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 /libbb | |
| 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
Diffstat (limited to 'libbb')
| -rw-r--r-- | libbb/libbb.h | 12 | ||||
| -rw-r--r-- | libbb/messages.c | 61 | ||||
| -rw-r--r-- | libbb/recursive_action.c | 6 | ||||
| -rw-r--r-- | libbb/unzip.c | 4 | ||||
| -rw-r--r-- | libbb/xfuncs.c | 5 |
5 files changed, 73 insertions, 15 deletions
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) |
