#!/bin/csh -f
#
# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
#
set path=( $path /usr/bin /usr/sbin /bin )
set UCONV=uconv
set CONVS="1252 CN-Big5 cns11643_1 cp949c Cp949c csUnicode11 csUnicode11UTF7 csUnicodeASCII csUnicodeLatin1 csWindows31Latin5 IMAP-MODIFIED-UTF-7 IMAP_UTF_7 IMAP-UTF-7 ISO-10646 ISO-10646-J-1 ISO-10646-UCS-BASIC ISO-10646-Unicode-Latin1 iso-8859-11 iso_8859-1:1978 ISO-8859-1-Windows-3.0-Latin-1 ISO-8859-1-Windows-3.1-Latin-1 ISO-8859-2-Windows-Latin-2 iso-8859-5-windows-latin-5 ISO-8859-8-Visual MODIFIED_UTF_7 MODIFIED-UTF-7 MUTF_7 MUTF-7 UNICODE-1-1-URF-7 UNICODE-1-1-UTF-7 UNICODE-1-1-UTF-8 unicode-2-0-utf-8 visual x-cp1250 x-cp1251 x-cp1252 x-cp1253 x-cp1254 x-cp1255 x-cp1256 x-cp1257 x-cp1258 x-euc x-ms-cp932 x-x-big5 x-gbk iso-8859-8i Win1255 Big5-HKSCS EUC-TW 5601 ansi-1251 TIS620.2533 x-johab johap x-johap x-euc-tw x-windows-949 iso-8859-13"
set LOGFILE=conversion-test-SunOS.log
set TMPFILE=tmpfile$$.txt
/bin/rm -fr $LOGFILE
@ okay = 1
foreach i ( $CONVS )
echo "Testing $i conversion:" |& tee -a $LOGFILE
$UCONV -f us-ascii -t $i /etc/passwd | $UCONV -f $i -t us-ascii >! $TMPFILE
diff -c /etc/passwd $TMPFILE >> /dev/null
if ( $status == 1) then
echo " roundtrip conversion failed..." |& tee -a $LOGFILE
@ okay = 0
else
echo " roundtrip conversion successful." |& tee -a $LOGFILE
endif
end
/bin/rm -fr $TMPFILE
if ( $okay == 0 ) then
printf "\nWarning: conversion error happened. Check the log file.\n"
echo "Conversion test done; test log has been created as ./${LOGFILE}."
exit 1
endif
echo "Conversion test done; test log has been created as ./${LOGFILE}."
exit 0