2006-07-02 19:47:05 +00:00
|
|
|
/* vi: set sw=4 ts=4: */
|
2008-12-07 00:52:58 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2008 Denys Vlasenko.
|
|
|
|
*
|
2010-08-16 18:14:46 +00:00
|
|
|
* Licensed under GPLv2, see file LICENSE in this source tree.
|
2008-12-07 00:52:58 +00:00
|
|
|
*/
|
2006-04-27 23:34:46 +00:00
|
|
|
#include <unistd.h>
|
2010-06-05 21:11:07 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2006-10-05 10:17:08 +00:00
|
|
|
|
2009-10-01 23:10:32 +00:00
|
|
|
#include "autoconf.h"
|
2006-04-27 23:34:46 +00:00
|
|
|
|
2008-06-13 20:44:05 +00:00
|
|
|
/* Since we can't use platform.h, have to do this again by hand: */
|
|
|
|
#if ENABLE_NOMMU
|
2009-10-01 23:10:32 +00:00
|
|
|
# define BB_MMU 0
|
|
|
|
# define USE_FOR_NOMMU(...) __VA_ARGS__
|
|
|
|
# define USE_FOR_MMU(...)
|
2008-06-13 20:44:05 +00:00
|
|
|
#else
|
2009-10-01 23:10:32 +00:00
|
|
|
# define BB_MMU 1
|
|
|
|
# define USE_FOR_NOMMU(...)
|
|
|
|
# define USE_FOR_MMU(...) __VA_ARGS__
|
2008-06-13 20:44:05 +00:00
|
|
|
#endif
|
|
|
|
|
2006-10-19 22:10:07 +00:00
|
|
|
#include "usage.h"
|
2010-06-05 21:11:07 +00:00
|
|
|
#define MAKE_USAGE(aname, usage) { aname, usage },
|
|
|
|
static struct usage_data {
|
|
|
|
const char *aname;
|
|
|
|
const char *usage;
|
|
|
|
} usage_array[] = {
|
2006-10-19 22:10:07 +00:00
|
|
|
#include "applets.h"
|
2010-06-05 21:11:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
2006-04-27 23:34:46 +00:00
|
|
|
|
|
|
|
int main(void)
|
|
|
|
{
|
2010-06-05 21:11:07 +00:00
|
|
|
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);
|
|
|
|
for (i = 0; i < num_messages; i++)
|
|
|
|
write(STDOUT_FILENO, usage_array[i].usage, strlen(usage_array[i].usage) + 1);
|
|
|
|
|
2006-04-27 23:34:46 +00:00
|
|
|
return 0;
|
|
|
|
}
|