wok-current rev 7439
busybox: display command line in usage output
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Mon Nov 29 16:23:32 2010 +0100 (2010-11-29) |
parents | 0e2e3ac6caf1 |
children | e09be8676c88 |
files | busybox/receipt busybox/stuff/busybox-1.17.4-cmdline.u |
line diff
1.1 --- a/busybox/receipt Mon Nov 29 05:33:40 2010 +0000 1.2 +++ b/busybox/receipt Mon Nov 29 16:23:32 2010 +0100 1.3 @@ -30,6 +30,7 @@ 1.4 zmodules.u 1.5 usage.u 1.6 printable.u 1.7 +cmdline.u 1.8 EOT 1.9 cp ../stuff/$PACKAGE-$VERSION.config .config 1.10 make oldconfig
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/busybox/stuff/busybox-1.17.4-cmdline.u Mon Nov 29 16:23:32 2010 +0100 2.3 @@ -0,0 +1,37 @@ 2.4 +Display command line in usage output. Useful to debug scripts. 2.5 +--- busybox-1.17.4/libbb/appletlib.c 2.6 ++++ busybox-1.17.4/libbb/appletlib.c 2.7 +@@ -97,9 +97,16 @@ 2.8 + 2.9 + #endif /* FEATURE_COMPRESS_USAGE */ 2.10 + 2.11 +- 2.12 ++static char **bb_argv; 2.13 + void FAST_FUNC bb_show_usage(void) 2.14 + { 2.15 ++ full_write2_str("\nCommand line: "); 2.16 ++ while (*bb_argv) { 2.17 ++ full_write2_str(*bb_argv++); 2.18 ++ full_write2_str(" "); 2.19 ++ } 2.20 ++ full_write2_str("\n\n"); 2.21 ++ 2.22 + if (ENABLE_SHOW_USAGE) { 2.23 + #ifdef SINGLE_APPLET_STR 2.24 + /* Imagine that this applet is "true". Dont suck in printf! */ 2.25 +@@ -634,6 +641,7 @@ 2.26 + /* If we were called as "busybox..." */ 2.27 + static int busybox_main(char **argv) 2.28 + { 2.29 ++ bb_argv = argv; 2.30 + if (!argv[1]) { 2.31 + /* Called without arguments */ 2.32 + const char *a; 2.33 +@@ -783,6 +791,7 @@ 2.34 + int main(int argc UNUSED_PARAM, char **argv) 2.35 + #endif 2.36 + { 2.37 ++ bb_argv = argv; 2.38 + /* Tweak malloc for reduced memory consumption */ 2.39 + #ifndef PAGE_SIZE 2.40 + # define PAGE_SIZE (4*1024) /* guess */