u31b3hs@cip-s04.informatik.rwth-aachen.de (Michael Haardt) (08/02/90)
Hello world! This is my first posting, so I hope that everything is ok. While doing the Minix upgrade from 1.3 to 1.5.10, I found there is no man command, with a proper database as under UNIX. For this reason I wrote a shellscript which works as follows: There should be a /usr/man and a /usr/catman directory, each with the man[1-9] subdirectories. If no chapter is given when called, my man looks at first for a catman/man1 entry. If this fails, the man/man1 directory will be used and the page would be nroffed before output etc... For getting the catman/man[1-9] entries, I wrote a little c program which converts the MINIX-man files into "proper" man files. The files will still have to be placed into the correct directories, but what's a shell for, anyway!?! The advantage of my shellscript over the MINIX-man command is that you can easily extend the manuals for local programs. If Andy can't post the nroff sources, his formatted pages will be in catman, but any other author should publish nroff texts. MINIX-man needs the "al"-capability, but my vt101 misses something like that. Each manual will be accessible with this command. Ok, this is what I am talking about: ---- snip here ---- or cut ----- killing to this line would be ok too ---- cd /usr N=nroff s=1 for i do case $i in [1-9]*) s=$i;; -t) N=troff;; -n) N=nroff;; -*) echo Unknown option \"$i\";; *) if test -f catman/man$s/$i.$s then cat catman/man$s/$i.$s else if test -f man/man$s/$i.$s then ${N} -man man/man$s/$i.$s else found=no for j in 1 2 3 4 5 6 7 8 9 do if test -f catman/man$j/$i.$j then found=yes; cat catman/man$j/$i.$j else if test -f man/man$j/$i.$j then found=yes ${N} -man man/man$j/$i.$j fi fi done case $found in no) echo $i: no manual page found esac fi fi esac done ----- you guessed it ----- cutting again ------------------------------------- #include <stdio.h> main() { char line[256],*s; FILE *output = NULL; while (gets(line)!=NULL) { if (*line == '#') { s=line+1; while (*s == ' ') s++; if (output != NULL) fclose(output); printf("%s - %s\n",s,(output=fopen(s,"w"))==NULL ? "error" : "ok"); } else fprintf(output,"%s\n",s); } close(output); } ------------------------------------------------------------------------------ Flames will be moved to /dev/null on my machine. Send any other comments to u31b3hs@cip-s01.informatik.rwth-aachen.de (Michael Haardt) -------------------------------- ciao ----------------------------------------