Re: Does getopt() return "-1", or "EOF", at end?
От
Doug Royer
Тема
Re: Does getopt() return "-1", or "EOF", at end?
Дата
Msg-id
3C3CB5D3.256A7D13@Royer.com
Список
Дерево обсуждения
Does getopt() return "-1", or "EOF", at end? Tom Lane <tgl@sss.pgh.pa.us>
Re: Does getopt() return "-1", or "EOF", at end? David Terrell <dbt@meat.net>
Re: Does getopt() return "-1", or "EOF", at end? Tom Lane <tgl@sss.pgh.pa.us>
Re: Does getopt() return "-1", or "EOF", at end? Bruce Momjian <pgman@candle.pha.pa.us>
Re: Does getopt() return "-1", or "EOF", at end? Richard Kuhns <rjk@grauel.com>
Re: Does getopt() return "-1", or "EOF", at end? Peter Eisentraut <peter_e@gmx.net>
Re: Does getopt() return "-1", or "EOF", at end? "Dominic J. Eidson" <sauron@the-infinite.org>
Tom Lane wrote: > > I notice that in some places we compare the result of getopt(3) to > "EOF", and in some other places we compare it to "-1". I think we > should standardize on one or the other; anyone have an opinion > which it should be? > > The man pages I have here (HPUX and Linux) both describe the > end-of-switches return value as being "-1". The glibc sources also > use "-1". Replacing this by EOF seems more readable but perhaps is > not strictly correct. > > Are there any platforms that define EOF as something other than -1? Would the correct question be, "what does POSIX define?". More and more systems (at least Unix systems) are defining POSIX interfaces. I don't have my POSIX CD here with me or I would quote the getopt() definition. I ~think~ it says EOF, and the target systems include files define what EOF means.
В списке pgsql-hackers по дате отправления