From d9ef4fca2f8124644ed167c0c3e62c96098175fb Mon Sep 17 00:00:00 2001 From: rich Date: Tue, 5 Dec 2006 22:40:38 +0000 Subject: [PATCH] Fix csvtool call to support '-' notation for reading from stdin. --- csvtool.ml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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 -- 1.8.3.1