I've always thought that specifying sections via "man -s 1 man" or "man 1 man" was ugly, and didn't work very well with filename completion. Diff relative to /usr/src/gnu/usr.bin/man to also handle the syntax of "man man.1":
--- man_old/man.c Sat Jul 19 17:17:13 2003 +++ man/man.c Sat Jul 19 18:08:23 2003 @@ -149,6 +149,8 @@ void do_apropos (); void do_whatis (); int man (); + int arglength = 0; + int i;
prognam = mkprogname (argv[0]); longsec = NULL; @@ -200,6 +202,23 @@
continue;
}
+
+ /* handle a section specified as "man.1" */
+ arglength = strlen(nextarg);
+
+ for (i = arglength; i > 0 ; i--) {
+ if (nextarg[i] == '.') {
+ tmp = is_section (&(nextarg[i + 1]), manp);
+ if (tmp != NULL) {
+ shortsec = tmp;
+ nextarg[i] = '\0';
+
+ if (debug)
+ fprintf (stderr, "\nsection (via suffix): %s\n", shortsec);
+ }
+ break;
+ }
+ } if (apropos) {
do_apropos (nextarg);
--- man_old/version.h Sat Jul 19 17:17:13 2003
+++ man/version.h Sat Jul 19 18:28:07 2003
@@ -14,4 +14,4 @@
* Austin, Texas 78712
*/-static char version[] = "1.1"; +static char version[] = "1.2";
--
This patch seems to handle boundary cases like rc.i386 (which at least somewhat resembles a section number :-) properly.
-- -Chuck
PS: People using ZSH will find the following completion script very handy in conjunction with the above, as it provides tab-based completion for manpages:
# Manual page completion
man_glob () {
local a
read -cA a
if [[ $a[2] = [0-9]* ]] then
reply=( $^manpath/man$a[2]/$1*$2(N:t:r) )
else
reply=( $^manpath/man*/$1*$2(N:t:r) )
fi
}compctl -K man_glob man
_______________________________________________ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to "[EMAIL PROTECTED]"
