Re: Does getopt() return "-1", or "EOF", at end?

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: Does getopt() return "-1", or "EOF", at end?
Дата
Msg-id 200201092110.g09LAFT10967@candle.pha.pa.us
обсуждение исходный текст
Ответ на Does getopt() return "-1", or "EOF", at end?  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Does getopt() return "-1", or "EOF", at end?
Список pgsql-hackers
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?

I think -1 is the only way to go.  EOF just doesn't seem right for a
non-file access function.

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: Does getopt() return "-1", or "EOF", at end?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Does getopt() return "-1", or "EOF", at end?