On Feb 09 09:49:35, mill...@openbsd.org wrote: > On Sun, 09 Feb 2020 17:46:51 +0100, Jan Stary wrote: > > > Whenever unistd.h declares getopt(3), it also declares > > the extern optind and optarg, so files including unistd.h > > don't need to declare those themselves, right? > > Correct. Most of those date back from before optind and optarg > were defined for you by unistd.h.
But the externs should be mentioned in the manpage, right? That's the only place they are mentioned before being talked about in the text; although I suspect that's why people keep declaring them in source code - it's what SYNOPSIS said. Jan