From 6f5695f7580aa11b69bf10028a9faa7b25119d3a Mon Sep 17 00:00:00 2001 From: Ralf Wildenhues Date: Tue, 1 Feb 2005 12:31:43 +0000 Subject: [PATCH] * clcommit.m4sh: Test whether the shell understands `read -r'. Use as `$read_r' if available, so `\' is preserved in commit notices. --- ChangeLog | 3 +++ clcommit.m4sh | 16 ++++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3bef82b8e..d2fe5584b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2005-02-01 Ralf Wildenhues + * clcommit.m4sh: Test whether the shell understands `read -r'. Use as + `$read_r' if available, so `\' is preserved in commit notices. + * HACKING (Editing `.m4sh' Files): Document preferred function header layout. * config/ltmain.m4sh (func_win32_libid, func_infer_tag) diff --git a/clcommit.m4sh b/clcommit.m4sh index dfd338813..8e93d7793 100644 --- a/clcommit.m4sh +++ b/clcommit.m4sh @@ -101,6 +101,14 @@ mailnotify_flags= sendmail_to= exit_cmd=: +# try to find out whether read supports -r +if echo bt | tr b '\\' | { read -r line; test "X$line" = 'X\t'; } 2>/dev/null +then + read_r='read -r' +else + read_r=read +fi + # Locations for important files: signature_file= log_dir="`func_mktempdir`" @@ -297,7 +305,7 @@ func_check_conflicts () func_verbose "$progname: checking for conflicts..." if $opt_tla; then if ( $TLA changes | - while read line; do + while $read_r line; do echo "$line" echo "$line" >&3 done | grep '^C' @@ -308,7 +316,7 @@ func_check_conflicts () if test -f CVS/Entries; then if ( $CVS $cvs_flags -q -n update $update_flags ${1+"$@"} | - while read line; do + while $read_r line; do echo "$line" echo "$line" >&3 done | grep '^C' @@ -340,7 +348,7 @@ func_check_commit_msg () if $opt_first; then skipping=: $SED 's,^,+,' < ${ChangeLog-ChangeLog} | - while read line; do + while $read_r line; do case "$line" in "+") if $skipping; then skipping=false; else break; fi;; "+ "*) @@ -358,7 +366,7 @@ func_check_commit_msg () cmd="$CVS $cvs_flags diff -u" fi $cmd ${ChangeLog-ChangeLog} | - while read line; do + while $read_r line; do case $line in "--- "*) :;; "-"*) -- 2.47.2