From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jonny Grant Subject: Re: getopt.3 Date: Fri, 08 May 2015 22:49:36 +0100 Message-ID: <554D2F70.4050306@jguk.org> References: <5548CF67.3@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <5548CF67.3-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> Sender: linux-man-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: "Michael Kerrisk (man-pages)" Cc: linux-man List-Id: linux-man@vger.kernel.org On 05/05/15 15:10, Michael Kerrisk (man-pages) wrote: > On 05/01/2015 12:10 AM, Jonny Grant wrote: >> #include >> #include >> #include >> >> 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