summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorG.raud <graud@gmx.com>2018-02-01 07:02:34 +0100
committerG.raud <graud@gmx.com>2018-02-02 08:28:28 +0100
commitdf1b3770f42745378dd4be69f8fcd51a4d358a46 (patch)
treecad1ea6dee3a6ded25390dc443d504b7c09c3077
parentdd964036b906b6a6dfa7d947809849a68d9834ca (diff)
downloadunison-df1b3770f42745378dd4be69f8fcd51a4d358a46.zip
unison-df1b3770f42745378dd4be69f8fcd51a4d358a46.tar.gz
unison-df1b3770f42745378dd4be69f8fcd51a4d358a46.tar.bz2
Uarg: do not discard an empty value following the option
The change makes command line arguments of the form "-option=" "val" considered equivalent to "-option" "" "val" but not to "-option" "val" anymore. The only function changed is Util.splitAtFirstChar.
-rw-r--r--src/ubase/util.ml8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/ubase/util.ml b/src/ubase/util.ml
index bbc562b..a02567f 100644
--- a/src/ubase/util.ml
+++ b/src/ubase/util.ml
@@ -403,10 +403,10 @@ let trimWhitespace s =
let splitAtFirstChar (s:string) (c:char) =
try
- let i = String.index s c in
- match String.length s with
- l when l=i+1 -> [String.sub s 0 i] (* do not include the empty string *)
- | l -> [String.sub s 0 i; String.sub s (i+1) (l-i-1)]
+ let i = String.index s c
+ and l= String.length s in
+ (* rest is possibly the empty string *)
+ [String.sub s 0 i; String.sub s (i+1) (l-i-1)]
with Not_found -> [s]
let splitIntoWords ?esc:(e='\\') (s:string) (c:char) =