1 /* vi: set sw=4 ts=4: */
3 * Copyright (C) 2009 Denys Vlasenko.
5 * Licensed under GPLv2, see file LICENSE in this tarball for details.
15 #define SKIP_applet_main
16 #define ALIGN1 /* nothing, just to placate applet_tables.h */
17 #define ALIGN2 /* nothing, just to placate applet_tables.h */
18 #include "applet_tables.h"
20 /* Since we can't use platform.h, have to do this again by hand: */
23 # define USE_FOR_NOMMU(...) __VA_ARGS__
24 # define USE_FOR_MMU(...)
27 # define USE_FOR_NOMMU(...)
28 # define USE_FOR_MMU(...) __VA_ARGS__
32 #define MAKE_USAGE(aname, usage) { aname, usage },
33 static struct usage_data {
40 static int compare_func(const void *a, const void *b)
42 const struct usage_data *ua = a;
43 const struct usage_data *ub = b;
44 return strcmp(ua->aname, ub->aname);
52 int num_messages = sizeof(usage_array) / sizeof(usage_array[0]);
54 if (num_messages == 0)
58 num_messages, sizeof(usage_array[0]),
62 for (i = 0; i < num_messages; i++) {
63 len2 = strlen(usage_array[i].aname) + 2;
64 if (col >= 76 - len2) {
74 printf(usage_array[i].aname);
79 printf("=head1 COMMAND DESCRIPTIONS\n\n");
80 printf("=over 4\n\n");
82 for (i = 0; i < num_messages; i++) {
83 if (usage_array[i].aname[0] >= 'a' && usage_array[i].aname[0] <= 'z'
84 && usage_array[i].usage[0] != NOUSAGE_STR[0]
86 printf("=item B<%s>\n\n", usage_array[i].aname);
87 if (usage_array[i].usage[0])
88 printf("%s %s\n\n", usage_array[i].aname, usage_array[i].usage);
90 printf("%s\n\n", usage_array[i].aname);
96 /* TODO: we used to make options bold with B<> and output an example too:
100 cat [B<-u>] [FILE]...
102 Concatenate FILE(s) and print them to stdout
105 -u Use unbuffered i/o (ignored)