1 let cols = int_of_string (Sys.getenv "COLUMNS")
10 if s = "" then false else
11 begin hl := s :: !hl; true end
14 if Scanf.fscanf ich "%s " add then read ich
16 let length l s = max l (String.length s)
19 let pre, post = if List.mem s !hl then color, normal else "", "" in
20 let spc = String.make (l - String.length s) ' ' in
22 if c = 0 || c = cols then "", l else
23 if c + l < cols then " ", c + succ l else "\n", l
25 Printf.printf "%s%s%s%s%s" bol pre s post spc;
29 let ich = open_in fname in
30 read ich; close_in ich
35 Arg.parse [] process help;
36 let files = Sys.readdir "." in
37 Array.fast_sort String.compare files;
38 let l = Array.fold_left length 0 files in
39 if cols < l then failwith "window too small";
40 let c = Array.fold_left (write l) 0 files in
41 if 0 < c && c < cols then print_newline ()