|
|
@ -25,7 +25,6 @@ |
|
|
#define S_ISDIR(mode) (((mode) & _S_IFDIR) != 0) |
|
|
#define S_ISDIR(mode) (((mode) & _S_IFDIR) != 0) |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static cpm_byte* find_fcb; |
|
|
static cpm_byte* find_fcb; |
|
|
static int find_n; |
|
|
static int find_n; |
|
|
static int find_ext = 0; |
|
|
static int find_ext = 0; |
|
|
@ -48,9 +47,11 @@ static char upper(char c) |
|
|
* the naive code in the distributed zx will not work everywhere. |
|
|
* the naive code in the distributed zx will not work everywhere. |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
|
|
|
/* Does the string "s" match the CP/M FCB? */ |
|
|
|
|
|
/* pattern[0-10] will become a CP/M name parsed from "s" if it matches. */ |
|
|
|
|
|
/* If 1st byte of FCB is '?' then anything matches. */ |
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
* Does the string "s" match the CP/M FCB? |
|
|
|
|
|
* pattern[0-10] will become a CP/M name parsed from "s" if it matches. |
|
|
|
|
|
* If 1st byte of FCB is '?' then anything matches. |
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
static int cpm_match(char* s, cpm_byte* fcb, cpm_byte* pattern) |
|
|
static int cpm_match(char* s, cpm_byte* fcb, cpm_byte* pattern) |
|
|
{ |
|
|
{ |
|
|
@ -65,6 +66,7 @@ static int cpm_match(char *s, cpm_byte *fcb, cpm_byte *pattern) |
|
|
* the fcb. we reject any that can't be valid cp/m filenames, |
|
|
* the fcb. we reject any that can't be valid cp/m filenames, |
|
|
* normalizing case as we go. all this goes into 'pattern' |
|
|
* normalizing case as we go. all this goes into 'pattern' |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
|
|
|
for (n = 0; n < 11; n++) pattern[n] = ' '; |
|
|
for (n = 0; n < 11; n++) pattern[n] = ' '; |
|
|
|
|
|
|
|
|
/* The name must have 1 or 0 dots */ |
|
|
/* The name must have 1 or 0 dots */ |
|
|
@ -74,7 +76,8 @@ static int cpm_match(char *s, cpm_byte *fcb, cpm_byte *pattern) |
|
|
for (n = 0; n < m; n++) { |
|
|
for (n = 0; n < m; n++) { |
|
|
pattern[n] = upper(s[n]) & 0x7F; |
|
|
pattern[n] = upper(s[n]) & 0x7F; |
|
|
} |
|
|
} |
|
|
} else { /* at least one dot */ |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
else { /* at least one dot */ |
|
|
if (strchr(dotpos + 1, '.')) { /* More than 1 dot */ |
|
|
if (strchr(dotpos + 1, '.')) { /* More than 1 dot */ |
|
|
return 0; |
|
|
return 0; |
|
|
} |
|
|
} |
|
|
@ -100,6 +103,7 @@ static int cpm_match(char *s, cpm_byte *fcb, cpm_byte *pattern) |
|
|
* handle special case where fcb[0] == '?' or fcb[0] & 0x80 |
|
|
* handle special case where fcb[0] == '?' or fcb[0] & 0x80 |
|
|
* this is used to return a full directory list on bdos's |
|
|
* this is used to return a full directory list on bdos's |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
|
|
|
if (((fcb[0] & 0x7F) == '?') || (fcb[0] & 0x80)) { |
|
|
if (((fcb[0] & 0x7F) == '?') || (fcb[0] & 0x80)) { |
|
|
return 1; |
|
|
return 1; |
|
|
} |
|
|
} |
|
|
@ -114,7 +118,6 @@ static int cpm_match(char *s, cpm_byte *fcb, cpm_byte *pattern) |
|
|
return 1; /* Success! */ |
|
|
return 1; /* Success! */ |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Get the next entry from the host's directory matching "fcb" */ |
|
|
/* Get the next entry from the host's directory matching "fcb" */ |
|
|
|
|
|
|
|
|
static struct dirent* next_entry(DIR* dir, cpm_byte* fcb, cpm_byte* pattern, |
|
|
static struct dirent* next_entry(DIR* dir, cpm_byte* fcb, cpm_byte* pattern, |
|
|
@ -131,26 +134,25 @@ static struct dirent * next_entry(DIR *dir, cpm_byte *fcb, cpm_byte *pattern, |
|
|
for (unsatisfied = 1; unsatisfied; ) |
|
|
for (unsatisfied = 1; unsatisfied; ) |
|
|
{ |
|
|
{ |
|
|
/* 1. Get the next entry */ |
|
|
/* 1. Get the next entry */ |
|
|
|
|
|
|
|
|
en = readdir(dir); |
|
|
en = readdir(dir); |
|
|
if (!en) return NULL; /* No next entry */ |
|
|
if (!en) return NULL; /* No next entry */ |
|
|
++entryno; /* 0 for 1st, 1 for 2nd, etc. */ |
|
|
++entryno; /* 0 for 1st, 1 for 2nd, etc. */ |
|
|
|
|
|
|
|
|
/* 2. See if it matches. We do this first (in preference to
|
|
|
/* 2. See if it matches. We do this first (in preference to
|
|
|
seeing if it's a subdirectory first) because it doesn't |
|
|
|
|
|
require disc access */ |
|
|
|
|
|
|
|
|
* seeing if it's a subdirectory first) because it doesn't |
|
|
|
|
|
* require disc access */ |
|
|
if (!cpm_match(en->d_name, fcb, pattern)) |
|
|
if (!cpm_match(en->d_name, fcb, pattern)) |
|
|
{ |
|
|
{ |
|
|
continue; |
|
|
continue; |
|
|
} |
|
|
} |
|
|
/* 3. Stat it, & reject it if it's a directory */ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* 3. Stat it, & reject it if it's a directory */ |
|
|
strcpy(target_name, redir_drive_prefix[drv]); |
|
|
strcpy(target_name, redir_drive_prefix[drv]); |
|
|
strcat(target_name, en->d_name); |
|
|
strcat(target_name, en->d_name); |
|
|
|
|
|
|
|
|
if (stat(target_name, st)) |
|
|
if (stat(target_name, st)) |
|
|
{ |
|
|
{ |
|
|
redir_Msg("Can't stat %s so omitting it.\n", target_name); |
|
|
|
|
|
|
|
|
DBGMSGV("Can't stat %s so omitting it.\n", target_name); |
|
|
continue; /* Can't stat */ |
|
|
continue; /* Can't stat */ |
|
|
} |
|
|
} |
|
|
if (S_ISDIR(st->st_mode)) |
|
|
if (S_ISDIR(st->st_mode)) |
|
|
@ -166,8 +168,6 @@ static struct dirent * next_entry(DIR *dir, cpm_byte *fcb, cpm_byte *pattern, |
|
|
return en; |
|
|
return en; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void volume_label(int drv, cpm_byte* dma) |
|
|
void volume_label(int drv, cpm_byte* dma) |
|
|
{ |
|
|
{ |
|
|
struct stat st; |
|
|
struct stat st; |
|
|
@ -176,6 +176,7 @@ void volume_label(int drv, cpm_byte *dma) |
|
|
|
|
|
|
|
|
/* Get label name */ |
|
|
/* Get label name */ |
|
|
redir_get_label(drv, (char*)(dma + 1)); |
|
|
redir_get_label(drv, (char*)(dma + 1)); |
|
|
|
|
|
|
|
|
/* [0x0c] = label byte
|
|
|
/* [0x0c] = label byte
|
|
|
* [0x0d] = password byte (=0) |
|
|
* [0x0d] = password byte (=0) |
|
|
* [0x10-0x17] = password |
|
|
* [0x10-0x17] = password |
|
|
@ -193,7 +194,7 @@ void volume_label(int drv, cpm_byte *dma) |
|
|
|
|
|
|
|
|
if (stat(redir_drive_prefix[drv], &st)) |
|
|
if (stat(redir_drive_prefix[drv], &st)) |
|
|
{ |
|
|
{ |
|
|
redir_Msg("stat() fails on '%s'\n", redir_drive_prefix[drv]); |
|
|
|
|
|
|
|
|
DBGMSGV("stat() fails on '%s'\n", redir_drive_prefix[drv]); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -201,8 +202,6 @@ void volume_label(int drv, cpm_byte *dma) |
|
|
redir_wr32(dma + 0x1C, redir_cpmtime(st.st_mtime)); |
|
|
redir_wr32(dma + 0x1C, redir_cpmtime(st.st_mtime)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cpm_word redir_find(int n, cpm_byte* fcb, cpm_byte* dma) |
|
|
cpm_word redir_find(int n, cpm_byte* fcb, cpm_byte* dma) |
|
|
{ |
|
|
{ |
|
|
DIR* hostdir; |
|
|
DIR* hostdir; |
|
|
@ -249,12 +248,10 @@ cpm_word redir_find(int n, cpm_byte *fcb, cpm_byte *dma) |
|
|
return 0; |
|
|
return 0; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
memset(dma, 0, 128); /* Zap the buffer */ |
|
|
memset(dma, 0, 128); /* Zap the buffer */ |
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
If returning all entries, return a volume label. |
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
/* If returning all entries, return a volume label. */ |
|
|
|
|
|
|
|
|
if ((fcb[0] & 0x7F) == '?') |
|
|
if ((fcb[0] & 0x7F) == '?') |
|
|
{ |
|
|
{ |
|
|
if (!n) |
|
|
if (!n) |
|
|
@ -266,18 +263,18 @@ cpm_word redir_find(int n, cpm_byte *fcb, cpm_byte *dma) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/* Note: This implies that opendir() works on a filename with a
|
|
|
/* Note: This implies that opendir() works on a filename with a
|
|
|
trailing slash. It does under Linux, but that's the only assurance |
|
|
|
|
|
I can give. |
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
* trailing slash. It does under Linux, but that's the only assurance |
|
|
|
|
|
* I can give. */ |
|
|
|
|
|
|
|
|
entryno = -1; |
|
|
entryno = -1; |
|
|
hostdir = opendir(redir_drive_prefix[drv]); |
|
|
hostdir = opendir(redir_drive_prefix[drv]); |
|
|
|
|
|
|
|
|
if (!hostdir) |
|
|
if (!hostdir) |
|
|
{ |
|
|
{ |
|
|
redir_Msg("opendir() fails on '%s'\n", redir_drive_prefix[drv]); |
|
|
|
|
|
|
|
|
DBGMSGV("opendir() fails on '%s'\n", redir_drive_prefix[drv]); |
|
|
return 0xFF; |
|
|
return 0xFF; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/* We have a handle to the directory. */ |
|
|
/* We have a handle to the directory. */ |
|
|
while (n >= 0) |
|
|
while (n >= 0) |
|
|
{ |
|
|
{ |
|
|
@ -308,8 +305,6 @@ cpm_word redir_find(int n, cpm_byte *fcb, cpm_byte *dma) |
|
|
if (attrib & 4) dma[10] |= 0x80; /* system */ |
|
|
if (attrib & 4) dma[10] |= 0x80; /* system */ |
|
|
if (!(attrib & 0x20)) dma[11] |= 0x80; /* archive */ |
|
|
if (!(attrib & 0x20)) dma[11] |= 0x80; /* archive */ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* TODO: Under Unix, work out correct RO setting */ |
|
|
/* TODO: Under Unix, work out correct RO setting */ |
|
|
|
|
|
|
|
|
recs = (st.st_size + 127) / 128; |
|
|
recs = (st.st_size + 127) / 128; |
|
|
@ -322,8 +317,7 @@ cpm_word redir_find(int n, cpm_byte *fcb, cpm_byte *dma) |
|
|
dma[0x12] = entryno & 0xFF; |
|
|
dma[0x12] = entryno & 0xFF; |
|
|
|
|
|
|
|
|
redir_wr32(dma + 0x16, (dword)st.st_mtime); /* Modification time. */ |
|
|
redir_wr32(dma + 0x16, (dword)st.st_mtime); /* Modification time. */ |
|
|
/* TODO: It should be in DOS */ |
|
|
|
|
|
/* format */ |
|
|
|
|
|
|
|
|
/* TODO: It should be in DOS format */ |
|
|
/* TODO: At 0x1A, 1st cluster */ |
|
|
/* TODO: At 0x1A, 1st cluster */ |
|
|
redir_wr32(dma + 0x1C, st.st_size); /* True size */ |
|
|
redir_wr32(dma + 0x1C, st.st_size); /* True size */ |
|
|
|
|
|
|
|
|
@ -348,25 +342,13 @@ cpm_word redir_find(int n, cpm_byte *fcb, cpm_byte *dma) |
|
|
return 0; |
|
|
return 0; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
|
|
|
#define SHOWNAME(func) \ |
|
|
|
|
|
{ \ |
|
|
|
|
|
char fname[CPM_MAXPATH]; \ |
|
|
|
|
|
redir_fcb2unix(fcb, fname); \ |
|
|
|
|
|
redir_Msg(func "(\"%s\")\n", fname); \ |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#else |
|
|
|
|
|
#define SHOWNAME(func) |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
cpm_word fcb_find1(cpm_byte* fcb, cpm_byte* dma) /* 0x11 */ |
|
|
cpm_word fcb_find1(cpm_byte* fcb, cpm_byte* dma) /* 0x11 */ |
|
|
{ |
|
|
{ |
|
|
#ifdef DEBUG |
|
|
#ifdef DEBUG |
|
|
int rv; |
|
|
int rv; |
|
|
#endif |
|
|
#endif |
|
|
SHOWNAME("fcb_find1") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FCBENT(fcb); |
|
|
|
|
|
|
|
|
redir_log_fcb(fcb); |
|
|
redir_log_fcb(fcb); |
|
|
|
|
|
|
|
|
@ -374,17 +356,18 @@ cpm_word fcb_find1 (cpm_byte *fcb, cpm_byte *dma) /* 0x11 */ |
|
|
find_fcb = fcb; |
|
|
find_fcb = fcb; |
|
|
find_ext = 0; |
|
|
find_ext = 0; |
|
|
find_xfcb = 0; |
|
|
find_xfcb = 0; |
|
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
#ifdef DEBUG |
|
|
rv = redir_find(find_n, fcb, dma); |
|
|
rv = redir_find(find_n, fcb, dma); |
|
|
|
|
|
|
|
|
if (rv < 4) |
|
|
if (rv < 4) |
|
|
{ |
|
|
{ |
|
|
redir_Msg("Ret: %-11.11s\n", dma + 1); |
|
|
|
|
|
|
|
|
DBGMSGV("Ret: %-11.11s\n", dma + 1); |
|
|
} |
|
|
} |
|
|
else redir_Msg("Ret: Fail\n"); |
|
|
|
|
|
return rv; |
|
|
|
|
|
|
|
|
else DBGMSG("Ret: Fail\n"); |
|
|
|
|
|
FCBRET(rv); |
|
|
#else |
|
|
#else |
|
|
return redir_find(find_n, find_fcb, dma); |
|
|
|
|
|
|
|
|
FCBRET(redir_find(find_n, find_fcb, dma)); |
|
|
#endif |
|
|
#endif |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -396,23 +379,29 @@ cpm_word fcb_find2 (cpm_byte *fcb, cpm_byte *dma) /* 0x12 */ |
|
|
{ |
|
|
{ |
|
|
#ifdef DEBUG |
|
|
#ifdef DEBUG |
|
|
int rv; |
|
|
int rv; |
|
|
|
|
|
|
|
|
char fname[CPM_MAXPATH]; |
|
|
char fname[CPM_MAXPATH]; |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
FCBENT(find_fcb); |
|
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
redir_fcb2unix(find_fcb, fname); |
|
|
redir_fcb2unix(find_fcb, fname); |
|
|
redir_Msg("fcb_find2(\"%s\") no. %d\n", fname, find_n); |
|
|
|
|
|
|
|
|
DBGMSGV("file number %d, '%s'\n", find_n, fname); |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
++find_n; |
|
|
++find_n; |
|
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
#ifdef DEBUG |
|
|
rv = redir_find(find_n, find_fcb, dma); |
|
|
rv = redir_find(find_n, find_fcb, dma); |
|
|
|
|
|
|
|
|
if (rv < 4) |
|
|
if (rv < 4) |
|
|
{ |
|
|
{ |
|
|
redir_Msg("Ret: %-11.11s\n", dma + 1); |
|
|
|
|
|
|
|
|
DBGMSGV("Ret: %-11.11s\n", dma + 1); |
|
|
} |
|
|
} |
|
|
else redir_Msg("Ret: Fail\n"); |
|
|
|
|
|
return rv; |
|
|
|
|
|
|
|
|
else DBGMSG("Ret: Fail\n"); |
|
|
|
|
|
FCBRET(rv); |
|
|
#else |
|
|
#else |
|
|
return redir_find(find_n, find_fcb, dma); |
|
|
|
|
|
|
|
|
FCBRET(redir_find(find_n, find_fcb, dma)); |
|
|
#endif |
|
|
#endif |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -427,8 +416,9 @@ cpm_word fcb_unlink(cpm_byte *fcb, cpm_byte *dma) |
|
|
int handle = 0; |
|
|
int handle = 0; |
|
|
int unpasswd = 0; |
|
|
int unpasswd = 0; |
|
|
char fname[CPM_MAXPATH]; |
|
|
char fname[CPM_MAXPATH]; |
|
|
|
|
|
int del_cnt = 0; |
|
|
|
|
|
|
|
|
SHOWNAME("fcb_unlink") |
|
|
|
|
|
|
|
|
FCBENT(fcb); |
|
|
|
|
|
|
|
|
if (fcb[5] & 0x80) unpasswd = 1; /* Remove password rather than file */ |
|
|
if (fcb[5] & 0x80) unpasswd = 1; /* Remove password rather than file */ |
|
|
|
|
|
|
|
|
@ -438,25 +428,30 @@ cpm_word fcb_unlink(cpm_byte *fcb, cpm_byte *dma) |
|
|
if (!drv || drv == '?') drv = redir_cpmdrive; |
|
|
if (!drv || drv == '?') drv = redir_cpmdrive; |
|
|
else drv--; |
|
|
else drv--; |
|
|
|
|
|
|
|
|
if (redir_ro_drv(drv)) return 0x02FF; /* Error: R/O drive */ |
|
|
|
|
|
|
|
|
if (redir_ro_drv(drv)) |
|
|
|
|
|
{ |
|
|
|
|
|
/* Error: R/O drive */ |
|
|
|
|
|
DBGMSG("delete failed - R/O drive\n"); |
|
|
|
|
|
FCBRET(0x02FF); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
#ifdef DEBUG |
|
|
#ifdef DEBUG |
|
|
redir_fcb2unix(fcb, fname); |
|
|
redir_fcb2unix(fcb, fname); |
|
|
redir_Msg("fcb_unlink(\"%s\")\n", fname); |
|
|
|
|
|
|
|
|
DBGMSGV("fcb_unlink('%s')\n", fname); |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
/* Note: This implies that opendir() works on a filename with a
|
|
|
/* Note: This implies that opendir() works on a filename with a
|
|
|
trailing slash. It does under Linux, but that's the only assurance |
|
|
|
|
|
I can give. |
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
* trailing slash. It does under Linux, but that's the only assurance |
|
|
|
|
|
* I can give.*/ |
|
|
|
|
|
|
|
|
hostdir = opendir(redir_drive_prefix[drv]); |
|
|
hostdir = opendir(redir_drive_prefix[drv]); |
|
|
|
|
|
|
|
|
if (!hostdir) |
|
|
if (!hostdir) |
|
|
{ |
|
|
{ |
|
|
redir_Msg("opendir() fails on '%s'\n", redir_drive_prefix[drv]); |
|
|
|
|
|
return 0xFF; |
|
|
|
|
|
|
|
|
DBGMSGV("opendir failed on '%s'\n", redir_drive_prefix[drv]); |
|
|
|
|
|
FCBRET(0xFF); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/* We have a handle to the directory. */ |
|
|
/* We have a handle to the directory. */ |
|
|
do |
|
|
do |
|
|
{ |
|
|
{ |
|
|
@ -465,7 +460,7 @@ cpm_word fcb_unlink(cpm_byte *fcb, cpm_byte *dma) |
|
|
{ |
|
|
{ |
|
|
strcpy(target_name, redir_drive_prefix[drv]); |
|
|
strcpy(target_name, redir_drive_prefix[drv]); |
|
|
strcat(target_name, de->d_name); |
|
|
strcat(target_name, de->d_name); |
|
|
redir_Msg("Deleting %s\n", de->d_name); |
|
|
|
|
|
|
|
|
DBGMSGV("deleting '%s'\n", de->d_name); |
|
|
if (unpasswd) |
|
|
if (unpasswd) |
|
|
{ |
|
|
{ |
|
|
#ifdef __MSDOS__ |
|
|
#ifdef __MSDOS__ |
|
|
@ -478,44 +473,59 @@ cpm_word fcb_unlink(cpm_byte *fcb, cpm_byte *dma) |
|
|
} |
|
|
} |
|
|
else if (fcb[0] & 0x80) |
|
|
else if (fcb[0] & 0x80) |
|
|
{ |
|
|
{ |
|
|
|
|
|
DBGMSGV("rmdir '%s'\n", target_name); |
|
|
handle = rmdir(target_name); |
|
|
handle = rmdir(target_name); |
|
|
if (handle && redir_password_error()) |
|
|
if (handle && redir_password_error()) |
|
|
{ |
|
|
{ |
|
|
|
|
|
DBGMSGV("rmdir failed (errno=%lu): %s\n", errno, strerror(errno)); |
|
|
redir_password_append(target_name, dma); |
|
|
redir_password_append(target_name, dma); |
|
|
|
|
|
DBGMSGV("rmdir '%s'\n", target_name); |
|
|
handle = rmdir(target_name); |
|
|
handle = rmdir(target_name); |
|
|
} |
|
|
} |
|
|
|
|
|
if (handle) |
|
|
|
|
|
DBGMSGV("rmdir failed (errno=%lu): %s\n", errno, strerror(errno)); |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
releaseFile(target_name); |
|
|
releaseFile(target_name); |
|
|
|
|
|
DBGMSGV("unlink '%s'\n", target_name); |
|
|
handle = unlink(target_name); |
|
|
handle = unlink(target_name); |
|
|
if (handle && redir_password_error()) |
|
|
if (handle && redir_password_error()) |
|
|
{ |
|
|
{ |
|
|
|
|
|
DBGMSGV("unlink failed (errno=%lu): %s\n", errno, strerror(errno)); |
|
|
redir_password_append(target_name, dma); |
|
|
redir_password_append(target_name, dma); |
|
|
releaseFile(target_name); |
|
|
releaseFile(target_name); |
|
|
|
|
|
DBGMSGV("unlink '%s'\n", target_name); |
|
|
handle = unlink(target_name); |
|
|
handle = unlink(target_name); |
|
|
} |
|
|
} |
|
|
|
|
|
if (handle) |
|
|
|
|
|
DBGMSGV("unlink failed (errno=%lu): %s\n", errno, strerror(errno)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (handle) de = NULL; /* Delete failed */ |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
while (de != NULL); |
|
|
|
|
|
if (handle) |
|
|
if (handle) |
|
|
|
|
|
de = NULL; /* Delete failed */ |
|
|
|
|
|
else |
|
|
|
|
|
del_cnt++; |
|
|
|
|
|
} |
|
|
|
|
|
} while (de != NULL); |
|
|
|
|
|
|
|
|
|
|
|
if (!handle && !del_cnt) |
|
|
|
|
|
DBGMSG("no matching directory entries\n"); |
|
|
|
|
|
else |
|
|
|
|
|
DBGMSGV("deleted %i file(s)\n", del_cnt); |
|
|
|
|
|
|
|
|
|
|
|
if (handle || !del_cnt) |
|
|
{ |
|
|
{ |
|
|
redir_Msg("Ret: -1\n"); |
|
|
|
|
|
|
|
|
DBGMSG("delete processing failed\n"); |
|
|
closedir(hostdir); |
|
|
closedir(hostdir); |
|
|
return 0xFF; |
|
|
|
|
|
|
|
|
FCBRET(0xFF); |
|
|
} |
|
|
} |
|
|
redir_Msg("Ret: 0\n"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DBGMSG("delete processing succeeded\n"); |
|
|
closedir(hostdir); |
|
|
closedir(hostdir); |
|
|
return 0; |
|
|
|
|
|
|
|
|
FCBRET(0); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef __MSDOS__ |
|
|
#ifdef __MSDOS__ |
|
|
cpm_word redir_get_label(cpm_byte drv, char* pattern) |
|
|
cpm_word redir_get_label(cpm_byte drv, char* pattern) |
|
|
{ |
|
|
{ |
|
|
@ -585,6 +595,4 @@ cpm_word redir_get_label(cpm_byte drv, char *pattern) |
|
|
return 0; |
|
|
return 0; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif |
|
|
#endif |
|
|
|