Simon Josefsson | 1 Aug 20:36 2004

new module: getsubopt

How about this?

I haven't really tested it, but it looks good to me.

Comments in general is appreciated, of course, but perhaps on the
following issues in particular:

* I didn't really understand the "restrict" stuff, so perhaps the
  prototype in getsubopt.c should be changed.  Perhaps it should be
  changed anyway, it is K&R now.

* The C file is glibc stdlib/getsubopt.c, but slightly modified.  I'll
  send a proposed glibc update to the glibc folks, and if it is
  accepted, gnulib could sync against that.

* MODULES.html.sh?  It mention getsubopt, but I dunno where to add
  getsubopt.  IIUC, getsubopt is X/Open, not POSIX.

Thanks.

2004-08-01  Simon Josefsson  <jas <at> extundo.com>

	* getsubopt.c: New file, from glibc but slightly modified.
	* getsubopt.h: New file.

2004-08-01  Simon Josefsson  <jas <at> extundo.com>

	* getsubopt.m4: New file.

2004-08-01  Simon Josefsson  <jas <at> extundo.com>
(Continue reading)

Simon Josefsson | 1 Aug 20:48 2004

xgetdomainname.c: need stdlib.h for free

?

2004-08-01  Simon Josefsson  <jas <at> extundo.com>

	* xgetdomainname.c: Include stdlib.h, for free.

Index: xgetdomainname.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/xgetdomainname.c,v
retrieving revision 1.2
diff -u -p -u -w -r1.2 xgetdomainname.c
--- xgetdomainname.c	25 Sep 2003 11:01:25 -0000	1.2
+++ xgetdomainname.c	1 Aug 2004 18:46:53 -0000
 <at>  <at>  -1,5 +1,6  <at>  <at> 
 /* xgetdomainname.c -- Return the NIS domain name, without size limitations.
-   Copyright (C) 1992, 1996, 2000, 2001, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1992, 1996, 2000, 2001, 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
 <at>  <at>  -30,6 +31,9  <at>  <at> 
 /* Get errno.  */
 #include <errno.h>

+/* Get free.  */
+#include <stdlib.h>
+
 #include "xalloc.h"

(Continue reading)

Paul Eggert | 2 Aug 01:31 2004

Re: new module: getsubopt

Simon Josefsson <jas <at> extundo.com> writes:

> * I didn't really understand the "restrict" stuff, so perhaps the
>   prototype in getsubopt.c should be changed.

The "restrict" keywords tell the caller that the arguments to
getsubopt cannot point at overlapping storage.  However, the POSIX
specification doesn't have "restrict", so the use of "restrict" here
violates POSIX.  This appears to be a bug in glibc; you might as well
fix it while you're at it, by removing "restrict".

>   Perhaps it should be changed anyway, it is K&R now.

Yes, please use prototypes, not K&R.  We assume C89 or better now.

> * The C file is glibc stdlib/getsubopt.c, but slightly modified.

Please arrange things so that the exact same file can be used in
gnulib versus glibc, except for the licensing comment.  That way, we
can list it in gnulib/config/srclist.txt, and it can be kept in sync
with glibc.

To that end, please replace this patch:

  +/* Get strchrnul.  */
  +#include <strchrnul.h>
  ...
  -  endp = __strchrnul (*optionp, ',');
  +  endp = strchrnul (*optionp, ',');

(Continue reading)

Simon Josefsson | 2 Aug 10:46 2004

Re: new module: getsubopt

I hope this addresses all issues.  I'll send an updated patch to
libc-alpha, once this discussion start to show up in the web archives,
so I can reference it.

Thanks.

2004-08-02  Simon Josefsson  <jas <at> extundo.com>

	* MODULES.html.sh (Support for systems lacking POSIX:2001): Add
	getsubopt.

2004-08-01  Simon Josefsson  <jas <at> extundo.com>

	* modules/getsubopt: New file.

2004-08-01  Simon Josefsson  <jas <at> extundo.com>

	* getsubopt.h: New file.
	* getsubopt.c: New file, from glibc, but slightly modified based
	on suggestions from Paul Eggert <eggert <at> CS.UCLA.EDU>.

2004-08-01  Simon Josefsson  <jas <at> extundo.com>

	* getsubopt.m4: New file.

Index: MODULES.html.sh
===================================================================
RCS file: /cvsroot/gnulib/gnulib/MODULES.html.sh,v
retrieving revision 1.54
diff -u -p -r1.54 MODULES.html.sh
(Continue reading)

Simon Josefsson | 3 Aug 18:37 2004

`fatal' module problem?

The `fatal' module look plain broken to me:

