1 ! Copyright (C) 2010 John Benediktsson
2 ! See http://factorcode.org/license.txt for BSD license
4 USING: command-line formatting fry io io.encodings
5 io.encodings.binary io.files kernel namespaces sequences ;
10 input-stream get binary re-decode
11 output-stream get binary re-encode
12 '[ _ stream-write ] each-stream-block ;
14 : cat-file ( path -- )
16 binary [ cat-stream ] with-file-reader
17 ] [ "%s: not found\n" printf flush ] if ;
19 : cat-files ( paths -- )
20 [ dup "-" = [ drop cat-stream ] [ cat-file ] if ] each ;
23 command-line get [ cat-stream ] [ cat-files ] if-empty ;