Skip to content

Commit

Permalink
Remove the rest of stringext
Browse files Browse the repository at this point in the history
This completes the job started in 1f4321a

Signed-off-by: David Scott <[email protected]>
  • Loading branch information
djs55 committed Jul 18, 2016
1 parent f9d7acb commit 42bb14b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/_tags
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<*.*>: package(stringext), package(result), package(fmt), package(lambda-term)
<*.*>: package(astring), package(result), package(fmt), package(lambda-term)
<*.*>: package(cstruct), package(cstruct.lwt)
<*.*>: package(lwt)
<*.*>: package(cmdliner, logs.fmt)
Expand Down
19 changes: 10 additions & 9 deletions src/main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
open Protocol_9p
open Infix
open Lwt
open Astring

let project_url = "http://github.com/mirage/ocaml-9p"
let version = "%%VERSION%%"
Expand All @@ -39,11 +40,11 @@ let finally f g =
Lwt.fail e)

let parse_address address =
match Stringext.split ~on:':' ~max:2 address with
| [ proto; address ] -> proto, address
| _ -> address, "5640"
match String.cut ~sep:":" address with
| Some (proto, address) -> proto, address
| None -> address, "5640"

let parse_path x = Stringext.split x ~on:'/'
let parse_path x = String.cuts x ~sep:"/"

let with_client address username f =
let proto, address = parse_address address in
Expand Down Expand Up @@ -160,7 +161,7 @@ let print_stats stats =
let rows = Array.of_list (List.map row_of_stat stats) in
let padto n x =
let extra = max 0 (n - (String.length x)) in
x ^ (String.make extra ' ') in
x ^ (String.v extra (fun _ -> ' ')) in
Array.iter (fun row ->
Array.iteri (fun i txt ->
let column = Array.map (fun row -> row.(i)) rows in
Expand Down Expand Up @@ -200,7 +201,7 @@ class read_line ~term ~history ~state = object(self)
initializer
let open React in
let open LTerm_text in
self#set_prompt (S.const (eval [ S (Printf.sprintf "9P %s> " (String.concat "/" !cwd)) ]))
self#set_prompt (S.const (eval [ S (Printf.sprintf "9P %s> " (String.concat ~sep:"/" !cwd)) ]))
end

let shell debug address username =
Expand All @@ -209,7 +210,7 @@ let shell debug address username =
with_client address username
(fun t ->
let execute_command x =
match Stringext.split ~on:' ' x with
match String.cuts ~sep:" " x with
| [ "ls" ] ->
begin
Client.readdir t !cwd >>= function
Expand All @@ -221,7 +222,7 @@ let shell debug address username =
return ()
end
| [ "cd"; dir ] ->
let dir' = Stringext.split ~on:'/' dir in
let dir' = String.cuts ~sep:"/" dir in
let newdir =
if dir <> "" && dir.[0] = '/' then dir'
else if dir = "." then !cwd
Expand Down Expand Up @@ -273,7 +274,7 @@ let shell debug address username =
>>= fun () ->
return ()
| "write" :: file :: rest ->
let data = String.concat " " rest in
let data = String.concat ~sep:" " rest in
let buf = Cstruct.create (String.length data) in
Cstruct.blit_from_string data 0 buf 0 (Cstruct.len buf);
begin
Expand Down

0 comments on commit 42bb14b

Please sign in to comment.