void
fatal (int errnum, const char *message, ...)
{
  va_list args;
...
  va_start (args, message);
  error (EXIT_FAILURE, errnum, message, args);

But error doesn't take a va_list, from error.h:

extern void error (int __status, int __errnum, const char *__format, ...)
     __attribute__ ((__format__ (__printf__, 3, 4)));

There is error_tail in error.c, that takes va_list, but it isn't
marked as 'extern'.  Furthermore, the error.m4 only test for
error_at_line, so even if it is marked as 'extern', error.c won't get
compiled on, e.g., glibc systems, so fatal fail to build.

One solution:

* Make error.m4 look for error_tail, and build error.c if it is not present.
* Make error_tail an 'extern' symbol, and include it in error.h.
* Make fatal use error_tail.

I'm not sure this is the best solution.  Any ideas?  I'm hoping that I
might have simply missed something, and that fatal.c really works.

Thanks.
(Continue reading)

Bruno Haible | 3 Aug 19:13 2004

Re: `fatal' module problem?

Simon Josefsson wrote:
> But error doesn't take a va_list, from error.h:

Agreed. We don't have a va_error(), and since the purpose of the error()
module is to provide for a substitute for functions already in glibc,
we cannot add it either.

Can you either
  - use a simplified version of error_tail in fatal.c, or
  - drop the 'fatal' module entirely (none of coreutils, tar, diff, gettext
    uses it)?

Bruno
Simon Josefsson | 3 Aug 19:27 2004

Re: `fatal' module problem?

Bruno Haible <bruno <at> clisp.org> writes:

> Simon Josefsson wrote:
>> But error doesn't take a va_list, from error.h:
>
> Agreed. We don't have a va_error(), and since the purpose of the error()
> module is to provide for a substitute for functions already in glibc,
> we cannot add it either.
>
> Can you either
>   - use a simplified version of error_tail in fatal.c, or
>   - drop the 'fatal' module entirely (none of coreutils, tar, diff, gettext
>     uses it)?

I realized `error (EXIT_FAILURE, ...)' did what I want, so I went for
your second option.

(I kind of preferred `fatal (...)' as it is more readable, though.)

Unless fatal.* is fixed, perhaps removing the 'modules/fatal' file is
a good idea, so others don't fall in the same trap as I did.

Thanks,
Simon
Paul Eggert | 3 Aug 20:44 2004

Re: Re: `fatal' module problem?

Simon Josefsson <jas <at> extundo.com> writes:

> (I kind of preferred `fatal (...)' as it is more readable, though.)

Another advantage of "fatal" would be that GCC can deduce that it
doesn't return, and can generate better code in some cases.

> Unless fatal.* is fixed, perhaps removing the 'modules/fatal' file is
> a good idea, so others don't fall in the same trap as I did.

OK, I removed the "fatal" module's files.  That's good enough for now.
Simon Josefsson | 3 Aug 23:22 2004

progname: doesn't appear to need stdbool.h.

?

2004-08-03  Simon Josefsson  <jas <at> extundo.com>

	* progname.h: Don't include stdbool.h.

2004-08-03  Simon Josefsson  <jas <at> extundo.com>

	* modules/progname (Depends-on): Don't depend on stdbool.

Index: progname.h
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/progname.h,v
retrieving revision 1.3
diff -u -p -u -w -r1.3 progname.h
--- progname.h	16 Jul 2004 16:28:50 -0000	1.3
+++ progname.h	3 Aug 2004 21:21:00 -0000
 <at>  <at>  -19,8 +19,6  <at>  <at> 
 #ifndef _PROGNAME_H
 #define _PROGNAME_H

-#include <stdbool.h>
-
 /* Programs using this file should do the following in main():
      set_program_name (argv[0]);
  */
Index: progname
===================================================================
RCS file: /cvsroot/gnulib/gnulib/modules/progname,v
retrieving revision 1.1
(Continue reading)

Simon Josefsson | 3 Aug 23:50 2004

strdup: fix warnings

strdup.h generated warnings on platforms that have strdup, since the
AC_CHECK_DECLS(strdup) call was only invoked when strdup was missing.
This fixes both the m4, and the header file.

Perhaps it is bad style to always invoke gl_PREREQ_*, I'm not sure
about that.

2004-08-03  Simon Josefsson  <jas <at> extundo.com>

	* strdup.h: Only use HAVE_DECL_STRDUP if defined.

2004-08-03  Simon Josefsson  <jas <at> extundo.com>

	* strdup.m4: Always run gl_PREREQ_STRDUP, since strdup.h need it.

Index: strdup.h
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/strdup.h,v
retrieving revision 1.1
diff -u -p -u -w -r1.1 strdup.h
--- strdup.h	25 Feb 2004 19:46:30 -0000	1.1
+++ strdup.h	3 Aug 2004 21:48:08 -0000
 <at>  <at>  -21,7 +21,7  <at>  <at> 
 /* Get strdup declaration, if available.  */
 #include <string.h>

-#if !HAVE_DECL_STRDUP && !defined strdup
+#if defined HAVE_DECL_STRDUP && !HAVE_DECL_STRDUP && !defined strdup
 /* Duplicate S, returning an identical malloc'd string.  */
 extern char *strdup (const char *s);
(Continue reading)


Gmane