check_GNU_style.sh: Read either from stdin, or from files

2015-05-12  Tom de Vries  <tom@codesourcery.com>

	* check_GNU_style.sh: Read either from stdin, or from files.

From-SVN: r223086
This commit is contained in:
Tom de Vries 2015-05-12 16:23:19 +00:00 committed by Tom de Vries
parent 0648b80726
commit 7f167be6ac
2 changed files with 20 additions and 6 deletions

View file

@ -1,3 +1,7 @@
2015-05-12 Tom de Vries <tom@codesourcery.com>
* check_GNU_style.sh: Read either from stdin, or from files.
2015-05-12 Tom de Vries <tom@codesourcery.com>
* check_GNU_style.sh: Check if files exists.

View file

@ -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