applet_tables: fix single applet build failure. Closes 4009
authorDenys Vlasenko <vda.linux@googlemail.com>
Fri, 16 Sep 2011 12:28:32 +0000 (14:28 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Fri, 16 Sep 2011 12:28:32 +0000 (14:28 +0200)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
applets/applet_tables.c

index 3859d73262b59a484557f573c61055d5f7600fe0..a47574737f7ef84f84aab48b70efd6b8dd626a31 100644 (file)
@@ -80,8 +80,15 @@ int main(int argc, char **argv)
 
        printf("#define NUM_APPLETS %u\n", NUM_APPLETS);
        if (NUM_APPLETS == 1) {
+               char *dash_to_underscore, *p;
                printf("#define SINGLE_APPLET_STR \"%s\"\n", applets[0].name);
-               printf("#define SINGLE_APPLET_MAIN %s_main\n", applets[0].name);
+               /* Example: "ether-wake" -> "ether_wake" */
+               p = dash_to_underscore = strdup(applets[0].name);
+               p--;
+               while (*++p)
+                       if (*p == '-')
+                               *p = '_';
+               printf("#define SINGLE_APPLET_MAIN %s_main\n", dash_to_underscore);
        }
        printf("\n");