# -*- shell-script -*-
message testing the kanji code conversion.
-printf '\xb4\xc1\xbb\xfa\xc9\xbd\n' > test-tmp-euc
- check $? $LINENO
-printf '\x8a\xbf\x8e\x9a\x95\x5c\n' > test-tmp-sjis
+uname >&2
+case $(uname) in
+Darwin*)
+ printf '\xb4\xc1\xbb\xfa\n' > test-tmp-euc
+ ;;
+*)
+ echo abcd | LANG=C tr abcd '\264\301\273\372' > test-tmp-euc
+ ;;
+esac
+ check $? $LINENO
+case $(uname) in
+Darwin*)
+ printf '\x8a\xbf\x8e\x9a\n' > test-tmp-sjis
+ ;;
+*)
+ echo abcd | LANG=C tr abcd '\212\277\216\232' > test-tmp-sjis
+ ;;
+esac
check $? $LINENO
# no convert
$lha c test-tmp-euc.lzh test-tmp-euc
check $? $LINENO
# file size is too small, so no compressed
-$lha v test-tmp-euc.lzh | grep lh0
+$lha v test-tmp-euc.lzh | egrep lh0
check $? $LINENO
# no convert
$lha xw=test-tmp-euc-d test-tmp-euc.lzh
# sjis to euc
$lha xew=test-tmp-unknown-d test-tmp-euc.lzh
check $? $LINENO
-diff -r test-tmp-euc test-tmp-unknown-d/test-tmp-euc
+diff -r test-tmp-euc test-tmp-unknown-d/test-tmp-euc 2>/dev/null
test $? -ne 0
check $? $LINENO
-diff -r test-tmp-sjis test-tmp-unknown-d/test-tmp-euc
+diff -r test-tmp-sjis test-tmp-unknown-d/test-tmp-euc 2>/dev/null
test $? -ne 0
check $? $LINENO
-# euc to sjis (NL to CR NL)
+# euc to sjis (LF to CR LF)
$lha ce test-tmp-sjis.lzh test-tmp-euc
check $? $LINENO
# file size is too small, so no compressed
-$lha v test-tmp-euc.lzh | grep lh0
+$lha v test-tmp-euc.lzh | egrep lh0
check $? $LINENO
-# no convert (CR NL to NL)
+# no convert (CR LF to LF)
$lha xtw=test-tmp-sjis-d test-tmp-sjis.lzh
check $? $LINENO
diff test-tmp-sjis test-tmp-sjis-d/test-tmp-euc
check $? $LINENO
-# sjis to euc (CR NL to NL)
+od -ct x1 test-tmp-sjis >&2
+od -ct x1 test-tmp-sjis-d/test-tmp-euc >&2
+# sjis to euc (CR LF to LF)
$lha xew=test-tmp-euc-d2 test-tmp-sjis.lzh
check $? $LINENO
diff test-tmp-euc test-tmp-euc-d2/test-tmp-euc
check $? $LINENO
+od -ct x1 test-tmp-euc >&2
+od -ct x1 test-tmp-euc-d2/test-tmp-euc >&2
+
+i=0
+while ((i < 10))
+do
+ cat test-tmp-euc
+ ((i = i + 1))
+done > test-tmp-euc2
i=0
-while ((i++ < 100))
+while ((i < 10))
do
- cat test-tmp-euc >> test-tmp-euc2
- cat test-tmp-sjis >> test-tmp-sjis2
-done
+ cat test-tmp-sjis
+ ((i = i + 1))
+done > test-tmp-sjis2
# no convert
$lha c test-tmp-euc2.lzh test-tmp-euc2
check $? $LINENO
-$lha v test-tmp-euc2.lzh | grep 'lh[567]'
+$lha v test-tmp-euc2.lzh | egrep 'lh[567]'
check $? $LINENO
# no convert
$lha xw=test-tmp-euc2-d test-tmp-euc2.lzh
diff -r test-tmp-euc2 test-tmp-unknown2-d/test-tmp-euc2
test $? -ne 0
check $? $LINENO
-diff -r test-tmp-sjis2 test-tmp-unknown2-d/test-tmp-euc2
+diff -r test-tmp-sjis2 test-tmp-unknown2-d/test-tmp-euc2 2>/dev/null
test $? -ne 0
check $? $LINENO
-# euc to sjis (NL to CR NL)
+# euc to sjis (LF to CR LF)
$lha ce test-tmp-sjis2.lzh test-tmp-euc2
check $? $LINENO
-$lha v test-tmp-euc2.lzh | grep 'lh[567]'
+$lha v test-tmp-euc2.lzh | egrep 'lh[567]'
check $? $LINENO
-# no convert (CR NL to NL)
+# no convert (CR LF to LF)
$lha xtw=test-tmp-sjis2-d test-tmp-sjis2.lzh
check $? $LINENO
diff test-tmp-sjis2 test-tmp-sjis2-d/test-tmp-euc2
check $? $LINENO
-# sjis to euc (CR NL to NL)
+# sjis to euc (CR LF to LF)
$lha xew=test-tmp-euc2-d2 test-tmp-sjis2.lzh
check $? $LINENO
diff test-tmp-euc2 test-tmp-euc2-d2/test-tmp-euc2