1 ! Copyright (C) 2010 John Benediktsson
2 ! See http://factorcode.org/license.txt for BSD license
4 USING: command-line formatting kernel io io.encodings.binary
5 io.files namespaces sequences strings ;
10 [ print flush ] each-line ;
13 [ >string write flush ] each-block ;
15 : cat-file ( path -- )
17 binary [ cat-stream ] with-file-reader
18 ] [ "%s: not found\n" printf flush ] if ;
20 : cat-files ( paths -- )
21 [ dup "-" = [ drop cat-lines ] [ cat-file ] if ] each ;
24 command-line get [ cat-lines ] [ cat-files ] if-empty ;