Added mv, fixed rename of esp32, and added touch.
This commit is contained in:
@ -37,7 +37,14 @@
|
||||
again
|
||||
;
|
||||
|
||||
: rm ( "path" --- ) bl parse delete-file throw ;
|
||||
: mv ( "src" "dst" -- ) bl parse bl parse rename-file throw ;
|
||||
: rm ( "path" -- ) bl parse delete-file throw ;
|
||||
|
||||
: touch ( "path" -- )
|
||||
bl parse 2dup w/o open-file
|
||||
if drop w/o create-file throw then
|
||||
close-file throw
|
||||
;
|
||||
|
||||
internals definitions
|
||||
( Leave some room for growth of starting system. )
|
||||
|
||||
@ -409,7 +409,9 @@ e: check-snapshots
|
||||
out: remember
|
||||
out: restore
|
||||
out: save
|
||||
out: touch
|
||||
out: rm
|
||||
out: mv
|
||||
out: cp
|
||||
out: cat
|
||||
out: dump-file
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
// limitations under the License.
|
||||
|
||||
static char filename[PATH_MAX];
|
||||
static char filename2[PATH_MAX];
|
||||
|
||||
{{bits}}
|
||||
{{core}}
|
||||
|
||||
@ -125,7 +125,9 @@ static cell_t ResizeFile(cell_t fd, cell_t size);
|
||||
X("DELETE-FILE", DELETE_FILE, cell_t len = n0; DROP; \
|
||||
memcpy(filename, a0, len); filename[len] = 0; \
|
||||
n0 = unlink(filename); n0 = n0 ? errno : 0) \
|
||||
X("RENAME-FILE", RENAME_FILE, NIPn(3); /* unimplemented */ n0 = 1) \
|
||||
X("RENAME-FILE", RENAME_FILE, memcpy(filename, a1, n0); filename[n0] = 0; \
|
||||
memcpy(filename2, a3, n2); filename2[n2] = 0; \
|
||||
n0 = rename(filename, filename2); n0 = n0 ? errno : 0) \
|
||||
X("WRITE-FILE", WRITE_FILE, cell_t fd = n0; DROP; cell_t len = n0; DROP; \
|
||||
n0 = write(fd, a0, len); n0 = n0 != len ? errno : 0) \
|
||||
X("READ-FILE", READ_FILE, cell_t fd = n0; DROP; cell_t len = n0; DROP; \
|
||||
|
||||
Reference in New Issue
Block a user