From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21647 invoked from network); 3 Jul 2001 10:49:49 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 3 Jul 2001 10:49:49 -0000 Received: (qmail 29433 invoked by alias); 3 Jul 2001 10:48:49 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 15223 Received: (qmail 29421 invoked from network); 3 Jul 2001 10:48:48 -0000 X-VirusChecked: Checked Sender: kiddleo@cav.logica.co.uk Message-ID: <3B41A31E.ED8B154E@u.genie.co.uk> Date: Tue, 03 Jul 2001 11:49:02 +0100 From: Oliver Kiddle X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.15 i686) X-Accept-Language: en MIME-Version: 1.0 To: Akinori MUSHA CC: zsh-workers@sunsite.dk Subject: Re: a compdef for FreeBSD's sysctl(8) command References: <86y9q6d0fz.wl@archon.local.idaemons.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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