aboutsummaryrefslogtreecommitdiff
path: root/libbb/appletlib.c
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/appletlib.c
parent729ce473609fbe2aef656e6079d6b8a102962004 (diff)
downloadbusybox-w32-0e5ba0843b86a78d2d98a5fbaac8d33fe041f10e.tar.gz
busybox-w32-0e5ba0843b86a78d2d98a5fbaac8d33fe041f10e.tar.bz2
busybox-w32-0e5ba0843b86a78d2d98a5fbaac8d33fe041f10e.zip
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/appletlib.c')
-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 @@
43#include "applets.h" 43#include "applets.h"
44#undef PROTOTYPES 44#undef PROTOTYPES
45 45
46#if ENABLE_SHOW_USAGE && !ENABLE_FEATURE_COMPRESS_USAGE
47/* Define usage_messages[] */
48static const char usage_messages[] ALIGN1 = ""
49# define MAKE_USAGE
50# include "usage.h"
51# include "applets.h"
52;
53# undef MAKE_USAGE
54#else
55# define usage_messages 0
56#endif /* SHOW_USAGE */
57
58 46
59/* Include generated applet names, pointers to <applet>_main, etc */ 47/* Include generated applet names, pointers to <applet>_main, etc */
60#include "applet_tables.h" 48#include "applet_tables.h"
61/* ...and if applet_tables generator says we have only one applet... */ 49/* ...and if applet_tables generator says we have only one applet... */
62#ifdef SINGLE_APPLET_MAIN 50#ifdef SINGLE_APPLET_MAIN
63#undef ENABLE_FEATURE_INDIVIDUAL 51# undef ENABLE_FEATURE_INDIVIDUAL
64#define ENABLE_FEATURE_INDIVIDUAL 1 52# define ENABLE_FEATURE_INDIVIDUAL 1
65#undef IF_FEATURE_INDIVIDUAL 53# undef IF_FEATURE_INDIVIDUAL
66#define IF_FEATURE_INDIVIDUAL(...) __VA_ARGS__ 54# define IF_FEATURE_INDIVIDUAL(...) __VA_ARGS__
67#endif 55#endif
68 56
69 57
70#if ENABLE_FEATURE_COMPRESS_USAGE
71
72#include "usage_compressed.h" 58#include "usage_compressed.h"
73#include "unarchive.h"
74 59
60#if ENABLE_SHOW_USAGE && !ENABLE_FEATURE_COMPRESS_USAGE
61static const char usage_messages[] ALIGN1 = UNPACKED_USAGE;
62#else
63# define usage_messages 0
64#endif /* SHOW_USAGE */
65
66#if ENABLE_FEATURE_COMPRESS_USAGE
67
68static const char packed_usage[] = { PACKED_USAGE };
69# include "unarchive.h"
75static const char *unpack_usage_messages(void) 70static const char *unpack_usage_messages(void)
76{ 71{
77 char *outbuf = NULL; 72 char *outbuf = NULL;
@@ -86,19 +81,19 @@ static const char *unpack_usage_messages(void)
86 * end up here with i != 0 on read data errors! Not trivial */ 81 * end up here with i != 0 on read data errors! Not trivial */
87 if (!i) { 82 if (!i) {
88 /* Cannot use xmalloc: will leak bd in NOFORK case! */ 83 /* Cannot use xmalloc: will leak bd in NOFORK case! */
89 outbuf = malloc_or_warn(SIZEOF_usage_messages); 84 outbuf = malloc_or_warn(sizeof(UNPACKED_USAGE));
90 if (outbuf) 85 if (outbuf)
91 read_bunzip(bd, outbuf, SIZEOF_usage_messages); 86 read_bunzip(bd, outbuf, sizeof(UNPACKED_USAGE));
92 } 87 }
93 dealloc_bunzip(bd); 88 dealloc_bunzip(bd);
94 return outbuf; 89 return outbuf;
95} 90}
96#define dealloc_usage_messages(s) free(s) 91# define dealloc_usage_messages(s) free(s)
97 92
98#else 93#else
99 94
100#define unpack_usage_messages() usage_messages 95# define unpack_usage_messages() usage_messages
101#define dealloc_usage_messages(s) ((void)(s)) 96# define dealloc_usage_messages(s) ((void)(s))
102 97
103#endif /* FEATURE_COMPRESS_USAGE */ 98#endif /* FEATURE_COMPRESS_USAGE */
104 99