[EMAIL PROTECTED] wrote:
> > Like someone already noted, it is supposed to be dotted !DECIMAL!
> > notation.
>
> Assuming my memory works at all, I think this is a feature
> of atoi() but I'd want to play with it first.
I dug around a wee bit.
The problem appears to be the inet_aton/inet_addr function,
and it's not a bug, it's a problem of conflicting specifications.
("the good thing about standards is that there are so many to choose from")
The SUS explicitly states:
All numbers supplied as parts in dot notation may be decimal,
octal, or hexadecimal, as specified in the ISO C standard (that
is, a leading 0x or 0X implies hexadecimal; otherwise, a leading
0 implies octal; otherwise, the number is interpreted as decimal).
(this is in line with the original BSD implementation, which even
contained an explicit comment to state that it worked this way...)
But RFC 1123 (STD 3) "Requirements for Internet Hosts --
Application and Support" says
2.1 Host Names and Numbers
...
Whenever a user inputs the identity of an Internet host, it SHOULD
be possible to enter either (1) a host domain name or (2) an IP
address in dotted-decimal ("#.#.#.#") form. The host SHOULD check
the string syntactically for a dotted-decimal number before
looking it up in the Domain Name System.
Though this does not provide a formal definition of the format,
it seems obvious that the numbers are intended to be decimal,
not octal or hexadecimal...
(and other RFCs contain examples that confirm this)
I suppose the UNIX standard take precedence here... ;-(
--
Willem Konynenberg <[EMAIL PROTECTED]>
I am not able rightly to apprehend the kind of confusion of ideas
that could provoke such a question -- Charles Babbage