Commit f3c25e73 authored by Taddeüs Kroes's avatar Taddeüs Kroes

Fix stack overflow when passing multiple options in one argument

parent 4350368c
...@@ -81,7 +81,7 @@ let parse_args () = ...@@ -81,7 +81,7 @@ let parse_args () =
| "-o" :: filename :: tl -> | "-o" :: filename :: tl ->
handle {args with outfile = Some filename} tl handle {args with outfile = Some filename} tl
| arg :: tl when String.length arg > 1 && arg.[0] = '-' && arg.[1] <> '-' -> | arg :: tl when String.length arg > 2 && arg.[0] = '-' && arg.[1] <> '-' ->
let rec handle_opts args = function let rec handle_opts args = function
| i when i = String.length arg -> args | i when i = String.length arg -> args
| i -> handle_opts (handle args ["-" ^ String.make 1 arg.[i]]) (i + 1) | i -> handle_opts (handle args ["-" ^ String.make 1 arg.[i]]) (i + 1)
...@@ -89,7 +89,7 @@ let parse_args () = ...@@ -89,7 +89,7 @@ let parse_args () =
handle (handle_opts args 1) tl handle (handle_opts args 1) tl
| arg :: tl when arg.[0] = '-' -> | arg :: tl when arg.[0] = '-' ->
prerr_string usage; prerr_endline usage;
raise (Failure ("unknown option " ^ arg)) raise (Failure ("unknown option " ^ arg))
| filename :: tl -> | filename :: tl ->
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment