- Fix build on big-endian platforms

Reported by:	linimon
This commit is contained in:
Alex Kozlov 2020-05-21 04:22:51 +00:00
parent a7a8045f41
commit 8d2ed79a6a
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=536043
2 changed files with 6 additions and 6 deletions

View File

@ -13,9 +13,6 @@ EXTRACT_SUFX= .ZIP
MAINTAINER= ak@FreeBSD.org
COMMENT= Copies files from VMS Files-11 (ODS2) file systems
BROKEN_FreeBSD_12_powerpc64= fails to build: ods-2-reader.new.c:60:1: error: unterminated #ifdef
BROKEN_FreeBSD_13_powerpc64= fails to build: ods-2-reader.new.c:3:687: error: expected identifier or '('
USES= zip
NO_WRKSUBDIR= yes
PLIST_FILES= bin/ods2reader

View File

@ -17,13 +17,16 @@ fi
while true; do
off=$((${off} + ${strlen}))
strlen=$(hexdump -s ${off} -n 2 -e '"%u"' ${file})
# read in 1-byte units
set -- $(od -An -tu1 -j${off} -N2 ${file})
# EoF
[ -z ${strlen} ] && break
[ -z "${1}" -o -z "${2}" ] && break
# assume little-endian, it's OpenVMS format
strlen=$(($2 * 256 + $1))
# print newline for zero-size records, as info-zip does
[ ${strlen} -eq 0 ] && echo
off=$((${off} + 2))
hexdump -s ${off} -n ${strlen} -e '1000/1 "%c""\n"' ${file}
hexdump -s ${off} -n ${strlen} -e '"'%.${strlen}s'"''"\n"' ${file}
# align 2
[ $((${strlen} % 2)) -ne 0 ] && off=$((${off} + 1))
done