So I saw this in the TODO file: >man > It would be nice to have a man command. Not one that handles troff or > anything, just one that can handle preformatted ascii man pages, possibly > compressed. This could probably be a script in the extras directory that > calls cat/zcat/bzcat | less > > (How doclifter might work into this is anybody's guess.)
So here is my first test version. I've verified it works with busybox 1.13. Obviously it can be trimmed down some to save space and needs proper legal wordage. #!/bin/sh ## man - a simple man program for busybox ## this does NOT handle nroff pages, ## only simple asii pages ## Copyright (c) 2008, Matthew Hiles, insert proper busybox license here. ## requires: find, head, sort, tr, grep/egrep, and less ## optional: zcat, bzcat #check to see if MANPATH is set and show warning if not if [ -z $MANPATH ]; then echo "Warning: MANPATH is not set, assuming /usr/local/man." >&2 MANPATH=/usr/local/man fi case $# in 1) pagearg=$1 ;; 2) section=man$1 pagearg=$2 ;; *) echo "Usage: man [section] <manpage>" exit esac pagefile=$( find $( echo "$MANPATH" | tr ":" " " ) | grep "/$section" | grep "/$pagearg\." | sort | head -n1 ) if [ -z $pagefile ]; then echo -n No manual entry for $pagearg [ $section ] && echo -n " in section $1 of the manual." echo exit fi #okay, found the page, try decompressing and displaying case $pagefile in *.bz2) bzcat $pagefile | less ;; *.gz) zcat $pagefile | less ;; *) less $pagefile ;; esac _______________________________________________ busybox mailing list busybox@busybox.net http://busybox.net/cgi-bin/mailman/listinfo/busybox