1 ! Copyright (C) 2010 John Benediktsson
2 ! See https://factorcode.org/license.txt for BSD license
4 USING: command-line io io.encodings io.encodings.binary io.files
5 kernel namespaces sequences ;
10 input-stream get binary re-decode
11 output-stream get binary re-encode
12 '[ _ [ stream-write ] [ stream-flush ] bi ] each-stream-block ;
14 : cat-file ( path -- )
15 [ binary [ cat-stream ] with-file-reader ]
16 [ write ": not found" print flush ] if-file-exists ;
18 : cat-files ( paths -- )
19 [ dup "-" = [ drop cat-stream ] [ cat-file ] if flush ] each ;
22 command-line get [ cat-stream ] [ cat-files ] if-empty ;