[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-gnulib] exit-status patch from coreutils
From: |
Paul Eggert |
Subject: |
[Bug-gnulib] exit-status patch from coreutils |
Date: |
23 Jan 2004 23:25:11 -0800 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 |
I installed the following patch, merged from coreutils. It fixes some
exit-status glitches.
2004-01-23 Paul Eggert <address@hidden>
Exit-status fix from coreutils.
Use exit_failure consistently in place of EXIT_FAILURE,
so that program exit statuses are consistent on failure.
* lib/argmatch.c (ARGMATCH_DIE) [! defined ARGMATCH_DIE]:
Include "exitfail.h", and use exit_failure rather than EXIT_FAILURE.
* lib/argmatch.h: Comment fix to match the above.
* lib/obstack.c (obstack_exit_failure) [!defined _LIBC]:
Now a macro referring to exit_failure, instead of a separate
variable. Include "exitfail.h" to get it.
* lib/xstrtol.h: Include "exitfail.h".
(STRTOL_FATAL_ERROR): Exit with status exit_failure, not 2.
* lib/long-options.c (parse_long_options): Use prototype
for usage function arg. Pass it EXIT_SUCCESS rather than 0,
for clarity.
* modules/argmatch, modules/obstack, modules/xstrtol:
Depend on exitfail.
Index: lib/argmatch.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/argmatch.c,v
retrieving revision 1.32
diff -p -u -r1.32 argmatch.c
--- lib/argmatch.c 12 Sep 2003 20:14:10 -0000 1.32
+++ lib/argmatch.c 24 Jan 2004 07:00:23 -0000
@@ -1,7 +1,7 @@
/* argmatch.c -- find a match for a string in an array
- Copyright (C) 1990, 1998, 1999, 2001, 2002, 2003 Free Software
- Foundation, Inc.
+ Copyright (C) 1990, 1998, 1999, 2001, 2002, 2003, 2004 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
@@ -49,7 +49,8 @@
/* Non failing version of argmatch call this function after failing. */
#ifndef ARGMATCH_DIE
-# define ARGMATCH_DIE exit (EXIT_FAILURE)
+# include "exitfail.h"
+# define ARGMATCH_DIE exit (exit_failure)
#endif
#ifdef ARGMATCH_DIE_DECL
Index: lib/argmatch.h
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/argmatch.h,v
retrieving revision 1.21
diff -p -u -r1.21 argmatch.h
--- lib/argmatch.h 21 Nov 2002 20:15:39 -0000 1.21
+++ lib/argmatch.h 24 Jan 2004 07:00:24 -0000
@@ -1,5 +1,7 @@
/* argmatch.h -- definitions and prototypes for argmatch.c
- Copyright (C) 1990, 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+
+ Copyright (C) 1990, 1998, 1999, 2001, 2002, 2004 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
@@ -55,7 +57,7 @@ int argmatch (char const *arg, char cons
/* xargmatch calls this function when it fails. This function should not
return. By default, this is a function that calls ARGMATCH_DIE which
- in turn defaults to `exit (EXIT_FAILURE)'. */
+ in turn defaults to `exit (exit_failure)'. */
typedef void (*argmatch_exit_fn) (void);
extern argmatch_exit_fn argmatch_die;
Index: lib/long-options.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/long-options.c,v
retrieving revision 1.19
diff -p -u -r1.19 long-options.c
--- lib/long-options.c 6 Oct 2003 20:30:18 -0000 1.19
+++ lib/long-options.c 24 Jan 2004 07:00:24 -0000
@@ -1,6 +1,6 @@
/* Utility to accept --help and --version options as unobtrusively as possible.
- Copyright (C) 1993, 1994, 1998, 1999, 2000, 2002, 2003 Free
+ Copyright (C) 1993, 1994, 1998, 1999, 2000, 2002, 2003, 2004 Free
Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
@@ -49,7 +49,7 @@ parse_long_options (int argc,
const char *command_name,
const char *package,
const char *version,
- void (*usage_func)(),
+ void (*usage_func) (int),
/* const char *author1, ...*/ ...)
{
int c;
@@ -66,7 +66,7 @@ parse_long_options (int argc,
switch (c)
{
case 'h':
- (*usage_func) (0);
+ (*usage_func) (EXIT_SUCCESS);
case 'v':
{
Index: lib/obstack.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/obstack.c,v
retrieving revision 1.22
diff -p -u -r1.22 obstack.c
--- lib/obstack.c 22 Oct 2003 05:10:04 -0000 1.22
+++ lib/obstack.c 24 Jan 2004 07:00:25 -0000
@@ -1,7 +1,8 @@
/* obstack.c - subroutines used implicitly by object stack macros
Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1996, 1997,
- 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+ 1998, 1999, 2000, 2001, 2002, 2003, 2004 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
@@ -22,9 +23,9 @@
#endif
#ifdef _LIBC
-#include <obstack.h>
+# include <obstack.h>
#else
-#include "obstack.h"
+# include "obstack.h"
#endif
/* NOTE BEFORE MODIFYING THIS FILE: This version number must be
@@ -86,10 +87,12 @@ void (*obstack_alloc_failed_handler) (vo
/* Exit value used when `print_and_abort' is used. */
# include <stdlib.h>
-# ifndef _LIBC
-# include "exit.h"
-# endif
+# ifdef _LIBC
int obstack_exit_failure = EXIT_FAILURE;
+# else
+# include "exitfail.h"
+# define obstack_exit_failure exit_failure
+# endif
/* The non-GNU-C macros copy the obstack into this global variable
to avoid multiple evaluation. */
@@ -286,9 +289,9 @@ _obstack_newchunk (struct obstack *h, in
/* The new chunk certainly contains no empty object yet. */
h->maybe_empty_object = 0;
}
-#ifdef _LIBC
+# ifdef _LIBC
libc_hidden_def (_obstack_newchunk)
-#endif
+# endif
/* Return nonzero if object OBJ has been allocated from obstack H.
This is here for debugging.
@@ -351,11 +354,11 @@ obstack_free (struct obstack *h, void *o
abort ();
}
-#ifdef _LIBC
+# ifdef _LIBC
/* Older versions of libc used a function _obstack_free intended to be
called by non-GCC compilers. */
strong_alias (obstack_free, _obstack_free)
-#endif
+# endif
int
_obstack_memory_used (struct obstack *h)
Index: lib/xstrtol.h
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/xstrtol.h,v
retrieving revision 1.17
diff -p -u -r1.17 xstrtol.h
--- lib/xstrtol.h 14 Oct 2003 20:08:26 -0000 1.17
+++ lib/xstrtol.h 24 Jan 2004 07:00:26 -0000
@@ -1,6 +1,6 @@
/* A more useful interface to strtol.
- Copyright (C) 1995, 1996, 1998, 1999, 2001, 2002, 2003 Free
+ Copyright (C) 1995, 1996, 1998, 1999, 2001, 2002, 2003, 2004 Free
Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
@@ -20,6 +20,8 @@
#ifndef XSTRTOL_H_
# define XSTRTOL_H_ 1
+# include "exitfail.h"
+
/* Get uintmax_t. */
# if HAVE_INTTYPES_H
# include <inttypes.h>
@@ -81,7 +83,7 @@ _DECLARE_XSTRTOL (xstrtoumax, uintmax_t)
while (0)
# define STRTOL_FATAL_ERROR(Str, Argument_type_string, Err) \
- _STRTOL_ERROR (2, Str, Argument_type_string, Err)
+ _STRTOL_ERROR (exit_failure, Str, Argument_type_string, Err)
# define STRTOL_FAIL_WARN(Str, Argument_type_string, Err) \
_STRTOL_ERROR (0, Str, Argument_type_string, Err)
Index: modules/argmatch
===================================================================
RCS file: /cvsroot/gnulib/gnulib/modules/argmatch,v
retrieving revision 1.5
diff -p -u -r1.5 argmatch
--- modules/argmatch 15 Sep 2003 20:40:48 -0000 1.5
+++ modules/argmatch 24 Jan 2004 07:00:26 -0000
@@ -12,6 +12,7 @@ quotearg
quote
unlocked-io
exit
+exitfail
configure.ac:
Index: modules/obstack
===================================================================
RCS file: /cvsroot/gnulib/gnulib/modules/obstack,v
retrieving revision 1.5
diff -p -u -r1.5 obstack
--- modules/obstack 15 Sep 2003 20:40:48 -0000 1.5
+++ modules/obstack 24 Jan 2004 07:00:26 -0000
@@ -9,6 +9,7 @@ m4/obstack.m4
Depends-on:
gettext
exit
+exitfail
configure.ac:
gl_OBSTACK
Index: modules/xstrtol
===================================================================
RCS file: /cvsroot/gnulib/gnulib/modules/xstrtol,v
retrieving revision 1.3
diff -p -u -r1.3 xstrtol
--- modules/xstrtol 20 Jan 2003 10:02:38 -0000 1.3
+++ modules/xstrtol 24 Jan 2004 07:00:26 -0000
@@ -14,6 +14,7 @@ m4/intmax_t.m4
m4/xstrtol.m4
Depends-on:
+exitfail
configure.ac:
gl_XSTRTOL
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Bug-gnulib] exit-status patch from coreutils,
Paul Eggert <=