mame/3rdparty/zstd/tests/cli-tests/bin/cmp_size
Vas Crabb 05e69b43e9
Added Zstandard support for zip archives and CHDs. (#11827)
* 3rdparty/zstd: Added Zstandard compression library version 1.5.5.
* util/unzip.cpp: Added support for Zstandard compression (method 93).
* util/chdcodec.cpp: Added support for Zstandard compression.
* 3rdparty/flac: Always define NDEBUG to avoid log spam.
2023-12-11 10:48:02 +11:00

45 lines
705 B
Bash
Executable File

#!/bin/sh
set -e
usage()
{
printf "USAGE:\n\t$0 [-eq|-ne|-lt|-le|-gt|-ge] FILE1 FILE2\n"
}
help()
{
printf "Small utility to compare file sizes without printing them with set -x.\n\n"
usage
}
case "$1" in
-h) help; exit 0 ;;
--help) help; exit 0 ;;
esac
if ! test -f $2; then
printf "FILE1='%b' is not a file\n\n" "$2"
usage
exit 1
fi
if ! test -f $3; then
printf "FILE2='%b' is not a file\n\n" "$3"
usage
exit 1
fi
size1=$(wc -c < $2)
size2=$(wc -c < $3)
case "$1" in
-eq) [ "$size1" -eq "$size2" ] ;;
-ne) [ "$size1" -ne "$size2" ] ;;
-lt) [ "$size1" -lt "$size2" ] ;;
-le) [ "$size1" -le "$size2" ] ;;
-gt) [ "$size1" -gt "$size2" ] ;;
-ge) [ "$size1" -ge "$size2" ] ;;
esac