wok annotate busybox/stuff/busybox-1.23-cmdline.u @ rev 19178

Up slitaz-configs (287)
author Paul Issott <paul@slitaz.org>
date Fri Jun 03 21:06:09 2016 +0100 (2016-06-03)
parents
children
rev   line source
pascal@17518 1 Display command line in usage output. Useful to debug scripts with variables.
pascal@17518 2 --- busybox-1.23.0/libbb/appletlib.c
pascal@17518 3 +++ busybox-1.23.0/libbb/appletlib.c
pascal@17518 4 @@ -93,9 +93,16 @@
pascal@17518 5
pascal@17518 6 #endif /* FEATURE_COMPRESS_USAGE */
pascal@17518 7
pascal@17518 8 -
pascal@17518 9 +static char **bb_argv;
pascal@17518 10 void FAST_FUNC bb_show_usage(void)
pascal@17518 11 {
pascal@17518 12 + full_write2_str("\nCommand line: ");
pascal@17518 13 + while (*bb_argv) {
pascal@17518 14 + full_write2_str(*bb_argv++);
pascal@17518 15 + full_write2_str(" ");
pascal@17518 16 + }
pascal@17518 17 + full_write2_str("\n\n");
pascal@17518 18 +
pascal@17518 19 if (ENABLE_SHOW_USAGE) {
pascal@17518 20 #ifdef SINGLE_APPLET_STR
pascal@17518 21 /* Imagine that this applet is "true". Dont suck in printf! */
pascal@17518 22 @@ -615,6 +622,7 @@
pascal@17518 23 /* If we were called as "busybox..." */
pascal@17518 24 static int busybox_main(char **argv)
pascal@17518 25 {
pascal@17518 26 + bb_argv = argv;
pascal@17518 27 if (!argv[1]) {
pascal@17518 28 /* Called without arguments */
pascal@17518 29 const char *a;
pascal@17518 30 @@ -792,6 +800,7 @@
pascal@17518 31 int main(int argc UNUSED_PARAM, char **argv)
pascal@17518 32 #endif
pascal@17518 33 {
pascal@17518 34 + bb_argv = argv;
pascal@17518 35 /* Tweak malloc for reduced memory consumption */
pascal@17518 36 #ifdef M_TRIM_THRESHOLD
pascal@17518 37 /* M_TRIM_THRESHOLD is the maximum amount of freed top-most memory