[Top][All Lists]

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

Re: multiline output variables.

From: Noah Misch
Subject: Re: multiline output variables.
Date: Fri, 14 Jan 2005 02:56:16 -0800
User-agent: Mutt/1.5.6i

Hi Dan,

Thanks for tackling this.

On Thu, Jan 13, 2005 at 05:49:36PM -0500, Dan Manthey wrote:
> My first thought was to simply also quote newlines.  This proved
> inpracticable due to the inability to guanantee that a substituted value
> of an output variable wouldn't confuse this quoting.  Therefore, I changed

s/[^t]$/&\\/ does not do the job?

> assumed that the 100-command limit for sed was indeed 100-command and not
> 100-line.  This latter change could be made regardless of multi-line
> substitutions.

A 100-command limit is consistent with the comment in the old code.

> Does anyone know of any portabilities issues with what I have done?  Does

It looks portable.

> Find below a patch of _AC_OUTPUT_FILES.

Does the test suite pass?  If not, you might want to patch in the additional
tests I posted to autoconf-patches today before your test run.

> --- status.m4.old     2005-01-13 15:03:43.702862400 -0500
> +++ status.m4 2005-01-13 16:53:33.338292800 -0500
> @@ -852,6 +852,20 @@
>  m4_define([AC_LIST_FILES_COMMANDS])
> +m4_define([_AC_CONFIG_STATUS_SED_CMD],
> +[m4_if($#,0,

Please add a comment like precedes every other macro definition.

The line breaks in this macro are a bit wild.  Consider reformatting.

As best I can tell, this macro has two independent behaviors based on whether or
not is it called with arguments (at the beginning and end of _AC_OUTPUT_FILES,
respectively).  If so, please split this into two macros or just move the $# ==
0 bits to the one place you need them.

> -[s,@AC_Var@,$AC_Var,;t t
> +[[s,@]AC_Var[@,`echo "$]AC_Var[]dnl
> +[" | sed 's/[\\\\&,]/\\\\&/g; $!s/$/\\\\/'`,;t t]])

You do not need to prevent expansion of names like `s' and `echo'.  This
formatting is fine:

[s,@AC_Var@,`echo "$AC_Var" | sed 's/[\\\\&,]/\\\\&/g; $!s/$/\\\\/'`,;t t]

>  ])])dnl
>  m4_ifdef([_AC_SUBST_FILES],
>        [AC_FOREACH([AC_Var], m4_defn([_AC_SUBST_FILES]),
> -[/@AC_Var@/r $AC_Var
> -s,@AC_Var@,,;t t
> +[_AC_CONFIG_STATUS_SED_CMD([[/@]AC_Var[@/r $]AC_Var[;s,@]AC_Var[@,,;t t]])

Likewise; `/@' cannot possibly expand as a macro, and you need not worry about
`t' and `r'.

> -  # Split the substitutions into bite-sized pieces for seds with
> -  # small command number limits, like on Digital OSF/1 and HP-UX.
> -dnl One cannot portably go further than 100 commands because of HP-UX.
> -dnl Here, there are 2 cmd per line, and two cmd are added later.

These comments are worth preserving somewhere.

> -      # The purpose of the label and of the branching condition is to
> -      # speed up the sed processing (if there are no `@' at all, there
> -      # is no need to browse any of the substitutions).
> -      # These are the two extra sed commands mentioned above.

Maybe this too.

reply via email to

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