zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: Stephane CHAZELAS <Stephane.CHAZELAS@free.fr>
Cc: zsh-workers@sunsite.dk
Subject: Re: printf and POSIX compliance
Date: Tue, 11 Feb 2003 09:29:51 +0100	[thread overview]
Message-ID: <8050.1044952191@finches.logica.co.uk> (raw)
In-Reply-To: <20030204164425.A192@pcchazelas.free.fr>

On 4 Feb, you wrote:
> Hello all, and thank you for the very good job
> 
> I read at
> http://www.opengroup.org/onlinepubs/007904975/utilities/printf.html
> that, according to POSIX:
> 
> 3- In addition to the escape sequences shown in the Base
>    Definitions volume of IEEE Std 1003.1-2001, Chapter 5, 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.
> 
> So
> 
> printf '\377\0377' | od -c
> 
> should return:
> 0000000 377 037   7
> 0000003

Okay, that's what printf(3) and ksh93's printf do.

> zsh man pages says that sames sequences as for echo are
> recognized. That's not what POSIX requires.

It uses the same code as for echo and $'...' and doing otherwise would
seem a bit unpleasant to me. That said, it seems to be what ksh93 does.
In ksh, $'...' and printf work that way while print does something
different.

Note also that the behaviour of \c should probably be to cancel further
output in printf but it isn't (again because I used the same function
as is used by echo).

It's an easy enough thing to change though. Should I? And what should
it do for print and for posix quotes?

Oliver

This e-mail and any attachment is for authorised use by the intended recipient(s) only.  It may contain proprietary material, confidential information and/or be subject to legal privilege.  It should not be copied, disclosed to, retained or used by, any other party.  If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender.  Thank you.


      parent reply	other threads:[~2003-02-11  8:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-04 15:44 Stephane CHAZELAS
2003-02-04 18:26 ` DervishD
2003-02-05 13:10   ` Stephane CHAZELAS
2003-02-05 13:42     ` Peter Stephenson
2003-02-11 12:09       ` PATCH: unset -v (was Re: printf and POSIX compliance) Oliver Kiddle
2003-02-05 14:41     ` printf and POSIX compliance DervishD
2003-02-11  8:29 ` Oliver Kiddle [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8050.1044952191@finches.logica.co.uk \
    --to=okiddle@yahoo.co.uk \
    --cc=Stephane.CHAZELAS@free.fr \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).