-PRG=`echo "$1" | sed -e 's/[[:space:]].*$//'`
-FSF=`"$PRG" --version 2>/dev/null | fgrep "Free Software Foundation" | head -n 1`
-ALL=`"$PRG" -dumpversion 2>/dev/null `
-ONE=`echo "$ALL" | sed -e 's/\..*$//'`
+#
+# As illustrated in
+# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60723
+#
+# gcc developers chose to ignore the problems with this, and summarized those
+# as "intriguing problems" in
+# https://gcc.gnu.org/gcc-5/porting_to.html
+
+PRG=`echo "$1" | "$AWK" '{ sub(/^[ ]*/,""); sub(/[ ].*$/, ""); print; }' || exit 0`
+FSF=`("$PRG" --version 2>/dev/null || exit 0) | fgrep "Free Software Foundation" | head -n 1`
+ALL=`"$PRG" -dumpversion 2>/dev/null || exit 0`
+ONE=`echo "$ALL" | sed -e 's/[^0-9].*$//'`