slitaz-base-files rev 67
Move man alias to /usr/bin/man
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Sat Jun 13 20:45:03 2009 +0200 (2009-06-13) |
parents | f2ec7a93b8a6 |
children | 2a0252eb0b37 |
files | rootfs/etc/profile rootfs/usr/bin/man |
line diff
1.1 --- a/rootfs/etc/profile Thu Apr 16 19:45:51 2009 +0200 1.2 +++ b/rootfs/etc/profile Sat Jun 13 20:45:03 2009 +0200 1.3 @@ -11,8 +11,8 @@ 1.4 PS1='\u@\h:\w\$ ' 1.5 else 1.6 # Light green and blue colored prompt. 1.7 - PS1="\[\e[1;32m\]\u@\h\[\e[0m\]:\[\e[1;34m\]\w\[\e[0m\]\$ " 1.8 - #PS1='\u@\h:\w\$ ' 1.9 + #PS1="\[\e[1;32m\]\u@\h\[\e[0m\]:\[\e[1;34m\]\w\[\e[0m\]\$ " 1.10 + PS1='\u@\h:\w\$ ' 1.11 fi 1.12 1.13 # Max 64M for programs (prevent memory leak crashs) 1.14 @@ -28,61 +28,6 @@ 1.15 # 1.16 which ldd > /dev/null || alias ldd='LD_TRACE_LOADED_OBJECTS=1 /lib/ld*.so' 1.17 1.18 -# man fake 1.19 -# 1.20 -if [ ! -x /usr/bin/man ]; then 1.21 - 1.22 -man() 1.23 -{ 1.24 -local i 1.25 -local SECTION 1.26 -local MSG 1.27 -local TOPIC 1.28 -local MAN_SECTION 1.29 -case "$1" in 1.30 -''|-*) 1.31 - cat <<EOT 1.32 - Usage: man [section] command 1.33 -EOT 1.34 - return;; 1.35 -esac 1.36 -SECTION=all 1.37 -MAN_SECTION='*' 1.38 -MSG="" 1.39 -if [ -n "$2" ]; then 1.40 - SECTION=$1 1.41 - MAN_SECTION=$1 1.42 - MSG=" in section $SECTION" 1.43 - shift 1.44 -fi 1.45 -TOPIC=$1 1.46 -if [ -x /usr/bin/retawq -a -f /usr/share/doc/$TOPIC/$TOPIC.html ]; then 1.47 - retawq --dump=file:///usr/share/doc/$TOPIC/$TOPIC.html | less -M 1.48 - return 1.49 -fi 1.50 -for i in /usr/share/$LC_ALL/man$MAN_SECTION /usr/share/man$MAN_SECTION; do 1.51 - if [ -f $i/raw-$TOPIC.* ]; then 1.52 - i=$(ls $i/raw-$TOPIC.*) 1.53 - case "$i" in 1.54 - *gz) (zcat $i || unlzma -c $i 2> /dev/null) | less -M;; 1.55 - *) less -M $i;; 1.56 - esac 1.57 - return 1.58 - fi 1.59 - if [ -x /usr/bin/retawq -a -f $i/$TOPIC.html ]; then 1.60 - retawq --dump=file://$i/$TOPIC.html | less -M 1.61 - return 1.62 - fi 1.63 -done 1.64 -(wget -O - "http://mirror.slitaz.org/man/$SECTION/$TOPIC.html" || \ 1.65 - wget -O - "http://man.he.net/?topic=$TOPIC§ion=$SECTION") 2> /dev/null | \ 1.66 - 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.67 - sed -e 's/<[^>]*>//g' -e 's/</</g' -e 's/>/>/g' -e 's/&/\&/g' | less -M 1.68 -} 1.69 - 1.70 -fi 1.71 - 1.72 - 1.73 # Export all variables defined above and set mask. 1.74 # 1.75 export PATH LD_LIBRARY_PATH PS1 DISPLAY G_FILENAME_ENCODING ignoreeof
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/rootfs/usr/bin/man Sat Jun 13 20:45:03 2009 +0200 2.3 @@ -0,0 +1,67 @@ 2.4 +#!/bin/sh 2.5 +# 2.6 +# Tiny man fake using online manuals. 2.7 +# (c) 2009 SliTaz GNU/Linux. 2.8 +# 2.9 + 2.10 +if [ ! -x /usr/bin/retawq ]; then 2.11 + echo -e "\nMissing Retawq webbrouwser..." 2.12 + echo -e "Please run: su -c 'tazpkg get-install retawq'\n" 2.13 + exit 0 2.14 +fi 2.15 + 2.16 +local i 2.17 +local SECTION 2.18 +local MSG 2.19 +local TOPIC 2.20 +local MAN_SECTION 2.21 + 2.22 +case "$1" in 2.23 + ''|-*) 2.24 + cat <<EOT 2.25 + 2.26 +Usage: man [section] command 2.27 + 2.28 +EOT 2.29 + return ;; 2.30 +esac 2.31 + 2.32 +SECTION=all 2.33 +MAN_SECTION='*' 2.34 +MSG="" 2.35 + 2.36 +if [ -n "$2" ]; then 2.37 + SECTION=$1 2.38 + MAN_SECTION=$1 2.39 + MSG=" in section $SECTION" 2.40 + shift 2.41 +fi 2.42 + 2.43 +TOPIC=$1 2.44 + 2.45 +if [ -x /usr/bin/retawq -a -f /usr/share/doc/$TOPIC/$TOPIC.html ]; then 2.46 + retawq --dump=file:///usr/share/doc/$TOPIC/$TOPIC.html | less -M 2.47 + return 2.48 +fi 2.49 + 2.50 +for i in /usr/share/$LC_ALL/man$MAN_SECTION /usr/share/man$MAN_SECTION; do 2.51 + if [ -f $i/raw-$TOPIC.* ]; then 2.52 + i=$(ls $i/raw-$TOPIC.*) 2.53 + case "$i" in 2.54 + *gz) (zcat $i || unlzma -c $i 2> /dev/null) | less -M;; 2.55 + *) less -M $i;; 2.56 + esac 2.57 + return 2.58 + fi 2.59 + if [ -x /usr/bin/retawq -a -f $i/$TOPIC.html ]; then 2.60 + retawq --dump=file://$i/$TOPIC.html | less -M 2.61 + return 2.62 + fi 2.63 +done 2.64 + 2.65 +(wget -O - "http://mirror.slitaz.org/man/$SECTION/$TOPIC.html" || \ 2.66 + wget -O - "http://man.he.net/?topic=$TOPIC§ion=$SECTION") 2> /dev/null | \ 2.67 + 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\" }" | \ 2.68 + sed -e 's/<[^>]*>//g' -e 's/</</g' -e 's/>/>/g' -e 's/&/\&/g' | less -M 2.69 + 2.70 +exit 0