diff options
author | Manoj Srivastava <srivasta@debian.org> | 2008-05-30 14:15:43 -0500 |
---|---|---|
committer | Manoj Srivastava <srivasta@debian.org> | 2008-05-30 14:15:43 -0500 |
commit | d902bed25e446508e9dcbe84001f738e77dd1979 (patch) | |
tree | 378d1e978b67c2c78904a81b454d303def969a97 /mcon/U/Tr.U | |
parent | 13da8069e56806306f6b42e2af5f03e89a835083 (diff) | |
parent | 6ed168ff814db8f9bcaad6f2e218fb2bbacbdb1c (diff) |
Merge branch 'upstream'
Conflicts:
jmake/files/Jmake.rules
mcon/U/Chk_MANI.U
Signed-off-by: Manoj Srivastava <srivasta@debian.org>
Diffstat (limited to 'mcon/U/Tr.U')
-rw-r--r-- | mcon/U/Tr.U | 67 |
1 files changed, 55 insertions, 12 deletions
diff --git a/mcon/U/Tr.U b/mcon/U/Tr.U index 883d13c..a7320fe 100644 --- a/mcon/U/Tr.U +++ b/mcon/U/Tr.U @@ -1,12 +1,12 @@ -?RCS: $Id: Tr.U,v 3.0.1.2 1994/10/29 18:00:54 ram Exp $ +?RCS: $Id$ ?RCS: -?RCS: Copyright (c) 1991-1993, Raphael Manfredi +?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi ?RCS: ?RCS: You may redistribute only under the terms of the Artistic Licence, ?RCS: as specified in the README file that comes with the distribution. ?RCS: You may reuse parts of this distribution only within the terms of ?RCS: that same Artistic Licence; a copy of which may be found at the root -?RCS: of the source tree for dist 3.0. +?RCS: of the source tree for dist 4.0. ?RCS: ?RCS: $Log: Tr.U,v $ ?RCS: Revision 3.0.1.2 1994/10/29 18:00:54 ram @@ -31,29 +31,72 @@ ?MAKE:Tr: startsh tr eunicefix ?MAKE: -pick add $@ %< ?F:./tr -?T:up low +?T:up low LC_ALL : see whether [:lower:] and [:upper:] are supported character classes echo " " -up='[A-Z]' -low='[a-z]' -case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in +case "`echo AbyZ | LC_ALL=C $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in ABYZ) echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4 up='[:upper:]' low='[:lower:]' ;; +*) # There is a discontinuity in EBCDIC between 'I' and 'J' + # (0xc9 and 0xd1), therefore that is a nice testing point. + if test "X$up" = X -o "X$low" = X; then + case "`echo IJ | LC_ALL=C $tr '[I-J]' '[i-j]' 2>/dev/null`" in + ij) up='[A-Z]' + low='[a-z]' + ;; + esac + fi + if test "X$up" = X -o "X$low" = X; then + case "`echo IJ | LC_ALL=C $tr I-J i-j 2>/dev/null`" in + ij) up='A-Z' + low='a-z' + ;; + esac + fi + if test "X$up" = X -o "X$low" = X; then + case "`echo IJ | od -x 2>/dev/null`" in + *C9D1*|*c9d1*) + echo "Hey, this might be EBCDIC." >&4 + if test "X$up" = X -o "X$low" = X; then + case "`echo IJ | \ + LC_ALL=C $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in + ij) up='[A-IJ-RS-Z]' + low='[a-ij-rs-z]' + ;; + esac + fi + if test "X$up" = X -o "X$low" = X; then + case "`echo IJ | LC_ALL=C $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in + ij) up='A-IJ-RS-Z' + low='a-ij-rs-z' + ;; + esac + fi + ;; + esac + fi +esac +case "`echo IJ | LC_ALL=C $tr \"$up\" \"$low\" 2>/dev/null`" in +ij) + echo "Using $up and $low to convert case." >&4 + ;; *) - echo "Your tr only supports [a-z] and [A-Z] to convert case." >&4 - ;; + echo "I don't know how to translate letters from upper to lower case." >&4 + echo "Your tr is not acting any way I know of." >&4 + exit 1 + ;; esac : set up the translation script tr, must be called with ./tr of course cat >tr <<EOSC $startsh case "\$1\$2" in -'[A-Z][a-z]') exec $tr '$up' '$low';; -'[a-z][A-Z]') exec $tr '$low' '$up';; +'[A-Z][a-z]') LC_ALL=C exec $tr '$up' '$low';; +'[a-z][A-Z]') LC_ALL=C exec $tr '$low' '$up';; esac -exec $tr "\$@" +LC_ALL=C exec $tr "\$@" EOSC chmod +x tr $eunicefix tr |