Re: [PATCH v2] log-tree: use custom line terminator in line termination mode
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 1, 2012, 04:27 UTC
- Message-ID
- <7vhaw0cyql.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <86ehr4r4u0.fsf@red.stonehenge.com>
merlyn@stonehenge.com (Randal L. Schwartz) writes:
Show 19 quoted lines
>>>>>> "Junio" == Junio C Hamano <gitster@pobox.com> writes: > > Junio> Having said that, are we sure that > > Junio> printf "add bar\0initial" > > > Junio> works per specification, or merely works by accident in some > Junio> implementation? > > From the POSIX spec > (http://pubs.opengroup.org/onlinepubs/9699919799/utilities/printf.html): > > In addition to the escape sequences shown in XBD File Format Notation ( > '\\' , '\a' , '\b' , '\f' , '\n' , '\r' , '\t' , '\v' ), "\ddd" , where > ddd is a one, two, or three-digit octal number, shall be written as a > byte with the numeric value specified by the octal number. > > Looks pretty intentional to me. \0 is a nul.
I was staring at the same passage, but somehow it didn't "click" for me that the above is _not_ saying that the NUL would terminate the string.
So I was worried too much and needlessly. Thanks.