kernel 2026a final changes (mainly FCB fixes)

git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@353 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
Bart Oldeman 2002-02-16 19:20:20 +00:00
parent 251fa29181
commit b2496a6fbd
12 changed files with 163 additions and 225 deletions

View File

@ -57,6 +57,10 @@ MENUDEFAULT=0,1 ( configuration 0, wait 1 second)
Although this is definitively worse then MSDOS menuing possibilities,
IMHO it's better then nothing
the selected configuration can be determined in AUTOEXEC.BAT in the
environment variable CONFIG like
if %CONFIG% == 0 echo configuration 0 selected
thus my config.sys now looks like

View File

@ -1,9 +1,17 @@
2002 Feb 17 - Build 2026a
-------- Bart Oldeman (bart@dosemu.org)
+ Changes Martin
* fixed SYS for non-Watcom compilers
+ Changes Tom
* set CONFIG environment variable to selected number of CONFIG.SYS
menu entry, for example for use in AUTOEXEC.BAT.
+ Changes Bart
* FCB and network redirector fixes
(FCBOpen was broken; it appears that clearing CF before calling
the redirector is safer then setting CF)
* fixed FCBOpen
* network redirector fixes ; it appears that clearing CF before calling
the redirector is safer than setting CF
* allow creating, renaming and deleting volume labels using FCBs
* fix renaming with wildcards using FCBs
* some dosfns.c and fcbfns.c clean-ups
2002 Feb 9 - Build 2026
-------- Bart Oldeman (bart@dosemu.org)
+ Changes Tom

View File

@ -47,6 +47,7 @@ static BYTE *fat_hRcsId =
#define D_DEVICE 0x40 /* device bit */
#define D_LFN (D_RDONLY | D_HIDDEN | D_SYSTEM | D_VOLID)
#define D_ALL (D_RDONLY | D_HIDDEN | D_SYSTEM | D_DIR | D_ARCHIVE)
/* FAT file name constants */
#define FNAME_SIZE 8

View File

@ -49,6 +49,6 @@ static BYTE *date_hRcsId =
#define REVISION_MINOR 1
#define REVISION_SEQ 26
#define BUILD "2026"
#define SUB_BUILD ""
#define KERNEL_VERSION_STRING "1.1.26" /*#REVISION_MAJOR "." #REVISION_MINOR "." #REVISION_SEQ */
#define KERNEL_BUILD_STRING "2026" /*#BUILD SUB_BUILD */
#define SUB_BUILD "a"
#define KERNEL_VERSION_STRING "1.1.26a" /*#REVISION_MAJOR "." #REVISION_MINOR "." #REVISION_SEQ */
#define KERNEL_BUILD_STRING "2026a" /*#BUILD SUB_BUILD */

View File

@ -128,7 +128,7 @@ BYTE askThisSingleCommand = FALSE; /* ?device= device?= */
BYTE DontAskThisSingleCommand = FALSE; /* !files= */
COUNT MenuTimeout = -1;
BYTE MenuSelected = '2';
BYTE MenuSelected = 0;
BYTE MenuLine = 0;
UCOUNT Menus = 0;

View File

