Hi,

Not sure we really want this but here is a patch for it.
Running sbase-box prints the available tools in a similar fashion
to busybox.

Thanks,
sin
>From 4ee57bb1194121b7212c0568bf57209745f10ba4 Mon Sep 17 00:00:00 2001
From: sin <[email protected]>
Date: Thu, 15 Aug 2013 16:46:46 +0100
Subject: [PATCH] Print the available targets for sbase-box

---
 Makefile | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 010391c..eaf36b5 100644
--- a/Makefile
+++ b/Makefile
@@ -149,13 +149,16 @@ sbase-box: $(SRC) util.a
        @cp $(HDR) build
        @for f in $(SRC); do sed "s/^main(/`basename $$f .c`_&/" < $$f > 
build/$$f; done
        @echo '#include <libgen.h>'  > build/[email protected]
+       @echo '#include <stdio.h>'  >> build/[email protected]
        @echo '#include <stdlib.h>' >> build/[email protected]
        @echo '#include <string.h>' >> build/[email protected]
        @echo '#include "util.h"'   >> build/[email protected]
        @for f in $(SRC); do echo "int `basename $$f .c`_main(int, char **);" 
>> build/[email protected]; done
        @echo 'int main(int argc, char *argv[]) { char *s = basename(argv[0]); 
if(0) ;' >> build/[email protected]
        @for f in $(SRC); do echo "else if(!strcmp(s, \"`basename $$f .c`\")) 
`basename $$f .c`_main(argc, argv);" >> build/[email protected]; done
-       @printf 'else eprintf("%%s: unknown program\\n", s); return 
EXIT_SUCCESS; }\n' >> build/[email protected]
+       @echo 'else {' >> build/[email protected]
+       @for f in $(SRC); do echo "printf(\"`basename $$f .c`\"); putchar(' 
');" >> build/[email protected]; done
+       @echo "putchar('\\\n'); }; return EXIT_SUCCESS; }" >> build/[email protected]
        @echo LD $@
        @$(LD) -o $@ build/*.c util.a $(CFLAGS) $(LDFLAGS)
        @rm -r build
-- 
1.8.2.3

Reply via email to