|
|
Index: argp-eexst.c |
|
|
--- argp-eexst.c.orig 1999-10-04 23:53:17.000000000 +0200 |
|
|
+++ argp-eexst.c 2015-09-18 22:48:56.585716441 +0200 |
|
|
@@ -22,7 +22,11 @@ |
|
|
#include <config.h> |
|
|
#endif |
|
|
|
|
|
-#include <sysexits.h> |
|
|
+#if HAVE_SYSEXITS_H |
|
|
+# include <sysexits.h> |
|
|
+#else |
|
|
+# define EX_USAGE 64 |
|
|
+#endif |
|
|
|
|
|
#include "argp.h" |
|
|
|
|
|
Index: argp-parse.c |
|
|
--- argp-parse.c.orig 2003-12-11 09:37:05.000000000 +0100 |
|
|
+++ argp-parse.c 2015-09-18 22:48:56.585716441 +0200 |
|
|
@@ -95,7 +95,9 @@ |
|
|
|
|
|
#define OPT_PROGNAME -2 |
|
|
#define OPT_USAGE -3 |
|
|
+#if HAVE_SLEEP && HAVE_GETPID |
|
|
#define OPT_HANG -4 |
|
|
+#endif |
|
|
|
|
|
static const struct argp_option argp_default_options[] = |
|
|
{ |
|
|
@@ -103,8 +105,10 @@ |
|
|
{"usage", OPT_USAGE, 0, 0, N_("Give a short usage message"), 0 }, |
|
|
{"program-name",OPT_PROGNAME,"NAME", OPTION_HIDDEN, |
|
|
N_("Set the program name"), 0}, |
|
|
+#if OPT_HANG |
|
|
{"HANG", OPT_HANG, "SECS", OPTION_ARG_OPTIONAL | OPTION_HIDDEN, |
|
|
N_("Hang for SECS seconds (default 3600)"), 0 }, |
|
|
+#endif |
|
|
{0, 0, 0, 0, 0, 0} |
|
|
}; |
|
|
|
|
|
@@ -143,7 +147,8 @@ |
|
|
state->argv[0] = arg; |
|
|
|
|
|
break; |
|
|
- |
|
|
+ |
|
|
+#if OPT_HANG |
|
|
case OPT_HANG: |
|
|
_argp_hang = atoi (arg ? arg : "3600"); |
|
|
fprintf(state->err_stream, "%s: pid = %ld\n", |
|
|
@@ -151,7 +156,8 @@ |
|
|
while (_argp_hang-- > 0) |
|
|
__sleep (1); |
|
|
break; |
|
|
- |
|
|
+#endif |
|
|
+ |
|
|
default: |
|
|
return EBADKEY; |
|
|
} |
|
|
@@ -1277,13 +1283,13 @@ |
|
|
/* Defined here, in case a user is not inlining the definitions in |
|
|
* argp.h */ |
|
|
void |
|
|
-__argp_usage (__const struct argp_state *__state) __THROW |
|
|
+__argp_usage (__const struct argp_state *__state) |
|
|
{ |
|
|
__argp_state_help (__state, stderr, ARGP_HELP_STD_USAGE); |
|
|
} |
|
|
|
|
|
int |
|
|
-__option_is_short (__const struct argp_option *__opt) __THROW |
|
|
+__option_is_short (__const struct argp_option *__opt) |
|
|
{ |
|
|
if (__opt->flags & OPTION_DOC) |
|
|
return 0; |
|
|
@@ -1297,7 +1303,7 @@ |
|
|
} |
|
|
|
|
|
int |
|
|
-__option_is_end (__const struct argp_option *__opt) __THROW |
|
|
+__option_is_end (__const struct argp_option *__opt) |
|
|
{ |
|
|
return !__opt->key && !__opt->name && !__opt->doc && !__opt->group; |
|
|
} |
|
|
Index: argp.h |
|
|
--- argp.h.orig 2003-12-11 09:37:05.000000000 +0100 |
|
|
+++ argp.h 2015-09-18 22:48:56.585716441 +0200 |
|
|
@@ -397,14 +397,14 @@ |
|
|
routine returned a non-zero value, it is returned; otherwise 0 is |
|
|
returned. This function may also call exit unless the ARGP_NO_HELP flag |
|
|
is set. INPUT is a pointer to a value to be passed in to the parser. */ |
|
|
-extern error_t argp_parse (__const struct argp *__restrict __argp, |
|
|
- int __argc, char **__restrict __argv, |
|
|
- unsigned __flags, int *__restrict __arg_index, |
|
|
- void *__restrict __input) __THROW; |
|
|
-extern error_t __argp_parse (__const struct argp *__restrict __argp, |
|
|
- int __argc, char **__restrict __argv, |
|
|
- unsigned __flags, int *__restrict __arg_index, |
|
|
- void *__restrict __input) __THROW; |
|
|
+extern error_t argp_parse (__const struct argp *__restrict argp, |
|
|
+ int argc, char **__restrict argv, |
|
|
+ unsigned flags, int *__restrict arg_index, |
|
|
+ void *__restrict input) __THROW; |
|
|
+extern error_t __argp_parse (__const struct argp *__restrict argp, |
|
|
+ int argc, char **__restrict argv, |
|
|
+ unsigned flags, int *__restrict arg_index, |
|
|
+ void *__restrict input) __THROW; |
|
|
|
|
|
/* Global variables. */ |
|
|
|
|
|
@@ -564,13 +564,13 @@ |
|
|
# endif |
|
|
|
|
|
ARGP_EI void |
|
|
-__argp_usage (__const struct argp_state *__state) __THROW |
|
|
+__argp_usage (__const struct argp_state *__state) |
|
|
{ |
|
|
__argp_state_help (__state, stderr, ARGP_HELP_STD_USAGE); |
|
|
} |
|
|
|
|
|
ARGP_EI int |
|
|
-__option_is_short (__const struct argp_option *__opt) __THROW |
|
|
+__option_is_short (__const struct argp_option *__opt) |
|
|
{ |
|
|
if (__opt->flags & OPTION_DOC) |
|
|
return 0; |
|
|
@@ -582,7 +582,7 @@ |
|
|
} |
|
|
|
|
|
ARGP_EI int |
|
|
-__option_is_end (__const struct argp_option *__opt) __THROW |
|
|
+__option_is_end (__const struct argp_option *__opt) |
|
|
{ |
|
|
return !__opt->key && !__opt->name && !__opt->doc && !__opt->group; |
|
|
} |
|
|
Index: configure.ac |
|
|
--- configure.ac.orig 2004-02-23 18:57:29.000000000 +0100 |
|
|
+++ configure.ac 2015-09-18 22:49:24.425859462 +0200 |
|
|
@@ -26,7 +26,7 @@ |
|
|
|
|
|
# Checks for header files. |
|
|
AC_HEADER_STDC |
|
|
-AC_CHECK_HEADERS(limits.h malloc.h unistd.h) |
|
|
+AC_CHECK_HEADERS(limits.h malloc.h unistd.h sysexits.h stdarg.h) |
|
|
|
|
|
# Checks for typedefs, structures, and compiler characteristics. |
|
|
AC_C_CONST |
|
|
@@ -38,7 +38,7 @@ |
|
|
# Checks for library functions. |
|
|
AC_FUNC_ALLOCA |
|
|
AC_FUNC_VPRINTF |
|
|
-AC_CHECK_FUNCS(strerror) |
|
|
+AC_CHECK_FUNCS(strerror sleep getpid snprintf) |
|
|
|
|
|
AC_REPLACE_FUNCS(mempcpy strndup strchrnul) |
|
|
|
|
|
@@ -77,20 +77,6 @@ |
|
|
AC_CHECK_DECLS([program_invocation_name, program_invocation_short_name], |
|
|
[], [], [[#include <errno.h>]]) |
|
|
|
|
|
-# Set these flags *last*, or else the test programs won't compile |
|
|
-if test x$GCC = xyes ; then |
|
|
- # Using -ggdb3 makes (some versions of) Redhat's gcc-2.96 dump core |
|
|
- if "$CC" --version | grep '^2\.96$' 1>/dev/null 2>&1; then |
|
|
- true |
|
|
- else |
|
|
- CFLAGS="$CFLAGS -ggdb3" |
|
|
- fi |
|
|
- CFLAGS="$CFLAGS -Wall -W \ |
|
|
- -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes \ |
|
|
- -Waggregate-return \ |
|
|
- -Wpointer-arith -Wbad-function-cast -Wnested-externs" |
|
|
-fi |
|
|
- |
|
|
CPPFLAGS="$CPPFLAGS -I$srcdir" |
|
|
|
|
|
AC_OUTPUT(Makefile testsuite/Makefile)
|
|
|
|