[PATCH] Add a 'busybox --list name' option to display script content
Ron Yorston
rmy at pobox.com
Sat Nov 10 08:22:12 UTC 2018
Kang-Che Sung wrote:
>Have you seen the implementation of bbconfig applet?
>I wonder if the extraction of the embedded script can be
>implemented in the same manner.
>Will implementing that way yield smaller binary?
Sure. See commit c339c7f7b 'libarchive: add a function to unpack
embedded data'. bbconfig, usage data and embedded scripts all use
the same unpacking function.
I wondered if listing all the scripts unconditionally, rather than just
one named script, would result in smaller code. This:
if (LIST_CONTENT && strcmp(argv[1]+6, "-scripts") == 0) {
char *script = get_script_content(0);
if (script != NULL) {
while (*script) {
full_write1_str(script);
full_write1_str("#---\n");
while (*script++)
continue;
}
}
return 0;
}
requires 124 bytes. For it to be useful it would really need to show
the name of each script, and that's sure to make the code bigger.
So I don't see any win there.
Ron
More information about the busybox
mailing list