From 288ca8fb73c7cedbb23d1cf2d7c9eb5e430211bf Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Tue, 20 Sep 2016 17:16:07 +0200 Subject: Ignore also ignores the argunment. Bug 18004 --- driver/Commandline.ml | 7 ++++++- driver/Commandline.mli | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'driver') diff --git a/driver/Commandline.ml b/driver/Commandline.ml index ce5acf9d..c0dd6257 100644 --- a/driver/Commandline.ml +++ b/driver/Commandline.ml @@ -98,7 +98,12 @@ let parse_array spec argv first last = end else begin eprintf "Option `%s' expects an argument\n" s; exit 2 end - | Some (Ignore) -> parse (i+1) + | Some (Ignore) -> + if i + 1 <= last then begin + parse (i+2) + end else begin + eprintf "Option `%s' expects an argument\n" s; exit 2 + end | Some (Unit f) -> f (); parse (i+1) end in parse first diff --git a/driver/Commandline.mli b/driver/Commandline.mli index 5f9d8704..197d0b04 100644 --- a/driver/Commandline.mli +++ b/driver/Commandline.mli @@ -33,7 +33,7 @@ type action = | Self of (string -> unit) (** call the function with the matched string *) | String of (string -> unit) (** read next arg as a string, call function *) | Integer of (int -> unit) (** read next arg as an int, call function *) - | Ignore (** ignore the arg *) + | Ignore (** ignore the next arg *) | Unit of (unit -> unit) (** call the function with unit as argument *) val parse_cmdline: (pattern * action) list -> unit -- cgit