[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
FYI: 91-gary-IRIX-dollar-zero-corruption-libtoolize.patch
From: |
Gary V. Vaughan |
Subject: |
FYI: 91-gary-IRIX-dollar-zero-corruption-libtoolize.patch |
Date: |
Thu, 12 Feb 2004 13:19:02 +0000 (GMT) |
User-agent: |
mailnotify/0.2 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Applied to HEAD.
- --
Gary V. Vaughan ())_. address@hidden,gnu.org}
Research Scientist ( '/ http://www.oranda.demon.co.uk
GNU Hacker / )= http://www.gnu.org/software/libtool
Technical Author `(_~)_ http://sources.redhat.com/autobook
__________________________________________________________
This patch notification generated by cvsapply version 0.13
http://savannah.gnu.org/projects/cvs-utils
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (Darwin)
iD8DBQFAK31FFRMICSmD1gYRAlQ+AJ9/7hcudpASCmMTfEsyR4gAq7+o2QCdEnph
4qlNRwQLIUO67ii59XXoEy8=
=GB9w
-----END PGP SIGNATURE-----
Index: ChangeLog
from Gary V. Vaughan <address@hidden>
* libtoolize.in: Use $progpath as for ltmain.in to work around the
IRIX bug described below.
* commit, config/mailnotify: Ditto. Resynch with cvs-utils HEAD.
Index: commit
===================================================================
RCS file: /cvsroot/libtool/libtool/commit,v
retrieving revision 1.20
diff -u -p -u -r1.20 commit
--- commit 11 Feb 2004 15:40:40 -0000 1.20
+++ commit 12 Feb 2004 13:18:09 -0000
@@ -1,8 +1,8 @@
#! /bin/sh
-# commit (GNU cvs-utils) version 0.10
-# Originally by Gary V. Vaughan <address@hidden>
-# Pretty much rewritten by Alexandre Oliva <address@hidden>
+# clcommit (GNU cvs-utils) version 0.11
+# Written by Gary V. Vaughan <address@hidden>
+# and Alexandre Oliva <address@hidden>
# Copyright (C) 1999, 2000, 2004 Free Software Foundation, Inc.
# This is free software; see the source for copying conditions. There is NO
@@ -24,7 +24,7 @@
# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
# MA 02111-1307, USA.
-# Usage: commit [-v] [-h] [-f] [-l] [-n] [-q] [-z N] [-C ChangeLog_file]
+# Usage: $progname [-v] [-h] [-f] [-l] [-n] [-q] [-z N] [-C ChangeLog_file]
# [-m msg|-F msg_file|-1] [-s addr [--from addr]] [--] [file|dir ...]
# -C file --changelog=file extract commit message from specified ChangeLog
@@ -66,297 +66,355 @@
# Report bugs to <address@hidden>
-name=commit
-: ${CVS=cvs}
-: ${SHELL=/bin/sh}
-: ${MAILNOTIFY=./config/mailnotify}
-cvsopt=
-updateopt=
-commitopt=
-dry_run=false
-commit=:
-update=:
-log_file="${TMPDIR-/tmp}/commitlog.$$"
-signature_file=
-first=false
-sendmail_to='Libtool Commit <address@hidden>'
+: ${CVS="cvs"}
+: ${SHELL="/bin/sh"}
+: ${MAILNOTIFY="$SHELL ./config/mailnotify"}
+: ${MV="mv -f"}
+: ${RM="rm -f"}
+: ${SED="sed"}
+
+dirname="$SED s,/[^/]*$,,"
+basename="$SED s,^.*/,,g"
+
+# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
+# is ksh but when the shell is invoked as "sh" and the current value of
+# the _XPG environment variable is not equal to 1 (one), the special
+# positional parameter $0, within a function call, is the name of the
+# function.
+progpath="$0"
+
+# The name of this program:
+progname=`echo "$progpath" | $basename`
+PROGRAM=clcommit
+
+# Global variables:
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+
+cvs_flags=
+update_flags=
+commit_flags=
+opt_commit=:
+opt_update=:
+opt_first=false
+
+sendmail_to="Libtool Commit <address@hidden>"
sendmail_from=
+exit_cmd=:
-my_sed_help='/^# Usage:/,/# Report bugs to/ {
- s/^# //; s/^# *$//;
- s/\$progname/'$progname'/;
- p;
- }; d'
-my_sed_version='/^# '$name' (GNU /,/# warranty; / {
- s/^# //; s/^# *$//;
- s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/;
- p;
- }; d'
+# Locations for important files
+signature_file=
+log_file="${TMPDIR-/tmp}/commitlog.$$"
-rm -f "${log_file}*"
-trap 'rm -f "${log_file}*"; exit 1' 1 2 15
+$RM "${log_file}*"
+trap '$RM "${log_file}*"; exit $EXIT_FAILURE' 1 2 15
set -e
-# this just eases exit handling
-main_repeat=":"
-while $main_repeat; do
-
-repeat="test $# -gt 0"
-while $repeat; do
- case "$1" in
- --fast)
- shift
- set fnord --force --first ${1+"$@"}
- shift
- ;;
- -f|--force)
- update=false
- PAGER=cat
- shift
- ;;
- --from)
- if test $# = 1; then
- echo "$name: missing argument for $1" >&2
- break
- fi
- shift
- sendmail_from="$1"
- shift
- ;;
- -l|--local)
- updateopt="$updateopt -l"
- commitopt="$commitopt -l"
- shift
- ;;
- -m|--message|--msg)
- if test $# = 1; then
- echo "$name: missing argument for $1" >&2
- break
- fi
- if $first || test -f "$log_file"; then
- echo "$name: you can have at most one of -m, -F and -1" >&2
- break
- fi
- shift
- echo "$1" > "$log_file"
- shift
- ;;
- -F|--file)
- if $first || test -f "$log_file"; then
- echo "$name: you can have at most one of -m, -F and -1" >&2
- break
- fi
- if test $# = 1; then
- echo "$name: missing argument for $1" >&2
- break
- fi
- shift
- if cat < "$1" > "$log_file"; then :; else
- break
- fi
- shift
- ;;
- -1|--first)
- if test -f "$log_File"; then
- echo "$name: you can have at most one of -m, -F and -1" >&2
- break
- fi
- first=:
- shift
- ;;
- -C|--[cC]hange[lL]og)
- if test $# = 1; then
- echo "$name: missing argument for $1" >&2
- break
- fi
- shift
- if test ! -f "$1"; then
- echo "$name: ChangeLog file \`$1' does not exist" >&2
- break
- fi
- ChangeLog="$1"
- shift
- ;;
- -n|--dry-run)
- commit=false
- update=true
- shift
- ;;
- -q|--quiet)
- cvsopt="$cvsopt -q"
- shift
- ;;
- -s|--sendmail)
- if test $# = 1; then
- echo "$name: missing argument for $1" >&2
- break
- fi
- shift
- sendmail_to="$1"
- shift
- ;;
- --signature)
- if test $# = 1; then
- echo "$name: missing argument for $1" >&2
- break
- fi
- shift
- signature_file="$HOME/.signature"
- case $1 in
- -*) ;;
- *) signature_file="$1"; shift ;;
- esac
- if test -f "$signature_file"; then :
- else
- echo "$name: \`$signature_file': file not found"
- break
- fi
- ;;
- -z|--compress)
- if test $# = 1; then
- echo "$name: missing argument for $1" >&2
- break
- fi
- case "$2" in
- [0-9]) :;;
- *) echo "$name: invalid argument for $1" >&2
- break
- ;;
- esac
- cvsopt="$cvsopt -z$2"
- shift
- shift
- ;;
- -m*|-F*|-C*|-s*|-z*)
- opt=`echo "$1" | sed '1s/^\(..\).*$/\1/;q'`
- arg=`echo "$1" | sed '1s/^-[a-zA-Z0-9]//'`
- shift
- set -- "$opt" "$arg" ${1+"$@"}
- ;;
-
--message=*|--msg=*|--from=*|--file=*|--[Cc]hange[Ll]og=*|--compress=*|--sendmail=*|--signature=*)
- opt=`echo "$1" | sed '1s/^\(--[^=]*\)=.*/\1/;q'`
- arg=`echo "$1" | sed '1s/^--[^=]*=//'`
- shift
- set -- "$opt" "$arg" ${1+"$@"}
- ;;
-
- -v|--version)
- sed "$my_sed_version" < $0
- exit 0
- ;;
- -\?|-h)
- sed '/^# usage:/,/# -h/ { s/^# //; p; }; d' < $0 &&
- echo
- echo "run \`$name --help | more' for full usage"
- exit 0
- ;;
- --help)
- sed "$my_sed_help" < $0
- exit 0
- ;;
- --)
- shift
- repeat=false
- ;;
- -*)
- echo "$name: invalid flag $1" >&2
- break
- ;;
- *)
- repeat=false
- ;;
+# func_echo arg...
+# Echo program name prefixed message.
+func_echo ()
+{
+ echo $progname: ${1+"$@"}
+}
+
+# func_error arg...
+# Echo program name prefixed message to standard error.
+func_error ()
+{
+ echo $progname: ${1+"$@"} 1>&2
+}
+
+# func_fatal_error arg...
+# Echo program name prefixed message to standard error, and exit.
+func_fatal_error ()
+{
+ func_error ${1+"$@"}
+ exit $EXIT_FAILURE
+}
+
+# func_verbose arg...
+# Echo program name prefixed message in verbose mode only.
+func_verbose ()
+{
+ $opt_verbose && func_error ${1+"$@"}
+}
+
+# func_fatal_help arg...
+# Echo program name prefixed message to standard error, followed by
+# a help hint, and exit.
+func_fatal_help ()
+{
+ func_error ${1+"$@"}
+ func_fatal_error "Try \`$progname --help' for more information."
+}
+
+# func_missing_arg argname
+# Echo program name prefixed message to standard error and set global
+# exit_cmd.
+func_missing_arg ()
+{
+ func_error "missing argument for $1"
+ exit_cmd=exit
+}
+
+# func_usage
+# Echo short help message to standard output and exit.
+func_usage ()
+{
+ $SED '/^# Usage:/,/# -h/ {
+ s/^# //; s/^# *$//;
+ s/\$progname/'$progname'/;
+ p;
+ }; d' < "$progpath"
+ echo
+ echo "run \`$progname --help | more' for full usage"
+ exit $EXIT_SUCCESS
+}
+
+# func_help
+# Echo long help message to standard output and exit.
+func_help ()
+{
+ $SED '/^# Usage:/,/# Report bugs to/ {
+ s/^# //; s/^# *$//;
+ s/\$progname/'$progname'/;
+ p;
+ }; d' < "$progpath"
+ exit $EXIT_SUCCESS
+}
+
+# func_version
+# Echo version message to standard output and exit.
+func_version ()
+{
+ $SED '/^# '$PROGRAM' (GNU /,/# warranty; / {
+ s/^# //; s/^# *$//;
+ s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/;
+ p;
+ }; d' < "$progpath"
+ exit $EXIT_SUCCESS
+}
+
+# Parse options once, thoroughly. This comes as soon as possible in
+# the script to make things like `libtoolize --version' happen quickly.
+{
+ # sed scripts:
+ my_sed_single_opt='1s/^\(..\).*$/\1/;q'
+ my_sed_single_rest='1s/^..\(.*\)$/\1/;q'
+ my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q'
+ my_sed_long_arg='1s/^--[^=]*=//'
+
+ # this just eases exit handling
+ while test $# -gt 0; do
+ opt="$1"
+ shift
+ case $opt in
+
+ --fast) set -- --force --first ${1+"$@"} ;;
+
+ -f|--force) opt_update=false; PAGER=cat ;;
+
+ --from) test $# = 0 && func_missing_arg $opt && break
+ sendmail_from="$1"
+ shift
+ ;;
+
+ -l|--local) update_flags="$update_flags -l"
+ commit_flags="$commit_flags -l"
+ ;;
+
+ -m|--message|--msg)
+ test $# = 0 && func_missing_arg $opt && break
+ if $opt_first || test -f "$log_file"; then
+ func_error "you can have at most one of -m, -F and -1"
+ break
+ fi
+ echo "$1" > "$log_file"
+ shift
+ ;;
+
+ -F|--file) test $# = 0 && func_missing_arg $opt && break
+ if $opt_first || test -f "$log_file"; then
+ func_error "you can have at most one of -m, -F and -1"
+ break
+ fi
+ if cat < "$1" > "$log_file"; then :; else
+ break
+ fi
+ shift
+ ;;
+
+ -1|--first) if test -f "$log_File"; then
+ func_error "you can have at most one of -m, -F and -1"
+ break
+ fi
+ opt_first=:
+ ;;
+
+ -C|--[cC]hange[lL]og)
+ test $# = 0 && func_missing_arg $opt && break
+ if test -f "$1"; then :; else
+ func_error "ChangeLog file \`$1' does not exist"
+ break
+ fi
+ ChangeLog="$1"
+ shift
+ ;;
+
+ -n|--dry-run) opt_commit=false; opt_update=: ;;
+
+ -q|--quiet) cvs_flags="$cvs_flags -q" ;;
+
+ -s|--sendmail) test $# = 0 && func_missing_arg $opt && break
+ sendmail_to="$1"
+ shift
+ ;;
+
+ --signature) test $# = 0 && func_missing_arg $opt && break
+ signature_file="$HOME/.signature"
+ case $1 in
+ -*) ;;
+ *) signature_file="$1"; shift ;;
+ esac
+ if test -f "$signature_file"; then :; else
+ func_error "\`$signature_file': file not found"
+ break
+ fi
+ ;;
+
+ -z|--compress)
+ test $# = 0 && func_missing_arg $opt && break
+ case "$1" in
+ [0-9]) :;;
+ *) func_error "invalid argument for $opt"
+ break
+ ;;
+ esac
+ cvs_flags="$cvs_flags -z$1"
+ shift
+ ;;
+
+ # Separate optargs to long options:
+
--message=*|--msg=*|--from=*|--file=*|--[Cc]hange[Ll]og=*|--compress=*|--sendmail=*|--signature=*)
+ arg=`echo "$opt" | $SED "$my_sed_long_arg"`
+ opt=`echo "$opt" | $SED "$my_sed_long_opt"`
+ set -- "$opt" "$arg" ${1+"$@"}
+ ;;
+
+ # Separate optargs to short options:
+ -m*|-F*|-C*|-s*|-z*)
+ arg=`echo "$opt" |$SED "$my_sed_single_rest"`
+ opt=`echo "$opt" |$SED "$my_sed_single_opt"`
+ set -- "$opt" "$arg" ${1+"$@"}
+ ;;
+
+ # Separate non-argument short options:
+ -f*|-1*|-n*|-q*)
+ rest=`echo "$opt" |$SED "$my_sed_single_rest"`
+ opt=`echo "$opt" |$SED "$my_sed_single_opt"`
+ set -- "$opt" "-$rest" ${1+"$@"}
+ ;;
+
+ -\?|-h) func_usage ;;
+ --help) func_help ;;
+ --version) func_version ;;
+ --) break ;;
+ -*) func_fatal_help "unrecognized option \`$opt'" ;;
+ *) set -- "$opt" ${1+"$@"}; break ;;
esac
-done
+ done
+
+ if test -z "$sendmail_to"; then
-if test -z "$sendmail_to"; then
# can't have a from address without a destination address
test -n "$sendmail_from" &&
- echo "$name: can't use --from without --sendmail." >&2 && exit 1
+ func_error "can't use --from without --sendmail." && exit_cmd=exit
+
# can't use a signature file without a destination address
test -n "$signature_file" &&
- echo "$name: can't use --signature without --sendmail," >&2 && exit 1
-fi
+ func_error "can't use --signature without --sendmail." && exit_cmd=exit
+ fi
-# might have used break 2 within the previous loop, but so what
-$repeat && break
+ # Bail if the options were screwed
+ $exit_cmd $EXIT_FAILURE
+}
-$update && \
-if echo "$name: checking for conflicts..." >&2
- ($CVS $cvsopt -q -n update $updateopt ${1+"$@"} \
- | while read line; do
- echo "$line"
- echo "$line" >&3
- done | grep '^C') 3>&1 >/dev/null; then
- echo "$name: some conflicts were found, aborting..." >&2
- break
-fi
-if test ! -f "$log_file"; then
+$opt_update && {
+ func_error "$progname: checking for conflicts..."
+ if ( $CVS $cvs_flags -q -n update $update_flags ${1+"$@"} |
+ while read line; do
+ echo "$line"
+ echo "$line" >&3
+ done | grep '^C'
+ ) 3>&1 >/dev/null; then
+ func_fatal_error "some conflicts were found, aborting..."
+ fi
+}
+
+if test -f "$log_file"; then :; else
if test -z "$ChangeLog"; then
for f in ${1+"$@"}; do
case "$f" in
- ChangeLog* | */ChangeLog*)
- if test -z "$ChangeLog"; then
+ ChangeLog* | */ChangeLog*)
+ if test -z "$ChangeLog"; then
ChangeLog="$f"
- else
- echo "$name: multiple ChangeLog files: $ChangeLog and $f" >&2
- break
- fi
+ else
+ func_fatal_error "multiple ChangeLog files: $ChangeLog and $f"
+ fi
;;
esac
done
fi
- echo "$name: checking commit message..." >&2
- if $first; then
+ func_error "$progname: checking commit message..."
+ if $opt_first; then
skipping=:
sed 's,^,+,' < ${ChangeLog-ChangeLog} |
- while read line; do
- case "$line" in
- "+") if $skipping; then skipping=false; else break; fi;;
- "+ "*)
- echo "$name: *** Warning: lines should start with tabs, not spaces;
ignoring line:" >&2
- echo "$line" | sed 's/^.//' >&2;;
- "+ "*)
- $skipping || echo "$line" ;;
- esac
- done |
- sed 's,^\+ ,,' > "$log_file" || break
+ while read line; do
+ case "$line" in
+ "+") if $skipping; then skipping=false; else break; fi;;
+ "+ "*)
+ func_error "*** Warning: lines should start with tabs, not spaces;
ignoring line:"
+ echo "$line" | sed 's/^.//' >&2;;
+ "+ "*)
+ $skipping || echo "$line" ;;
+ esac
+ done |
+ sed 's,^\+ ,,' > "$log_file" || exit $EXIT_FAILURE
else
- $CVS $cvsopt diff -u ${ChangeLog-ChangeLog} |
- while read line; do
- case $line in
- "--- "*) :;;
- "-"*)
- echo "$name: *** Warning: the following line in ChangeLog diff is
suspicious:" >&2
- echo "$line" | sed 's/^.//' >&2;;
- "+ "*)
- echo "$name: *** Warning: lines should start with tabs, not spaces;
ignoring line:" >&2
- echo "$line" | sed 's/^.//' >&2;;
- "+") echo;;
- "+ "*) echo "$line";;
- esac
- done |
- sed -e 's,\+ ,,' -e '/./p' -e '/./d' -e '1d' -e '$d' > "$log_file" \
- || break
+ $CVS $cvs_flags diff -u ${ChangeLog-ChangeLog} |
+ while read line; do
+ case $line in
+ "--- "*) :;;
+ "-"*)
+ func_error "*** Warning: the following line in ChangeLog diff is
suspicious:"
+ echo "$line" | sed 's/^.//' >&2;;
+ "+ "*)
+ func_error "*** Warning: lines should start with tabs, not spaces;
ignoring line:"
+ echo "$line" | sed 's/^.//' >&2;;
+ "+") echo ;;
+ "+ "*) echo "$line";;
+ esac
+ done |
+ sed -e 's,\+ ,,' -e '/./p' -e '/./d' -e '1d' -e '$d' > "$log_file" \
+ || exit $EXIT_FAILURE
fi
-# The sed script above removes "+TAB" from the beginning of a line, then
-# deletes the first and/or the last line, when they happen to be empty
+ # The sed script above removes "+TAB" from the beginning of a line, then
+ # deletes the first and/or the last line, when they happen to be empty
fi
-if grep '[^ ]' < "$log_file" > /dev/null; then :; else
- echo "$name: empty commit message, aborting" >&2
- break
-fi
+grep '[^ ]' < "$log_file" > /dev/null ||
+ func_fatal_error "empty commit message, aborting"
if grep '^$' < "$log_file" > /dev/null; then
- echo "$name: *** Warning: blank lines should not appear within commit
messages." >&2
- echo "$name: *** They should be used to separate distinct commits." >&2
+ func_error "*** Warning: blank lines should not appear within commit
messages."
+ func_error "*** They should be used to separate distinct commits."
fi
-${PAGER-more} "$log_file" || break
+${PAGER-more} "$log_file" || exit $EXIT_FAILURE
sleep 1 # give the user some time for a ^C
@@ -365,24 +423,21 @@ filelist=`cvs -nq up 2>/dev/null | grep
# Do not check for empty $log_file again, even though the user might have
# zeroed it out. If s/he did, it was probably intentional.
-if $commit; then
- $CVS $cvsopt commit $commitopt -F $log_file ${1+"$@"} || break
+if $opt_commit; then
+ $CVS $cvs_flags commit $commit_flags -F $log_file ${1+"$@"} || exit
$EXIT_FAILURE
fi
-main_repeat=false
-done
-
# Send a copy of the log_file if sendmail_to was set:
if test -n "$sendmail_to"; then
notify_file="${log_file}.2"
- echo "$name: Mailing commit notification to $sendmail_to" >&2
+ func_error "Mailing commit notification to $sendmail_to"
test $# -gt 0 && filelist="$@"
{
test -f CVS/Root &&
echo "CVSROOT: `sed -e 's,.*:,,g' CVS/Root`"
test -f ./config/mkstamp &&
- echo "TIMESTAMP: `$SHELL ./config/mkstamp < ./ChangeLog`"
+ echo "TIMESTAMP: `./config/mkstamp < ./ChangeLog`"
test -f CVS/Repository &&
echo "Module name: `cat CVS/Repository`"
test -f CVS/Tag &&
@@ -393,17 +448,20 @@ if test -n "$sendmail_to"; then
echo "Log Message:"
sed -e 's,^, ,' "$log_file"
test -f "$signature_file" && cat "$signature_file"
- } >> "$notify_file"
+ } > "$notify_file"
if test -n "$sendmail_from"; then
- $SHELL $MAILNOTIFY -F "$sendmail_from" -s "`echo $filelist`" -f
"$notify_file" -m "text/plain" "$sendmail_to"
+ $MAILNOTIFY -F "$sendmail_from" -s "`echo $filelist`" -f "$notify_file" -m
"text/plain" "$sendmail_to"
else
- $SHELL $MAILNOTIFY -s "`echo $filelist`" -f "$notify_file" -m "text/plain"
"$sendmail_to"
+ $MAILNOTIFY -s "`echo $filelist`" -f "$notify_file" -m "text/plain"
"$sendmail_to"
fi
fi
-rm -f "${log_file}*"
+$RM "${log_file}*"
+
+exit $EXIT_SUCCESS
-# if main_repeat was not set to `false', we failed
-$main_repeat && exit 1
-exit 0
+# Local Variables:
+# mode:shell-script
+# sh-indentation:2
+# End:
Index: libtoolize.in
===================================================================
RCS file: /cvsroot/libtool/libtool/libtoolize.in,v
retrieving revision 1.37
diff -u -p -u -r1.37 libtoolize.in
--- libtoolize.in 11 Jan 2004 23:24:02 -0000 1.37
+++ libtoolize.in 12 Feb 2004 13:18:10 -0000
@@ -52,25 +52,39 @@
: ${LN_S="@LN_S@"}
: ${MKDIR="mkdir"}
: ${RM="rm -f"}
+: ${SED="@SED@"}
+
+dirname="$SED s,/[^/]*$,,"
+basename="$SED s,^.*/,,g"
+
+# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
+# is ksh but when the shell is invoked as "sh" and the current value of
+# the _XPG environment variable is not equal to 1 (one), the special
+# positional parameter $0, within a function call, is the name of the
+# function.
+progpath="$0"
# The name of this program:
-progname=`echo "$0" | sed 's%^.*/%%'`
+progname=`echo "$progpath" | $basename`
PROGRAM=libtoolize
-# Global variables.
-dry_run_opt=false
-force_opt=false
-install_opt=false
-link_opt=:
-ltdl_opt=false
-ltdl_tar_opt=false
-quiet_opt=false
-verbose_opt=false
+# Global variables:
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+
+opt_dry_run=false
+opt_force=false
+opt_install=false
+opt_link=:
+opt_ltdl=false
+opt_ltdl_tar=false
+opt_quiet=false
+opt_verbose=false
seen_libtool=false
seen_ltdl=false
-exit_status=0
+exit_status=$EXIT_SUCCESS
# Locations for important files:
address@hidden@
@@ -81,7 +95,6 @@ auxdir=
m4dir=
configure_ac=configure.in
-sed_dirname='s,/[^/]*$,,'
# func_echo arg...
# Echo program name prefixed message.
@@ -94,7 +107,7 @@ func_echo ()
# Echo program name prefixed message in verbose mode only.
func_verbose ()
{
- $verbose_opt && func_echo ${1+"$@"}
+ $opt_verbose && func_echo ${1+"$@"}
}
# func_error arg...
@@ -109,7 +122,7 @@ func_error ()
func_fatal_error ()
{
func_error ${1+"$@"}
- exit 1
+ exit $EXIT_FAILURE
}
# func_fatal_help arg...
@@ -121,6 +134,53 @@ func_fatal_help ()
func_fatal_error "Try \`$progname --help' for more information."
}
+# func_missing_arg argname
+# Echo program name prefixed message to standard error and set global
+# exit_cmd.
+func_missing_arg ()
+{
+ func_error "missing argument for $1"
+ exit_cmd=exit
+}
+
+# func_usage
+# Echo short help message to standard output and exit.
+func_usage ()
+{
+ $SED '/^# Usage:/,/# -h/ {
+ s/^# //; s/^# *$//;
+ s/\$progname/'$progname'/;
+ p;
+ }; d' < "$progpath"
+ echo
+ echo "run \`$progname --help | more' for full usage"
+ exit $EXIT_SUCCESS
+}
+
+# func_help
+# Echo long help message to standard output and exit.
+func_help ()
+{
+ $SED '/^# Usage:/,/# Report bugs to/ {
+ s/^# //; s/^# *$//;
+ s/\$progname/'$progname'/;
+ p;
+ }; d' < "$progpath"
+ exit $EXIT_SUCCESS
+}
+
+# func_version
+# Echo version message to standard output and exit.
+func_version ()
+{
+ $SED '/^# '$PROGRAM' (GNU /,/# warranty; / {
+ s/^# //; s/^# *$//;
+ s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/;
+ p;
+ }; d' < "$progpath"
+ exit $EXIT_SUCCESS
+}
+
# Parse options once, thoroughly. This comes as soon as possible in
# the script to make things like `libtoolize --version' happen quickly.
@@ -128,30 +188,21 @@ func_fatal_help ()
# sed scripts:
my_sed_single_opt='1s/^\(..\).*$/\1/;q'
my_sed_single_rest='1s/^..\(.*\)$/\1/;q'
- my_sed_help='/^# Usage:/,/# Report bugs to/ {
- s/^# //; s/^# *$//;
- s/\$progname/'$progname'/;
- p;
- }; d'
- my_sed_version='/^# '$PROGRAM' (GNU /,/# warranty; / {
- s/^# //; s/^# *$//;
- s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/;
- p;
- }; d'
-
+ my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q'
+ my_sed_long_arg='1s/^--[^=]*=//'
while test "$#" -gt 0; do
- case $1 in
- --copy | -c) shift; link_opt=false ;;
+ opt="$1"
+ shift
+ case $opt in
+ --copy|-c) opt_link=false ;;
- --debug) shift
- func_echo "enabling shell trace mode"
+ --debug) func_echo "enabling shell trace mode"
set -x
;;
- --dry-run | -n) shift
- if $dry_run_opt; then :; else
- dry_run_opt=:
+ --dry-run|-n) if $opt_dry_run; then :; else
+ opt_dry_run=:
RM="echo $RM"
test -n "$LN_S" && LN_S="echo $LN_S"
CP="echo $CP"
@@ -159,25 +210,25 @@ func_fatal_help ()
fi
;;
- --force | -f) shift; force_opt=: ;;
- --install | -i) shift; install_opt=: ;;
- --ltdl) shift; ltdl_opt=: ;;
- --ltdl-tar) shift; ltdl_tar_opt=: ;;
- --quiet | --automake | -q) # --automake is for 1.5 compatibility
- shift; quiet_opt=: ;;
- --verbose | -v) shift; verbose_opt=: ;;
+ --force|-f) opt_force=: ;;
+ --install|-i) opt_install=: ;;
+ --ltdl) opt_ltdl=: ;;
+ --ltdl-tar) opt_ltdl_tar=: ;;
+ --quiet|--automake|-q) # --automake is for 1.5 compatibility
+ opt_quiet=: ;;
+ --verbose|-v) opt_verbose=: ;;
-c*|-i*|-f*|-n*|-q*|-v*)
- opt=`echo "$1" |sed "$my_sed_single_opt"`
- rest=`echo "$1" |sed "$my_sed_single_rest"`
- shift
+ rest=`echo "$opt" |$SED "$my_sed_single_rest"`
+ opt=`echo "$opt" |$SED "$my_sed_single_opt"`
set -- "$opt" "-$rest" ${1+"$@"}
;;
- --version) sed "$my_sed_version" < $0; exit 0 ;;
- --help) sed "$my_sed_help" < $0; exit 0 ;;
- --) shift; break ;;
- -*) func_fatal_help "unrecognized option \`$1'" ;;
+ -\?|-h) func_usage ;;
+ --help) func_help ;;
+ --version) func_version ;;
+ --) break ;;
+ -*) func_fatal_help "unrecognized option \`$opt'" ;;
*) func_fatal_help "too many arguments" ;;
esac
done
@@ -193,7 +244,7 @@ func_mkdir_p ()
while test ! -d "$my_dir"; do
my_dirs="$my_dir $my_dirs"
case $my_dir in */*) ;; *) break ;; esac
- my_dir=`echo "$my_dir" | sed "$sed_dirname"`
+ my_dir=`echo "$my_dir" | $dirname`
done
test ! -n "$my_dirs" || $MKDIR $my_dirs
}
@@ -207,18 +258,18 @@ func_copy ()
my_destfile="$2"
my_return_status=1
- func_mkdir_p `echo "$my_destfile" | sed "$sed_dirname"`
+ func_mkdir_p `echo "$my_destfile" | "$dirname`
$RM "$my_destfile"
- if $link_opt && $LN_S "$my_srcfile" "$my_destfile"; then
- $quiet_opt || func_echo "copying file \`$my_destfile'"
+ if $opt_link && $LN_S "$my_srcfile" "$my_destfile"; then
+ $opt_quiet || func_echo "copying file \`$my_destfile'"
my_return_status=0
elif $CP "$my_srcfile" "$my_destfile"; then
- $quiet_opt || func_echo "copying file \`$my_destfile'"
+ $opt_quiet || func_echo "copying file \`$my_destfile'"
my_return_status=0
else
func_error "can not copy \`$my_srcfile' to \`$my_destfile'"
- exit_status=1
+ exit_status=$EXIT_FAILURE
fi
return $my_return_status
@@ -228,7 +279,7 @@ func_copy ()
# For each file in SRCDIR, then try to copy the file to DESTDIR by calling
# COPY_CB with the src and dest files. If GLOB_EXCLUDE is given, exclude
# any matching filenames from the copy. If COPY_CB is passed, then the
-# check for overwriting without force_opt is the callbacks responsibility:
+# check for overwriting without opt_force is the callbacks responsibility:
# This allows using callbacks like func_serial_update, which perform their
# own checks to decide whether to overwrite the dest file.
func_copy_all_files ()
@@ -247,8 +298,8 @@ func_copy_all_files ()
if test -f "$my_srcdir/$my_filename"; then
if test "X$my_copy_cb" = Xfunc_copy; then
- $force_opt || if test -f "$my_destdir/$my_filename"; then
- $quiet_opt \
+ $opt_force || if test -f "$my_destdir/$my_filename"; then
+ $opt_quiet \
|| func_error "\`$my_destdir/$my_filename' exists: use \`--force'
to overwrite"
continue
fi
@@ -291,7 +342,7 @@ func_scan_files ()
my_sed_scan_configure_ac='s,#.*$,,; s,^dnl .*$,,; s, dnl .*$,,;
/AC_INIT/ { s,^.*$,my_uses_autoconf=:,; p; };
d'
- eval `sed "$my_sed_scan_configure_ac" "$configure_ac"`
+ eval `$SED "$my_sed_scan_configure_ac" "$configure_ac"`
$my_uses_autoconf || {
func_verbose "$configure_ac: not using Autoconf"
@@ -312,7 +363,7 @@ func_scan_files ()
/A[CM]_PROG_LIBTOOL/ { s,^.*$,seen_libtool=:,; p; };
/AC_LIB_LTDL/ { s,^.*$,seen_ltdl=:,; p; };
d;'
- eval `cat aclocal.m4 "$configure_ac" | sed "$my_sed_traces" 2>/dev/null`
+ eval `cat aclocal.m4 "$configure_ac" | $SED "$my_sed_traces" 2>/dev/null`
# ---------------- #
@@ -357,7 +408,7 @@ func_scan_files ()
s,^[^=]*=[ ]*\(.*\), \1,; q; }; d'
if test ! -n "$m4dir" && test -f Makefile.am; then
my_m4dir_is_next=false
- for arg in `sed "$my_sed_aclocal_flags" Makefile.am`; do
+ for arg in `$SED "$my_sed_aclocal_flags" Makefile.am`; do
if $my_m4dir_is_next; then
m4dir="$arg"
break
@@ -390,7 +441,7 @@ func_included_files ()
# Only recurse when we don't care if all the variables we use get
# trashed, since they are in global scope.
- for my_filename in `sed "$my_sed_include" "$my_searchfile"`; do
+ for my_filename in `$SED "$my_sed_include" "$my_searchfile"`; do
func_included_files $my_filename
done
}
@@ -411,7 +462,7 @@ func_serial ()
my_serial=
for my_file in `func_included_files "$my_filename"`; do
if func_grep '^AC_DEFUN(\['"$my_macro_regex" "$my_file"; then
- my_serial=`sed -e "$my_sed_serial" "$my_file"`
+ my_serial=`$SED -e "$my_sed_serial" "$my_file"`
break
fi
done
@@ -452,16 +503,16 @@ func_serial_update ()
if test "$my_src_serial" -lt "$my_dest_serial"; then
func_error "\`$my_srcfile' is serial $my_srcserial, less than
$my_destserial in \`$my_destfile'"
- $force_opt \
+ $opt_force \
|| func_fatal_error "Use \`--force' to replace newer libtool files
with this version."
fi
fi
- if $my_update_p || $force_opt; then
+ if $my_update_p || $opt_force; then
func_copy "$my_srcfile" "$my_destfile"
my_return_status=$?
else
- $quiet_opt \
+ $opt_quiet \
|| func_echo "\`$my_destfile' is already up to date."
fi
@@ -482,7 +533,7 @@ func_check_macros ()
{
# Don't trace for this, we're just checking the user didn't invoke it
# directly from configure.ac.
- sed 's,dnl .*$,,; s,# .*$,,' "$configure_ac" | grep AC_PROG_RANLIB \
+ $SED 's,dnl .*$,,; s,# .*$,,' "$configure_ac" | grep AC_PROG_RANLIB \
&& func_echo "\`AC_PROG_RANLIB' is rendered obsolete by
\`AC_PROG_LIBTOOL'"
$seen_libtool \
@@ -511,10 +562,10 @@ func_ltmain_update ()
# FIXME: check versions, and only downgrade with --force
cmp -s "$my_srcfile" "$my_destfile"
- if test "$?" -ne 0 || $force_opt; then
+ if test "$?" -ne 0 || $opt_force; then
func_copy "$my_srcfile" "$my_destfile"
else
- $quiet_opt \
+ $opt_quiet \
|| func_echo "\`$my_destfile' is already up to date."
fi
}
@@ -536,10 +587,10 @@ func_config_update ()
# FIXME: check versions, and only downgrade with --force
cmp -s "$my_srcfile" "$my_destfile"
- if test "$?" -ne 0 || $force_opt; then
+ if test "$?" -ne 0 || $opt_force; then
func_copy "$my_srcfile" "$my_destfile"
else
- $quiet_opt \
+ $opt_quiet \
|| func_echo "\`$my_destfile' is already up to date."
fi
}
@@ -557,17 +608,17 @@ func_config_update ()
re_pkgmacro_files='libtool\.m4|ltdl\.m4'
func_scan_files
- $quiet_opt || func_check_macros
+ $opt_quiet || func_check_macros
# Copy all the files from installed libltdl to this project, if the
# user specified `--with-ltdl'.
- $ltdl_opt && eval func_copy_all_files "$pkgdatadir/libltdl" libltdl
+ $opt_ltdl && eval func_copy_all_files "$pkgdatadir/libltdl" libltdl
# Copy all the files from installed libltdl to a tarball in this project,
# if the user specified `--with-ltdl-tar'.
- $ltdl_tar_opt && {
+ $opt_ltdl_tar && {
if test -f libltdl.tar.gz; then
- if $force_opt; then
+ if $opt_force; then
test -d libltdl && ${RM}r libltdl
func_copy_all_files "$pkgdatadir/libltdl" libltdl
tar -chof - libltdl | gzip --best > libltdl.tar.gz
@@ -580,10 +631,10 @@ func_config_update ()
# Copy all the installed utility files to the auxiliary directory if
# `--install' was passed, or else copy just ltmain.sh.
- $quiet_opt || if test "$auxdir" != .; then
+ $opt_quiet || if test "$auxdir" != .; then
func_echo "putting files in AC_CONFIG_AUX_DIR, \`$auxdir'."
fi
- if $install_opt || $force_opt; then
+ if $opt_install || $opt_force; then
func_copy_all_files "$pkgdatadir" "$auxdir" "$re_pkgaux_files"
func_config_update "$pkgdatadir/config.guess" "$auxdir/config.guess"
test -f "$pkgdatadir/config.sub" \
@@ -592,7 +643,7 @@ func_config_update ()
func_ltmain_update "$pkgdatadir/ltmain.sh" "$auxdir/ltmain.sh"
# Copy libtool's m4 macros to the macro directory, if they are newer.
- $quiet_opt || if test "$m4dir" != .; then
+ $opt_quiet || if test "$m4dir" != .; then
func_echo "putting macros in AC_CONFIG_MACRO_DIR, \`$m4dir'."
fi
Index: config/mailnotify
===================================================================
RCS file: /cvsroot/libtool/libtool/config/mailnotify,v
retrieving revision 1.1
diff -u -p -u -r1.1 mailnotify
--- config/mailnotify 10 Feb 2004 19:47:00 -0000 1.1
+++ config/mailnotify 12 Feb 2004 13:18:10 -0000
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# mailnotify (GNU cvs-utils) version 0.1
+# mailnotify (GNU cvs-utils) version 0.2
# Written by Gary V. Vaughan <address@hidden>
# Copyright (C) 2004 Free Software Foundation, Inc.
@@ -33,8 +33,8 @@
# -o FILE --output-file=FILE output to FILE instead of sending
# -s TEXT --subject=TEXT set subject header
# -v --verbose run in verbose mode
-# --version print version information
-# -h,-? --help print short or long help message
+# --version print version information
+# -h,-? --help print short or long help message
# Assemble a (possibly multi-part) mime message and hand it to the local
# sendmail for onward delivery. MUAs tend to mangle patch attachments in
@@ -61,8 +61,18 @@
: ${RM="rm -f"}
: ${SED="sed"}
+dirname="$SED s,/[^/]*$,,"
+basename="$SED s,^.*/,,g"
+
+# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
+# is ksh but when the shell is invoked as "sh" and the current value of
+# the _XPG environment variable is not equal to 1 (one), the special
+# positional parameter $0, within a function call, is the name of the
+# function.
+progpath="$0"
+
# The name of this program:
-progname=`echo "$0" | $SED 's%^.*/%%'`
+progname=`echo "$progpath" | $basename`
PROGRAM=mailnotify
# Global variables:
@@ -74,8 +84,6 @@ outputfile=""
exit_cmd=:
-sed_dirname='s,/[^/]*$,,'
-sed_basename='s,^.*/,,'
sed_mail_address='s,^.*<\(.*\)>.*$,\1,'
# func_echo arg...
@@ -125,6 +133,43 @@ func_missing_arg ()
exit_cmd=exit
}
+# Echo short help message to standard output and exit.
+func_usage ()
+{
+ $SED '/^# Usage:/,/# -h/ {
+ s/^# //; s/^# *$//;
+ s/\$progname/'$progname'/;
+ p;
+ }; d' < "$progpath"
+ echo
+ echo "run \`$progname --help | more' for full usage"
+ exit $EXIT_SUCCESS
+}
+
+# func_help
+# Echo long help message to standard output and exit.
+func_help ()
+{
+ $SED '/^# Usage:/,/# Report bugs to/ {
+ s/^# //; s/^# *$//;
+ s/\$progname/'$progname'/;
+ p;
+ }; d' < "$progpath"
+ exit $EXIT_SUCCESS
+}
+
+# func_version
+# Echo version message to standard output and exit.
+func_version ()
+{
+ $SED '/^# '$PROGRAM' (GNU /,/# warranty; / {
+ s/^# //; s/^# *$//;
+ s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/;
+ p;
+ }; d' < "$progpath"
+ exit $EXIT_SUCCESS
+}
+
# Parse options once, thoroughly. This comes as soon as possible in
# the script to make things like `mailnotify --version' happen quickly.
{
@@ -133,16 +178,6 @@ func_missing_arg ()
my_sed_single_rest='1s/^..\(.*\)$/\1/;q'
my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q'
my_sed_long_arg='1s/^--[^=]*=//'
- my_sed_help='/^# Usage:/,/# Report bugs to/ {
- s/^# //; s/^# *$//;
- s/\$progname/'$progname'/;
- p;
- }; d'
- my_sed_version='/^# '$PROGRAM' (GNU /,/# warranty; / {
- s/^# //; s/^# *$//;
- s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/;
- p;
- }; d'
while test $# -gt 0; do
opt="$1"
@@ -200,29 +235,33 @@ func_missing_arg ()
-v|--verbose) opt_verbose=: ;;
+ # Separate optargs to long options:
--carbon-copy=*|--from=*|--filename=*|--mime-type=*|--output-file=*|--subject=*)
arg=`echo "$opt" | $SED "$my_sed_long_arg"`
opt=`echo "$opt" | $SED "$my_sed_long_opt"`
set -- "$opt" "$arg" ${1+"$@"}
;;
+ # Separate optargs to short options:
-C*|-F*|-f*|-m*|-o*|-s*)
arg=`echo "$opt" |$SED "$my_sed_single_rest"`
opt=`echo "$opt" |$SED "$my_sed_single_opt"`
set -- "$opt" "$arg" ${1+"$@"}
;;
+ # Separate non-argument short options:
-n*|-v*)
rest=`echo "$opt" |$SED "$my_sed_single_rest"`
opt=`echo "$opt" |$SED "$my_sed_single_opt"`
set -- "$opt" "-$rest" ${1+"$@"}
;;
- --version) $SED "$my_sed_version" < $0; exit $EXIT_SUCCESS ;;
- --help) $SED "$my_sed_help" < $0; exit $EXIT_SUCCESS ;;
- --) break ;;
- -*) func_fatal_help "unrecognized option \`$opt'" ;;
- *) set -- "$opt" ${1+"$@"}; break ;;
+ -\?|-h) func_usage ;;
+ --help) func_help ;;
+ --version) func_version ;;
+ --) break ;;
+ -*) func_fatal_help "unrecognized option \`$opt'" ;;
+ *) set -- "$opt" ${1+"$@"}; break ;;
esac
done
@@ -256,7 +295,7 @@ func_headers ()
my_sed_version_no='/^# '$PROGRAM' (GNU / { s/^# .*version //; p; }; d'
{
- echo "User-Agent: $PROGRAM/`$SED \"$my_sed_version_no\" < $0`"
+ echo "User-Agent: $PROGRAM/`$SED \"$my_sed_version_no\" < $progpath`"
echo "MIME-Version: 1.0"
test -n "$from" && echo "From: $from"
echo "To: $my_destination"
@@ -387,3 +426,8 @@ func_sendmail ()
}
exit $EXIT_SUCCESS
+
+# Local Variables:
+# mode:shell-script
+# sh-indentation:2
+# End:
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- FYI: 91-gary-IRIX-dollar-zero-corruption-libtoolize.patch,
Gary V. Vaughan <=