Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Few newbie questions..



On Aug 21, 12:34am, Vincent Lefevre wrote:
} Subject: Re: Few newbie questions..
}
} On Sat, Aug 18, 2001 at 03:25:13 +0000, Bart Schaefer wrote:
} > 
} >     zsh% man 7 lo<TAB>
} 
} But this doesn't work under Solaris, where you need the -s option.

Try this patch.  It handles -s, -S, and $MANSECT.  However, I don't
know what it does with the awk stuff in _man_pages -- it's possible
that the assignment to $awk needs to be adjusted as well.


Index: Completion/Unix/Command/_man
===================================================================
--- Completion/Unix/Command/_man	2001/07/10 09:05:14	1.3
+++ Completion/Unix/Command/_man	2001/08/21 02:48:25
@@ -22,9 +22,18 @@
 
   mrd=(${^manpath/\%L/${LANG:-En_US.ASCII}}/mandb(N))
 
-  if [[ $words[2] = (<->*|1M|l|n) ]]; then
-    dirs=( $^manpath/(sman|man|cat)${words[2]}/ )
-    awk="\$2 == \"$words[2]\" {print \$1}"
+  local sect
+  if [[ $OSTYPE = solaris* ]]; then
+    sect=$words[$words[(i)-s]+1]
+  elif [[ -n ${sect:=$words[$words[(i)-S]+1]} || -n ${sect:=$MANSECT} ]]; then
+    if [[ $sect != ${sect::="${sect//:/|}"} ]]; then
+      sect="($sect)"
+    fi
+  fi
+
+  if [[ $sect = (<->*|1M|l|n) || $sect = \((*\|*)\) ]]; then
+    dirs=( $^manpath/(sman|man|cat)${~sect}/ )
+    awk="\$2 == \"$sect\" {print \$1}"
   else
     dirs=( $^manpath/(sman|man|cat)*/ )
     awk='{print $1}'


-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   



Messages sorted by: Reverse Date, Date, Thread, Author