@ -37,7 +37,6 @@ static BYTE *dosfnsRcsId =
COUNT get_free_hndl(VOID);
sft FAR * get_free_sft(COUNT *);
BOOL cmatch(COUNT, COUNT, COUNT);
f_node_ptr xlt_fd(COUNT);
@ -306,7 +305,7 @@ UCOUNT DosRead(COUNT hndl, UCOUNT n, BYTE FAR * bp, COUNT FAR * err)
}
#endif
UCOUNT DosWriteSft(sft FAR * s, UCOUNT n, BYTE FAR * bp, COUNT FAR * err)
UCOUNT DosWriteSft(sft FAR * s, UCOUNT n, const BYTE FAR * bp, COUNT FAR * err)
{
UCOUNT WriteCount;
@ -334,7 +333,7 @@ UCOUNT DosWriteSft(sft FAR * s, UCOUNT n, BYTE FAR * bp, COUNT FAR * err)
save_dta = dta;
lpCurSft = s;
current_filepos = s->sft_posit; /* needed for MSCDEX */
dta = bp;
dta = (BYTE FAR *)bp;
WriteCount = remote_write(s, n, &rc);
dta = save_dta;
*err = rc;
@ -412,7 +411,7 @@ UCOUNT DosWriteSft(sft FAR * s, UCOUNT n, BYTE FAR * bp, COUNT FAR * err)
rq.r_length = sizeof(request);
rq.r_command = C_OUTPUT;
rq.r_count = 1;
rq.r_trans = bp;
rq.r_trans = (BYTE FAR *)bp;
rq.r_status = 0;
execrh((request FAR *) & rq, s->sft_dev);
if (!(rq.r_status & S_ERROR))
@ -627,26 +626,27 @@ BYTE FAR *get_root(BYTE FAR * fname)
return ++froot;
}
/* Ascii only file name match routines */
STATIC BOOL cmatch(COUNT s, COUNT d, COUNT mode)
/* initialize SFT fields (for open/creat) for character devices */
STATIC void DeviceOpenSft(struct dhdr FAR *dhp, sft FAR *sftp)
{
if (s >= 'a' && s <= 'z')
s -= 'a' - 'A';
if (d >= 'a' && d <= 'z')
d -= 'a' - 'A';
if (mode && s == '?' && (d >= 'A' && s <= 'Z'))
return TRUE;
return s == d;
}
int i;
BOOL fnmatch(BYTE FAR * s, BYTE FAR * d, COUNT n, COUNT mode)
{
while (n--)
{
if (!cmatch(*s++, *d++, mode))
return FALSE;
}
return TRUE;
sftp->sft_shroff = -1; /* /// Added for SHARE - Ron Cemer */
sftp->sft_count += 1;
sftp->sft_flags =
((dhp->
dh_attr & ~SFT_MASK) & ~SFT_FSHARED) | SFT_FDEVICE | SFT_FEOF;
fmemcpy(sftp->sft_name, dhp->dh_name, FNAME_SIZE);
/* pad with spaces */
for (i = FNAME_SIZE + FEXT_SIZE - 1; sftp->sft_name[i] == '\0'; i--)
sftp->sft_name[i] = ' ';
/* and uppercase */
DosUpFMem(sftp->sft_name, FNAME_SIZE + FEXT_SIZE);
sftp->sft_dev = dhp;
sftp->sft_date = dos_getdate();
sftp->sft_time = dos_gettime();
}
COUNT DosCreatSft(BYTE * fname, COUNT attrib)
@ -657,13 +657,6 @@ COUNT DosCreatSft(BYTE * fname, COUNT attrib)
WORD result;
COUNT drive;
/* NEVER EVER allow directories to be created */
attrib &= 0xff;
if (attrib & ~(D_RDONLY | D_HIDDEN | D_SYSTEM | D_ARCHIVE))
{
return DE_ACCESS;
}
/* now get a free system file table entry */
if ((sftp = get_free_sft(&sft_idx)) == (sft FAR *) - 1)
return DE_TOOMANY;
@ -674,21 +667,12 @@ COUNT DosCreatSft(BYTE * fname, COUNT attrib)
sftp->sft_psp = cu_psp;
sftp->sft_mode = SFT_MRDWR;
sftp->sft_attrib = attrib;
sftp->sft_psp = cu_psp;
/* check for a device */
dhp = IsDevice(fname);
if (dhp)
{
sftp->sft_count += 1;
sftp->sft_flags =
((dhp->
dh_attr & ~SFT_MASK) & ~SFT_FSHARED) | SFT_FDEVICE | SFT_FEOF;
fmemcpy(sftp->sft_name, (BYTE FAR *) SecPathName,
FNAME_SIZE + FEXT_SIZE);
sftp->sft_dev = dhp;
sftp->sft_date = dos_getdate();
sftp->sft_time = dos_gettime();
DeviceOpenSft(dhp, sftp);
return sft_idx;
}
@ -727,7 +711,7 @@ COUNT DosCreatSft(BYTE * fname, COUNT attrib)
DosGetFile(fname, sftp->sft_name);
dos_getftime(sftp->sft_status,
(date FAR *) & sftp->sft_date,
(time FAR *) & sftp->sft_time);
(time FAR *) & sftp->sft_time);
return sft_idx;
}
else
@ -748,6 +732,13 @@ COUNT DosCreat(BYTE FAR * fname, COUNT attrib)
psp FAR *p = MK_FP(cu_psp, 0);
COUNT sft_idx, hndl, result;
/* NEVER EVER allow directories to be created */
attrib = (BYTE) attrib;
if (attrib & ~(D_RDONLY | D_HIDDEN | D_SYSTEM | D_ARCHIVE))
{
return DE_ACCESS;
}
/* get a free handle */
if ((hndl = get_free_hndl()) < 0)
return hndl;
@ -867,17 +858,7 @@ COUNT DosOpenSft(BYTE * fname, COUNT mode)
dhp = IsDevice(fname);
if (dhp)
{
sftp->sft_shroff = -1; /* /// Added for SHARE - Ron Cemer */
sftp->sft_count += 1;
sftp->sft_flags =
((dhp->
dh_attr & ~SFT_MASK) & ~SFT_FSHARED) | SFT_FDEVICE | SFT_FEOF;
fmemcpy(sftp->sft_name, (BYTE FAR *) SecPathName,
FNAME_SIZE + FEXT_SIZE);
sftp->sft_dev = dhp;
sftp->sft_date = dos_getdate();
sftp->sft_time = dos_gettime();
DeviceOpenSft(dhp, sftp);
return sft_idx;
}
@ -1260,8 +1241,8 @@ COUNT DosChangeDir(BYTE FAR * s)
Copy the path to the current directory
structure.
Some redirectors do not write back to the CDS.
SHSUCdX needs this. jt
Some redirectors do not write back to the CDS.
SHSUCdX needs this. jt
*/
fstrcpy(current_ldt->cdsCurrentPath, PriPathName);
if (PriPathName[7] == 0)
@ -1571,7 +1552,7 @@ UBYTE DosSelectDrv(UBYTE drv)
return lastdrive;
}
COUNT DosDelete(BYTE FAR * path)
COUNT DosDelete(BYTE FAR * path, int attrib)
{
COUNT result, drive;
@ -1597,11 +1578,11 @@ COUNT DosDelete(BYTE FAR * path)
}
else
{
return dos_delete(PriPathName);
return dos_delete(PriPathName, attrib);
}
}
COUNT DosRenameTrue(BYTE * path1, BYTE * path2)
COUNT DosRenameTrue(BYTE * path1, BYTE * path2, int attrib)
{
COUNT drive1, drive2;
@ -1623,7 +1604,7 @@ COUNT DosRenameTrue(BYTE * path1, BYTE * path2)
}
else
{
return dos_rename(PriPathName, SecPathName);
return dos_rename(PriPathName, SecPathName, attrib);
}
}
@ -1643,7 +1624,7 @@ COUNT DosRename(BYTE FAR * path1, BYTE FAR * path2)
return result;
}
return DosRenameTrue(PriPathName, SecPathName);
return DosRenameTrue(PriPathName, SecPathName, D_ALL);
}
COUNT DosMkdir(BYTE FAR * dir)
@ -1737,27 +1718,12 @@ COUNT DosLockUnlock(COUNT hndl, LONG pos, LONG len, COUNT unlock)
* This seems to work well.
*/
/* check for a device */
struct dhdr FAR *IsDevice(BYTE FAR * fname)
{
struct dhdr FAR *dhp;
BYTE FAR *froot;
WORD i;
BYTE tmpPathName[FNAME_SIZE + 1];
/* check for a device */
froot = get_root(fname);
for (i = 0; i < FNAME_SIZE; i++)
{
if (*froot != '\0' && *froot != '.')
tmpPathName[i] = *froot++;
else
break;
}
for (; i < FNAME_SIZE; i++)
tmpPathName[i] = ' ';
tmpPathName[i] = 0;
char FAR *froot = get_root(fname);
int i;
/* /// BUG!!! This is absolutely wrong. A filename of "NUL.LST" must be
treated EXACTLY the same as a filename of "NUL". The existence or
@ -1775,24 +1741,28 @@ struct dhdr FAR *IsDevice(BYTE FAR * fname)
/* BUGFIX: MSCD000<00> should be handled like MSCD000<20> TE */
char dev_name_buff[FNAME_SIZE];
int namelen = fstrlen(dhp->dh_name);
memset(dev_name_buff, ' ', FNAME_SIZE);
fmemcpy(dev_name_buff, dhp->dh_name, min(namelen, FNAME_SIZE));
if (fnmatch
((BYTE FAR *) tmpPathName, (BYTE FAR *) dev_name_buff, FNAME_SIZE,
FALSE))
for (i = 0; i < FNAME_SIZE; i++)
{
memcpy(SecPathName, tmpPathName, i + 1);
return dhp;
char c1 = froot[i];
if (c1 == '.' || c1 == '\0')
{
/* check if remainder of device name consists of spaces or nulls */
for (; i < FNAME_SIZE; i++)
{
char c2 = dhp->dh_name[i];
if (c2 != ' ' && c2 != '\0')
break;
}
break;
}
if (DosUpFChar(c1) != DosUpFChar(dhp->dh_name[i]))
break;
}
if (i == FNAME_SIZE)
return dhp;
}
return (struct dhdr FAR *)0;
return NULL;
}
/* /// Added for SHARE. - Ron Cemer */

