summaryrefslogtreecommitdiff
path: root/stdlib/arg.ml
diff options
context:
space:
mode:
authorDamien Doligez <damien.doligez-inria.fr>2001-08-21 15:10:51 +0000
committerDamien Doligez <damien.doligez-inria.fr>2001-08-21 15:10:51 +0000
commitf5759d294ad036ce11a428e5e73277bf981615cf (patch)
treeb1a72d53b94421d286de160a7540cdda00e31b0a /stdlib/arg.ml
parent91e077432c401dca5ec3205e13dd80d98f950ebb (diff)
downloadocaml-f5759d294ad036ce11a428e5e73277bf981615cf.tar.gz
arg: ajout --help; random: meilleur init
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@3644 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'stdlib/arg.ml')
-rw-r--r--stdlib/arg.ml7
1 files changed, 6 insertions, 1 deletions
diff --git a/stdlib/arg.ml b/stdlib/arg.ml
index c3e7593baa..1de0a785f9 100644
--- a/stdlib/arg.ml
+++ b/stdlib/arg.ml
@@ -44,6 +44,8 @@ let usage speclist errmsg =
List.iter (function (key, _, doc) -> eprintf " %s %s\n" key doc) speclist;
try ignore (assoc3 "-help" speclist)
with Not_found -> eprintf " -help display this list of options\n";
+ try ignore (assoc3 "--help" speclist)
+ with Not_found -> eprintf " --help display this list of options\n";
;;
let current = ref 0;;
@@ -55,6 +57,7 @@ let parse speclist anonfun errmsg =
if initpos < Array.length Sys.argv then Sys.argv.(initpos) else "(?)" in
begin match error with
| Unknown "-help" -> ()
+ | Unknown "--help" -> ()
| Unknown s ->
eprintf "%s: unknown option `%s'.\n" progname s
| Missing s ->
@@ -66,7 +69,9 @@ let parse speclist anonfun errmsg =
eprintf "%s: %s.\n" progname s
end;
usage speclist errmsg;
- exit (if error = (Unknown "-help") then 0 else 2);
+ if error = Unknow "-help" || error = Unknown "--help"
+ then exit 0
+ else exit 2
in
let l = Array.length Sys.argv in
incr current;