aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2010-06-05 23:11:07 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2010-06-05 23:11:07 +0200
commit0e5ba0843b86a78d2d98a5fbaac8d33fe041f10e (patch)
tree1f043ab8b4f8e1e57ddaf49e0ddf7677fedf7689 /libbb
parent729ce473609fbe2aef656e6079d6b8a102962004 (diff)
downloadbusybox-0e5ba0843b86a78d2d98a5fbaac8d33fe041f10e.tar.gz
Remove requirement that include/applets.h must be sorted
First, I _again_ violated it - two xz-related applets are in wrong positions. Second, planned in-applet help text thing will be so much easier without this requirement... Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb')
-rw-r--r--libbb/appletlib.c43
1 files changed, 19 insertions, 24 deletions
diff --git a/libbb/appletlib.c b/libbb/appletlib.c
index a8cd8e65f..6267f2673 100644
--- a/libbb/appletlib.c
+++ b/libbb/appletlib.c
@@ -43,35 +43,30 @@
#include "applets.h"
#undef PROTOTYPES
-#if ENABLE_SHOW_USAGE && !ENABLE_FEATURE_COMPRESS_USAGE
-/* Define usage_messages[] */
-static const char usage_messages[] ALIGN1 = ""
-# define MAKE_USAGE
-# include "usage.h"
-# include "applets.h"
-;
-# undef MAKE_USAGE
-#else
-# define usage_messages 0
-#endif /* SHOW_USAGE */
-
/* Include generated applet names, pointers to <applet>_main, etc */
#include "applet_tables.h"
/* ...and if applet_tables generator says we have only one applet... */
#ifdef SINGLE_APPLET_MAIN
-#undef ENABLE_FEATURE_INDIVIDUAL
-#define ENABLE_FEATURE_INDIVIDUAL 1
-#undef IF_FEATURE_INDIVIDUAL
-#define IF_FEATURE_INDIVIDUAL(...) __VA_ARGS__
+# undef ENABLE_FEATURE_INDIVIDUAL
+# define ENABLE_FEATURE_INDIVIDUAL 1
+# undef IF_FEATURE_INDIVIDUAL
+# define IF_FEATURE_INDIVIDUAL(...) __VA_ARGS__
#endif
-#if ENABLE_FEATURE_COMPRESS_USAGE
-
#include "usage_compressed.h"
-#include "unarchive.h"
+#if ENABLE_SHOW_USAGE && !ENABLE_FEATURE_COMPRESS_USAGE
+static const char usage_messages[] ALIGN1 = UNPACKED_USAGE;
+#else
+# define usage_messages 0
+#endif /* SHOW_USAGE */
+
+#if ENABLE_FEATURE_COMPRESS_USAGE
+
+static const char packed_usage[] = { PACKED_USAGE };
+# include "unarchive.h"
static const char *unpack_usage_messages(void)
{
char *outbuf = NULL;
@@ -86,19 +81,19 @@ static const char *unpack_usage_messages(void)
* end up here with i != 0 on read data errors! Not trivial */
if (!i) {
/* Cannot use xmalloc: will leak bd in NOFORK case! */
- outbuf = malloc_or_warn(SIZEOF_usage_messages);
+ outbuf = malloc_or_warn(sizeof(UNPACKED_USAGE));
if (outbuf)
- read_bunzip(bd, outbuf, SIZEOF_usage_messages);
+ read_bunzip(bd, outbuf, sizeof(UNPACKED_USAGE));
}
dealloc_bunzip(bd);
return outbuf;
}
-#define dealloc_usage_messages(s) free(s)
+# define dealloc_usage_messages(s) free(s)
#else
-#define unpack_usage_messages() usage_messages
-#define dealloc_usage_messages(s) ((void)(s))
+# define unpack_usage_messages() usage_messages
+# define dealloc_usage_messages(s) ((void)(s))
#endif /* FEATURE_COMPRESS_USAGE */