Branch
Hash :
153d4079
Author :
Date :
2023-05-12T22:41:08
On z/OS, set a charset tag on iconv's output file. For the concept of charset tags as external metadata on z/OS files, see <https://lists.gnu.org/archive/html/bug-gnu-libiconv/2023-04/msg00021.html>. * src/zos-tag.h: New file. * src/iconv.c: Include zos-tag.h. (convert): Add a 'tocode' parameter. On z/OS, turn off auto-conversion and tag the output file. (main): Update callers. * tests/check-ebcdic: On z/OS, make all test files initially untagged. * tests/check-tag: New file. * tests/Makefile.in (check): Pass the host_os to check-ebcdic. Invoke check-tag.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
#!/bin/sh
# Check that files on z/OS are properly tagged with their CCSIDs
set -e
host_os="$1"
iconv=../src/iconv_no_i18n
# This test is only meaningful on z/OS (previously called OS/390)
rc=0
if test "${host_os}" = 'openedition' ; then
printf 'hello' | $iconv -f ISO8859-1 -t IBM-1047 > tmp-tag-1
if ls -T tmp-tag-1 | grep -v 'IBM-1047' ; then
echo "tmp-tag-1 is not correctly tagged as IBM-1047." >&2
rc=1
fi
printf 'hello' | $iconv -f ISO8859-1 -t IBM-1047 >tmp-tag-ebcdic
$iconv -f IBM-1047 -t ISO-8859-2 <tmp-tag-ebcdic > tmp-tag-2
if ls -T tmp-tag-2 | grep -v 'ISO8859-2' ; then
echo "tmp-tag-2 is not correctly tagged as ISO8859-2." >&2
rc=1
fi
$iconv -f IBM-1047 -t CP037 <tmp-tag-ebcdic > tmp-tag-7
if ls -T tmp-tag-7 | grep -v 'IBM-037' ; then
echo "tmp-tag-7 is not correctly tagged as IBM-037." >&2
rc=1
fi
$iconv -f IBM-1047 -t UTF-8 <tmp-tag-ebcdic > tmp-tag-8
if ls -T tmp-tag-8 | grep -v 'UTF-8' ; then
echo "tmp-tag-8 is not correctly tagged as UTF-8." >&2
rc=1
fi
$iconv -f IBM-1047 -t ISO_8859-9 <tmp-tag-ebcdic > tmp-tag-9
if ls -T tmp-tag-9 | grep -v 'ISO8859-9' ; then
echo "tmp-tag-9 is not correctly tagged as ISO8859-9." >&2
rc=1
fi
if [ $rc -eq 0 ] ; then
rm -f tmp-tag-*
fi
fi
exit $rc