Added -args
This commit is contained in:
parent
e3c00a52fb
commit
1f4a1a7cd5
|
@ -3359,6 +3359,19 @@ let parse_argv () =
|
||||||
let align_specs s =
|
let align_specs s =
|
||||||
Arg.align s
|
Arg.align s
|
||||||
|
|
||||||
|
(* The old -control mechanism clashed with AND, but must be retained for
|
||||||
|
backwards compatibility. There is a new mechanism -args file which performs
|
||||||
|
direct textual substitution of the file, before any expansion of ANDs *)
|
||||||
|
let rec expand_args_inner prev = function
|
||||||
|
[] -> rev prev
|
||||||
|
| "-args"::filename::r ->
|
||||||
|
expand_args_inner (rev (parse_control_file filename) @ prev) r
|
||||||
|
| h::t -> expand_args_inner (h::prev) t
|
||||||
|
|
||||||
|
let expand_args argv =
|
||||||
|
let l = Array.to_list argv in
|
||||||
|
Array.of_list (expand_args_inner [] l)
|
||||||
|
|
||||||
(* Main function. *)
|
(* Main function. *)
|
||||||
let go_withargv argv =
|
let go_withargv argv =
|
||||||
if demo then
|
if demo then
|
||||||
|
@ -3370,6 +3383,8 @@ let go_withargv argv =
|
||||||
flush stderr
|
flush stderr
|
||||||
end;
|
end;
|
||||||
try
|
try
|
||||||
|
(* Pre-expand -args *)
|
||||||
|
let argv = expand_args argv in
|
||||||
(* Split the arguments into sets either side of ANDs *)
|
(* Split the arguments into sets either side of ANDs *)
|
||||||
let sets =
|
let sets =
|
||||||
let args =
|
let args =
|
||||||
|
@ -3394,13 +3409,10 @@ let go_withargv argv =
|
||||||
flush stdout (*r for Windows *)
|
flush stdout (*r for Windows *)
|
||||||
with
|
with
|
||||||
| Arg.Bad s ->
|
| Arg.Bad s ->
|
||||||
let s' =
|
prerr_string
|
||||||
let chars = explode s in
|
(implode (takewhile (neq '\n') (explode s)) ^ " Use -help for help.\n\n");
|
||||||
implode (takewhile (neq '\n') chars) ^ " Use -help for help.\n\n"
|
flush stderr;
|
||||||
in
|
exit 2
|
||||||
prerr_string s';
|
|
||||||
flush stderr;
|
|
||||||
exit 2
|
|
||||||
| Arg.Help _ ->
|
| Arg.Help _ ->
|
||||||
Arg.usage (align_specs specs) usage_msg;
|
Arg.usage (align_specs specs) usage_msg;
|
||||||
flush stderr (*r for Windows *)
|
flush stderr (*r for Windows *)
|
||||||
|
|
Loading…
Reference in New Issue