Akim Demaille wrote:
> Here is an updated proposal, that was taking into account
> several comments made last week.

Looks fine, modulo a question and test artifacts:
Thanks!

...
> -warn()
> +# warnf_ FORMAT-STRING ARG1...
> +warnf_ ()
>  {
> -  for i
> -  do
> -    echo "$i"
> -  done | sed -e "s/^/$me: /" >&2
> +  warnf_format_=$1
> +  shift
> +  nl='
> +'
> +  case $* in
> +    *$nl*) me_=$(printf "$me"|tr "$nl|" '??')

Is it worth testing for both $nl and '|' ?

> +       printf "$warnf_format_" "$@" | sed "s|^|$me_: |" ;;
> +    *) printf "$me: $warnf_format_" "$@" ;;
> +  esac >&2
> +}
> +
> +warnf_ '<%s>\n' "test1" 't
> +e
> +d
> +2' t3 t54

No test artifacts, please ;-)

> +warnf_ ()
> +{
> +  warnf_format_=$1
> +  shift
> +  printf "$warnf_format_" "$@" | sed "s,^,$me: ," >&2
> +}

Reply via email to