[RFC, PATCH] new applet resize #2

Bernhard Fischer rep.nop at aon.at
Fri Sep 22 07:44:32 UTC 2006


On Thu, Sep 21, 2006 at 11:25:04PM -0400, Rob Landley wrote:
>On Thursday 21 September 2006 5:45 pm, Bernhard Fischer wrote:

>> Unfortunately we 
>> currently cannot say the proper (and size-saving!)
>> int my_applet_main(void){} due to our macros being stubborn.
[snip global argv]
>> Easy to fix (i have a patch here at home which did this, against an
>> ancient version) but i'm not convinced if Rob likes this or not as it
>> would make the applet dispatch-table filler macros even less
>> comprehensible.
>> 
>> Rob?
>> Mind if Tito or i do this, mid-term?
>
>Do which?  What specifically are you proposing?

provide means to let applets be of the form

variant_A_main(void)
variant_B_main(int argc)
variant_C_main(char **argv)
variant_D_main(int argc, char **argv)

by making the PROTOTYPES peruse
#define _BB_NOARG (void)
#define _BB_ARGC  (int argc)
#define _BB_ARGV  (char **argv)
#define _BB_ARGS  (int argc, char **argv)

via 


Index: include/applets.h
===================================================================
--- include/applets.h   (revision 16172)
+++ include/applets.h   (working copy)
@@ -15,11 +15,15 @@
 #undef APPLET_ODDNAME
 #undef APPLET_NOUSAGE
 
+#define _BB_NOARG (void)
+#define _BB_ARGC  (int argc)
+#define _BB_ARGV  (char **argv)
+#define _BB_ARGS  (int argc, char **argv)
 
 #if defined(PROTOTYPES)
-# define APPLET(a,b,c) extern int a##_main(int argc, char **argv);
-# define APPLET_NOUSAGE(a,b,c,d) extern int b##_main(int argc, char
**argv);
-# define APPLET_ODDNAME(a,b,c,d,e) extern int b##_main(int argc, char
**argv);
+# define APPLET(a,b,c) extern int a##_main ## c;
+# define APPLET_NOUSAGE(a,b,c,d) extern int b##_main ## c;
+# define APPLET_ODDNAME(a,b,c,d,e) extern int b##_main ## c;
 #elif defined(MAKE_USAGE)
 # ifdef CONFIG_FEATURE_VERBOSE_USAGE
 #  define APPLET(a,b,c) a##_trivial_usage "\n\n" a##_full_usage "\0"


so you can say (e.g. for test):

@@ -47,7 +51,7 @@
 #endif
 
 
-USE_TEST(APPLET_NOUSAGE([, test, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
+USE_TEST(APPLET_NOUSAGE([, test, _BB_ARGS, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
 USE_TEST(APPLET_NOUSAGE([[, test, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
 USE_ADDGROUP(APPLET(addgroup, _BB_DIR_BIN, _BB_SUID_NEVER))
 USE_ADDUSER(APPLET(adduser, _BB_DIR_BIN, _BB_SUID_NEVER))




More information about the busybox mailing list