shell script implementation of man

Bernhard Reutner-Fischer rep.dot.nop at gmail.com
Wed Nov 19 14:37:29 UTC 2008


On Wed, Nov 19, 2008 at 09:15:51AM -0500, Matthew Hiles wrote:
>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.

the proper legal wording can be found in any file, like (preferably):
/*
 * foo - describe what foo does
 * Copyright (c) 2008 Your Name
 *
 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
 */


I assume that you did not see miscutils/man.c, i fear.

>#!/bin/sh
>
>## man - a simple man program for busybox
>##       this does NOT handle nroff pages,
>##       only simple asii pages

s/asii/ascii/
>
>## 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

This should default to /usr/share/man

>        MANPATH=/usr/local/man
>fi
>
>case $# in
>1)

Did you test this with msh ?



More information about the busybox mailing list