[git commit] busybox: show embedded scripts in applet list

Denys Vlasenko vda.linux at googlemail.com
Thu Nov 1 12:58:16 UTC 2018


commit: https://git.busybox.net/busybox/commit/?id=0575c9932d203d93633104e12054dcf5da522061
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master

function                                             old     new   delta
busybox_main                                         624     642     +18

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 libbb/appletlib.c | 36 +++++++++++++++++++++---------------
 1 file changed, 21 insertions(+), 15 deletions(-)

diff --git a/libbb/appletlib.c b/libbb/appletlib.c
index 92d99fbe8..d48b2ea60 100644
--- a/libbb/appletlib.c
+++ b/libbb/appletlib.c
@@ -839,24 +839,30 @@ int busybox_main(int argc UNUSED_PARAM, char **argv)
 			"Currently defined functions:\n"
 		);
 		col = 0;
-		a = applet_names;
 		/* prevent last comma to be in the very last pos */
 		output_width--;
-		while (*a) {
-			int len2 = strlen(a) + 2;
-			if (col >= (int)output_width - len2) {
-				full_write2_str(",\n");
-				col = 0;
-			}
-			if (col == 0) {
-				col = 6;
-				full_write2_str("\t");
-			} else {
-				full_write2_str(", ");
+		a = applet_names;
+		{
+#  if NUM_SCRIPTS > 0
+			int i;
+			for (i = 0; i < 2; i++, a = script_names)
+#  endif
+			while (*a) {
+				int len2 = strlen(a) + 2;
+				if (col >= (int)output_width - len2) {
+					full_write2_str(",\n");
+					col = 0;
+				}
+				if (col == 0) {
+					col = 6;
+					full_write2_str("\t");
+				} else {
+					full_write2_str(", ");
+				}
+				full_write2_str(a);
+				col += len2;
+				a += len2 - 1;
 			}
-			full_write2_str(a);
-			col += len2;
-			a += len2 - 1;
 		}
 		full_write2_str("\n");
 		return 0;


More information about the busybox-cvs mailing list