1
0
mirror of https://github.com/facebook/zstd.git synced 2025-11-09 17:41:01 +03:00

Correctness and tidy

Test compilation performed with warnings. Author and license added. Test for failing grep on ancient OSX versions. Replaced the test image with something less noisy (which compresses better).
This commit is contained in:
Carl Woffenden
2019-09-02 18:02:50 +02:00
parent b199bb3e0a
commit 8ac29cc825
7 changed files with 3286 additions and 3961 deletions

View File

@@ -6,6 +6,8 @@
# implementation (due to the grep calls) but it runs and works everywhere.
#
# TODO: ROOTS and FOUND as arrays (since they fail on paths with spaces)
#
# Author: Carl Woffenden, Numfum GmbH (released under a CC0 license)
# Common file roots
ROOTS="./"
@@ -25,6 +27,14 @@ usage() {
exit 1
}
# Tests that the grep implementation works as expected (older OSX grep fails)
test_grep() {
if ! echo '#include "foo"' | grep -Eq '^\s*#\s*include\s*".+"'; then
echo "Aborting: the grep implementation fails to parse include lines"
exit 1
fi
}
# Tests if list $1 has item $2 (returning zero on a match)
list_has_item() {
if echo "$1" | grep -Eq "(^|\s*)$2(\$|\s*)"; then
@@ -102,6 +112,7 @@ if [ -n "$1" ]; then
if [ -n "$DESTN" ]; then
printf "" > "$DESTN"
fi
test_grep
add_file $1
else
echo "Input file not found: \"$1\""