Added mv, fixed rename of esp32, and added touch.

This commit is contained in:
Brad Nelson
2022-09-05 17:29:41 -07:00
parent a6dddb83e1
commit 8cd205a9a5
4 changed files with 14 additions and 2 deletions

View File

@ -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. )

View File

@ -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

View File

@ -13,6 +13,7 @@
// limitations under the License.
static char filename[PATH_MAX];
static char filename2[PATH_MAX];
{{bits}}
{{core}}

View File

@ -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; \