Robert Henney wrote:
> from man page:
> 
>       FORMAT controls the output as in C printf.  Interpreted sequences are:
>       [...]
>       \c     produce no further output

This is not a bug in the program.  However it may be a deficiency in
the online documentation.  At least it is an area where the GNU
documentation could be improved.  Documentation patches and
suggestions are always welcome.  Best to send those upstream directly.

The man page is designed as a quick reference to the commands and
options.  As noted in the man page the full documentation is in the
online info pages.  However this feature it not documented very well
in the info pages either.  The online POSIX standards describe this
feature in better detail as belonging only to the %b format specifier.

> but executing
>       printf "one\n\cword\n"
> 
> produces
>       one
>       \cword

The printf program mimics the C printf(3) routine.  This includes
various format specifiers such as %s.

  printf "%s\n" hello

Additionally a %b specifier is provided to mimic the old echo program
behavior.

  printf "%b\n" hello

The POSIX echo program provides \c as a way to not print a newline.
(But the BSD echo uses -n for this.  This is one of the classic
portability problems with using echo across different systems.)

  echo "prompt: \c"

Using printf in the echo compatibility mode.

  printf "%b\n" "prompt: \c"
  
That prints no newline at the end off the string.  Using your example:

  printf "%b\n" "one\n\cword\n"
  one

While it is not documented in the GNU info manual very well the printf
program is behaving as expected.  The \c is only useful when used with
the %b format specifier.

> interestingly, on our freebsd system the man page says the same thing 
> and their binary isn't acknowledging the \c either.  same source?

Not the same source.  But written to the same POSIX specification.

Bob


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to