mirror of
https://github.com/ksherlock/mpw.git
synced 2025-01-18 12:30:29 +00:00
implement ftrap_delete
This commit is contained in:
parent
af98ca4bfd
commit
09b0eb102f
@ -13,6 +13,7 @@
|
||||
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/paths.h>
|
||||
|
||||
#include <cpu/defs.h>
|
||||
@ -33,6 +34,24 @@ namespace MPW
|
||||
{
|
||||
|
||||
|
||||
uint32_t ftrap_delete(uint32_t name)
|
||||
{
|
||||
|
||||
std::string sname;
|
||||
int rv;
|
||||
|
||||
sname = ToolBox::ReadCString(name, true);
|
||||
|
||||
Log(" delete(%s)\n", sname.c_str());
|
||||
|
||||
rv = ::unlink(sname.c_str());
|
||||
if (rv < 0) return 0x40000000 | errno_to_errno(errno);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
uint32_t ftrap_open(uint32_t name, uint32_t parm)
|
||||
{
|
||||
uint32_t d0;
|
||||
@ -118,6 +137,7 @@ namespace MPW
|
||||
return d0;
|
||||
}
|
||||
|
||||
|
||||
void ftrap_access(uint16_t trap)
|
||||
{
|
||||
// open a file, rename a file, or delete a file.
|
||||
@ -139,6 +159,11 @@ namespace MPW
|
||||
case kF_OPEN:
|
||||
d0 = ftrap_open(name, parm);
|
||||
break;
|
||||
|
||||
case kF_DELETE:
|
||||
d0 = ftrap_delete(name);
|
||||
break;
|
||||
|
||||
case kF_GTABINFO:
|
||||
d0 = 0x40000000 | kEINVAL;
|
||||
break;
|
||||
@ -146,6 +171,7 @@ namespace MPW
|
||||
default:
|
||||
d0 = 0x40000000 | kEINVAL;
|
||||
fprintf(stderr, "faccess - unsupported op %04x\n", op);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
cpuSetDReg(0, d0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user