From: Jonny Grant <jg-hus3n9K41k0@public.gmane.org>
To: "Michael Kerrisk (man-pages)"
<mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: linux-man <linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: getopt.3
Date: Fri, 08 May 2015 22:49:36 +0100 [thread overview]
Message-ID: <554D2F70.4050306@jguk.org> (raw)
In-Reply-To: <5548CF67.3-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
On 05/05/15 15:10, Michael Kerrisk (man-pages) wrote:
> On 05/01/2015 12:10 AM, Jonny Grant wrote:
>> #include <unistd.h>
>> #include <stdlib.h>
>> #include <stdio.h>
>>
>> int
>> main(int argc, char *argv[])
>> {
>> int flags, opt;
>> int nsecs, tfnd;
>>
>> nsecs = 0;
>> tfnd = 0;
>> flags = 0;
>> while ((opt = getopt(argc, argv, "nt:")) != -1) {
>> switch (opt) {
>> case 'n':
>> flags = 1;
>> break;
>> case 't':
>> nsecs = atoi(optarg);
>> tfnd = 1;
>> break;
>> default: /* '?' */
>> fprintf(stderr, "Usage: %s [-t nsecs] [-n] name\n",
>> argv[0]);
>> exit(EXIT_FAILURE);
>> }
>> }
>>
>> return 0;
>> }
>
> It looks like you are looking at a (very) old version
> of the page. That code does not match the example in
> the current man page.
Apologies, unsure where I got that old code from.
Latest code compiles ok for me too.
Regards, Jonny
--
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:[~2015-05-08 21:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-11 22:27 getopt.3 Jonny Grant
[not found] ` <CAGc9EveyW=7Oy2NBfy+V2kjEHhzxkY5Keh2+eU_hff8kbBQt9Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-04-12 7:21 ` getopt.3 Michael Kerrisk (man-pages)
[not found] ` <CAGc9EvfEfGEfw5Fr3tvoJxrRbTJzps9y=Xbt0G4cZxeU1OSk-Q@mail.gmail.com>
[not found] ` <5548CF67.3@gmail.com>
[not found] ` <5548CF67.3-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-05-08 21:49 ` Jonny Grant [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=554D2F70.4050306@jguk.org \
--to=jg-hus3n9k41k0@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.