Hello,
On Wed, Aug 24, 2005 at 10:20:08PM -0700, Paul Eggert wrote:
> Let's please just define [EX_OK] to 0; [...]
>
> I also like Simon's suggestion of defining EXIT_SUCCESS and
> EXIT_FAILURE in config.h, [...]
something like the attached patch (not tested)?
Stepan
diff -urpN gnulib/lib/.cppi-disable gnulib.new/lib/.cppi-disable
--- gnulib/lib/.cppi-disable 2005-08-25 14:51:21.000000000 +0200
+++ gnulib.new/lib/.cppi-disable 2005-08-25 14:52:42.000000000 +0200
@@ -1,7 +1,6 @@
alloca_.h
allocsa.h
error.h
-exit.h
fnmatch_.h
fts.c
fts_.h
diff -urpN gnulib/lib/argmatch.c gnulib.new/lib/argmatch.c
--- gnulib/lib/argmatch.c 2005-08-25 14:51:21.000000000 +0200
+++ gnulib.new/lib/argmatch.c 2005-08-25 14:52:42.000000000 +0200
@@ -36,7 +36,7 @@
#define _(msgid) gettext (msgid)
#include "error.h"
-#include "exit.h"
+#include <stdlib.h>
#include "quotearg.h"
#include "quote.h"
diff -urpN gnulib/lib/copy-file.c gnulib.new/lib/copy-file.c
--- gnulib/lib/copy-file.c 2005-08-25 14:51:21.000000000 +0200
+++ gnulib.new/lib/copy-file.c 2005-08-25 14:52:42.000000000 +0200
@@ -45,7 +45,7 @@
#include "safe-read.h"
#include "full-write.h"
#include "binary-io.h"
-#include "exit.h"
+#include <stdlib.h>
#include "gettext.h"
#define _(str) gettext (str)
diff -urpN gnulib/lib/execute.c gnulib.new/lib/execute.c
--- gnulib/lib/execute.c 2005-08-25 14:51:21.000000000 +0200
+++ gnulib.new/lib/execute.c 2005-08-25 14:52:42.000000000 +0200
@@ -35,7 +35,7 @@
#endif
#include "error.h"
-#include "exit.h"
+#include <stdlib.h>
#include "fatal-signal.h"
#include "wait-process.h"
#include "gettext.h"
diff -urpN gnulib/lib/exit.h gnulib.new/lib/exit.h
--- gnulib/lib/exit.h 2005-08-25 14:51:33.000000000 +0200
+++ gnulib.new/lib/exit.h 1970-01-01 01:00:00.000000000 +0100
@@ -1,32 +0,0 @@
-/* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 -urpN gnulib/lib/exitfail.c gnulib.new/lib/exitfail.c
--- gnulib/lib/exitfail.c 2005-08-25 14:51:21.000000000 +0200
+++ gnulib.new/lib/exitfail.c 2005-08-25 14:52:42.000000000 +0200
@@ -22,6 +22,6 @@
#endif
#include "exitfail.h"
-#include "exit.h"
+#include <stdlib.h>
int volatile exit_failure = EXIT_FAILURE;
diff -urpN gnulib/lib/pagealign_alloc.c gnulib.new/lib/pagealign_alloc.c
--- gnulib/lib/pagealign_alloc.c 2005-08-25 14:51:21.000000000 +0200
+++ gnulib.new/lib/pagealign_alloc.c 2005-08-25 14:52:42.000000000 +0200
@@ -39,7 +39,7 @@
#endif
#include "error.h"
-#include "exit.h"
+#include <stdlib.h>
#include "getpagesize.h"
#include "xalloc.h"
#include "gettext.h"
diff -urpN gnulib/lib/pipe.c gnulib.new/lib/pipe.c
--- gnulib/lib/pipe.c 2005-08-25 14:51:21.000000000 +0200
+++ gnulib.new/lib/pipe.c 2005-08-25 14:52:42.000000000 +0200
@@ -34,7 +34,7 @@
#endif
#include "error.h"
-#include "exit.h"
+#include <stdlib.h>
#include "fatal-signal.h"
#include "wait-process.h"
#include "gettext.h"
diff -urpN gnulib/lib/sysexit_.h gnulib.new/lib/sysexit_.h
--- gnulib/lib/sysexit_.h 2005-08-25 14:51:21.000000000 +0200
+++ gnulib.new/lib/sysexit_.h 2005-08-25 14:52:42.000000000 +0200
@@ -1,5 +1,5 @@
/* exit() exit codes for some BSD system programs.
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2005 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
@@ -20,6 +20,7 @@
#ifndef _SYSEXITS_H
#define _SYSEXITS_H
+#define EX_OK 0
#define EX_USAGE 64
#define EX_DATAERR 65
#define EX_NOINPUT 66
diff -urpN gnulib/lib/wait-process.c gnulib.new/lib/wait-process.c
--- gnulib/lib/wait-process.c 2005-08-25 14:51:21.000000000 +0200
+++ gnulib.new/lib/wait-process.c 2005-08-25 14:52:42.000000000 +0200
@@ -91,7 +91,7 @@
#endif
#include "error.h"
-#include "exit.h"
+#include <stdlib.h>
#include "fatal-signal.h"
#include "xalloc.h"
#include "gettext.h"
diff -urpN gnulib/lib/xsetenv.c gnulib.new/lib/xsetenv.c
--- gnulib/lib/xsetenv.c 2005-08-25 14:51:21.000000000 +0200
+++ gnulib.new/lib/xsetenv.c 2005-08-25 14:52:42.000000000 +0200
@@ -24,7 +24,7 @@
#include "setenv.h"
#include "error.h"
-#include "exit.h"
+#include <stdlib.h>
#include "gettext.h"
#define _(str) gettext (str)
diff -urpN gnulib/m4/exit_codes.m4 gnulib.new/m4/exit_codes.m4
--- gnulib/m4/exit_codes.m4 1970-01-01 01:00:00.000000000 +0100
+++ gnulib.new/m4/exit_codes.m4 2005-08-25 14:43:10.000000000 +0200
@@ -0,0 +1,21 @@
+# exit_code.m4 serial 0
+dnl Copyright (C) 2005 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_EXIT],
+[
+AH_TEMPLATE([EXIT_SUCCESS], [Define is stdlib.h forgot.])
+AH_TEMPLATE([EXIT_FAILURE], [Define is stdlib.h forgot.])
+for gl_symbol in EXIT_SUCCESS EXIT_FAILURE
+AC_EGREP_CPP([gl:replacement_needed],
+[#include <stdlib.h>
+#ifndef $gl_symbol
+ gl:replacement_needed
+#endif],
+[test $gl_symbol = EXIT_SUCCESS && gl_value=0 || gl_value=1
+ AC_DEFINE_UNQUOTED([$gl_symbol], [$gl_value])
+])
+done
+])
diff -urpN gnulib/modules/exit gnulib.new/modules/exit
--- gnulib/modules/exit 2005-08-25 14:51:21.000000000 +0200
+++ gnulib.new/modules/exit 2005-08-25 14:52:42.000000000 +0200
@@ -2,20 +2,19 @@ Description:
exit() function: program termination.
Files:
-lib/exit.h
+m4/exit_codes.m4
Depends-on:
configure.ac:
+gl_EXIT
Makefile.am:
-lib_SOURCES += exit.h
Include:
-"exit.h"
License:
-GPL
+unlimited
Maintainer:
Bruno Haible
_______________________________________________
bug-gnulib mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-gnulib