slitaz-tools rev 234

man: add 'No manual entry'
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Jul 12 09:22:54 2008 +0000 (2008-07-12)
parents c1d9f377135b
children 0d67ae872978
files tinyutils/man
line diff
     1.1 --- a/tinyutils/man	Fri Jul 11 19:42:05 2008 +0000
     1.2 +++ b/tinyutils/man	Sat Jul 12 09:22:54 2008 +0000
     1.3 @@ -8,11 +8,18 @@
     1.4  	exit 1;;
     1.5  esac
     1.6  SECTION=all
     1.7 +MSG=""
     1.8  if [ -n "$2" ]; then
     1.9  	SECTION=$1
    1.10 +	MSG=" in section $SECTION"
    1.11  	shift
    1.12  fi
    1.13  TOPIC=$1
    1.14 +#http://www.penguin-soft.com/penguin/man?q=$TOPIC&section=ALL&action=man
    1.15 +#http://linuxreviews.org/man/$TOPIC/index.html.en
    1.16 +#http://www.mediacollege.com/cgi-bin/man/page.cgi?topic=$TOPIC
    1.17 +#http://www.linuxcertif.com/man/$SECTION/$TOPIC/
    1.18 +#http://casper.ict.hen.nl/cgi-bin/man2html?+$TOPIC+$SECTION
    1.19  wget -O - "http://man.he.net/?topic=$TOPIC&section=$SECTION" 2> /dev/null | \
    1.20 -awk 'BEGIN { s=0 } /<PRE>/ { s=1 } { if (s) print } /<\/PRE>/ { s=0 }' | \
    1.21 +awk "BEGIN { s=0; n=0 } /<PRE>/ { s=1 } { if (s) { print; n++} } /<\/PRE>/ { s=0 } END { if (n == 0) print \"No manual entry for $TOPIC$MSG\" }" | \
    1.22  sed -e 's/<[^>]*>//g' -e 's/&lt;/</g' -e 's/&gt;/>/g' -e 's/&amp;/\&/g' | less -M