More shell type commands.
This commit is contained in:
@ -13,20 +13,32 @@
|
|||||||
\ limitations under the License.
|
\ limitations under the License.
|
||||||
|
|
||||||
: dump-file ( a n a n -- )
|
: dump-file ( a n a n -- )
|
||||||
w/o create-file if drop ." failed create-file" exit then
|
w/o create-file throw
|
||||||
>r r@ write-file if r> drop ." failed write-file" exit then
|
>r r@ write-file throw
|
||||||
r> close-file drop
|
r> close-file drop
|
||||||
;
|
;
|
||||||
|
|
||||||
: cat ( "path" -- )
|
: cat ( "path" -- )
|
||||||
parse r/o open-file if ." not found!" exit then { fh }
|
bl parse r/o bin open-file throw { fh }
|
||||||
begin
|
begin
|
||||||
here 80 fh read-file if drop exit fh close-file drop exit then
|
here 80 fh read-file throw
|
||||||
dup 0= if exit then
|
dup 0= if drop fh close-file throw exit then
|
||||||
here swap type
|
here swap type
|
||||||
again
|
again
|
||||||
;
|
;
|
||||||
|
|
||||||
|
: cp ( "src" "dst" -- )
|
||||||
|
bl parse r/o bin open-file throw { inf }
|
||||||
|
bl parse w/o bin create-file throw { outf }
|
||||||
|
begin
|
||||||
|
here 80 inf read-file throw
|
||||||
|
dup 0= if drop outf close-file throw inf close-file throw exit then
|
||||||
|
here swap outf write-file throw
|
||||||
|
again
|
||||||
|
;
|
||||||
|
|
||||||
|
: rm ( "path" --- ) bl parse delete-file throw ;
|
||||||
|
|
||||||
internals definitions
|
internals definitions
|
||||||
( Leave some room for growth of starting system. )
|
( Leave some room for growth of starting system. )
|
||||||
0 value saving-base
|
0 value saving-base
|
||||||
|
|||||||
@ -409,6 +409,9 @@ e: check-snapshots
|
|||||||
out: remember
|
out: remember
|
||||||
out: restore
|
out: restore
|
||||||
out: save
|
out: save
|
||||||
|
out: rm
|
||||||
|
out: cp
|
||||||
|
out: cat
|
||||||
out: dump-file
|
out: dump-file
|
||||||
;e
|
;e
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user