1d5a1c23088a7c650e19d2e442ac38b05cd1b236
[openwrt.git] / package / busybox / patches / 000-upstream-buildsys.patch
1 --- a/applets/applet_tables.c
2 +++ b/applets/applet_tables.c
3 @@ -80,8 +80,15 @@ int main(int argc, char **argv)
4  
5         printf("#define NUM_APPLETS %u\n", NUM_APPLETS);
6         if (NUM_APPLETS == 1) {
7 +               char *dash_to_underscore, *p;
8                 printf("#define SINGLE_APPLET_STR \"%s\"\n", applets[0].name);
9 -               printf("#define SINGLE_APPLET_MAIN %s_main\n", applets[0].name);
10 +               /* Example: "ether-wake" -> "ether_wake" */
11 +               p = dash_to_underscore = strdup(applets[0].name);
12 +               p--;
13 +               while (*++p)
14 +                       if (*p == '-')
15 +                               *p = '_';
16 +               printf("#define SINGLE_APPLET_MAIN %s_main\n", dash_to_underscore);
17         }
18         printf("\n");
19