View File

@ -517,7 +517,8 @@ COUNT dos_findfirst(UCOUNT attr, BYTE * name)
while (dir_read(fnp) == 1)
{
/* Test the attribute and return first found */
if ((fnp->f_dir.dir_attrib & ~(D_RDONLY | D_ARCHIVE)) == D_VOLID)
if ((fnp->f_dir.dir_attrib & ~(D_RDONLY | D_ARCHIVE)) == D_VOLID &&
fnp->f_dir.dir_name[0] != DELETED)
{
dmp->dm_dircluster = fnp->f_dirstart; /* TE */
memcpy(&SearchDir, &fnp->f_dir, sizeof(struct dirent));

View File

@ -40,7 +40,7 @@ BYTE *RcsId = "$Id$";
f_node_ptr xlt_fd(COUNT);
COUNT xlt_fnp(f_node_ptr);
f_node_ptr split_path(BYTE *, BYTE *, BYTE *);
BOOL find_fname(f_node_ptr, BYTE *, BYTE *);
BOOL find_fname(f_node_ptr, BYTE *, BYTE *, int);
/* /// Added - Ron Cemer */
STATIC void merge_file_changes(f_node_ptr fnp, int collect);
/* /// Added - Ron Cemer */
@ -97,7 +97,7 @@ COUNT dos_open(BYTE * path, COUNT flag)
/* Look for the file. If we can't find it, just return a not */
/* found error. */
if (!find_fname(fnp, szFileName, szFileExt))
if (!find_fname(fnp, szFileName, szFileExt, D_ALL))
{
dir_close(fnp);
return DE_FILENOTFND;
@ -277,7 +277,7 @@ f_node_ptr split_path(BYTE * path, BYTE * fname, BYTE * fext)
return fnp;
}
STATIC BOOL find_fname(f_node_ptr fnp, BYTE * fname, BYTE * fext)
STATIC BOOL find_fname(f_node_ptr fnp, BYTE * fname, BYTE * fext, int attr)
{
BOOL found = FALSE;
@ -290,7 +290,7 @@ STATIC BOOL find_fname(f_node_ptr fnp, BYTE * fname, BYTE * fext)
if (fcmp(fname, (BYTE *) fnp->f_dir.dir_name, FNAME_SIZE)
&& fcmp(fext, (BYTE *) fnp->f_dir.dir_ext, FEXT_SIZE)
&& ((fnp->f_dir.dir_attrib & D_VOLID) == 0))
&& (fnp->f_dir.dir_attrib & ~(D_RDONLY | D_ARCHIVE | attr)) == 0)
{
found = TRUE;
break;
@ -417,7 +417,7 @@ STATIC void copy_file_changes(f_node_ptr src, f_node_ptr dst)
dst->f_dir.dir_time = src->f_dir.dir_time;
}
COUNT dos_creat(BYTE * path, COUNT attrib)
COUNT dos_creat(BYTE * path, int attrib)
{
REG f_node_ptr fnp;
@ -430,7 +430,7 @@ COUNT dos_creat(BYTE * path, COUNT attrib)
/* Check that we don't have a duplicate name, so if we */
/* find one, truncate it. */
if (find_fname(fnp, szFileName, szFileExt))
if (find_fname(fnp, szFileName, szFileExt, D_ALL | attrib))
{
/* The only permissable attribute is archive, */
/* check for any other bit set. If it is, give */
@ -542,7 +542,7 @@ STATIC COUNT delete_dir_entry(f_node_ptr fnp)
return SUCCESS;
}
COUNT dos_delete(BYTE * path)
COUNT dos_delete(BYTE * path, int attrib)
{
REG f_node_ptr fnp;
@ -555,13 +555,13 @@ COUNT dos_delete(BYTE * path)
/* Check that we don't have a duplicate name, so if we */
/* find one, it's an error. */
if (find_fname(fnp, szFileName, szFileExt))
if (find_fname(fnp, szFileName, szFileExt, attrib))
{
/* The only permissable attribute is archive, */
/* TE +hidden + system */
/* check for any other bit set. If it is, give */
/* an access error. */
if (fnp->f_dir.dir_attrib & ~(D_ARCHIVE | D_HIDDEN | D_SYSTEM))
/* Do not delete directories or r/o files */
/* lfn entries and volume labels are only found */
/* by find_fname() if attrib is set to a */
/* special value */
if (fnp->f_dir.dir_attrib & (D_RDONLY | D_DIR))
{
dir_close(fnp);
return DE_ACCESS;
@ -599,7 +599,7 @@ COUNT dos_rmdir(BYTE * path)
/* Check that we don't have a duplicate name, so if we */
/* find one, it's an error. */
if (find_fname(fnp, szFileName, szFileExt))
if (find_fname(fnp, szFileName, szFileExt, D_ALL))
{
/* The only permissable attribute is directory, */
/* check for any other bit set. If it is, give */
@ -668,7 +668,7 @@ COUNT dos_rmdir(BYTE * path)
}
}
COUNT dos_rename(BYTE * path1, BYTE * path2)
COUNT dos_rename(BYTE * path1, BYTE * path2, int attrib)
{
REG f_node_ptr fnp1;
REG f_node_ptr fnp2;
@ -684,7 +684,7 @@ COUNT dos_rename(BYTE * path1, BYTE * path2)
/* Check that we don't have a duplicate name, so if we find */
/* one, it's an error. */
if (find_fname(fnp2, szFileName, szFileExt))
if (find_fname(fnp2, szFileName, szFileExt, attrib))
{
dir_close(fnp2);
return DE_ACCESS;
@ -698,7 +698,7 @@ COUNT dos_rename(BYTE * path1, BYTE * path2)
return DE_PATHNOTFND;
}
if (!find_fname(fnp1, szFileName, szFileExt))
if (!find_fname(fnp1, szFileName, szFileExt, attrib))
{
/* No such file, return the error */
dir_close(fnp1);
@ -1101,7 +1101,7 @@ COUNT dos_mkdir(BYTE * dir)
/* Check that we don't have a duplicate name, so if we */
/* find one, it's an error. */
if (find_fname(fnp, szFileName, szFileExt))
if (find_fname(fnp, szFileName, szFileExt, D_ALL))
{
dir_close(fnp);
return DE_ACCESS;
@ -1828,7 +1828,7 @@ STATIC COUNT dos_extend(f_node_ptr fnp)
}
/* Write block to disk */
UCOUNT writeblock(COUNT fd, VOID FAR * buffer, UCOUNT count, COUNT * err)
UCOUNT writeblock(COUNT fd, const VOID FAR * buffer, UCOUNT count, COUNT * err)
{
REG f_node_ptr fnp;
struct buffer FAR *bp;

View File

@ -38,7 +38,6 @@ static BYTE *RcsId =
#define FCB_ERR_NODATA 1
#define FCB_ERR_EOF 3
#define FCB_ERR_WRITE 1
#define D_ALL D_NORMAL | D_RDONLY | D_HIDDEN | D_SYSTEM | D_DIR | D_ARCHIVE
#ifdef PROTO
fcb FAR *ExtFcbToFcb(xfcb FAR * lpExtFcb);
@ -82,7 +81,7 @@ VOID FatGetDrvData(UCOUNT drive, UCOUNT FAR * spc, UCOUNT FAR * bps,
#define PARSE_RET_BADDRIVE 0xff
#ifndef IPL
WORD FcbParseFname(int wTestMode, BYTE FAR ** lpFileName, fcb FAR * lpFcb)
WORD FcbParseFname(int wTestMode, const BYTE FAR ** lpFileName, fcb FAR * lpFcb)
{
COUNT nIndex;
WORD wRetCodeName = FALSE, wRetCodeExt = FALSE;
@ -156,7 +155,7 @@ WORD FcbParseFname(int wTestMode, BYTE FAR ** lpFileName, fcb FAR * lpFcb)
return (wRetCodeName | wRetCodeExt) ? PARSE_RET_WILD : PARSE_RET_NOWILD;
}
BYTE FAR * ParseSkipWh(BYTE FAR * lpFileName)
const BYTE FAR * ParseSkipWh(const BYTE FAR * lpFileName)
{
while (*lpFileName == ' ' || *lpFileName == '\t')
++lpFileName;
@ -191,7 +190,7 @@ BOOL TestFieldSeps(BYTE FAR * lpFileName)
}
#endif
BYTE FAR * GetNameField(BYTE FAR * lpFileName, BYTE FAR * lpDestField,
const BYTE FAR * GetNameField(const BYTE FAR * lpFileName, BYTE FAR * lpDestField,
COUNT nFieldSize, BOOL * pbWildCard)
{
COUNT nIndex = 0;
@ -466,7 +465,9 @@ BOOL FcbOpenCreate(xfcb FAR * lpXfcb, BOOL Create)
if (Create)
{
sft_idx = DosCreatSft(PriPathName, 0);
/* pass attribute without constraints (dangerous for directories) */
int attr = (lpXfcb->xfcb_flag == 0xff ? lpXfcb->xfcb_attrib : 0);
sft_idx = DosCreatSft(PriPathName, attr);
}
else
{
@ -559,21 +560,22 @@ BOOL FcbDelete(xfcb FAR * lpXfcb)
}
else
{
int attr = (lpXfcb->xfcb_flag == 0xff ? lpXfcb->xfcb_attrib : D_ALL);
BYTE FAR *lpOldDta = dta;
dmatch Dmatch;
dta = (BYTE FAR *) & Dmatch;
if (DosFindFirst
(D_ALL,
SecPathName[1] == ':' ? &SecPathName[2] : SecPathName) != SUCCESS)
if (DosFindFirst(attr, SecPathName) != SUCCESS)
{
dta = lpOldDta;
return FALSE;
}
do
{
truename(Dmatch.dm_name, SecPathName, FALSE);
if (DosDelete(SecPathName) != SUCCESS)
SecPathName[0] = 'A' + FcbDrive - 1;
SecPathName[1] = ':';
strcpy(&SecPathName[2], Dmatch.dm_name);
if (DosDelete(SecPathName, attr) != SUCCESS)
{
dta = lpOldDta;
return FALSE;
@ -592,7 +594,8 @@ BOOL FcbRename(xfcb FAR * lpXfcb)
/* Build a traditional DOS file name */
lpRenameFcb = (rfcb FAR *) CommonFcbInit(lpXfcb, SecPathName, &FcbDrive);
wAttr = (lpXfcb->xfcb_flag == 0xff ? lpXfcb->xfcb_attrib : D_ALL);
/* check for a device */
if (IsDevice(SecPathName))
{
@ -604,9 +607,7 @@ BOOL FcbRename(xfcb FAR * lpXfcb)
dmatch Dmatch;
dta = (BYTE FAR *) & Dmatch;
if (DosFindFirst
(D_ALL,
SecPathName[1] == ':' ? &SecPathName[2] : SecPathName) != SUCCESS)
if (DosFindFirst(wAttr, SecPathName) != SUCCESS)
{
dta = lpOldDta;
return FALSE;
@ -615,65 +616,34 @@ BOOL FcbRename(xfcb FAR * lpXfcb)
do
{
fcb LocalFcb;
BYTE *pToName, *pszFrom;
BYTE FAR *pFromPattern;
COUNT nIndex;
/* First, expand the find match into fcb style */
/* file name entry */
/* Fill with blanks first */
memset(LocalFcb.fcb_fname, ' ', FNAME_SIZE);
memset(LocalFcb.fcb_fext, ' ', FEXT_SIZE);
/* next move in the file name while overwriting */
/* the filler blanks */
pszFrom = Dmatch.dm_name;
pToName = LocalFcb.fcb_fname;
for (nIndex = 0; nIndex < FNAME_SIZE; nIndex++)
{
if (*pszFrom != 0 && *pszFrom != '.')
*pToName++ = *pszFrom++;
else if (*pszFrom == '.')
{
++pszFrom;
break;
}
else
break;
}
if (*pszFrom != '\0')
{
pToName = LocalFcb.fcb_fext;
for (nIndex = 0; nIndex < FEXT_SIZE; nIndex++)
{
if (*pszFrom != '\0')
*pToName++ = *pszFrom++;
else
break;
}
}
BYTE *pToName;
const BYTE FAR *pFromPattern = Dmatch.dm_name;
int i;
FcbParseFname(0, &pFromPattern, &LocalFcb);
/* Overlay the pattern, skipping '?' */
/* I'm cheating because this assumes that the */
/* struct alignments are on byte boundaries */
pToName = LocalFcb.fcb_fname;
for (pFromPattern = lpRenameFcb->renNewName,
nIndex = 0; nIndex < FNAME_SIZE + FEXT_SIZE; nIndex++)
pFromPattern = lpRenameFcb->renNewName;
for (i = 0; i < FNAME_SIZE + FEXT_SIZE; i++)
{
if (*pFromPattern != '?')
*pToName++ = *pFromPattern++;
else
++pFromPattern;
*pToName = *pFromPattern;
pToName++;
pFromPattern++;
}
SecPathName[0] = 'A' + FcbDrive - 1;
SecPathName[1] = ':';
strcpy(&SecPathName[2], Dmatch.dm_name);
truename(SecPathName, PriPathName, FALSE);
/* now to build a dos name again */
LocalFcb.fcb_drive = 0;
LocalFcb.fcb_drive = FcbDrive;
FcbNameInit((fcb FAR *) & LocalFcb, SecPathName, &FcbDrive);
truename(Dmatch.dm_name, PriPathName, FALSE);
if (DosRenameTrue(PriPathName, SecPathName) != SUCCESS)
if (DosRenameTrue(PriPathName, SecPathName, wAttr) != SUCCESS)
{
dta = lpOldDta;
return FALSE;

View File

@ -532,9 +532,7 @@ dispatch:
/* Parse File Name */
case 0x29:
{
BYTE FAR *lpFileName;
lpFileName = MK_FP(r->DS, r->SI);
const BYTE FAR *lpFileName = MK_FP(r->DS, r->SI);
r->AL = FcbParseFname(r->AL, &lpFileName, MK_FP(r->ES, r->DI));
r->DS = FP_SEG(lpFileName);
r->SI = FP_OFF(lpFileName);
@ -820,7 +818,7 @@ dispatch:
/* Dos Delete File */
case 0x41:
rc = DosDelete((BYTE FAR *) FP_DS_DX);
rc = DosDelete((BYTE FAR *) FP_DS_DX, D_ALL);
if (rc < 0)
goto error_exit;
break;
@ -1416,7 +1414,7 @@ dispatch:
CLEAR_CARRY_FLAG();
break;
/* Flush file buffer -- COMMIT FILE -- dummy function right now. */
/* Flush file buffer -- COMMIT FILE. */
case 0x68:
case 0x6a:
if ((rc = DosCommit(r->BX)) < 0)

View File

@ -393,43 +393,30 @@ STATIC VOID signon()
STATIC void kernel()
{
#if 0
BYTE FAR *ep, *sp;
#endif
exec_blk exb;
CommandTail Cmd;
int rc;
#ifndef KDB
static BYTE master_env[] = "PATH=.\0\0\0\0\0";
/* static BYTE *path = "PATH=.";*/
#endif
extern char MenuSelected;
#ifdef KDB
kdb();
#else
#if 0
/* create the master environment area */
BYTE master_env[32];
char *masterenv_ptr = master_env;
if (allocmem(0x2, &exb.exec.env_seg))
init_fatal("cannot allocate master environment space");
/* build the startup environment */
/* populate it with the minimum environment */
++exb.exec.env_seg;
ep = MK_FP(exb.exec.env_seg, 0);
memset(master_env,0,sizeof(master_env));
for (sp = path; *sp != 0;)
*ep++ = *sp++;
/* initial path setting. is this useful ?? */
masterenv_ptr += sprintf(masterenv_ptr, "PATH=.");
/* export the current selected config menu */
if (MenuSelected)
{
masterenv_ptr += sprintf(masterenv_ptr, "CONFIG=%c", MenuSelected);
}
*ep++ = '\0';
*ep++ = '\0';
*((int FAR *)ep) = 0;
ep += sizeof(int);
#else
exb.exec.env_seg = DOS_PSP + 8;
fmemcpy(MK_FP(exb.exec.env_seg, 0), master_env, sizeof(master_env));
#endif
#endif
RootPsp = ~0;

View File

@ -67,7 +67,6 @@ sft FAR *get_sft(UCOUNT);
/* dosfns.c */
BYTE FAR *get_root(BYTE FAR *);
BOOL fnmatch(BYTE FAR *, BYTE FAR *, COUNT, COUNT);
BOOL check_break(void);
UCOUNT GenericReadSft(sft far * sftp, UCOUNT n, BYTE FAR * bp,
COUNT FAR * err, BOOL force_binary);
@ -76,7 +75,7 @@ COUNT SftSeek(sft FAR * sftp, LONG new_pos, COUNT mode);
#define GenericRead(hndl, n, bp, err, t) GenericReadSft(get_sft(hndl), n, bp, err, t)
#define DosRead(hndl, n, bp, err) GenericRead(hndl, n, bp, err, FALSE)
#define DosReadSft(sftp, n, bp, err) GenericReadSft(sftp, n, bp, err, FALSE)
UCOUNT DosWriteSft(sft FAR * sftp, UCOUNT n, BYTE FAR * bp,
UCOUNT DosWriteSft(sft FAR * sftp, UCOUNT n, const BYTE FAR * bp,
COUNT FAR * err);
#define DosWrite(hndl, n, bp, err) DosWriteSft(get_sft(hndl), n, bp, err)
COUNT DosSeek(COUNT hndl, LONG new_pos, COUNT mode, ULONG * set_pos);
@ -102,9 +101,9 @@ COUNT DosSetFtimeSft(WORD sft_idx, date dp, time tp);
COUNT DosGetFattr(BYTE FAR * name);
COUNT DosSetFattr(BYTE FAR * name, UWORD attrp);
UBYTE DosSelectDrv(UBYTE drv);
COUNT DosDelete(BYTE FAR * path);
COUNT DosDelete(BYTE FAR * path, int attrib);
COUNT DosRename(BYTE FAR * path1, BYTE FAR * path2);
COUNT DosRenameTrue(BYTE * path1, BYTE * path2);
COUNT DosRenameTrue(BYTE * path1, BYTE * path2, int attrib);
COUNT DosMkdir(BYTE FAR * dir);
COUNT DosRmdir(BYTE FAR * dir);
struct dhdr FAR *IsDevice(BYTE FAR * FileName);
@ -145,10 +144,10 @@ BOOL fcmp_wild(BYTE FAR * s1, BYTE FAR * s2, COUNT n);
VOID touc(BYTE * s, COUNT n);
COUNT dos_close(COUNT fd);
COUNT dos_commit(COUNT fd);
COUNT dos_creat(BYTE * path, COUNT attrib);
COUNT dos_delete(BYTE * path);
COUNT dos_creat(BYTE * path, int attrib);
COUNT dos_delete(BYTE * path, int attrib);
COUNT dos_rmdir(BYTE * path);
COUNT dos_rename(BYTE * path1, BYTE * path2);
COUNT dos_rename(BYTE * path1, BYTE * path2, int attrib);
date dos_getdate(void);
time dos_gettime(void);
COUNT dos_getftime(COUNT fd, date FAR * dp, time FAR * tp);
@ -160,9 +159,9 @@ COUNT dos_mkdir(BYTE * dir);
BOOL last_link(f_node_ptr fnp);
COUNT map_cluster(REG f_node_ptr fnp, COUNT mode);
UCOUNT readblock(COUNT fd, VOID FAR * buffer, UCOUNT count, COUNT * err);
UCOUNT writeblock(COUNT fd, VOID FAR * buffer, UCOUNT count, COUNT * err);
UCOUNT writeblock(COUNT fd, const VOID FAR * buffer, UCOUNT count, COUNT * err);
COUNT dos_read(COUNT fd, VOID FAR * buffer, UCOUNT count);
COUNT dos_write(COUNT fd, VOID FAR * buffer, UCOUNT count);
COUNT dos_write(COUNT fd, const VOID FAR * buffer, UCOUNT count);
LONG dos_lseek(COUNT fd, LONG foffset, COUNT origin);
CLUSTER dos_free(struct dpb FAR * dpbp);
@ -205,11 +204,11 @@ VOID DosCharOutput(COUNT c);
VOID DosDisplayOutput(COUNT c);
VOID FatGetDrvData(UCOUNT drive, UCOUNT FAR * spc, UCOUNT FAR * bps,
UCOUNT FAR * nc, BYTE FAR ** mdp);
WORD FcbParseFname(int wTestMode, BYTE FAR ** lpFileName, fcb FAR * lpFcb);
BYTE FAR *ParseSkipWh(BYTE FAR * lpFileName);
WORD FcbParseFname(int wTestMode, const BYTE FAR ** lpFileName, fcb FAR * lpFcb);
const BYTE FAR *ParseSkipWh(const BYTE FAR * lpFileName);
BOOL TestCmnSeps(BYTE FAR * lpFileName);
BOOL TestFieldSeps(BYTE FAR * lpFileName);
BYTE FAR *GetNameField(BYTE FAR * lpFileName, BYTE FAR * lpDestField,
const BYTE FAR *GetNameField(const BYTE FAR * lpFileName, BYTE FAR * lpDestField,
COUNT nFieldSize, BOOL * pbWildCard);
typedef BOOL FcbFunc_t (xfcb FAR *, COUNT *, UCOUNT);
FcbFunc_t FcbRead, FcbWrite;
@ -253,10 +252,10 @@ VOID DosUmbLink(BYTE n);
VOID mcb_print(mcb FAR * mcbp);
/* misc.c */
VOID ASMCFUNC strcpy(REG BYTE * d, REG BYTE * s);
VOID ASMCFUNC fmemcpy(REG VOID FAR * d, REG VOID FAR * s, REG COUNT n);
VOID ASMCFUNC fstrcpy(REG BYTE FAR * d, REG BYTE FAR * s);
void ASMCFUNC memcpy(REG void *d, REG VOID * s, REG COUNT n);
VOID ASMCFUNC strcpy(REG BYTE * d, REG const BYTE * s);
VOID ASMCFUNC fmemcpy(REG VOID FAR * d, REG const VOID FAR * s, REG COUNT n);
VOID ASMCFUNC fstrcpy(REG BYTE FAR * d, REG const BYTE FAR * s);
void ASMCFUNC memcpy(REG void *d, REG const VOID * s, REG COUNT n);
void ASMCFUNC fmemset(REG VOID FAR * s, REG int ch, REG COUNT n);
void ASMCFUNC memset(REG VOID * s, REG int ch, REG COUNT n);