From: Tom de Vries Date: Tue, 12 May 2015 16:23:19 +0000 (+0000) Subject: check_GNU_style.sh: Read either from stdin, or from files X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7f167be6acfb2114b23adabe91e489a2d651eefe;p=gcc.git check_GNU_style.sh: Read either from stdin, or from files 2015-05-12 Tom de Vries * check_GNU_style.sh: Read either from stdin, or from files. From-SVN: r223086 --- diff --git a/contrib/ChangeLog b/contrib/ChangeLog index 605950a1c48..da374975417 100644 --- a/contrib/ChangeLog +++ b/contrib/ChangeLog @@ -1,3 +1,7 @@ +2015-05-12 Tom de Vries + + * check_GNU_style.sh: Read either from stdin, or from files. + 2015-05-12 Tom de Vries * check_GNU_style.sh: Check if files exists. diff --git a/contrib/check_GNU_style.sh b/contrib/check_GNU_style.sh index 2c4d9e24fe6..f00b3d54096 100755 --- a/contrib/check_GNU_style.sh +++ b/contrib/check_GNU_style.sh @@ -39,12 +39,22 @@ test $# -eq 0 && usage nfiles=$# files="$*" -for f in $files; do - if [ "$f" != "-" ] && [ ! -f "$f" ]; then - echo "error: could not read file: $f" - exit 1 - fi -done +stdin=false +if [ $nfiles -eq 1 ] && [ "$files" = "-" ]; then + stdin=true +else + for f in $files; do + if [ "$f" = "-" ]; then + # Let's keep things simple. Either we read from stdin, or we read + # from files specified on the command line, not both. + usage + fi + if [ ! -f "$f" ]; then + echo "error: could not read file: $f" + exit 1 + fi + done +fi inp=check_GNU_style.inp tmp=check_GNU_style.tmp