Simon Josefsson | 2 Aug 2004 10:46

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)

Bruno Haible | 6 Aug 2004 22:28

Re: Re: new module: getsubopt

Simon Josefsson wrote:
> I hope this addresses all issues.
>
> 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.

Thanks. I've added your patch. And added some comments to the new file
getsubopt.h. While doing this I noted an issue that may be a glibc bug:

Does the POSIX:2001 description paragraph "If the string at *optionp ...
value for the suboption is an error." hold only for the case that
the "token" is found among the keylist, i.e. when the return value is >= 0?

Or does it hold also when the return value is -1?
(Continue reading)

Simon Josefsson | 7 Aug 2004 00:09

Re: new module: getsubopt

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

> While doing this I noted an issue that may be a glibc bug:
>
> Does the POSIX:2001 description paragraph "If the string at *optionp ...
> value for the suboption is an error." hold only for the case that
> the "token" is found among the keylist, i.e. when the return value is >= 0?
>
> Or does it hold also when the return value is -1?
>
> In the first case, an application must be aware that *OPTIONP and *VALUEP
> are undefined after getsubopt() returns -1. (Or maybe they should both be
> unchanged??) I.e. the search loop cannot be continued by the calling program,
> as in the other case.
>
> In the second case, glibc is in error if it sets *VALUEP specially.

I know it is merely informative, but looking at the example code on
the OpenGroup web page suggest *VALUEP should be set, even if -1 is
returned, as the code appear to dereference *VALUEP in that case.

To me it seems more useful to set *VALUEP even for -1.

> I've added your patch.

Thanks,
Simon

Gmane