summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAkim Demaille <akim@lrde.epita.fr>2012-07-13 14:33:38 +0200
committerStefano Lattarini <stefano.lattarini@gmail.com>2012-07-14 12:10:22 +0200
commit0a25f35b5d0a4d2acb5a72f25cf25ecc0d8e84dd (patch)
tree261a79143e5414af5de4635ce74129ecad3710be /lib
parentbe2bb639757a723d44809678d0c21cd429a321cd (diff)
downloadautomake-0a25f35b5d0a4d2acb5a72f25cf25ecc0d8e84dd.tar.gz
ylwrap: modernize idioms
* lib/ylwrap: Prefer printf to echo when special characters may occur. Replace the historical ',' sed separator with '|'.
Diffstat (limited to 'lib')
-rwxr-xr-xlib/ylwrap10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/ylwrap b/lib/ylwrap
index 8e02e9ae0..f64b2b58a 100755
--- a/lib/ylwrap
+++ b/lib/ylwrap
@@ -32,7 +32,7 @@ scriptversion=2012-07-13.14; # UTC
get_dirname ()
{
case $1 in
- */*|*\\*) printf '%s\n' "$1" | sed -e 's,\([\\/]\)[^\\/]*$,\1,';;
+ */*|*\\*) printf '%s\n' "$1" | sed -e 's|\([\\/]\)[^\\/]*$|\1|';;
# Otherwise, we want the empty string (not ".").
esac
}
@@ -42,7 +42,7 @@ get_dirname ()
# The CPP macro used to guard inclusion of FILE.
guard()
{
- echo "$from" \
+ printf '%s\n' "$from" \
| sed \
-e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\
-e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'
@@ -196,7 +196,7 @@ if test $ret -eq 0; then
# file so we can compare them to existing versions.
if test $first = no; then
realtarget="$target"
- target="tmp-`echo $target | sed s/.*[\\/]//g`"
+ target=tmp-`printf '%s\n' "$target" | sed s/.*[\\/]//g`
fi
# Munge "#line" or "#" directives.
# We don't want the resulting debug information to point at
@@ -207,8 +207,8 @@ if test $ret -eq 0; then
FROM=`guard "$from"`
TARGET=`guard "$to"`
- sed -e "/^#/!b" -e "s,$input_rx,$input_sub_rx," -e "$rename_sed" \
- -e "s,$FROM,$TARGET," "$from" >"$target" || ret=$?
+ sed -e "/^#/!b" -e "s|$input_rx|$input_sub_rx|" -e "$rename_sed" \
+ -e "s|$FROM|$TARGET|" "$from" >"$target" || ret=$?
# Check whether header files must be updated.
if test $first = no; then