From: rich Date: Tue, 5 Dec 2006 22:40:38 +0000 (+0000) Subject: Fix csvtool call to support '-' notation for reading from stdin. X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=d9ef4fca2f8124644ed167c0c3e62c96098175fb;p=ocaml-csv.git Fix csvtool call to support '-' notation for reading from stdin. --- diff --git a/csvtool.ml b/csvtool.ml index 724eb72..8c54081 100644 --- a/csvtool.ml +++ b/csvtool.ml @@ -1,5 +1,5 @@ (* Handy tool for managing CSV files. - * $Id: csvtool.ml,v 1.9 2006-12-05 22:24:44 rich Exp $ + * $Id: csvtool.ml,v 1.10 2006-12-05 22:40:38 rich Exp $ *) open Printf @@ -316,9 +316,12 @@ let cmd_call ~input_sep ~output_sep ~chan command files = in List.iter ( fun filename -> - let in_chan = open_in filename in + let in_chan, close = + match filename with + | "-" -> stdin, false + | filename -> open_in filename, true in load_rows ~separator:input_sep f in_chan; - close_in in_chan + if close then close_in in_chan ) files let rec uniq = function