Skip to content

Commit 6215d67

Browse files
committed
Avoid shell backticks and improve md5sum.ml error messages
1 parent 47ceedd commit 6215d67

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

Makefile.checker

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ checker/%.cmx: checker/%.ml
7777

7878
md5chk:
7979
$(SHOW)'MD5SUM cic.mli'
80-
$(HIDE)if grep -q "^MD5 `$(OCAML) tools/md5sum.ml checker/cic.mli`$$" checker/values.ml; \
81-
then true; else echo "Error: outdated checker/values.ml"; false; fi
80+
$(HIDE)if grep -q "^MD5 $$($(OCAML) tools/md5sum.ml checker/cic.mli)$$" checker/values.ml; \
81+
then true; else echo "Error: outdated checker/values.ml" >&2; false; fi
8282

8383
.PHONY: md5chk
8484

tools/md5sum.ml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ let get_content file =
77
git checkout has included return characters.
88
See: https://github.com/coq/coq/pull/6305 *)
99
| c -> Buffer.add_char buf c; fill ()
10+
| exception End_of_file -> close_in ic; Buffer.contents buf
1011
in
11-
try fill () with End_of_file -> Buffer.contents buf
12+
fill ()
1213

1314
let () =
1415
match Sys.argv with
@@ -18,6 +19,6 @@ let () =
1819
print_string (md5 ^ " " ^ file)
1920
| _ ->
2021
prerr_endline "Error: This program needs exactly one parameter.";
21-
prerr_endline "Usage: ocaml md5sum.ml [FILE]";
22-
prerr_endline "Print MD5 (128-bit) checksum.";
22+
prerr_endline "Usage: ocaml md5sum.ml <FILE>";
23+
prerr_endline "Print MD5 (128-bit) checksum of the file content modulo \\r.";
2324
exit 1

0 commit comments

Comments
 (0)