Commit 29dfca23 authored by Paul Eggert's avatar Paul Eggert

Use ‘echo’ safely with ‘\’ or leading ‘-’

POSIX says that ‘echo FOO’ produces implementation-defined output
if FOO contains leading ‘-’, or ‘\’ anywhere, so don’t assume GNU
behavior in that case.
* Makefile.in (removenullpaths): Remove.
(epaths-force): Rewrite to avoid the need for ‘echo’.
(install-etc): Be clearer about escaping the shell metacharacters
‘\’ and ‘$’.
* Makefile.in (install-arch-indep, install-etcdoc):
* admin/charsets/mapconv, admin/merge-gnulib, admin/merge-pkg-config:
* admin/quick-install-emacs, build-aux/gitlog-to-emacslog:
* configure.ac, lib-src/rcs2log, make-dist:
* src/Makefile.in (lisp.mk):
Don’t assume ‘echo’ outputs ‘\’ and leading ‘-’ unscathed.
For example, use ‘printf '%s\n' "$foo"’ rather than ‘echo "$foo"’
if $foo can contain arbitrary characters.
* lisp/Makefile.in (TAGS): Use ‘ls’, not ‘echo’, to avoid ‘\’ issues.
* doc/lispref/two-volume.make (vol1.pdf):
* test/etags/make-src/Makefile (web ftp publish):
Use ‘printf’ rather than ‘echo -e’.
parent ec0d4d24
......@@ -314,8 +314,6 @@ etc-emacsver:
${srcdir}/build-aux/move-if-change emacsver.tex.$$$$ \
${srcdir}/etc/refcards/emacsver.tex
removenullpaths=sed -e 's/^:*//' -e 's/:*$$//g' -e 's/::*/:/g'
# Generate epaths.h from epaths.in. This target is invoked by 'configure'.
# See comments in configure.ac for why it is done this way, as opposed
# to just letting configure generate epaths.h from epaths.in in a
......@@ -324,20 +322,18 @@ epaths-force:
@for dir in '$(abs_srcdir)' '$(lispdir)' '$(archlibdir)'; do \
case $$dir in \
*:*) \
echo >&2 "Build or installation directory '$$dir'"; \
printf >&2 "Build or installation directory '%s'\\n" "$$dir"; \
echo >&2 "cannot contain ':'."; \
exit 1;; \
esac; \
done
@(standardlisppath=`echo "${standardlisppath}" | ${removenullpaths}` ; \
locallisppath=`echo "${locallisppath}" | ${removenullpaths}` ; \
buildlisppath=`echo "${buildlisppath}" | ${removenullpaths}` ; \
x_default_search_path=`echo ${x_default_search_path}`; \
gamedir=`echo ${gamedir}`; \
@(gamedir='${gamedir}'; \
sed < ${srcdir}/src/epaths.in > epaths.h.$$$$ \
-e 's;\(#.*PATH_LOADSEARCH\).*$$;\1 "'"$${standardlisppath}"'";' \
-e 's;\(#.*PATH_SITELOADSEARCH\).*$$;\1 "'"$${locallisppath}"'";' \
-e 's;\(#.*PATH_DUMPLOADSEARCH\).*$$;\1 "'"$${buildlisppath}"'";' \
-e 's;\(#.*PATH_LOADSEARCH\).*$$;\1 "${standardlisppath}";' \
-e 's;\(#.*PATH_SITELOADSEARCH\).*$$;\1 "${locallisppath}";' \
-e 's;\(#.*PATH_DUMPLOADSEARCH\).*$$;\1 "${buildlisppath}";' \
-e '/^#define PATH_[^ ]*SEARCH /s/\([":]\):*/\1/g' \
-e '/^#define PATH_[^ ]*SEARCH /s/:"/"/' \
-e 's;\(#.*PATH_EXEC\).*$$;\1 "${archlibdir}";' \
-e 's;\(#.*PATH_INFO\).*$$;\1 "${infodir}";' \
-e 's;\(#.*PATH_DATA\).*$$;\1 "${etcdir}";' \
......@@ -577,7 +573,7 @@ install-arch-indep: lisp install-info install-man ${INSTALL_ARCH_INDEP_EXTRA}
fi; \
rm -rf "$${dest}" ; \
umask 022; ${MKDIR_P} "$${dest}" ; \
echo "Copying $${dir} to $${dest}..." ; \
printf 'Copying %s to %s...\n' "$$dir" "$$dest" ; \
(cd $${dir}; tar -chf - . ) \
| (cd "$${dest}"; umask 022; \
tar -xvf - && cat > /dev/null) || exit 1; \
......@@ -632,7 +628,8 @@ install-etcdoc: src install-arch-indep
if [ "`cd ./etc; /bin/pwd`" != "$$exp_etcdocdir" ]; \
then \
docfile="DOC"; \
echo "Copying etc/$${docfile} to $(DESTDIR)${etcdocdir} ..." ; \
printf 'Copying %s to %s ...\n' "etc/$$docfile" \
"$(DESTDIR)${etcdocdir}"; \
${INSTALL_DATA} etc/$${docfile} "$(DESTDIR)${etcdocdir}/$${docfile}"; \
$(set_installuser); \
chown $${installuser} "$(DESTDIR)${etcdocdir}/$${docfile}" || true ; \
......@@ -721,7 +718,7 @@ install-etc:
for icon in $${dir}/${EMACS_ICON}[.-]*; do \
[ -r $${icon} ] || continue ; \
ext=`echo "$${icon}" | sed -e 's|.*\.||'`; \
dest=`echo "$${icon}" | sed -e 's|.*/||' -e "s|\.$${ext}$$||" -e 's/$(EMACS_ICON)/emacs/' -e '$(TRANSFORM)'`.$${ext} ; \
dest=`echo "$${icon}" | sed -e 's|.*/||' -e "s|\\.$${ext}\$$||" -e 's/$(EMACS_ICON)/emacs/' -e '$(TRANSFORM)'`.$${ext} ; \
( cd "$${thisdir}"; \
${INSTALL_DATA} ${iconsrcdir}/$${icon} "$(DESTDIR)${icondir}/$${dir}/$${dest}" ) \
|| exit 1; \
......
......@@ -64,7 +64,7 @@ case "$3" in
KANJI-DATABASE)
SOURCE="http://kanji-database.cvs.sourceforge.net/viewvc/*checkout*/kanji-database/kanji-database/data/cns2ucsdkw.txt?revision=1.4";;
*)
echo "Unknown file type: $3";
printf 'Unknown file type: %s\n' "$3"
exit 1;;
esac
......@@ -147,7 +147,6 @@ elif [ "$3" = "KANJI-DATABASE" ] ; then
| sed -e 's/...\(....\) U+\([0-9A-F]*\).*/0x\1 0x\2/' \
| sort | ${AWKPROG}
else
echo "Invalid arguments: $3"
printf 'Invalid arguments: %s\n' "$3"
exit 1
fi
......@@ -71,7 +71,7 @@ case $gnulib_srcdir in
esac
case $src in
-*)
echo >&2 "$0: usage: $0 [GNULIB_SRCDIR [SRCDIR]]
printf '%s\n' >&2 "$0: usage: $0 [GNULIB_SRCDIR [SRCDIR]]
SRCDIR is the Emacs source directory (default: working directory).
GNULIB_SRCDIR is the Gnulib source directory (default: SRCDIR/../gnulib)."
......@@ -79,7 +79,7 @@ case $src in
esac
test -x "$src"autogen.sh || {
echo >&2 "$0: '${src:-.}' is not an Emacs source directory."
printf '%s\n' >&2 "$0: '${src:-.}' is not an Emacs source directory."
exit 1
}
......@@ -88,7 +88,7 @@ git clone -- "$GNULIB_URL" "$gnulib_srcdir" ||
exit
test -x "$gnulib_srcdir"/gnulib-tool || {
echo >&2 "$0: '$gnulib_srcdir' is not a Gnulib source directory."
printf '%s\n' >&2 "$0: '$gnulib_srcdir' is not a Gnulib source directory."
exit 1
}
......
......@@ -49,15 +49,15 @@
test -n "$dir"
} || {
echo >&2 "$0: cannot find pkg.m4"
printf >&2 '%s\n' "$0: cannot find pkg.m4"
exit 1
}
test -d m4 || {
echo >&2 "$0: please run this command in the main source directory"
printf >&2 '%s\n' "$0: please run this command in the main source directory"
exit 1
}
echo >&2 "$0: copying $dir/pkg.m4 to m4/pkg.m4"
printf >&2 '%s\n' "$0: copying $dir/pkg.m4 to m4/pkg.m4"
cp $dir/pkg.m4 m4
......@@ -121,11 +121,11 @@ EOF
-[!-]?*)
# split concatenated single-letter options apart
FIRST="$1"; shift
set -- `echo $FIRST | sed 's/-\(.\)\(.*\)/-\1 -\2/'` "$@"
set -- `printf '%s\n' "$FIRST" | sed 's/-\(.\)\(.*\)/-\1 -\2/'` "$@"
;;
-*)
echo 1>&2 "$me: unrecognized option '$1'"
echo 1>&2 "$TRY"
printf '%s\n' >&2 "$me: unrecognized option '$1'"
printf '%s\n' >&2 "$TRY"
exit 1
;;
*)
......@@ -140,17 +140,18 @@ case $# in
1) BUILD="$1";;
2) BUILD="$1"; prefix="$2";;
*)
echo 1>&2 "$USAGE"
echo 1>&2 "$TRY"
printf '%s\n' >&2 "$USAGE"
printf '%s\n' >&2 "$TRY"
exit 1
;;
esac
if test ! -d "$BUILD"; then
echo 1>&2 "$me: $BUILD: Build tree not found"
printf '%s\n' >&2 "$me: $BUILD: Build tree not found"
exit 2
elif test ! -r "$BUILD/config.status"; then
echo 1>&2 "$me: $BUILD: Not a proper build tree, config.status not found"
printf '%s\n' >&2 \
"$me: $BUILD: Not a proper build tree, config.status not found"
exit 2
fi
......@@ -160,7 +161,8 @@ get_config_var ()
{ sed -n "s/^S[[]\"$1\"[]]=\"\([^\"]*\)\"/\1/p" $CONFIG_STATUS | sed q | grep ''; } ||
{ sed -n "s/^s\(.\)@$1@\1\(|#_!!_#|\)*\(.*\)\1.*$/\3/p" $CONFIG_STATUS | sed q | grep ''; } ||
{
echo 1>&2 "$me: $1: Configuration variable not found in $CONFIG_STATUS"
printf '%s\n' >&2 \
"$me: $1: Configuration variable not found in $CONFIG_STATUS"
exit 4
}
}
......@@ -172,7 +174,7 @@ test x"$ARCH" = x && { ARCH="`get_config_var host`" || exit 4 ; }
VERSION=`
sed -n 's/^AC_INIT(emacs,[ ]*\([^ )]*\).*/\1/p' <$SRC/configure.ac
` || exit 4
test -n "$VERSION" || { echo >&2 "$me: no version in configure.ac"; exit 4; }
test -n "$VERSION" || { printf '%s\n' >&2 "$me: no version in configure.ac"; exit 4; }
DST_SHARE="$prefix/share/emacs/$VERSION"
DST_BIN="$prefix/bin"
......@@ -209,7 +211,7 @@ maybe_mkdir "$DST_INFO"
PRUNED=""
if test x"$PRUNE" != xno; then
for D in `ls -1t $BUILD/src/emacs-$VERSION.* | sed 1d`; do
echo $REMOVE_CMD $D
printf '%s\n' "$REMOVE_CMD $D"
PRUNED="$PRUNED $D"
done
fi
......@@ -219,7 +221,7 @@ test x"$PRUNE" = xonly && exit 0
maybe_emit_copy ()
{
if test "$FORCE" = yes || ! cmp -s $1 $2; then
echo $LINK_CMD $1 $2
printf '%s\n' "$LINK_CMD $1 $2"
fi
}
......@@ -240,7 +242,7 @@ for SUBDIR in lisp leim etc lib-src info; do
# defaults
SHARED=no
FORCED=''
AVOID_PAT="`echo "($AVOID)" | tr ' ' '|'`"
AVOID_PAT="`printf '%s\n' "($AVOID)" | tr ' ' '|'`"
# Set subdir-specific values
case $SUBDIR in
......@@ -255,7 +257,7 @@ for SUBDIR in lisp leim etc lib-src info; do
;;
lib-src)
DST="$DST_LIBEXEC"
AVOID_PAT="`echo "($AVOID ($PUBLIC_LIBSRC_BINARIES)\$)" | tr ' ' '|'`"
AVOID_PAT="`printf '%s\n' "($AVOID ($PUBLIC_LIBSRC_BINARIES)\$)" | tr ' ' '|'`"
;;
info)
DST="$DST_INFO"
......@@ -267,10 +269,10 @@ for SUBDIR in lisp leim etc lib-src info; do
if [ -d $PFX/$SUBDIR ]; then
for DIR in `(cd $PFX/$SUBDIR; find . -type d -print | sed 's@^./@@')`; do
if [ -d $DST/$DIR ]; then
echo Directory $DST/$DIR exists
printf '%s\n' "Directory $DST/$DIR exists"
else
echo Directory $DST/$DIR non-existent
if [ "`echo $DIR | egrep -v "$AVOID_PAT"`" ]; then
printf '%s\n' "Directory $DST/$DIR non-existent"
if [ "`printf '%s\n' "$DIR" | grep -Ev "$AVOID_PAT"`" ]; then
maybe_mkdir $DST/$DIR
fi
fi
......
......@@ -35,14 +35,14 @@ while [ $# -gt 0 ]; do
-f|--force) force=1 ;;
-n|--nmax) nmax="$2"; shift ;;
-o|--output) output="$2" ; shift ;;
*) echo "Unrecognized argument: $1" >&2; exit 1 ;;
*) printf '%s\n' "Unrecognized argument: $1" >&2; exit 1 ;;
esac
shift
done
if [ ! -f ChangeLog.$nmax ]; then
echo "Can't find ChangeLog.$nmax" >&2
echo "Must be run from the top source directory" >&2
printf '%s\n' "Can't find ChangeLog.$nmax" >&2
printf '%s\n' "Must be run from the top source directory" >&2
exit 1
fi
......@@ -52,7 +52,7 @@ fi
gen_origin_line=`
grep -E '^commit [0-9a-f]+ [(]inclusive[)]' ChangeLog.$nmax
` || {
echo "ChangeLog.$nmax lacks a 'commit ... (inclusive)' line" >&2
printf '%s\n' "ChangeLog.$nmax lacks a 'commit ... (inclusive)' line" >&2
exit 1
}
set $gen_origin_line
......@@ -63,7 +63,7 @@ fi
new_origin=`git log --pretty=format:%H 'HEAD^!'` || exit
if [ -f "$output" ]; then
[ ! "$force" ] && echo "$output exists" >&2 && exit 1
[ ! "$force" ] && printf '%s\n' "$output exists" >&2 && exit 1
rm -f "$output" || exit 1
fi
......
This diff is collapsed.
......@@ -26,9 +26,9 @@ tex2 = sed '/^@setfilename/a\
# elisp.texi specially defines \tocreadfilename when VOL1 or VOL2 is
# set, so we can use our premade .toc's.
#
#
vol1.pdf: elisp1med-fns-ready elisp1med-aux-ready elisp1med-toc-ready
@echo -e "\f Final TeX run for volume 1..."
@printf '\f Final TeX run for volume 1...\n'
cp elisp1med-toc-ready elisp1-toc-ready.toc
cp elisp1med-fns-ready vol1.fns
cp elisp1med-aux-ready vol1.aux
......@@ -42,27 +42,27 @@ vol2.pdf: elisp2med-fns-ready elisp2med-aux-ready elisp2med-toc-ready
$(tex2)
# intermediate toc files.
#
#
# vol1 toc: volume 1, page break, volume 2 (with II: prepended).
elisp1med-toc-ready: elisp1med-init elisp2med-init
echo '@unnchapentry{@b{Volume 1}}{10001}{vol1}{}' >$@
cat elisp1med-toc >>$@
echo '@page' >>$@
echo '@unnchapentry{@b{Volume 2}}{10001}{vol2}{}' >>$@
sed 's/{\([^}]*\)}$$/{II:\1}/' elisp2med-toc >>$@
sed 's/{\([^}]*\)}$$/{II:\1}/' elisp2med-toc >>$@
#
# vol2 toc: volume 1 (with I: prepended), page break, volume 2.
elisp2med-toc-ready: elisp1med-init elisp2med-init
echo '@unnchapentry{@b{Volume 1}}{10001}{vol1}{}' >$@
sed 's/{\([^}]*\)}$$/{I:\1}/' elisp1med-toc >>$@
sed 's/{\([^}]*\)}$$/{I:\1}/' elisp1med-toc >>$@
echo '@page' >>$@
echo '@unnchapentry{@b{Volume 2}}{10001}{vol2}{}' >>$@
cat elisp2med-toc >>$@
# intermediate aux files.
#
# append vol2's fixed aux to normal vol1.
#
# append vol2's fixed aux to normal vol1.
elisp1med-aux-ready: elisp2med-aux-vol-added
cat elisp1med-aux $< >$@
#
......@@ -78,7 +78,7 @@ elisp2med-aux-vol-added: elisp2med-init
sed 's/-pg}{\(.*\)}$$/-pg}{\1, vol.@tie2}/' elisp2med-aux >$@
# intermediate index (fns) file.
#
#
elisp1med-fns-ready: elisp1med-fn-vol-added elisp2med-fn-vol-added
cat elisp2med-fn-vol-added >>vol1.fn
texindex vol1.fn
......@@ -103,17 +103,17 @@ elisp2med-fn-vol-added: elisp2med-init
# -----------------------------------------------------------------------------
# intermediate TeX runs.
#
#
# this generates what would be the final versions -- except the page
# numbers aren't right. The process of adding the I: and II: changes
# the page breaks, so a few index entries, at least are wrong. (In
# 2007, x-meta-keysym in vol.II ended up on page 374 when the index had
# it on page 375 from the initial run.)
#
#
# So, we start all over again, from these fns/aux/toc files.
#
#
elisp1med-init: elisp1-fns-ready elisp1-aux-ready elisp1init-toc-ready $(texinfodir)/texinfo.tex
@echo -e "\f Intermediate TeX run for volume 1..."
@printf '\f Intermediate TeX run for volume 1...\n'
cp elisp1init-toc-ready elisp1-toc-ready.toc
cp elisp1-fns-ready vol1.fns
cp elisp1-aux-ready vol1.aux
......@@ -134,26 +134,26 @@ elisp2med-init: elisp2-fns-ready elisp2-aux-ready elisp2init-toc-ready $(texinfo
# initial toc files.
#
#
# vol1 toc: volume 1, page break, volume 2 (with II: prepended).
elisp1init-toc-ready: elisp1-init elisp2-init
echo '@unnchapentry{@b{Volume 1}}{10001}{vol1}{}' >$@
cat elisp1-toc >>$@
echo '@page' >>$@
echo '@unnchapentry{@b{Volume 2}}{10001}{vol2}{}' >>$@
sed 's/{\([^}]*\)}$$/{II:\1}/' elisp2-toc >>$@
sed 's/{\([^}]*\)}$$/{II:\1}/' elisp2-toc >>$@
#
# vol2 toc: volume 1 (with I: prepended), page break, volume 2.
elisp2init-toc-ready: elisp1-init elisp2-init
echo '@unnchapentry{@b{Volume 1}}{10001}{vol1}{}' >$@
sed 's/{\([^}]*\)}$$/{I:\1}/' elisp1-toc >>$@
sed 's/{\([^}]*\)}$$/{I:\1}/' elisp1-toc >>$@
echo '@page' >>$@
echo '@unnchapentry{@b{Volume 2}}{10001}{vol2}{}' >>$@
cat elisp2-toc >>$@
# initial aux files.
#
#
# append vol2's fixed aux to normal vol1. The initial runs saved
# elisp1-aux and elisp2-aux.
elisp1-aux-ready: elisp2-aux-vol-added
......@@ -171,7 +171,7 @@ elisp2-aux-vol-added: elisp2-init
sed 's/-pg}{\(.*\)}$$/-pg}{\1, vol.@tie2}/' elisp2-aux >$@
# initial index (fns) file.
#
#
# Append other volume's index entries to this one's.
# Index entries in this volume will then take precedence.
elisp1-fns-ready: elisp1-fn-vol-added elisp2-fn-vol-added
......@@ -195,14 +195,14 @@ elisp2-fn-vol-added: elisp2-init
# initial TeX runs.
#
#
# We use the .fn, .aux, and .toc files created here in subsequent
# processing. The page numbers generated here will not be correct yet,
# but we run texindex and TeX a second time just to get them closer.
# Otherwise it might take even longer for them to converge.
#
#
elisp1-init: elisp.texi
@echo -e "\f Initial TeX run for volume 1..."
@printf '\f Initial TeX run for volume 1...\n'
rm -f vol1.aux vol1.toc
$(tex1)
texindex vol1.??
......@@ -220,17 +220,16 @@ elisp2-init: elisp.texi
touch $@
# COPYING CONDITIONS
#
#
# This file is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
#
# This file is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
#
# You should have received a copy of the GNU General Public License
# along with this file. If not, see <http://www.gnu.org/licenses/>.
......@@ -130,7 +130,8 @@ do
case $1 in
-n) case ${2?}${3?}${4?} in
*"$tab"* | *"$nl"*)
echo >&2 "$0: -n '$2' '$3' '$4': tabs, newlines not allowed"
printf '%s\n' >&2 \
"$0: -n '$2' '$3' '$4': tabs, newlines not allowed"
exit 1;;
esac
login=$2
......@@ -140,7 +141,7 @@ do
# If $2 is not tab-separated, use colon for separator.
case ${2?} in
*"$nl"*)
echo >&2 "$0: -u '$2': newlines not allowed"
printf '%s\n' >&2 "$0: -u '$2': newlines not allowed"
exit 1;;
*"$tab"*)
t=$tab;;
......@@ -149,7 +150,7 @@ do
esac
case $2 in
*"$t"*"$t"*"$t"*)
echo >&2 "$0: -u '$2': too many fields"
printf '%s\n' >&2 "$0: -u '$2': too many fields"
exit 1;;
*"$t"*"$t"*)
uf="[^$t]*$t" # An unselected field, followed by a separator.
......@@ -161,7 +162,7 @@ do
expr "X$2" : "$uf$uf$sf"
`;;
*)
echo >&2 "$0: -u '$2': not enough fields"
printf '%s\n' >&2 "$0: -u '$2': not enough fields"
exit 1;;
esac
shift;;
......@@ -186,9 +187,9 @@ do
--version)
set $Id
rcs2logVersion=$3
echo >&2 "rcs2log (GNU Emacs) $rcs2logVersion$nl$Copyright"
printf '%s\n' >&2 "rcs2log (GNU Emacs) $rcs2logVersion$nl$Copyright"
exit 0;;
-*) echo >&2 "Usage: $0 [OPTION]... [FILE ...]$nl$Help"
-*) printf '%s\n' >&2 "Usage: $0 [OPTION]... [FILE ...]$nl$Help"
case $1 in
--help) exit 0;;
*) exit 1;;
......@@ -303,7 +304,8 @@ case $rlogfile in
esac
if test ! -d "$repository"
then
echo >&2 "$0: $repository: bad repository (see CVS/Repository)"
printf '%s\n' >&2 \
"$0: $repository: bad repository (see CVS/Repository)"
exit 1
fi
pository=$repository;;
......@@ -330,7 +332,7 @@ case $rlogfile in
T?*)
rlog_options=-r`expr "$CVSTAG" : 'T\(.*\)'`;;
*)
echo >&2 "$0: invalid CVS/Tag"; exit 1;;
printf '%s\n' >&2 "$0: invalid CVS/Tag"; exit 1;;
esac
fi;;
esac
......@@ -595,7 +597,7 @@ case $hostname in
hostname=`(
hostname || uname -n || uuname -l || cat /etc/whoami
) 2>/dev/null` || {
echo >&2 "$0: cannot deduce hostname"
printf '%s\n' >&2 "$0: cannot deduce hostname"
exit 1
}
......
......@@ -221,7 +221,7 @@ lisptagsfiles2 = $(srcdir)/*/*.el
lisptagsfiles3 = $(srcdir)/*/*/*.el
lisptagsfiles4 = $(srcdir)/*/*/*/*.el
## The echo | sed | xargs is to stop the command line getting too long
## The ls | sed | xargs is to stop the command line getting too long
## on MS Windows, when the MSYS Bash passes it to a MinGW compiled
## etags. It might be better to use find in a similar way to
## compile-main. But maybe this is not even necessary any more now
......@@ -229,10 +229,9 @@ lisptagsfiles4 = $(srcdir)/*/*/*/*.el
TAGS: $(lisptagsfiles1) $(lisptagsfiles2) $(lisptagsfiles3) $(lisptagsfiles4)
rm -f $@
touch $@
echo $(lisptagsfiles1) $(lisptagsfiles2) $(lisptagsfiles3) $(lisptagsfiles4) | \
sed -e 's,$(srcdir)/[^ ]*loaddefs[^ ]*,,g' \
-e 's,$(srcdir)/ldefs-boot[^ ]*,,' \
-e 's,$(srcdir)/[^ ]*esh-groups.el[^ ]*,,' | \
ls $(lisptagsfiles1) $(lisptagsfiles2) \
$(lisptagsfiles3) $(lisptagsfiles4) | \
sed -e '/loaddefs/d; /\/ldefs-boot/d; /esh-groups\.el/d' | \
xargs $(XARGS_LIMIT) "$(ETAGS)" -a -o $@
......
......@@ -245,86 +245,48 @@
;; ----------------------------------------
;;
;; Notice: for directory/host/user tracking you need to have something
;; like this in your shell startup script ( this is for tcsh but should
;; be quite easy to port to other shells )
;; like this in your shell startup script (this is for a POSIXish shell
;; like Bash but should be quite easy to port to other shells)
;;
;; ----------------------------------------
;;
;;
;; set os = `uname`
;; set host = `hostname`
;; set date = `date`
;; # Set HOSTNAME if not already set.
;; : ${HOSTNAME=$(uname -n)}
;;
;; # su does not change this but I'd like it to
;;
;; set user = `whoami`
;; USER=$(whoami)
;;
;; # ...
;;
;; if ( eterm =~ $TERM ) then
;;
;; echo --------------------------------------------------------------
;; echo Hello $user
;; echo Today is $date
;; echo We are on $host running $os under Emacs term mode
;; echo --------------------------------------------------------------
;;
;; setenv EDITOR emacsclient
;;
;; # Notice: $host and $user have been set before to 'hostname' and 'whoami'
;; # this is necessary because, f.e., certain versions of 'su' do not change
;; # $user, YMMV: if you don't want to fiddle with them define a couple
;; # of new variables and use these instead.
;; # NOTICE that there is a space between "AnSiT?" and $whatever NOTICE
;;
;; # These are because we want the real cwd in the messages, not the login
;; # time one !
;;
;; set cwd_hack='$cwd'
;; set host_hack='$host'
;; set user_hack='$user'
;; case $TERM in
;; eterm*)
;;
;; # Notice that the ^[ character is an ESC, not two chars. You can
;; # get it in various ways, for example by typing
;; # echo -e '\033' > escape.file
;; # or by using your favorite editor
;; printf '%s\n' \
;; -------------------------------------------------------------- \
;; "Hello $user" \
;; "Today is $(date)" \
;; "We are on $HOSTNAME running $(uname) under Emacs term mode" \
;; --------------------------------------------------------------
;;
;; foreach temp (cd pushd)
;; alias $temp "$temp \!* ; echo 'AnSiTc' $cwd_hack"
;; end
;; alias popd 'popd ;echo "AnSiTc" $cwd'
;; export EDITOR=emacsclient
;;
;; # Every command that can modify the user/host/directory should be aliased
;; # as follows for the tracking mechanism to work.
;; # The \033 stands for ESC.
;; # There is a space between "AnSiT?" and $whatever.
;;
;; foreach temp ( rlogin telnet rsh sh ksh csh tcsh zsh bash tcl su )
;; alias $temp "$temp \!* ; echo 'AnSiTh' $host_hack ; \
;; echo 'AnSiTu' $user_hack ;echo 'AnSiTc' $cwd_hack"
;; end
;; cd() { command cd "$@"; printf '\033AnSiTc %s\n' "$PWD"; }
;; pushd() { command pushd "$@"; printf '\033AnSiTc %s\n' "$PWD"; }
;; popd() { command popd "$@"; printf '\033AnSiTc %s\n' "$PWD"; }
;;
;; # Start up & use color ls
;; printf '\033AnSiTc %s\n' "$PWD"
;; printf '\033AnSiTh %s\n' "$HOSTNAME"
;; printf '\033AnSiTu %s\n' "$USER"
;;
;; echo "AnSiTh" $host
;; echo "AnSiTu" $user
;; echo "AnSiTc" $cwd
;;
;; # some housekeeping
;;
;; unset cwd_hack
;; unset host_hack
;; unset user_hack
;; unset temp
;;
;; eval `/bin/dircolors /home/marco/.emacs_dircolors`
;; endif
;; eval $(dircolors $HOME/.emacs_dircolors)
;; esac
;;
;; # ...
;;
;; # Let's not clutter user space
;;
;; unset os
;; unset date
;;
;;
;;; Original Commentary:
......
......@@ -110,7 +110,7 @@ while [ $# -gt 0 ]; do
;;
"--help")
echo "Usage: ${progname} [options]"
printf '%s\n' "Usage: ${progname} [options]"
echo ""
echo " --bzip2 use bzip2 instead of gzip"
echo " --clean-up delete staging directories when done"
......@@ -128,7 +128,7 @@ while [ $# -gt 0 ]; do
;;
* )
echo "${progname}: Unrecognized argument: $1" >&2
printf '%s\n' "${progname}: Unrecognized argument: $1" >&2
exit 1
;;
esac
......@@ -137,9 +137,9 @@ done
### Make sure we're running in the right place.
if [ ! -d src -o ! -f src/lisp.h -o ! -d lisp -o ! -f lisp/subr.el ]; then
echo "${progname}: Can't find 'src/lisp.h' and 'lisp/subr.el'." >&2
echo "${progname} must be run in the top directory of the Emacs" >&2
echo "distribution tree. cd to that directory and try again." >&2
printf '%s\n' "${progname}: Can't find 'src/lisp.h' and 'lisp/subr.el'." >&2
printf '%s\n' "${progname} must be run in the top directory of the Emacs" >&2
printf '%s\n' "distribution tree. cd to that directory and try again." >&2
exit 1
fi
......@@ -155,7 +155,7 @@ then
/*) ;;
*)
if [ ! -f "$EMACS" ]; then
echo "$0: You must set the EMACS environment variable " \
printf '%s\n' "$0: You must set the EMACS environment variable " \
"to an absolute file name." 2>&1
exit 1
fi;;
......@@ -168,7 +168,8 @@ version=`
sed -n 's/^AC_INIT(GNU Emacs,[ ]*\([^ ,)]*\).*/\1/p' <configure.ac
` || version=
if [ ! "${version}" ]; then
echo "${progname}: can't find current Emacs version in './src/emacs.c'" >&2
printf '%s\n' \
"${progname}: can't find current Emacs version in './src/emacs.c'" >&2
exit 1
fi
......@@ -195,7 +196,7 @@ fi
### Make sure the subdirectory is available.
tempparent="make-dist.tmp.$$"
if [ -d ${tempparent} ]; then
echo "${progname}: staging directory '${tempparent}' already exists.
printf '%s\n' "${progname}: staging directory '${tempparent}' already exists.
Perhaps a previous invocation of '${progname}' failed to clean up after
itself. Check that directories whose names are of the form
'make-dist.tmp.NNNNN' don't contain any important information, remove
......@@ -530,7 +531,7 @@ for subdir in . etc leim lib lib-src lisp lwlib msdos nt src; do
done
if [ "${newer}" ]; then
echo "Removing files older than $newer"
printf '%s\n' "Removing files older than $newer"
## We remove .elc files unconditionally, on the theory that anyone picking
## up an incremental distribution already has a running Emacs to byte-compile
## them with.
......@@ -544,8 +545,9 @@ find ${tempparent} \( -name '*~' -o -name '#*#' -o -name '.*ignore' -o -name '=*
if [ "${make_tar}" = yes ]; then
echo "Looking for $default_gzip"
found=0
temppath=`echo $PATH | sed -e 's/^:/.:/' -e 's/::/:.:/g' -e 's/:$/:./' \
<