diff mbox series

Improve error message for bad arguments to script

Message ID 20190223212026.GA5580@redhat.com
State New
Headers show
Series Improve error message for bad arguments to script | expand

Commit Message

Jonathan Wakely Feb. 23, 2019, 9:20 p.m. UTC
* generate_libstdcxx_web_docs: Improve error output.

This makes the script a bit more user friendly. Committed to trunk.
commit b771c659703e48b531c3df0999d56cec1c7dad39
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Sat Feb 23 03:36:45 2019 +0000

    Improve error message for bad arguments to script
    
            * generate_libstdcxx_web_docs: Improve error output.
diff mbox series

Patch

diff --git a/maintainer-scripts/generate_libstdcxx_web_docs b/maintainer-scripts/generate_libstdcxx_web_docs
index 00ebcbf7f67..74886356bc7 100755
--- a/maintainer-scripts/generate_libstdcxx_web_docs
+++ b/maintainer-scripts/generate_libstdcxx_web_docs
@@ -3,16 +3,28 @@ 
 # i.e. http://gcc.gnu.org/onlinedocs/gcc-x.y.z/libstdc++*
 
 SRCDIR=${1}
-DOCSDIR=$(realpath ${2})
+DOCSDIR=${2}
 
 if ! [ $# -eq 2 -a -x "${SRCDIR}/configure" -a -d "${DOCSDIR}" ]
 then
+  if ! [ $# -eq 2 ]
+  then
+    echo "$0: Wrong number of arguments" >&2
+  elif ! [ -x "${SRCDIR}/configure" ]
+  then
+    echo "$0: No executable configure script found in $SRCDIR" >&2
+  elif ! [ -d "${DOCSDIR}" ]
+  then
+    echo "$0: Output directory does not exist: $DOCSDIR" >&2
+  fi
   echo "Usage: $0 <gcc src dir> <doc output dir>" >&2
   exit 1
 fi
 
 set -e
 
+DOCSDIR=$(realpath ${DOCSDIR})
+
 # Check we have some of the required tools
 for i in doxygen dot dblatex pdflatex makeindex
 do