Skip to content

Commit

Permalink
add bin/shell to the build, fix deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
hannesm committed Apr 11, 2022
1 parent 86c1ff6 commit 435b09a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
4 changes: 2 additions & 2 deletions bin/dune
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(executables
(names main)
(public_names fat)
(names main shell)
(public_names fat shell)
(libraries fat-filesystem mirage-block-unix cmdliner))
11 changes: 5 additions & 6 deletions bin/shell.ml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
(* This is a toplevel-like test program *)
open Lwt.Infix
open Mirage_fs

module Test = Fat.FS(Block)
module Test = Fat.Make(Block)

let with_file flags filename f =
Lwt_unix.openfile filename flags 0o0 >>= fun file ->
Expand All @@ -14,7 +13,7 @@ let with_file flags filename f =
Lwt_unix.close file >>= fun () ->
Lwt.fail x)

let fail fmt = Fmt.kstrf Lwt.fail_with fmt
let fail fmt = Fmt.kstr Lwt.fail_with fmt

let (>>|=) m f = m >>= function
| Error e -> fail "%a" Test.pp_error e
Expand Down Expand Up @@ -58,7 +57,7 @@ let main filename _create_size =
let n = ref 0 in
List.iter (fun buf ->
Printf.printf "%s" (Cstruct.to_string buf);
n := !n + (Cstruct.len buf)
n := !n + (Cstruct.length buf)
) datas;
Printf.printf "\n%!";
if !n <> file_size
Expand Down Expand Up @@ -160,10 +159,10 @@ let main filename _create_size =
inner (snd(parse_path x))
in

let space = Re_str.regexp_string " " in
let space = Re.Str.regexp_string " " in
let rec loop () =
Printf.printf "A:%s> %!" (Path.to_string !cwd);
match Re_str.split space (input_line stdin) with
match Re.Str.split space (input_line stdin) with
| [ "dir" ] -> do_dir "" >>= loop
| [ "dir"; path ] -> do_dir path >>= loop
| [ "cd"; path ] -> do_cd path >>= loop
Expand Down

0 comments on commit 435b09a

Please sign in to comment.