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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)postgreSQL(dot)org
Subject: Does getopt() return "-1", or "EOF", at end?
Date: 2002-01-09 17:58:45
Message-ID: 8213.1010599125@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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?

regards, tom lane

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Marc G. Fournier 2002-01-09 18:02:19 Re: RC1 time?
Previous Message Doug Royer 2002-01-09 17:37:38 Re: Some architectures need "signed char" declarations