sed substitutions.
* doc/autoconf.texi (Installation Directory Variables): Use s|a|b|
for file names, again. Reported by Noah Misch.
(Coding Style): Explain that s|a|b| is preferred for file names.
* lib/autoconf/status.m4 (_AC_OUTPUT_FILES_PREPARE): Prefer s/a/b/.
(AC_OUTPUT_MAKE_DEFS): Likewise.
* lib/autotest/general.m4 (AT_INIT): Likewise.
* lib/m4sugar/m4sh.m4 (_AS_LINENO_PREPARE): Likewise.
* tests/local.at (AT_CHECK_AUTOM4TE): Likewise.
2006-01-05 Paul Eggert <eggert@cs.ucla.edu>
+ * Makefile.maint (sc_root_tests): Use recommend style s/a/b/ for
+ sed substitutions.
+ * doc/autoconf.texi (Installation Directory Variables): Use s|a|b|
+ for file names, again. Reported by Noah Misch.
+ (Coding Style): Explain that s|a|b| is preferred for file names.
+ * lib/autoconf/status.m4 (_AC_OUTPUT_FILES_PREPARE): Prefer s/a/b/.
+ (AC_OUTPUT_MAKE_DEFS): Likewise.
+ * lib/autotest/general.m4 (AT_INIT): Likewise.
+ * lib/m4sugar/m4sh.m4 (_AS_LINENO_PREPARE): Likewise.
+ * tests/local.at (AT_CHECK_AUTOM4TE): Likewise.
+
Fix Posix-conformance bugs re use of { command in sed scripts,
and improve the sed-related documentation a bit.
* doc/autoconf.texi (Installation Directory Variables): Use
# This Makefile fragment is shared between the coreutils,
# CPPI, Bison, and Autoconf.
-## Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+## Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 Free Software
+## Foundation, Inc.
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
sc_root_tests:
@t1=sc-root.expected; t2=sc-root.actual; \
grep -nl '^PRIV_CHECK_ARG=require-root' \
- $$($(CVS_LIST) tests) |sed s,tests,., |sort > $$t1; \
+ $$($(CVS_LIST) tests) |sed s/tests/./ |sort > $$t1; \
sed -n 's, cd \([^ ]*\) .*MAKE..check TESTS=\(.*\),./\1/\2,p' \
$(srcdir)/tests/Makefile.am |sort > $$t2; \
diff -u $$t1 $$t2 || diff=1; \
@example
@group
edit = sed \
- -e 's,@@datadir[@@],$(pkgdatadir),g' \
- -e 's,@@prefix[@@],$(prefix),g'
+ -e 's|@@datadir[@@]|$(pkgdatadir)|g' \
+ -e 's|@@prefix[@@]|$(prefix)|g'
@end group
@group
When using @command{sed}, don't use @option{-e} except for indenting
purposes. With the @code{s} and @code{y} commands, the preferred
separator is @samp{/} unless @samp{/} itself might appear in the pattern
-or replacement, in which case you should use @samp{,}.
+or replacement, in which case you should use @samp{|}, or optionally
+@samp{,} if you know the pattern and replacement cannot contain a file
+name. If none of these characters will do, choose a printable character
+that cannot appear in the pattern or replacement. Characters from the
+set @samp{"#$&'()*;<=>?`|~} are good choices if the pattern or
+replacement might contain a file name, since they have special meaning
+to the shell and are less likely to occur in file names.
@xref{Macro Definitions}, for details on how to define a macro. If a
macro doesn't use @code{AC_REQUIRE} and it is expected to never be the
[dnl Just to be on the safe side, claim that $ac_delim is the empty string.
m4_define([_AC_SED_FRAG],
m4_defn([_AC_SED_FRAG])dnl
-[s,ac_delim,|#_!!_#|,g
+[s/ac_delim/|#_!!_#|/g
])dnl
m4_define([_AC_SED_CMD_NUM], m4_incr(_AC_SED_CMD_NUM))],
_AC_Var, [@END@],
cat >confdef2opt.sed <<\_ACEOF
t clear
:clear
-s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g
+s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g
t quote
-s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g
+s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g
t quote
d
:quote
-s,[ `~#$^&*(){}\\|;'"<>?],\\&,g
-s,\[,\\&,g
-s,\],\\&,g
-s,\$,$$,g
+s/[ `~#$^&*(){}\\|;'"<>?]/\\&/g
+s/\[/\\&/g
+s/\]/\\&/g
+s/\$/$$/g
p
_ACEOF
# We use echo to avoid assuming a particular line-breaking character.
# This file is part of Autoconf. -*- Autoconf -*-
# M4 macros used in building test suites.
-# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 Free Software
+# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software
# Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
[[0-9]- | [0-9][0-9]- | [0-9][0-9][0-9]- | [0-9][0-9][0-9][0-9]-])
at_range_start=`echo $at_option |tr -d '-'`
at_range=`echo " $at_groups_all " | \
- sed -e 's,^.* \('$at_range_start' \),\1,'`
+ sed -e 's/^.* \('$at_range_start' \)/\1/'`
at_groups="$at_groups$at_range "
;;
[-[0-9] | -[0-9][0-9] | -[0-9][0-9][0-9] | -[0-9][0-9][0-9][0-9]])
at_range_end=`echo $at_option |tr -d '-'`
at_range=`echo " $at_groups_all " | \
- sed -e 's,\( '$at_range_end'\) .*$,\1,'`
+ sed -e 's/\( '$at_range_end'\) .*$/\1/'`
at_groups="$at_groups$at_range "
;;
at_range_start=$at_tmp
fi
at_range=`echo " $at_groups_all " | \
- sed -e 's,^.*\( '$at_range_start' \),\1,' \
- -e 's,\( '$at_range_end'\) .*$,\1,'`
+ sed -e 's/^.*\( '$at_range_start' \)/\1/' \
+ -e 's/\( '$at_range_end'\) .*$/\1/'`
at_groups="$at_groups$at_range "
;;
/[[$]]LINENO/=
' <$as_myself |
sed '
- s,[[$]]LINENO.*,&-,
+ s/[[$]]LINENO.*/&-/
t lineno
b
:lineno
N
:loop
- s,[[$]]LINENO\([[^'$as_cr_alnum'_]].*\n\)\(.*\),\2\1\2,
+ s/[[$]]LINENO\([[^'$as_cr_alnum'_]].*\n\)\(.*\)/\2\1\2/
t loop
- s,-\n.*,,
+ s/-\n.*//
' >$as_me.lineno &&
chmod +x $as_me.lineno ||
AS_ERROR([cannot create $as_me.lineno; rerun with a POSIX shell])
# M4 macros used in building Autoconf test suites. -*- Autotest -*-
-# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 Free Software
+# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software
# Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
m4_define([AT_CHECK_AUTOM4TE],
[AT_CHECK([autom4te $1], [$2], [$3], m4_ifval([$4], [stderr]))
m4_ifval([$4],
-[AT_CHECK([[sed -e 's,^\([^:]*\): *\([0-9][0-9]*\): *[^:]*m4: ,m4: \1: \2: ,' \
- -e 's,^[^:]*m4: *\([^:]*\): *\([0-9][0-9]*\): ,m4: \1: \2: ,' \
+[AT_CHECK([[sed -e 's/^\([^:]*\): *\([0-9][0-9]*\): *[^:]*m4: /m4: \1: \2: /' \
+ -e 's/^[^:]*m4: *\([^:]*\): *\([0-9][0-9]*\): /m4: \1: \2: /' \
-e 's/^autom4te: [^ ]*m4 /autom4te: m4 /' \
-e 's/^autom4te: [^ ]*m4.exe /autom4te: m4 /' \
-e 's/ (E[A-Z]*)$//' \