summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen2001-04-25 05:39:18 +0000
committerEric Andersen2001-04-25 05:39:18 +0000
commit04095e58fb4d3a083f77962714080ffe8139b39c (patch)
treeaa3580587822774ffed9831aacee11d977d0a5f9
parent3676374915866fb06224a19e2274afe026eb9377 (diff)
downloadbusybox-04095e58fb4d3a083f77962714080ffe8139b39c.zip
busybox-04095e58fb4d3a083f77962714080ffe8139b39c.tar.gz
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
-rw-r--r--Makefile14
-rw-r--r--applets.c4
-rw-r--r--applets/applets.c4
-rw-r--r--applets/busybox.c5
-rw-r--r--archival/gunzip.c4
-rw-r--r--archival/gzip.c3
-rw-r--r--archival/libunarchive/decompress_unzip.c4
-rw-r--r--archival/libunarchive/unzip.c4
-rw-r--r--archival/tar.c4
-rw-r--r--busybox.c5
-rw-r--r--chgrp.c4
-rw-r--r--chmod.c3
-rw-r--r--chown.c4
-rw-r--r--coreutils/chgrp.c4
-rw-r--r--coreutils/chmod.c3
-rw-r--r--coreutils/chown.c4
-rw-r--r--coreutils/date.c4
-rw-r--r--coreutils/du.c5
-rw-r--r--coreutils/ln.c3
-rw-r--r--coreutils/mkdir.c3
-rw-r--r--coreutils/test.c3
-rw-r--r--coreutils/tr.c3
-rw-r--r--date.c4
-rw-r--r--du.c5
-rw-r--r--dutmp.c3
-rw-r--r--gunzip.c4
-rw-r--r--gzip.c3
-rw-r--r--include/libbb.h12
-rw-r--r--init.c3
-rw-r--r--init/init.c3
-rw-r--r--libbb/libbb.h12
-rw-r--r--libbb/messages.c61
-rw-r--r--libbb/recursive_action.c6
-rw-r--r--libbb/unzip.c4
-rw-r--r--libbb/xfuncs.c5
-rw-r--r--ln.c3
-rw-r--r--messages.c89
-rw-r--r--miscutils/dutmp.c3
-rw-r--r--mkdir.c3
-rw-r--r--more.c3
-rw-r--r--procps/ps.c3
-rw-r--r--ps.c3
-rw-r--r--tar.c4
-rw-r--r--test.c3
-rw-r--r--tr.c3
-rw-r--r--util-linux/more.c3
46 files changed, 98 insertions, 241 deletions
diff --git a/Makefile b/Makefile
index 005fb4d..d6a1cd9 100644
--- a/Makefile
+++ b/Makefile
@@ -212,7 +212,7 @@ endif
# And option 4:
-include applet_source_list
-OBJECTS = $(APPLET_SOURCES:.c=.o) busybox.o messages.o usage.o applets.o
+OBJECTS = $(APPLET_SOURCES:.c=.o) busybox.o usage.o applets.o
CFLAGS += $(CROSS_CFLAGS)
CFLAGS += -DBB_VER='"$(VERSION)"'
CFLAGS += -DBB_BT='"$(BUILDTIME)"'
@@ -249,13 +249,18 @@ recursive_action.c safe_read.c safe_strncpy.c seek_ared_file.c syscalls.c \
syslog_msg_with_name.c time_string.c trim.c untar.c unzip.c vdprintf.c \
verror_msg.c vperror_msg.c wfopen.c xfuncs.c xgetcwd.c xregcomp.c interface.c \
remove_file.c
-
LIBBB_OBJS=$(patsubst %.c,$(LIBBB)/%.o, $(LIBBB_CSRC))
LIBBB_CFLAGS = -I$(LIBBB)
ifneq ($(strip $(BB_SRC_DIR)),)
LIBBB_CFLAGS += -I$(BB_SRC_DIR)/$(LIBBB)
endif
+LIBBB_MSRC=libbb/messages.c
+LIBBB_MESSAGES= full_version name_too_long omitting_directory not_a_directory \
+memory_exhausted invalid_date invalid_option io_error dash_dash_help \
+write_error too_few_args name_longer_than_foo
+LIBBB_MOBJ=$(patsubst %,$(LIBBB)/%.o, $(LIBBB_MESSAGES))
+
# Put user-supplied flags at the end, where they
# have a chance of winning.
@@ -352,10 +357,13 @@ $(LIBBB_OBJS): %.o: %.c Config.h busybox.h applets.h Makefile libbb/libbb.h
- mkdir -p $(LIBBB)
$(CC) $(CFLAGS) $(LIBBB_CFLAGS) -c $< -o $*.o
+$(LIBBB_MOBJ): $(LIBBB_MSRC)
+ $(CC) $(CFLAGS) $(LIBBB_CFLAGS) -DL_$(patsubst libbb/%,%,$*) -c $< -o $*.o
+
libpwd.a: $(PWD_OBJS)
$(AR) $(ARFLAGS) $@ $^
-libbb.a: $(LIBBB_OBJS)
+libbb.a: $(LIBBB_MOBJ) $(LIBBB_OBJS)
$(AR) $(ARFLAGS) $@ $^
usage.o: usage.h
diff --git a/applets.c b/applets.c
index 10b44a5..c1575c7 100644
--- a/applets.c
+++ b/applets.c
@@ -35,10 +35,6 @@
#undef PROTOTYPES
#include "applets.h"
-#define bb_need_full_version
-#define BB_DECLARE_EXTERN
-#include "messages.c"
-
struct BB_applet *applet_using;
/* The -1 arises because of the {0,NULL,0,-1} entry above. */
diff --git a/applets/applets.c b/applets/applets.c
index 10b44a5..c1575c7 100644
--- a/applets/applets.c
+++ b/applets/applets.c
@@ -35,10 +35,6 @@
#undef PROTOTYPES
#include "applets.h"
-#define bb_need_full_version
-#define BB_DECLARE_EXTERN
-#include "messages.c"
-
struct BB_applet *applet_using;
/* The -1 arises because of the {0,NULL,0,-1} entry above. */
diff --git a/applets/busybox.c b/applets/busybox.c
index 9db26df..b4939e1 100644
--- a/applets/busybox.c
+++ b/applets/busybox.c
@@ -5,11 +5,6 @@
#include <errno.h>
#include <stdlib.h>
#include "busybox.h"
-
-#define bb_need_full_version
-#define BB_DECLARE_EXTERN
-#include "messages.c"
-
#ifdef BB_LOCALE_SUPPORT
#include <locale.h>
#endif
diff --git a/archival/gunzip.c b/archival/gunzip.c
index b4edb25..db5f6ee 100644
--- a/archival/gunzip.c
+++ b/archival/gunzip.c
@@ -65,10 +65,6 @@ static char *license_msg[] = {
#include <unistd.h>
#include <getopt.h>
#include "busybox.h"
-#define BB_DECLARE_EXTERN
-#define bb_need_memory_exhausted
-#define bb_need_name_too_long
-#include "messages.c"
extern int gunzip_main(int argc, char **argv)
{
diff --git a/archival/gzip.c b/archival/gzip.c
index f05ef95..6d46926 100644
--- a/archival/gzip.c
+++ b/archival/gzip.c
@@ -44,9 +44,6 @@
#include <unistd.h>
#include <errno.h>
#include "busybox.h"
-#define BB_DECLARE_EXTERN
-#define bb_need_memory_exhausted
-#include "messages.c"
#define memzero(s, n) memset ((void *)(s), 0, (n))
diff --git a/archival/libunarchive/decompress_unzip.c b/archival/libunarchive/decompress_unzip.c
index 9568c28..7de2893 100644
--- a/archival/libunarchive/decompress_unzip.c
+++ b/archival/libunarchive/decompress_unzip.c
@@ -65,10 +65,6 @@ static char *license_msg[] = {
#include <signal.h>
#include <stdlib.h>
#include "libbb.h"
-#define BB_DECLARE_EXTERN
-#define bb_need_memory_exhausted
-#define bb_need_name_too_long
-#include "../messages.c"
FILE *in_file, *out_file;
diff --git a/archival/libunarchive/unzip.c b/archival/libunarchive/unzip.c
index 9568c28..7de2893 100644
--- a/archival/libunarchive/unzip.c
+++ b/archival/libunarchive/unzip.c
@@ -65,10 +65,6 @@ static char *license_msg[] = {
#include <signal.h>
#include <stdlib.h>
#include "libbb.h"
-#define BB_DECLARE_EXTERN
-#define bb_need_memory_exhausted
-#define bb_need_name_too_long
-#include "../messages.c"
FILE *in_file, *out_file;
diff --git a/archival/tar.c b/archival/tar.c
index 7cfad72..48284c0 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -51,10 +51,6 @@
#include <stdlib.h>
#include <unistd.h>
#include "busybox.h"
-#define BB_DECLARE_EXTERN
-#define bb_need_io_error
-#define bb_need_name_longer_than_foo
-#include "messages.c"
/* Tar file constants */
#ifndef MAJOR
diff --git a/busybox.c b/busybox.c
index 9db26df..b4939e1 100644
--- a/busybox.c
+++ b/busybox.c
@@ -5,11 +5,6 @@
#include <errno.h>
#include <stdlib.h>
#include "busybox.h"
-
-#define bb_need_full_version
-#define BB_DECLARE_EXTERN
-#include "messages.c"
-
#ifdef BB_LOCALE_SUPPORT
#include <locale.h>
#endif
diff --git a/chgrp.c b/chgrp.c
index 739d09f..c6312a7 100644
--- a/chgrp.c
+++ b/chgrp.c
@@ -27,10 +27,6 @@
#include <string.h>
#include <unistd.h>
#include "busybox.h"
-#define BB_DECLARE_EXTERN
-#define bb_need_invalid_option
-#define bb_need_too_few_args
-#include "messages.c"
/* Don't use lchown for libc5 or glibc older then 2.1.x */
#if (__GLIBC__ < 2) && (__GLIBC_MINOR__ < 1)
diff --git a/chmod.c b/chmod.c
index c3bef4e..5e12e76 100644
--- a/chmod.c
+++ b/chmod.c
@@ -28,9 +28,6 @@
#include <unistd.h>
#include <getopt.h>
#include "busybox.h"
-#define BB_DECLARE_EXTERN
-#define bb_need_too_few_args
-#include "messages.c"
struct stat *theMode;
diff --git a/chown.c b/chown.c
index f044a75..b6059d0 100644
--- a/chown.c
+++ b/chown.c
@@ -27,10 +27,6 @@
#include <string.h>
#include <unistd.h>
#include "busybox.h"
-#define BB_DECLARE_EXTERN
-#define bb_need_too_few_args
-#include "messages.c"
-
/* Don't use lchown for libc5 or glibc older then 2.1.x */
#if (__GLIBC__ < 2) && (__GLIBC_MINOR__ < 1)
diff --git a/coreutils/chgrp.c b/coreutils/chgrp.c
index 739d09f..c6312a7 100644
--- a/coreutils/chgrp.c
+++ b/coreutils/chgrp.c
@@ -27,10 +27,6 @@
#include <string.h>
#include <unistd.h>
#include "busybox.h"
-#define BB_DECLARE_EXTERN
-#define bb_need_invalid_option
-#define bb_need_too_few_args
-#include "messages.c"
/* Don't use lchown for libc5 or glibc older then 2.1.x */
#if (__GLIBC__ < 2) && (__GLIBC_MINOR__ < 1)
diff --git a/coreutils/chmod.c b/coreutils/chmod.c
index c3bef4e..5e12e76 100644
--- a/coreutils/chmod.c
+++ b/coreutils/chmod.c
@@ -28,9 +28,6 @@
#include <unistd.h>
#include <getopt.h>
#include "busybox.h"
-#define BB_DECLARE_EXTERN
-#define bb_need_too_few_args
-#include "messages.c"
struct stat *theMode;
diff --git a/coreutils/chown.c b/coreutils/chown.c
index f044a75..b6059d0 100644
--- a/coreutils/chown.c
+++ b/coreutils/chown.c
@@ -27,10 +27,6 @@
#include <string.h>
#include <unistd.h>
#include "busybox.h"
-#define BB_DECLARE_EXTERN
-#define bb_need_too_few_args
-#include "messages.c"
-
/* Don't use lchown for libc5 or glibc older then 2.1.x */
#if (__GLIBC__ < 2) && (__GLIBC_MINOR__ < 1)
diff --git a/coreutils/date.c b/coreutils/date.c
index 4b2f66a..22a1304 100644
--- a/coreutils/date.c
+++ b/coreutils/date.c
@@ -29,10 +29,6 @@
#include <string.h>
#include <getopt.h>
#include "busybox.h"
-#define BB_DECLARE_EXTERN
-#define bb_need_invalid_date
-#define bb_need_memory_exhausted
-#include "messages.c"
/* This 'date' command supports only 2 time setting formats,
diff --git a/coreutils/du.c b/coreutils/du.c
index 119895e..3f7621b 100644
--- a/coreutils/du.c
+++ b/coreutils/du.c
@@ -31,9 +31,6 @@
#include <string.h>
#include <errno.h>
#include "busybox.h"
-#define BB_DECLARE_EXTERN
-#define bb_need_name_too_long
-#include "messages.c"
#ifdef BB_FEATURE_HUMAN_READABLE
@@ -192,7 +189,7 @@ int du_main(int argc, char **argv)
return status;
}
-/* $Id: du.c,v 1.44 2001/04/09 22:48:11 andersen Exp $ */
+/* $Id: du.c,v 1.45 2001/04/25 05:39:18 andersen Exp $ */
/*
Local Variables:
c-file-style: "linux"
diff --git a/coreutils/ln.c b/coreutils/ln.c
index 6d41cce..7412a86 100644
--- a/coreutils/ln.c
+++ b/coreutils/ln.c
@@ -28,9 +28,6 @@
#include <errno.h>
#include <unistd.h>
#include "busybox.h"
-#define BB_DECLARE_EXTERN
-#define bb_need_not_a_directory
-#include "messages.c"
static const int LN_SYMLINK = 1;
diff --git a/coreutils/mkdir.c b/coreutils/mkdir.c
index 902da7c..d78f57e 100644
--- a/coreutils/mkdir.c
+++ b/coreutils/mkdir.c
@@ -26,9 +26,6 @@
#include <string.h>
#include <stdlib.h>
#include "busybox.h"
-#define bb_need_name_too_long
-#define BB_DECLARE_EXTERN
-#include "messages.c"
static int parentFlag = FALSE;
diff --git a/coreutils/test.c b/coreutils/test.c
index 79db8cb..9c66cbb 100644
--- a/coreutils/test.c
+++ b/coreutils/test.c
@@ -38,9 +38,6 @@
#include <stdlib.h>
#include <string.h>
#include "busybox.h"
-#define BB_DECLARE_EXTERN
-#define bb_need_help
-#include "messages.c"
/* test(1) accepts the following grammar:
oexpr ::= aexpr | aexpr "-o" oexpr ;
diff --git a/coreutils/tr.c b/coreutils/tr.c
index ce15cfd..ff0f331 100644
--- a/coreutils/tr.c
+++ b/coreutils/tr.c
@@ -30,9 +30,6 @@
#include <unistd.h>
#include <sys/types.h>
#include "busybox.h"
-#define BB_DECLARE_EXTERN
-#define bb_need_write_error
-#include "messages.c"
static const int ASCII = 0377;
diff --git a/date.c b/date.c
index 4b2f66a..22a1304 100644
--- a/date.c
+++ b/date.c
@@ -29,10 +29,6 @@
#include <string.h>
#include <getopt.h>
#include "busybox.h"
-#define BB_DECLARE_EXTERN
-#define bb_need_invalid_date
-#define bb_need_memory_exhausted
-#include "messages.c"
/* This 'date' command supports only 2 time setting formats,
diff --git a/du.c b/du.c
index 119895e..3f7621b 100644
--- a/du.c
+++ b/du.c
@@ -31,9 +31,6 @@
#include <string.h>
#include <errno.h>
#include "busybox.h"
-#define BB_DECLARE_EXTERN
-#define bb_need_name_too_long
-#include "messages.c"
#ifdef BB_FEATURE_HUMAN_READABLE
@@ -192,7 +189,7 @@ int du_main(int argc, char **argv)
return status;
}
-/* $Id: du.c,v 1.44 2001/04/09 22:48:11 andersen Exp $ */
+/* $Id: du.c,v 1.45 2001/04/25 05:39:18 andersen Exp $ */
/*
Local Variables:
c-file-style: "linux"
diff --git a/dutmp.c b/dutmp.c
index df5ee13..5732539 100644
--- a/dutmp.c
+++ b/dutmp.c
@@ -20,9 +20,6 @@
#include <stdlib.h>
#include <unistd.h>
#include "busybox.h"
-#define BB_DECLARE_EXTERN
-#define bb_need_io_error
-#include "messages.c"
extern int dutmp_main(int argc, char **argv)
{
diff --git a/gunzip.c b/gunzip.c
index b4edb25..db5f6ee 100644
--- a/gunzip.c
+++ b/gunzip.c
@@ -65,10 +65,6 @@ static char *license_msg[] = {
#include <unistd.h>
#include <getopt.h>
#include "busybox.h"
-#define BB_DECLARE_EXTERN
-#define bb_need_memory_exhausted
-#define bb_need_name_too_long
-#include "messages.c"
extern int gunzip_main(int argc, char **argv)
{
diff --git a/gzip.c b/gzip.c
index f05ef95..6d46926 100644
--- a/gzip.c
+++ b/gzip.c
@@ -44,9 +44,6 @@
#include <unistd.h>
#include <errno.h>
#include "busybox.h"
-#define BB_DECLARE_EXTERN
-#define bb_need_memory_exhausted
-#include "messages.c"
#define memzero(s, n) memset ((void *)(s), 0, (n))
diff --git a/include/libbb.h b/include/libbb.h
index bbfffda..cbc1436 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -264,5 +264,17 @@ enum {
};
extern const char *applet_name;
+extern const char *full_version;
+extern const char *name_too_long;
+extern const char *omitting_directory;
+extern const char *not_a_directory;
+extern const char *memory_exhausted;
+extern const char *invalid_date;
+extern const char *invalid_option;
+extern const char *io_error;
+extern const char *dash_dash_help;
+extern const char *write_error;
+extern const char *too_few_args;
+extern const char *name_longer_than_foo;
#endif /* __LIBBB_H__ */
diff --git a/init.c b/init.c
index d65220c..e7c096d 100644
--- a/init.c
+++ b/init.c
@@ -43,9 +43,6 @@
#include <sys/types.h>
#include <sys/wait.h>
#include "busybox.h"
-#define bb_need_full_version
-#define BB_DECLARE_EXTERN
-#include "messages.c"
#ifdef BB_SYSLOGD
# include <sys/syslog.h>
#endif
diff --git a/init/init.c b/init/init.c
index d65220c..e7c096d 100644
--- a/init/init.c
+++ b/init/init.c
@@ -43,9 +43,6 @@
#include <sys/types.h>
#include <sys/wait.h>
#include "busybox.h"
-#define bb_need_full_version
-#define BB_DECLARE_EXTERN
-#include "messages.c"
#ifdef BB_SYSLOGD
# include <sys/syslog.h>
#endif
diff --git a/libbb/libbb.h b/libbb/libbb.h
index bbfffda..cbc1436 100644
--- a/libbb/libbb.h
+++ b/libbb/libbb.h
@@ -264,5 +264,17 @@ enum {
};
extern const char *applet_name;
+extern const char *full_version;
+extern const char *name_too_long;
+extern const char *omitting_directory;
+extern const char *not_a_directory;
+extern const char *memory_exhausted;
+extern const char *invalid_date;
+extern const char *invalid_option;
+extern const char *io_error;
+extern const char *dash_dash_help;
+extern const char *write_error;
+extern const char *too_few_args;
+extern const char *name_longer_than_foo;
#endif /* __LIBBB_H__ */
diff --git a/libbb/messages.c b/libbb/messages.c
new file mode 100644
index 0000000..16ac63f
--- /dev/null
+++ b/libbb/messages.c
@@ -0,0 +1,61 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * Copyright (C) 2001 by Lineo, inc.
+ * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include "../busybox.h"
+
+#ifdef L_full_version
+ const char *full_version = BB_BANNER " multi-call binary";
+#endif
+#ifdef L_name_too_long
+ const char *name_too_long = "file name too long";
+#endif
+
+#ifdef L_omitting_directory
+ const char *omitting_directory = "%s: omitting directory";
+#endif
+#ifdef L_not_a_directory
+ const char *not_a_directory = "%s: not a directory";
+#endif
+#ifdef L_memory_exhausted
+ const char *memory_exhausted = "memory exhausted";
+#endif
+#ifdef L_invalid_date
+ const char *invalid_date = "invalid date `%s'";
+#endif
+#ifdef L_invalid_option
+ const char *invalid_option = "invalid option -- %c";
+#endif
+#ifdef L_io_error
+ const char *io_error = "%s: input/output error -- %s";
+#endif
+#ifdef L_dash_dash_help
+ const char *dash_dash_help = "--help";
+#endif
+#ifdef L_write_error
+ const char *write_error = "Write Error";
+#endif
+#ifdef L_too_few_args
+ const char *too_few_args = "too few arguments";
+#endif
+#ifdef L_name_longer_than_foo
+ const char *name_longer_than_foo = "Names longer than %d chars not supported.";
+#endif
+
diff --git a/libbb/recursive_action.c b/libbb/recursive_action.c
index 510080b..6672db1 100644
--- a/libbb/recursive_action.c
+++ b/libbb/recursive_action.c
@@ -32,12 +32,6 @@
#include <stdlib.h> /* free() */
#include "libbb.h"
-
-/* same conditions as recursive_action */
-#define bb_need_name_too_long
-#define BB_DECLARE_EXTERN
-#include "../messages.c"
-
#undef DEBUG_RECURS_ACTION
diff --git a/libbb/unzip.c b/libbb/unzip.c
index 9568c28..7de2893 100644
--- a/libbb/unzip.c
+++ b/libbb/unzip.c
@@ -65,10 +65,6 @@ static char *license_msg[] = {
#include <signal.h>
#include <stdlib.h>
#include "libbb.h"
-#define BB_DECLARE_EXTERN
-#define bb_need_memory_exhausted
-#define bb_need_name_too_long
-#include "../messages.c"
FILE *in_file, *out_file;
diff --git a/libbb/xfuncs.c b/libbb/xfuncs.c
index e7f41aa..f3b294b 100644
--- a/libbb/xfuncs.c
+++ b/libbb/xfuncs.c
@@ -31,11 +31,6 @@
#include <unistd.h>
#include "libbb.h"
-/* same conditions as recursive_action */
-#define bb_need_memory_exhausted
-#define BB_DECLARE_EXTERN
-#include "../messages.c"
-
#ifndef DMALLOC
extern void *xmalloc(size_t size)
diff --git a/ln.c b/ln.c
index 6d41cce..7412a86 100644
--- a/ln.c
+++ b/ln.c
@@ -28,9 +28,6 @@
#include <errno.h>
#include <unistd.h>
#include "busybox.h"
-#define BB_DECLARE_EXTERN
-#define bb_need_not_a_directory
-#include "messages.c"
static const int LN_SYMLINK = 1;
diff --git a/messages.c b/messages.c
deleted file mode 100644
index 57630a8..0000000
--- a/messages.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/* vi: set sw=4 ts=4: */
-/*
- * Copyright (C) 2000 by BitterSweet Enterprises, LLC.
- * Written by Karl M. Hegbloom <karlheg@debian.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-
-/*
- * Let's put all of these messages in one place, and link this in as
- * a separate object module, so that there are not going to be
- * multiple non-unique but very similar strings in the binary.
- * Perhaps this will make it simpler to internationalize also, and
- * may make the binary slightly smaller.
- */
-
-// To use this header file, include something like this:
-//
-//#define BB_DECLARE_EXTERN
-//#define bb_need_memory_exhausted
-//#include "messages.c"
-//
-//Then just use the string memory_exhausted when it is needed.
-//
-
-#include "busybox.h"
-#ifndef _BB_MESSAGES_C
-#define _BB_MESSAGES_C
-
-#ifdef BB_DECLARE_EXTERN
-# define BB_DEF_MESSAGE(symbol, string_const) extern const char *symbol;
-#else
-# define BB_DEF_MESSAGE(symbol, string_const) const char *symbol = string_const;
-#endif
-
-
-#if defined bb_need_full_version || ! defined BB_DECLARE_EXTERN
- BB_DEF_MESSAGE(full_version, BB_BANNER " multi-call binary")
-#endif
-#if defined bb_need_name_too_long || ! defined BB_DECLARE_EXTERN
- BB_DEF_MESSAGE(name_too_long, "file name too long")
-#endif
-#if defined bb_need_omitting_directory || ! defined BB_DECLARE_EXTERN
- BB_DEF_MESSAGE(omitting_directory, "%s: omitting directory")
-#endif
-#if defined bb_need_not_a_directory || ! defined BB_DECLARE_EXTERN
- BB_DEF_MESSAGE(not_a_directory, "%s: not a directory")
-#endif
-#if defined bb_need_memory_exhausted || ! defined BB_DECLARE_EXTERN
- BB_DEF_MESSAGE(memory_exhausted, "memory exhausted")
-#endif
-#if defined bb_need_invalid_date || ! defined BB_DECLARE_EXTERN
- BB_DEF_MESSAGE(invalid_date, "invalid date `%s'")
-#endif
-#if defined bb_need_invalid_option || ! defined BB_DECLARE_EXTERN
- BB_DEF_MESSAGE(invalid_option, "invalid option -- %c")
-#endif
-#if defined bb_need_io_error || ! defined BB_DECLARE_EXTERN
- BB_DEF_MESSAGE(io_error, "%s: input/output error -- %s")
-#endif
-#if defined bb_need_help || ! defined BB_DECLARE_EXTERN
- BB_DEF_MESSAGE(dash_dash_help, "--help")
-#endif
-#if defined bb_need_write_error || ! defined BB_DECLARE_EXTERN
- BB_DEF_MESSAGE(write_error, "Write Error")
-#endif
-#if defined bb_need_too_few_args || ! defined BB_DECLARE_EXTERN
- BB_DEF_MESSAGE(too_few_args, "too few arguments")
-#endif
-#if defined bb_need_name_longer_than_foo || ! defined BB_DECLARE_EXTERN
- BB_DEF_MESSAGE(name_longer_than_foo, "Names longer than %d chars not supported.")
-#endif
-
-
-#endif /* _BB_MESSAGES_C */
-
diff --git a/miscutils/dutmp.c b/miscutils/dutmp.c
index df5ee13..5732539 100644
--- a/miscutils/dutmp.c
+++ b/miscutils/dutmp.c
@@ -20,9 +20,6 @@
#include <stdlib.h>
#include <unistd.h>
#include "busybox.h"
-#define BB_DECLARE_EXTERN
-#define bb_need_io_error
-#include "messages.c"
extern int dutmp_main(int argc, char **argv)
{
diff --git a/mkdir.c b/mkdir.c
index 902da7c..d78f57e 100644
--- a/mkdir.c
+++ b/mkdir.c
@@ -26,9 +26,6 @@
#include <string.h>
#include <stdlib.h>
#include "busybox.h"
-#define bb_need_name_too_long
-#define BB_DECLARE_EXTERN
-#include "messages.c"
static int parentFlag = FALSE;
diff --git a/more.c b/more.c
index ffc79b1..8ae2661 100644
--- a/more.c
+++ b/more.c
@@ -31,9 +31,6 @@
#include <stdlib.h>
#include <sys/ioctl.h>
#include "busybox.h"
-#define BB_DECLARE_EXTERN
-#define bb_need_help
-#include "messages.c"
/* ED: sparc termios is broken: revert back to old termio handling. */
#ifdef BB_FEATURE_USE_TERMIOS
diff --git a/procps/ps.c b/procps/ps.c
index 4ce43c4..24f806c 100644
--- a/procps/ps.c
+++ b/procps/ps.c
@@ -38,9 +38,6 @@
#include <string.h>
#include <sys/ioctl.h>
#include "busybox.h"
-#define BB_DECLARE_EXTERN
-#define bb_need_help
-#include "messages.c"
static const int TERMINAL_WIDTH = 79; /* not 80 in case terminal has linefold bug */
diff --git a/ps.c b/ps.c
index 4ce43c4..24f806c 100644
--- a/ps.c
+++ b/ps.c
@@ -38,9 +38,6 @@
#include <string.h>
#include <sys/ioctl.h>
#include "busybox.h"
-#define BB_DECLARE_EXTERN
-#define bb_need_help
-#include "messages.c"
static const int TERMINAL_WIDTH = 79; /* not 80 in case terminal has linefold bug */
diff --git a/tar.c b/tar.c
index 7cfad72..48284c0 100644
--- a/tar.c
+++ b/tar.c
@@ -51,10 +51,6 @@
#include <stdlib.h>
#include <unistd.h>
#include "busybox.h"
-#define BB_DECLARE_EXTERN
-#define bb_need_io_error
-#define bb_need_name_longer_than_foo
-#include "messages.c"
/* Tar file constants */
#ifndef MAJOR
diff --git a/test.c b/test.c
index 79db8cb..9c66cbb 100644
--- a/test.c
+++ b/test.c
@@ -38,9 +38,6 @@
#include <stdlib.h>
#include <string.h>
#include "busybox.h"
-#define BB_DECLARE_EXTERN
-#define bb_need_help
-#include "messages.c"
/* test(1) accepts the following grammar:
oexpr ::= aexpr | aexpr "-o" oexpr ;
diff --git a/tr.c b/tr.c
index ce15cfd..ff0f331 100644
--- a/tr.c
+++ b/tr.c
@@ -30,9 +30,6 @@
#include <unistd.h>
#include <sys/types.h>
#include "busybox.h"
-#define BB_DECLARE_EXTERN
-#define bb_need_write_error
-#include "messages.c"
static const int ASCII = 0377;
diff --git a/util-linux/more.c b/util-linux/more.c
index ffc79b1..8ae2661 100644
--- a/util-linux/more.c
+++ b/util-linux/more.c
@@ -31,9 +31,6 @@
#include <stdlib.h>
#include <sys/ioctl.h>
#include "busybox.h"
-#define BB_DECLARE_EXTERN
-#define bb_need_help
-#include "messages.c"
/* ED: sparc termios is broken: revert back to old termio handling. */
#ifdef BB_FEATURE_USE_TERMIOS