Beginnings of a simple shell.
This commit is contained in:
11
ueforth/posix/shell.fs
Normal file
11
ueforth/posix/shell.fs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
( Shell like words )
|
||||||
|
vocabulary shell shell definitions also posix
|
||||||
|
512 constant max-path
|
||||||
|
create cwd max-path allot 0 value cwd#
|
||||||
|
: +cwd ( a n -- ) dup >r cwd cwd# + swap cmove r> cwd# + to cwd# ;
|
||||||
|
: /+ s" /" +cwd ; : /? cwd cwd# 1- + c@ [char] / = ;
|
||||||
|
/+
|
||||||
|
|
||||||
|
: pwd cwd cwd# type cr ;
|
||||||
|
: cd.. begin /? cwd# 1- to cwd# until ;
|
||||||
|
: cd ( "name" ) bl parse /? 0= if /+ then +cwd ;
|
||||||
Reference in New Issue
Block a user