diff options
Diffstat (limited to 'libbb/appletlib.c')
-rw-r--r-- | libbb/appletlib.c | 36 |
1 files 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) | |||
839 | "Currently defined functions:\n" | 839 | "Currently defined functions:\n" |
840 | ); | 840 | ); |
841 | col = 0; | 841 | col = 0; |
842 | a = applet_names; | ||
843 | /* prevent last comma to be in the very last pos */ | 842 | /* prevent last comma to be in the very last pos */ |
844 | output_width--; | 843 | output_width--; |
845 | while (*a) { | 844 | a = applet_names; |
846 | int len2 = strlen(a) + 2; | 845 | { |
847 | if (col >= (int)output_width - len2) { | 846 | # if NUM_SCRIPTS > 0 |
848 | full_write2_str(",\n"); | 847 | int i; |
849 | col = 0; | 848 | for (i = 0; i < 2; i++, a = script_names) |
850 | } | 849 | # endif |
851 | if (col == 0) { | 850 | while (*a) { |
852 | col = 6; | 851 | int len2 = strlen(a) + 2; |
853 | full_write2_str("\t"); | 852 | if (col >= (int)output_width - len2) { |
854 | } else { | 853 | full_write2_str(",\n"); |
855 | full_write2_str(", "); | 854 | col = 0; |
855 | } | ||
856 | if (col == 0) { | ||
857 | col = 6; | ||
858 | full_write2_str("\t"); | ||
859 | } else { | ||
860 | full_write2_str(", "); | ||
861 | } | ||
862 | full_write2_str(a); | ||
863 | col += len2; | ||
864 | a += len2 - 1; | ||
856 | } | 865 | } |
857 | full_write2_str(a); | ||
858 | col += len2; | ||
859 | a += len2 - 1; | ||
860 | } | 866 | } |
861 | full_write2_str("\n"); | 867 | full_write2_str("\n"); |
862 | return 0; | 868 | return 0; |