From: Michael Kerrisk <mtk.manpages-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
To: Jonathan Nieder <jrnieder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] getopt.3: Fix feature test macro requirements for getopt()
Date: Wed, 3 Feb 2010 07:30:28 +0100 [thread overview]
Message-ID: <cfd18e0f1002022230v2030f97aja0e4b94615fee26b@mail.gmail.com> (raw)
In-Reply-To: <20091127040505.GA21636-Zz+2AvWe3NP1iTQCbxR7ew@public.gmane.org>
Hello Jonathan,
On Fri, Nov 27, 2009 at 5:05 AM, Jonathan Nieder <jrnieder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> The synopsis previously stated that getopt requires
> _POSIX_C_SOURCE >= 2 || _XOPEN_SOURCE || _POSIX_SOURCE, but that
> would be impossible, since _POSIX_SOURCE is a synonym for
> _POSIX_C_SOURCE >= 1.
>
> getopt was introduced to POSIX in POSIX.2. The glibc headers
> correctly test for that version.
Agreed. I applied your patch. The change will be in man-pages-3.24.
I also discovered and fixed similar errors in popen(2) and confstr(3)!
Thanks!
Cheers,
Michael
> Signed-off-by: Jonathan Nieder <jrnieder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> ---
> Hi,
>
> I noticed this when trying to compile a program that uses getopt with
> _POSIX_SOURCE. Checking the headers, I see that unistd.h does not
> include getopt.h unless __USE_POSIX2 is defined, and getopt.h does not
> choose the standards-conforming implementation unless __USE_POSIX2 &&
> !__USE_POSIX_IMPLICITLY && !__USE_GNU is defined.
>
> The POSIX-1 2008 documentation [1] suggests that SVr2 had a getopt,
> and the FreeBSD manpage [2] says BSD 4.3 had one, too. So maybe
> getopt should be exposed if either _BSD_SOURCE or _SVID_SOURCE is
> defined. But it isn’t currently.
>
> Anyway, I hope the patch is of some use.
>
> Thanks,
> Jonathan
>
> [1] http://www.opengroup.org/onlinepubs/9699919799/functions/getopt.html
> [2] http://svn.freebsd.org/viewvc/base/head/lib/libc/stdlib/getopt.3?view=markup
>
> man3/getopt.3 | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/man3/getopt.3 b/man3/getopt.3
> index 503f689..97ff60a 100644
> --- a/man3/getopt.3
> +++ b/man3/getopt.3
> @@ -68,7 +68,7 @@ Feature Test Macro Requirements for glibc (see
> .in
> .sp
> .BR getopt ():
> -_POSIX_C_SOURCE\ >=\ 2 || _XOPEN_SOURCE || _POSIX_SOURCE
> +_POSIX_C_SOURCE\ >=\ 2 || _XOPEN_SOURCE
> .br
> .BR getopt_long (),
> .BR getopt_long_only ():
> --
> 1.6.5.3
>
>
--
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Author of "The Linux Programming Interface" http://blog.man7.org/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
prev parent reply other threads:[~2010-02-03 6:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-27 4:05 [PATCH] getopt.3: Fix feature test macro requirements for getopt() Jonathan Nieder
[not found] ` <20091127040505.GA21636-Zz+2AvWe3NP1iTQCbxR7ew@public.gmane.org>
2010-02-03 6:30 ` Michael Kerrisk [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cfd18e0f1002022230v2030f97aja0e4b94615fee26b@mail.gmail.com \
--to=mtk.manpages-gm/ye1e23mwn+bqq9rbeug@public.gmane.org \
--cc=jrnieder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).