summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2002-01-02 11:05:00 +0000
committerBruno Haible <bruno@clisp.org>2009-06-22 00:29:09 +0200
commit8817d43473b02eac28150c5c5048956e49d7b815 (patch)
tree9d51b7cdc88a2aecac416fb27f214087ed3c92fb
parent427f2c17087ca21f48435083b01e83203824a336 (diff)
downloadexternal_gettext-8817d43473b02eac28150c5c5048956e49d7b815.zip
external_gettext-8817d43473b02eac28150c5c5048956e49d7b815.tar.gz
external_gettext-8817d43473b02eac28150c5c5048956e49d7b815.tar.bz2
Split system.h into many small include files: binary-io.h exit.h liballoca.h
pathname.h stpcpy.h stpncpy.h strcase.h xgetcwd.h.
-rw-r--r--lib/ChangeLog45
-rw-r--r--lib/Makefile.am21
-rw-r--r--lib/argmatch.c10
-rw-r--r--lib/binary-io.h55
-rw-r--r--lib/concatpath.c5
-rw-r--r--lib/copy-file.c12
-rw-r--r--lib/execute.c5
-rw-r--r--lib/exit.h32
-rw-r--r--lib/findprog.c2
-rw-r--r--lib/javacomp.c27
-rw-r--r--lib/javaexec.c27
-rw-r--r--lib/liballoca.h56
-rw-r--r--lib/linebreak.c2
-rw-r--r--lib/linebreak.h3
-rw-r--r--lib/minmax.h2
-rw-r--r--lib/pathname.h59
-rw-r--r--lib/pipe-bidi.c5
-rw-r--r--lib/pipe-in.c5
-rw-r--r--lib/pipe-out.c5
-rw-r--r--lib/setenv.c27
-rw-r--r--lib/stpcpy.h40
-rw-r--r--lib/stpncpy.h42
-rw-r--r--lib/strcase.h35
-rw-r--r--lib/system.h157
-rw-r--r--lib/wait-process.c5
-rw-r--r--lib/xerror.c5
-rw-r--r--lib/xgetcwd.h27
-rw-r--r--lib/xmalloc.c5
-rw-r--r--src/ChangeLog63
-rw-r--r--src/dir-list.c3
-rw-r--r--src/file-list.c2
-rw-r--r--src/format-java.c1
-rw-r--r--src/format-lisp.c1
-rw-r--r--src/gettext.c2
-rw-r--r--src/hostname.c2
-rw-r--r--src/msgattrib.c2
-rw-r--r--src/msgcat.c2
-rw-r--r--src/msgcmp.c3
-rw-r--r--src/msgcomm.c2
-rw-r--r--src/msgconv.c2
-rw-r--r--src/msgen.c3
-rw-r--r--src/msgexec.c2
-rw-r--r--src/msgfilter.c3
-rw-r--r--src/msgfmt.c5
-rw-r--r--src/msggrep.c3
-rw-r--r--src/msginit.c5
-rw-r--r--src/msgl-cat.c5
-rw-r--r--src/msgl-charset.c5
-rw-r--r--src/msgl-iconv.c3
-rw-r--r--src/msgmerge.c6
-rw-r--r--src/msgunfmt.c2
-rw-r--r--src/msguniq.c2
-rw-r--r--src/ngettext.c2
-rw-r--r--src/open-po.c14
-rw-r--r--src/po-charset.c8
-rw-r--r--src/po-gram-gen.y1
-rw-r--r--src/po-hash-gen.y1
-rw-r--r--src/po-lex.c6
-rw-r--r--src/read-java.c2
-rw-r--r--src/read-mo.c5
-rw-r--r--src/urlget.c12
-rw-r--r--src/write-java.c3
-rw-r--r--src/write-mo.c6
-rw-r--r--src/write-po.c3
-rw-r--r--src/x-c.c3
-rw-r--r--src/x-librep.c3
-rw-r--r--src/x-lisp.c3
-rw-r--r--src/x-rst.c4
-rw-r--r--src/x-ycp.c2
-rw-r--r--src/xgettext.c19
-rw-r--r--src/xgettext.h2
-rw-r--r--tests/ChangeLog4
-rw-r--r--tests/tstngettext.c2
73 files changed, 575 insertions, 380 deletions
diff --git a/lib/ChangeLog b/lib/ChangeLog
index e32ea71..a62960f 100644
--- a/lib/ChangeLog
+++ b/lib/ChangeLog
@@ -1,3 +1,48 @@
+2001-12-22 Bruno Haible <bruno@clisp.org>
+
+ * binary-io.h: New file, extracted from system.h.
+ * exit.h: New file, extracted from system.h.
+ * liballoca.h: New file, extracted from system.h.
+ * pathname.h: New file, extracted from system.h.
+ * stpcpy.h: New file, extracted from system.h.
+ * stpncpy.h: New file, extracted from system.h.
+ * strcase.h: New file, extracted from system.h.
+ * xgetcwd.h: New file, extracted from system.h.
+ * system.h: Remove file.
+ * Makefile.am (libgettextlib_la_SOURCES): Remove xgetcwd.c.
+ (libgettextlib_la_HEADER): Add binary-io.h, exit.h, liballoca.h,
+ pathname.h. Remove system.h.
+ (LIBADD_HEADER): Add stpcpy.h, stpncpy.h, strcase.h.
+ (UNUSED_SOURCE): Add xgetcwd.c.
+ (UNUSED_HEADER): Add xgetcwd.h.
+ * argmatch.c: Include exit.h instead of <stdlib.h>.
+ (EXIT_FAILURE): Remove fallback definition.
+ * concatpath.c: Include pathname.h, <string.h>, stpcpy.h instead of
+ system.h.
+ * copy-file.c: Include <unistd.h>, binary-io.h, exit.h instead of
+ system.h.
+ (O_BINARY): Remove fallback definition.
+ * execute.c: Include exit.h.
+ (EXIT_FAILURE): Remove fallback definition.
+ * findprog.c: Include pathname.h instead of system.h.
+ * javacomp.c: Include liballoca.h. Remove alloca() declaration stuff.
+ * javaexec.c: Likewise.
+ * setenv.c: Likewise.
+ * linebreak.h: Include <stddef.h> instead of <stdlib.h>.
+ * linebreak.c: Include <stdlib.h> instead of <stddef.h>.
+ * pipe-bidi.c: Include exit.h.
+ (EXIT_FAILURE): Remove fallback definition.
+ * pipe-in.c: Include exit.h.
+ (EXIT_FAILURE): Remove fallback definition.
+ * pipe-out.c: Include exit.h.
+ (EXIT_FAILURE): Remove fallback definition.
+ * wait-process.c: Include exit.h.
+ (EXIT_FAILURE): Remove fallback definition.
+ * xerror.c: Include exit.h.
+ (EXIT_FAILURE): Remove fallback definition.
+ * xmalloc.c: Include exit.h.
+ (EXIT_FAILURE): Remove fallback definition.
+
2001-12-21 Bruno Haible <bruno@clisp.org>
* minmax.h: New file, extracted from system.h.
diff --git a/lib/Makefile.am b/lib/Makefile.am
index a72fe85..f43075a 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -28,13 +28,14 @@ c-ctype.c concatpath.c copy-file.c execute.c findprog.c fstrcmp.c \
full-write.c gcd.c getopt.c getopt1.c hash.c javacomp.c javaexec.c \
linebreak.c localcharset.c mbswidth.c obstack.c pipe-bidi.c pipe-in.c \
pipe-out.c progname.c safe-read.c sh-quote.c tmpdir.c wait-process.c xerror.c \
-xgetcwd.c xmalloc.c xstrdup.c
+xmalloc.c xstrdup.c
-libgettextlib_la_HEADER = argmatch.h backupfile.h basename.h c-ctype.h \
-copy-file.h execute.h findprog.h fstrcmp.h full-write.h gcd.h getopt.h hash.h \
-javacomp.h javaexec.h lbrkprop.h linebreak.h mbswidth.h minmax.h obstack.h \
-pathmax.h pipe.h progname.h safe-read.h sh-quote.h system.h tmpdir.h \
-utf8-ucs4.h utf16-ucs4.h wait-process.h xerror.h xmalloc.h
+libgettextlib_la_HEADER = argmatch.h backupfile.h basename.h binary-io.h \
+c-ctype.h copy-file.h execute.h exit.h findprog.h fstrcmp.h full-write.h \
+gcd.h getopt.h hash.h javacomp.h javaexec.h lbrkprop.h liballoca.h \
+linebreak.h mbswidth.h minmax.h obstack.h pathmax.h pathname.h pipe.h \
+progname.h safe-read.h sh-quote.h tmpdir.h utf8-ucs4.h utf16-ucs4.h \
+wait-process.h xerror.h xmalloc.h
# Sources that are compiled only on platforms that lack the functions.
@@ -42,14 +43,14 @@ LIBADD_SOURCE = alloca.c error.c getline.c memset.c mkdtemp.c pfnmatch.c \
setenv.c stpcpy.c stpncpy.c strcasecmp.c strcspn.c strncasecmp.c strpbrk.c \
strstr.c strtol.c strtoul.c vasprintf.c
-LIBADD_HEADER = error.h getline.h mkdtemp.h pfnmatch.h setenv.h strpbrk.h \
-strstr.h
+LIBADD_HEADER = error.h getline.h mkdtemp.h pfnmatch.h setenv.h stpcpy.h \
+stpncpy.h strcase.h strpbrk.h strstr.h
# Unused sources.
-UNUSED_SOURCE = memmove.c
+UNUSED_SOURCE = memmove.c xgetcwd.c
-UNUSED_HEADER =
+UNUSED_HEADER = xgetcwd.h
# How to build libgettextlib.la.
diff --git a/lib/argmatch.c b/lib/argmatch.c
index da664ef..f6ff44f 100644
--- a/lib/argmatch.c
+++ b/lib/argmatch.c
@@ -21,7 +21,6 @@
#include "argmatch.h"
#include <stdio.h>
-#include <stdlib.h>
#ifdef STDC_HEADERS
# include <string.h>
#endif
@@ -36,14 +35,7 @@
#endif
#include "error.h"
-
-/* The following test is to work around the gross typo in
- systems like Sony NEWS-OS Release 4.0C, whereby EXIT_FAILURE
- is defined to 0, not 1. */
-#if !EXIT_FAILURE
-# undef EXIT_FAILURE
-# define EXIT_FAILURE 1
-#endif
+#include "exit.h"
/* Non failing version of argmatch call this function after failing. */
#ifndef ARGMATCH_DIE
diff --git a/lib/binary-io.h b/lib/binary-io.h
new file mode 100644
index 0000000..b10e546
--- /dev/null
+++ b/lib/binary-io.h
@@ -0,0 +1,55 @@
+/* Binary mode I/O.
+ Copyright (C) 2001 Free Software Foundation, Inc.
+
+ 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, 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. */
+
+#ifndef _BINARY_H
+#define _BINARY_H
+
+#include <fcntl.h>
+/* For systems that distinguish between text and binary I/O.
+ O_BINARY is usually declared in <fcntl.h>. */
+#if !defined O_BINARY && defined _O_BINARY
+ /* For MSC-compatible compilers. */
+# define O_BINARY _O_BINARY
+# define O_TEXT _O_TEXT
+#endif
+#ifdef __BEOS__
+ /* BeOS 5 has O_BINARY and O_TEXT, but they have no effect. */
+# undef O_BINARY
+# undef O_TEXT
+#endif
+#if O_BINARY
+# if !(defined(__EMX__) || defined(__DJGPP__))
+# define setmode _setmode
+# define fileno _fileno
+# endif
+# ifdef __DJGPP__
+# include <io.h> /* declares setmode() */
+# include <unistd.h> /* declares isatty() */
+# /* Avoid putting stdin/stdout in binary mode if it is connected to the
+# console, because that would make it impossible for the user to
+# interrupt the program through Ctrl-C or Ctrl-Break. */
+# define SET_BINARY(fd) (!isatty(fd) ? (setmode(fd,O_BINARY), 0) : 0)
+# else
+# define SET_BINARY(fd) setmode(fd,O_BINARY)
+# endif
+#else
+ /* On reasonable systems, binary I/O is the default. */
+# define O_BINARY 0
+# define SET_BINARY(fd) /* nothing */
+#endif
+
+#endif /* _BINARY_H */
diff --git a/lib/concatpath.c b/lib/concatpath.c
index 1d494f9..88c2864 100644
--- a/lib/concatpath.c
+++ b/lib/concatpath.c
@@ -23,9 +23,12 @@
#endif
/* Specification. */
-#include "system.h"
+#include "pathname.h"
+
+#include <string.h>
#include "xmalloc.h"
+#include "stpcpy.h"
/* Concatenate a directory pathname, a relative pathname and an optional
suffix. The directory may end with the directory separator. The second
diff --git a/lib/copy-file.c b/lib/copy-file.c
index 3ac67ac..07697ab 100644
--- a/lib/copy-file.c
+++ b/lib/copy-file.c
@@ -28,22 +28,22 @@
#include <fcntl.h>
#include <sys/stat.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
#if HAVE_UTIME || HAVE_UTIMES
# include <utime.h>
#endif
#include "error.h"
#include "full-write.h"
-#include "system.h"
+#include "binary-io.h"
+#include "exit.h"
#include "gettext.h"
#define _(str) gettext (str)
-/* On reasonable systems, binary I/O is the default. */
-#ifndef O_BINARY
-# define O_BINARY 0
-#endif
-
void
copy_file (src_filename, dest_filename)
const char *src_filename;
diff --git a/lib/execute.c b/lib/execute.c
index 0b5e7bf..6b11c7f 100644
--- a/lib/execute.c
+++ b/lib/execute.c
@@ -42,13 +42,10 @@
#endif
#include "error.h"
+#include "exit.h"
#include "wait-process.h"
#include "gettext.h"
-#ifndef EXIT_FAILURE
-# define EXIT_FAILURE 1
-#endif
-
#ifndef STDIN_FILENO
# define STDIN_FILENO 0
#endif
diff --git a/lib/exit.h b/lib/exit.h
new file mode 100644
index 0000000..4e8d465
--- /dev/null
+++ b/lib/exit.h
@@ -0,0 +1,32 @@
+/* exit() function.
+ Copyright (C) 1995, 2001 Free Software Foundation, Inc.
+
+ 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, 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. */
+
+#ifndef _EXIT_H
+#define _EXIT_H
+
+/* Get exit() declaration. */
+#include <stdlib.h>
+
+/* Some systems do not define EXIT_*, even with STDC_HEADERS. */
+#ifndef EXIT_SUCCESS
+# define EXIT_SUCCESS 0
+#endif
+#ifndef EXIT_FAILURE
+# define EXIT_FAILURE 1
+#endif
+
+#endif /* _EXIT_H */
diff --git a/lib/findprog.c b/lib/findprog.c
index 6013768..571ed47 100644
--- a/lib/findprog.c
+++ b/lib/findprog.c
@@ -32,7 +32,7 @@
#endif
#include "xmalloc.h"
-#include "system.h"
+#include "pathname.h"
const char *
diff --git a/lib/javacomp.c b/lib/javacomp.c
index 53c7769..5f1f51f 100644
--- a/lib/javacomp.c
+++ b/lib/javacomp.c
@@ -19,6 +19,7 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
+#include "liballoca.h"
/* Specification. */
#include "javacomp.h"
@@ -37,32 +38,6 @@
#include "error.h"
#include "gettext.h"
-#ifdef __GNUC__
-# ifndef alloca
-# define alloca __builtin_alloca
-# endif
-#else
-# if HAVE_ALLOCA_H
-# include <alloca.h>
-# else
-# ifdef _AIX
- #pragma alloca
-# else
-# ifdef __hpux /* This section must match that of bison generated files. */
-# ifdef __cplusplus
-extern "C" void *alloca (unsigned int);
-# else /* not __cplusplus */
-void *alloca ();
-# endif /* not __cplusplus */
-# else /* not __hpux */
-# ifndef alloca
-char *alloca ();
-# endif
-# endif /* __hpux */
-# endif
-# endif
-#endif
-
#define _(str) gettext (str)
diff --git a/lib/javaexec.c b/lib/javaexec.c
index b21516e..d2a595e 100644
--- a/lib/javaexec.c
+++ b/lib/javaexec.c
@@ -19,6 +19,7 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
+#include "liballoca.h"
/* Specification. */
#include "javaexec.h"
@@ -34,32 +35,6 @@
#include "error.h"
#include "gettext.h"
-#ifdef __GNUC__
-# ifndef alloca
-# define alloca __builtin_alloca
-# endif
-#else
-# if HAVE_ALLOCA_H
-# include <alloca.h>
-# else
-# ifdef _AIX
- #pragma alloca
-# else
-# ifdef __hpux /* This section must match that of bison generated files. */
-# ifdef __cplusplus
-extern "C" void *alloca (unsigned int);
-# else /* not __cplusplus */
-void *alloca ();
-# endif /* not __cplusplus */
-# else /* not __hpux */
-# ifndef alloca
-char *alloca ();
-# endif
-# endif /* __hpux */
-# endif
-# endif
-#endif
-
#define _(str) gettext (str)
diff --git a/lib/liballoca.h b/lib/liballoca.h
new file mode 100644
index 0000000..4a4276c
--- /dev/null
+++ b/lib/liballoca.h
@@ -0,0 +1,56 @@
+/* Memory allocation on the stack.
+ Copyright (C) 1995, 1999, 2001 Free Software Foundation, Inc.
+
+ 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, 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. */
+
+/* When this file is included, it may be preceded only by preprocessor
+ declarations. Thanks to AIX. Therefore we include it right after
+ "config.h", not later. */
+
+#ifndef _LIBALLOCA_H
+#define _LIBALLOCA_H
+
+#ifdef __GNUC__
+# ifndef alloca
+# define alloca __builtin_alloca
+# endif
+#else
+# ifdef _MSC_VER
+# include <malloc.h>
+# alloca _alloca
+# else
+# if HAVE_ALLOCA_H
+# include <alloca.h>
+# else
+# ifdef _AIX
+ #pragma alloca
+# else
+# ifdef __hpux /* This section must match that of bison generated files. */
+# ifdef __cplusplus
+extern "C" void *alloca (unsigned int);
+# else /* not __cplusplus */
+void *alloca ();
+# endif /* not __cplusplus */
+# else /* not __hpux */
+# ifndef alloca
+char *alloca ();
+# endif
+# endif /* __hpux */
+# endif
+# endif
+# endif
+#endif
+
+#endif /* _LIBALLOCA_H */
diff --git a/lib/linebreak.c b/lib/linebreak.c
index 7afbee6..02f4ae7 100644
--- a/lib/linebreak.c
+++ b/lib/linebreak.c
@@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Specification. */
#include "linebreak.h"
-#include <stddef.h>
+#include <stdlib.h>
#include <string.h>
#include "c-ctype.h"
diff --git a/lib/linebreak.h b/lib/linebreak.h
index f45e80e..59b7371 100644
--- a/lib/linebreak.h
+++ b/lib/linebreak.h
@@ -27,7 +27,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
# endif
#endif
-#include <stdlib.h>
+/* Get size_t. */
+#include <stddef.h>
/* Display width. */
diff --git a/lib/minmax.h b/lib/minmax.h
index c4d2ad2..b26174d 100644
--- a/lib/minmax.h
+++ b/lib/minmax.h
@@ -1,5 +1,5 @@
/* MIN, MAX macros.
- Copyright (C) 1995-1997, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1998, 2001 Free Software Foundation, Inc.
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
diff --git a/lib/pathname.h b/lib/pathname.h
new file mode 100644
index 0000000..d2a4c75
--- /dev/null
+++ b/lib/pathname.h
@@ -0,0 +1,59 @@
+/* Pathname support.
+ Copyright (C) 2001 Free Software Foundation, Inc.
+
+ 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, 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. */
+
+#ifndef _PATHNAME_H
+#define _PATHNAME_H
+
+#ifndef PARAMS
+# if __STDC__ || defined __GNUC__ || defined __SUNPRO_C || defined __cplusplus || __PROTOTYPES
+# define PARAMS(args) args
+# else
+# define PARAMS(args) ()
+# endif
+#endif
+
+/* Pathname support.
+ ISSLASH(C) tests whether C is a directory separator character.
+ IS_ABSOLUTE_PATH(P) tests whether P is an absolute path. If it is not,
+ it may be concatenated to a directory pathname.
+ IS_PATH_WITH_DIR(P) tests whether P contains a directory specification.
+ */
+#if defined _WIN32 || defined __WIN32__ || defined __EMX__ || defined __DJGPP__
+ /* Win32, OS/2, DOS */
+# define ISSLASH(C) ((C) == '/' || (C) == '\\')
+# define HAS_DEVICE(P) \
+ ((((P)[0] >= 'A' && (P)[0] <= 'Z') || ((P)[0] >= 'a' && (P)[0] <= 'z')) \
+ && (P)[1] == ':')
+# define IS_ABSOLUTE_PATH(P) (ISSLASH ((P)[0]) || HAS_DEVICE (P))
+# define IS_PATH_WITH_DIR(P) \
+ (strchr (P, '/') != NULL || strchr (P, '\\') != NULL || HAS_DEVICE (P))
+# define FILESYSTEM_PREFIX_LEN(P) (HAS_DEVICE (P) ? 2 : 0)
+#else
+ /* Unix */
+# define ISSLASH(C) ((C) == '/')
+# define IS_ABSOLUTE_PATH(P) ISSLASH ((P)[0])
+# define IS_PATH_WITH_DIR(P) (strchr (P, '/') != NULL)
+# define FILESYSTEM_PREFIX_LEN(P) 0
+#endif
+
+/* Concatenate a directory pathname, a relative pathname and an optional
+ suffix. Return a freshly allocated pathname. */
+extern char *concatenated_pathname PARAMS ((const char *directory,
+ const char *filename,
+ const char *suffix));
+
+#endif /* _PATHNAME_H */
diff --git a/lib/pipe-bidi.c b/lib/pipe-bidi.c
index a6fa72c..28c1b31 100644
--- a/lib/pipe-bidi.c
+++ b/lib/pipe-bidi.c
@@ -41,12 +41,9 @@
#endif
#include "error.h"
+#include "exit.h"
#include "gettext.h"
-#ifndef EXIT_FAILURE
-# define EXIT_FAILURE 1
-#endif
-
#ifndef STDIN_FILENO
# define STDIN_FILENO 0
#endif
diff --git a/lib/pipe-in.c b/lib/pipe-in.c
index 1d24b9d..00380bf 100644
--- a/lib/pipe-in.c
+++ b/lib/pipe-in.c
@@ -41,12 +41,9 @@
#endif
#include "error.h"
+#include "exit.h"
#include "gettext.h"
-#ifndef EXIT_FAILURE
-# define EXIT_FAILURE 1
-#endif
-
#ifndef STDIN_FILENO
# define STDIN_FILENO 0
#endif
diff --git a/lib/pipe-out.c b/lib/pipe-out.c
index a54fc2c..3ee8137 100644
--- a/lib/pipe-out.c
+++ b/lib/pipe-out.c
@@ -41,12 +41,9 @@
#endif
#include "error.h"
+#include "exit.h"
#include "gettext.h"
-#ifndef EXIT_FAILURE
-# define EXIT_FAILURE 1
-#endif
-
#ifndef STDIN_FILENO
# define STDIN_FILENO 0
#endif
diff --git a/lib/setenv.c b/lib/setenv.c
index c35458e..9653604 100644
--- a/lib/setenv.c
+++ b/lib/setenv.c
@@ -19,32 +19,7 @@
#if HAVE_CONFIG_H
# include <config.h>
#endif
-
-#ifdef __GNUC__
-# ifndef alloca
-# define alloca __builtin_alloca
-# endif
-#else
-# if HAVE_ALLOCA_H
-# include <alloca.h>
-# else
-# ifdef _AIX
- #pragma alloca
-# else
-# ifdef __hpux /* This section must match that of bison generated files. */
-# ifdef __cplusplus
-extern "C" void *alloca (unsigned int);
-# else /* not __cplusplus */
-void *alloca ();
-# endif /* not __cplusplus */
-# else /* not __hpux */
-# ifndef alloca
-char *alloca ();
-# endif
-# endif /* __hpux */
-# endif
-# endif
-#endif
+#include "liballoca.h"
#include <errno.h>
#if !_LIBC
diff --git a/lib/stpcpy.h b/lib/stpcpy.h
new file mode 100644
index 0000000..ce8fe0e
--- /dev/null
+++ b/lib/stpcpy.h
@@ -0,0 +1,40 @@
+/* String copying.
+ Copyright (C) 1995, 2001 Free Software Foundation, Inc.
+
+ 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, 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. */
+
+#ifndef _STPCPY_H
+#define _STPCPY_H
+
+#ifndef PARAMS
+# if __STDC__ || defined __GNUC__ || defined __SUNPRO_C || defined __cplusplus || __PROTOTYPES
+# define PARAMS(args) args
+# else
+# define PARAMS(args) ()
+# endif
+#endif
+
+#if HAVE_STPCPY
+
+/* Get stpcpy() declaration. */
+#include <string.h>
+
+#else
+
+extern char *stpcpy PARAMS ((char *__dst, const char *__src));
+
+#endif
+
+#endif /* _STPCPY_H */
diff --git a/lib/stpncpy.h b/lib/stpncpy.h
new file mode 100644
index 0000000..0c4df53
--- /dev/null
+++ b/lib/stpncpy.h
@@ -0,0 +1,42 @@
+/* String copying.
+ Copyright (C) 1995, 2001 Free Software Foundation, Inc.
+
+ 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, 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. */
+
+#ifndef _STPNCPY_H
+#define _STPNCPY_H
+
+#ifndef PARAMS
+# if __STDC__ || defined __GNUC__ || defined __SUNPRO_C || defined __cplusplus || __PROTOTYPES
+# define PARAMS(args) args
+# else
+# define PARAMS(args) ()
+# endif
+#endif
+
+#if HAVE_STPNCPY
+
+/* Get stpncpy() declaration. */
+#include <string.h>
+
+#else
+
+#include <stddef.h>
+
+extern char *stpncpy PARAMS ((char *__dst, const char *__src, size_t __n));
+
+#endif
+
+#endif /* _STPNCPY_H */
diff --git a/lib/strcase.h b/lib/strcase.h
new file mode 100644
index 0000000..be2d0dd
--- /dev/null
+++ b/lib/strcase.h
@@ -0,0 +1,35 @@
+/* Case-insensitive string comparison functions.
+ Copyright (C) 1995-1996, 2001 Free Software Foundation, Inc.
+
+ 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, 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. */
+
+#ifndef _STRCASE_H
+#define _STRCASE_H
+
+#include <stddef.h>
+
+#ifndef PARAMS
+# if __STDC__ || defined __GNUC__ || defined __SUNPRO_C || defined __cplusplus || __PROTOTYPES
+# define PARAMS(args) args
+# else
+# define PARAMS(args) ()
+# endif
+#endif
+
+extern int strcasecmp PARAMS ((const char *__s1, const char *__s2));
+extern int strncasecmp PARAMS ((const char *__s1, const char *__s2,
+ size_t __n));
+
+#endif /* _STRCASE_H */
diff --git a/lib/system.h b/lib/system.h
deleted file mode 100644
index 637ed0f..0000000
--- a/lib/system.h
+++ /dev/null
@@ -1,157 +0,0 @@
-/* Header for GNU gettext libiberty
- Copyright (C) 1995-1997, 2000, 2001 Free Software Foundation, Inc.
-
- 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, 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. */
-
-#ifndef _SYSTEM_H
-#define _SYSTEM_H 1
-
-#ifndef PARAMS
-# if __STDC__ || defined __GNUC__ || defined __SUNPRO_C || defined __cplusplus || __PROTOTYPES
-# define PARAMS(args) args
-# else
-# define PARAMS(args) ()
-# endif
-#endif
-
-#include <stdio.h>
-#include <sys/types.h>
-
-#if defined STDC_HEADERS
-# include <stdlib.h>
-#else
-# ifdef HAVE_MALLOC_H
-# include <malloc.h>
-# endif
-unsigned long strtoul ();
-#endif
-
-/* Wrapper functions with error checking for standard functions. */
-extern char *xgetcwd PARAMS ((void));
-extern char *stpcpy PARAMS ((char *__dst, const char *__src));
-extern char *stpncpy PARAMS ((char *__dst, const char *__src, size_t __n));
-extern int strcasecmp PARAMS ((const char *__s1, const char *__s2));
-extern int strncasecmp PARAMS ((const char *__s1, const char *__s2,
- size_t __n));
-
-#include <string.h>
-#if !STDC_HEADERS && HAVE_MEMORY_H
-# include <memory.h>
-#endif
-#if !HAVE_MEMCPY
-# ifndef memcpy
-# define memcpy(D, S, N) bcopy ((S), (D), (N))
-# endif
-#endif
-
-#ifdef __GNUC__
-# ifndef alloca
-# define alloca __builtin_alloca
-# endif
-#else
-# if HAVE_ALLOCA_H
-# include <alloca.h>
-# else
-# ifdef _AIX
- #pragma alloca
-# else
-# ifdef __hpux /* This section must match that of bison generated files. */
-# ifdef __cplusplus
-extern "C" void *alloca (unsigned int);
-# else /* not __cplusplus */
-void *alloca ();
-# endif /* not __cplusplus */
-# else /* not __hpux */
-# ifndef alloca
-char *alloca ();
-# endif
-# endif /* __hpux */
-# endif
-# endif
-#endif
-
-/* Some systems do not define EXIT_*, even with STDC_HEADERS. */
-#ifndef EXIT_SUCCESS
-# define EXIT_SUCCESS 0
-#endif
-#ifndef EXIT_FAILURE
-# define EXIT_FAILURE 1
-#endif
-
-
-/* Pathname support.
- ISSLASH(C) tests whether C is a directory separator character.
- IS_ABSOLUTE_PATH(P) tests whether P is an absolute path. If it is not,
- it may be concatenated to a directory pathname.
- IS_PATH_WITH_DIR(P) tests whether P contains a directory specification.
- */
-#if defined _WIN32 || defined __WIN32__ || defined __EMX__ || defined __DJGPP__
- /* Win32, OS/2, DOS */
-# define ISSLASH(C) ((C) == '/' || (C) == '\\')
-# define HAS_DEVICE(P) \
- ((((P)[0] >= 'A' && (P)[0] <= 'Z') || ((P)[0] >= 'a' && (P)[0] <= 'z')) \
- && (P)[1] == ':')
-# define IS_ABSOLUTE_PATH(P) (ISSLASH ((P)[0]) || HAS_DEVICE (P))
-# define IS_PATH_WITH_DIR(P) \
- (strchr (P, '/') != NULL || strchr (P, '\\') != NULL || HAS_DEVICE (P))
-# define FILESYSTEM_PREFIX_LEN(P) (HAS_DEVICE (P) ? 2 : 0)
-#else
- /* Unix */
-# define ISSLASH(C) ((C) == '/')
-# define IS_ABSOLUTE_PATH(P) ISSLASH ((P)[0])
-# define IS_PATH_WITH_DIR(P) (strchr (P, '/') != NULL)
-# define FILESYSTEM_PREFIX_LEN(P) 0
-#endif
-
-/* Concatenate a directory pathname, a relative pathname and an optional
- suffix. Return a freshly allocated pathname. */
-extern char *concatenated_pathname PARAMS ((const char *directory,
- const char *filename,
- const char *suffix));
-
-
-#include <fcntl.h>
-/* For systems that distinguish between text and binary I/O.
- O_BINARY is usually declared in <fcntl.h>. */
-#if !defined O_BINARY && defined _O_BINARY
- /* For MSC-compatible compilers. */
-# define O_BINARY _O_BINARY
-# define O_TEXT _O_TEXT
-#endif
-#ifdef __BEOS__
- /* BeOS 5 has O_BINARY and O_TEXT, but they have no effect. */
-# undef O_BINARY
-# undef O_TEXT
-#endif
-#if O_BINARY
-# if !(defined(__EMX__) || defined(__DJGPP__))
-# define setmode _setmode
-# define fileno _fileno
-# endif
-# ifdef __DJGPP__
-# include <io.h> /* declares setmode() */
-# include <unistd.h> /* declares isatty() */
-# /* Avoid putting stdin/stdout in binary mode if it is connected to the
-# console, because that would make it impossible for the user to
-# interrupt the program through Ctrl-C or Ctrl-Break. */
-# define SET_BINARY(fd) (!isatty(fd) ? (setmode(fd,O_BINARY), 0) : 0)
-# else
-# define SET_BINARY(fd) setmode(fd,O_BINARY)
-# endif
-#else
-# define SET_BINARY(fd) /* nothing */
-#endif
-
-#endif
diff --git a/lib/wait-process.c b/lib/wait-process.c
index 2b2dd98..6946ebc 100644
--- a/lib/wait-process.c
+++ b/lib/wait-process.c
@@ -75,12 +75,9 @@
#endif
#include "error.h"
+#include "exit.h"
#include "gettext.h"
-#ifndef EXIT_FAILURE
-# define EXIT_FAILURE 1
-#endif
-
#define _(str) gettext (str)
diff --git a/lib/xerror.c b/lib/xerror.c
index 1ea6d1a..349bb73 100644
--- a/lib/xerror.c
+++ b/lib/xerror.c
@@ -30,13 +30,10 @@
#include "error.h"
#include "progname.h"
+#include "exit.h"
#include "mbswidth.h"
#include "gettext.h"
-#ifndef EXIT_FAILURE
-# define EXIT_FAILURE 1
-#endif
-
#define _(str) gettext (str)
#if __STDC__
diff --git a/lib/xgetcwd.h b/lib/xgetcwd.h
new file mode 100644
index 0000000..2f6df8a
--- /dev/null
+++ b/lib/xgetcwd.h
@@ -0,0 +1,27 @@
+/* xgetcwd -- return current directory with unlimited length
+ Copyright (C) 1995, 2001 Free Software Foundation, Inc.
+
+ 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, 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. */
+
+#ifndef PARAMS
+# if __STDC__ || defined __GNUC__ || defined __SUNPRO_C || defined __cplusplus || __PROTOTYPES
+# define PARAMS(args) args
+# else
+# define PARAMS(args) ()
+# endif
+#endif
+
+/* Wrapper function with error checking for standard function. */
+extern char *xgetcwd PARAMS ((void));
diff --git a/lib/xmalloc.c b/lib/xmalloc.c
index 367e9ef..d7fa812 100644
--- a/lib/xmalloc.c
+++ b/lib/xmalloc.c
@@ -25,12 +25,9 @@
#include <stdlib.h>
#include "error.h"
+#include "exit.h"
#include "gettext.h"
-#ifndef EXIT_FAILURE
-# define EXIT_FAILURE 1
-#endif
-
#define _(str) gettext (str)
diff --git a/src/ChangeLog b/src/ChangeLog
index a6c506d..1b38169 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,66 @@
+2001-12-22 Bruno Haible <bruno@clisp.org>
+
+ * dir-list.c: Include <stddef.h> instead of <stdlib.h>.
+ * xgettext.h: Likewise.
+ * file-list.c: Include exit.h instead of system.h.
+ * gettext.c: Likewise.
+ * hostname.c: Likewise.
+ * msgattrib.c: Likewise.
+ * msgcat.c: Likewise.
+ * msgcomm.c: Likewise.
+ * msgconv.c: Likewise.
+ * msgexec.c: Likewise.
+ * msgunfmt.c: Likewise.
+ * msguniq.c: Likewise.
+ * ngettext.c: Likewise.
+ * read-java.c: Likewise.
+ * x-ycp.c: Likewise.
+ * msgcmp.c: Include exit.h instead of system.h. Don't include
+ str-list.h.
+ * msgfilter.c: Likewise.
+ * msgen.c: Include exit.h instead of system.h. Don't include xmalloc.h.
+ * msgfmt.c: Include exit.h, stpcpy.h instead of system.h. Don't
+ include <errno.h>, getline.h.
+ * msggrep.c: Include exit.h instead of system.h. Don't include
+ <fcntl.h>.
+ * msginit.c: Include liballoca.h, <limits.h>, exit.h, pathname.h
+ instead of system.h.
+ * msgl-cat.c: Include liballoca.h, exit.h instead of system.h.
+ Include <stddef.h> instead of <stdlib.h>.
+ * msgl-charset.c: Likewise.
+ * msgl-iconv.c: Include liballoca.h, exit.h instead of system.h.
+ * write-po.c: Likewise.
+ * msgmerge.c: Include liballoca.h, exit.h, strcase.h, stpcpy.h,
+ stpncpy.h instead of system.h.
+ * format-java.c: Include liballoca.h.
+ * format-lisp.c: Don't include system.h.
+ * open-po.c: Include pathname.h, xmalloc.h instead of system.h.
+ Don't include <sys/types.h>, error.h.
+ * po-charset.c: Include liballoca.h, string.h, strcase.h instead of
+ system.h. Don't include error.h. Include progname.h.
+ (program_name): Remove declaration.
+ * po-gram-gen.y: Include <string.h>.
+ * po-hash-gen.y: Include <string.h>.
+ * po-lex.c: Include exit.h instead of system.h. Don't include
+ <sys/types.h>.
+ * read-mo.c: Include binary-io.h, exit.h instead of system.h.
+ Include <stddef.h> instead of <stdlib.h>.
+ * urlget.c: Include <unistd.h>, binary-io.h, exit.h instead of
+ system.h.
+ (O_BINARY): Remove fallback definition.
+ * write-java.c: Include liballoca.h, pathname.h instead of system.h.
+ * write-mo.c: Include liballoca.h, binary-io.h, exit.h instead of
+ system.h. Don't include msgfmt.h.
+ * x-c.c: Include exit.h instead of system.h. Don't include <ctype.h>.
+ * x-librep.c: Include exit.h instead of system.h. Include hash.h.
+ * x-lisp.c: Likewise.
+ * x-rst.c: Include exit.h instead of system.h. Include <stddef.h>
+ instead of <stdlib.h>.
+ * xgettext.c: Include <string.h>, exit.h, pathname.h, strcase.h,
+ stpcpy.h instead of system.h. Include str-list.h. Don't include
+ <sys/param.h>, <pwd.h>, <sys/types.h>, <unistd.h>, getline.h.
+ (getpwuid): Remove declaration.
+
2001-12-21 Bruno Haible <bruno@clisp.org>
* format-lisp.c: Include minmax.h.
diff --git a/src/dir-list.c b/src/dir-list.c
index 9761ffa..851b852 100644
--- a/src/dir-list.c
+++ b/src/dir-list.c
@@ -25,9 +25,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Specification. */
#include "dir-list.h"
-#include <stdlib.h>
+#include <stddef.h>
-#include "system.h"
#include "str-list.h"
static string_list_ty *directory /* = NULL */;
diff --git a/src/file-list.c b/src/file-list.c
index 9711ced..2c9a007 100644
--- a/src/file-list.c
+++ b/src/file-list.c
@@ -29,7 +29,7 @@
#include "str-list.h"
#include "error.h"
-#include "system.h"
+#include "exit.h"
#include "getline.h"
#include "gettext.h"
diff --git a/src/format-java.c b/src/format-java.c
index 2f5bd3c..dc07680 100644
--- a/src/format-java.c
+++ b/src/format-java.c
@@ -19,6 +19,7 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
+#include "liballoca.h"
#include <stdbool.h>
#include <stdlib.h>
diff --git a/src/format-lisp.c b/src/format-lisp.c
index 58c4b8f..deba63c 100644
--- a/src/format-lisp.c
+++ b/src/format-lisp.c
@@ -28,7 +28,6 @@
#include "gcd.h"
#include "xmalloc.h"
#include "minmax.h"
-#include "system.h"
#include "error.h"
#include "progname.h"
#include "gettext.h"
diff --git a/src/gettext.c b/src/gettext.c
index b604f2e..29b7dbb 100644
--- a/src/gettext.c
+++ b/src/gettext.c
@@ -29,7 +29,7 @@
#include "error.h"
#include "basename.h"
#include "xmalloc.h"
-#include "system.h"
+#include "exit.h"
#ifdef TESTS
# define HAVE_SETLOCALE 1
diff --git a/src/hostname.c b/src/hostname.c
index 8d21a81..7208f53 100644
--- a/src/hostname.c
+++ b/src/hostname.c
@@ -74,7 +74,7 @@
#include "progname.h"
#include "basename.h"
#include "xmalloc.h"
-#include "system.h"
+#include "exit.h"
#include "gettext.h"
#define _(str) gettext (str)
diff --git a/src/msgattrib.c b/src/msgattrib.c
index 300cc14..870312f 100644
--- a/src/msgattrib.c
+++ b/src/msgattrib.c
@@ -34,7 +34,7 @@
#include "message.h"
#include "read-po.h"
#include "write-po.h"
-#include "system.h"
+#include "exit.h"
#include "gettext.h"
#define _(str) gettext (str)
diff --git a/src/msgcat.c b/src/msgcat.c
index 19fb0fa..2324dcb 100644
--- a/src/msgcat.c
+++ b/src/msgcat.c
@@ -37,7 +37,7 @@
#include "read-po.h"
#include "write-po.h"
#include "msgl-cat.h"
-#include "system.h"
+#include "exit.h"
#include "gettext.h"
#define _(str) gettext (str)
diff --git a/src/msgcmp.c b/src/msgcmp.c
index 0d3dc45..834374c 100644
--- a/src/msgcmp.c
+++ b/src/msgcmp.c
@@ -32,10 +32,9 @@
#include "progname.h"
#include "basename.h"
#include "message.h"
-#include "system.h"
+#include "exit.h"
#include "gettext.h"
#include "po.h"
-#include "str-list.h"
#define _(str) gettext (str)
diff --git a/src/msgcomm.c b/src/msgcomm.c
index 4e759d9..e38963e 100644
--- a/src/msgcomm.c
+++ b/src/msgcomm.c
@@ -37,7 +37,7 @@
#include "read-po.h"
#include "write-po.h"
#include "msgl-cat.h"
-#include "system.h"
+#include "exit.h"
#include "gettext.h"
diff --git a/src/msgconv.c b/src/msgconv.c
index 7ef8dcf..e345ce7 100644
--- a/src/msgconv.c
+++ b/src/msgconv.c
@@ -34,7 +34,7 @@
#include "read-po.h"
#include "write-po.h"
#include "msgl-iconv.h"
-#include "system.h"
+#include "exit.h"
#include "gettext.h"
#define _(str) gettext (str)
diff --git a/src/msgen.c b/src/msgen.c
index 7f3eeeb..ab3241b 100644
--- a/src/msgen.c
+++ b/src/msgen.c
@@ -34,8 +34,7 @@
#include "read-po.h"
#include "msgl-english.h"
#include "write-po.h"
-#include "xmalloc.h"
-#include "system.h"
+#include "exit.h"
#include "gettext.h"
#define _(str) gettext (str)
diff --git a/src/msgexec.c b/src/msgexec.c
index 54716d3..7dbdae9 100644
--- a/src/msgexec.c
+++ b/src/msgexec.c
@@ -41,7 +41,7 @@
#include "message.h"
#include "read-po.h"
#include "xmalloc.h"
-#include "system.h"
+#include "exit.h"
#include "full-write.h"
#include "findprog.h"
#include "pipe.h"
diff --git a/src/msgfilter.c b/src/msgfilter.c
index 225518a..5cca360 100644
--- a/src/msgfilter.c
+++ b/src/msgfilter.c
@@ -48,10 +48,9 @@
#include "message.h"
#include "read-po.h"
#include "write-po.h"
-#include "str-list.h"
#include "msgl-charset.h"
#include "xmalloc.h"
-#include "system.h"
+#include "exit.h"
#include "findprog.h"
#include "pipe.h"
#include "wait-process.h"
diff --git a/src/msgfmt.c b/src/msgfmt.c
index 23e5798..669f1bb 100644
--- a/src/msgfmt.c
+++ b/src/msgfmt.c
@@ -21,7 +21,6 @@
#endif
#include <ctype.h>
-#include <errno.h>
#include <getopt.h>
#include <limits.h>
#include <setjmp.h>
@@ -36,12 +35,12 @@
#include "progname.h"
#include "basename.h"
#include "xerror.h"
-#include "getline.h"
#include "format.h"
#include "xmalloc.h"
#include "plural-exp.h"
#include "strstr.h"
-#include "system.h"
+#include "stpcpy.h"
+#include "exit.h"
#include "msgfmt.h"
#include "write-mo.h"
#include "write-java.h"
diff --git a/src/msggrep.c b/src/msggrep.c
index ec356d8..d9013a5 100644
--- a/src/msggrep.c
+++ b/src/msggrep.c
@@ -22,7 +22,6 @@
#endif
#include <errno.h>
-#include <fcntl.h>
#include <getopt.h>
#include <limits.h>
#include <locale.h>
@@ -46,7 +45,7 @@
#include "str-list.h"
#include "msgl-charset.h"
#include "xmalloc.h"
-#include "system.h"
+#include "exit.h"
#include "full-write.h"
#include "findprog.h"
#include "pipe.h"
diff --git a/src/msginit.c b/src/msginit.c
index 3d2f562..f999765 100644
--- a/src/msginit.c
+++ b/src/msginit.c
@@ -20,9 +20,11 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
+#include "liballoca.h"
#include <errno.h>
#include <getopt.h>
+#include <limits.h>
#include <locale.h>
#include <stdio.h>
#include <stdlib.h>
@@ -73,7 +75,8 @@
#include "po-charset.h"
#include "po-time.h"
#include "xmalloc.h"
-#include "system.h"
+#include "exit.h"
+#include "pathname.h"
#include "xerror.h"
#include "msgl-english.h"
#include "pipe.h"
diff --git a/src/msgl-cat.c b/src/msgl-cat.c
index 8bc0883..c0a23b9 100644
--- a/src/msgl-cat.c
+++ b/src/msgl-cat.c
@@ -20,12 +20,13 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
+#include "liballoca.h"
/* Specification. */
#include "msgl-cat.h"
#include <stdbool.h>
-#include <stdlib.h>
+#include <stddef.h>
#include <string.h>
#include "error.h"
@@ -39,7 +40,7 @@
#include "xmalloc.h"
#include "strstr.h"
#include "basename.h"
-#include "system.h"
+#include "exit.h"
#include "gettext.h"
#define _(str) gettext (str)
diff --git a/src/msgl-charset.c b/src/msgl-charset.c
index b77e0bc..850ddc8 100644
--- a/src/msgl-charset.c
+++ b/src/msgl-charset.c
@@ -20,11 +20,12 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
+#include "liballoca.h"
/* Specification. */
#include "msgl-charset.h"
-#include <stdlib.h>
+#include <stddef.h>
#include <string.h>
#include "po-charset.h"
@@ -34,7 +35,7 @@
#include "xerror.h"
#include "message.h"
#include "strstr.h"
-#include "system.h"
+#include "exit.h"
#include "gettext.h"
#define _(str) gettext (str)
diff --git a/src/msgl-iconv.c b/src/msgl-iconv.c
index 32b1f13..06b857f 100644
--- a/src/msgl-iconv.c
+++ b/src/msgl-iconv.c
@@ -20,6 +20,7 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
+#include "liballoca.h"
/* Specification. */
#include "msgl-iconv.h"
@@ -40,7 +41,7 @@
#include "msgl-ascii.h"
#include "xmalloc.h"
#include "strstr.h"
-#include "system.h"
+#include "exit.h"
#include "gettext.h"
#define _(str) gettext (str)
diff --git a/src/msgmerge.c b/src/msgmerge.c
index 0ec4e1e..19b1433 100644
--- a/src/msgmerge.c
+++ b/src/msgmerge.c
@@ -19,6 +19,7 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
+#include "liballoca.h"
#include <getopt.h>
#include <limits.h>
@@ -38,7 +39,10 @@
#include "format.h"
#include "xmalloc.h"
#include "strstr.h"
-#include "system.h"
+#include "exit.h"
+#include "strcase.h"
+#include "stpcpy.h"
+#include "stpncpy.h"
#include "po.h"
#include "msgl-equal.h"
#include "plural-exp.h"
diff --git a/src/msgunfmt.c b/src/msgunfmt.c
index caa9405..9d40a6a 100644
--- a/src/msgunfmt.c
+++ b/src/msgunfmt.c
@@ -29,7 +29,7 @@
#include "error.h"
#include "progname.h"
#include "basename.h"
-#include "system.h"
+#include "exit.h"
#include "message.h"
#include "msgunfmt.h"
#include "read-mo.h"
diff --git a/src/msguniq.c b/src/msguniq.c
index 11a05ff..b84941c 100644
--- a/src/msguniq.c
+++ b/src/msguniq.c
@@ -36,7 +36,7 @@
#include "read-po.h"
#include "write-po.h"
#include "msgl-cat.h"
-#include "system.h"
+#include "exit.h"
#include "gettext.h"
#define _(str) gettext (str)
diff --git a/src/ngettext.c b/src/ngettext.c
index 4df8e93..3cec828 100644
--- a/src/ngettext.c
+++ b/src/ngettext.c
@@ -29,7 +29,7 @@
#include "error.h"
#include "basename.h"
#include "xmalloc.h"
-#include "system.h"
+#include "exit.h"
#include "gettext.h"
diff --git a/src/open-po.c b/src/open-po.c
index 6612fd3..8d2e10d 100644
--- a/src/open-po.c
+++ b/src/open-po.c
@@ -25,26 +25,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include <errno.h>
#include <stdio.h>
-#include <sys/types.h>
#include <stdlib.h>
#include <string.h>
#include "dir-list.h"
-#include "error.h"
-#include "system.h"
-
+#include "pathname.h"
+#include "xmalloc.h"
#include "gettext.h"
#define _(str) gettext (str)
-#ifndef errno
-extern int errno;
-#endif
-
-/* Prototypes for helper functions. Needed to ensure compiler checking of
- function argument counts despite of K&R C function definition syntax. */
-extern char *xstrdup PARAMS ((const char *string));
-
/* This macro is used to determine the number of elements in an erray. */
#define SIZEOF(a) (sizeof(a)/sizeof(a[0]))
diff --git a/src/po-charset.c b/src/po-charset.c
index 1d6573f..4e25d6e 100644
--- a/src/po-charset.c
+++ b/src/po-charset.c
@@ -20,21 +20,21 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
+#include "liballoca.h"
/* Specification. */
#include "po-charset.h"
#include <stdlib.h>
+#include <string.h>
-#include "error.h"
#include "xerror.h"
#include "basename.h"
+#include "progname.h"
#include "strstr.h"
-#include "system.h"
+#include "strcase.h"
#include "gettext.h"
-extern const char *program_name;
-
#define _(str) gettext (str)
#define SIZEOF(a) (sizeof(a) / sizeof(a[0]))
diff --git a/src/po-gram-gen.y b/src/po-gram-gen.y
index 5efd51a..3b484d4 100644
--- a/src/po-gram-gen.y
+++ b/src/po-gram-gen.y
@@ -27,6 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include "str-list.h"
#include "po-lex.h"
diff --git a/src/po-hash-gen.y b/src/po-hash-gen.y
index 7afac28..bbb391c 100644
--- a/src/po-hash-gen.y
+++ b/src/po-hash-gen.y
@@ -36,6 +36,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include "xmalloc.h"
#include "po.h"
diff --git a/src/po-lex.c b/src/po-lex.c
index 6191f34..98a6eca 100644
--- a/src/po-lex.c
+++ b/src/po-lex.c
@@ -31,7 +31,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/types.h>
#if HAVE_ICONV
# include <iconv.h>
@@ -55,12 +54,13 @@
# define va_dcl char *a1, *a2, *a3, *a4, *a5, *a6, *a7, *a8;
#endif
-#include "str-list.h"
#include "po-charset.h"
#include "xmalloc.h"
-#include "system.h"
+#include "exit.h"
#include "error.h"
#include "open-po.h"
+
+#include "str-list.h"
#include "po-gram-gen2.h"
#if HAVE_ICONV
diff --git a/src/read-java.c b/src/read-java.c
index 8b46089..6ca86a6 100644
--- a/src/read-java.c
+++ b/src/read-java.c
@@ -34,7 +34,7 @@
#include "wait-process.h"
#include "read-po.h"
#include "error.h"
-#include "system.h"
+#include "exit.h"
#include "gettext.h"
#define _(str) gettext (str)
diff --git a/src/read-mo.c b/src/read-mo.c
index 7b4c454..dffe573 100644
--- a/src/read-mo.c
+++ b/src/read-mo.c
@@ -25,7 +25,7 @@
#include <errno.h>
#include <stdio.h>
-#include <stdlib.h>
+#include <stddef.h>
#include <string.h>
/* This include file describes the main part of binary .mo format. */
@@ -33,7 +33,8 @@
#include "error.h"
#include "xmalloc.h"
-#include "system.h"
+#include "binary-io.h"
+#include "exit.h"
#include "message.h"
#include "gettext.h"
diff --git a/src/urlget.c b/src/urlget.c
index 7f1e618..6d18392 100644
--- a/src/urlget.c
+++ b/src/urlget.c
@@ -29,22 +29,22 @@
#include <stdlib.h>
#include <locale.h>
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
#include "error.h"
#include "progname.h"
#include "basename.h"
#include "full-write.h"
#include "execute.h"
#include "javaexec.h"
-#include "system.h"
+#include "exit.h"
+#include "binary-io.h"
#include "gettext.h"
#define _(str) gettext (str)
-/* On reasonable systems, binary I/O is the default. */
-#ifndef O_BINARY
-# define O_BINARY 0
-#endif
-
#ifndef STDOUT_FILENO
# define STDOUT_FILENO 1
#endif
diff --git a/src/write-java.c b/src/write-java.c
index dc238e5..21a244a 100644
--- a/src/write-java.c
+++ b/src/write-java.c
@@ -19,6 +19,7 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
+#include "liballoca.h"
/* Specification. */
#include "write-java.h"
@@ -72,7 +73,7 @@
#include "plural-exp.h"
#include "po-charset.h"
#include "xmalloc.h"
-#include "system.h"
+#include "pathname.h"
#include "tmpdir.h"
#include "utf8-ucs4.h"
#include "gettext.h"
diff --git a/src/write-mo.c b/src/write-mo.c
index 7d1fc6b..a4b6d9c 100644
--- a/src/write-mo.c
+++ b/src/write-mo.c
@@ -24,6 +24,7 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
+#include "liballoca.h"
/* Specification. */
#include "write-mo.h"
@@ -35,8 +36,6 @@
#include <stdlib.h>
#include <string.h>
-#include "msgfmt.h"
-
/* These two include files describe the binary .mo format. */
#include "gmo.h"
#include "hash-string.h"
@@ -44,7 +43,8 @@
#include "error.h"
#include "hash.h"
#include "message.h"
-#include "system.h"
+#include "binary-io.h"
+#include "exit.h"
#include "gettext.h"
#define _(str) gettext (str)
diff --git a/src/write-po.c b/src/write-po.c
index e1ca1b2..7f30e30 100644
--- a/src/write-po.c
+++ b/src/write-po.c
@@ -20,6 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
+#include "liballoca.h"
/* Specification. */
#include "write-po.h"
@@ -39,7 +40,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "msgl-ascii.h"
#include "xmalloc.h"
#include "strstr.h"
-#include "system.h"
+#include "exit.h"
#include "error.h"
#include "xerror.h"
#include "gettext.h"
diff --git a/src/x-c.c b/src/x-c.c
index 074ce05..4b1cee1 100644
--- a/src/x-c.c
+++ b/src/x-c.c
@@ -21,7 +21,6 @@
# include "config.h"
#endif
-#include <ctype.h>
#include <errno.h>
#include <stdbool.h>
#include <stdio.h>
@@ -34,7 +33,7 @@
#include "error.h"
#include "progname.h"
#include "xmalloc.h"
-#include "system.h"
+#include "exit.h"
#include "hash.h"
#include "gettext.h"
diff --git a/src/x-librep.c b/src/x-librep.c
index a00a186..2de5a5c 100644
--- a/src/x-librep.c
+++ b/src/x-librep.c
@@ -33,7 +33,8 @@
#include "xgettext.h"
#include "error.h"
#include "xmalloc.h"
-#include "system.h"
+#include "exit.h"
+#include "hash.h"
#include "gettext.h"
#define _(s) gettext(s)
diff --git a/src/x-lisp.c b/src/x-lisp.c
index 03d3382..59644ff 100644
--- a/src/x-lisp.c
+++ b/src/x-lisp.c
@@ -32,7 +32,8 @@
#include "xgettext.h"
#include "error.h"
#include "xmalloc.h"
-#include "system.h"
+#include "exit.h"
+#include "hash.h"
#include "gettext.h"
#define _(s) gettext(s)
diff --git a/src/x-rst.c b/src/x-rst.c
index 8a0a92a..cd1ac86 100644
--- a/src/x-rst.c
+++ b/src/x-rst.c
@@ -24,7 +24,7 @@
#include <ctype.h>
#include <errno.h>
#include <stdio.h>
-#include <stdlib.h>
+#include <stddef.h>
#include "message.h"
#include "x-rst.h"
@@ -32,7 +32,7 @@
#include "error.h"
#include "progname.h"
#include "xmalloc.h"
-#include "system.h"
+#include "exit.h"
#include "gettext.h"
#define _(s) gettext(s)
diff --git a/src/x-ycp.c b/src/x-ycp.c
index cea6463..7fb0088 100644
--- a/src/x-ycp.c
+++ b/src/x-ycp.c
@@ -33,7 +33,7 @@
#include "xgettext.h"
#include "error.h"
#include "xmalloc.h"
-#include "system.h"
+#include "exit.h"
#include "gettext.h"
#define _(s) gettext(s)
diff --git a/src/xgettext.c b/src/xgettext.c
index eef07c6..4d02d82 100644
--- a/src/xgettext.c
+++ b/src/xgettext.c
@@ -23,32 +23,29 @@
#include <ctype.h>
#include <errno.h>
#include <getopt.h>
-#include <sys/param.h>
-#include <pwd.h>
#include <stdio.h>
#include <time.h>
-#include <sys/types.h>
#include <stdlib.h>
#include <stdbool.h>
+#include <string.h>
#include <locale.h>
#include <limits.h>
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-
#include "xgettext.h"
#include "dir-list.h"
#include "file-list.h"
+#include "str-list.h"
#include "error.h"
#include "progname.h"
#include "basename.h"
#include "xerror.h"
-#include "getline.h"
#include "xmalloc.h"
#include "strstr.h"
#include "xerror.h"
-#include "system.h"
+#include "exit.h"
+#include "pathname.h"
+#include "strcase.h"
+#include "stpcpy.h"
#include "po.h"
#include "message.h"
#include "po-time.h"
@@ -56,10 +53,6 @@
#include "format.h"
#include "gettext.h"
-#ifndef _POSIX_VERSION
-struct passwd *getpwuid ();
-#endif
-
/* A convenience macro. I don't like writing gettext() every time. */
#define _(str) gettext (str)
diff --git a/src/xgettext.h b/src/xgettext.h
index c384fc1..f8649b2 100644
--- a/src/xgettext.h
+++ b/src/xgettext.h
@@ -20,7 +20,7 @@
#ifndef _XGETTEXT_H
#define _XGETTEXT_H
-#include <stdlib.h>
+#include <stddef.h>
#include "message.h"
#include "pos.h"
diff --git a/tests/ChangeLog b/tests/ChangeLog
index a478edf..0230085 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,7 @@
+2001-12-22 Bruno Haible <bruno@clisp.org>
+
+ * tstngettext.c: Include exit.h instead of system.h.
+
2001-12-21 Bruno Haible <bruno@clisp.org>
* msgfilter-1: Avoid failure on HP-UX, due to strange 'fold' program.
diff --git a/tests/tstngettext.c b/tests/tstngettext.c
index 526b346..49ceea7 100644
--- a/tests/tstngettext.c
+++ b/tests/tstngettext.c
@@ -27,7 +27,7 @@
#include "error.h"
#include "basename.h"
-#include "system.h"
+#include "exit.h"
#define HAVE_SETLOCALE 1
/* Make sure we use the included libintl, not the system's one. */