summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorvries <vries@138bc75d-0d04-0410-961f-82ee72b054a4>2015-05-12 16:23:19 +0000
committervries <vries@138bc75d-0d04-0410-961f-82ee72b054a4>2015-05-12 16:23:19 +0000
commit0b4a9aa24d9ded711f1f562077882c040d9b1736 (patch)
tree0e3d24b6b0f65ef93e7dde2b42e35f4386277d20 /contrib
parent4945bb803def618c9f93fe9b5b811d435c91af03 (diff)
downloadgcc-0b4a9aa24d9ded711f1f562077882c040d9b1736.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@223086 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'contrib')
-rw-r--r--contrib/ChangeLog4
-rwxr-xr-xcontrib/check_GNU_style.sh22
2 files changed, 20 insertions, 6 deletions
diff --git a/contrib/ChangeLog b/contrib/ChangeLog
index 605950a1c48..da374975417 100644
--- a/contrib/ChangeLog
+++ b/contrib/ChangeLog
@@ -1,5 +1,9 @@
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.
2015-05-12 Tom de Vries <tom@codesourcery.com>
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