diff options
author | Eric Andersen <andersen@codepoet.org> | 2001-04-25 05:39:18 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2001-04-25 05:39:18 +0000 |
commit | 04095e58fb4d3a083f77962714080ffe8139b39c (patch) | |
tree | aa3580587822774ffed9831aacee11d977d0a5f9 | |
parent | 3676374915866fb06224a19e2274afe026eb9377 (diff) | |
download | busybox-w32-04095e58fb4d3a083f77962714080ffe8139b39c.tar.gz busybox-w32-04095e58fb4d3a083f77962714080ffe8139b39c.tar.bz2 busybox-w32-04095e58fb4d3a083f77962714080ffe8139b39c.zip |
Move messages.c to libbb. Make each string in messages.c be its own .o file.
This way, we can new get rid of all that tedious #define rubbish we used to
need to enable specific messages. This way is enormously simpler, and as a
bonus also ends up saving us 96 bytes.
-Erik
46 files changed, 98 insertions, 241 deletions
@@ -212,7 +212,7 @@ endif | |||
212 | # And option 4: | 212 | # And option 4: |
213 | -include applet_source_list | 213 | -include applet_source_list |
214 | 214 | ||
215 | OBJECTS = $(APPLET_SOURCES:.c=.o) busybox.o messages.o usage.o applets.o | 215 | OBJECTS = $(APPLET_SOURCES:.c=.o) busybox.o usage.o applets.o |
216 | CFLAGS += $(CROSS_CFLAGS) | 216 | CFLAGS += $(CROSS_CFLAGS) |
217 | CFLAGS += -DBB_VER='"$(VERSION)"' | 217 | CFLAGS += -DBB_VER='"$(VERSION)"' |
218 | CFLAGS += -DBB_BT='"$(BUILDTIME)"' | 218 | CFLAGS += -DBB_BT='"$(BUILDTIME)"' |
@@ -249,13 +249,18 @@ recursive_action.c safe_read.c safe_strncpy.c seek_ared_file.c syscalls.c \ | |||
249 | syslog_msg_with_name.c time_string.c trim.c untar.c unzip.c vdprintf.c \ | 249 | syslog_msg_with_name.c time_string.c trim.c untar.c unzip.c vdprintf.c \ |
250 | verror_msg.c vperror_msg.c wfopen.c xfuncs.c xgetcwd.c xregcomp.c interface.c \ | 250 | verror_msg.c vperror_msg.c wfopen.c xfuncs.c xgetcwd.c xregcomp.c interface.c \ |
251 | remove_file.c | 251 | remove_file.c |
252 | |||
253 | LIBBB_OBJS=$(patsubst %.c,$(LIBBB)/%.o, $(LIBBB_CSRC)) | 252 | LIBBB_OBJS=$(patsubst %.c,$(LIBBB)/%.o, $(LIBBB_CSRC)) |
254 | LIBBB_CFLAGS = -I$(LIBBB) | 253 | LIBBB_CFLAGS = -I$(LIBBB) |
255 | ifneq ($(strip $(BB_SRC_DIR)),) | 254 | ifneq ($(strip $(BB_SRC_DIR)),) |
256 | LIBBB_CFLAGS += -I$(BB_SRC_DIR)/$(LIBBB) | 255 | LIBBB_CFLAGS += -I$(BB_SRC_DIR)/$(LIBBB) |
257 | endif | 256 | endif |
258 | 257 | ||
258 | LIBBB_MSRC=libbb/messages.c | ||
259 | LIBBB_MESSAGES= full_version name_too_long omitting_directory not_a_directory \ | ||
260 | memory_exhausted invalid_date invalid_option io_error dash_dash_help \ | ||
261 | write_error too_few_args name_longer_than_foo | ||
262 | LIBBB_MOBJ=$(patsubst %,$(LIBBB)/%.o, $(LIBBB_MESSAGES)) | ||
263 | |||
259 | 264 | ||
260 | # Put user-supplied flags at the end, where they | 265 | # Put user-supplied flags at the end, where they |
261 | # have a chance of winning. | 266 | # have a chance of winning. |
@@ -352,10 +357,13 @@ $(LIBBB_OBJS): %.o: %.c Config.h busybox.h applets.h Makefile libbb/libbb.h | |||
352 | - mkdir -p $(LIBBB) | 357 | - mkdir -p $(LIBBB) |
353 | $(CC) $(CFLAGS) $(LIBBB_CFLAGS) -c $< -o $*.o | 358 | $(CC) $(CFLAGS) $(LIBBB_CFLAGS) -c $< -o $*.o |
354 | 359 | ||
360 | $(LIBBB_MOBJ): $(LIBBB_MSRC) | ||
361 | $(CC) $(CFLAGS) $(LIBBB_CFLAGS) -DL_$(patsubst libbb/%,%,$*) -c $< -o $*.o | ||
362 | |||
355 | libpwd.a: $(PWD_OBJS) | 363 | libpwd.a: $(PWD_OBJS) |
356 | $(AR) $(ARFLAGS) $@ $^ | 364 | $(AR) $(ARFLAGS) $@ $^ |
357 | 365 | ||
358 | libbb.a: $(LIBBB_OBJS) | 366 | libbb.a: $(LIBBB_MOBJ) $(LIBBB_OBJS) |
359 | $(AR) $(ARFLAGS) $@ $^ | 367 | $(AR) $(ARFLAGS) $@ $^ |
360 | 368 | ||
361 | usage.o: usage.h | 369 | usage.o: usage.h |
@@ -35,10 +35,6 @@ | |||
35 | #undef PROTOTYPES | 35 | #undef PROTOTYPES |
36 | #include "applets.h" | 36 | #include "applets.h" |
37 | 37 | ||
38 | #define bb_need_full_version | ||
39 | #define BB_DECLARE_EXTERN | ||
40 | #include "messages.c" | ||
41 | |||
42 | struct BB_applet *applet_using; | 38 | struct BB_applet *applet_using; |
43 | 39 | ||
44 | /* The -1 arises because of the {0,NULL,0,-1} entry above. */ | 40 | /* The -1 arises because of the {0,NULL,0,-1} entry above. */ |
diff --git a/applets/applets.c b/applets/applets.c index 10b44a5fc..c1575c70d 100644 --- a/applets/applets.c +++ b/applets/applets.c | |||
@@ -35,10 +35,6 @@ | |||
35 | #undef PROTOTYPES | 35 | #undef PROTOTYPES |
36 | #include "applets.h" | 36 | #include "applets.h" |
37 | 37 | ||
38 | #define bb_need_full_version | ||
39 | #define BB_DECLARE_EXTERN | ||
40 | #include "messages.c" | ||
41 | |||
42 | struct BB_applet *applet_using; | 38 | struct BB_applet *applet_using; |
43 | 39 | ||
44 | /* The -1 arises because of the {0,NULL,0,-1} entry above. */ | 40 | /* The -1 arises because of the {0,NULL,0,-1} entry above. */ |
diff --git a/applets/busybox.c b/applets/busybox.c index 9db26df27..b4939e19d 100644 --- a/applets/busybox.c +++ b/applets/busybox.c | |||
@@ -5,11 +5,6 @@ | |||
5 | #include <errno.h> | 5 | #include <errno.h> |
6 | #include <stdlib.h> | 6 | #include <stdlib.h> |
7 | #include "busybox.h" | 7 | #include "busybox.h" |
8 | |||
9 | #define bb_need_full_version | ||
10 | #define BB_DECLARE_EXTERN | ||
11 | #include "messages.c" | ||
12 | |||
13 | #ifdef BB_LOCALE_SUPPORT | 8 | #ifdef BB_LOCALE_SUPPORT |
14 | #include <locale.h> | 9 | #include <locale.h> |
15 | #endif | 10 | #endif |
diff --git a/archival/gunzip.c b/archival/gunzip.c index b4edb25ac..db5f6ee55 100644 --- a/archival/gunzip.c +++ b/archival/gunzip.c | |||
@@ -65,10 +65,6 @@ static char *license_msg[] = { | |||
65 | #include <unistd.h> | 65 | #include <unistd.h> |
66 | #include <getopt.h> | 66 | #include <getopt.h> |
67 | #include "busybox.h" | 67 | #include "busybox.h" |
68 | #define BB_DECLARE_EXTERN | ||
69 | #define bb_need_memory_exhausted | ||
70 | #define bb_need_name_too_long | ||
71 | #include "messages.c" | ||
72 | 68 | ||
73 | extern int gunzip_main(int argc, char **argv) | 69 | extern int gunzip_main(int argc, char **argv) |
74 | { | 70 | { |
diff --git a/archival/gzip.c b/archival/gzip.c index f05ef95d0..6d46926ee 100644 --- a/archival/gzip.c +++ b/archival/gzip.c | |||
@@ -44,9 +44,6 @@ | |||
44 | #include <unistd.h> | 44 | #include <unistd.h> |
45 | #include <errno.h> | 45 | #include <errno.h> |
46 | #include "busybox.h" | 46 | #include "busybox.h" |
47 | #define BB_DECLARE_EXTERN | ||
48 | #define bb_need_memory_exhausted | ||
49 | #include "messages.c" | ||
50 | 47 | ||
51 | #define memzero(s, n) memset ((void *)(s), 0, (n)) | 48 | #define memzero(s, n) memset ((void *)(s), 0, (n)) |
52 | 49 | ||
diff --git a/archival/libunarchive/decompress_unzip.c b/archival/libunarchive/decompress_unzip.c index 9568c2870..7de28930a 100644 --- a/archival/libunarchive/decompress_unzip.c +++ b/archival/libunarchive/decompress_unzip.c | |||
@@ -65,10 +65,6 @@ static char *license_msg[] = { | |||
65 | #include <signal.h> | 65 | #include <signal.h> |
66 | #include <stdlib.h> | 66 | #include <stdlib.h> |
67 | #include "libbb.h" | 67 | #include "libbb.h" |
68 | #define BB_DECLARE_EXTERN | ||
69 | #define bb_need_memory_exhausted | ||
70 | #define bb_need_name_too_long | ||
71 | #include "../messages.c" | ||
72 | 68 | ||
73 | FILE *in_file, *out_file; | 69 | FILE *in_file, *out_file; |
74 | 70 | ||
diff --git a/archival/libunarchive/unzip.c b/archival/libunarchive/unzip.c index 9568c2870..7de28930a 100644 --- a/archival/libunarchive/unzip.c +++ b/archival/libunarchive/unzip.c | |||
@@ -65,10 +65,6 @@ static char *license_msg[] = { | |||
65 | #include <signal.h> | 65 | #include <signal.h> |
66 | #include <stdlib.h> | 66 | #include <stdlib.h> |
67 | #include "libbb.h" | 67 | #include "libbb.h" |
68 | #define BB_DECLARE_EXTERN | ||
69 | #define bb_need_memory_exhausted | ||
70 | #define bb_need_name_too_long | ||
71 | #include "../messages.c" | ||
72 | 68 | ||
73 | FILE *in_file, *out_file; | 69 | FILE *in_file, *out_file; |
74 | 70 | ||
diff --git a/archival/tar.c b/archival/tar.c index 7cfad72b5..48284c00a 100644 --- a/archival/tar.c +++ b/archival/tar.c | |||
@@ -51,10 +51,6 @@ | |||
51 | #include <stdlib.h> | 51 | #include <stdlib.h> |
52 | #include <unistd.h> | 52 | #include <unistd.h> |
53 | #include "busybox.h" | 53 | #include "busybox.h" |
54 | #define BB_DECLARE_EXTERN | ||
55 | #define bb_need_io_error | ||
56 | #define bb_need_name_longer_than_foo | ||
57 | #include "messages.c" | ||
58 | 54 | ||
59 | /* Tar file constants */ | 55 | /* Tar file constants */ |
60 | #ifndef MAJOR | 56 | #ifndef MAJOR |
@@ -5,11 +5,6 @@ | |||
5 | #include <errno.h> | 5 | #include <errno.h> |
6 | #include <stdlib.h> | 6 | #include <stdlib.h> |
7 | #include "busybox.h" | 7 | #include "busybox.h" |
8 | |||
9 | #define bb_need_full_version | ||
10 | #define BB_DECLARE_EXTERN | ||
11 | #include "messages.c" | ||
12 | |||
13 | #ifdef BB_LOCALE_SUPPORT | 8 | #ifdef BB_LOCALE_SUPPORT |
14 | #include <locale.h> | 9 | #include <locale.h> |
15 | #endif | 10 | #endif |
@@ -27,10 +27,6 @@ | |||
27 | #include <string.h> | 27 | #include <string.h> |
28 | #include <unistd.h> | 28 | #include <unistd.h> |
29 | #include "busybox.h" | 29 | #include "busybox.h" |
30 | #define BB_DECLARE_EXTERN | ||
31 | #define bb_need_invalid_option | ||
32 | #define bb_need_too_few_args | ||
33 | #include "messages.c" | ||
34 | 30 | ||
35 | /* Don't use lchown for libc5 or glibc older then 2.1.x */ | 31 | /* Don't use lchown for libc5 or glibc older then 2.1.x */ |
36 | #if (__GLIBC__ < 2) && (__GLIBC_MINOR__ < 1) | 32 | #if (__GLIBC__ < 2) && (__GLIBC_MINOR__ < 1) |
@@ -28,9 +28,6 @@ | |||
28 | #include <unistd.h> | 28 | #include <unistd.h> |
29 | #include <getopt.h> | 29 | #include <getopt.h> |
30 | #include "busybox.h" | 30 | #include "busybox.h" |
31 | #define BB_DECLARE_EXTERN | ||
32 | #define bb_need_too_few_args | ||
33 | #include "messages.c" | ||
34 | 31 | ||
35 | 32 | ||
36 | struct stat *theMode; | 33 | struct stat *theMode; |
@@ -27,10 +27,6 @@ | |||
27 | #include <string.h> | 27 | #include <string.h> |
28 | #include <unistd.h> | 28 | #include <unistd.h> |
29 | #include "busybox.h" | 29 | #include "busybox.h" |
30 | #define BB_DECLARE_EXTERN | ||
31 | #define bb_need_too_few_args | ||
32 | #include "messages.c" | ||
33 | |||
34 | 30 | ||
35 | /* Don't use lchown for libc5 or glibc older then 2.1.x */ | 31 | /* Don't use lchown for libc5 or glibc older then 2.1.x */ |
36 | #if (__GLIBC__ < 2) && (__GLIBC_MINOR__ < 1) | 32 | #if (__GLIBC__ < 2) && (__GLIBC_MINOR__ < 1) |
diff --git a/coreutils/chgrp.c b/coreutils/chgrp.c index 739d09fb6..c6312a7e4 100644 --- a/coreutils/chgrp.c +++ b/coreutils/chgrp.c | |||
@@ -27,10 +27,6 @@ | |||
27 | #include <string.h> | 27 | #include <string.h> |
28 | #include <unistd.h> | 28 | #include <unistd.h> |
29 | #include "busybox.h" | 29 | #include "busybox.h" |
30 | #define BB_DECLARE_EXTERN | ||
31 | #define bb_need_invalid_option | ||
32 | #define bb_need_too_few_args | ||
33 | #include "messages.c" | ||
34 | 30 | ||
35 | /* Don't use lchown for libc5 or glibc older then 2.1.x */ | 31 | /* Don't use lchown for libc5 or glibc older then 2.1.x */ |
36 | #if (__GLIBC__ < 2) && (__GLIBC_MINOR__ < 1) | 32 | #if (__GLIBC__ < 2) && (__GLIBC_MINOR__ < 1) |
diff --git a/coreutils/chmod.c b/coreutils/chmod.c index c3bef4ebe..5e12e76b9 100644 --- a/coreutils/chmod.c +++ b/coreutils/chmod.c | |||
@@ -28,9 +28,6 @@ | |||
28 | #include <unistd.h> | 28 | #include <unistd.h> |
29 | #include <getopt.h> | 29 | #include <getopt.h> |
30 | #include "busybox.h" | 30 | #include "busybox.h" |
31 | #define BB_DECLARE_EXTERN | ||
32 | #define bb_need_too_few_args | ||
33 | #include "messages.c" | ||
34 | 31 | ||
35 | 32 | ||
36 | struct stat *theMode; | 33 | struct stat *theMode; |
diff --git a/coreutils/chown.c b/coreutils/chown.c index f044a7527..b6059d048 100644 --- a/coreutils/chown.c +++ b/coreutils/chown.c | |||
@@ -27,10 +27,6 @@ | |||
27 | #include <string.h> | 27 | #include <string.h> |
28 | #include <unistd.h> | 28 | #include <unistd.h> |
29 | #include "busybox.h" | 29 | #include "busybox.h" |
30 | #define BB_DECLARE_EXTERN | ||
31 | #define bb_need_too_few_args | ||
32 | #include "messages.c" | ||
33 | |||
34 | 30 | ||
35 | /* Don't use lchown for libc5 or glibc older then 2.1.x */ | 31 | /* Don't use lchown for libc5 or glibc older then 2.1.x */ |
36 | #if (__GLIBC__ < 2) && (__GLIBC_MINOR__ < 1) | 32 | #if (__GLIBC__ < 2) && (__GLIBC_MINOR__ < 1) |
diff --git a/coreutils/date.c b/coreutils/date.c index 4b2f66add..22a1304d5 100644 --- a/coreutils/date.c +++ b/coreutils/date.c | |||
@@ -29,10 +29,6 @@ | |||
29 | #include <string.h> | 29 | #include <string.h> |
30 | #include <getopt.h> | 30 | #include <getopt.h> |
31 | #include "busybox.h" | 31 | #include "busybox.h" |
32 | #define BB_DECLARE_EXTERN | ||
33 | #define bb_need_invalid_date | ||
34 | #define bb_need_memory_exhausted | ||
35 | #include "messages.c" | ||
36 | 32 | ||
37 | 33 | ||
38 | /* This 'date' command supports only 2 time setting formats, | 34 | /* This 'date' command supports only 2 time setting formats, |
diff --git a/coreutils/du.c b/coreutils/du.c index 119895e49..3f7621b3d 100644 --- a/coreutils/du.c +++ b/coreutils/du.c | |||
@@ -31,9 +31,6 @@ | |||
31 | #include <string.h> | 31 | #include <string.h> |
32 | #include <errno.h> | 32 | #include <errno.h> |
33 | #include "busybox.h" | 33 | #include "busybox.h" |
34 | #define BB_DECLARE_EXTERN | ||
35 | #define bb_need_name_too_long | ||
36 | #include "messages.c" | ||
37 | 34 | ||
38 | 35 | ||
39 | #ifdef BB_FEATURE_HUMAN_READABLE | 36 | #ifdef BB_FEATURE_HUMAN_READABLE |
@@ -192,7 +189,7 @@ int du_main(int argc, char **argv) | |||
192 | return status; | 189 | return status; |
193 | } | 190 | } |
194 | 191 | ||
195 | /* $Id: du.c,v 1.44 2001/04/09 22:48:11 andersen Exp $ */ | 192 | /* $Id: du.c,v 1.45 2001/04/25 05:39:18 andersen Exp $ */ |
196 | /* | 193 | /* |
197 | Local Variables: | 194 | Local Variables: |
198 | c-file-style: "linux" | 195 | c-file-style: "linux" |
diff --git a/coreutils/ln.c b/coreutils/ln.c index 6d41cce62..7412a86fd 100644 --- a/coreutils/ln.c +++ b/coreutils/ln.c | |||
@@ -28,9 +28,6 @@ | |||
28 | #include <errno.h> | 28 | #include <errno.h> |
29 | #include <unistd.h> | 29 | #include <unistd.h> |
30 | #include "busybox.h" | 30 | #include "busybox.h" |
31 | #define BB_DECLARE_EXTERN | ||
32 | #define bb_need_not_a_directory | ||
33 | #include "messages.c" | ||
34 | 31 | ||
35 | 32 | ||
36 | static const int LN_SYMLINK = 1; | 33 | static const int LN_SYMLINK = 1; |
diff --git a/coreutils/mkdir.c b/coreutils/mkdir.c index 902da7c99..d78f57e2b 100644 --- a/coreutils/mkdir.c +++ b/coreutils/mkdir.c | |||
@@ -26,9 +26,6 @@ | |||
26 | #include <string.h> | 26 | #include <string.h> |
27 | #include <stdlib.h> | 27 | #include <stdlib.h> |
28 | #include "busybox.h" | 28 | #include "busybox.h" |
29 | #define bb_need_name_too_long | ||
30 | #define BB_DECLARE_EXTERN | ||
31 | #include "messages.c" | ||
32 | 29 | ||
33 | 30 | ||
34 | static int parentFlag = FALSE; | 31 | static int parentFlag = FALSE; |
diff --git a/coreutils/test.c b/coreutils/test.c index 79db8cbb6..9c66cbb87 100644 --- a/coreutils/test.c +++ b/coreutils/test.c | |||
@@ -38,9 +38,6 @@ | |||
38 | #include <stdlib.h> | 38 | #include <stdlib.h> |
39 | #include <string.h> | 39 | #include <string.h> |
40 | #include "busybox.h" | 40 | #include "busybox.h" |
41 | #define BB_DECLARE_EXTERN | ||
42 | #define bb_need_help | ||
43 | #include "messages.c" | ||
44 | 41 | ||
45 | /* test(1) accepts the following grammar: | 42 | /* test(1) accepts the following grammar: |
46 | oexpr ::= aexpr | aexpr "-o" oexpr ; | 43 | oexpr ::= aexpr | aexpr "-o" oexpr ; |
diff --git a/coreutils/tr.c b/coreutils/tr.c index ce15cfdf8..ff0f331ff 100644 --- a/coreutils/tr.c +++ b/coreutils/tr.c | |||
@@ -30,9 +30,6 @@ | |||
30 | #include <unistd.h> | 30 | #include <unistd.h> |
31 | #include <sys/types.h> | 31 | #include <sys/types.h> |
32 | #include "busybox.h" | 32 | #include "busybox.h" |
33 | #define BB_DECLARE_EXTERN | ||
34 | #define bb_need_write_error | ||
35 | #include "messages.c" | ||
36 | 33 | ||
37 | static const int ASCII = 0377; | 34 | static const int ASCII = 0377; |
38 | 35 | ||
@@ -29,10 +29,6 @@ | |||
29 | #include <string.h> | 29 | #include <string.h> |
30 | #include <getopt.h> | 30 | #include <getopt.h> |
31 | #include "busybox.h" | 31 | #include "busybox.h" |
32 | #define BB_DECLARE_EXTERN | ||
33 | #define bb_need_invalid_date | ||
34 | #define bb_need_memory_exhausted | ||
35 | #include "messages.c" | ||
36 | 32 | ||
37 | 33 | ||
38 | /* This 'date' command supports only 2 time setting formats, | 34 | /* This 'date' command supports only 2 time setting formats, |
@@ -31,9 +31,6 @@ | |||
31 | #include <string.h> | 31 | #include <string.h> |
32 | #include <errno.h> | 32 | #include <errno.h> |
33 | #include "busybox.h" | 33 | #include "busybox.h" |
34 | #define BB_DECLARE_EXTERN | ||
35 | #define bb_need_name_too_long | ||
36 | #include "messages.c" | ||
37 | 34 | ||
38 | 35 | ||
39 | #ifdef BB_FEATURE_HUMAN_READABLE | 36 | #ifdef BB_FEATURE_HUMAN_READABLE |
@@ -192,7 +189,7 @@ int du_main(int argc, char **argv) | |||
192 | return status; | 189 | return status; |
193 | } | 190 | } |
194 | 191 | ||
195 | /* $Id: du.c,v 1.44 2001/04/09 22:48:11 andersen Exp $ */ | 192 | /* $Id: du.c,v 1.45 2001/04/25 05:39:18 andersen Exp $ */ |
196 | /* | 193 | /* |
197 | Local Variables: | 194 | Local Variables: |
198 | c-file-style: "linux" | 195 | c-file-style: "linux" |
@@ -20,9 +20,6 @@ | |||
20 | #include <stdlib.h> | 20 | #include <stdlib.h> |
21 | #include <unistd.h> | 21 | #include <unistd.h> |
22 | #include "busybox.h" | 22 | #include "busybox.h" |
23 | #define BB_DECLARE_EXTERN | ||
24 | #define bb_need_io_error | ||
25 | #include "messages.c" | ||
26 | 23 | ||
27 | extern int dutmp_main(int argc, char **argv) | 24 | extern int dutmp_main(int argc, char **argv) |
28 | { | 25 | { |
@@ -65,10 +65,6 @@ static char *license_msg[] = { | |||
65 | #include <unistd.h> | 65 | #include <unistd.h> |
66 | #include <getopt.h> | 66 | #include <getopt.h> |
67 | #include "busybox.h" | 67 | #include "busybox.h" |
68 | #define BB_DECLARE_EXTERN | ||
69 | #define bb_need_memory_exhausted | ||
70 | #define bb_need_name_too_long | ||
71 | #include "messages.c" | ||
72 | 68 | ||
73 | extern int gunzip_main(int argc, char **argv) | 69 | extern int gunzip_main(int argc, char **argv) |
74 | { | 70 | { |
@@ -44,9 +44,6 @@ | |||
44 | #include <unistd.h> | 44 | #include <unistd.h> |
45 | #include <errno.h> | 45 | #include <errno.h> |
46 | #include "busybox.h" | 46 | #include "busybox.h" |
47 | #define BB_DECLARE_EXTERN | ||
48 | #define bb_need_memory_exhausted | ||
49 | #include "messages.c" | ||
50 | 47 | ||
51 | #define memzero(s, n) memset ((void *)(s), 0, (n)) | 48 | #define memzero(s, n) memset ((void *)(s), 0, (n)) |
52 | 49 | ||
diff --git a/include/libbb.h b/include/libbb.h index bbfffda6d..cbc1436fc 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
@@ -264,5 +264,17 @@ enum { | |||
264 | }; | 264 | }; |
265 | 265 | ||
266 | extern const char *applet_name; | 266 | extern const char *applet_name; |
267 | extern const char *full_version; | ||
268 | extern const char *name_too_long; | ||
269 | extern const char *omitting_directory; | ||
270 | extern const char *not_a_directory; | ||
271 | extern const char *memory_exhausted; | ||
272 | extern const char *invalid_date; | ||
273 | extern const char *invalid_option; | ||
274 | extern const char *io_error; | ||
275 | extern const char *dash_dash_help; | ||
276 | extern const char *write_error; | ||
277 | extern const char *too_few_args; | ||
278 | extern const char *name_longer_than_foo; | ||
267 | 279 | ||
268 | #endif /* __LIBBB_H__ */ | 280 | #endif /* __LIBBB_H__ */ |
@@ -43,9 +43,6 @@ | |||
43 | #include <sys/types.h> | 43 | #include <sys/types.h> |
44 | #include <sys/wait.h> | 44 | #include <sys/wait.h> |
45 | #include "busybox.h" | 45 | #include "busybox.h" |
46 | #define bb_need_full_version | ||
47 | #define BB_DECLARE_EXTERN | ||
48 | #include "messages.c" | ||
49 | #ifdef BB_SYSLOGD | 46 | #ifdef BB_SYSLOGD |
50 | # include <sys/syslog.h> | 47 | # include <sys/syslog.h> |
51 | #endif | 48 | #endif |
diff --git a/init/init.c b/init/init.c index d65220cdd..e7c096d49 100644 --- a/init/init.c +++ b/init/init.c | |||
@@ -43,9 +43,6 @@ | |||
43 | #include <sys/types.h> | 43 | #include <sys/types.h> |
44 | #include <sys/wait.h> | 44 | #include <sys/wait.h> |
45 | #include "busybox.h" | 45 | #include "busybox.h" |
46 | #define bb_need_full_version | ||
47 | #define BB_DECLARE_EXTERN | ||
48 | #include "messages.c" | ||
49 | #ifdef BB_SYSLOGD | 46 | #ifdef BB_SYSLOGD |
50 | # include <sys/syslog.h> | 47 | # include <sys/syslog.h> |
51 | #endif | 48 | #endif |
diff --git a/libbb/libbb.h b/libbb/libbb.h index bbfffda6d..cbc1436fc 100644 --- a/libbb/libbb.h +++ b/libbb/libbb.h | |||
@@ -264,5 +264,17 @@ enum { | |||
264 | }; | 264 | }; |
265 | 265 | ||
266 | extern const char *applet_name; | 266 | extern const char *applet_name; |
267 | extern const char *full_version; | ||
268 | extern const char *name_too_long; | ||
269 | extern const char *omitting_directory; | ||
270 | extern const char *not_a_directory; | ||
271 | extern const char *memory_exhausted; | ||
272 | extern const char *invalid_date; | ||
273 | extern const char *invalid_option; | ||
274 | extern const char *io_error; | ||
275 | extern const char *dash_dash_help; | ||
276 | extern const char *write_error; | ||
277 | extern const char *too_few_args; | ||
278 | extern const char *name_longer_than_foo; | ||
267 | 279 | ||
268 | #endif /* __LIBBB_H__ */ | 280 | #endif /* __LIBBB_H__ */ |
diff --git a/libbb/messages.c b/libbb/messages.c new file mode 100644 index 000000000..16ac63f69 --- /dev/null +++ b/libbb/messages.c | |||
@@ -0,0 +1,61 @@ | |||
1 | /* vi: set sw=4 ts=4: */ | ||
2 | /* | ||
3 | * Copyright (C) 2001 by Lineo, inc. | ||
4 | * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
14 | * General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 | * | ||
20 | */ | ||
21 | |||
22 | #include "../busybox.h" | ||
23 | |||
24 | #ifdef L_full_version | ||
25 | const char *full_version = BB_BANNER " multi-call binary"; | ||
26 | #endif | ||
27 | #ifdef L_name_too_long | ||
28 | const char *name_too_long = "file name too long"; | ||
29 | #endif | ||
30 | |||
31 | #ifdef L_omitting_directory | ||
32 | const char *omitting_directory = "%s: omitting directory"; | ||
33 | #endif | ||
34 | #ifdef L_not_a_directory | ||
35 | const char *not_a_directory = "%s: not a directory"; | ||
36 | #endif | ||
37 | #ifdef L_memory_exhausted | ||
38 | const char *memory_exhausted = "memory exhausted"; | ||
39 | #endif | ||
40 | #ifdef L_invalid_date | ||
41 | const char *invalid_date = "invalid date `%s'"; | ||
42 | #endif | ||
43 | #ifdef L_invalid_option | ||
44 | const char *invalid_option = "invalid option -- %c"; | ||
45 | #endif | ||
46 | #ifdef L_io_error | ||
47 | const char *io_error = "%s: input/output error -- %s"; | ||
48 | #endif | ||
49 | #ifdef L_dash_dash_help | ||
50 | const char *dash_dash_help = "--help"; | ||
51 | #endif | ||
52 | #ifdef L_write_error | ||
53 | const char *write_error = "Write Error"; | ||
54 | #endif | ||
55 | #ifdef L_too_few_args | ||
56 | const char *too_few_args = "too few arguments"; | ||
57 | #endif | ||
58 | #ifdef L_name_longer_than_foo | ||
59 | const char *name_longer_than_foo = "Names longer than %d chars not supported."; | ||
60 | #endif | ||
61 | |||
diff --git a/libbb/recursive_action.c b/libbb/recursive_action.c index 510080b83..6672db17f 100644 --- a/libbb/recursive_action.c +++ b/libbb/recursive_action.c | |||
@@ -32,12 +32,6 @@ | |||
32 | #include <stdlib.h> /* free() */ | 32 | #include <stdlib.h> /* free() */ |
33 | #include "libbb.h" | 33 | #include "libbb.h" |
34 | 34 | ||
35 | |||
36 | /* same conditions as recursive_action */ | ||
37 | #define bb_need_name_too_long | ||
38 | #define BB_DECLARE_EXTERN | ||
39 | #include "../messages.c" | ||
40 | |||
41 | #undef DEBUG_RECURS_ACTION | 35 | #undef DEBUG_RECURS_ACTION |
42 | 36 | ||
43 | 37 | ||
diff --git a/libbb/unzip.c b/libbb/unzip.c index 9568c2870..7de28930a 100644 --- a/libbb/unzip.c +++ b/libbb/unzip.c | |||
@@ -65,10 +65,6 @@ static char *license_msg[] = { | |||
65 | #include <signal.h> | 65 | #include <signal.h> |
66 | #include <stdlib.h> | 66 | #include <stdlib.h> |
67 | #include "libbb.h" | 67 | #include "libbb.h" |
68 | #define BB_DECLARE_EXTERN | ||
69 | #define bb_need_memory_exhausted | ||
70 | #define bb_need_name_too_long | ||
71 | #include "../messages.c" | ||
72 | 68 | ||
73 | FILE *in_file, *out_file; | 69 | FILE *in_file, *out_file; |
74 | 70 | ||
diff --git a/libbb/xfuncs.c b/libbb/xfuncs.c index e7f41aae2..f3b294be2 100644 --- a/libbb/xfuncs.c +++ b/libbb/xfuncs.c | |||
@@ -31,11 +31,6 @@ | |||
31 | #include <unistd.h> | 31 | #include <unistd.h> |
32 | #include "libbb.h" | 32 | #include "libbb.h" |
33 | 33 | ||
34 | /* same conditions as recursive_action */ | ||
35 | #define bb_need_memory_exhausted | ||
36 | #define BB_DECLARE_EXTERN | ||
37 | #include "../messages.c" | ||
38 | |||
39 | 34 | ||
40 | #ifndef DMALLOC | 35 | #ifndef DMALLOC |
41 | extern void *xmalloc(size_t size) | 36 | extern void *xmalloc(size_t size) |
@@ -28,9 +28,6 @@ | |||
28 | #include <errno.h> | 28 | #include <errno.h> |
29 | #include <unistd.h> | 29 | #include <unistd.h> |
30 | #include "busybox.h" | 30 | #include "busybox.h" |
31 | #define BB_DECLARE_EXTERN | ||
32 | #define bb_need_not_a_directory | ||
33 | #include "messages.c" | ||
34 | 31 | ||
35 | 32 | ||
36 | static const int LN_SYMLINK = 1; | 33 | static const int LN_SYMLINK = 1; |
diff --git a/messages.c b/messages.c deleted file mode 100644 index 57630a802..000000000 --- a/messages.c +++ /dev/null | |||
@@ -1,89 +0,0 @@ | |||
1 | /* vi: set sw=4 ts=4: */ | ||
2 | /* | ||
3 | * Copyright (C) 2000 by BitterSweet Enterprises, LLC. | ||
4 | * Written by Karl M. Hegbloom <karlheg@debian.org> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
14 | * General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 | * | ||
20 | */ | ||
21 | |||
22 | /* | ||
23 | * Let's put all of these messages in one place, and link this in as | ||
24 | * a separate object module, so that there are not going to be | ||
25 | * multiple non-unique but very similar strings in the binary. | ||
26 | * Perhaps this will make it simpler to internationalize also, and | ||
27 | * may make the binary slightly smaller. | ||
28 | */ | ||
29 | |||
30 | // To use this header file, include something like this: | ||
31 | // | ||
32 | //#define BB_DECLARE_EXTERN | ||
33 | //#define bb_need_memory_exhausted | ||
34 | //#include "messages.c" | ||
35 | // | ||
36 | //Then just use the string memory_exhausted when it is needed. | ||
37 | // | ||
38 | |||
39 | #include "busybox.h" | ||
40 | #ifndef _BB_MESSAGES_C | ||
41 | #define _BB_MESSAGES_C | ||
42 | |||
43 | #ifdef BB_DECLARE_EXTERN | ||
44 | # define BB_DEF_MESSAGE(symbol, string_const) extern const char *symbol; | ||
45 | #else | ||
46 | # define BB_DEF_MESSAGE(symbol, string_const) const char *symbol = string_const; | ||
47 | #endif | ||
48 | |||
49 | |||
50 | #if defined bb_need_full_version || ! defined BB_DECLARE_EXTERN | ||
51 | BB_DEF_MESSAGE(full_version, BB_BANNER " multi-call binary") | ||
52 | #endif | ||
53 | #if defined bb_need_name_too_long || ! defined BB_DECLARE_EXTERN | ||
54 | BB_DEF_MESSAGE(name_too_long, "file name too long") | ||
55 | #endif | ||
56 | #if defined bb_need_omitting_directory || ! defined BB_DECLARE_EXTERN | ||
57 | BB_DEF_MESSAGE(omitting_directory, "%s: omitting directory") | ||
58 | #endif | ||
59 | #if defined bb_need_not_a_directory || ! defined BB_DECLARE_EXTERN | ||
60 | BB_DEF_MESSAGE(not_a_directory, "%s: not a directory") | ||
61 | #endif | ||
62 | #if defined bb_need_memory_exhausted || ! defined BB_DECLARE_EXTERN | ||
63 | BB_DEF_MESSAGE(memory_exhausted, "memory exhausted") | ||
64 | #endif | ||
65 | #if defined bb_need_invalid_date || ! defined BB_DECLARE_EXTERN | ||
66 | BB_DEF_MESSAGE(invalid_date, "invalid date `%s'") | ||
67 | #endif | ||
68 | #if defined bb_need_invalid_option || ! defined BB_DECLARE_EXTERN | ||
69 | BB_DEF_MESSAGE(invalid_option, "invalid option -- %c") | ||
70 | #endif | ||
71 | #if defined bb_need_io_error || ! defined BB_DECLARE_EXTERN | ||
72 | BB_DEF_MESSAGE(io_error, "%s: input/output error -- %s") | ||
73 | #endif | ||
74 | #if defined bb_need_help || ! defined BB_DECLARE_EXTERN | ||
75 | BB_DEF_MESSAGE(dash_dash_help, "--help") | ||
76 | #endif | ||
77 | #if defined bb_need_write_error || ! defined BB_DECLARE_EXTERN | ||
78 | BB_DEF_MESSAGE(write_error, "Write Error") | ||
79 | #endif | ||
80 | #if defined bb_need_too_few_args || ! defined BB_DECLARE_EXTERN | ||
81 | BB_DEF_MESSAGE(too_few_args, "too few arguments") | ||
82 | #endif | ||
83 | #if defined bb_need_name_longer_than_foo || ! defined BB_DECLARE_EXTERN | ||
84 | BB_DEF_MESSAGE(name_longer_than_foo, "Names longer than %d chars not supported.") | ||
85 | #endif | ||
86 | |||
87 | |||
88 | #endif /* _BB_MESSAGES_C */ | ||
89 | |||
diff --git a/miscutils/dutmp.c b/miscutils/dutmp.c index df5ee13fb..5732539d2 100644 --- a/miscutils/dutmp.c +++ b/miscutils/dutmp.c | |||
@@ -20,9 +20,6 @@ | |||
20 | #include <stdlib.h> | 20 | #include <stdlib.h> |
21 | #include <unistd.h> | 21 | #include <unistd.h> |
22 | #include "busybox.h" | 22 | #include "busybox.h" |
23 | #define BB_DECLARE_EXTERN | ||
24 | #define bb_need_io_error | ||
25 | #include "messages.c" | ||
26 | 23 | ||
27 | extern int dutmp_main(int argc, char **argv) | 24 | extern int dutmp_main(int argc, char **argv) |
28 | { | 25 | { |
@@ -26,9 +26,6 @@ | |||
26 | #include <string.h> | 26 | #include <string.h> |
27 | #include <stdlib.h> | 27 | #include <stdlib.h> |
28 | #include "busybox.h" | 28 | #include "busybox.h" |
29 | #define bb_need_name_too_long | ||
30 | #define BB_DECLARE_EXTERN | ||
31 | #include "messages.c" | ||
32 | 29 | ||
33 | 30 | ||
34 | static int parentFlag = FALSE; | 31 | static int parentFlag = FALSE; |
@@ -31,9 +31,6 @@ | |||
31 | #include <stdlib.h> | 31 | #include <stdlib.h> |
32 | #include <sys/ioctl.h> | 32 | #include <sys/ioctl.h> |
33 | #include "busybox.h" | 33 | #include "busybox.h" |
34 | #define BB_DECLARE_EXTERN | ||
35 | #define bb_need_help | ||
36 | #include "messages.c" | ||
37 | 34 | ||
38 | /* ED: sparc termios is broken: revert back to old termio handling. */ | 35 | /* ED: sparc termios is broken: revert back to old termio handling. */ |
39 | #ifdef BB_FEATURE_USE_TERMIOS | 36 | #ifdef BB_FEATURE_USE_TERMIOS |
diff --git a/procps/ps.c b/procps/ps.c index 4ce43c47f..24f806c4b 100644 --- a/procps/ps.c +++ b/procps/ps.c | |||
@@ -38,9 +38,6 @@ | |||
38 | #include <string.h> | 38 | #include <string.h> |
39 | #include <sys/ioctl.h> | 39 | #include <sys/ioctl.h> |
40 | #include "busybox.h" | 40 | #include "busybox.h" |
41 | #define BB_DECLARE_EXTERN | ||
42 | #define bb_need_help | ||
43 | #include "messages.c" | ||
44 | 41 | ||
45 | static const int TERMINAL_WIDTH = 79; /* not 80 in case terminal has linefold bug */ | 42 | static const int TERMINAL_WIDTH = 79; /* not 80 in case terminal has linefold bug */ |
46 | 43 | ||
@@ -38,9 +38,6 @@ | |||
38 | #include <string.h> | 38 | #include <string.h> |
39 | #include <sys/ioctl.h> | 39 | #include <sys/ioctl.h> |
40 | #include "busybox.h" | 40 | #include "busybox.h" |
41 | #define BB_DECLARE_EXTERN | ||
42 | #define bb_need_help | ||
43 | #include "messages.c" | ||
44 | 41 | ||
45 | static const int TERMINAL_WIDTH = 79; /* not 80 in case terminal has linefold bug */ | 42 | static const int TERMINAL_WIDTH = 79; /* not 80 in case terminal has linefold bug */ |
46 | 43 | ||
@@ -51,10 +51,6 @@ | |||
51 | #include <stdlib.h> | 51 | #include <stdlib.h> |
52 | #include <unistd.h> | 52 | #include <unistd.h> |
53 | #include "busybox.h" | 53 | #include "busybox.h" |
54 | #define BB_DECLARE_EXTERN | ||
55 | #define bb_need_io_error | ||
56 | #define bb_need_name_longer_than_foo | ||
57 | #include "messages.c" | ||
58 | 54 | ||
59 | /* Tar file constants */ | 55 | /* Tar file constants */ |
60 | #ifndef MAJOR | 56 | #ifndef MAJOR |
@@ -38,9 +38,6 @@ | |||
38 | #include <stdlib.h> | 38 | #include <stdlib.h> |
39 | #include <string.h> | 39 | #include <string.h> |
40 | #include "busybox.h" | 40 | #include "busybox.h" |
41 | #define BB_DECLARE_EXTERN | ||
42 | #define bb_need_help | ||
43 | #include "messages.c" | ||
44 | 41 | ||
45 | /* test(1) accepts the following grammar: | 42 | /* test(1) accepts the following grammar: |
46 | oexpr ::= aexpr | aexpr "-o" oexpr ; | 43 | oexpr ::= aexpr | aexpr "-o" oexpr ; |
@@ -30,9 +30,6 @@ | |||
30 | #include <unistd.h> | 30 | #include <unistd.h> |
31 | #include <sys/types.h> | 31 | #include <sys/types.h> |
32 | #include "busybox.h" | 32 | #include "busybox.h" |
33 | #define BB_DECLARE_EXTERN | ||
34 | #define bb_need_write_error | ||
35 | #include "messages.c" | ||
36 | 33 | ||
37 | static const int ASCII = 0377; | 34 | static const int ASCII = 0377; |
38 | 35 | ||
diff --git a/util-linux/more.c b/util-linux/more.c index ffc79b179..8ae2661ab 100644 --- a/util-linux/more.c +++ b/util-linux/more.c | |||
@@ -31,9 +31,6 @@ | |||
31 | #include <stdlib.h> | 31 | #include <stdlib.h> |
32 | #include <sys/ioctl.h> | 32 | #include <sys/ioctl.h> |
33 | #include "busybox.h" | 33 | #include "busybox.h" |
34 | #define BB_DECLARE_EXTERN | ||
35 | #define bb_need_help | ||
36 | #include "messages.c" | ||
37 | 34 | ||
38 | /* ED: sparc termios is broken: revert back to old termio handling. */ | 35 | /* ED: sparc termios is broken: revert back to old termio handling. */ |
39 | #ifdef BB_FEATURE_USE_TERMIOS | 36 | #ifdef BB_FEATURE_USE_TERMIOS |