zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <opk@u.genie.co.uk>
To: Akinori MUSHA <knu@iDaemons.org>
Cc: zsh-workers@sunsite.dk
Subject: Re: a compdef for FreeBSD's sysctl(8) command
Date: Tue, 03 Jul 2001 11:49:02 +0100	[thread overview]
Message-ID: <3B41A31E.ED8B154E@u.genie.co.uk> (raw)
In-Reply-To: <86y9q6d0fz.wl@archon.local.idaemons.org>

Akinori MUSHA wrote:

> Attached is a compdef for FreeBSD's sysctl(8) command which gets or
> sets kernel state.  It was reviewed in a public mailing list.
> 
> Would you please merge this?

Thanks, I'll merge that a bit later.

First though, I've just tried to adapt it to also work for Linux. I
also replaced your function with a substitution which I think should
do the same thing so I would appreciate if you could check that the
updated function below still works.

I don't suppose that $OSTYPE on FreeBSD includes any of the FreeBSD
version. It is just that it is a tiny bit faster to check than
`uname -sr`?

If `sysctl -A' or `sysctl -aN' is run as a non-root user, do you get
any output to stderr (you do on Linux)? If so, we need to add a
redirection.

Does anyone on zsh-workers mind if I put this on the stable branch.
Mainly because I suspect the FreeBSD folks would otherwise be
maintaining it as a patch for their port.

Oliver

#compdef sysctl

case `uname -sr` in
  FreeBSD\ [0-4].*)
    _arguments -s \
      '-a[list all]' \
      '-A[show all opaques (values suppressed)]' \
      '-b[binary output]' \
      '-n[show only variable values]' \
      '-w[write mode]' \
      '-X[show all opaques (entire values)]' \
      "*:sysctl variable:compadd ${words[(r)-w]:+-S =} $(sysctl -A | sed 's/:.*//')"
  ;;
  FreeBSD\ [5-9].*)
    _arguments -s \
      '-a[list all]' \
      '-b[binary output]' \
      '-N[show only variable names]' \
      '-n[show only variable values]' \
      '-o[show opaques as well (values suppressed)]' \
      '-x[show opaques as well (entire values)]' \
      '*:sysctl variable:compadd -S "" - $(sysctl -aN)'
  ;;
  Linux*)
    _arguments -A "-*" \
      '-n[show only variable values]' \
      '(-n -p -a -A)-w[write mode]' \
      '(-n -w -a -A *)-p[specify file to load sysctl settings from]:file:_files' \
      '(-n -w -p -A *)-a[list all]' \
      '(-n -w -p -a *)-A[list all in table form]' \
      '(-n -p -a -A)*:sysctl variable:_files -W /proc/sys'
  ;;
esac

_____________________________________________________________________
This message has been checked for all known viruses by the 
MessageLabs Virus Scanning Service. For further information visit
http://www.messagelabs.com/stats.asp


  parent reply	other threads:[~2001-07-03 10:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-03  5:52 Akinori MUSHA
2001-07-03  6:31 ` Andrej Borsenkow
2001-07-03 10:49 ` Oliver Kiddle [this message]
2001-07-03 11:16   ` Akinori MUSHA
2001-07-03 16:28     ` Bart Schaefer
2001-07-03 18:27       ` Akinori MUSHA
2001-07-04  8:46       ` Sven Wischnowsky
2001-07-05 11:04         ` PATCH: " Oliver Kiddle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3B41A31E.ED8B154E@u.genie.co.uk \
    --to=opk@u.genie.co.uk \
    --cc=knu@iDaemons.org \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).