Am 09.11.2018 19:10, schrieb Ron Yorston:
> Add an option to allow the content of embedded scripts to be
> displayed.
> 


> @@ -865,6 +877,22 @@ int busybox_main(int argc UNUSED_PARAM, char **argv)
>  #  else
>               const char *a = applet_names;
>  #  endif
> +
> +             if (LIST_CONTENT && argv[1][6] == '\0' && argv[2] != NULL) {
> +                     int n = (HAS_PROFILE && strcmp(argv[2], ".profile") == 
> 0) ? 0 :
> +                                             find_script_by_name(argv[2]);
> +                     if (n >= 0) {
> +                             char *script = get_script_content(n);
> +                             if (script != NULL) {
> +                                     full_write1_str(script);
> +                             }
> +                     }
> +                     else {
> +                             bb_error_msg_and_die("script '%s' not found", 
> argv[2]);
> +                     }
> +                     return 0;
> +             }
> +

i would write that a bit different to improve readability:
 
                        char *script;
                        int n = (HAS_PROFILE && strcmp(argv[2], ".profile") ==
0) ? 0 :
                                          find_script_by_name(argv[2]);

                        if ( n<0 )
                          bb_error_msg_and_die("script '%s' not found",
argv[2]);
                 
                        script = get_script_content(n);
                        if (script != NULL) 
                               full_write1_str(script);                 
                        return 0;
            }


just my 2 cents,
re,
 wh
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to