[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
(no subject)
From: |
Sergey Poznyakoff |
Subject: |
(no subject) |
Date: |
Sun, 10 Sep 2006 14:56:48 +0300 |
I have installed the following changes to argp:
2006-09-10 Sergey Poznyakoff <address@hidden>
* argp-parse.c (__argp_parse) [!_LIBC]: Make sure
program_invocation_name and program_invocation_short_name are
initialized.
* argp-namefrob.h: Move declarations of program_invocation_name
and program_invocation_short_name to argp.h, so they are visible
to user programs.
* argp.h: Likewise
Index: lib/argp-namefrob.h
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/argp-namefrob.h,v
retrieving revision 1.12
diff -p -u -r1.12 argp-namefrob.h
--- lib/argp-namefrob.h 7 Feb 2006 13:35:29 -0000 1.12
+++ lib/argp-namefrob.h 10 Sep 2006 11:29:45 -0000
@@ -141,20 +141,6 @@
# define putchar_unlocked(x) putchar (x)
# endif
-/* GNULIB makes sure both program_invocation_name and
- program_invocation_short_name are available */
-#ifdef GNULIB_PROGRAM_INVOCATION_NAME
-extern char *program_invocation_name;
-# undef HAVE_DECL_PROGRAM_INVOCATION_NAME
-# define HAVE_DECL_PROGRAM_INVOCATION_NAME 1
-#endif
-
-#ifdef GNULIB_PROGRAM_INVOCATION_SHORT_NAME
-extern char *program_invocation_short_name;
-# undef HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME
-# define HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME 1
-#endif
-
#endif /* !_LIBC */
#ifndef __set_errno
Index: lib/argp-parse.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/argp-parse.c,v
retrieving revision 1.17
diff -p -u -r1.17 argp-parse.c
--- lib/argp-parse.c 13 Mar 2006 09:52:05 -0000 1.17
+++ lib/argp-parse.c 10 Sep 2006 11:29:47 -0000
@@ -877,6 +877,20 @@ __argp_parse (const struct argp *argp, i
to be parsed (which in some cases isn't actually an error). */
int arg_ebadkey = 0;
+#ifndef _LIBC
+ if (!(flags & ARGP_PARSE_ARGV0))
+ {
+#ifdef HAVE_DECL_PROGRAM_INVOCATION_NAME
+ if (!program_invocation_name)
+ program_invocation_name = argv[0];
+#endif
+#ifdef HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME
+ if (!program_invocation_short_name)
+ program_invocation_short_name = __argp_base_name (argv[0]);
+#endif
+ }
+#endif
+
if (! (flags & ARGP_NO_HELP))
/* Add our own options. */
{
Index: lib/argp.h
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/argp.h,v
retrieving revision 1.11
diff -p -u -r1.11 argp.h
--- lib/argp.h 10 Jan 2006 21:49:07 -0000 1.11
+++ lib/argp.h 10 Sep 2006 11:29:50 -0000
@@ -418,6 +418,20 @@ extern error_t __argp_parse (const struc
/* Global variables. */
+/* GNULIB makes sure both program_invocation_name and
+ program_invocation_short_name are available */
+#ifdef GNULIB_PROGRAM_INVOCATION_NAME
+extern char *program_invocation_name;
+# undef HAVE_DECL_PROGRAM_INVOCATION_NAME
+# define HAVE_DECL_PROGRAM_INVOCATION_NAME 1
+#endif
+
+#ifdef GNULIB_PROGRAM_INVOCATION_SHORT_NAME
+extern char *program_invocation_short_name;
+# undef HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME
+# define HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME 1
+#endif
+
/* If defined or set by the user program to a non-zero value, then a default
option --version is added (unless the ARGP_NO_HELP flag is used), which
will print this string followed by a newline and exit (unless the
Index: m4/argp.m4
===================================================================
RCS file: /cvsroot/gnulib/gnulib/m4/argp.m4,v
retrieving revision 1.10
diff -p -u -r1.10 argp.m4
--- m4/argp.m4 9 Aug 2006 22:52:40 -0000 1.10
+++ m4/argp.m4 10 Sep 2006 11:29:51 -0000
@@ -15,13 +15,13 @@ AC_DEFUN([gl_ARGP],
[AC_DEFINE(HAVE_DECL_PROGRAM_INVOCATION_NAME, 1,
[Define if program_invocation_name is declared])],
[AC_DEFINE(GNULIB_PROGRAM_INVOCATION_NAME, 1,
- [Define to 1 to add extern declaration of
program_invocation_name to argp-namefrob.h])],
+ [Define to 1 to add extern declaration of
program_invocation_name to argp.h])],
[#include <errno.h>])
AC_CHECK_DECL([program_invocation_short_name],
[AC_DEFINE(HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME, 1,
[Define if program_invocation_short_name is
declared])],
[AC_DEFINE(GNULIB_PROGRAM_INVOCATION_SHORT_NAME, 1,
- [Define to 1 to add extern declaration of
program_invocation_short_name to argp-namefrob.h])],
+ [Define to 1 to add extern declaration of
program_invocation_short_name to argp.h])],
[#include <errno.h>])
# Check if program_invocation_name and program_invocation_short_name
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- (no subject),
Sergey Poznyakoff <=