mdw-setup: Fix for constructing Makefile.am from m4 source.
[cfd] / txtlib.in
index e8fb938..da2abcd 100755 (executable)
--- a/txtlib.in
+++ b/txtlib.in
@@ -2,7 +2,7 @@
 
 # -*-sh-*-
 #
-# $Id: txtlib.in,v 1.1 1999/05/05 19:23:47 mdw Exp $
+# $Id: txtlib.in,v 1.5 2004/04/08 01:36:24 mdw Exp $
 #
 # Manipulate simple libraries of text chunks
 #
 # along with `common'; if not, write to the Free Software Foundation,
 # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
-#----- Revision history -----------------------------------------------------
-#
-# $Log: txtlib.in,v $
-# Revision 1.1  1999/05/05 19:23:47  mdw
-# Initial revision
-#
+set -e
 
 # --- Handle command line arguments ---
 
@@ -64,8 +59,8 @@ EOF
       exit 0
       ;;
     -v | --v | --ve | --ver | --vers | --versi | --versio | --version)
-      version=`echo '$Revision: 1.1 $' |
-       sed -n -e 's;^.*: \([0-9.]*\)\\$;\1;p'`
+      version=`echo '$Revision: 1.5 $' |
+       sed -n -e 's;^.*: \([0-9.]*\) *\\$;\1;p'`
       echo "txtlib $version; Common Files Distribution version @VERSION@"
       exit 0
       ;;
@@ -109,10 +104,10 @@ test "$out" = "-" && out=""
 
 case $mode in
   l)
-    sed -n -e "/^.*\*@-\([-a-zA-Z0-9_]*\)-@\*.*$/ s//\1/p" "$@"
+    sed -n -e "/^.*\*@-\([-a-zA-Z0-9_]*\)-@\*.*$/ s//\1/p" /dev/null "$@"
     ;;
   x)
-    t=/tmp/txtlib.$$
+    t=${TMPDIR-/tmp}/txtlib.$$
     if mkdir -m 700 $t; then :
     else
       echo >&2 "txtlib: could not create temporary directory"
@@ -122,9 +117,9 @@ case $mode in
     while read LINE; do
       echo "/\*@-$LINE-@\*/,/\*@-#-@\*/ p"
     done >$sedfile
-    test -z "$out" || exec >$out
+    test -z "$out" || exec >"$out"
     sed -e '/\*@-[-a-zA-Z0-9_]*-@\*/ i\
-    *@-#-@*' "$@" | sed -n -f $sedfile | sed -e '/\*@-#-@\*/ d'
+    *@-#-@*' /dev/null "$@" | sed -n -f $sedfile | sed -e '/\*@-#-@\*/ d'
     rm -rf $t
     ;;
 esac