Walter Harms
2018-11-25 15:13:36 UTC
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) {
+ 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: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) {
+ 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;
+ }
+
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