tech-userlevel archive

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

Re: printf(1), sh(1), POSIX.2 and octal escape sequences



On Wed, Jun 28, 2023 at 05:59:10PM +0200, tlaronde%polynum.com@localhost wrote:
> "\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."
> 
> ? Because I parse it as: an octal escape sequence can be \d, or \dd or
> \ddd; and the result is a byte value.

Exactly. But for the parser the "byte value" is irrelevant, that part is
semantics (and checked later). Syntactically you write an octal number
with upto three digits.

If you want to write a two digit octal number you can not continue with
another ocatal digit. In C you could do "...\77" "7" and have it concat
the literals. In config files (without concatenation) you need some
other trick.

Martin


Home | Main Index | Thread Index | Old Index