I have been missing, inside ash, a short path response
from the type builtin:
$ type -p tail
/usr/bin/tail
The attached difference file ackomplishes this in a
somewhat cheating manner, since it only detect whether
the first argument of "type" begins with a dash, and then
verbosity is switched off.
I might be prejudiced, but the ASH_CMDCMD conditionals
inside typecmd() and describe_command() seem utterly
pointless, so they are removed in order to implement
this "short type" functionality.
Regards, Mats E A
--- shell/ash.c.svn 2007-05-03 12:24:04.563024520 +0200
+++ shell/ash.c 2007-05-03 12:26:25.864543424 +0200
@@ -6894,10 +6894,4 @@
*/
-#if ENABLE_ASH_CMDCMD
static int
describe_command(char *command, int describe_command_verbose)
-#else
-#define describe_command_verbose 1
-static int
-describe_command(char *command)
-#endif
{
@@ -6999,11 +6993,10 @@
{
- int i;
- int err = 0;
+ int i = 1;
+ int err = 0, verbose = 1;
- for (i = 1; i < argc; i++) {
-#if ENABLE_ASH_CMDCMD
- err |= describe_command(argv[i], 1);
-#else
- err |= describe_command(argv[i]);
-#endif
+ if ( *argv[1] == '-' )
+ i++, verbose = 0;
+
+ for ( ; i < argc; i++) {
+ err |= describe_command(argv[i], verbose);
}
_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox