bug-gnulib
[Top][All Lists]
Advanced

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

Re: [PATCH] bootstrap: use a more consistent error reporting scheme.


From: Stefano Lattarini
Subject: Re: [PATCH] bootstrap: use a more consistent error reporting scheme.
Date: Fri, 06 Jul 2012 14:46:37 +0200

On 07/06/2012 02:37 PM, Akim Demaille wrote:
> Le 6 juil. 2012 à 14:24, Jim Meyering a écrit :
>
>>    warnf '%s\n' "Error: '$app' version == $inst_ver is too old" \
>>                 "       '$app' version >= $req_ver is required"
> 
> Don't you mean warnf '%s\n%s\n'?  Or should warnf expect a single %s
> in $1 and use $1 repeatedly on the remaining arguments?
> 
I think POSIX mandates that printf(1) applies the format string to
the arguments in a sort of loop:

  $ printf '%s\n' a b c d
  a
  b
  c
  d

  $ printf '%s-%s\n' a b c d
  a-b
  c-d

In fact, quoting from
<http://pubs.opengroup.org/onlinepubs/9699919799/utilities/printf.html>:

   The format operand shall be reused as often as necessary to satisfy the
   argument operands.  Any extra c or s conversion specifiers shall be
   evaluated as if a null string argument were supplied; other extra
   conversion specifications shall be evaluated as if a zero argument were
   supplied. If the format operand contains no conversion specifications
   and argument operands are present, the results are unspecified.

Regards,
  Stefano



reply via email to

[Prev in Thread] Current Thread [Next in Thread]