[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-gnulib] feature request: argp()
From: |
Simon Josefsson |
Subject: |
Re: [Bug-gnulib] feature request: argp() |
Date: |
Tue, 10 Jun 2003 19:09:32 +0200 |
User-agent: |
Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux) |
Bruno Haible <address@hidden> writes:
>> * Commit the following patch. It consists of verbatim (from CVS)
>> libc/argp/argp* (except argp-test.c) and new gnulib/m4/argp.m4,
>> gnulib/modules/argp. This builds on my Debian Linux box. (My
>> savannah account is "jas" if you want me to commit it.)
>
> OK, I've committed the lib/* files for you, and also the module
> description. I've tweaked the title of the description because there
> is no argp() function.
Thanks.
> With m4/argp.m4 I see two problems:
>
> - The module doesn't define a function argp(), therefore _FUNC_ARGP is
> inappropriate. Can you call the macro AC_ARGP or gl_ARGP ?
I used AC_ARGP below. Is there a policy about the gl_ prefix? I
found it slightly ugly, and it doesn't seem to be used consistently.
> - The code is compiled and used even on glibc systems, which
> unnecessarily increases executable size. Can you arrange to
> not compile the files on a glibc system?
I'm using AM_CONDITIONAL below. While testing this, I noticed that
the getopt and xalloc packages (which argp depends on) have the same
problem. I also add a new module "sysexits", modeled after "exit",
based on libc's sysexits.h that argp need. Below I also modify
argp-eexst.c to handle sysexits.h, I believe the patch is safe within
libc too and I will send this patch to the libc maintainers soon.
More to come...
Thanks.
m4/argp.m4:
# argp.m4 serial 1
dnl Copyright (C) 2003 Free Software Foundation, Inc.
dnl This file is free software, distributed under the terms of the GNU
dnl General Public License. As a special exception to the GNU General
dnl Public License, this file may be distributed as part of a program
dnl that contains a configuration script generated by Autoconf, under
dnl the same distribution terms as the rest of that program.
AC_DEFUN([AC_ARGP],
[
AC_CHECK_HEADERS(argp.h)
AC_CHECK_FUNCS(argp_parse)
AM_CONDITIONAL(ARGP, test x$ac_cv_func_argp_parse = xno)
if test $ac_cv_func_argp_parse = no; then
gl_PREREQ_ARGP
fi
])
# Prerequisites of lib/argp*.c.
AC_DEFUN([gl_PREREQ_ARGP], [
AC_CHECK_HEADERS_ONCE(sysexits.h)
])
modules/argp:
--- argp.~1.1.~ Tue Jun 10 13:29:45 2003
+++ argp Tue Jun 10 19:01:03 2003
@@ -19,18 +19,21 @@
Depends-on:
alloca
getopt
+strchrnul
+sysexits
configure.ac:
-AC_FUNC_ARGP
+AC_ARGP
Makefile.am:
-lib_SOURCES += argp.h argp-ba.c argp-eexst.c \
- argp-fmtstream.c argp-fmtstream.h argp-fs-xinl.c argp-help.c \
- argp-namefrob.h argp-parse.c argp-pv.c argp-pvh.c argp-xinl.c
+if ARGP
+lib_SOURCES += argp.h argp-ba.c argp-eexst.c argp-fmtstream.c \
+ argp-fmtstream.h argp-fs-xinl.c argp-help.c argp-namefrob.h \
+ argp-parse.c argp-pv.c argp-pvh.c argp-xinl.c
+endif
Include:
"argp.h"
Maintainer:
Simon Josefsson, glibc
-
lib/sysexits.h:
/*
* Copyright (c) 1987, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)sysexits.h 8.1 (Berkeley) 6/2/93
*/
#ifndef _SYSEXITS_H
#define _SYSEXITS_H 1
/*
* SYSEXITS.H -- Exit status codes for system programs.
*
* This include file attempts to categorize possible error
* exit statuses for system programs, notably delivermail
* and the Berkeley network.
*
* Error numbers begin at EX__BASE to reduce the possibility of
* clashing with other exit statuses that random programs may
* already return. The meaning of the codes is approximately
* as follows:
*
* EX_USAGE -- The command was used incorrectly, e.g., with
* the wrong number of arguments, a bad flag, a bad
* syntax in a parameter, or whatever.
* EX_DATAERR -- The input data was incorrect in some way.
* This should only be used for user's data & not
* system files.
* EX_NOINPUT -- An input file (not a system file) did not
* exist or was not readable. This could also include
* errors like "No message" to a mailer (if it cared
* to catch it).
* EX_NOUSER -- The user specified did not exist. This might
* be used for mail addresses or remote logins.
* EX_NOHOST -- The host specified did not exist. This is used
* in mail addresses or network requests.
* EX_UNAVAILABLE -- A service is unavailable. This can occur
* if a support program or file does not exist. This
* can also be used as a catchall message when something
* you wanted to do doesn't work, but you don't know
* why.
* EX_SOFTWARE -- An internal software error has been detected.
* This should be limited to non-operating system related
* errors as possible.
* EX_OSERR -- An operating system error has been detected.
* This is intended to be used for such things as "cannot
* fork", "cannot create pipe", or the like. It includes
* things like getuid returning a user that does not
* exist in the passwd file.
* EX_OSFILE -- Some system file (e.g., /etc/passwd, /etc/utmp,
* etc.) does not exist, cannot be opened, or has some
* sort of error (e.g., syntax error).
* EX_CANTCREAT -- A (user specified) output file cannot be
* created.
* EX_IOERR -- An error occurred while doing I/O on some file.
* EX_TEMPFAIL -- temporary failure, indicating something that
* is not really an error. In sendmail, this means
* that a mailer (e.g.) could not create a connection,
* and the request should be reattempted later.
* EX_PROTOCOL -- the remote system returned something that
* was "not possible" during a protocol exchange.
* EX_NOPERM -- You did not have sufficient permission to
* perform the operation. This is not intended for
* file system problems, which should use NOINPUT or
* CANTCREAT, but rather for higher level permissions.
*/
#define EX_OK 0 /* successful termination */
#define EX__BASE 64 /* base value for error messages */
#define EX_USAGE 64 /* command line usage error */
#define EX_DATAERR 65 /* data format error */
#define EX_NOINPUT 66 /* cannot open input */
#define EX_NOUSER 67 /* addressee unknown */
#define EX_NOHOST 68 /* host name unknown */
#define EX_UNAVAILABLE 69 /* service unavailable */
#define EX_SOFTWARE 70 /* internal software error */
#define EX_OSERR 71 /* system error (e.g., can't fork) */
#define EX_OSFILE 72 /* critical OS file missing */
#define EX_CANTCREAT 73 /* can't create (user) output file */
#define EX_IOERR 74 /* input/output error */
#define EX_TEMPFAIL 75 /* temp failure; user is invited to retry */
#define EX_PROTOCOL 76 /* remote error in protocol */
#define EX_NOPERM 77 /* permission denied */
#define EX_CONFIG 78 /* configuration error */
#define EX__MAX 78 /* maximum listed value */
#endif /* sysexits.h */
modules/sysexits:
Description:
SYSEXITS.H: Exit status codes for system programs.
Files:
lib/sysexits.h
Depends-on:
configure.ac:
Makefile.am:
lib_SOURCES += sysexits.h
Include:
"sysexits.h"
Maintainer:
Simon Josefsson, glibc
lib/argp-eexst.c:
--- argp-eexst.c.~1.1.~ Tue Jun 10 13:19:46 2003
+++ argp-eexst.c Tue Jun 10 19:06:34 2003
@@ -1,5 +1,5 @@
/* Default definition for ARGP_ERR_EXIT_STATUS
- Copyright (C) 1997 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Miles Bader <address@hidden>.
@@ -22,7 +22,11 @@
#include <config.h>
#endif
+#if defined _LIBC || defined HAVE_SYSEXITS_H
#include <sysexits.h>
+#else
+#include "sysexits.h"
+#endif
#include "argp.h"
- [Bug-gnulib] feature request: argp(), Simon Josefsson, 2003/06/05
- Re: [Bug-gnulib] feature request: argp(), Bruno Haible, 2003/06/06
- Re: [Bug-gnulib] feature request: argp(), Simon Josefsson, 2003/06/06
- Re: [Bug-gnulib] feature request: argp(), Bruno Haible, 2003/06/07
- Re: [Bug-gnulib] feature request: argp(), Simon Josefsson, 2003/06/08
- Re: [Bug-gnulib] feature request: argp(), Bruno Haible, 2003/06/10
- Re: [Bug-gnulib] feature request: argp(),
Simon Josefsson <=
- Re: [Bug-gnulib] feature request: argp(), Simon Josefsson, 2003/06/10
- Re: [Bug-gnulib] feature request: argp(), James Youngman, 2003/06/10
- Re: [Bug-gnulib] feature request: argp(), Simon Josefsson, 2003/06/10
- Re: [Bug-gnulib] sysexits.h, Bruno Haible, 2003/06/10
- Re: [Bug-gnulib] sysexits.h, Simon Josefsson, 2003/06/10
- Re: [Bug-gnulib] sysexits.h, Bruno Haible, 2003/06/10
- Re: [Bug-gnulib] sysexits.h, Simon Josefsson, 2003/06/10
- Re: [Bug-gnulib] sysexits.h, Bruno Haible, 2003/06/11
- Re: [Bug-gnulib] sysexits.h, Simon Josefsson, 2003/06/11
- Re: [Bug-gnulib] sysexits.h, James Youngman, 2003/06/11