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? >> - 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'? Or should warnf expect a single %s in $1 and use $1 repeatedly on the remaining arguments?