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

Re: Few newbie questions..



On Aug 21, 10:27am, Borsenkow Andrej wrote:
}
} > 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.
} 
} No, it should be O.K.

Except, of course, that I forgot the fallback condition.  Here's the
more correct patch (the missing bit was

+  else
+    sect=$words[2]

).

Index: Completion/Unix/Command/_man
===================================================================
--- Completion/Unix/Command/_man	2001/07/10 09:05:14	1.3
+++ Completion/Unix/Command/_man	2001/08/21 06:35:55
@@ -22,9 +22,20 @@
 
   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
+  else
+    sect=$words[2]
+  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