Refining file handling.
This commit is contained in:
@ -18,15 +18,6 @@
|
||||
r> close-file drop
|
||||
;
|
||||
|
||||
: cat ( "path" -- )
|
||||
bl parse r/o bin open-file throw { fh }
|
||||
begin
|
||||
here 80 fh read-file throw
|
||||
dup 0= if drop fh close-file throw exit then
|
||||
here swap type
|
||||
again
|
||||
;
|
||||
|
||||
: cp ( "src" "dst" -- )
|
||||
bl parse r/o bin open-file throw { inf }
|
||||
bl parse w/o bin create-file throw { outf }
|
||||
@ -46,6 +37,22 @@
|
||||
close-file throw
|
||||
;
|
||||
|
||||
internals definitions
|
||||
|
||||
: cremit ( ch -- ) dup nl = if drop cr else emit then ;
|
||||
: crtype ( a n -- ) for aft dup c@ cremit 1+ then next drop ;
|
||||
|
||||
forth definitions internals
|
||||
|
||||
: cat ( "path" -- )
|
||||
bl parse r/o bin open-file throw { fh }
|
||||
begin
|
||||
here 80 fh read-file throw
|
||||
dup 0= if drop fh close-file throw exit then
|
||||
here swap crtype
|
||||
again
|
||||
;
|
||||
|
||||
internals definitions
|
||||
( Leave some room for growth of starting system. )
|
||||
0 value saving-base
|
||||
|
||||
Reference in New Issue
Block a user