diff options
Diffstat (limited to 'applets')
-rw-r--r-- | applets/applet_tables.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/applets/applet_tables.c b/applets/applet_tables.c index 35b099eb4..17135ddc1 100644 --- a/applets/applet_tables.c +++ b/applets/applet_tables.c | |||
@@ -47,6 +47,7 @@ int main(int argc, char **argv) | |||
47 | { | 47 | { |
48 | int i; | 48 | int i; |
49 | int ofs; | 49 | int ofs; |
50 | unsigned MAX_APPLET_NAME_LEN = 1; | ||
50 | 51 | ||
51 | qsort(applets, NUM_APPLETS, sizeof(applets[0]), cmp_name); | 52 | qsort(applets, NUM_APPLETS, sizeof(applets[0]), cmp_name); |
52 | 53 | ||
@@ -71,18 +72,21 @@ int main(int argc, char **argv) | |||
71 | 72 | ||
72 | puts("/* This is a generated file, don't edit */\n"); | 73 | puts("/* This is a generated file, don't edit */\n"); |
73 | 74 | ||
75 | printf("#define NUM_APPLETS %u\n", NUM_APPLETS); | ||
74 | if (NUM_APPLETS == 1) { | 76 | if (NUM_APPLETS == 1) { |
75 | printf("#define SINGLE_APPLET_STR \"%s\"\n", applets[0].name); | 77 | printf("#define SINGLE_APPLET_STR \"%s\"\n", applets[0].name); |
76 | printf("#define SINGLE_APPLET_MAIN %s_main\n\n", applets[0].name); | 78 | printf("#define SINGLE_APPLET_MAIN %s_main\n", applets[0].name); |
77 | } | 79 | } |
78 | 80 | ||
79 | puts("const char applet_names[] ALIGN1 = \"\""); | 81 | puts("\nconst char applet_names[] ALIGN1 = \"\""); |
80 | for (i = 0; i < NUM_APPLETS; i++) { | 82 | for (i = 0; i < NUM_APPLETS; i++) { |
81 | printf("\"%s\" \"\\0\"\n", applets[i].name); | 83 | printf("\"%s\" \"\\0\"\n", applets[i].name); |
84 | if (MAX_APPLET_NAME_LEN < strlen(applets[i].name)) | ||
85 | MAX_APPLET_NAME_LEN = strlen(applets[i].name); | ||
82 | } | 86 | } |
83 | puts(";"); | 87 | puts(";"); |
84 | 88 | ||
85 | puts("int (*const applet_main[])(int argc, char **argv) = {"); | 89 | puts("\nint (*const applet_main[])(int argc, char **argv) = {"); |
86 | for (i = 0; i < NUM_APPLETS; i++) { | 90 | for (i = 0; i < NUM_APPLETS; i++) { |
87 | printf("%s_main,\n", applets[i].main); | 91 | printf("%s_main,\n", applets[i].main); |
88 | } | 92 | } |
@@ -113,8 +117,10 @@ int main(int argc, char **argv) | |||
113 | printf("0x%02x,\n", v); | 117 | printf("0x%02x,\n", v); |
114 | i++; | 118 | i++; |
115 | } | 119 | } |
116 | puts("};"); | 120 | puts("};\n"); |
117 | #endif | 121 | #endif |
118 | 122 | ||
123 | printf("#define MAX_APPLET_NAME_LEN %u\n", MAX_APPLET_NAME_LEN); | ||
124 | |||
119 | return 0; | 125 | return 0; |
120 | } | 126 | } |