From: Eric Blake Date: Wed, 15 Oct 2008 17:22:25 +0000 (-0600) Subject: Cleanups to previous patches. X-Git-Tag: v2.63b~249 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6edff90b47fbfe7a3b503b9b453ffd374e3d0369;p=thirdparty%2Fautoconf.git Cleanups to previous patches. * doc/autoconf.texi (Portable Shell): Minor edits. (Limitations of Builtins): Touch up wording. * lib/m4sugar/m4sh.m4 (AS_LINENO_PUSH): Nuke trailing whitespace. (_AS_SHELL_SANITIZE): Wrap comments less than 80 columns. Signed-off-by: Eric Blake --- diff --git a/ChangeLog b/ChangeLog index 9789f57c..d4619b9b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-10-15 Eric Blake + + Cleanups to previous patches. + * doc/autoconf.texi (Portable Shell): Minor edits. + (Limitations of Builtins): Touch up wording. + * lib/m4sugar/m4sh.m4 (AS_LINENO_PUSH): Nuke trailing whitespace. + (_AS_SHELL_SANITIZE): Wrap comments less than 80 columns. + 2008-10-15 Paolo Bonzini Updates to shell portability documentation. diff --git a/doc/autoconf.texi b/doc/autoconf.texi index fe516679..b3ffc766 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -12794,10 +12794,11 @@ while not in Unix version 7, were retrofitted in the original Bourne shell and can be assumed to be part of the least common denominator. On the other hand, if you're using M4sh you can assume that the shell -has the features that were added in SVR2, including shell functions, +has the features that were added in SVR2 (circa 1984), including shell +functions, @command{return}, @command{unset}, and I/O redirection for builtins. For more information, refer to @uref{http://@/www.in-ulm.de/@/~mascheck/@/bourne/}. -However, some pitfalls have to be avoided for portable use of this +However, some pitfalls have to be avoided for portable use of these constructs; these will be documented in the rest of this chapter. See in particular @ref{Shell Functions} and @ref{Limitations of Builtins, , Limitations of Shell Builtins}. @@ -14555,10 +14556,11 @@ EOF @end example New applications which are not aiming at portability should use -@samp{printf} instead of @samp{echo}. M4sh provides the @code{AS_ECHO} -and @code{AS_ECHO_N} macros (corresponding to @samp{echo -n} which use -@samp{printf} if it is available, or otherwise resort to various creative -tricks in order to work around the above problems. +@command{printf} instead of @command{echo}. M4sh provides the +@code{AS_ECHO} and @code{AS_ECHO_N} macros, which choose between +@samp{echo -n} on implementations where that works, @command{printf} if +it is available, or other creative tricks in order to work around the +above problems. @item @command{eval} @@ -14799,7 +14801,7 @@ fi @noindent Or, especially if the @dfn{else} branch is short, you can use @code{||}. In M4sh, the @code{AS_IF} macro provides an easy way to write these kinds -of conditionals as; +of conditionals: @example AS_IF([cmp -s file file.new], [], [mv file.new file]) diff --git a/lib/m4sugar/m4sh.m4 b/lib/m4sugar/m4sh.m4 index 64cc8db2..b42e87fa 100644 --- a/lib/m4sugar/m4sh.m4 +++ b/lib/m4sugar/m4sh.m4 @@ -420,9 +420,10 @@ if test ! -f "$as_myself"; then AS_EXIT fi -# Unset variables that we do not need and cause bugs (e.g. in pre-3.0 UWIN ksh). -# But do not cause bugs in bash 2.01; the "|| exit 1" suppresses any -# "Segmentation fault" message there. '((' could trigger a bug in pdksh 5.2.14. +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset && dnl ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : @@ -698,7 +699,7 @@ m4_define([AS_ERROR], # ------------------------ # If this is the outermost call to AS_LINENO_PUSH, make sure that # AS_MESSAGE will print LINENO as the line number. -m4_defun([AS_LINENO_PUSH], +m4_defun([AS_LINENO_PUSH], [as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack])