Add files using upload-large-folder tool
Browse files- bin/jupyter +10 -0
- bin/jupyter-kernel +10 -0
- bin/jupyter-troubleshoot +10 -0
- bin/libdeflate-gzip +0 -0
- bin/libpng-config +127 -0
- bin/libpng16-config +127 -0
- bin/linkicc +0 -0
- bin/lsm2bin +8 -0
- bin/lzcmp +220 -0
- bin/lzdiff +220 -0
- bin/lzegrep +300 -0
- bin/lzfgrep +300 -0
- bin/lzless +74 -0
- bin/lzmadec +0 -0
- bin/lzmainfo +0 -0
- bin/lzmore +80 -0
- bin/markdown-it +8 -0
- bin/markdown_py +8 -0
- bin/mnist_get_data.sh +13 -0
- bin/mnist_preview +34 -0
bin/jupyter
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/home/aioz-nghiale/anaconda3/envs/testing_softzoo_pointe/bin/python3.10
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
|
| 6 |
+
from jupyter_core.command import main
|
| 7 |
+
|
| 8 |
+
if __name__ == '__main__':
|
| 9 |
+
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
|
| 10 |
+
sys.exit(main())
|
bin/jupyter-kernel
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/home/aioz-nghiale/anaconda3/envs/testing_softzoo_pointe/bin/python3.10
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
|
| 6 |
+
from jupyter_client.kernelapp import main
|
| 7 |
+
|
| 8 |
+
if __name__ == '__main__':
|
| 9 |
+
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
|
| 10 |
+
sys.exit(main())
|
bin/jupyter-troubleshoot
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/home/aioz-nghiale/anaconda3/envs/testing_softzoo_pointe/bin/python3.10
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
|
| 6 |
+
from jupyter_core.troubleshoot import main
|
| 7 |
+
|
| 8 |
+
if __name__ == '__main__':
|
| 9 |
+
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
|
| 10 |
+
sys.exit(main())
|
bin/libdeflate-gzip
ADDED
|
Binary file (30.9 kB). View file
|
|
|
bin/libpng-config
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#! /bin/sh
|
| 2 |
+
|
| 3 |
+
# libpng-config
|
| 4 |
+
# provides configuration info for libpng.
|
| 5 |
+
|
| 6 |
+
# Copyright (C) 2002, 2004, 2006, 2007 Glenn Randers-Pehrson
|
| 7 |
+
|
| 8 |
+
# This code is released under the libpng license.
|
| 9 |
+
# For conditions of distribution and use, see the disclaimer
|
| 10 |
+
# and license in png.h
|
| 11 |
+
|
| 12 |
+
# Modeled after libxml-config.
|
| 13 |
+
|
| 14 |
+
version="1.6.39"
|
| 15 |
+
prefix="/home/aioz-nghiale/anaconda3/envs/testing_softzoo_pointe"
|
| 16 |
+
exec_prefix="${prefix}"
|
| 17 |
+
libdir="${exec_prefix}/lib"
|
| 18 |
+
includedir="${prefix}/include/libpng16"
|
| 19 |
+
libs="-lpng16"
|
| 20 |
+
all_libs="-lpng16 -lm -lz -lm "
|
| 21 |
+
I_opts="-I${includedir}"
|
| 22 |
+
L_opts="-L${libdir}"
|
| 23 |
+
R_opts=""
|
| 24 |
+
cppflags=""
|
| 25 |
+
ccopts=""
|
| 26 |
+
ldopts=""
|
| 27 |
+
|
| 28 |
+
usage()
|
| 29 |
+
{
|
| 30 |
+
cat <<EOF
|
| 31 |
+
Usage: $0 [OPTION] ...
|
| 32 |
+
|
| 33 |
+
Known values for OPTION are:
|
| 34 |
+
|
| 35 |
+
--prefix print libpng prefix
|
| 36 |
+
--libdir print path to directory containing library
|
| 37 |
+
--libs print library linking information
|
| 38 |
+
--ccopts print compiler options
|
| 39 |
+
--cppflags print pre-processor flags
|
| 40 |
+
--cflags print preprocessor flags, I_opts, and compiler options
|
| 41 |
+
--I_opts print "-I" include options
|
| 42 |
+
--L_opts print linker "-L" flags for dynamic linking
|
| 43 |
+
--R_opts print dynamic linker "-R" or "-rpath" flags
|
| 44 |
+
--ldopts print linker options
|
| 45 |
+
--ldflags print linker flags (ldopts, L_opts, R_opts, and libs)
|
| 46 |
+
--static revise subsequent outputs for static linking
|
| 47 |
+
--help print this help and exit
|
| 48 |
+
--version print version information
|
| 49 |
+
EOF
|
| 50 |
+
|
| 51 |
+
exit $1
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
if test $# -eq 0; then
|
| 55 |
+
usage 1
|
| 56 |
+
fi
|
| 57 |
+
|
| 58 |
+
while test $# -gt 0; do
|
| 59 |
+
case "$1" in
|
| 60 |
+
|
| 61 |
+
--prefix)
|
| 62 |
+
echo ${prefix}
|
| 63 |
+
;;
|
| 64 |
+
|
| 65 |
+
--version)
|
| 66 |
+
echo ${version}
|
| 67 |
+
exit 0
|
| 68 |
+
;;
|
| 69 |
+
|
| 70 |
+
--help)
|
| 71 |
+
usage 0
|
| 72 |
+
;;
|
| 73 |
+
|
| 74 |
+
--ccopts)
|
| 75 |
+
echo ${ccopts}
|
| 76 |
+
;;
|
| 77 |
+
|
| 78 |
+
--cppflags)
|
| 79 |
+
echo ${cppflags}
|
| 80 |
+
;;
|
| 81 |
+
|
| 82 |
+
--cflags)
|
| 83 |
+
echo ${I_opts} ${cppflags} ${ccopts}
|
| 84 |
+
;;
|
| 85 |
+
|
| 86 |
+
--libdir)
|
| 87 |
+
echo ${libdir}
|
| 88 |
+
;;
|
| 89 |
+
|
| 90 |
+
--libs)
|
| 91 |
+
echo ${libs}
|
| 92 |
+
;;
|
| 93 |
+
|
| 94 |
+
--I_opts)
|
| 95 |
+
echo ${I_opts}
|
| 96 |
+
;;
|
| 97 |
+
|
| 98 |
+
--L_opts)
|
| 99 |
+
echo ${L_opts}
|
| 100 |
+
;;
|
| 101 |
+
|
| 102 |
+
--R_opts)
|
| 103 |
+
echo ${R_opts}
|
| 104 |
+
;;
|
| 105 |
+
|
| 106 |
+
--ldopts)
|
| 107 |
+
echo ${ldopts}
|
| 108 |
+
;;
|
| 109 |
+
|
| 110 |
+
--ldflags)
|
| 111 |
+
echo ${ldopts} ${L_opts} ${R_opts} ${libs}
|
| 112 |
+
;;
|
| 113 |
+
|
| 114 |
+
--static)
|
| 115 |
+
R_opts=""
|
| 116 |
+
libs=${all_libs}
|
| 117 |
+
;;
|
| 118 |
+
|
| 119 |
+
*)
|
| 120 |
+
usage
|
| 121 |
+
exit 1
|
| 122 |
+
;;
|
| 123 |
+
esac
|
| 124 |
+
shift
|
| 125 |
+
done
|
| 126 |
+
|
| 127 |
+
exit 0
|
bin/libpng16-config
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#! /bin/sh
|
| 2 |
+
|
| 3 |
+
# libpng-config
|
| 4 |
+
# provides configuration info for libpng.
|
| 5 |
+
|
| 6 |
+
# Copyright (C) 2002, 2004, 2006, 2007 Glenn Randers-Pehrson
|
| 7 |
+
|
| 8 |
+
# This code is released under the libpng license.
|
| 9 |
+
# For conditions of distribution and use, see the disclaimer
|
| 10 |
+
# and license in png.h
|
| 11 |
+
|
| 12 |
+
# Modeled after libxml-config.
|
| 13 |
+
|
| 14 |
+
version="1.6.39"
|
| 15 |
+
prefix="/home/aioz-nghiale/anaconda3/envs/testing_softzoo_pointe"
|
| 16 |
+
exec_prefix="${prefix}"
|
| 17 |
+
libdir="${exec_prefix}/lib"
|
| 18 |
+
includedir="${prefix}/include/libpng16"
|
| 19 |
+
libs="-lpng16"
|
| 20 |
+
all_libs="-lpng16 -lm -lz -lm "
|
| 21 |
+
I_opts="-I${includedir}"
|
| 22 |
+
L_opts="-L${libdir}"
|
| 23 |
+
R_opts=""
|
| 24 |
+
cppflags=""
|
| 25 |
+
ccopts=""
|
| 26 |
+
ldopts=""
|
| 27 |
+
|
| 28 |
+
usage()
|
| 29 |
+
{
|
| 30 |
+
cat <<EOF
|
| 31 |
+
Usage: $0 [OPTION] ...
|
| 32 |
+
|
| 33 |
+
Known values for OPTION are:
|
| 34 |
+
|
| 35 |
+
--prefix print libpng prefix
|
| 36 |
+
--libdir print path to directory containing library
|
| 37 |
+
--libs print library linking information
|
| 38 |
+
--ccopts print compiler options
|
| 39 |
+
--cppflags print pre-processor flags
|
| 40 |
+
--cflags print preprocessor flags, I_opts, and compiler options
|
| 41 |
+
--I_opts print "-I" include options
|
| 42 |
+
--L_opts print linker "-L" flags for dynamic linking
|
| 43 |
+
--R_opts print dynamic linker "-R" or "-rpath" flags
|
| 44 |
+
--ldopts print linker options
|
| 45 |
+
--ldflags print linker flags (ldopts, L_opts, R_opts, and libs)
|
| 46 |
+
--static revise subsequent outputs for static linking
|
| 47 |
+
--help print this help and exit
|
| 48 |
+
--version print version information
|
| 49 |
+
EOF
|
| 50 |
+
|
| 51 |
+
exit $1
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
if test $# -eq 0; then
|
| 55 |
+
usage 1
|
| 56 |
+
fi
|
| 57 |
+
|
| 58 |
+
while test $# -gt 0; do
|
| 59 |
+
case "$1" in
|
| 60 |
+
|
| 61 |
+
--prefix)
|
| 62 |
+
echo ${prefix}
|
| 63 |
+
;;
|
| 64 |
+
|
| 65 |
+
--version)
|
| 66 |
+
echo ${version}
|
| 67 |
+
exit 0
|
| 68 |
+
;;
|
| 69 |
+
|
| 70 |
+
--help)
|
| 71 |
+
usage 0
|
| 72 |
+
;;
|
| 73 |
+
|
| 74 |
+
--ccopts)
|
| 75 |
+
echo ${ccopts}
|
| 76 |
+
;;
|
| 77 |
+
|
| 78 |
+
--cppflags)
|
| 79 |
+
echo ${cppflags}
|
| 80 |
+
;;
|
| 81 |
+
|
| 82 |
+
--cflags)
|
| 83 |
+
echo ${I_opts} ${cppflags} ${ccopts}
|
| 84 |
+
;;
|
| 85 |
+
|
| 86 |
+
--libdir)
|
| 87 |
+
echo ${libdir}
|
| 88 |
+
;;
|
| 89 |
+
|
| 90 |
+
--libs)
|
| 91 |
+
echo ${libs}
|
| 92 |
+
;;
|
| 93 |
+
|
| 94 |
+
--I_opts)
|
| 95 |
+
echo ${I_opts}
|
| 96 |
+
;;
|
| 97 |
+
|
| 98 |
+
--L_opts)
|
| 99 |
+
echo ${L_opts}
|
| 100 |
+
;;
|
| 101 |
+
|
| 102 |
+
--R_opts)
|
| 103 |
+
echo ${R_opts}
|
| 104 |
+
;;
|
| 105 |
+
|
| 106 |
+
--ldopts)
|
| 107 |
+
echo ${ldopts}
|
| 108 |
+
;;
|
| 109 |
+
|
| 110 |
+
--ldflags)
|
| 111 |
+
echo ${ldopts} ${L_opts} ${R_opts} ${libs}
|
| 112 |
+
;;
|
| 113 |
+
|
| 114 |
+
--static)
|
| 115 |
+
R_opts=""
|
| 116 |
+
libs=${all_libs}
|
| 117 |
+
;;
|
| 118 |
+
|
| 119 |
+
*)
|
| 120 |
+
usage
|
| 121 |
+
exit 1
|
| 122 |
+
;;
|
| 123 |
+
esac
|
| 124 |
+
shift
|
| 125 |
+
done
|
| 126 |
+
|
| 127 |
+
exit 0
|
bin/linkicc
ADDED
|
Binary file (31.5 kB). View file
|
|
|
bin/lsm2bin
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/home/aioz-nghiale/anaconda3/envs/testing_softzoo_pointe/bin/python3.10
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from tifffile.lsm2bin import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
bin/lzcmp
ADDED
|
@@ -0,0 +1,220 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
# SPDX-License-Identifier: GPL-2.0-or-later
|
| 3 |
+
|
| 4 |
+
# Copyright (C) 1998, 2002, 2006, 2007 Free Software Foundation
|
| 5 |
+
# Copyright (C) 1993 Jean-loup Gailly
|
| 6 |
+
|
| 7 |
+
# Modified for XZ Utils by Andrew Dudman and Lasse Collin.
|
| 8 |
+
|
| 9 |
+
# This program is free software; you can redistribute it and/or modify
|
| 10 |
+
# it under the terms of the GNU General Public License as published by
|
| 11 |
+
# the Free Software Foundation; either version 2 of the License, or
|
| 12 |
+
# (at your option) any later version.
|
| 13 |
+
|
| 14 |
+
# This program is distributed in the hope that it will be useful,
|
| 15 |
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 16 |
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 17 |
+
# GNU General Public License for more details.
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
#SET_PATH - This line is a placeholder to ease patching this script.
|
| 21 |
+
|
| 22 |
+
# Instead of unsetting XZ_OPT, just make sure that xz will use file format
|
| 23 |
+
# autodetection. This way memory usage limit and thread limit can be
|
| 24 |
+
# specified via XZ_OPT. With gzip, bzip2, and lzop it's OK to just unset the
|
| 25 |
+
# environment variables.
|
| 26 |
+
xz='xz --format=auto'
|
| 27 |
+
unset GZIP BZIP BZIP2 LZOP
|
| 28 |
+
|
| 29 |
+
case ${0##*/} in
|
| 30 |
+
*cmp*) prog=xzcmp; cmp=${CMP:-cmp};;
|
| 31 |
+
*) prog=xzdiff; cmp=${DIFF:-diff};;
|
| 32 |
+
esac
|
| 33 |
+
|
| 34 |
+
version="$prog (XZ Utils) 5.6.4"
|
| 35 |
+
|
| 36 |
+
usage="Usage: ${0##*/} [OPTION]... FILE1 [FILE2]
|
| 37 |
+
Compare FILE1 to FILE2, using their uncompressed contents if they are
|
| 38 |
+
compressed. If FILE2 is omitted, then the files compared are FILE1 and
|
| 39 |
+
FILE1 from which the compression format suffix has been stripped.
|
| 40 |
+
|
| 41 |
+
Do comparisons like '$cmp' does. OPTIONs are the same as for '$cmp'.
|
| 42 |
+
|
| 43 |
+
Report bugs to <xz@tukaani.org>."
|
| 44 |
+
|
| 45 |
+
# sed script to escape all ' for the shell, and then (to handle trailing
|
| 46 |
+
# newlines correctly) turn trailing X on last line into '.
|
| 47 |
+
escape='
|
| 48 |
+
s/'\''/'\''\\'\'''\''/g
|
| 49 |
+
$s/X$/'\''/
|
| 50 |
+
'
|
| 51 |
+
|
| 52 |
+
while :; do
|
| 53 |
+
case $1 in
|
| 54 |
+
--h*) printf '%s\n' "$usage" || exit 2; exit;;
|
| 55 |
+
--v*) printf '%s\n' "$version" || exit 2; exit;;
|
| 56 |
+
--) shift; break;;
|
| 57 |
+
-*\'*) cmp="$cmp '"`printf '%sX\n' "$1" | sed "$escape"`;;
|
| 58 |
+
-?*) cmp="$cmp '$1'";;
|
| 59 |
+
*) break;;
|
| 60 |
+
esac
|
| 61 |
+
shift
|
| 62 |
+
done
|
| 63 |
+
cmp="$cmp --"
|
| 64 |
+
|
| 65 |
+
for file; do
|
| 66 |
+
test "X$file" = X- || <"$file" || exit 2
|
| 67 |
+
done
|
| 68 |
+
|
| 69 |
+
# xz needs -qQ to ignore warnings like unsupported check type.
|
| 70 |
+
xz1="$xz -qQ"
|
| 71 |
+
xz2="$xz -qQ"
|
| 72 |
+
xz_status=0
|
| 73 |
+
exec 3>&1
|
| 74 |
+
|
| 75 |
+
if test $# -eq 1; then
|
| 76 |
+
case $1 in
|
| 77 |
+
*[-.]xz | *[-.]lzma | *[-.]lz | *.t[lx]z)
|
| 78 |
+
;;
|
| 79 |
+
*[-.]bz2 | *.tbz | *.tbz2)
|
| 80 |
+
xz1=bzip2;;
|
| 81 |
+
*[-.][zZ] | *_z | *[-.]gz | *.t[ag]z)
|
| 82 |
+
xz1=gzip;;
|
| 83 |
+
*[-.]lzo | *.tzo)
|
| 84 |
+
xz1=lzop;;
|
| 85 |
+
*[-.]zst | *.tzst)
|
| 86 |
+
xz1='zstd -q';;
|
| 87 |
+
*[-.]lz4)
|
| 88 |
+
xz1=lz4;;
|
| 89 |
+
*)
|
| 90 |
+
printf '%s\n' "$0: $1: Unknown compressed file name suffix" >&2
|
| 91 |
+
exit 2;;
|
| 92 |
+
esac
|
| 93 |
+
case $1 in
|
| 94 |
+
*[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *[-.]lz | *[-.]lzo | *[-.]zst | *[-.]lz4)
|
| 95 |
+
FILE=`expr "X$1" : 'X\(.*\)[-.][abglmostxzZ24]*$'`;;
|
| 96 |
+
*.t[abglx]z)
|
| 97 |
+
FILE=`expr "X$1" : 'X\(.*[-.]t\)[abglx]z$'`ar;;
|
| 98 |
+
*.tbz2)
|
| 99 |
+
FILE=`expr "X$1" : 'X\(.*[-.]t\)bz2$'`ar;;
|
| 100 |
+
*.tzo)
|
| 101 |
+
FILE=`expr "X$1" : 'X\(.*[-.]t\)zo$'`ar;;
|
| 102 |
+
*.tzst)
|
| 103 |
+
FILE=`expr "X$1" : 'X\(.*[-.]t\)zst$'`ar;;
|
| 104 |
+
esac
|
| 105 |
+
xz_status=$(
|
| 106 |
+
exec 4>&1
|
| 107 |
+
($xz1 -cd -- "$1" 4>&-; echo $? >&4) 3>&- | eval "$cmp" - '"$FILE"' >&3
|
| 108 |
+
)
|
| 109 |
+
elif test $# -eq 2; then
|
| 110 |
+
case $1 in
|
| 111 |
+
*[-.]bz2 | *.tbz | *.tbz2) xz1=bzip2;;
|
| 112 |
+
*[-.][zZ] | *_z | *[-.]gz | *.t[ag]z) xz1=gzip;;
|
| 113 |
+
*[-.]lzo | *.tzo) xz1=lzop;;
|
| 114 |
+
*[-.]zst | *.tzst) xz1='zstd -q';;
|
| 115 |
+
*[-.]lz4) xz1=lz4;;
|
| 116 |
+
esac
|
| 117 |
+
case $2 in
|
| 118 |
+
*[-.]bz2 | *.tbz | *.tbz2) xz2=bzip2;;
|
| 119 |
+
*[-.][zZ] | *_z | *[-.]gz | *.t[ag]z) xz2=gzip;;
|
| 120 |
+
*[-.]lzo | *.tzo) xz2=lzop;;
|
| 121 |
+
*[-.]zst | *.tzst) xz2='zstd -q';;
|
| 122 |
+
*[-.]lz4) xz2=lz4;;
|
| 123 |
+
esac
|
| 124 |
+
case $1 in
|
| 125 |
+
*[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *[-.]lz | *.t[abglx]z | *.tbz2 | *[-.]lzo | *.tzo | *[-.]zst | *.tzst | *[-.]lz4 | -)
|
| 126 |
+
case "$2" in
|
| 127 |
+
*[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *[-.]lz | *.t[abglx]z | *.tbz2 | *[-.]lzo | *.tzo | *[-.]zst | *.tzst | *[-.]lz4 | -)
|
| 128 |
+
if test "$1$2" = --; then
|
| 129 |
+
xz_status=$(
|
| 130 |
+
exec 4>&1
|
| 131 |
+
($xz1 -cdf - 4>&-; echo $? >&4) 3>&- |
|
| 132 |
+
eval "$cmp" - - >&3
|
| 133 |
+
)
|
| 134 |
+
elif # Reject Solaris 8's buggy /bin/bash 2.03.
|
| 135 |
+
echo X | (echo X | eval "$cmp" /dev/fd/5 - >/dev/null 2>&1) 5<&0; then
|
| 136 |
+
# NOTE: xz_status will contain two numbers.
|
| 137 |
+
xz_status=$(
|
| 138 |
+
exec 4>&1
|
| 139 |
+
($xz1 -cdf -- "$1" 4>&-; echo $? >&4) 3>&- |
|
| 140 |
+
( ($xz2 -cdf -- "$2" 4>&-; echo $? >&4) 3>&- 5<&- </dev/null |
|
| 141 |
+
eval "$cmp" /dev/fd/5 - >&3) 5<&0
|
| 142 |
+
)
|
| 143 |
+
else
|
| 144 |
+
F=`expr "/$2" : '.*/\(.*\)[-.][ablmotxz2]*$'` || F=$prog
|
| 145 |
+
tmp=
|
| 146 |
+
trap '
|
| 147 |
+
test -n "$tmp" && rm -rf "$tmp"
|
| 148 |
+
(exit 2); exit 2
|
| 149 |
+
' HUP INT PIPE TERM 0
|
| 150 |
+
if type mktemp >/dev/null 2>&1; then
|
| 151 |
+
# Note that FreeBSD's mktemp isn't fully compatible with
|
| 152 |
+
# the implementations from mktemp.org and GNU coreutils.
|
| 153 |
+
# It is important that the -t argument is the last argument
|
| 154 |
+
# and that no "--" is used between -t and the template argument.
|
| 155 |
+
# This way this command works on all implementations.
|
| 156 |
+
tmp=`mktemp -d -t "$prog.XXXXXXXXXX"` || exit 2
|
| 157 |
+
else
|
| 158 |
+
# Fallback code if mktemp is missing. This isn't as
|
| 159 |
+
# robust as using mktemp since this doesn't try with
|
| 160 |
+
# different file names in case of a file name conflict.
|
| 161 |
+
#
|
| 162 |
+
# There's no need to save the original umask since
|
| 163 |
+
# we don't create any non-temp files. Note that using
|
| 164 |
+
# mkdir -m 0077 isn't secure since some mkdir implementations
|
| 165 |
+
# create the dir with the default umask and chmod the
|
| 166 |
+
# the dir afterwards.
|
| 167 |
+
umask 0077
|
| 168 |
+
mkdir -- "${TMPDIR-/tmp}/$prog.$$" || exit 2
|
| 169 |
+
tmp="${TMPDIR-/tmp}/$prog.$$"
|
| 170 |
+
fi
|
| 171 |
+
$xz2 -cdf -- "$2" > "$tmp/$F" || exit 2
|
| 172 |
+
xz_status=$(
|
| 173 |
+
exec 4>&1
|
| 174 |
+
($xz1 -cdf -- "$1" 4>&-; echo $? >&4) 3>&- |
|
| 175 |
+
eval "$cmp" - '"$tmp/$F"' >&3
|
| 176 |
+
)
|
| 177 |
+
cmp_status=$?
|
| 178 |
+
rm -rf "$tmp" || xz_status=$?
|
| 179 |
+
trap - HUP INT PIPE TERM 0
|
| 180 |
+
(exit $cmp_status)
|
| 181 |
+
fi;;
|
| 182 |
+
*)
|
| 183 |
+
xz_status=$(
|
| 184 |
+
exec 4>&1
|
| 185 |
+
($xz1 -cdf -- "$1" 4>&-; echo $? >&4) 3>&- |
|
| 186 |
+
eval "$cmp" - '"$2"' >&3
|
| 187 |
+
);;
|
| 188 |
+
esac;;
|
| 189 |
+
*)
|
| 190 |
+
case "$2" in
|
| 191 |
+
*[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *[-.]lz | *.t[abglx]z | *.tbz2 | *[-.]lzo | *.tzo | *[-.]zst | *.tzst | *[-.]lz4 | -)
|
| 192 |
+
xz_status=$(
|
| 193 |
+
exec 4>&1
|
| 194 |
+
($xz2 -cdf -- "$2" 4>&-; echo $? >&4) 3>&- |
|
| 195 |
+
eval "$cmp" '"$1"' - >&3
|
| 196 |
+
);;
|
| 197 |
+
*)
|
| 198 |
+
eval "$cmp" '"$1"' '"$2"';;
|
| 199 |
+
esac;;
|
| 200 |
+
esac
|
| 201 |
+
else
|
| 202 |
+
printf '%s\n' "$0: Invalid number of operands; try '${0##*/} --help' for help" >&2
|
| 203 |
+
exit 2
|
| 204 |
+
fi
|
| 205 |
+
|
| 206 |
+
cmp_status=$?
|
| 207 |
+
for num in $xz_status ; do
|
| 208 |
+
# 0 from decompressor means successful decompression. SIGPIPE from
|
| 209 |
+
# decompressor is possible when diff or cmp exits before the whole file
|
| 210 |
+
# has been decompressed. In that case we want to retain the exit status
|
| 211 |
+
# from diff or cmp. Note that using "trap '' PIPE" is not possible
|
| 212 |
+
# because gzip changes its behavior (including exit status) if SIGPIPE
|
| 213 |
+
# is ignored.
|
| 214 |
+
test "$num" -eq 0 && continue
|
| 215 |
+
test "$num" -ge 128 \
|
| 216 |
+
&& test "$(kill -l "$num" 2> /dev/null)" = "PIPE" \
|
| 217 |
+
&& continue
|
| 218 |
+
exit 2
|
| 219 |
+
done
|
| 220 |
+
exit $cmp_status
|
bin/lzdiff
ADDED
|
@@ -0,0 +1,220 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
# SPDX-License-Identifier: GPL-2.0-or-later
|
| 3 |
+
|
| 4 |
+
# Copyright (C) 1998, 2002, 2006, 2007 Free Software Foundation
|
| 5 |
+
# Copyright (C) 1993 Jean-loup Gailly
|
| 6 |
+
|
| 7 |
+
# Modified for XZ Utils by Andrew Dudman and Lasse Collin.
|
| 8 |
+
|
| 9 |
+
# This program is free software; you can redistribute it and/or modify
|
| 10 |
+
# it under the terms of the GNU General Public License as published by
|
| 11 |
+
# the Free Software Foundation; either version 2 of the License, or
|
| 12 |
+
# (at your option) any later version.
|
| 13 |
+
|
| 14 |
+
# This program is distributed in the hope that it will be useful,
|
| 15 |
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 16 |
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 17 |
+
# GNU General Public License for more details.
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
#SET_PATH - This line is a placeholder to ease patching this script.
|
| 21 |
+
|
| 22 |
+
# Instead of unsetting XZ_OPT, just make sure that xz will use file format
|
| 23 |
+
# autodetection. This way memory usage limit and thread limit can be
|
| 24 |
+
# specified via XZ_OPT. With gzip, bzip2, and lzop it's OK to just unset the
|
| 25 |
+
# environment variables.
|
| 26 |
+
xz='xz --format=auto'
|
| 27 |
+
unset GZIP BZIP BZIP2 LZOP
|
| 28 |
+
|
| 29 |
+
case ${0##*/} in
|
| 30 |
+
*cmp*) prog=xzcmp; cmp=${CMP:-cmp};;
|
| 31 |
+
*) prog=xzdiff; cmp=${DIFF:-diff};;
|
| 32 |
+
esac
|
| 33 |
+
|
| 34 |
+
version="$prog (XZ Utils) 5.6.4"
|
| 35 |
+
|
| 36 |
+
usage="Usage: ${0##*/} [OPTION]... FILE1 [FILE2]
|
| 37 |
+
Compare FILE1 to FILE2, using their uncompressed contents if they are
|
| 38 |
+
compressed. If FILE2 is omitted, then the files compared are FILE1 and
|
| 39 |
+
FILE1 from which the compression format suffix has been stripped.
|
| 40 |
+
|
| 41 |
+
Do comparisons like '$cmp' does. OPTIONs are the same as for '$cmp'.
|
| 42 |
+
|
| 43 |
+
Report bugs to <xz@tukaani.org>."
|
| 44 |
+
|
| 45 |
+
# sed script to escape all ' for the shell, and then (to handle trailing
|
| 46 |
+
# newlines correctly) turn trailing X on last line into '.
|
| 47 |
+
escape='
|
| 48 |
+
s/'\''/'\''\\'\'''\''/g
|
| 49 |
+
$s/X$/'\''/
|
| 50 |
+
'
|
| 51 |
+
|
| 52 |
+
while :; do
|
| 53 |
+
case $1 in
|
| 54 |
+
--h*) printf '%s\n' "$usage" || exit 2; exit;;
|
| 55 |
+
--v*) printf '%s\n' "$version" || exit 2; exit;;
|
| 56 |
+
--) shift; break;;
|
| 57 |
+
-*\'*) cmp="$cmp '"`printf '%sX\n' "$1" | sed "$escape"`;;
|
| 58 |
+
-?*) cmp="$cmp '$1'";;
|
| 59 |
+
*) break;;
|
| 60 |
+
esac
|
| 61 |
+
shift
|
| 62 |
+
done
|
| 63 |
+
cmp="$cmp --"
|
| 64 |
+
|
| 65 |
+
for file; do
|
| 66 |
+
test "X$file" = X- || <"$file" || exit 2
|
| 67 |
+
done
|
| 68 |
+
|
| 69 |
+
# xz needs -qQ to ignore warnings like unsupported check type.
|
| 70 |
+
xz1="$xz -qQ"
|
| 71 |
+
xz2="$xz -qQ"
|
| 72 |
+
xz_status=0
|
| 73 |
+
exec 3>&1
|
| 74 |
+
|
| 75 |
+
if test $# -eq 1; then
|
| 76 |
+
case $1 in
|
| 77 |
+
*[-.]xz | *[-.]lzma | *[-.]lz | *.t[lx]z)
|
| 78 |
+
;;
|
| 79 |
+
*[-.]bz2 | *.tbz | *.tbz2)
|
| 80 |
+
xz1=bzip2;;
|
| 81 |
+
*[-.][zZ] | *_z | *[-.]gz | *.t[ag]z)
|
| 82 |
+
xz1=gzip;;
|
| 83 |
+
*[-.]lzo | *.tzo)
|
| 84 |
+
xz1=lzop;;
|
| 85 |
+
*[-.]zst | *.tzst)
|
| 86 |
+
xz1='zstd -q';;
|
| 87 |
+
*[-.]lz4)
|
| 88 |
+
xz1=lz4;;
|
| 89 |
+
*)
|
| 90 |
+
printf '%s\n' "$0: $1: Unknown compressed file name suffix" >&2
|
| 91 |
+
exit 2;;
|
| 92 |
+
esac
|
| 93 |
+
case $1 in
|
| 94 |
+
*[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *[-.]lz | *[-.]lzo | *[-.]zst | *[-.]lz4)
|
| 95 |
+
FILE=`expr "X$1" : 'X\(.*\)[-.][abglmostxzZ24]*$'`;;
|
| 96 |
+
*.t[abglx]z)
|
| 97 |
+
FILE=`expr "X$1" : 'X\(.*[-.]t\)[abglx]z$'`ar;;
|
| 98 |
+
*.tbz2)
|
| 99 |
+
FILE=`expr "X$1" : 'X\(.*[-.]t\)bz2$'`ar;;
|
| 100 |
+
*.tzo)
|
| 101 |
+
FILE=`expr "X$1" : 'X\(.*[-.]t\)zo$'`ar;;
|
| 102 |
+
*.tzst)
|
| 103 |
+
FILE=`expr "X$1" : 'X\(.*[-.]t\)zst$'`ar;;
|
| 104 |
+
esac
|
| 105 |
+
xz_status=$(
|
| 106 |
+
exec 4>&1
|
| 107 |
+
($xz1 -cd -- "$1" 4>&-; echo $? >&4) 3>&- | eval "$cmp" - '"$FILE"' >&3
|
| 108 |
+
)
|
| 109 |
+
elif test $# -eq 2; then
|
| 110 |
+
case $1 in
|
| 111 |
+
*[-.]bz2 | *.tbz | *.tbz2) xz1=bzip2;;
|
| 112 |
+
*[-.][zZ] | *_z | *[-.]gz | *.t[ag]z) xz1=gzip;;
|
| 113 |
+
*[-.]lzo | *.tzo) xz1=lzop;;
|
| 114 |
+
*[-.]zst | *.tzst) xz1='zstd -q';;
|
| 115 |
+
*[-.]lz4) xz1=lz4;;
|
| 116 |
+
esac
|
| 117 |
+
case $2 in
|
| 118 |
+
*[-.]bz2 | *.tbz | *.tbz2) xz2=bzip2;;
|
| 119 |
+
*[-.][zZ] | *_z | *[-.]gz | *.t[ag]z) xz2=gzip;;
|
| 120 |
+
*[-.]lzo | *.tzo) xz2=lzop;;
|
| 121 |
+
*[-.]zst | *.tzst) xz2='zstd -q';;
|
| 122 |
+
*[-.]lz4) xz2=lz4;;
|
| 123 |
+
esac
|
| 124 |
+
case $1 in
|
| 125 |
+
*[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *[-.]lz | *.t[abglx]z | *.tbz2 | *[-.]lzo | *.tzo | *[-.]zst | *.tzst | *[-.]lz4 | -)
|
| 126 |
+
case "$2" in
|
| 127 |
+
*[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *[-.]lz | *.t[abglx]z | *.tbz2 | *[-.]lzo | *.tzo | *[-.]zst | *.tzst | *[-.]lz4 | -)
|
| 128 |
+
if test "$1$2" = --; then
|
| 129 |
+
xz_status=$(
|
| 130 |
+
exec 4>&1
|
| 131 |
+
($xz1 -cdf - 4>&-; echo $? >&4) 3>&- |
|
| 132 |
+
eval "$cmp" - - >&3
|
| 133 |
+
)
|
| 134 |
+
elif # Reject Solaris 8's buggy /bin/bash 2.03.
|
| 135 |
+
echo X | (echo X | eval "$cmp" /dev/fd/5 - >/dev/null 2>&1) 5<&0; then
|
| 136 |
+
# NOTE: xz_status will contain two numbers.
|
| 137 |
+
xz_status=$(
|
| 138 |
+
exec 4>&1
|
| 139 |
+
($xz1 -cdf -- "$1" 4>&-; echo $? >&4) 3>&- |
|
| 140 |
+
( ($xz2 -cdf -- "$2" 4>&-; echo $? >&4) 3>&- 5<&- </dev/null |
|
| 141 |
+
eval "$cmp" /dev/fd/5 - >&3) 5<&0
|
| 142 |
+
)
|
| 143 |
+
else
|
| 144 |
+
F=`expr "/$2" : '.*/\(.*\)[-.][ablmotxz2]*$'` || F=$prog
|
| 145 |
+
tmp=
|
| 146 |
+
trap '
|
| 147 |
+
test -n "$tmp" && rm -rf "$tmp"
|
| 148 |
+
(exit 2); exit 2
|
| 149 |
+
' HUP INT PIPE TERM 0
|
| 150 |
+
if type mktemp >/dev/null 2>&1; then
|
| 151 |
+
# Note that FreeBSD's mktemp isn't fully compatible with
|
| 152 |
+
# the implementations from mktemp.org and GNU coreutils.
|
| 153 |
+
# It is important that the -t argument is the last argument
|
| 154 |
+
# and that no "--" is used between -t and the template argument.
|
| 155 |
+
# This way this command works on all implementations.
|
| 156 |
+
tmp=`mktemp -d -t "$prog.XXXXXXXXXX"` || exit 2
|
| 157 |
+
else
|
| 158 |
+
# Fallback code if mktemp is missing. This isn't as
|
| 159 |
+
# robust as using mktemp since this doesn't try with
|
| 160 |
+
# different file names in case of a file name conflict.
|
| 161 |
+
#
|
| 162 |
+
# There's no need to save the original umask since
|
| 163 |
+
# we don't create any non-temp files. Note that using
|
| 164 |
+
# mkdir -m 0077 isn't secure since some mkdir implementations
|
| 165 |
+
# create the dir with the default umask and chmod the
|
| 166 |
+
# the dir afterwards.
|
| 167 |
+
umask 0077
|
| 168 |
+
mkdir -- "${TMPDIR-/tmp}/$prog.$$" || exit 2
|
| 169 |
+
tmp="${TMPDIR-/tmp}/$prog.$$"
|
| 170 |
+
fi
|
| 171 |
+
$xz2 -cdf -- "$2" > "$tmp/$F" || exit 2
|
| 172 |
+
xz_status=$(
|
| 173 |
+
exec 4>&1
|
| 174 |
+
($xz1 -cdf -- "$1" 4>&-; echo $? >&4) 3>&- |
|
| 175 |
+
eval "$cmp" - '"$tmp/$F"' >&3
|
| 176 |
+
)
|
| 177 |
+
cmp_status=$?
|
| 178 |
+
rm -rf "$tmp" || xz_status=$?
|
| 179 |
+
trap - HUP INT PIPE TERM 0
|
| 180 |
+
(exit $cmp_status)
|
| 181 |
+
fi;;
|
| 182 |
+
*)
|
| 183 |
+
xz_status=$(
|
| 184 |
+
exec 4>&1
|
| 185 |
+
($xz1 -cdf -- "$1" 4>&-; echo $? >&4) 3>&- |
|
| 186 |
+
eval "$cmp" - '"$2"' >&3
|
| 187 |
+
);;
|
| 188 |
+
esac;;
|
| 189 |
+
*)
|
| 190 |
+
case "$2" in
|
| 191 |
+
*[-.][zZ] | *_z | *[-.][gx]z | *[-.]bz2 | *[-.]lzma | *[-.]lz | *.t[abglx]z | *.tbz2 | *[-.]lzo | *.tzo | *[-.]zst | *.tzst | *[-.]lz4 | -)
|
| 192 |
+
xz_status=$(
|
| 193 |
+
exec 4>&1
|
| 194 |
+
($xz2 -cdf -- "$2" 4>&-; echo $? >&4) 3>&- |
|
| 195 |
+
eval "$cmp" '"$1"' - >&3
|
| 196 |
+
);;
|
| 197 |
+
*)
|
| 198 |
+
eval "$cmp" '"$1"' '"$2"';;
|
| 199 |
+
esac;;
|
| 200 |
+
esac
|
| 201 |
+
else
|
| 202 |
+
printf '%s\n' "$0: Invalid number of operands; try '${0##*/} --help' for help" >&2
|
| 203 |
+
exit 2
|
| 204 |
+
fi
|
| 205 |
+
|
| 206 |
+
cmp_status=$?
|
| 207 |
+
for num in $xz_status ; do
|
| 208 |
+
# 0 from decompressor means successful decompression. SIGPIPE from
|
| 209 |
+
# decompressor is possible when diff or cmp exits before the whole file
|
| 210 |
+
# has been decompressed. In that case we want to retain the exit status
|
| 211 |
+
# from diff or cmp. Note that using "trap '' PIPE" is not possible
|
| 212 |
+
# because gzip changes its behavior (including exit status) if SIGPIPE
|
| 213 |
+
# is ignored.
|
| 214 |
+
test "$num" -eq 0 && continue
|
| 215 |
+
test "$num" -ge 128 \
|
| 216 |
+
&& test "$(kill -l "$num" 2> /dev/null)" = "PIPE" \
|
| 217 |
+
&& continue
|
| 218 |
+
exit 2
|
| 219 |
+
done
|
| 220 |
+
exit $cmp_status
|
bin/lzegrep
ADDED
|
@@ -0,0 +1,300 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
# SPDX-License-Identifier: GPL-2.0-or-later
|
| 3 |
+
|
| 4 |
+
# xzgrep -- a wrapper around a grep program that decompresses files as needed
|
| 5 |
+
# Adapted from a version sent by Charles Levert <charles@comm.polymtl.ca>
|
| 6 |
+
|
| 7 |
+
# Copyright (C) 1998, 2001, 2002, 2006, 2007 Free Software Foundation
|
| 8 |
+
# Copyright (C) 1993 Jean-loup Gailly
|
| 9 |
+
|
| 10 |
+
# Modified for XZ Utils by Andrew Dudman and Lasse Collin.
|
| 11 |
+
|
| 12 |
+
# This program is free software; you can redistribute it and/or modify
|
| 13 |
+
# it under the terms of the GNU General Public License as published by
|
| 14 |
+
# the Free Software Foundation; either version 2 of the License, or
|
| 15 |
+
# (at your option) any later version.
|
| 16 |
+
|
| 17 |
+
# This program is distributed in the hope that it will be useful,
|
| 18 |
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 19 |
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 20 |
+
# GNU General Public License for more details.
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
#SET_PATH - This line is a placeholder to ease patching this script.
|
| 24 |
+
|
| 25 |
+
# Instead of unsetting XZ_OPT, just make sure that xz will use file format
|
| 26 |
+
# autodetection. This way memory usage limit and thread limit can be
|
| 27 |
+
# specified via XZ_OPT. With gzip, bzip2, and lzop it's OK to just unset the
|
| 28 |
+
# environment variables.
|
| 29 |
+
xz='xz --format=auto'
|
| 30 |
+
unset GZIP BZIP BZIP2 LZOP
|
| 31 |
+
|
| 32 |
+
case ${0##*/} in
|
| 33 |
+
*egrep*) prog=xzegrep; grep=${GREP:-grep -E};;
|
| 34 |
+
*fgrep*) prog=xzfgrep; grep=${GREP:-grep -F};;
|
| 35 |
+
*) prog=xzgrep; grep=${GREP:-grep};;
|
| 36 |
+
esac
|
| 37 |
+
|
| 38 |
+
version="$prog (XZ Utils) 5.6.4"
|
| 39 |
+
|
| 40 |
+
usage="Usage: ${0##*/} [OPTION]... [-e] PATTERN [FILE]...
|
| 41 |
+
Look for instances of PATTERN in the input FILEs, using their
|
| 42 |
+
uncompressed contents if they are compressed.
|
| 43 |
+
|
| 44 |
+
OPTIONs are the same as for '$grep'.
|
| 45 |
+
|
| 46 |
+
Report bugs to <xz@tukaani.org>."
|
| 47 |
+
|
| 48 |
+
# sed script to escape all ' for the shell, and then (to handle trailing
|
| 49 |
+
# newlines correctly) turn trailing X on last line into '.
|
| 50 |
+
escape='
|
| 51 |
+
s/'\''/'\''\\'\'''\''/g
|
| 52 |
+
$s/X$/'\''/
|
| 53 |
+
'
|
| 54 |
+
operands=
|
| 55 |
+
have_pat=0
|
| 56 |
+
files_with_matches=0
|
| 57 |
+
files_without_matches=0
|
| 58 |
+
no_filename=0
|
| 59 |
+
with_filename=0
|
| 60 |
+
|
| 61 |
+
# See if -H and --label options are supported (GNU and *BSDs).
|
| 62 |
+
if test f:x = "$(eval "echo x | $grep -H --label=f x 2> /dev/null")"; then
|
| 63 |
+
grep_supports_label=1
|
| 64 |
+
else
|
| 65 |
+
grep_supports_label=0
|
| 66 |
+
fi
|
| 67 |
+
|
| 68 |
+
while test $# -ne 0; do
|
| 69 |
+
option=$1
|
| 70 |
+
shift
|
| 71 |
+
optarg=
|
| 72 |
+
|
| 73 |
+
case $option in
|
| 74 |
+
(-[0123456789abcdEFGhHiIKlLnoPqrRsTuUvVwxyzZ]*[!0123456789]*)
|
| 75 |
+
# Something like -Fiv was specified, that is, $option contains more
|
| 76 |
+
# than one option of which the first option (in this example -F)
|
| 77 |
+
# doesn't take an argument. Split the first option into a standalone
|
| 78 |
+
# argument and continue parsing the rest of the options (in this example,
|
| 79 |
+
# replace -Fiv with -iv in the argument list and set option=-F).
|
| 80 |
+
#
|
| 81 |
+
# If there are digits [0-9] they are treated as if they were a single
|
| 82 |
+
# option character because this syntax is an alias for -C for GNU grep.
|
| 83 |
+
# For example, "grep -25F" is equivalent to "grep -C25 -F". If only
|
| 84 |
+
# digits are specified like "grep -25" we don't get here because the
|
| 85 |
+
# above pattern in the case-statement doesn't match such strings.
|
| 86 |
+
arg2=-\'$(LC_ALL=C expr "X${option}X" : 'X-.[0-9]*\(.*\)' |
|
| 87 |
+
LC_ALL=C sed "$escape")
|
| 88 |
+
eval "set -- $arg2 "'${1+"$@"}'
|
| 89 |
+
option=$(LC_ALL=C expr "X$option" : 'X\(-.[0-9]*\)');;
|
| 90 |
+
(--binary-*=* | --[lm]a*=* | --reg*=*)
|
| 91 |
+
# These options require an argument and an argument has been provided
|
| 92 |
+
# with the --foo=argument syntax. All is good.
|
| 93 |
+
;;
|
| 94 |
+
(-[ABCDefmX] | --binary-* | --file | --[lm]a* | --reg*)
|
| 95 |
+
# These options require an argument which should now be in $1.
|
| 96 |
+
# If it isn't, display an error and exit.
|
| 97 |
+
case ${1?"$option option requires an argument"} in
|
| 98 |
+
(*\'*)
|
| 99 |
+
optarg=" '"$(printf '%sX\n' "$1" | LC_ALL=C sed "$escape");;
|
| 100 |
+
(*)
|
| 101 |
+
optarg=" '$1'";;
|
| 102 |
+
esac
|
| 103 |
+
shift;;
|
| 104 |
+
(--)
|
| 105 |
+
break;;
|
| 106 |
+
(-?*)
|
| 107 |
+
;;
|
| 108 |
+
(*)
|
| 109 |
+
case $option in
|
| 110 |
+
(*\'*)
|
| 111 |
+
operands="$operands '"$(printf '%sX\n' "$option" |
|
| 112 |
+
LC_ALL=C sed "$escape");;
|
| 113 |
+
(*)
|
| 114 |
+
operands="$operands '$option'";;
|
| 115 |
+
esac
|
| 116 |
+
${POSIXLY_CORRECT+break}
|
| 117 |
+
continue;;
|
| 118 |
+
esac
|
| 119 |
+
|
| 120 |
+
case $option in
|
| 121 |
+
(-[drRzZ] | --di* | --exc* | --inc* | --rec* | --nu*)
|
| 122 |
+
printf >&2 '%s: %s: Option not supported\n' "$0" "$option"
|
| 123 |
+
exit 2;;
|
| 124 |
+
(-[ef]* | --file | --file=* | --reg*)
|
| 125 |
+
have_pat=1;;
|
| 126 |
+
(--h | --he | --hel | --help)
|
| 127 |
+
printf '%s\n' "$usage" || exit 2
|
| 128 |
+
exit;;
|
| 129 |
+
(-H | --wi | --wit | --with | --with- | --with-f | --with-fi \
|
| 130 |
+
| --with-fil | --with-file | --with-filen | --with-filena | --with-filenam \
|
| 131 |
+
| --with-filename)
|
| 132 |
+
with_filename=1
|
| 133 |
+
continue;;
|
| 134 |
+
(-l | --files-with-*)
|
| 135 |
+
files_with_matches=1
|
| 136 |
+
continue;;
|
| 137 |
+
(-L | --files-witho*)
|
| 138 |
+
files_without_matches=1
|
| 139 |
+
continue;;
|
| 140 |
+
(-h | --no-f*)
|
| 141 |
+
no_filename=1;;
|
| 142 |
+
(-V | --v | --ve | --ver | --vers | --versi | --versio | --version)
|
| 143 |
+
printf '%s\n' "$version" || exit 2
|
| 144 |
+
exit;;
|
| 145 |
+
esac
|
| 146 |
+
|
| 147 |
+
case $option in
|
| 148 |
+
(*\'?*)
|
| 149 |
+
option=\'$(printf '%sX\n' "$option" | LC_ALL=C sed "$escape");;
|
| 150 |
+
(*)
|
| 151 |
+
option="'$option'";;
|
| 152 |
+
esac
|
| 153 |
+
|
| 154 |
+
grep="$grep $option$optarg"
|
| 155 |
+
done
|
| 156 |
+
|
| 157 |
+
eval "set -- $operands "'${1+"$@"}'
|
| 158 |
+
|
| 159 |
+
if test $have_pat -eq 0; then
|
| 160 |
+
case ${1?"Missing pattern; try '${0##*/} --help' for help"} in
|
| 161 |
+
(*\'*)
|
| 162 |
+
grep="$grep -e '"$(printf '%sX\n' "$1" | LC_ALL=C sed "$escape");;
|
| 163 |
+
(*)
|
| 164 |
+
grep="$grep -e '$1'";;
|
| 165 |
+
esac
|
| 166 |
+
shift
|
| 167 |
+
fi
|
| 168 |
+
|
| 169 |
+
if test $# -eq 0; then
|
| 170 |
+
set -- -
|
| 171 |
+
fi
|
| 172 |
+
|
| 173 |
+
exec 3>&1
|
| 174 |
+
|
| 175 |
+
# res=1 means that no file matched yet
|
| 176 |
+
res=1
|
| 177 |
+
|
| 178 |
+
for i; do
|
| 179 |
+
case $i in
|
| 180 |
+
*[-.][zZ] | *_z | *[-.]gz | *.t[ag]z) uncompress="gzip -cdf";;
|
| 181 |
+
*[-.]bz2 | *[-.]tbz | *.tbz2) uncompress="bzip2 -cdf";;
|
| 182 |
+
*[-.]lzo | *[-.]tzo) uncompress="lzop -cdf";;
|
| 183 |
+
*[-.]zst | *[-.]tzst) uncompress="zstd -cdfq";; # zstd needs -q.
|
| 184 |
+
*[-.]lz4) uncompress="lz4 -cdf";;
|
| 185 |
+
*) uncompress="$xz -cdfqQ";; # -qQ to ignore warnings like unsupp. check.
|
| 186 |
+
esac
|
| 187 |
+
# xz_status will hold the decompressor's exit status.
|
| 188 |
+
# Exit status of grep (and in rare cases, printf or sed) is
|
| 189 |
+
# available as the exit status of this assignment command.
|
| 190 |
+
xz_status=$(
|
| 191 |
+
exec 5>&1
|
| 192 |
+
($uncompress -- "$i" 5>&-; echo $? >&5) 3>&- |
|
| 193 |
+
if test $files_with_matches -eq 1; then
|
| 194 |
+
eval "$grep -q" && { printf '%s\n' "$i" || exit 2; }
|
| 195 |
+
elif test $files_without_matches -eq 1; then
|
| 196 |
+
eval "$grep -q" || {
|
| 197 |
+
r=$?
|
| 198 |
+
if test $r -eq 1; then
|
| 199 |
+
printf '%s\n' "$i" || r=2
|
| 200 |
+
fi
|
| 201 |
+
exit $r
|
| 202 |
+
}
|
| 203 |
+
elif test $with_filename -eq 0 &&
|
| 204 |
+
{ test $# -eq 1 || test $no_filename -eq 1; }; then
|
| 205 |
+
eval "$grep"
|
| 206 |
+
elif test $grep_supports_label -eq 1; then
|
| 207 |
+
# The grep implementation in use allows us to specify the filename
|
| 208 |
+
# that grep will prefix to the output lines. This is faster and
|
| 209 |
+
# less prone to security bugs than the fallback method that uses sed.
|
| 210 |
+
# This also avoids confusing output with GNU grep >= 3.5 (2020-09-27)
|
| 211 |
+
# which prints "binary file matches" to stderr instead of stdout.
|
| 212 |
+
#
|
| 213 |
+
# If reading from stdin, let grep use whatever name it prefers for
|
| 214 |
+
# stdin. With GNU grep it is a locale-specific translated string.
|
| 215 |
+
if test "x$i" = "x-"; then
|
| 216 |
+
eval "$grep -H"
|
| 217 |
+
else
|
| 218 |
+
eval "$grep -H --label \"\$i\""
|
| 219 |
+
fi
|
| 220 |
+
else
|
| 221 |
+
# Append a colon so that the last character will never be a newline
|
| 222 |
+
# which would otherwise get lost in shell command substitution.
|
| 223 |
+
i="$i:"
|
| 224 |
+
|
| 225 |
+
# Escape & \ | and newlines only if such characters are present
|
| 226 |
+
# (speed optimization).
|
| 227 |
+
case $i in
|
| 228 |
+
(*'
|
| 229 |
+
'* | *'&'* | *'\'* | *'|'*)
|
| 230 |
+
# If sed fails, set i to a known safe string to ensure that
|
| 231 |
+
# failing sed did not create a half-escaped dangerous string.
|
| 232 |
+
i=$(printf '%s\n' "$i" | LC_ALL=C sed 's/[&\|]/\\&/g; $!s/$/\\/') ||
|
| 233 |
+
i='(unknown filename):';;
|
| 234 |
+
esac
|
| 235 |
+
|
| 236 |
+
# $i already ends with a colon so do not add it here.
|
| 237 |
+
sed_script="s|^|$i|"
|
| 238 |
+
|
| 239 |
+
# If grep or sed fails, pick the larger value of the two exit statuses.
|
| 240 |
+
# If sed fails, use at least 2 since we use >= 2 to indicate errors.
|
| 241 |
+
r=$(
|
| 242 |
+
exec 4>&1
|
| 243 |
+
(eval "$grep" 4>&-; echo $? >&4) 3>&- |
|
| 244 |
+
LC_ALL=C sed "$sed_script" >&3 4>&-
|
| 245 |
+
) || {
|
| 246 |
+
sed_status=$?
|
| 247 |
+
test "$sed_status" -lt 2 && sed_status=2
|
| 248 |
+
test "$r" -lt "$sed_status" && r=$sed_status
|
| 249 |
+
}
|
| 250 |
+
exit $r
|
| 251 |
+
fi >&3 5>&-
|
| 252 |
+
)
|
| 253 |
+
r=$?
|
| 254 |
+
|
| 255 |
+
# If grep or sed or other non-decompression command failed with a signal,
|
| 256 |
+
# exit immediately and ignore the possible remaining files.
|
| 257 |
+
#
|
| 258 |
+
# NOTE: Instead of 128 + signal_number, some shells use
|
| 259 |
+
# 256 + signal_number (ksh) or 384 + signal_number (yash).
|
| 260 |
+
# This is fine for us since their "exit" and "kill -l" commands take
|
| 261 |
+
# this into account. (At least the versions I tried do but there is
|
| 262 |
+
# a report of an old ksh variant whose "exit" truncates the exit status
|
| 263 |
+
# to 8 bits without any special handling for values indicating a signal.)
|
| 264 |
+
test "$r" -ge 128 && exit "$r"
|
| 265 |
+
|
| 266 |
+
if test -z "$xz_status"; then
|
| 267 |
+
# Something unusual happened, for example, we got a signal and
|
| 268 |
+
# the exit status of the decompressor was never echoed and thus
|
| 269 |
+
# $xz_status is empty. Exit immediately and ignore the possible
|
| 270 |
+
# remaining files.
|
| 271 |
+
exit 2
|
| 272 |
+
elif test "$xz_status" -ge 128; then
|
| 273 |
+
# The decompressor died due to a signal. SIGPIPE is ignored since it can
|
| 274 |
+
# occur if grep exits before the whole file has been decompressed (grep -q
|
| 275 |
+
# can do that). If the decompressor died with some other signal, exit
|
| 276 |
+
# immediately and ignore the possible remaining files.
|
| 277 |
+
test "$(kill -l "$xz_status" 2> /dev/null)" != "PIPE" && exit "$xz_status"
|
| 278 |
+
elif test "$xz_status" -gt 0; then
|
| 279 |
+
# Decompression failed but we will continue with the remaining
|
| 280 |
+
# files anyway. Set exit status to at least 2 to indicate an error.
|
| 281 |
+
test "$r" -lt 2 && r=2
|
| 282 |
+
fi
|
| 283 |
+
|
| 284 |
+
# Since res=1 is the initial value, we only need to care about
|
| 285 |
+
# matches (r == 0) and errors (r >= 2) here; r == 1 can be ignored.
|
| 286 |
+
if test "$r" -ge 2; then
|
| 287 |
+
# An error occurred in decompressor, grep, or some other command. Update
|
| 288 |
+
# res unless a larger error code has been seen with an earlier file.
|
| 289 |
+
test "$res" -lt "$r" && res=$r
|
| 290 |
+
elif test "$r" -eq 0; then
|
| 291 |
+
# grep found a match and no errors occurred. Update res if no errors have
|
| 292 |
+
# occurred with earlier files.
|
| 293 |
+
test "$res" -eq 1 && res=0
|
| 294 |
+
fi
|
| 295 |
+
done
|
| 296 |
+
|
| 297 |
+
# 0: At least one file matched and no errors occurred.
|
| 298 |
+
# 1: No matches were found and no errors occurred.
|
| 299 |
+
# >=2: Error. It's unknown if matches were found.
|
| 300 |
+
exit "$res"
|
bin/lzfgrep
ADDED
|
@@ -0,0 +1,300 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
# SPDX-License-Identifier: GPL-2.0-or-later
|
| 3 |
+
|
| 4 |
+
# xzgrep -- a wrapper around a grep program that decompresses files as needed
|
| 5 |
+
# Adapted from a version sent by Charles Levert <charles@comm.polymtl.ca>
|
| 6 |
+
|
| 7 |
+
# Copyright (C) 1998, 2001, 2002, 2006, 2007 Free Software Foundation
|
| 8 |
+
# Copyright (C) 1993 Jean-loup Gailly
|
| 9 |
+
|
| 10 |
+
# Modified for XZ Utils by Andrew Dudman and Lasse Collin.
|
| 11 |
+
|
| 12 |
+
# This program is free software; you can redistribute it and/or modify
|
| 13 |
+
# it under the terms of the GNU General Public License as published by
|
| 14 |
+
# the Free Software Foundation; either version 2 of the License, or
|
| 15 |
+
# (at your option) any later version.
|
| 16 |
+
|
| 17 |
+
# This program is distributed in the hope that it will be useful,
|
| 18 |
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 19 |
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 20 |
+
# GNU General Public License for more details.
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
#SET_PATH - This line is a placeholder to ease patching this script.
|
| 24 |
+
|
| 25 |
+
# Instead of unsetting XZ_OPT, just make sure that xz will use file format
|
| 26 |
+
# autodetection. This way memory usage limit and thread limit can be
|
| 27 |
+
# specified via XZ_OPT. With gzip, bzip2, and lzop it's OK to just unset the
|
| 28 |
+
# environment variables.
|
| 29 |
+
xz='xz --format=auto'
|
| 30 |
+
unset GZIP BZIP BZIP2 LZOP
|
| 31 |
+
|
| 32 |
+
case ${0##*/} in
|
| 33 |
+
*egrep*) prog=xzegrep; grep=${GREP:-grep -E};;
|
| 34 |
+
*fgrep*) prog=xzfgrep; grep=${GREP:-grep -F};;
|
| 35 |
+
*) prog=xzgrep; grep=${GREP:-grep};;
|
| 36 |
+
esac
|
| 37 |
+
|
| 38 |
+
version="$prog (XZ Utils) 5.6.4"
|
| 39 |
+
|
| 40 |
+
usage="Usage: ${0##*/} [OPTION]... [-e] PATTERN [FILE]...
|
| 41 |
+
Look for instances of PATTERN in the input FILEs, using their
|
| 42 |
+
uncompressed contents if they are compressed.
|
| 43 |
+
|
| 44 |
+
OPTIONs are the same as for '$grep'.
|
| 45 |
+
|
| 46 |
+
Report bugs to <xz@tukaani.org>."
|
| 47 |
+
|
| 48 |
+
# sed script to escape all ' for the shell, and then (to handle trailing
|
| 49 |
+
# newlines correctly) turn trailing X on last line into '.
|
| 50 |
+
escape='
|
| 51 |
+
s/'\''/'\''\\'\'''\''/g
|
| 52 |
+
$s/X$/'\''/
|
| 53 |
+
'
|
| 54 |
+
operands=
|
| 55 |
+
have_pat=0
|
| 56 |
+
files_with_matches=0
|
| 57 |
+
files_without_matches=0
|
| 58 |
+
no_filename=0
|
| 59 |
+
with_filename=0
|
| 60 |
+
|
| 61 |
+
# See if -H and --label options are supported (GNU and *BSDs).
|
| 62 |
+
if test f:x = "$(eval "echo x | $grep -H --label=f x 2> /dev/null")"; then
|
| 63 |
+
grep_supports_label=1
|
| 64 |
+
else
|
| 65 |
+
grep_supports_label=0
|
| 66 |
+
fi
|
| 67 |
+
|
| 68 |
+
while test $# -ne 0; do
|
| 69 |
+
option=$1
|
| 70 |
+
shift
|
| 71 |
+
optarg=
|
| 72 |
+
|
| 73 |
+
case $option in
|
| 74 |
+
(-[0123456789abcdEFGhHiIKlLnoPqrRsTuUvVwxyzZ]*[!0123456789]*)
|
| 75 |
+
# Something like -Fiv was specified, that is, $option contains more
|
| 76 |
+
# than one option of which the first option (in this example -F)
|
| 77 |
+
# doesn't take an argument. Split the first option into a standalone
|
| 78 |
+
# argument and continue parsing the rest of the options (in this example,
|
| 79 |
+
# replace -Fiv with -iv in the argument list and set option=-F).
|
| 80 |
+
#
|
| 81 |
+
# If there are digits [0-9] they are treated as if they were a single
|
| 82 |
+
# option character because this syntax is an alias for -C for GNU grep.
|
| 83 |
+
# For example, "grep -25F" is equivalent to "grep -C25 -F". If only
|
| 84 |
+
# digits are specified like "grep -25" we don't get here because the
|
| 85 |
+
# above pattern in the case-statement doesn't match such strings.
|
| 86 |
+
arg2=-\'$(LC_ALL=C expr "X${option}X" : 'X-.[0-9]*\(.*\)' |
|
| 87 |
+
LC_ALL=C sed "$escape")
|
| 88 |
+
eval "set -- $arg2 "'${1+"$@"}'
|
| 89 |
+
option=$(LC_ALL=C expr "X$option" : 'X\(-.[0-9]*\)');;
|
| 90 |
+
(--binary-*=* | --[lm]a*=* | --reg*=*)
|
| 91 |
+
# These options require an argument and an argument has been provided
|
| 92 |
+
# with the --foo=argument syntax. All is good.
|
| 93 |
+
;;
|
| 94 |
+
(-[ABCDefmX] | --binary-* | --file | --[lm]a* | --reg*)
|
| 95 |
+
# These options require an argument which should now be in $1.
|
| 96 |
+
# If it isn't, display an error and exit.
|
| 97 |
+
case ${1?"$option option requires an argument"} in
|
| 98 |
+
(*\'*)
|
| 99 |
+
optarg=" '"$(printf '%sX\n' "$1" | LC_ALL=C sed "$escape");;
|
| 100 |
+
(*)
|
| 101 |
+
optarg=" '$1'";;
|
| 102 |
+
esac
|
| 103 |
+
shift;;
|
| 104 |
+
(--)
|
| 105 |
+
break;;
|
| 106 |
+
(-?*)
|
| 107 |
+
;;
|
| 108 |
+
(*)
|
| 109 |
+
case $option in
|
| 110 |
+
(*\'*)
|
| 111 |
+
operands="$operands '"$(printf '%sX\n' "$option" |
|
| 112 |
+
LC_ALL=C sed "$escape");;
|
| 113 |
+
(*)
|
| 114 |
+
operands="$operands '$option'";;
|
| 115 |
+
esac
|
| 116 |
+
${POSIXLY_CORRECT+break}
|
| 117 |
+
continue;;
|
| 118 |
+
esac
|
| 119 |
+
|
| 120 |
+
case $option in
|
| 121 |
+
(-[drRzZ] | --di* | --exc* | --inc* | --rec* | --nu*)
|
| 122 |
+
printf >&2 '%s: %s: Option not supported\n' "$0" "$option"
|
| 123 |
+
exit 2;;
|
| 124 |
+
(-[ef]* | --file | --file=* | --reg*)
|
| 125 |
+
have_pat=1;;
|
| 126 |
+
(--h | --he | --hel | --help)
|
| 127 |
+
printf '%s\n' "$usage" || exit 2
|
| 128 |
+
exit;;
|
| 129 |
+
(-H | --wi | --wit | --with | --with- | --with-f | --with-fi \
|
| 130 |
+
| --with-fil | --with-file | --with-filen | --with-filena | --with-filenam \
|
| 131 |
+
| --with-filename)
|
| 132 |
+
with_filename=1
|
| 133 |
+
continue;;
|
| 134 |
+
(-l | --files-with-*)
|
| 135 |
+
files_with_matches=1
|
| 136 |
+
continue;;
|
| 137 |
+
(-L | --files-witho*)
|
| 138 |
+
files_without_matches=1
|
| 139 |
+
continue;;
|
| 140 |
+
(-h | --no-f*)
|
| 141 |
+
no_filename=1;;
|
| 142 |
+
(-V | --v | --ve | --ver | --vers | --versi | --versio | --version)
|
| 143 |
+
printf '%s\n' "$version" || exit 2
|
| 144 |
+
exit;;
|
| 145 |
+
esac
|
| 146 |
+
|
| 147 |
+
case $option in
|
| 148 |
+
(*\'?*)
|
| 149 |
+
option=\'$(printf '%sX\n' "$option" | LC_ALL=C sed "$escape");;
|
| 150 |
+
(*)
|
| 151 |
+
option="'$option'";;
|
| 152 |
+
esac
|
| 153 |
+
|
| 154 |
+
grep="$grep $option$optarg"
|
| 155 |
+
done
|
| 156 |
+
|
| 157 |
+
eval "set -- $operands "'${1+"$@"}'
|
| 158 |
+
|
| 159 |
+
if test $have_pat -eq 0; then
|
| 160 |
+
case ${1?"Missing pattern; try '${0##*/} --help' for help"} in
|
| 161 |
+
(*\'*)
|
| 162 |
+
grep="$grep -e '"$(printf '%sX\n' "$1" | LC_ALL=C sed "$escape");;
|
| 163 |
+
(*)
|
| 164 |
+
grep="$grep -e '$1'";;
|
| 165 |
+
esac
|
| 166 |
+
shift
|
| 167 |
+
fi
|
| 168 |
+
|
| 169 |
+
if test $# -eq 0; then
|
| 170 |
+
set -- -
|
| 171 |
+
fi
|
| 172 |
+
|
| 173 |
+
exec 3>&1
|
| 174 |
+
|
| 175 |
+
# res=1 means that no file matched yet
|
| 176 |
+
res=1
|
| 177 |
+
|
| 178 |
+
for i; do
|
| 179 |
+
case $i in
|
| 180 |
+
*[-.][zZ] | *_z | *[-.]gz | *.t[ag]z) uncompress="gzip -cdf";;
|
| 181 |
+
*[-.]bz2 | *[-.]tbz | *.tbz2) uncompress="bzip2 -cdf";;
|
| 182 |
+
*[-.]lzo | *[-.]tzo) uncompress="lzop -cdf";;
|
| 183 |
+
*[-.]zst | *[-.]tzst) uncompress="zstd -cdfq";; # zstd needs -q.
|
| 184 |
+
*[-.]lz4) uncompress="lz4 -cdf";;
|
| 185 |
+
*) uncompress="$xz -cdfqQ";; # -qQ to ignore warnings like unsupp. check.
|
| 186 |
+
esac
|
| 187 |
+
# xz_status will hold the decompressor's exit status.
|
| 188 |
+
# Exit status of grep (and in rare cases, printf or sed) is
|
| 189 |
+
# available as the exit status of this assignment command.
|
| 190 |
+
xz_status=$(
|
| 191 |
+
exec 5>&1
|
| 192 |
+
($uncompress -- "$i" 5>&-; echo $? >&5) 3>&- |
|
| 193 |
+
if test $files_with_matches -eq 1; then
|
| 194 |
+
eval "$grep -q" && { printf '%s\n' "$i" || exit 2; }
|
| 195 |
+
elif test $files_without_matches -eq 1; then
|
| 196 |
+
eval "$grep -q" || {
|
| 197 |
+
r=$?
|
| 198 |
+
if test $r -eq 1; then
|
| 199 |
+
printf '%s\n' "$i" || r=2
|
| 200 |
+
fi
|
| 201 |
+
exit $r
|
| 202 |
+
}
|
| 203 |
+
elif test $with_filename -eq 0 &&
|
| 204 |
+
{ test $# -eq 1 || test $no_filename -eq 1; }; then
|
| 205 |
+
eval "$grep"
|
| 206 |
+
elif test $grep_supports_label -eq 1; then
|
| 207 |
+
# The grep implementation in use allows us to specify the filename
|
| 208 |
+
# that grep will prefix to the output lines. This is faster and
|
| 209 |
+
# less prone to security bugs than the fallback method that uses sed.
|
| 210 |
+
# This also avoids confusing output with GNU grep >= 3.5 (2020-09-27)
|
| 211 |
+
# which prints "binary file matches" to stderr instead of stdout.
|
| 212 |
+
#
|
| 213 |
+
# If reading from stdin, let grep use whatever name it prefers for
|
| 214 |
+
# stdin. With GNU grep it is a locale-specific translated string.
|
| 215 |
+
if test "x$i" = "x-"; then
|
| 216 |
+
eval "$grep -H"
|
| 217 |
+
else
|
| 218 |
+
eval "$grep -H --label \"\$i\""
|
| 219 |
+
fi
|
| 220 |
+
else
|
| 221 |
+
# Append a colon so that the last character will never be a newline
|
| 222 |
+
# which would otherwise get lost in shell command substitution.
|
| 223 |
+
i="$i:"
|
| 224 |
+
|
| 225 |
+
# Escape & \ | and newlines only if such characters are present
|
| 226 |
+
# (speed optimization).
|
| 227 |
+
case $i in
|
| 228 |
+
(*'
|
| 229 |
+
'* | *'&'* | *'\'* | *'|'*)
|
| 230 |
+
# If sed fails, set i to a known safe string to ensure that
|
| 231 |
+
# failing sed did not create a half-escaped dangerous string.
|
| 232 |
+
i=$(printf '%s\n' "$i" | LC_ALL=C sed 's/[&\|]/\\&/g; $!s/$/\\/') ||
|
| 233 |
+
i='(unknown filename):';;
|
| 234 |
+
esac
|
| 235 |
+
|
| 236 |
+
# $i already ends with a colon so do not add it here.
|
| 237 |
+
sed_script="s|^|$i|"
|
| 238 |
+
|
| 239 |
+
# If grep or sed fails, pick the larger value of the two exit statuses.
|
| 240 |
+
# If sed fails, use at least 2 since we use >= 2 to indicate errors.
|
| 241 |
+
r=$(
|
| 242 |
+
exec 4>&1
|
| 243 |
+
(eval "$grep" 4>&-; echo $? >&4) 3>&- |
|
| 244 |
+
LC_ALL=C sed "$sed_script" >&3 4>&-
|
| 245 |
+
) || {
|
| 246 |
+
sed_status=$?
|
| 247 |
+
test "$sed_status" -lt 2 && sed_status=2
|
| 248 |
+
test "$r" -lt "$sed_status" && r=$sed_status
|
| 249 |
+
}
|
| 250 |
+
exit $r
|
| 251 |
+
fi >&3 5>&-
|
| 252 |
+
)
|
| 253 |
+
r=$?
|
| 254 |
+
|
| 255 |
+
# If grep or sed or other non-decompression command failed with a signal,
|
| 256 |
+
# exit immediately and ignore the possible remaining files.
|
| 257 |
+
#
|
| 258 |
+
# NOTE: Instead of 128 + signal_number, some shells use
|
| 259 |
+
# 256 + signal_number (ksh) or 384 + signal_number (yash).
|
| 260 |
+
# This is fine for us since their "exit" and "kill -l" commands take
|
| 261 |
+
# this into account. (At least the versions I tried do but there is
|
| 262 |
+
# a report of an old ksh variant whose "exit" truncates the exit status
|
| 263 |
+
# to 8 bits without any special handling for values indicating a signal.)
|
| 264 |
+
test "$r" -ge 128 && exit "$r"
|
| 265 |
+
|
| 266 |
+
if test -z "$xz_status"; then
|
| 267 |
+
# Something unusual happened, for example, we got a signal and
|
| 268 |
+
# the exit status of the decompressor was never echoed and thus
|
| 269 |
+
# $xz_status is empty. Exit immediately and ignore the possible
|
| 270 |
+
# remaining files.
|
| 271 |
+
exit 2
|
| 272 |
+
elif test "$xz_status" -ge 128; then
|
| 273 |
+
# The decompressor died due to a signal. SIGPIPE is ignored since it can
|
| 274 |
+
# occur if grep exits before the whole file has been decompressed (grep -q
|
| 275 |
+
# can do that). If the decompressor died with some other signal, exit
|
| 276 |
+
# immediately and ignore the possible remaining files.
|
| 277 |
+
test "$(kill -l "$xz_status" 2> /dev/null)" != "PIPE" && exit "$xz_status"
|
| 278 |
+
elif test "$xz_status" -gt 0; then
|
| 279 |
+
# Decompression failed but we will continue with the remaining
|
| 280 |
+
# files anyway. Set exit status to at least 2 to indicate an error.
|
| 281 |
+
test "$r" -lt 2 && r=2
|
| 282 |
+
fi
|
| 283 |
+
|
| 284 |
+
# Since res=1 is the initial value, we only need to care about
|
| 285 |
+
# matches (r == 0) and errors (r >= 2) here; r == 1 can be ignored.
|
| 286 |
+
if test "$r" -ge 2; then
|
| 287 |
+
# An error occurred in decompressor, grep, or some other command. Update
|
| 288 |
+
# res unless a larger error code has been seen with an earlier file.
|
| 289 |
+
test "$res" -lt "$r" && res=$r
|
| 290 |
+
elif test "$r" -eq 0; then
|
| 291 |
+
# grep found a match and no errors occurred. Update res if no errors have
|
| 292 |
+
# occurred with earlier files.
|
| 293 |
+
test "$res" -eq 1 && res=0
|
| 294 |
+
fi
|
| 295 |
+
done
|
| 296 |
+
|
| 297 |
+
# 0: At least one file matched and no errors occurred.
|
| 298 |
+
# 1: No matches were found and no errors occurred.
|
| 299 |
+
# >=2: Error. It's unknown if matches were found.
|
| 300 |
+
exit "$res"
|
bin/lzless
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
# SPDX-License-Identifier: GPL-2.0-or-later
|
| 3 |
+
|
| 4 |
+
# Copyright (C) 1998, 2002, 2006, 2007 Free Software Foundation
|
| 5 |
+
|
| 6 |
+
# The original version for gzip was written by Paul Eggert.
|
| 7 |
+
# Modified for XZ Utils by Andrew Dudman and Lasse Collin.
|
| 8 |
+
|
| 9 |
+
# This program is free software; you can redistribute it and/or modify
|
| 10 |
+
# it under the terms of the GNU General Public License as published by
|
| 11 |
+
# the Free Software Foundation; either version 2 of the License, or
|
| 12 |
+
# (at your option) any later version.
|
| 13 |
+
|
| 14 |
+
# This program is distributed in the hope that it will be useful,
|
| 15 |
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 16 |
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 17 |
+
# GNU General Public License for more details.
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
#SET_PATH - This line is a placeholder to ease patching this script.
|
| 21 |
+
|
| 22 |
+
# Instead of unsetting XZ_OPT, just make sure that xz will use file format
|
| 23 |
+
# autodetection. This way memory usage limit and thread limit can be
|
| 24 |
+
# specified via XZ_OPT.
|
| 25 |
+
xz='xz --format=auto'
|
| 26 |
+
|
| 27 |
+
version='xzless (XZ Utils) 5.6.4'
|
| 28 |
+
|
| 29 |
+
usage="Usage: ${0##*/} [OPTION]... [FILE]...
|
| 30 |
+
Like 'less', but operate on the uncompressed contents of xz compressed FILEs.
|
| 31 |
+
|
| 32 |
+
Options are the same as for 'less'.
|
| 33 |
+
|
| 34 |
+
Report bugs to <xz@tukaani.org>."
|
| 35 |
+
|
| 36 |
+
case $1 in
|
| 37 |
+
--help) printf '%s\n' "$usage" || exit 2; exit;;
|
| 38 |
+
--version) printf '%s\n' "$version" || exit 2; exit;;
|
| 39 |
+
esac
|
| 40 |
+
|
| 41 |
+
if test "${LESSMETACHARS+set}" != set; then
|
| 42 |
+
# Work around a bug in less 394 and earlier;
|
| 43 |
+
# it mishandles the metacharacters '$%=~'.
|
| 44 |
+
space=' '
|
| 45 |
+
tab=' '
|
| 46 |
+
nl='
|
| 47 |
+
'
|
| 48 |
+
LESSMETACHARS="$space$tab$nl'"';*?"()<>[|&^`#\$%=~'
|
| 49 |
+
fi
|
| 50 |
+
|
| 51 |
+
VER=$(less -V | { read _ ver _ && echo ${ver%%.*}; })
|
| 52 |
+
if test "$VER" -ge 451; then
|
| 53 |
+
# less 451 or later: If the compressed file is valid but has
|
| 54 |
+
# zero bytes of uncompressed data, using two vertical bars ||- makes
|
| 55 |
+
# "less" check the exit status of xz and if it is zero then display
|
| 56 |
+
# an empty file. With a single vertical bar |- and no output from xz,
|
| 57 |
+
# "less" would attempt to display the raw input file instead.
|
| 58 |
+
LESSOPEN="||-$xz -cdfqQ -- %s"
|
| 59 |
+
elif test "$VER" -ge 429; then
|
| 60 |
+
# less 429 or later: LESSOPEN pipe will be used on
|
| 61 |
+
# standard input if $LESSOPEN begins with |-.
|
| 62 |
+
LESSOPEN="|-$xz -cdfqQ -- %s"
|
| 63 |
+
else
|
| 64 |
+
LESSOPEN="|$xz -cdfqQ -- %s"
|
| 65 |
+
fi
|
| 66 |
+
|
| 67 |
+
SHOW_PREPROC_ERRORS=
|
| 68 |
+
if test "$VER" -ge 632; then
|
| 69 |
+
SHOW_PREPROC_ERRORS=--show-preproc-errors
|
| 70 |
+
fi
|
| 71 |
+
|
| 72 |
+
export LESSMETACHARS LESSOPEN
|
| 73 |
+
|
| 74 |
+
exec less $SHOW_PREPROC_ERRORS "$@"
|
bin/lzmadec
ADDED
|
Binary file (17.2 kB). View file
|
|
|
bin/lzmainfo
ADDED
|
Binary file (17 kB). View file
|
|
|
bin/lzmore
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
# SPDX-License-Identifier: GPL-2.0-or-later
|
| 3 |
+
|
| 4 |
+
# Copyright (C) 2001, 2002, 2007 Free Software Foundation
|
| 5 |
+
# Copyright (C) 1992, 1993 Jean-loup Gailly
|
| 6 |
+
|
| 7 |
+
# Modified for XZ Utils by Andrew Dudman and Lasse Collin.
|
| 8 |
+
|
| 9 |
+
# This program is free software; you can redistribute it and/or modify
|
| 10 |
+
# it under the terms of the GNU General Public License as published by
|
| 11 |
+
# the Free Software Foundation; either version 2 of the License, or
|
| 12 |
+
# (at your option) any later version.
|
| 13 |
+
|
| 14 |
+
# This program is distributed in the hope that it will be useful,
|
| 15 |
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 16 |
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 17 |
+
# GNU General Public License for more details.
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
#SET_PATH - This line is a placeholder to ease patching this script.
|
| 21 |
+
|
| 22 |
+
# Instead of unsetting XZ_OPT, just make sure that xz will use file format
|
| 23 |
+
# autodetection. This way memory usage limit and thread limit can be
|
| 24 |
+
# specified via XZ_OPT.
|
| 25 |
+
xz='xz --format=auto'
|
| 26 |
+
|
| 27 |
+
version='xzmore (XZ Utils) 5.6.4'
|
| 28 |
+
|
| 29 |
+
usage="Usage: ${0##*/} [OPTION]... [FILE]...
|
| 30 |
+
Like 'more', but operate on the uncompressed contents of xz compressed FILEs.
|
| 31 |
+
|
| 32 |
+
Report bugs to <xz@tukaani.org>."
|
| 33 |
+
|
| 34 |
+
case $1 in
|
| 35 |
+
--help) printf '%s\n' "$usage" || exit 2; exit;;
|
| 36 |
+
--version) printf '%s\n' "$version" || exit 2; exit;;
|
| 37 |
+
esac
|
| 38 |
+
|
| 39 |
+
oldtty=`stty -g 2>/dev/null`
|
| 40 |
+
if stty -cbreak 2>/dev/null; then
|
| 41 |
+
cb='cbreak'; ncb='-cbreak'
|
| 42 |
+
else
|
| 43 |
+
# 'stty min 1' resets eof to ^a on both SunOS and SysV!
|
| 44 |
+
cb='min 1 -icanon'; ncb='icanon eof ^d'
|
| 45 |
+
fi
|
| 46 |
+
if test $? -eq 0 && test -n "$oldtty"; then
|
| 47 |
+
trap 'stty $oldtty 2>/dev/null; exit' 0 2 3 5 10 13 15
|
| 48 |
+
else
|
| 49 |
+
trap 'stty $ncb echo 2>/dev/null; exit' 0 2 3 5 10 13 15
|
| 50 |
+
fi
|
| 51 |
+
|
| 52 |
+
if test $# = 0; then
|
| 53 |
+
if test -t 0; then
|
| 54 |
+
printf '%s\n' "$usage"; exit 1
|
| 55 |
+
else
|
| 56 |
+
$xz -cdfqQ | eval "${PAGER:-more}"
|
| 57 |
+
fi
|
| 58 |
+
else
|
| 59 |
+
FIRST=1
|
| 60 |
+
for FILE; do
|
| 61 |
+
< "$FILE" || continue
|
| 62 |
+
if test $FIRST -eq 0; then
|
| 63 |
+
printf "%s--More--(Next file: %s)" "" "$FILE"
|
| 64 |
+
stty $cb -echo 2>/dev/null
|
| 65 |
+
ANS=`dd bs=1 count=1 2>/dev/null`
|
| 66 |
+
stty $ncb echo 2>/dev/null
|
| 67 |
+
echo " "
|
| 68 |
+
case "$ANS" in
|
| 69 |
+
[eq]) exit;;
|
| 70 |
+
esac
|
| 71 |
+
fi
|
| 72 |
+
if test "$ANS" != 's'; then
|
| 73 |
+
printf '%s\n' "------> $FILE <------"
|
| 74 |
+
$xz -cdfqQ -- "$FILE" | eval "${PAGER:-more}"
|
| 75 |
+
fi
|
| 76 |
+
if test -t 1; then
|
| 77 |
+
FIRST=0
|
| 78 |
+
fi
|
| 79 |
+
done
|
| 80 |
+
fi
|
bin/markdown-it
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/home/aioz-nghiale/anaconda3/envs/testing_softzoo_pointe/bin/python3.10
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from markdown_it.cli.parse import main
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(main())
|
bin/markdown_py
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/home/aioz-nghiale/anaconda3/envs/testing_softzoo_pointe/bin/python3.10
|
| 2 |
+
# -*- coding: utf-8 -*-
|
| 3 |
+
import re
|
| 4 |
+
import sys
|
| 5 |
+
from markdown.__main__ import run
|
| 6 |
+
if __name__ == '__main__':
|
| 7 |
+
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
| 8 |
+
sys.exit(run())
|
bin/mnist_get_data.sh
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
|
| 3 |
+
if [ -d data ]; then
|
| 4 |
+
echo "data directory already present, exiting"
|
| 5 |
+
exit 1
|
| 6 |
+
fi
|
| 7 |
+
|
| 8 |
+
mkdir data
|
| 9 |
+
wget --recursive --level=1 --cut-dirs=3 --no-host-directories \
|
| 10 |
+
--directory-prefix=data --accept '*.gz' http://yann.lecun.com/exdb/mnist/
|
| 11 |
+
pushd data
|
| 12 |
+
gunzip *
|
| 13 |
+
popd
|
bin/mnist_preview
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/home/aioz-nghiale/anaconda3/envs/testing_softzoo_pointe/bin/python3.10
|
| 2 |
+
|
| 3 |
+
import random
|
| 4 |
+
import argparse
|
| 5 |
+
from mnist import MNIST
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
if __name__ == "__main__":
|
| 9 |
+
|
| 10 |
+
parser = argparse.ArgumentParser()
|
| 11 |
+
parser.add_argument("--id", default=None, type=int,
|
| 12 |
+
help="ID (position) of the letter to show")
|
| 13 |
+
parser.add_argument("--training", action="store_true",
|
| 14 |
+
help="Use training set instead of testing set")
|
| 15 |
+
|
| 16 |
+
parser.add_argument("--data", default="./data",
|
| 17 |
+
help="Path to MNIST data dir")
|
| 18 |
+
|
| 19 |
+
args = parser.parse_args()
|
| 20 |
+
|
| 21 |
+
mn = MNIST(args.data)
|
| 22 |
+
|
| 23 |
+
if args.training:
|
| 24 |
+
img, label = mn.load_training()
|
| 25 |
+
else:
|
| 26 |
+
img, label = mn.load_testing()
|
| 27 |
+
|
| 28 |
+
if args.id:
|
| 29 |
+
which = args.id
|
| 30 |
+
else:
|
| 31 |
+
which = random.randrange(0, len(label))
|
| 32 |
+
|
| 33 |
+
print('Showing num: {}'.format(label[which]))
|
| 34 |
+
print(mn.display(img[which]))
|