Akim Demaille wrote: > Le 6 juil. 2012 à 14:24, Jim Meyering a écrit : > >> Akim Demaille wrote: >>> Le 6 juil. 2012 à 13:56, Jim Meyering a écrit : >>> >>>> Um... this is a good reason to post an adjusted patch. >>>> What I meant was that it is fine to continue to print that diagnostic >>>> on one line, but not using echo; using the new "warn". >>>> >>>> It should use warn, and warn should be defined as in init.sh. >>> >>> Ah, ok. But the messages were already on several lines before, >>> so you actually prefer to make the diagnostic less formatted? >>> >>> -if test $found_aux_dir = no; then >>> - echo "$0: expected line not found in configure.ac. Add the following:" >>> >&2 >>> - echo " AC_CONFIG_AUX_DIR([$build_aux])" >&2 >>> - exit 1 >>> -fi >>> +test $found_aux_dir = yes \ >>> + || die "expected line not found in configure.ac. Add the following:" \ >>> + " AC_CONFIG_AUX_DIR([$build_aux])" >> >> Actually, using die above is fine. >> However, I would like to keep bootstrap's warn and init.sh's warn_ >> compatible. > > So if I understand correctly die would take lines as arguments > and warn would take words? Or maybe I don't understand what you > mean with "Actually, using die above is fine". Maybe you mean > making this diagnostic output a single line?
Sorry I haven't been clear enough. die here should be like init.sh's die_ and take words, not lines. That particular diagnostic wouldn't look too bad on one line. >>> - echo "$me: Error: '$app' version == $inst_ver is too old" >&2 >>> - echo " '$app' version >= $req_ver is required" >&2 >>> + warn "Error: '$app' version == $inst_ver is too old" \ >>> + " '$app' version >= $req_ver is required" >>> >>> Or do you prefer reintroducing braces and several commands for a single, >>> but multi-line, message? >> >> Converting separate arguments into separate lines seems wrong. >> Inserting newlines is the job of a printf-like function. >> >> Options: >> - use printf 1>&2 ... or >> - use a printf-style variant, say warnf, that would be used like this: >> >> 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'? No, but if you think it's better, somehow... I meant that warnf would be a very thin wrapper around printf: $ printf '%s\n' a b c a b c > Or should warnf expect a single %s or multiple %-directives: $ printf '%s - %s\n' a b c d a - b c - d > in $1 and use $1 repeatedly on the remaining arguments?