123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- #include <unistd.h>
- #include <stdint.h>
- #include <stdlib.h>
- #include <string.h>
- #include <stdio.h>
- #include "autoconf.h"
- #define SKIP_applet_main
- #define ALIGN1
- #define ALIGN2
- #include "applet_tables.h"
- #if ENABLE_NOMMU
- # define BB_MMU 0
- # define USE_FOR_NOMMU(...) __VA_ARGS__
- # define USE_FOR_MMU(...)
- #else
- # define BB_MMU 1
- # define USE_FOR_NOMMU(...)
- # define USE_FOR_MMU(...) __VA_ARGS__
- #endif
- #include "usage.h"
- #define MAKE_USAGE(aname, usage) { aname, usage },
- static struct usage_data {
- const char *aname;
- const char *usage;
- } usage_array[] = {
- #include "applets.h"
- };
- static int compare_func(const void *a, const void *b)
- {
- const struct usage_data *ua = a;
- const struct usage_data *ub = b;
- return strcmp(ua->aname, ub->aname);
- }
- int main(void)
- {
- int col, len2;
- int i;
- int num_messages = sizeof(usage_array) / sizeof(usage_array[0]);
- if (num_messages == 0)
- return 0;
- qsort(usage_array,
- num_messages, sizeof(usage_array[0]),
- compare_func);
- col = 0;
- for (i = 0; i < num_messages; i++) {
- len2 = strlen(usage_array[i].aname) + 2;
- if (col >= 76 - len2) {
- printf(",\n");
- col = 0;
- }
- if (col == 0) {
- col = 6;
- printf("\t");
- } else {
- printf(", ");
- }
- printf("%s", usage_array[i].aname);
- col += len2;
- }
- printf("\n\n");
- printf("=head1 COMMAND DESCRIPTIONS\n\n");
- printf("=over 4\n\n");
- for (i = 0; i < num_messages; i++) {
- if (usage_array[i].aname[0] >= 'a' && usage_array[i].aname[0] <= 'z'
- && usage_array[i].usage[0] != NOUSAGE_STR[0]
- ) {
- printf("=item B<%s>\n\n", usage_array[i].aname);
- if (usage_array[i].usage[0])
- printf("%s %s\n\n", usage_array[i].aname, usage_array[i].usage);
- else
- printf("%s\n\n", usage_array[i].aname);
- }
- }
- printf("=back\n\n");
- return 0;
- }
|