Magellan Linux

Annotation of /trunk/mkinitrd-magellan/busybox/applets/usage.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1123 - (hide annotations) (download)
Wed Aug 18 21:56:57 2010 UTC (13 years, 9 months ago) by niro
File MIME type: text/plain
File size: 1178 byte(s)
-updated to busybox-1.17.1
1 niro 532 /* vi: set sw=4 ts=4: */
2 niro 984 /*
3     * Copyright (C) 2008 Denys Vlasenko.
4     *
5     * Licensed under GPLv2, see file LICENSE in this tarball for details.
6     */
7 niro 532 #include <unistd.h>
8 niro 1123 #include <stdlib.h>
9     #include <string.h>
10 niro 532
11 niro 984 #include "autoconf.h"
12 niro 532
13 niro 816 /* Since we can't use platform.h, have to do this again by hand: */
14     #if ENABLE_NOMMU
15 niro 984 # define BB_MMU 0
16     # define USE_FOR_NOMMU(...) __VA_ARGS__
17     # define USE_FOR_MMU(...)
18 niro 816 #else
19 niro 984 # define BB_MMU 1
20     # define USE_FOR_NOMMU(...)
21     # define USE_FOR_MMU(...) __VA_ARGS__
22 niro 816 #endif
23    
24 niro 532 #include "usage.h"
25 niro 1123 #define MAKE_USAGE(aname, usage) { aname, usage },
26     static struct usage_data {
27     const char *aname;
28     const char *usage;
29     } usage_array[] = {
30 niro 532 #include "applets.h"
31 niro 1123 };
32 niro 532
33 niro 1123 static int compare_func(const void *a, const void *b)
34     {
35     const struct usage_data *ua = a;
36     const struct usage_data *ub = b;
37     return strcmp(ua->aname, ub->aname);
38     }
39    
40 niro 532 int main(void)
41     {
42 niro 1123 int i;
43     int num_messages = sizeof(usage_array) / sizeof(usage_array[0]);
44    
45     if (num_messages == 0)
46     return 0;
47    
48     qsort(usage_array,
49     num_messages, sizeof(usage_array[0]),
50     compare_func);
51     for (i = 0; i < num_messages; i++)
52     write(STDOUT_FILENO, usage_array[i].usage, strlen(usage_array[i].usage) + 1);
53    
54 niro 532 return 0;
55     }