[ih] 13 the unlucky number

John Lowry jhlowry at mac.com
Tue Aug 11 11:53:46 PDT 2020


Perhaps it is BSD-ism ?
https://tools.ietf.org/html/draft-main-ipaddr-text-rep-00 <https://tools.ietf.org/html/draft-main-ipaddr-text-rep-00>


> On Aug 11, 2020, at 14:12, Joseph Touch via Internet-history <internet-history at elists.isoc.org> wrote:
> 
> FYI, some code appears to use stroul() with a base of “0”, which works basically like scanf() with %i.
> 
> Joe
> 
>> On Aug 11, 2020, at 10:57 AM, Patrick W. Gilmore via Internet-history <internet-history at elists.isoc.org> wrote:
>> 
>> I believe MacOS (I’m on Catalina, 10.15, but pretty sure previous versions are the same) is doing %I. The leading 0 is forcing octal. Removing the leading zero lets the OS see decimal. For instance:
>> 
>> patrick at TiggerBook-C-32 ~ % ping 10.010.010.10 
>> PING 10.010.010.10 (10.8.8.10): 56 data bytes
>> 
>> -- 
>> TTFN,
>> patrick
>> 
>>> On Aug 11, 2020, at 1:51 PM, Joseph Touch via Internet-history <internet-history at elists.isoc.org> wrote:
>>> 
>>> It seems like the input functions of the implementations vary. When using scanf:
>>> 
>>> 	%d, %x, %o 	= interpret the input as only decimal, hex, or octal (respectively)
>>> 
>>> 	%I			= interpret the input based on its format:
>>> 						0x… 	= hex
>>> 						0…		= octal
>>> 						(1-9)…	= decimal
>>> 						0b…	= binary (in some systems)
>>> 
>>> It looks like MacOS is using %d and linux/others are using %I
>>> 
>>> Joe
>>> 	
>>> 
>>>> On Aug 11, 2020, at 9:50 AM, Carsten Bormann via Internet-history <internet-history at elists.isoc.org> wrote:
>>>> 
>>>> On 2020-08-11, at 01:58, Alejandro Acosta via Internet-history <internet-history at elists.isoc.org> wrote:
>>>>> 
>>>>>   010.rrr.rrr.rrr   ARPANET       ARPANET [17,1,VGC]
>>>> 
>>>> Off-topic, but I can’t read this in any other way than as an octal number.
>>>> 
>>>> $ ping 010.010.010.010
>>>> PING 010.010.010.010 (8.8.8.8) 56(84) bytes of data.
>>>> 64 bytes from 8.8.8.8: icmp_seq=1 ttl=119 time=6.35 ms
>>>> $ ping 134744072
>>>> PING 134744072 (8.8.8.8) 56(84) bytes of data.
>>>> 64 bytes from 8.8.8.8: icmp_seq=1 ttl=119 time=6.31 ms
>>>> $ ping 01002004010
>>>> PING 01002004010 (8.8.8.8) 56(84) bytes of data.
>>>> 64 bytes from 8.8.8.8: icmp_seq=1 ttl=119 time=6.31 ms
>>>> $ ping 0x8080808
>>>> PING 0x8080808 (8.8.8.8) 56(84) bytes of data.
>>>> 64 bytes from 8.8.8.8: icmp_seq=1 ttl=119 time=6.30 ms
>>>> 
>>>> Does anyone remember how this misfeature crept into the C library?
>>>> (I seem to remember seeing it all the way back to 4.2BSD.  
>>>> It no longer works with macOS, but still does on the Linuxes I tried.)
>>>> 
>>>> Grüße, Carsten
>>>> 
>>>> -- 
>>>> Internet-history mailing list
>>>> Internet-history at elists.isoc.org
>>>> https://elists.isoc.org/mailman/listinfo/internet-history
>>> 
>>> -- 
>>> Internet-history mailing list
>>> Internet-history at elists.isoc.org
>>> https://elists.isoc.org/mailman/listinfo/internet-history
>> 
>> -- 
>> Internet-history mailing list
>> Internet-history at elists.isoc.org
>> https://elists.isoc.org/mailman/listinfo/internet-history
> 
> -- 
> Internet-history mailing list
> Internet-history at elists.isoc.org
> https://elists.isoc.org/mailman/listinfo/internet-history




More information about the Internet-history mailing list