Mercurial > hg > octave-lyh > gnulib-hg
changeset 4934:0ffd1692e066
Exit-status fixes from coreutils.
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Sat, 24 Jan 2004 07:22:33 +0000 |
parents | e91b53a432f7 |
children | a05c22d4840f |
files | ChangeLog lib/ChangeLog lib/argmatch.c lib/argmatch.h lib/long-options.c lib/obstack.c lib/xstrtol.h modules/argmatch modules/obstack modules/xstrtol |
diffstat | 10 files changed, 73 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2004-01-23 Paul Eggert <eggert@twinsun.com> + + * modules/argmatch, modules/obstack, modules/xstrtol: + Depend on exitfail. + 2004-01-20 Bruno Haible <bruno@clisp.org> * modules/setenv: Depend on allocsa instead of alloca.
--- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,23 @@ +2004-01-23 Paul Eggert <eggert@twinsun.com> + + Exit-status fix from coreutils. + + Use exit_failure consistently in place of EXIT_FAILURE, + so that program exit statuses are consistent on failure. + + * argmatch.c (ARGMATCH_DIE) [! defined ARGMATCH_DIE]: + Include "exitfail.h", and use exit_failure rather than EXIT_FAILURE. + * argmatch.h: Comment fix to match the above. + * 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. + * xstrtol.h: Include "exitfail.h". + (STRTOL_FATAL_ERROR): Exit with status exit_failure, not 2. + + * long-options.c (parse_long_options): Use prototype + for usage function arg. Pass it EXIT_SUCCESS rather than 0, + for clarity. + 2004-01-21 Jim Meyering <jim@meyering.net> * mktime.c (__mktime_internal) [!_LIBC]: Define to mktime_internal @@ -6,6 +26,23 @@ * timegm.c (__mktime_internal) [!_LIBC]: Likewise. Problem building statically-linked `ls' reported by Michael Brunnbauer. +2004-01-18 Paul Eggert <eggert@twinsun.com> + + Merge from diffutils. + + * file-type.c (file_type): Add typed memory objects. + * file-type.h (S_TYPEISTMO): New macro. + + * c-stack.h (c_stack_action): Remove argv argument. + * c-stack.c (c_stack_action): Likewise. All uses changed. + (die): Don't calculate message unless segv_action returns. + (get_stack_location, min_address_from_argv, max_address_from_argv, + volatile stack_base, volatile_stack_size): Remove. + (segv_handler): If ! HAVE_XSI_STACK_OVERFLOW_HEURISTIC, assume + that every segmentation violation is a stack overflow. (Ouch!) + See Debian bug 136249 (still outstanding) for more info about why + HAVE_XSI_STACK_OVERFLOW_HEURISTIC fails on Linux kernels. + 2003-11-30 Bruno Haible <bruno@clisp.org> Safer stack allocation.
--- a/lib/argmatch.c +++ b/lib/argmatch.c @@ -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
--- a/lib/argmatch.h +++ b/lib/argmatch.h @@ -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 @@ /* 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;
--- a/lib/long-options.c +++ b/lib/long-options.c @@ -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 @@ 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 @@ switch (c) { case 'h': - (*usage_func) (0); + (*usage_func) (EXIT_SUCCESS); case 'v': {
--- a/lib/obstack.c +++ b/lib/obstack.c @@ -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 @@ /* Exit value used when `print_and_abort' is used. */ # include <stdlib.h> -# ifndef _LIBC -# include "exit.h" +# ifdef _LIBC +int obstack_exit_failure = EXIT_FAILURE; +# else +# include "exitfail.h" +# define obstack_exit_failure exit_failure # endif -int obstack_exit_failure = EXIT_FAILURE; /* The non-GNU-C macros copy the obstack into this global variable to avoid multiple evaluation. */ @@ -286,9 +289,9 @@ /* 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 @@ 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)
--- a/lib/xstrtol.h +++ b/lib/xstrtol.h @@ -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 @@ 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)
--- a/modules/argmatch +++ b/modules/argmatch @@ -12,6 +12,7 @@ quote unlocked-io exit +exitfail configure.ac: