[Android] compile.sh: error on invalid usage

Filip Roséen git at videolan.org
Tue Aug 9 07:19:05 CEST 2016


vlc-android | branch: master | Filip Roséen <filip at atch.se> | Tue Aug  9 04:01:47 2016 +0200| [da1fc3625959ecc77e0ef5117bdd7cac4dd2835c] | committer: Jean-Baptiste Kempf

compile.sh: error on invalid usage

If a user of the script happens to pass an invalid option to
"compile.sh" we should not ignore it, instead it is more appropriate
to add a diagnostic saying that the user has supplied an invalid
option.

As such, these changes adds a fallback entry to the argument parsing
so that the script aborts to save user from unexpected behavior.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> https://code.videolan.org/videolan/vlc-android/commit/da1fc3625959ecc77e0ef5117bdd7cac4dd2835c
---

 compile.sh | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/compile.sh b/compile.sh
index 650b27e..3e92ae3 100755
--- a/compile.sh
+++ b/compile.sh
@@ -43,6 +43,11 @@ while [ $# -gt 0 ]; do
         run)
             RUN=1
             ;;
+        *)
+            echo "$0: Invalid option '$1'." 1>&2
+            echo "$0: Try --help for more information." 1>&2
+            exit 1
+            ;;
     esac
     shift
 done



More information about the Android mailing list