Bug 44435

Summary: sysctl manpage: add example for tcsh
Product: Documentation Reporter: Slaven Rezic <eserte>
Component: Books & ArticlesAssignee: freebsd-doc (Nobody) <doc>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description Slaven Rezic 2002-10-24 15:30:01 UTC
	Add the completion example for sysctl's -N option also for tcsh.
	At least, tcsh is in the base system while zsh is not.
Comment 1 Giorgos Keramidas freebsd_committer freebsd_triage 2002-11-21 02:20:42 UTC
The suggested command doesn't work on the tcsh prompt for me, but it
does work if put it in my .tcshrc file.  Do you mind if I commit a
slightly different patch than the one in the PR?  One that explicitly
mentions .tcshrc like below:

%%%
Index: sysctl.8
===================================================================
RCS file: /home/ncvs/src/sbin/sysctl/sysctl.8,v
retrieving revision 1.47
diff -u -r1.47 sysctl.8
--- sysctl.8	6 Jul 2002 19:35:04 -0000	1.47
+++ sysctl.8	21 Nov 2002 02:15:07 -0000
@@ -95,6 +95,15 @@
 listsysctls () { set -A reply $(sysctl -AN ${1%.*}) }
 compctl -K listsysctls sysctl
 .Ed
+.Pp
+or if you are using
+.Nm tcsh
+as your shell, add the following to your
+.Pa .tcshrc
+file:
+.Bd -literal -offset indent
+complete sysctl 'n/*/`sysctl -Na`/'
+.Ed
 .It Fl n
 Show only variable values, not their names.
 This option is useful for setting shell variables.
%%%
Comment 2 slaven.rezic 2002-11-21 08:14:21 UTC
Giorgos Keramidas <keramida@freebsd.org> writes:

> The suggested command doesn't work on the tcsh prompt for me, but it
> does work if put it in my .tcshrc file.

Strange, the example works for me in the command line.

>  Do you mind if I commit a
> slightly different patch than the one in the PR?  One that explicitly
> mentions .tcshrc like below:

That's OK with me --- putting it into .tcshrc will be the common case.

Regards,
	Slaven

> %%%
> Index: sysctl.8
> ===================================================================
> RCS file: /home/ncvs/src/sbin/sysctl/sysctl.8,v
> retrieving revision 1.47
> diff -u -r1.47 sysctl.8
> --- sysctl.8	6 Jul 2002 19:35:04 -0000	1.47
> +++ sysctl.8	21 Nov 2002 02:15:07 -0000
> @@ -95,6 +95,15 @@
>  listsysctls () { set -A reply $(sysctl -AN ${1%.*}) }
>  compctl -K listsysctls sysctl
>  .Ed
> +.Pp
> +or if you are using
> +.Nm tcsh
> +as your shell, add the following to your
> +.Pa .tcshrc
> +file:
> +.Bd -literal -offset indent
> +complete sysctl 'n/*/`sysctl -Na`/'
> +.Ed
>  .It Fl n
>  Show only variable values, not their names.
>  This option is useful for setting shell variables.
> %%%
> 

-- 
Slaven Rezic - slaven.rezic@berlin.de

    tkrevdiff - graphical display of diffs between revisions (RCS or CVS)
    http://ptktools.sourceforge.net/#tkrevdiff
Comment 3 Giorgos Keramidas freebsd_committer freebsd_triage 2002-11-21 11:31:10 UTC
On 2002-11-21 01:40, Slaven Rezic <slaven.rezic@berlin.de> wrote:
>Slaven Rezic <slaven.rezic@berlin.de> wrote:
>>Giorgos Keramidas <keramida@freebsd.org> writes:
>>> The suggested command doesn't work on the tcsh prompt for me, but it
>>> does work if put it in my .tcshrc file.
>>
>>Strange, the example works for me in the command line.

Pilot error.  I moved my .tcshrc and .cshrc out of the way and it
works for me too.  Your diff looks fine, sorry 'bout the confusion :/
Comment 4 simon 2003-05-26 00:53:50 UTC
In the name of close a doc PR.

I think this seems like a very good idea to add.  I didn't know about
the feature but this code is certainly going to my .tcshrc now.

I would suggest to reference tcsh(1) with Xr instead of using ".Nm
tcsh" like :

%%%
--- sbin/sysctl/sysctl.8.orig	Thu Oct 24 16:09:29 2002
+++ sbin/sysctl/sysctl.8	Thu Oct 24 16:11:22 2002
@@ -93,6 +93,13 @@
 listsysctls () { set -A reply $(sysctl -AN ${1%.*}) }
 compctl -K listsysctls sysctl
 .Ed
+.Pp
+or in
+.Xr tcsh 1 ,
+the following code:
+.Bd -literal -offset indent
+complete sysctl 'n/*/`sysctl -Na`/'
+.Ed
 .It Fl n
 Show only variable values, not their names.
 This option is useful for setting shell variables.
%%%

Just my 0.02c.

-- 
Simon L. Nielsen
With no PGP since GNATS don't like mime patches.
Comment 5 Hiten Pandya freebsd_committer freebsd_triage 2004-12-05 23:44:58 UTC
State Changed
From-To: open->closed

A variation of the original patch was committed by few moments ago. 

Thank you!