slitaz-tools rev 232

man: add usage
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Jul 11 19:27:59 2008 +0000 (2008-07-11)
parents addef667cbef
children c1d9f377135b
files tinyutils/man
line diff
     1.1 --- a/tinyutils/man	Fri Jul 11 15:10:34 2008 +0000
     1.2 +++ b/tinyutils/man	Fri Jul 11 19:27:59 2008 +0000
     1.3 @@ -1,4 +1,12 @@
     1.4  #!/bin/sh
     1.5 +
     1.6 +case "$1" in
     1.7 +''|-*)
     1.8 +	cat <<EOT
     1.9 +Usage: man [section] command
    1.10 +EOT
    1.11 +	exit 1;;
    1.12 +esac
    1.13  SECTION=all
    1.14  if [ -n "$2" ]; then
    1.15  	SECTION=$1
    1.16 @@ -7,4 +15,4 @@
    1.17  TOPIC=$1
    1.18  wget -O - "http://man.he.net/?topic=$TOPIC&section=$SECTION" 2> /dev/null | \
    1.19  awk 'BEGIN { s=0 } /<PRE>/ { s=1 } { if (s) print } /<\/PRE>/ { s=0 }' | \
    1.20 -sed -e 's/<[^>]*>//g' -e 's/&lt;/</g' -e 's/&gt;/>/g' -e 's/&amp;/\&/g' | less
    1.21 +sed -e 's/<[^>]*>//g' -e 's/&lt;/</g' -e 's/&gt;/>/g' -e 's/&amp;/\&/g' | less -M