tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: printf '%b' '\64' (was: printf(1) and incomplete escape sequence)



    Date:        Tue, 3 Jul 2018 10:39:37 +0200
    From:        Edgar =?iso-8859-1?B?RnXf?= <ef%math.uni-bonn.de@localhost>
    Message-ID:  <20180703083936.GI48007%trav.math.uni-bonn.de@localhost>

  | > that is, \0123 in a format string, and in a %b arg are treated differently.
  | There's always something new to learn.
  | Do you have any idea which system's printf's bug POSIX is modeled after here?

I'm not certain, but I think that printf came from 9th edition (bell labs) 
unix, and the format string was designed as an apparoximate copy of printf(3).

I am not sure whether %b comes from there or not, but it was added as a way
to allow printf(1) to emulate Sys V echo - and that one uses \0NNN for octal
(probably from when the \ nonsense was added to echo somewhere in the
System III, or perhaps even PWB days ... ie: too long ago to care, and just 
another example of whoever added that being dangerously incompetant.)

kre



Home | Main Index | Thread Index | Old Index