Path: utzoo!dciem!nrcaer!scs!spl1!laidbak!att!pacbell!ames!mailrus!tut.cis.ohio-state.edu!bloom-beacon!mit-eddie!uw-beaver!ssc-vax!uvicctr!tholm From: tholm@uvicctr.UUCP (Terrence W. Holm) Newsgroups: comp.os.minix Subject: man(1) Message-ID: <434@uvicctr.UUCP> Date: 2 Jun 88 00:45:47 GMT Article-I.D.: uvicctr.434 Reply-To: tholm@uvicctr.UUCP (Terrence W. Holm) Organization: University of Victoria, Victoria B.C. Canada Lines: 194 EFTH Minix report #18 - June 1988 - man(1) This is an implementation of man(1) that we wrote for Minix. Please consider this a public domain program. "man" pages are included. NOTES: The man(1) script assumes that the man files are under /usr/man/cat[1-4]. Change this as required for your system. The man(1) script is too slow on an XT. The makewhatis(1) script assumes that man files begin with: NAME command(1) - what it is You will have to change the "for" loop in makewhatis(1) if your system is different. echo x - man.1 gres '^X' '' > man.1 << '/' XNAME X man(1) - print manual pages X XSYNOPSIS X man [ section ] file X man -f name X man -k key X XDESCRIPTION X The manual pages associated with "file" will be sent to X standard output. Usually the sections for commands (1), X system calls (2), subroutines (3) and structures (4) are X checked. The "section" option forces only the specified X section to be used. X X If the standard output is a terminal then more(1) is used X to display the manual pages, otherwise cat(1) is used. X X The "-f name" option generates a one line description of X what "name" is used for. This is the same as "whatis name". X X The "-k key" option displays a one line description of any X man page using the keyword "key". X X The "-f" and "-k" options search the file "/usr/man/whatis". X This file must be remade using "makewhatis" whenever a X relevant change occurs in the manual pages. X XFILES X /usr/man/cat[1-4]/*.[1-4] X /usr/man/whatis X XSEE ALSO X more(1), whatis(1) / echo x - whatis.1 gres '^X' '' > whatis.1 << '/' XNAME X whatis(1) - what is this name used for X XSYNOPSIS X whatis name X makewhatis X XDESCRIPTION X A one line description of the command, system call or X subroutine called "name" is displayed. X X The command "whatis name" is the same as "man -f name". X X This command searches the file "/usr/man/whatis" for "name". The X file must be remade using "makewhatis" whenever a relevant change X occurs in the manual pages. X XFILES X /usr/man/whatis X XSEE ALSO X man(1) / echo x - man gres '^X' '' > man << '/' X#!/bin/sh X# man(1) efth 1988-Apr-20 X# X# man [ section ] file X# man -f name X# man -k key X XMAN=/usr/man X X# Check if standard output is a terminal X Xif tty -s <&1; then X CAT=more Xelse X CAT=cat Xfi X Xif test $# -eq 1; then X for SECT in 1 2 3 4; do X if test -r $MAN/cat$SECT/$1.$SECT; then X $CAT $MAN/cat$SECT/$1.$SECT X exit 0 X fi X done X X echo "No manual entry for $1." X exit 1 Xfi X Xif test $# -ne 2; then X echo "Usage: man [ section ] file" X echo " man -f name" X echo " man -k key" X exit 1 Xfi X Xif test .$1 = .-f; then X grep "^ *$2[ (]" $MAN/whatis | $CAT X Xelif test .$1 = .-k; then X grep "$2" $MAN/whatis | $CAT X Xelse # Must be "man section file" X X if test $1 -lt 1 -o $1 -gt 4; then X echo "Sections are: (1) commands" X echo " (2) system calls" X echo " (3) subroutines" X echo " (4) structures" X exit 1 X fi X X if test -r $MAN/cat$1/$2.$1; then X $CAT $MAN/cat$1/$2.$1 X else X echo "No entry for $2 in section $1 of the manual." X exit 1 X fi X Xfi X Xexit 0 / echo x - makewhatis gres '^X' '' > makewhatis << '/' X#!/bin/sh X# makewhatis(1) efth 1988-Apr-20 X XMAN=/usr/man X Xif test `whoami` != root; then X echo "makewhatis: must be root" X exit 1 Xfi X Xif test `pwd` != $MAN; then X cd $MAN X makewhatis X exit 0 Xfi X Xrm -f whatis X Xfor file in cat?/*; do X head -2 $file | tail -1 >>whatis Xdone X Xchmod 644 whatis Xchown bin whatis / echo x - whatis gres '^X' '' > whatis << '/' X#!/bin/sh X# whatis(1) efth 1988-Apr-20 X# X# whatis name X Xman -f $1 / -------------------------------------------------------------------- Edwin L. Froese uw-beaver!ubc-cs!mprg!handel!froese Terrence W. Holm {uw-beaver,ubc-cs}!uvicctr!sirius!tholm