man ls- Not Busybox?


Forum: User Feedback
Topic: man ls- Not Busybox?
started by: chaostic

Posted by chaostic on May 17 2008,09:47
DSL 3.4.11, gnu-utils.dsl loaded.

When you do "man ls", it returns:
 This is not a BusyBox application.
then it opens up the online netrik man page.

I thought it was an issue with the dsl man script, but it turns out that it is a symlink issue that confuses the man script. /bin/ls is symlinked to "busybox" while every other busybox app is symlinked to "/bin/busybox". The man script expects it to be /bin/busybox (or atleast, the second entry in a array to be busybox).

So, fix the symlink, or change the man script to check if it's a symlink to just "busybox" instead of only "/\/busybox/". I don't know enough perl (natch: or any :P) to offer my own fix.

But, since we are talking about the man script, how hard would it be to add two new flags to it? -o and -b.

-o would force it to check for the app online, even if its in bb, while -b would force to check the bb man page for it.

I'm thinking all it needs is:

Code Sample

# Force online
if ( $app  =~ /^-o$|^--online$/ ) {
    print "Forcing online man check...\n";
    sleep 2;
    $app =  $ARGV[1];
    $grab = $MANUAL . $app . '&section=all';
    system("netrik \"$grab\" 2>/dev/null");
    exit;
}

# Force BB
if ( $app  =~ /^-b$|^--busybox$/ ) {
    print "Forcing BusyBox man check...\n";
    sleep 2;
    $app =  $ARGV[1];
    $grab = 'http://www.busybox.net/downloads/BusyBox.html#item_' . $app;
    system("netrik \"$grab\" 2>/dev/null");
    exit;
}


This would be added after the check for -h/--help and before the actual busybox check.

Oh, and last small man related question, shouldn't there be a backdated copy of the busybox online man page that matches the options available for the v1.2.2 busybox that dsl uses, instead of the 1.10 that is current? Sure the changes arn't that big, but for consistency (and nitpickings :P) sake...


edit: A quick nano on a copy of the man script confirms that the -o and -b code works as expected.

Also, I found a nice Freebsd online man page that can be used by this script (I use OSX which uses freebsd tools that I need to check for), but I'll keep that to myself unless someone wants it (Cause why would dsl need to be able to get freebsd man pages? :P)

