diff options
author | G.raud <graud@gmx.com> | 2018-02-01 06:42:53 +0100 |
---|---|---|
committer | G.raud <graud@gmx.com> | 2018-02-02 08:27:46 +0100 |
commit | 77885be3740480136c2749ea11dd37a6ca1a18cd (patch) | |
tree | 02a93986b3d4e4ee4d1450bbc7254e6bf2bb1455 | |
parent | de383ead397a25b4ea197a4e8e112b08655c1963 (diff) | |
download | unison-77885be3740480136c2749ea11dd37a6ca1a18cd.zip unison-77885be3740480136c2749ea11dd37a6ca1a18cd.tar.gz unison-77885be3740480136c2749ea11dd37a6ca1a18cd.tar.bz2 |
Uarg: fix parsing of equal sign '=' following command line option names
The change makes the parser only take a single '=' as delimiter after an
option name and lets it consider as valid other '=' in the value to the
option.
Splitting the argument with Util.splitAtFirstChar instead of
Util.splitIntoWords also disables parsing of the escaping backslash in
the option.
-rw-r--r-- | src/ubase/uarg.ml | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/ubase/uarg.ml b/src/ubase/uarg.ml index 5ffd924..f2e5444 100644 --- a/src/ubase/uarg.ml +++ b/src/ubase/uarg.ml @@ -69,7 +69,7 @@ let parse speclist anonfun errmsg = while !current < l do let ss = argv.(!current) in if String.length ss >= 1 & String.get ss 0 = '-' then begin - let args = Util.splitIntoWords ss '=' in + let args = Util.splitAtFirstChar ss '=' in let s = Safelist.nth args 0 in let arg conv mesg = match args with @@ -79,7 +79,7 @@ let parse speclist anonfun errmsg = incr current; (try conv a with Failure _ -> stop (Wrong (s, a, mesg))) | [_;a] -> (try conv a with Failure _ -> stop (Wrong (s, a, mesg))) - | _ -> stop (Message (sprintf "Garbled argument %s" s)) in + | _ -> assert false in let action = try assoc3 s speclist with Not_found -> stop (Unknown s) |