PR#1709
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@5591 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02master
parent
02db1196fe
commit
0b2e6f5f7c
|
@ -77,7 +77,7 @@ let usage speclist errmsg =
|
|||
|
||||
let current = ref 0;;
|
||||
|
||||
let parse_argv_internal argv speclist anonfun errmsg =
|
||||
let parse_argv argv speclist anonfun errmsg =
|
||||
let stop error =
|
||||
let progname = if Array.length argv > 0 then argv.(0) else "(?)" in
|
||||
begin match error with
|
||||
|
@ -176,13 +176,7 @@ let parse_argv_internal argv speclist anonfun errmsg =
|
|||
done;
|
||||
;;
|
||||
|
||||
let parse_argv argv speclist anonfun errmsg =
|
||||
let save_current = !current in
|
||||
let parse =
|
||||
current := 0;
|
||||
try
|
||||
parse_argv_internal argv speclist anonfun errmsg;
|
||||
current := save_current;
|
||||
with ex -> current := save_current; raise ex
|
||||
parse_argv Sys.argv;
|
||||
;;
|
||||
|
||||
let parse = parse_argv Sys.argv;;
|
||||
|
|
|
@ -97,8 +97,9 @@ val parse :
|
|||
val parse_argv : string array ->
|
||||
(key * spec * doc) list -> anon_fun -> usage_msg -> unit
|
||||
(** [Arg.parse_argv args speclist anon_fun usage_msg] parses the array
|
||||
[args] as if it were the command line. It saves the value of
|
||||
[Arg.current] before starting and restores it before returning. *)
|
||||
[args] as if it were the command line. It uses and updates the
|
||||
value of [Arg.current]. You must set [Arg.current] before calling
|
||||
[parse_argv], and restore it afterward if needed. *)
|
||||
|
||||
exception Bad of string
|
||||
(** Functions in [spec] or [anon_fun] can raise [Arg.Bad] with an error
|
||||
|
|
Loading…
Reference in New Issue