edit 2: I also finally got around to figuring out how to change the website used by the man script to the nicer linux.die.net man pages (It redirects < http://linux.die.net/man/$app > to < http://linux.die.net/man/$n/$app > depending on which man section the app belongs to, which prevented me from using it before.) Pm if you want it, or ask and I'll add the change (or change if using a flag).

Posted by humpty on May 18 2008,12:20
i think gnu-utils's 'ls' is not actually part of busybox.
therefore wouldn't it be right to report that it is not ?

Posted by ^thehatsrule^ on May 18 2008,20:28
Quote
/bin/ls is symlinked to "busybox" while every other busybox app is symlinked to "/bin/busybox".

Posted by roberts on May 18 2008,21:25
The symlink will be changed to accomodate the man script.
So man.he.net is no longer working and we now wish to change again, this time, to linux.die.net/man/1/ ?

Posted by chaostic on May 19 2008,04:34
Quote (roberts @ May 18 2008,17:25)
The symlink will be changed to accomodate the man script.
So man.he.net is no longer working and we now wish to change again, this time, to linux.die.net/man/1/ ?

No, man.he.net is still working. It is just "not as pretty" as linux.die.net, (imho!). I threw that in my message just incase someone would prefer that instead (Hence the PM part).

If it were changed though, it would be:
"netrik "http://linux.die.net/man/$app" 2>/dev/null"
The linux.die.net server automatically finds which man section it belongs in, silently redirecting you to "http://linux.die.net/man/?/$app".
You can double check by going to
"http://linux.die.net/man/ls" and "http://linux.die.net/man/socket"
which redirect to /1/ls and /3/socket, respectfully.

--
Re: Humpty, gnu-utils.dsl only updates some (most) of the base commands, not all (in this case, ls). The core-utils.uci replaces all of them.


edit:
If you wanted to use linux.die.net instead, the full changes would be:

Code Sample

my $MANUAL='http://linux.die.net/man/';

---snip---

else {
   print "This is not a BusyBox application.\n";
   sleep 1;
   $grab = $MANUAL . $app;
#print $grab . "\n"; exit;

}
if ($app=~/^\w+$/) {
       system("netrik \"$grab\" 2>/dev/null");
}
else {
print $usage;
exit;
}
---eof---

Posted by mikshaw on May 19 2008,08:15
A *very* simplified man bash script for die.net:
Code Sample
[ -n "$1" ] && exec netrik "http://linux.die.net/man/$1"

It's probably not suitable for everyone, but it suits me =o)

I'd probably add an optional integer argument for specifying a man section, but didn't bother for the moment.

Posted by mikshaw on June 25 2008,04:12
Found it was much more convenient to keep a local copy, so it now saves the html automatically.
Code Sample
manserver="http://linux.die.net/man"
mandir="/home/shared/reference/man_pages"

[ -n "$1" ] || exit
if [ ! -r "$mandir/$1.html" ]; then
 wget "$manserver/$1" -O "$mandir/$1.html"
fi
exec netrik "$mandir/$1.html"

Posted by jpeters on June 25 2008,06:40
Barry Kauler has a nice script that first searches for txt or htm* files in /usr/share/doc directory before going online:

#!/bin/sh
#Barry Kauler 2006. written for puppyos, www.puppyos.com
#a script to replace the man command.

# -iname option is case-insensitive, -name is case-sensitive.

BBAPPLETS="|addgroup|adduser|adjtimex|ar|arping|ash|awk|basename|bunzip2|busybox|bzcat|cal|cat|chgrp|chmod|chown|chroot|chvt|clear|cmp|cp|cpio|crond|crontab|cut|date|dc|dd|deallocvt|delgroup|deluser|devfsd|df|dirname|dmesg|dos2unix|dpkg|dpkg-deb|du|dumpkmap|dumpleases|echo|egrep|env|expr|false|fbset|fdflush|fdformat|fdisk|fgrep|find|fold|free|freeramdisk|fsck.minix|ftpget|ftpput|getopt|getty|grep|gunzip|gzip|halt|hdparm|head|hexdump|hostid|hostname|httpd|hush|hwclock|id|ifconfig|ifdown|ifup|inetd|init|insmod|install|ip|ipaddr|ipcalc|iplink|iproute|iptunnel|kill|killall|klogd|lash|last|length|linuxrc|ln|loadfont|loadkmap|logger|login|logname|logread|losetup|ls|lsmod|makedevs|md5sum|mesg|mkdir|mkfifo|mkfs.minix|mknod|mkswap|mktemp|modprobe|more|mount|msh|mt|mv|nameif|nc|netstat|nslookup|od|openvt|passwd|patch|pidof|ping|ping6|pipe_progress|pivot_root|poweroff|printf|ps|pwd|rdate|readlink|realpath|reboot|renice|reset|rm|rmdir|rmmod|route|rpm|rpm2cpio|run-parts|rx|sed|seq|setkeycodes|sha1sum|sleep|sort|start-stop-daemon|strings|stty|su|sulogin|swapoff|swapon|sync|sysctl|syslogd|tail|tar|tee|telnet|telnetd|test|tftp|time|top|touch|tr|traceroute|true|tty|udhcpc|udhcpd|umount|uname|uncompress|uniq|unix2dos|unzip|uptime|usleep|uudecode|uuencode|vconfig|vi|vlock|watch|watchdog|wc|wget|which|who|whoami|xargs|yes|zcat|"

SYMLNKS="`find /usr/share/doc -maxdepth 1 -type l | tr "\n" " "`"

FNDTXT="`find /usr/share/doc -maxdepth 3 -mount -xtype f -iname ${1}.txt`"
#find does not follow symlinks in paths unless followed by at least a "/", need this crap...
if [ "$FNDTXT" = "" ];then
for ONELNK in $SYMLNKS
do
 [ ! "`echo -n "$ONELNK" | grep -i "${1}.txt$"`" = "" ] && FNDTXT="$ONELNK"
 [ ! "$FNDTXT" = "" ] && break
 FNDTXT="`find ${ONELNK}/  -mount -maxdepth 3 -xtype f -iname ${1}.txt`"
 [ ! "$FNDTXT" = "" ] && break
done
fi
if [ "$FNDTXT" != "" ];then
exec defaulttextviewer "$FNDTXT"
else
FNDHTM="`find /usr/share/doc -maxdepth 9 -mount -xtype f -iname ${1}.htm*`"
#v2.12 improved find code contributed by Dougal...
if [ "$FNDHTM" = "" ];then
  FNDDIR="`find /usr/share/doc -maxdepth 9 -mount -type d -iname ${1}*`"
  [ $? -eq 0 ] && [ -f $FNDDIR/index.html ] && FNDHTM=$FNDDIR/index.html
fi
#find does not follow symlinks in paths unless followed by at least a "/", need this crap...
if [ "$FNDHTM" = "" ];then
 for ONELNK in $SYMLNKS
 do
  [ ! "`echo -n "$ONELNK" | grep -i "${1}.htm"`" = "" ] && FNDHTM="$ONELNK"
  [ ! "$FNDHTM" = "" ] && break
  FNDHTM="`find ${ONELNK}/ -mount -maxdepth 3 -xtype f -iname ${1}.htm*`"
  [ ! "$FNDHTM" = "" ] && break
 done
fi

if [ ! "$FNDHTM" = "" ];then
 [ "`echo -n "$FNDHTM" | cut -b 1`" = "/" ] && FNDHTM=file://$FNDHTM
 exec defaulthtmlviewer "$FNDHTM"
else

 #v2.21 #maybe it is a busybox applet...
 #if [ ! "`echo -n "$BBAPPLETS" | grep "|${1}|"`" = "" ];then
 # exec defaulthtmlviewer file:///usr/share/doc/busybox.htm
 #else
 # exec defaulthtmlviewer file:///usr/share/doc/index.html
 #fi
 #exec defaulthtmlviewer < http://en.wikipedia.org/wiki/${1} >
 #exec defaulthtmlviewer < http://unixhelp.ed.ac.uk/CGI/man-cgi?${1} >
 #exec defaulthtmlviewer < http://threads.seas.gwu.edu/cgi-bin/man2web?program=${1} >
 exec defaulthtmlviewer < http://linux.die.net/man/${1} >
 
fi

fi

Powered by Ikonboard 3.1.2a
Ikonboard © 2001 Jarvis Entertainment Group, Inc.