BUFFERS tuning and misc bug fixes/cleanups (2024c).
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@232 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
parent
f52e31f5c5
commit
68375764dd
@ -1,3 +1,20 @@
|
||||
2001 Jun 2 - Build 2024
|
||||
-------- Bart Oldeman (bart.oldeman@bristol.ac.uk)
|
||||
+ Fixes Tom:
|
||||
* small fixes again.
|
||||
* one possible cause for data corruption (BFR_VALID) detected
|
||||
* directories with 'ARCHIVE' attribute could not be deleted
|
||||
* saved even more bytes (now 20 buffers in HMA :-)
|
||||
* some issues with pathnames around PARSE_MAX removed
|
||||
* blanks in filenames weren't proper handled
|
||||
* there was (at rare circumstances) a buffer overflow
|
||||
while config.sys parsing.
|
||||
+ Fixes Bart:
|
||||
* INT 21 0A - Dos Buffered Input reworked
|
||||
+ Added tom:
|
||||
* slighly better buffer handling (search BFR_UNCACHE)
|
||||
now go more FAT+DIR sectors, less DATA sectors into cache
|
||||
* dos_mkdir tuned (was ~0.5 sec on 64K cluster partitions)
|
||||
2001 Apr 29 - Build 2024
|
||||
-------- Bart Oldeman (bart.oldeman@bristol.ac.uk)
|
||||
+ Fixes Bart:
|
||||
@ -20,6 +37,30 @@
|
||||
* Default lastdrive should be 5 (E) not 6 (F).
|
||||
* fixed not ignoring whitespace after '=' in config.sys
|
||||
* noted INT21/AX=3800 bug for getting the country. Put in a workaround for now.
|
||||
2001 Apr 29 - Build 2024
|
||||
-------- Bart Oldeman (bart.oldeman@bristol.ac.uk)
|
||||
+ Fixes Bart:
|
||||
* fixed the "TYPE > FOO.TXT" poor man's editor.
|
||||
* use "fast console output" (int 29) when applicable.
|
||||
* moved 5 FILES to DOS DS:00CC and fixed the SFT linked list.
|
||||
* cleaned up findfirst/findnext for redirected drives.
|
||||
* moved IO segments to 0x70 as this matches other DOS'es.
|
||||
Tom:
|
||||
* more VDISK changes (changed slightly by Bart)
|
||||
* check for presence of A:/B: (changed by Bart to use the BIOS equipment flag
|
||||
from INT11 instead of INT13).
|
||||
* added F5/F8 stepping through config.sys; default SHELL=COMMAND.COM /P/E:256
|
||||
Use ESC to stop single stepping, F5 to skip remaining config.sys/autoexec.bat.
|
||||
* new sys: uses INT25/26 instead of the low level INT13 related kernel code from
|
||||
floppy.asm (see also comments in sys.c) + a few fixes (also boot.asm related)
|
||||
from Bart.
|
||||
* Hopefully fixed DateTime Changed + ATTRIB |= ARCHIVE bug.
|
||||
* Combined clk and blk driver entries as much as possible.
|
||||
* cleaned up dsk.c and saved more bytes.
|
||||
Przemyslaw Czerpak:
|
||||
* Default lastdrive should be 5 (E) not 6 (F).
|
||||
* fixed not ignoring whitespace after '=' in config.sys
|
||||
* noted INT21/AX=3800 bug for getting the country. Put in a workaround for now.
|
||||
2001 Apr 21 - Build 2024
|
||||
-------- Bart Oldeman (bart.oldeman@bristol.ac.uk)
|
||||
+ Fixes Tom:
|
||||
|
@ -1,13 +1,13 @@
|
||||
Begin3
|
||||
Title: The FreeDOS Kernel
|
||||
Version: 1.1.20
|
||||
Entered-date: 5 May 2000
|
||||
Version: 1.1.24
|
||||
Entered-date: 2 Jun 2001
|
||||
Description: The FreeDOS Kernel.
|
||||
Keywords: kernel freedos dos msdos
|
||||
Author: (developers)
|
||||
Maintained-by: jimtabor@infohwy.com
|
||||
Maintained-by: bart.oldeman@bristol.ac.uk
|
||||
Primary-site: http://freedos.sourceforge.net
|
||||
Alternate-site: www.freedos.org
|
||||
Alternate-site: www.dosemu.org/~bart
|
||||
Original-site: http://www.gcfl.net/pub/FreeDOS/kernel
|
||||
Platforms: dos dosemu
|
||||
Copying-policy: GPL
|
||||
|
@ -34,6 +34,9 @@ static BYTE *buffer_hRcsId = "$Id$";
|
||||
|
||||
/*
|
||||
* $Log$
|
||||
* Revision 1.2 2001/06/03 14:16:17 bartoldeman
|
||||
* BUFFERS tuning and misc bug fixes/cleanups (2024c).
|
||||
*
|
||||
* Revision 1.1 2001/04/21 22:32:53 bartoldeman
|
||||
* Init DS=Init CS, fixed stack overflow problems and misc bugs.
|
||||
*
|
||||
@ -68,6 +71,7 @@ struct buffer
|
||||
#define b_dpbp _b._b_dpbp
|
||||
#define b_huge_blkno _b._b_huge_blkno
|
||||
|
||||
#define BFR_UNCACHE 0x80 /* indication, not really used */
|
||||
#define BFR_DIRTY 0x40 /* buffer modified */
|
||||
#define BFR_VALID 0x20 /* buffer contains valid data */
|
||||
#define BFR_DATA 0x08 /* buffer is from data area */
|
||||
|
13
hdr/device.h
13
hdr/device.h
@ -35,6 +35,9 @@ static BYTE *device_hRcsId = "$Id$";
|
||||
|
||||
/*
|
||||
* $Log$
|
||||
* Revision 1.6 2001/06/03 14:16:17 bartoldeman
|
||||
* BUFFERS tuning and misc bug fixes/cleanups (2024c).
|
||||
*
|
||||
* Revision 1.5 2001/04/15 03:21:50 bartoldeman
|
||||
* See history.txt for the list of fixes.
|
||||
*
|
||||
@ -312,19 +315,19 @@ typedef boot super; /* Alias for boot structure */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
BYTE r_length; /* Request Header length */
|
||||
BYTE r_unit; /* Unit Code */
|
||||
BYTE r_command; /* Command Code */
|
||||
UBYTE r_length; /* Request Header length */
|
||||
UBYTE r_unit; /* Unit Code */
|
||||
UBYTE r_command; /* Command Code */
|
||||
WORD r_status; /* Status */
|
||||
BYTE r_reserved[8]; /* DOS Reserved Area */
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
BYTE _r_nunits; /* number of units */
|
||||
UBYTE _r_nunits; /* number of units */
|
||||
BYTE FAR *_r_endaddr; /* Ending Address */
|
||||
bpb *FAR * _r_bpbptr; /* ptr to BPB array */
|
||||
BYTE _r_firstunit;
|
||||
UBYTE _r_firstunit;
|
||||
}
|
||||
_r_init;
|
||||
struct
|
||||
|
@ -36,6 +36,9 @@ static BYTE *fnode_hRcsId = "$Id$";
|
||||
|
||||
/*
|
||||
* $Log$
|
||||
* Revision 1.6 2001/06/03 14:16:17 bartoldeman
|
||||
* BUFFERS tuning and misc bug fixes/cleanups (2024c).
|
||||
*
|
||||
* Revision 1.5 2001/04/29 17:34:40 bartoldeman
|
||||
* A new SYS.COM/config.sys single stepping/console output/misc fixes.
|
||||
*
|
||||
@ -126,3 +129,4 @@ struct f_node
|
||||
UWORD f_boff; /* the byte in the cluster */
|
||||
};
|
||||
|
||||
typedef struct f_node FAR * f_node_ptr;
|
||||
|
@ -36,6 +36,9 @@ static char *portab_hRcsId = "$Id$";
|
||||
|
||||
/*
|
||||
* $Log$
|
||||
* Revision 1.9 2001/06/03 14:16:17 bartoldeman
|
||||
* BUFFERS tuning and misc bug fixes/cleanups (2024c).
|
||||
*
|
||||
* Revision 1.8 2001/04/15 03:21:50 bartoldeman
|
||||
* See history.txt for the list of fixes.
|
||||
*
|
||||
@ -195,6 +198,9 @@ typedef int COUNT;
|
||||
typedef unsigned int UCOUNT;
|
||||
typedef unsigned long ULONG;
|
||||
|
||||
#define STATIC /* local calls inside module */
|
||||
|
||||
|
||||
#ifdef UNIX
|
||||
typedef char FAR *ADDRESS;
|
||||
#else
|
||||
|
@ -44,4 +44,4 @@ static BYTE *date_hRcsId = "$Id$";
|
||||
#define REVISION_MINOR 1
|
||||
#define REVISION_SEQ 24
|
||||
#define BUILD 2024
|
||||
#define SUB_BUILD "b"
|
||||
#define SUB_BUILD "c"
|
||||
|
@ -37,6 +37,9 @@ static BYTE *blockioRcsId = "$Id$";
|
||||
|
||||
/*
|
||||
* $Log$
|
||||
* Revision 1.10 2001/06/03 14:16:17 bartoldeman
|
||||
* BUFFERS tuning and misc bug fixes/cleanups (2024c).
|
||||
*
|
||||
* Revision 1.9 2001/04/21 22:32:53 bartoldeman
|
||||
* Init DS=Init CS, fixed stack overflow problems and misc bugs.
|
||||
*
|
||||
@ -241,6 +244,11 @@ VOID setblkno(struct buffer FAR * bp, ULONG blkno)
|
||||
FALSE:
|
||||
the buffer is not found
|
||||
*Buffp contains a block to flush and reuse later
|
||||
|
||||
new:
|
||||
upper layer may set UNCACHE attribute
|
||||
UNCACHE buffers are recycled first.
|
||||
intended to be used for full sector reads into application buffer
|
||||
|
||||
*/
|
||||
|
||||
@ -251,6 +259,7 @@ BOOL searchblock(ULONG blkno, COUNT dsk,
|
||||
struct buffer FAR *bp;
|
||||
struct buffer FAR *lbp = NULL;
|
||||
struct buffer FAR *lastNonFat = NULL;
|
||||
struct buffer FAR *uncacheBuf = NULL;
|
||||
|
||||
|
||||
#ifdef DISPLAY_GETBLOCK
|
||||
@ -281,6 +290,10 @@ BOOL searchblock(ULONG blkno, COUNT dsk,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (bp->b_flag & BFR_UNCACHE)
|
||||
uncacheBuf = bp;
|
||||
|
||||
|
||||
if (bp->b_flag & BFR_FAT)
|
||||
fat_count++;
|
||||
else
|
||||
@ -291,17 +304,27 @@ BOOL searchblock(ULONG blkno, COUNT dsk,
|
||||
now take either the last buffer in chain (not used recently)
|
||||
or, if we are low on FAT buffers, the last non FAT buffer
|
||||
*/
|
||||
|
||||
if (lbp ->b_flag & BFR_FAT && fat_count < 3 && lastNonFat)
|
||||
|
||||
if (uncacheBuf)
|
||||
{
|
||||
lbp = uncacheBuf;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (lbp ->b_flag & BFR_FAT && fat_count < 3 && lastNonFat)
|
||||
{
|
||||
lbp = lastNonFat;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lbp->b_flag &= ~BFR_UNCACHE; /* reset uncache attribute */
|
||||
|
||||
*pBuffp = lbp;
|
||||
|
||||
#ifdef DISPLAY_GETBLOCK
|
||||
printf("MISS, replace %04x:%04x]\n", FP_SEG(lbp), FP_OFF(lbp));
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
if (lbp != firstbuf) /* move to front */
|
||||
@ -316,6 +339,23 @@ BOOL searchblock(ULONG blkno, COUNT dsk,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void dumpBufferCache(void)
|
||||
{
|
||||
struct buffer FAR *bp;
|
||||
int printed = 0;
|
||||
|
||||
/* Search through buffers to see if the required block */
|
||||
/* is already in a buffer */
|
||||
|
||||
for (bp = firstbuf; bp != NULL;bp = bp->b_next)
|
||||
{
|
||||
printf("%8lx %02x ",getblkno(bp),bp->b_flag);
|
||||
if (++printed % 6 == 0)
|
||||
printf("\n");
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
|
||||
/* */
|
||||
/* Return the address of a buffer structure containing the */
|
||||
@ -364,17 +404,10 @@ struct buffer FAR *getblock(ULONG blkno, COUNT dsk)
|
||||
}
|
||||
|
||||
/*
|
||||
Return the address of a buffer structure for the
|
||||
requested block. This is for writing new data to a block, so
|
||||
we really don't care what is in the buffer now.
|
||||
|
||||
returns:
|
||||
TRUE = buffer available, flushed if necessary
|
||||
parameter is filled with pointer to buffer
|
||||
FALSE = there was an error flushing the buffer.
|
||||
parameter is set to NULL
|
||||
exactly the same as getblock(), but the data will be completely
|
||||
overwritten. so there is no need to read from disk first
|
||||
*/
|
||||
BOOL getbuf(struct buffer FAR ** pbp, ULONG blkno, COUNT dsk)
|
||||
struct buffer FAR * getblockOver(ULONG blkno, COUNT dsk)
|
||||
{
|
||||
struct buffer FAR *bp;
|
||||
|
||||
@ -383,8 +416,7 @@ BOOL getbuf(struct buffer FAR ** pbp, ULONG blkno, COUNT dsk)
|
||||
|
||||
if (searchblock(blkno, dsk, &bp))
|
||||
{
|
||||
*pbp = bp;
|
||||
return TRUE;
|
||||
return bp;
|
||||
}
|
||||
|
||||
/* The block we need is not in a buffer, we must make a buffer */
|
||||
@ -396,14 +428,12 @@ BOOL getbuf(struct buffer FAR ** pbp, ULONG blkno, COUNT dsk)
|
||||
bp->b_flag = 0;
|
||||
bp->b_unit = dsk;
|
||||
setblkno(bp, blkno);
|
||||
*pbp = bp;
|
||||
return TRUE;
|
||||
return bp;
|
||||
}
|
||||
else
|
||||
/* failure */
|
||||
{
|
||||
*pbp = NULL;
|
||||
return FALSE;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
/* */
|
||||
@ -438,7 +468,7 @@ BOOL flush_buffers(REG COUNT dsk)
|
||||
{
|
||||
if (bp->b_unit == dsk)
|
||||
if (!flush1(bp))
|
||||
ok = FALSE;
|
||||
ok = FALSE;
|
||||
bp = bp->b_next;
|
||||
}
|
||||
return ok;
|
||||
@ -465,16 +495,17 @@ BOOL flush1(struct buffer FAR * bp)
|
||||
|
||||
while (--i > 0)
|
||||
{
|
||||
blkno += offset;
|
||||
result = dskxfer(bp->b_unit, blkno,
|
||||
blkno += offset;
|
||||
result = dskxfer(bp->b_unit, blkno,
|
||||
(VOID FAR *) bp->b_buffer, 1, DSKWRITE); /* BER 9/4/00 */
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
result = TRUE; /* This negates any error code returned in result...BER */
|
||||
result = 0; /* This negates any error code returned in result...BER */
|
||||
/* and 0 returned, if no errors occurred - tom */
|
||||
bp->b_flag &= ~BFR_DIRTY; /* even if error, mark not dirty */
|
||||
if (!result) /* otherwise system has trouble */
|
||||
if (result != 0) /* otherwise system has trouble */
|
||||
bp->b_flag &= ~BFR_VALID; /* continuing. */
|
||||
return (TRUE); /* Forced to TRUE...was like this before dskxfer() */
|
||||
/* returned error codes...BER */
|
||||
@ -521,6 +552,24 @@ UWORD dskxfer(COUNT dsk, ULONG blkno, VOID FAR * buf, UWORD numblocks, COUNT mod
|
||||
|
||||
REG struct dpb FAR *dpbp = CDSp->cds_table[dsk].cdsDpb;
|
||||
|
||||
|
||||
if ((UCOUNT)dsk >= lastdrive ||
|
||||
!(CDSp->cds_table[dsk].cdsFlags & CDSPHYSDRV))
|
||||
{
|
||||
return -1; /* illegal command */
|
||||
}
|
||||
|
||||
#if 1
|
||||
#define KeyboardShiftState() (*(BYTE FAR *)(MK_FP(0x40,0x17)))
|
||||
|
||||
if (KeyboardShiftState() & 0x01)
|
||||
{
|
||||
printf("dskxfer:%s %x - %lx %u\n", mode == DSKWRITE ? "write" : "read", dsk, blkno, numblocks);
|
||||
if ((KeyboardShiftState() & 0x03) == 3)
|
||||
dumpBufferCache();
|
||||
}
|
||||
#endif
|
||||
|
||||
for (;;)
|
||||
{
|
||||
IoReqHdr.r_length = sizeof(request);
|
||||
|
@ -36,6 +36,9 @@ static BYTE *charioRcsId = "$Id$";
|
||||
|
||||
/*
|
||||
* $Log$
|
||||
* Revision 1.9 2001/06/03 14:16:17 bartoldeman
|
||||
* BUFFERS tuning and misc bug fixes/cleanups (2024c).
|
||||
*
|
||||
* Revision 1.8 2001/04/29 17:34:40 bartoldeman
|
||||
* A new SYS.COM/config.sys single stepping/console output/misc fixes.
|
||||
*
|
||||
@ -285,7 +288,7 @@ VOID KbdFlush(void)
|
||||
|
||||
static VOID kbfill(keyboard FAR * kp, UCOUNT c, BOOL ctlf, UWORD * vp)
|
||||
{
|
||||
if (kp->kb_count > kp->kb_size)
|
||||
if (kp->kb_count >= kp->kb_size)
|
||||
{
|
||||
cso(BELL);
|
||||
return;
|
||||
@ -349,8 +352,6 @@ UCOUNT sti(keyboard FAR * kp)
|
||||
for (i = kp->kb_count; local_buffer[i] != '\0'; i++)
|
||||
{
|
||||
c = local_buffer[kp->kb_count];
|
||||
if (c == '\r' || c == '\n')
|
||||
break;
|
||||
kbfill(kp, c, FALSE, &virt_pos);
|
||||
}
|
||||
break;
|
||||
@ -358,8 +359,6 @@ UCOUNT sti(keyboard FAR * kp)
|
||||
|
||||
case RIGHT:
|
||||
c = local_buffer[kp->kb_count];
|
||||
if (c == '\r' || c == '\n')
|
||||
break;
|
||||
kbfill(kp, c, FALSE, &virt_pos);
|
||||
break;
|
||||
}
|
||||
@ -397,21 +396,18 @@ UCOUNT sti(keyboard FAR * kp)
|
||||
break;
|
||||
|
||||
case CR:
|
||||
kbfill(kp, CR, TRUE, &virt_pos);
|
||||
kbfill(kp, LF, TRUE, &virt_pos);
|
||||
#ifndef NOSPCL
|
||||
fbcopy((BYTE FAR *) kp->kb_buf,
|
||||
(BYTE FAR *) local_buffer, (COUNT) kp->kb_count);
|
||||
local_buffer[kp->kb_count] = '\0';
|
||||
#endif
|
||||
kbfill(kp, CR, TRUE, &virt_pos);
|
||||
if (eof)
|
||||
return eof;
|
||||
else
|
||||
return kp->kb_count;
|
||||
|
||||
case LF:
|
||||
cso(CR);
|
||||
cso(LF);
|
||||
break;
|
||||
|
||||
case ESC:
|
||||
|
154
kernel/config.c
154
kernel/config.c
@ -80,6 +80,9 @@ static BYTE *RcsId = "$Id$";
|
||||
|
||||
/*
|
||||
* $Log$
|
||||
* Revision 1.23 2001/06/03 14:16:17 bartoldeman
|
||||
* BUFFERS tuning and misc bug fixes/cleanups (2024c).
|
||||
*
|
||||
* Revision 1.22 2001/04/29 17:34:40 bartoldeman
|
||||
* A new SYS.COM/config.sys single stepping/console output/misc fixes.
|
||||
*
|
||||
@ -590,9 +593,7 @@ INIT VOID configDone(VOID)
|
||||
INIT VOID DoConfig(VOID)
|
||||
{
|
||||
COUNT nFileDesc;
|
||||
COUNT nRetCode;
|
||||
BYTE *pLine,
|
||||
*pTmp;
|
||||
BYTE *pLine;
|
||||
BOOL bEof;
|
||||
|
||||
/* Check to see if we have a config.sys file. If not, just */
|
||||
@ -627,97 +628,82 @@ INIT VOID DoConfig(VOID)
|
||||
/* Read each line into the buffer and then parse the line, */
|
||||
/* do the table lookup and execute the handler for that */
|
||||
/* function. */
|
||||
while (!bEof)
|
||||
|
||||
for (;!bEof;nCfgLine++)
|
||||
{
|
||||
struct table *pEntry;
|
||||
UWORD bytesLeft = 0;
|
||||
|
||||
if (pLine > szLine)
|
||||
bytesLeft = LINESIZE - (pLine - szLine);
|
||||
pLineStart = szLine;
|
||||
|
||||
/* read in a single line, \n or ^Z terminated */
|
||||
|
||||
for (pLine = szLine;;)
|
||||
{
|
||||
if (read(nFileDesc, pLine, 1) <= 0)
|
||||
{
|
||||
bEof = TRUE;
|
||||
break;
|
||||
}
|
||||
if (pLine >= szLine + sizeof(szLine)-3)
|
||||
{
|
||||
CfgFailure(pLine);
|
||||
printf("error - line overflow line %d \n",nCfgLine);
|
||||
break;
|
||||
}
|
||||
|
||||
if (bytesLeft)
|
||||
{
|
||||
fbcopy(pLine, szLine, LINESIZE - bytesLeft);
|
||||
pLine = szLine + bytesLeft;
|
||||
}
|
||||
|
||||
/* Read a line from config */
|
||||
/* Interrupt processing if read error or no bytes read */
|
||||
if ((nRetCode = read(nFileDesc, pLine, LINESIZE - bytesLeft)) <= 0)
|
||||
break;
|
||||
|
||||
/* If the buffer was not filled completely, append a
|
||||
CTRL-Z character to mark where the file ends */
|
||||
|
||||
if (nRetCode + bytesLeft < LINESIZE)
|
||||
szLine[nRetCode + bytesLeft] = EOF;
|
||||
|
||||
/* Process the buffer, line by line */
|
||||
pLine = szLine;
|
||||
|
||||
while (!bEof && *pLine != EOF)
|
||||
{
|
||||
|
||||
/*
|
||||
Do it here in the loop.
|
||||
*/
|
||||
|
||||
/* shouldn't this go also AFTER the last line has been read?
|
||||
might be the UMB driver */
|
||||
if(UmbState == 2){
|
||||
if(!Umb_Test()){
|
||||
UmbState = 1;
|
||||
upBase = MK_FP(umb_start , 0);
|
||||
/* reset root */
|
||||
uppermem_root = umb_start;
|
||||
/* setup the real mcb for the devicehigh block */
|
||||
zumcb_init((mcb FAR *) upBase, UMB_top - 1);
|
||||
upBase += 16;
|
||||
if (*pLine == '\n' ||
|
||||
*pLine == EOF ) /* end of line */
|
||||
break;
|
||||
|
||||
if (*pLine == '\r') /* ignore */
|
||||
;
|
||||
else
|
||||
pLine++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (pTmp = pLine; pTmp - szLine < LINESIZE; pTmp++)
|
||||
{
|
||||
if (*pTmp == '\r' || *pTmp == EOF)
|
||||
break;
|
||||
}
|
||||
|
||||
if (pTmp - szLine >= LINESIZE)
|
||||
break;
|
||||
|
||||
if (*pTmp == EOF)
|
||||
bEof = TRUE;
|
||||
|
||||
*pTmp = '\0';
|
||||
pLineStart = pLine;
|
||||
|
||||
*pLine = 0;
|
||||
pLine = szLine;
|
||||
|
||||
|
||||
/* Skip leading white space and get verb. */
|
||||
pLine = scan(pLine, szBuf);
|
||||
|
||||
/* If the line was blank, skip it. Otherwise, look up */
|
||||
/* the verb and execute the appropriate function. */
|
||||
if (*szBuf != '\0')
|
||||
{
|
||||
pEntry = LookUp(commands, szBuf);
|
||||
if (*szBuf == '\0')
|
||||
continue;
|
||||
|
||||
if (pEntry->pass < 0 || pEntry->pass == nPass)
|
||||
{
|
||||
if ( !SkipLine(pLineStart))
|
||||
{
|
||||
pLine = skipwh(pLine);
|
||||
pEntry = LookUp(commands, szBuf);
|
||||
|
||||
if ('=' != *pLine)
|
||||
if (pEntry->pass >= 0 && pEntry->pass != nPass)
|
||||
continue;
|
||||
|
||||
if ( SkipLine(pLineStart)) /* F5/F8 processing */
|
||||
continue;
|
||||
|
||||
pLine = skipwh(pLine);
|
||||
|
||||
if ('=' != *pLine)
|
||||
CfgFailure(pLine);
|
||||
else
|
||||
else /* YES. DO IT */
|
||||
(*(pEntry->func)) (skipwh(pLine+1));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* might have been the UMB driver */
|
||||
if(UmbState == 2){
|
||||
if(!Umb_Test()){
|
||||
UmbState = 1;
|
||||
upBase = MK_FP(umb_start , 0);
|
||||
/* reset root */
|
||||
uppermem_root = umb_start;
|
||||
/* setup the real mcb for the devicehigh block */
|
||||
zumcb_init((mcb FAR *) upBase, UMB_top - 1);
|
||||
upBase += 16;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
nCfgLine++;
|
||||
pLine += strlen(pLine) + 1;
|
||||
}
|
||||
}
|
||||
close(nFileDesc);
|
||||
}
|
||||
|
||||
@ -825,7 +811,7 @@ INIT BOOL SkipLine(char *pLine)
|
||||
{
|
||||
case 'N':
|
||||
case 'n':
|
||||
printf("N");
|
||||
printf("N\n");
|
||||
return TRUE;
|
||||
|
||||
case 0x1b: /* don't know where documented
|
||||
@ -838,14 +824,14 @@ INIT BOOL SkipLine(char *pLine)
|
||||
case '\n':
|
||||
case 'Y':
|
||||
case 'y':
|
||||
printf("Y");
|
||||
printf("Y\n");
|
||||
return FALSE;
|
||||
|
||||
}
|
||||
|
||||
if (key == 0x3f00) /* YES, you may hit F5 here, too */
|
||||
{
|
||||
printf("N");
|
||||
printf("N\n");
|
||||
SkipAllConfig = TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
@ -969,7 +955,7 @@ INIT static VOID Lastdrive(BYTE * pLine)
|
||||
*/
|
||||
|
||||
|
||||
INIT static VOID Dosmem(BYTE * pLine)
|
||||
INIT STATIC VOID Dosmem(BYTE * pLine)
|
||||
{
|
||||
BYTE *pTmp;
|
||||
BYTE UMBwanted = FALSE, HMAwanted = FALSE;
|
||||
@ -1515,7 +1501,11 @@ VOID config_init_buffers(COUNT anzBuffers)
|
||||
int HMAcount = 0;
|
||||
|
||||
anzBuffers = max(anzBuffers,6);
|
||||
anzBuffers = min(anzBuffers,64);
|
||||
if (anzBuffers > 99)
|
||||
{
|
||||
printf("BUFFERS=%u not supported, reducing to 99\n",anzBuffers);
|
||||
anzBuffers = 99;
|
||||
}
|
||||
|
||||
firstbuf = ConfigAlloc(sizeof (struct buffer));
|
||||
|
||||
|
@ -37,6 +37,9 @@ static BYTE *dosfnsRcsId = "$Id$";
|
||||
* /// Added SHARE support. 2000/09/04 Ron Cemer
|
||||
*
|
||||
* $Log$
|
||||
* Revision 1.18 2001/06/03 14:16:17 bartoldeman
|
||||
* BUFFERS tuning and misc bug fixes/cleanups (2024c).
|
||||
*
|
||||
* Revision 1.17 2001/04/29 17:34:40 bartoldeman
|
||||
* A new SYS.COM/config.sys single stepping/console output/misc fixes.
|
||||
*
|
||||
@ -173,12 +176,12 @@ static BYTE *dosfnsRcsId = "$Id$";
|
||||
|
||||
#include "globals.h"
|
||||
|
||||
sft FAR *get_sft(COUNT);
|
||||
sft FAR *get_sft(UCOUNT);
|
||||
WORD get_free_hndl(VOID);
|
||||
sft FAR *get_free_sft(WORD FAR *);
|
||||
BOOL cmatch(COUNT, COUNT, COUNT);
|
||||
|
||||
struct f_node FAR *xlt_fd(COUNT);
|
||||
f_node_ptr xlt_fd(COUNT);
|
||||
|
||||
|
||||
/* /// Added for SHARE. - Ron Cemer */
|
||||
@ -248,7 +251,7 @@ static VOID DosGetFile(BYTE FAR * lpszPath, BYTE FAR * lpszDosFileName)
|
||||
fbcopy((BYTE FAR *) szLclExt, &lpszDosFileName[FNAME_SIZE], FEXT_SIZE);
|
||||
}
|
||||
|
||||
sft FAR *get_sft(COUNT hndl)
|
||||
sft FAR *get_sft(UCOUNT hndl)
|
||||
{
|
||||
psp FAR *p = MK_FP(cu_psp, 0);
|
||||
WORD sys_idx;
|
||||
@ -363,6 +366,11 @@ UCOUNT GenericRead(COUNT hndl, UCOUNT n, BYTE FAR * bp, COUNT FAR * err,
|
||||
ReadCount = sti((keyboard FAR *) & kb_buf);
|
||||
if (ReadCount < kb_buf.kb_count)
|
||||
s->sft_flags &= ~SFT_FEOF;
|
||||
else if (kb_buf.kb_count < kb_buf.kb_size) {
|
||||
kb_buf.kb_buf[kb_buf.kb_count++] = LF;
|
||||
cso(LF);
|
||||
ReadCount++;
|
||||
}
|
||||
fbcopy((BYTE FAR *) kb_buf.kb_buf, bp, kb_buf.kb_count);
|
||||
*err = SUCCESS;
|
||||
return ReadCount;
|
||||
@ -683,7 +691,7 @@ COUNT DosSeek(COUNT hndl, LONG new_pos, COUNT mode, ULONG * set_pos)
|
||||
return result;
|
||||
}
|
||||
|
||||
static WORD get_free_hndl(void)
|
||||
STATIC WORD get_free_hndl(void)
|
||||
{
|
||||
psp FAR *p = MK_FP(cu_psp, 0);
|
||||
WORD hndl;
|
||||
@ -1023,7 +1031,7 @@ COUNT DosOpen(BYTE FAR * fname, COUNT mode)
|
||||
|
||||
if (sftp->sft_status >= 0)
|
||||
{
|
||||
struct f_node FAR *fnp = xlt_fd(sftp->sft_status);
|
||||
f_node_ptr fnp = xlt_fd(sftp->sft_status);
|
||||
|
||||
sftp->sft_attrib = fnp->f_dir.dir_attrib;
|
||||
|
||||
@ -1214,7 +1222,7 @@ COUNT DosChangeDir(BYTE FAR * s)
|
||||
Some redirectors do not write back to the CDS.
|
||||
SHSUCdX needs this. jt
|
||||
*/
|
||||
fscopy(&PriPathName[0], cdsp->cdsCurrentPath);
|
||||
fstrncpy(cdsp->cdsCurrentPath,&PriPathName[0],sizeof(cdsp->cdsCurrentPath)-1);
|
||||
if (PriPathName[7] == 0)
|
||||
cdsp->cdsCurrentPath[8] = 0; /* Need two Zeros at the end */
|
||||
|
||||
@ -1224,7 +1232,7 @@ COUNT DosChangeDir(BYTE FAR * s)
|
||||
result = dos_cd(cdsp, PriPathName);
|
||||
}
|
||||
if (result == SUCCESS) {
|
||||
fscopy(&PriPathName[0], cdsp->cdsCurrentPath);
|
||||
fstrncpy(cdsp->cdsCurrentPath,&PriPathName[0],sizeof(cdsp->cdsCurrentPath)-1);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -1411,8 +1419,28 @@ COUNT DosGetFattr(BYTE FAR * name, UWORD FAR * attrp)
|
||||
or cleanup, such as converting "c:\a\b\.\c\.." to "C:\A\B".
|
||||
- Ron Cemer
|
||||
*/
|
||||
/*
|
||||
memcpy(SecPathName,PriPathName,sizeof(SecPathName));
|
||||
return dos_getfattr(SecPathName, attrp);
|
||||
*/
|
||||
/* no longer true. dos_getfattr() is
|
||||
A) intelligent (uses dos_open) anyway
|
||||
B) there are some problems with MAX_PARSE, i.e. if PATH ~= 64
|
||||
and TRUENAME adds a C:, which leeds to trouble.
|
||||
|
||||
the problem was discovered, when VC did something like
|
||||
|
||||
fd = DosOpen(filename,...)
|
||||
jc can't_copy_dialog;
|
||||
|
||||
attr = DosGetAttrib(filename);
|
||||
jc can't_copy_dialog;
|
||||
and suddenly, the filehandle stays open
|
||||
shit.
|
||||
tom
|
||||
*/
|
||||
return dos_getfattr(name, attrp);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -1449,8 +1477,14 @@ COUNT DosSetFattr(BYTE FAR * name, UWORD FAR * attrp)
|
||||
to get trashed somewhere in transit.
|
||||
- Ron Cemer
|
||||
*/
|
||||
/*
|
||||
memcpy(SecPathName,PriPathName,sizeof(SecPathName));
|
||||
return dos_setfattr(SecPathName, attrp);
|
||||
|
||||
see DosGetAttr()
|
||||
*/
|
||||
return dos_setfattr(name, attrp);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,6 +36,9 @@ static BYTE *dosnamesRcsId = "$Id$";
|
||||
|
||||
/*
|
||||
* $Log$
|
||||
* Revision 1.9 2001/06/03 14:16:17 bartoldeman
|
||||
* BUFFERS tuning and misc bug fixes/cleanups (2024c).
|
||||
*
|
||||
* Revision 1.8 2001/04/15 03:21:50 bartoldeman
|
||||
* See history.txt for the list of fixes.
|
||||
*
|
||||
@ -421,8 +424,9 @@ VOID DosTrimPath(BYTE FAR * lpszPathNamep)
|
||||
lpszRoot = lpszNext + 1;
|
||||
}
|
||||
|
||||
/* NAMEMAX + 2, must include C: TE*/
|
||||
for (lpszLast = lpszNext = lpszPathNamep, nChars = 0;
|
||||
*lpszNext != '\0' && nChars < NAMEMAX;)
|
||||
*lpszNext != '\0' && nChars < NAMEMAX+2;)
|
||||
{
|
||||
/* Initialize flag for loop. */
|
||||
flDotDot = FALSE;
|
||||
|
@ -34,6 +34,9 @@ static BYTE *errorRcsId = "$Id$";
|
||||
|
||||
/*
|
||||
* $Log$
|
||||
* Revision 1.5 2001/06/03 14:16:17 bartoldeman
|
||||
* BUFFERS tuning and misc bug fixes/cleanups (2024c).
|
||||
*
|
||||
* Revision 1.4 2001/04/15 03:21:50 bartoldeman
|
||||
* See history.txt for the list of fixes.
|
||||
*
|
||||
@ -87,6 +90,7 @@ static BYTE *errorRcsId = "$Id$";
|
||||
|
||||
#include "globals.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
/* error registers */
|
||||
VOID dump(void)
|
||||
{
|
||||
@ -105,6 +109,7 @@ VOID dump(void)
|
||||
error_regs.DS,
|
||||
error_regs.ES);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* issue a panic message for corrupted data structures */
|
||||
VOID panic(BYTE * s)
|
||||
@ -124,8 +129,8 @@ VOID fatal(BYTE * err_msg)
|
||||
/* issue an internal error message */
|
||||
VOID fatal(BYTE * err_msg)
|
||||
{
|
||||
printf("\nInternal kernel error - %s\nSystem halted\n", err_msg);
|
||||
for (;;) ;
|
||||
printf("\nInternal kernel error - \n");
|
||||
panic(err_msg);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
100
kernel/fatdir.c
100
kernel/fatdir.c
@ -36,6 +36,9 @@ static BYTE *fatdirRcsId = "$Id$";
|
||||
|
||||
/*
|
||||
* $Log$
|
||||
* Revision 1.16 2001/06/03 14:16:17 bartoldeman
|
||||
* BUFFERS tuning and misc bug fixes/cleanups (2024c).
|
||||
*
|
||||
* Revision 1.15 2001/04/29 17:34:40 bartoldeman
|
||||
* A new SYS.COM/config.sys single stepping/console output/misc fixes.
|
||||
*
|
||||
@ -169,11 +172,11 @@ static BYTE *fatdirRcsId = "$Id$";
|
||||
* Initial revision.
|
||||
*/
|
||||
|
||||
VOID pop_dmp(dmatch FAR *, struct f_node FAR *);
|
||||
VOID pop_dmp(dmatch FAR *, f_node_ptr);
|
||||
|
||||
struct f_node FAR *dir_open(BYTE FAR * dirname)
|
||||
f_node_ptr dir_open(BYTE FAR * dirname)
|
||||
{
|
||||
struct f_node FAR *fnp;
|
||||
f_node_ptr fnp;
|
||||
COUNT drive;
|
||||
BYTE *p;
|
||||
WORD i;
|
||||
@ -183,9 +186,9 @@ struct f_node FAR *dir_open(BYTE FAR * dirname)
|
||||
BYTE *pszPath = &TempCDS.cdsCurrentPath[2];
|
||||
|
||||
/* Allocate an fnode if possible - error return (0) if not. */
|
||||
if ((fnp = get_f_node()) == (struct f_node FAR *)0)
|
||||
if ((fnp = get_f_node()) == (f_node_ptr)0)
|
||||
{
|
||||
return (struct f_node FAR *)NULL;
|
||||
return (f_node_ptr)0;
|
||||
}
|
||||
|
||||
/* Force the fnode into read-write mode */
|
||||
@ -255,7 +258,7 @@ struct f_node FAR *dir_open(BYTE FAR * dirname)
|
||||
if (media_check(TempCDS.cdsDpb) < 0)
|
||||
{
|
||||
release_f_node(fnp);
|
||||
return (struct f_node FAR *)0;
|
||||
return (f_node_ptr)0;
|
||||
}
|
||||
|
||||
fnp->f_dsize = DIRENT_SIZE * TempCDS.cdsDpb->dpb_dirents;
|
||||
@ -329,7 +332,7 @@ struct f_node FAR *dir_open(BYTE FAR * dirname)
|
||||
{
|
||||
|
||||
release_f_node(fnp);
|
||||
return (struct f_node FAR *)0;
|
||||
return (f_node_ptr)0;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -354,7 +357,7 @@ struct f_node FAR *dir_open(BYTE FAR * dirname)
|
||||
return fnp;
|
||||
}
|
||||
|
||||
COUNT dir_read(REG struct f_node FAR * fnp)
|
||||
COUNT dir_read(REG f_node_ptr fnp)
|
||||
{
|
||||
/* REG i; */
|
||||
/* REG j; */
|
||||
@ -396,7 +399,7 @@ COUNT dir_read(REG struct f_node FAR * fnp)
|
||||
+ fnp->f_dpb->dpb_dirstrt),
|
||||
fnp->f_dpb->dpb_unit);
|
||||
bp->b_flag &= ~(BFR_DATA | BFR_FAT);
|
||||
bp->b_flag |= BFR_DIR;
|
||||
bp->b_flag |= BFR_DIR | BFR_VALID;
|
||||
#ifdef DISPLAY_GETBLOCK
|
||||
printf("DIR (dir_read)\n");
|
||||
#endif
|
||||
@ -447,7 +450,7 @@ COUNT dir_read(REG struct f_node FAR * fnp)
|
||||
+ fnp->f_sector,
|
||||
fnp->f_dpb->dpb_unit);
|
||||
bp->b_flag &= ~(BFR_DATA | BFR_FAT);
|
||||
bp->b_flag |= BFR_DIR;
|
||||
bp->b_flag |= BFR_DIR | BFR_VALID;
|
||||
#ifdef DISPLAY_GETBLOCK
|
||||
printf("DIR (dir_read)\n");
|
||||
#endif
|
||||
@ -478,7 +481,7 @@ COUNT dir_read(REG struct f_node FAR * fnp)
|
||||
}
|
||||
|
||||
#ifndef IPL
|
||||
COUNT dir_write(REG struct f_node FAR * fnp)
|
||||
COUNT dir_write(REG f_node_ptr fnp)
|
||||
{
|
||||
struct buffer FAR *bp;
|
||||
|
||||
@ -494,7 +497,7 @@ COUNT dir_write(REG struct f_node FAR * fnp)
|
||||
+ fnp->f_dpb->dpb_dirstrt),
|
||||
fnp->f_dpb->dpb_unit);
|
||||
bp->b_flag &= ~(BFR_DATA | BFR_FAT);
|
||||
bp->b_flag |= BFR_DIR;
|
||||
bp->b_flag |= BFR_DIR | BFR_VALID;
|
||||
#ifdef DISPLAY_GETBLOCK
|
||||
printf("DIR (dir_write)\n");
|
||||
#endif
|
||||
@ -546,7 +549,7 @@ COUNT dir_write(REG struct f_node FAR * fnp)
|
||||
+ fnp->f_sector,
|
||||
fnp->f_dpb->dpb_unit);
|
||||
bp->b_flag &= ~(BFR_DATA | BFR_FAT);
|
||||
bp->b_flag |= BFR_DIR;
|
||||
bp->b_flag |= BFR_DIR | BFR_VALID;
|
||||
#ifdef DISPLAY_GETBLOCK
|
||||
printf("DIR (dir_write)\n");
|
||||
#endif
|
||||
@ -561,13 +564,13 @@ COUNT dir_write(REG struct f_node FAR * fnp)
|
||||
}
|
||||
putdirent((struct dirent FAR *)&fnp->f_dir,
|
||||
(VOID FAR *) & bp->b_buffer[(UWORD)fnp->f_diroff % fnp->f_dpb->dpb_secsize]);
|
||||
bp->b_flag |= BFR_DIRTY;
|
||||
bp->b_flag |= BFR_DIRTY | BFR_VALID;
|
||||
}
|
||||
return DIRENT_SIZE;
|
||||
}
|
||||
#endif
|
||||
|
||||
VOID dir_close(REG struct f_node FAR * fnp)
|
||||
VOID dir_close(REG f_node_ptr fnp)
|
||||
{
|
||||
REG COUNT disk = fnp->f_dpb->dpb_unit;
|
||||
|
||||
@ -590,7 +593,7 @@ VOID dir_close(REG struct f_node FAR * fnp)
|
||||
#ifndef IPL
|
||||
COUNT dos_findfirst(UCOUNT attr, BYTE FAR * name)
|
||||
{
|
||||
REG struct f_node FAR *fnp;
|
||||
REG f_node_ptr fnp;
|
||||
REG dmatch FAR *dmp = (dmatch FAR *) dta;
|
||||
REG COUNT i;
|
||||
COUNT nDrive;
|
||||
@ -729,11 +732,11 @@ COUNT dos_findfirst(UCOUNT attr, BYTE FAR * name)
|
||||
COUNT dos_findnext(void)
|
||||
{
|
||||
REG dmatch FAR *dmp = (dmatch FAR *) dta;
|
||||
REG struct f_node FAR *fnp;
|
||||
REG f_node_ptr fnp;
|
||||
BOOL found = FALSE;
|
||||
|
||||
/* Allocate an fnode if possible - error return (0) if not. */
|
||||
if ((fnp = get_f_node()) == (struct f_node FAR *)0)
|
||||
if ((fnp = get_f_node()) == (f_node_ptr)0)
|
||||
{
|
||||
return DE_NFILES;
|
||||
}
|
||||
@ -804,7 +807,7 @@ COUNT dos_findnext(void)
|
||||
return found ? SUCCESS : DE_NFILES;
|
||||
}
|
||||
|
||||
static VOID pop_dmp(dmatch FAR * dmp, struct f_node FAR * fnp)
|
||||
static VOID pop_dmp(dmatch FAR * dmp, f_node_ptr fnp)
|
||||
{
|
||||
|
||||
dmp->dm_attr_fnd = fnp->f_dir.dir_attrib;
|
||||
@ -824,6 +827,11 @@ static VOID pop_dmp(dmatch FAR * dmp, struct f_node FAR * fnp)
|
||||
/*
|
||||
this receives a name in 11 char field NAME+EXT and builds
|
||||
a zeroterminated string
|
||||
|
||||
unfortunately, blanks are allowed in filenames. like
|
||||
"test e", " test .y z",...
|
||||
|
||||
so we have to work from the last blank backward
|
||||
*/
|
||||
void ConvertName83ToNameSZ(BYTE FAR *destSZ, BYTE FAR *srcFCBName)
|
||||
{
|
||||
@ -835,24 +843,56 @@ void ConvertName83ToNameSZ(BYTE FAR *destSZ, BYTE FAR *srcFCBName)
|
||||
noExtension = TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
fmemcpy(destSZ,srcFCBName,FNAME_SIZE);
|
||||
|
||||
srcFCBName += FNAME_SIZE;
|
||||
|
||||
for (loop = FNAME_SIZE; --loop >= 0; )
|
||||
{
|
||||
if (destSZ[loop] != ' ')
|
||||
break;
|
||||
}
|
||||
destSZ += loop + 1;
|
||||
|
||||
|
||||
for (loop = FNAME_SIZE; --loop >= 0; srcFCBName++)
|
||||
{
|
||||
if (*srcFCBName != ' ')
|
||||
*destSZ++ = *srcFCBName;
|
||||
}
|
||||
|
||||
if (!noExtension) /* not for ".", ".." */
|
||||
{
|
||||
if (*srcFCBName != ' ')
|
||||
|
||||
for (loop = FEXT_SIZE; --loop >= 0; )
|
||||
{
|
||||
if (srcFCBName[loop] != ' ')
|
||||
break;
|
||||
}
|
||||
if (loop >= 0)
|
||||
{
|
||||
*destSZ++ = '.';
|
||||
for (loop = FEXT_SIZE; --loop >= 0; srcFCBName++)
|
||||
{
|
||||
if (*srcFCBName != ' ')
|
||||
*destSZ++ = *srcFCBName;
|
||||
}
|
||||
fmemcpy(destSZ,srcFCBName,loop+1);
|
||||
destSZ += loop+1;
|
||||
}
|
||||
}
|
||||
*destSZ = '\0';
|
||||
}
|
||||
|
||||
/*
|
||||
returns the asciiSZ length of a 8.3 filename
|
||||
*/
|
||||
|
||||
int FileName83Length(BYTE *filename83)
|
||||
{
|
||||
BYTE buff[13];
|
||||
|
||||
ConvertName83ToNameSZ(buff, filename83);
|
||||
|
||||
return strlen(buff);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
258
kernel/fatfs.c
258
kernel/fatfs.c
@ -35,7 +35,13 @@ BYTE *RcsId = "$Id$";
|
||||
#endif
|
||||
|
||||
/*
|
||||
* the dos_mkdir/extenddir (with getblock() instead of getblockOver) was a real
|
||||
* performance killer on large drives. (~0.5 sec /dos_mkdir) TE
|
||||
*
|
||||
* $Log$
|
||||
* Revision 1.18 2001/06/03 14:16:17 bartoldeman
|
||||
* BUFFERS tuning and misc bug fixes/cleanups (2024c).
|
||||
*
|
||||
* Revision 1.17 2001/04/29 17:34:40 bartoldeman
|
||||
* A new SYS.COM/config.sys single stepping/console output/misc fixes.
|
||||
*
|
||||
@ -225,26 +231,26 @@ BYTE *RcsId = "$Id$";
|
||||
/* */
|
||||
/* function prototypes */
|
||||
/* */
|
||||
struct f_node FAR *xlt_fd(COUNT);
|
||||
COUNT xlt_fnp(struct f_node FAR *);
|
||||
struct f_node FAR *split_path(BYTE FAR *, BYTE *, BYTE *, BYTE *);
|
||||
BOOL find_fname(struct f_node FAR *, BYTE *, BYTE *);
|
||||
f_node_ptrxlt_fd(COUNT);
|
||||
COUNT xlt_fnp(f_node_ptr);
|
||||
f_node_ptr split_path(BYTE FAR *, BYTE *, BYTE *, BYTE *);
|
||||
BOOL find_fname(f_node_ptr, BYTE *, BYTE *);
|
||||
/* /// Added - Ron Cemer */
|
||||
static void merge_file_changes(struct f_node FAR *fnp, int collect);
|
||||
STATIC void merge_file_changes(f_node_ptr fnp, int collect);
|
||||
/* /// Added - Ron Cemer */
|
||||
static int is_same_file(struct f_node FAR *fnp1, struct f_node FAR *fnp2);
|
||||
STATIC int is_same_file(f_node_ptr fnp1, f_node_ptr fnp2);
|
||||
/* /// Added - Ron Cemer */
|
||||
static void copy_file_changes(struct f_node FAR *src, struct f_node FAR *dst);
|
||||
STATIC void copy_file_changes(f_node_ptr src, f_node_ptr dst);
|
||||
date dos_getdate(VOID);
|
||||
time dos_gettime(VOID);
|
||||
BOOL find_free(struct f_node FAR *);
|
||||
UWORD find_fat_free(struct f_node FAR *);
|
||||
VOID wipe_out(struct f_node FAR *);
|
||||
BOOL last_link(struct f_node FAR *);
|
||||
BOOL extend(struct f_node FAR *);
|
||||
COUNT extend_dir(struct f_node FAR *);
|
||||
BOOL first_fat(struct f_node FAR *);
|
||||
COUNT map_cluster(struct f_node FAR *, COUNT);
|
||||
BOOL find_free(f_node_ptr);
|
||||
UWORD find_fat_free(f_node_ptr);
|
||||
VOID wipe_out(f_node_ptr);
|
||||
BOOL last_link(f_node_ptr);
|
||||
BOOL extend(f_node_ptr);
|
||||
COUNT extend_dir(f_node_ptr);
|
||||
BOOL first_fat(f_node_ptr);
|
||||
COUNT map_cluster(f_node_ptr, COUNT);
|
||||
|
||||
/************************************************************************/
|
||||
/* */
|
||||
@ -258,7 +264,7 @@ COUNT map_cluster(struct f_node FAR *, COUNT);
|
||||
|
||||
COUNT dos_open(BYTE FAR * path, COUNT flag)
|
||||
{
|
||||
REG struct f_node FAR *fnp;
|
||||
REG f_node_ptr fnp;
|
||||
|
||||
/* First test the flag to see if the user has passed a valid */
|
||||
/* file mode... */
|
||||
@ -331,7 +337,7 @@ BOOL fcmp_wild(BYTE FAR * s1, BYTE FAR * s2, COUNT n)
|
||||
|
||||
COUNT dos_close(COUNT fd)
|
||||
{
|
||||
struct f_node FAR *fnp;
|
||||
f_node_ptr fnp;
|
||||
|
||||
/* Translate the fd into a useful pointer */
|
||||
fnp = xlt_fd(fd);
|
||||
@ -339,7 +345,7 @@ COUNT dos_close(COUNT fd)
|
||||
/* If the fd was invalid because it was out of range or the */
|
||||
/* requested file was not open, tell the caller and exit */
|
||||
/* note: an invalid fd is indicated by a 0 return */
|
||||
if (fnp == (struct f_node FAR *)0 || fnp->f_count <= 0)
|
||||
if (fnp == (f_node_ptr)0 || fnp->f_count <= 0)
|
||||
return DE_INVLDHNDL;
|
||||
|
||||
if (fnp->f_mode != RDONLY)
|
||||
@ -365,17 +371,17 @@ COUNT dos_close(COUNT fd)
|
||||
/* */
|
||||
/* split a path into it's component directory and file name */
|
||||
/* */
|
||||
struct f_node FAR *
|
||||
f_node_ptr
|
||||
split_path(BYTE FAR * path, BYTE * dname, BYTE * fname, BYTE * fext)
|
||||
{
|
||||
REG struct f_node FAR *fnp;
|
||||
REG f_node_ptr fnp;
|
||||
COUNT nDrive;
|
||||
struct cds FAR *cdsp;
|
||||
|
||||
/* Start off by parsing out the components. */
|
||||
if (ParseDosName(adjust_far(path), &nDrive, &dname[2], fname, fext, FALSE)
|
||||
!= SUCCESS)
|
||||
return (struct f_node FAR *)0;
|
||||
return (f_node_ptr)0;
|
||||
if (nDrive < 0)
|
||||
nDrive = default_drive;
|
||||
|
||||
@ -387,7 +393,7 @@ struct f_node FAR *
|
||||
SpacePad(fext, FEXT_SIZE);
|
||||
|
||||
if (nDrive >= lastdrive) {
|
||||
return (struct f_node FAR *)0;
|
||||
return (f_node_ptr)0;
|
||||
}
|
||||
cdsp = &CDSp->cds_table[nDrive];
|
||||
|
||||
@ -413,7 +419,7 @@ struct f_node FAR *
|
||||
if (cdsp->cdsFlags & CDSNETWDRV) {
|
||||
printf("split path called for redirected file: `%s.%s'\n",
|
||||
fname, fext);
|
||||
return (struct f_node FAR *)0;
|
||||
return (f_node_ptr)0;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -423,10 +429,10 @@ struct f_node FAR *
|
||||
/* If the fd was invalid because it was out of range or the */
|
||||
/* requested file was not open, tell the caller and exit... */
|
||||
/* note: an invalid fd is indicated by a 0 return */
|
||||
if (fnp == (struct f_node FAR *)0 || fnp->f_count <= 0)
|
||||
if (fnp == (f_node_ptr)0 || fnp->f_count <= 0)
|
||||
{
|
||||
dir_close(fnp);
|
||||
return (struct f_node FAR *)0;
|
||||
return (f_node_ptr)0;
|
||||
}
|
||||
|
||||
/* Convert the name into an absolute name for comparison... */
|
||||
@ -437,7 +443,7 @@ struct f_node FAR *
|
||||
return fnp;
|
||||
}
|
||||
|
||||
static BOOL find_fname(struct f_node FAR * fnp, BYTE * fname, BYTE * fext)
|
||||
STATIC BOOL find_fname(f_node_ptr fnp, BYTE * fname, BYTE * fext)
|
||||
{
|
||||
BOOL found = FALSE;
|
||||
|
||||
@ -469,14 +475,14 @@ static BOOL find_fname(struct f_node FAR * fnp, BYTE * fname, BYTE * fext)
|
||||
reasons, since DOS without SHARE does not share changes
|
||||
between two or more open instances of the same file
|
||||
unless these instances were generated by dup() or dup2(). */
|
||||
static void merge_file_changes(struct f_node FAR *fnp, int collect) {
|
||||
struct f_node FAR *fnp2;
|
||||
STATIC void merge_file_changes(f_node_ptr fnp, int collect) {
|
||||
f_node_ptr fnp2;
|
||||
int i;
|
||||
|
||||
if (!IsShareInstalled()) return;
|
||||
for (i = 0; i < f_nodes_cnt; i++) {
|
||||
fnp2 = &f_nodes[i];
|
||||
if ( (fnp != (struct f_node FAR *)0)
|
||||
fnp2 = (f_node_ptr)&f_nodes[i];
|
||||
if ( (fnp != (f_node_ptr)0)
|
||||
&& (fnp != fnp2)
|
||||
&& (fnp->f_count > 0)
|
||||
&& (is_same_file(fnp, fnp2)) ) {
|
||||
@ -501,7 +507,7 @@ static void merge_file_changes(struct f_node FAR *fnp, int collect) {
|
||||
}
|
||||
|
||||
/* /// Added - Ron Cemer */
|
||||
static int is_same_file(struct f_node FAR *fnp1, struct f_node FAR *fnp2) {
|
||||
STATIC int is_same_file(f_node_ptr fnp1, f_node_ptr fnp2) {
|
||||
return
|
||||
(fnp1->f_dpb->dpb_unit == fnp2->f_dpb->dpb_unit)
|
||||
&& (fnp1->f_dpb->dpb_subunit == fnp2->f_dpb->dpb_subunit)
|
||||
@ -520,7 +526,7 @@ static int is_same_file(struct f_node FAR *fnp1, struct f_node FAR *fnp2) {
|
||||
}
|
||||
|
||||
/* /// Added - Ron Cemer */
|
||||
static void copy_file_changes(struct f_node FAR *src, struct f_node FAR *dst) {
|
||||
STATIC void copy_file_changes(f_node_ptr src, f_node_ptr dst) {
|
||||
dst->f_highwater = src->f_highwater;
|
||||
dst->f_dir.dir_start = src->f_dir.dir_start;
|
||||
dst->f_dir.dir_size = src->f_dir.dir_size;
|
||||
@ -530,7 +536,7 @@ static void copy_file_changes(struct f_node FAR *src, struct f_node FAR *dst) {
|
||||
|
||||
COUNT dos_creat(BYTE FAR * path, COUNT attrib)
|
||||
{
|
||||
REG struct f_node FAR *fnp;
|
||||
REG f_node_ptr fnp;
|
||||
|
||||
/* NEVER EVER allow directories to be created */
|
||||
if (attrib & ~(D_RDONLY|D_HIDDEN|D_SYSTEM|D_ARCHIVE))
|
||||
@ -638,7 +644,7 @@ COUNT dos_creat(BYTE FAR * path, COUNT attrib)
|
||||
|
||||
COUNT dos_delete(BYTE FAR * path)
|
||||
{
|
||||
REG struct f_node FAR *fnp;
|
||||
REG f_node_ptr fnp;
|
||||
|
||||
/* first split the passed dir into components (i.e. - */
|
||||
/* path to new directory and name of new directory */
|
||||
@ -687,8 +693,8 @@ COUNT dos_delete(BYTE FAR * path)
|
||||
|
||||
COUNT dos_rmdir(BYTE FAR * path)
|
||||
{
|
||||
REG struct f_node FAR *fnp;
|
||||
REG struct f_node FAR *fnp1;
|
||||
REG f_node_ptr fnp;
|
||||
REG f_node_ptr fnp1;
|
||||
BOOL found;
|
||||
|
||||
/* first split the passed dir into comopnents (i.e. - */
|
||||
@ -713,7 +719,13 @@ COUNT dos_rmdir(BYTE FAR * path)
|
||||
/* The only permissable attribute is directory, */
|
||||
/* check for any other bit set. If it is, give */
|
||||
/* an access error. */
|
||||
if (fnp->f_dir.dir_attrib & ~D_DIR)
|
||||
/* if (fnp->f_dir.dir_attrib & ~D_DIR) */
|
||||
|
||||
/* directories may have attributes, too. at least my WinNT disk
|
||||
has many 'archive' directories
|
||||
we still don't allow SYSTEM or RDONLY directories to be deleted TE*/
|
||||
|
||||
if (fnp->f_dir.dir_attrib & ~(D_DIR |D_HIDDEN|D_ARCHIVE))
|
||||
{
|
||||
dir_close(fnp);
|
||||
return DE_ACCESS;
|
||||
@ -787,8 +799,8 @@ COUNT dos_rmdir(BYTE FAR * path)
|
||||
|
||||
COUNT dos_rename(BYTE FAR * path1, BYTE FAR * path2)
|
||||
{
|
||||
REG struct f_node FAR *fnp1;
|
||||
REG struct f_node FAR *fnp2;
|
||||
REG f_node_ptr fnp1;
|
||||
REG f_node_ptr fnp2;
|
||||
BOOL is_free;
|
||||
|
||||
/* first split the passed target into compnents (i.e. - path to */
|
||||
@ -886,7 +898,7 @@ COUNT dos_rename(BYTE FAR * path1, BYTE FAR * path2)
|
||||
/* */
|
||||
/* wipe out all FAT entries for create, delete, etc. */
|
||||
/* */
|
||||
static VOID wipe_out(struct f_node FAR * fnp)
|
||||
STATIC VOID wipe_out(f_node_ptr fnp)
|
||||
{
|
||||
REG UWORD st,
|
||||
next;
|
||||
@ -926,7 +938,7 @@ static VOID wipe_out(struct f_node FAR * fnp)
|
||||
}
|
||||
}
|
||||
|
||||
static BOOL find_free(struct f_node FAR * fnp)
|
||||
STATIC BOOL find_free(f_node_ptr fnp)
|
||||
{
|
||||
while (dir_read(fnp) == DIRENT_SIZE)
|
||||
{
|
||||
@ -995,7 +1007,7 @@ time dos_gettime()
|
||||
/* */
|
||||
COUNT dos_getftime(COUNT fd, date FAR * dp, time FAR * tp)
|
||||
{
|
||||
struct f_node FAR *fnp;
|
||||
f_node_ptr fnp;
|
||||
|
||||
/* Translate the fd into an fnode pointer, since all internal */
|
||||
/* operations are achieved through fnodes. */
|
||||
@ -1004,7 +1016,7 @@ COUNT dos_getftime(COUNT fd, date FAR * dp, time FAR * tp)
|
||||
/* If the fd was invalid because it was out of range or the */
|
||||
/* requested file was not open, tell the caller and exit */
|
||||
/* note: an invalid fd is indicated by a 0 return */
|
||||
if (fnp == (struct f_node FAR *)0 || fnp->f_count <= 0)
|
||||
if (fnp == (f_node_ptr)0 || fnp->f_count <= 0)
|
||||
return DE_INVLDHNDL;
|
||||
|
||||
/* Get the date and time from the fnode and return */
|
||||
@ -1019,7 +1031,7 @@ COUNT dos_getftime(COUNT fd, date FAR * dp, time FAR * tp)
|
||||
/* */
|
||||
COUNT dos_setftime(COUNT fd, date FAR * dp, time FAR * tp)
|
||||
{
|
||||
struct f_node FAR *fnp;
|
||||
f_node_ptr fnp;
|
||||
|
||||
/* Translate the fd into an fnode pointer, since all internal */
|
||||
/* operations are achieved through fnodes. */
|
||||
@ -1028,7 +1040,7 @@ COUNT dos_setftime(COUNT fd, date FAR * dp, time FAR * tp)
|
||||
/* If the fd was invalid because it was out of range or the */
|
||||
/* requested file was not open, tell the caller and exit */
|
||||
/* note: an invalid fd is indicated by a 0 return */
|
||||
if (fnp == (struct f_node FAR *)0 || fnp->f_count <= 0)
|
||||
if (fnp == (f_node_ptr)0 || fnp->f_count <= 0)
|
||||
return DE_INVLDHNDL;
|
||||
|
||||
/* Set the date and time from the fnode and return */
|
||||
@ -1043,7 +1055,7 @@ COUNT dos_setftime(COUNT fd, date FAR * dp, time FAR * tp)
|
||||
/* */
|
||||
LONG dos_getcufsize(COUNT fd)
|
||||
{
|
||||
struct f_node FAR *fnp;
|
||||
f_node_ptr fnp;
|
||||
|
||||
/* Translate the fd into an fnode pointer, since all internal */
|
||||
/* operations are achieved through fnodes. */
|
||||
@ -1052,7 +1064,7 @@ LONG dos_getcufsize(COUNT fd)
|
||||
/* If the fd was invalid because it was out of range or the */
|
||||
/* requested file was not open, tell the caller and exit */
|
||||
/* note: an invalid fd is indicated by a 0 return */
|
||||
if (fnp == (struct f_node FAR *)0 || fnp->f_count <= 0)
|
||||
if (fnp == (f_node_ptr)0 || fnp->f_count <= 0)
|
||||
return -1l;
|
||||
|
||||
/* Return the file size */
|
||||
@ -1064,7 +1076,7 @@ LONG dos_getcufsize(COUNT fd)
|
||||
/* */
|
||||
LONG dos_getfsize(COUNT fd)
|
||||
{
|
||||
struct f_node FAR *fnp;
|
||||
f_node_ptr fnp;
|
||||
|
||||
/* Translate the fd into an fnode pointer, since all internal */
|
||||
/* operations are achieved through fnodes. */
|
||||
@ -1073,7 +1085,7 @@ LONG dos_getfsize(COUNT fd)
|
||||
/* If the fd was invalid because it was out of range or the */
|
||||
/* requested file was not open, tell the caller and exit */
|
||||
/* note: an invalid fd is indicated by a 0 return */
|
||||
if (fnp == (struct f_node FAR *)0 || fnp->f_count <= 0)
|
||||
if (fnp == (f_node_ptr)0 || fnp->f_count <= 0)
|
||||
return -1l;
|
||||
|
||||
/* Return the file size */
|
||||
@ -1085,7 +1097,7 @@ LONG dos_getfsize(COUNT fd)
|
||||
/* */
|
||||
BOOL dos_setfsize(COUNT fd, LONG size)
|
||||
{
|
||||
struct f_node FAR *fnp;
|
||||
f_node_ptr fnp;
|
||||
|
||||
/* Translate the fd into an fnode pointer, since all internal */
|
||||
/* operations are achieved through fnodes. */
|
||||
@ -1094,7 +1106,7 @@ BOOL dos_setfsize(COUNT fd, LONG size)
|
||||
/* If the fd was invalid because it was out of range or the */
|
||||
/* requested file was not open, tell the caller and exit */
|
||||
/* note: an invalid fd is indicated by a 0 return */
|
||||
if (fnp == (struct f_node FAR *)0 || fnp->f_count <= 0)
|
||||
if (fnp == (f_node_ptr)0 || fnp->f_count <= 0)
|
||||
return FALSE;
|
||||
|
||||
/* Change the file size */
|
||||
@ -1109,7 +1121,7 @@ BOOL dos_setfsize(COUNT fd, LONG size)
|
||||
/* */
|
||||
/* Find free cluster in disk FAT table */
|
||||
/* */
|
||||
static UWORD find_fat_free(struct f_node FAR * fnp)
|
||||
STATIC UWORD find_fat_free(f_node_ptr fnp)
|
||||
{
|
||||
REG UWORD idx;
|
||||
|
||||
@ -1144,15 +1156,14 @@ static UWORD find_fat_free(struct f_node FAR * fnp)
|
||||
}
|
||||
|
||||
/* */
|
||||
/* crate a directory - returns success or a negative error */
|
||||
/* create a directory - returns success or a negative error */
|
||||
/* number */
|
||||
/* */
|
||||
COUNT dos_mkdir(BYTE FAR * dir)
|
||||
{
|
||||
REG struct f_node FAR *fnp;
|
||||
REG f_node_ptr fnp;
|
||||
REG COUNT idx;
|
||||
struct buffer FAR *bp;
|
||||
BYTE FAR *p;
|
||||
UWORD free_fat;
|
||||
UWORD parent;
|
||||
|
||||
@ -1163,6 +1174,28 @@ COUNT dos_mkdir(BYTE FAR * dir)
|
||||
dir_close(fnp);
|
||||
return DE_PATHNOTFND;
|
||||
}
|
||||
|
||||
/* check that the resulting combined path does not exceed
|
||||
the 64 PARSE_MAX limit. this leeds to problems:
|
||||
A) you can't CD to this directory later
|
||||
B) you can't create files in this subdirectory
|
||||
C) the created dir will not be found later, so you
|
||||
can create an unlimited amount of same dirs. this space
|
||||
is lost forever
|
||||
*/
|
||||
if (2 /* "C" */
|
||||
+ strlen(szDirName)
|
||||
+ 1 /* "\\" */
|
||||
+ FileName83Length(szFileName) /* the SZ is not SZ, of course */
|
||||
> PARSE_MAX+2)
|
||||
{
|
||||
dir_close(fnp);
|
||||
return DE_PATHNOTFND;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* Check that we don't have a duplicate name, so if we */
|
||||
/* find one, it's an error. */
|
||||
@ -1244,7 +1277,8 @@ COUNT dos_mkdir(BYTE FAR * dir)
|
||||
|
||||
/* Craft the new directory. Note that if we're in a new */
|
||||
/* directory just under the root, ".." pointer is 0. */
|
||||
bp = getblock((ULONG) clus2phys(free_fat,
|
||||
/* as we are overwriting it completely, don't read first */
|
||||
bp = getblockOver((ULONG) clus2phys(free_fat,
|
||||
(fnp->f_dpb->dpb_clsmask + 1),
|
||||
fnp->f_dpb->dpb_data),
|
||||
fnp->f_dpb->dpb_unit);
|
||||
@ -1277,19 +1311,17 @@ COUNT dos_mkdir(BYTE FAR * dir)
|
||||
putdirent((struct dirent FAR *)&DirEntBuffer, (BYTE FAR *) & bp->b_buffer[DIRENT_SIZE]);
|
||||
|
||||
/* fill the rest of the block with zeros */
|
||||
for (p = (BYTE FAR *) & bp->b_buffer[2 * DIRENT_SIZE];
|
||||
p < &bp->b_buffer[BUFFERSIZE];)
|
||||
*p++ = NULL;
|
||||
fmemset( & bp->b_buffer[2 * DIRENT_SIZE],0, BUFFERSIZE - 2 * DIRENT_SIZE);
|
||||
|
||||
/* Mark the block to be written out */
|
||||
bp->b_flag |= BFR_DIRTY;
|
||||
bp->b_flag |= BFR_DIRTY | BFR_VALID;
|
||||
|
||||
/* clear out the rest of the blocks in the cluster */
|
||||
for (idx = 1; idx < (fnp->f_dpb->dpb_clsmask + 1); idx++)
|
||||
{
|
||||
REG COUNT i;
|
||||
|
||||
bp = getblock((ULONG) clus2phys(fnp->f_dir.dir_start,
|
||||
/* as we are overwriting it completely, don't read first */
|
||||
bp = getblockOver((ULONG) clus2phys(fnp->f_dir.dir_start,
|
||||
(fnp->f_dpb->dpb_clsmask + 1),
|
||||
fnp->f_dpb->dpb_data) + idx,
|
||||
fnp->f_dpb->dpb_unit);
|
||||
@ -1301,9 +1333,9 @@ COUNT dos_mkdir(BYTE FAR * dir)
|
||||
dir_close(fnp);
|
||||
return DE_BLKINVLD;
|
||||
}
|
||||
for (i = 0, p = (BYTE FAR *) bp->b_buffer; i < BUFFERSIZE; i++)
|
||||
*p++ = NULL;
|
||||
bp->b_flag |= BFR_DIRTY;
|
||||
fmemset(bp->b_buffer, 0, BUFFERSIZE);
|
||||
bp->b_flag |= BFR_DIRTY | BFR_VALID;
|
||||
bp->b_flag |= BFR_UNCACHE; /* need not be cached */
|
||||
}
|
||||
|
||||
/* flush the drive buffers so that all info is written */
|
||||
@ -1316,12 +1348,12 @@ COUNT dos_mkdir(BYTE FAR * dir)
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
BOOL last_link(struct f_node FAR * fnp)
|
||||
BOOL last_link(f_node_ptr fnp)
|
||||
{
|
||||
return (((UWORD) fnp->f_cluster == (UWORD) LONG_LAST_CLUSTER));
|
||||
}
|
||||
|
||||
static BOOL extend(struct f_node FAR * fnp)
|
||||
STATIC BOOL extend(f_node_ptr fnp)
|
||||
{
|
||||
UWORD free_fat;
|
||||
|
||||
@ -1347,7 +1379,7 @@ static BOOL extend(struct f_node FAR * fnp)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static COUNT extend_dir(struct f_node FAR * fnp)
|
||||
STATIC COUNT extend_dir(f_node_ptr fnp)
|
||||
{
|
||||
REG COUNT idx;
|
||||
|
||||
@ -1360,11 +1392,9 @@ static COUNT extend_dir(struct f_node FAR * fnp)
|
||||
/* clear out the rest of the blocks in the cluster */
|
||||
for (idx = 0; idx < (fnp->f_dpb->dpb_clsmask + 1); idx++)
|
||||
{
|
||||
REG COUNT i;
|
||||
REG BYTE FAR *p;
|
||||
REG struct buffer FAR *bp;
|
||||
|
||||
bp = getblock((ULONG) clus2phys(fnp->f_cluster,
|
||||
bp = getblockOver((ULONG) clus2phys(fnp->f_cluster,
|
||||
(fnp->f_dpb->dpb_clsmask + 1),
|
||||
fnp->f_dpb->dpb_data) + idx,
|
||||
fnp->f_dpb->dpb_unit);
|
||||
@ -1376,9 +1406,11 @@ static COUNT extend_dir(struct f_node FAR * fnp)
|
||||
dir_close(fnp);
|
||||
return DE_BLKINVLD;
|
||||
}
|
||||
for (i = 0, p = (BYTE FAR *) bp->b_buffer; i < BUFFERSIZE; i++)
|
||||
*p++ = NULL;
|
||||
bp->b_flag |= BFR_DIRTY;
|
||||
fmemset(bp->b_buffer,0, BUFFERSIZE);
|
||||
bp->b_flag |= BFR_DIRTY | BFR_VALID;
|
||||
|
||||
if (idx != 0)
|
||||
bp->b_flag |= BFR_UNCACHE; /* needs not be cached */
|
||||
}
|
||||
|
||||
if (!find_free(fnp))
|
||||
@ -1395,7 +1427,7 @@ static COUNT extend_dir(struct f_node FAR * fnp)
|
||||
}
|
||||
|
||||
/* JPP: finds the next free cluster in the FAT */
|
||||
static BOOL first_fat(struct f_node FAR * fnp)
|
||||
STATIC BOOL first_fat(f_node_ptr fnp)
|
||||
{
|
||||
UWORD free_fat;
|
||||
|
||||
@ -1424,10 +1456,10 @@ static BOOL first_fat(struct f_node FAR * fnp)
|
||||
/* JPP: new map_cluster. If we are moving forward, then use the offset
|
||||
that we are at now (f_cluster_offset) to start, instead of starting
|
||||
at the beginning. */
|
||||
COUNT map_cluster(REG struct f_node FAR * fnp, COUNT mode)
|
||||
COUNT map_cluster(REG f_node_ptr fnp, COUNT mode)
|
||||
{
|
||||
ULONG idx;
|
||||
UWORD clssize;
|
||||
ULONG clssize; /* might be 64K (by WinNT) TE */
|
||||
|
||||
#ifdef DISPLAY_GETBLOCK
|
||||
printf("map_cluster: current %lu, offset %lu, diff=%lu ",
|
||||
@ -1435,7 +1467,7 @@ COUNT map_cluster(REG struct f_node FAR * fnp, COUNT mode)
|
||||
fnp->f_offset - fnp->f_cluster_offset);
|
||||
#endif
|
||||
/* The variable clssize will be used later. */
|
||||
clssize = fnp->f_dpb->dpb_secsize * (fnp->f_dpb->dpb_clsmask + 1);
|
||||
clssize = (ULONG)fnp->f_dpb->dpb_secsize * (fnp->f_dpb->dpb_clsmask + 1);
|
||||
|
||||
/* If someone did a seek, but no writes have occured, we will */
|
||||
/* need to initialize the fnode. */
|
||||
@ -1504,7 +1536,7 @@ COUNT map_cluster(REG struct f_node FAR * fnp, COUNT mode)
|
||||
/* Read block from disk */
|
||||
UCOUNT readblock(COUNT fd, VOID FAR * buffer, UCOUNT count, COUNT * err)
|
||||
{
|
||||
REG struct f_node FAR *fnp;
|
||||
REG f_node_ptr fnp;
|
||||
REG struct buffer FAR *bp;
|
||||
UCOUNT xfr_cnt = 0;
|
||||
UCOUNT ret_cnt = 0;
|
||||
@ -1525,7 +1557,7 @@ UCOUNT readblock(COUNT fd, VOID FAR * buffer, UCOUNT count, COUNT * err)
|
||||
/* If the fd was invalid because it was out of range or the */
|
||||
/* requested file was not open, tell the caller and exit */
|
||||
/* note: an invalid fd is indicated by a 0 return */
|
||||
if (fnp == (struct f_node FAR *)0 || fnp->f_count <= 0)
|
||||
if (fnp == (f_node_ptr)0 || fnp->f_count <= 0)
|
||||
{
|
||||
*err = DE_INVLDHNDL;
|
||||
return 0;
|
||||
@ -1650,7 +1682,7 @@ UCOUNT readblock(COUNT fd, VOID FAR * buffer, UCOUNT count, COUNT * err)
|
||||
#ifdef DISPLAY_GETBLOCK
|
||||
printf("DATA (readblock)\n");
|
||||
#endif
|
||||
if (bp == (struct buffer *)0)
|
||||
if (bp == NULL) /* (struct buffer *)0 --> DS:0 !! */
|
||||
{
|
||||
*err = DE_BLKINVLD;
|
||||
return ret_cnt;
|
||||
@ -1669,6 +1701,15 @@ UCOUNT readblock(COUNT fd, VOID FAR * buffer, UCOUNT count, COUNT * err)
|
||||
|
||||
fbcopy((BYTE FAR *) & bp->b_buffer[fnp->f_boff], buffer, xfr_cnt);
|
||||
|
||||
/* complete buffer read ?
|
||||
probably not reused later
|
||||
*/
|
||||
if (xfr_cnt == sizeof(bp->b_buffer) ||
|
||||
fnp->f_offset + xfr_cnt == fnp->f_dir.dir_size )
|
||||
{
|
||||
bp->b_flag |= BFR_UNCACHE;
|
||||
}
|
||||
|
||||
/* update pointers and counters */
|
||||
ret_cnt += xfr_cnt;
|
||||
to_xfer -= xfr_cnt;
|
||||
@ -1682,7 +1723,7 @@ UCOUNT readblock(COUNT fd, VOID FAR * buffer, UCOUNT count, COUNT * err)
|
||||
/* Write block to disk */
|
||||
UCOUNT writeblock(COUNT fd, VOID FAR * buffer, UCOUNT count, COUNT * err)
|
||||
{
|
||||
REG struct f_node FAR *fnp;
|
||||
REG f_node_ptr fnp;
|
||||
struct buffer FAR *bp;
|
||||
UCOUNT xfr_cnt = 0;
|
||||
UCOUNT ret_cnt = 0;
|
||||
@ -1703,7 +1744,7 @@ UCOUNT writeblock(COUNT fd, VOID FAR * buffer, UCOUNT count, COUNT * err)
|
||||
/* If the fd was invalid because it was out of range or the */
|
||||
/* requested file was not open, tell the caller and exit */
|
||||
/* note: an invalid fd is indicated by a 0 return */
|
||||
if (fnp == (struct f_node FAR *)0 || fnp->f_count <= 0)
|
||||
if (fnp == (f_node_ptr)0 || fnp->f_count <= 0)
|
||||
{
|
||||
*err = DE_INVLDHNDL;
|
||||
return 0;
|
||||
@ -1872,19 +1913,22 @@ UCOUNT writeblock(COUNT fd, VOID FAR * buffer, UCOUNT count, COUNT * err)
|
||||
potential problems.
|
||||
- Ron Cemer */
|
||||
if ( (fnp->f_boff == 0) && (xfr_cnt == secsize) ) {
|
||||
if (!getbuf(&bp, (ULONG) clus2phys(fnp->f_cluster,
|
||||
bp = getblockOver((ULONG) clus2phys(fnp->f_cluster,
|
||||
(fnp->f_dpb->dpb_clsmask + 1),
|
||||
fnp->f_dpb->dpb_data) + fnp->f_sector,
|
||||
fnp->f_dpb->dpb_unit)) {
|
||||
*err = DE_BLKINVLD;
|
||||
return ret_cnt;
|
||||
}
|
||||
fnp->f_dpb->dpb_unit);
|
||||
|
||||
} else {
|
||||
bp = getblock((ULONG) clus2phys(fnp->f_cluster,
|
||||
(fnp->f_dpb->dpb_clsmask + 1),
|
||||
fnp->f_dpb->dpb_data) + fnp->f_sector,
|
||||
fnp->f_dpb->dpb_unit);
|
||||
}
|
||||
if (bp == NULL) {
|
||||
*err = DE_BLKINVLD;
|
||||
return ret_cnt;
|
||||
}
|
||||
|
||||
|
||||
/* transfer a block */
|
||||
/* Transfer size as either a full block size, or the */
|
||||
@ -1899,6 +1943,12 @@ UCOUNT writeblock(COUNT fd, VOID FAR * buffer, UCOUNT count, COUNT * err)
|
||||
fbcopy(buffer, (BYTE FAR *) & bp->b_buffer[fnp->f_boff], xfr_cnt);
|
||||
bp->b_flag |= BFR_DIRTY | BFR_VALID;
|
||||
|
||||
if (xfr_cnt == sizeof(bp->b_buffer)) /* probably not used later */
|
||||
{
|
||||
bp->b_flag |= BFR_UNCACHE;
|
||||
}
|
||||
|
||||
|
||||
fnp->f_flags.f_dmod = TRUE; /* mark file as modified */
|
||||
|
||||
|
||||
@ -1930,7 +1980,7 @@ COUNT dos_read(COUNT fd, VOID FAR * buffer, UCOUNT count)
|
||||
#ifndef IPL
|
||||
COUNT dos_write(COUNT fd, VOID FAR * buffer, UCOUNT count)
|
||||
{
|
||||
REG struct f_node FAR *fnp;
|
||||
REG f_node_ptr fnp;
|
||||
COUNT err,
|
||||
xfr;
|
||||
|
||||
@ -1943,7 +1993,7 @@ COUNT dos_write(COUNT fd, VOID FAR * buffer, UCOUNT count)
|
||||
/* If the fd was invalid because it was out of range or the */
|
||||
/* requested file was not open, tell the caller and exit */
|
||||
/* note: an invalid fd is indicated by a 0 return */
|
||||
if (fnp == (struct f_node FAR *)0 || fnp->f_count <= 0)
|
||||
if (fnp == (f_node_ptr)0 || fnp->f_count <= 0)
|
||||
{
|
||||
return DE_INVLDHNDL;
|
||||
}
|
||||
@ -1975,7 +2025,7 @@ COUNT dos_write(COUNT fd, VOID FAR * buffer, UCOUNT count)
|
||||
/* Returns a long current offset or a negative error code */
|
||||
LONG dos_lseek(COUNT fd, LONG foffset, COUNT origin)
|
||||
{
|
||||
REG struct f_node FAR *fnp;
|
||||
REG f_node_ptr fnp;
|
||||
|
||||
/* Translate the fd into a useful pointer */
|
||||
|
||||
@ -1985,7 +2035,7 @@ LONG dos_lseek(COUNT fd, LONG foffset, COUNT origin)
|
||||
/* requested file was not open, tell the caller and exit */
|
||||
/* note: an invalid fd is indicated by a 0 return */
|
||||
|
||||
if (fnp == (struct f_node FAR *)0 || fnp->f_count <= 0)
|
||||
if (fnp == (f_node_ptr)0 || fnp->f_count <= 0)
|
||||
return (LONG) DE_INVLDHNDL;
|
||||
|
||||
/* now do the actual lseek adjustment to the file poitner */
|
||||
@ -2043,7 +2093,7 @@ UWORD dos_free(struct dpb FAR *dpbp)
|
||||
#ifndef IPL
|
||||
COUNT dos_cd(struct cds FAR * cdsp, BYTE FAR *PathName)
|
||||
{
|
||||
struct f_node FAR *fnp;
|
||||
f_node_ptr fnp;
|
||||
|
||||
/* first check for valid drive */
|
||||
if (cdsp->cdsDpb == 0)
|
||||
@ -2060,14 +2110,14 @@ COUNT dos_cd(struct cds FAR * cdsp, BYTE FAR *PathName)
|
||||
|
||||
cdsp->cdsStrtClst = fnp->f_dirstart;
|
||||
dir_close(fnp);
|
||||
fscopy(&PathName[0], cdsp->cdsCurrentPath);
|
||||
fstrncpy(cdsp->cdsCurrentPath,&PathName[0],sizeof(cdsp->cdsCurrentPath)-1);
|
||||
return SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Try to allocate an f_node from the available files array */
|
||||
|
||||
struct f_node FAR *get_f_node(void)
|
||||
f_node_ptr get_f_node(void)
|
||||
{
|
||||
REG i;
|
||||
|
||||
@ -2079,10 +2129,10 @@ struct f_node FAR *get_f_node(void)
|
||||
return &f_nodes[i];
|
||||
}
|
||||
}
|
||||
return (struct f_node FAR *)0;
|
||||
return (f_node_ptr)0;
|
||||
}
|
||||
|
||||
VOID release_f_node(struct f_node FAR * fnp)
|
||||
VOID release_f_node(f_node_ptr fnp)
|
||||
{
|
||||
if (fnp->f_count > 0)
|
||||
--fnp->f_count;
|
||||
@ -2098,7 +2148,7 @@ VOID dos_setdta(BYTE FAR * newdta)
|
||||
|
||||
COUNT dos_getfattr(BYTE FAR * name, UWORD FAR * attrp)
|
||||
{
|
||||
struct f_node FAR *fnp;
|
||||
f_node_ptr fnp;
|
||||
COUNT fd;
|
||||
|
||||
/* Translate the fd into an fnode pointer, since all internal */
|
||||
@ -2107,7 +2157,7 @@ COUNT dos_getfattr(BYTE FAR * name, UWORD FAR * attrp)
|
||||
return DE_FILENOTFND;
|
||||
|
||||
/* note: an invalid fd is indicated by a 0 return */
|
||||
if ((fnp = xlt_fd(fd)) == (struct f_node FAR *)0)
|
||||
if ((fnp = xlt_fd(fd)) == (f_node_ptr)0)
|
||||
return DE_TOOMANY;
|
||||
|
||||
/* If the fd was invalid because it was out of range or the */
|
||||
@ -2126,7 +2176,7 @@ COUNT dos_getfattr(BYTE FAR * name, UWORD FAR * attrp)
|
||||
|
||||
COUNT dos_setfattr(BYTE FAR * name, UWORD FAR * attrp)
|
||||
{
|
||||
struct f_node FAR *fnp;
|
||||
f_node_ptr fnp;
|
||||
COUNT fd;
|
||||
|
||||
/* Translate the fd into an fnode pointer, since all internal */
|
||||
@ -2135,7 +2185,7 @@ COUNT dos_setfattr(BYTE FAR * name, UWORD FAR * attrp)
|
||||
return DE_FILENOTFND;
|
||||
|
||||
/* note: an invalid fd is indicated by a 0 return */
|
||||
if ((fnp = xlt_fd(fd)) == (struct f_node FAR *)0)
|
||||
if ((fnp = xlt_fd(fd)) == (f_node_ptr)0)
|
||||
return DE_TOOMANY;
|
||||
|
||||
/* If the fd was invalid because it was out of range or the */
|
||||
@ -2292,13 +2342,13 @@ COUNT media_check(REG struct dpb FAR * dpbp)
|
||||
}
|
||||
|
||||
/* translate the fd into an f_node pointer */
|
||||
struct f_node FAR *xlt_fd(COUNT fd)
|
||||
f_node_ptr xlt_fd(COUNT fd)
|
||||
{
|
||||
return fd >= f_nodes_cnt ? (struct f_node FAR *)0 : &f_nodes[fd];
|
||||
return fd >= f_nodes_cnt ? (f_node_ptr)0 : &f_nodes[fd];
|
||||
}
|
||||
|
||||
/* translate the f_node pointer into an fd */
|
||||
COUNT xlt_fnp(struct f_node FAR * fnp)
|
||||
COUNT xlt_fnp(f_node_ptr fnp)
|
||||
{
|
||||
return (COUNT)(fnp - f_nodes);
|
||||
}
|
||||
|
125
kernel/fattab.c
125
kernel/fattab.c
@ -35,6 +35,9 @@ static BYTE *RcsId = "$Id$";
|
||||
|
||||
/*
|
||||
* $Log$
|
||||
* Revision 1.6 2001/06/03 14:16:17 bartoldeman
|
||||
* BUFFERS tuning and misc bug fixes/cleanups (2024c).
|
||||
*
|
||||
* Revision 1.5 2001/04/21 22:32:53 bartoldeman
|
||||
* Init DS=Init CS, fixed stack overflow problems and misc bugs.
|
||||
*
|
||||
@ -122,6 +125,33 @@ UWORD next_cl16();
|
||||
/* */
|
||||
/************************************************************************/
|
||||
|
||||
struct buffer FAR *getFATblock(UWORD cluster, struct dpb FAR *dpbp)
|
||||
{
|
||||
ULONG sector;
|
||||
struct buffer FAR *bp;
|
||||
|
||||
if (ISFAT12(dpbp))
|
||||
{
|
||||
sector = ((cluster << 1) + cluster) >> 1;
|
||||
}
|
||||
else /* FAT16 */
|
||||
{
|
||||
sector = (ULONG)cluster * SIZEOF_CLST16;
|
||||
}
|
||||
sector = sector / dpbp->dpb_secsize + dpbp->dpb_fatstrt;
|
||||
|
||||
bp = getblock(sector, dpbp->dpb_unit);
|
||||
|
||||
if (bp)
|
||||
{
|
||||
bp->b_flag &= ~(BFR_DATA | BFR_DIR);
|
||||
bp->b_flag |= BFR_FAT | BFR_VALID;
|
||||
bp->b_copies = dpbp->dpb_fats;
|
||||
bp->b_offset_lo = dpbp->dpb_fatsize;
|
||||
bp->b_offset_hi = dpbp->dpb_fatsize >> 8;
|
||||
}
|
||||
return bp;
|
||||
}
|
||||
/* */
|
||||
/* The FAT file system is difficult to trace through FAT table. */
|
||||
/* There are two kinds of FAT's, 12 bit and 16 bit. The 16 bit */
|
||||
@ -152,30 +182,21 @@ UCOUNT link_fat16(struct dpb FAR *dpbp, UCOUNT Cluster1, UCOUNT Cluster2)
|
||||
{
|
||||
UCOUNT idx;
|
||||
struct buffer FAR *bp;
|
||||
UWORD Cl2 = Cluster2;
|
||||
|
||||
/* Get the block that this cluster is in */
|
||||
bp = getblock((ULONG) (((ULONG) Cluster1) * SIZEOF_CLST16) / dpbp->dpb_secsize + dpbp->dpb_fatstrt,
|
||||
dpbp->dpb_unit);
|
||||
#ifdef DISPLAY_GETBLOCK
|
||||
printf("FAT (link_fat16)\n");
|
||||
#endif
|
||||
bp = getFATblock( Cluster1, dpbp);
|
||||
|
||||
if (bp == NULL)
|
||||
return DE_BLKINVLD;
|
||||
bp->b_flag &= ~(BFR_DATA | BFR_DIR);
|
||||
bp->b_flag |= BFR_FAT;
|
||||
bp->b_copies = dpbp->dpb_fats;
|
||||
bp->b_offset_lo = dpbp->dpb_fatsize;
|
||||
bp->b_offset_hi = dpbp->dpb_fatsize >> 8;
|
||||
|
||||
/* form an index so that we can read the block as a */
|
||||
/* byte array */
|
||||
idx = (UWORD)((((LONG) Cluster1) * SIZEOF_CLST16) % dpbp->dpb_secsize);
|
||||
idx = (UWORD)(( Cluster1 * SIZEOF_CLST16) % dpbp->dpb_secsize);
|
||||
|
||||
/* Finally, put the word into the buffer and mark the */
|
||||
/* buffer as dirty. */
|
||||
fputword((WORD FAR *) & Cl2, (VOID FAR *) & (bp->b_buffer[idx]));
|
||||
bp->b_flag |= BFR_DIRTY;
|
||||
fputword((WORD FAR *) & Cluster2, (VOID FAR *) & (bp->b_buffer[idx]));
|
||||
bp->b_flag |= BFR_DIRTY | BFR_VALID;
|
||||
|
||||
/* Return successful. */
|
||||
/* update the free space count */
|
||||
@ -206,18 +227,9 @@ UCOUNT link_fat12(struct dpb FAR *dpbp, UCOUNT Cluster1, UCOUNT Cluster2)
|
||||
FAR * bp1;
|
||||
|
||||
/* Get the block that this cluster is in */
|
||||
bp = getblock((ULONG) ((((Cluster1 << 1) + Cluster1) >> 1) / dpbp->dpb_secsize + dpbp->dpb_fatstrt),
|
||||
dpbp->dpb_unit);
|
||||
#ifdef DISPLAY_GETBLOCK
|
||||
printf("FAT (link_fat12)\n");
|
||||
#endif
|
||||
bp = getFATblock(Cluster1 , dpbp);
|
||||
if (bp == NULL)
|
||||
return DE_BLKINVLD;
|
||||
bp->b_flag &= ~(BFR_DATA | BFR_DIR);
|
||||
bp->b_flag |= BFR_FAT;
|
||||
bp->b_copies = dpbp->dpb_fats;
|
||||
bp->b_offset_lo = dpbp->dpb_fatsize;
|
||||
bp->b_offset_hi = dpbp->dpb_fatsize >> 8;
|
||||
|
||||
/* form an index so that we can read the block as a */
|
||||
/* byte array */
|
||||
@ -229,26 +241,18 @@ UCOUNT link_fat12(struct dpb FAR *dpbp, UCOUNT Cluster1, UCOUNT Cluster2)
|
||||
/* block. */
|
||||
if (idx >= dpbp->dpb_secsize - 1)
|
||||
{
|
||||
bp1 = getblock((ULONG) (dpbp->dpb_fatstrt +
|
||||
((((Cluster1 << 1) + Cluster1) >> 1) / dpbp->dpb_secsize))
|
||||
+ 1,
|
||||
dpbp->dpb_unit);
|
||||
#ifdef DISPLAY_GETBLOCK
|
||||
printf("FAT (link_fat12)\n");
|
||||
#endif
|
||||
if (bp1 == (struct buffer *)0)
|
||||
bp1 = getFATblock(Cluster1 + 1,dpbp);
|
||||
if (bp1 == 0)
|
||||
return DE_BLKINVLD;
|
||||
bp1->b_flag &= ~(BFR_DATA | BFR_DIR);
|
||||
bp1->b_flag |= BFR_FAT | BFR_DIRTY;
|
||||
bp1->b_copies = dpbp->dpb_fats;
|
||||
bp1->b_offset_lo = dpbp->dpb_fatsize;
|
||||
bp1->b_offset_hi = dpbp->dpb_fatsize >> 8;
|
||||
|
||||
bp1->b_flag |= BFR_DIRTY | BFR_VALID;
|
||||
|
||||
fbp1 = (UBYTE FAR *) & (bp1->b_buffer[0]);
|
||||
}
|
||||
else
|
||||
fbp1 = (UBYTE FAR *) & (bp->b_buffer[idx + 1]);
|
||||
fbp0 = (UBYTE FAR *) & (bp->b_buffer[idx]);
|
||||
bp->b_flag |= BFR_DIRTY;
|
||||
bp->b_flag |= BFR_DIRTY | BFR_VALID;
|
||||
|
||||
/* Now pack the value in */
|
||||
if (Cluster1 & 0x01)
|
||||
@ -298,20 +302,10 @@ UWORD next_cl16(struct dpb FAR *dpbp, UCOUNT ClusterNum)
|
||||
struct buffer FAR *bp;
|
||||
|
||||
/* Get the block that this cluster is in */
|
||||
bp = getblock((ULONG) (((ULONG) ClusterNum) * SIZEOF_CLST16) / dpbp->dpb_secsize + dpbp->dpb_fatstrt,
|
||||
dpbp->dpb_unit);
|
||||
#ifdef DISPLAY_GETBLOCK
|
||||
printf("FAT (next_cl16)\n");
|
||||
#endif
|
||||
bp = getFATblock( ClusterNum, dpbp);
|
||||
|
||||
if (bp == NULL)
|
||||
return DE_BLKINVLD;
|
||||
bp->b_flag &= ~(BFR_DATA | BFR_DIR);
|
||||
bp->b_flag |= BFR_FAT;
|
||||
bp->b_copies = dpbp->dpb_fats;
|
||||
bp->b_offset_lo = dpbp->dpb_fatsize;
|
||||
bp->b_offset_hi = dpbp->dpb_fatsize >> 8;
|
||||
|
||||
|
||||
|
||||
#ifndef I86
|
||||
UCOUNT idx;
|
||||
@ -330,7 +324,7 @@ UWORD next_cl16(struct dpb FAR *dpbp, UCOUNT ClusterNum)
|
||||
#else
|
||||
/* this saves 2 WORDS of stack :-) */
|
||||
|
||||
return *(WORD FAR *)&(bp->b_buffer[(ClusterNum * SIZEOF_CLST16) % dpbp->dpb_secsize]);
|
||||
return *(UWORD FAR *)&(bp->b_buffer[(ClusterNum * SIZEOF_CLST16) % dpbp->dpb_secsize]);
|
||||
|
||||
#endif
|
||||
|
||||
@ -345,18 +339,10 @@ UWORD next_cl12(struct dpb FAR *dpbp, REG UCOUNT ClusterNum)
|
||||
FAR * bp1;
|
||||
|
||||
/* Get the block that this cluster is in */
|
||||
bp = getblock((ULONG) ((((ClusterNum << 1) + ClusterNum) >> 1) / dpbp->dpb_secsize + dpbp->dpb_fatstrt),
|
||||
dpbp->dpb_unit);
|
||||
#ifdef DISPLAY_GETBLOCK
|
||||
printf("FAT (next_cl12)\n");
|
||||
#endif
|
||||
bp = getFATblock(ClusterNum , dpbp);
|
||||
|
||||
if (bp == NULL)
|
||||
return LONG_BAD;
|
||||
bp->b_flag &= ~(BFR_DATA | BFR_DIR);
|
||||
bp->b_flag |= BFR_FAT;
|
||||
bp->b_copies = dpbp->dpb_fats;
|
||||
bp->b_offset_lo = dpbp->dpb_fatsize;
|
||||
bp->b_offset_hi = dpbp->dpb_fatsize >> 8;
|
||||
|
||||
/* form an index so that we can read the block as a */
|
||||
/* byte array */
|
||||
@ -368,20 +354,11 @@ UWORD next_cl12(struct dpb FAR *dpbp, REG UCOUNT ClusterNum)
|
||||
/* block. */
|
||||
if (idx >= dpbp->dpb_secsize - 1)
|
||||
{
|
||||
bp1 = getblock((ULONG) (dpbp->dpb_fatstrt +
|
||||
((((ClusterNum << 1) + ClusterNum) >> 1) / dpbp->dpb_secsize))
|
||||
+ 1,
|
||||
dpbp->dpb_unit);
|
||||
#ifdef DISPLAY_GETBLOCK
|
||||
printf("FAT (next_cl12)\n");
|
||||
#endif
|
||||
if (bp1 == (struct buffer *)0)
|
||||
bp1 = getFATblock(ClusterNum +1, dpbp);
|
||||
|
||||
if (bp1 == 0)
|
||||
return LONG_BAD;
|
||||
bp1->b_flag &= ~(BFR_DATA | BFR_DIR);
|
||||
bp1->b_flag |= BFR_FAT;
|
||||
bp1->b_copies = dpbp->dpb_fats;
|
||||
bp1->b_offset_lo = dpbp->dpb_fatsize;
|
||||
bp1->b_offset_hi = dpbp->dpb_fatsize >> 8;
|
||||
|
||||
fbp1 = (UBYTE FAR *) & (bp1->b_buffer[0]);
|
||||
}
|
||||
else
|
||||
|
@ -35,6 +35,9 @@ static BYTE *RcsId = "$Id$";
|
||||
|
||||
/*
|
||||
* $Log$
|
||||
* Revision 1.11 2001/06/03 14:16:17 bartoldeman
|
||||
* BUFFERS tuning and misc bug fixes/cleanups (2024c).
|
||||
*
|
||||
* Revision 1.10 2001/04/21 22:32:53 bartoldeman
|
||||
* Init DS=Init CS, fixed stack overflow problems and misc bugs.
|
||||
*
|
||||
@ -157,32 +160,42 @@ VOID MoveDirInfo();
|
||||
|
||||
static dmatch Dmatch;
|
||||
|
||||
VOID FatGetDrvData(COUNT drive, COUNT FAR * spc, COUNT FAR * bps,
|
||||
VOID FatGetDrvData(UCOUNT drive, COUNT FAR * spc, COUNT FAR * bps,
|
||||
COUNT FAR * nc, BYTE FAR ** mdp)
|
||||
{
|
||||
struct dpb FAR *dpbp;
|
||||
struct cds FAR *cdsp;
|
||||
|
||||
printf("FGDD\n");
|
||||
/* first check for valid drive */
|
||||
*spc = -1;
|
||||
|
||||
drive = (drive == 0 ? default_drive : drive - 1);
|
||||
|
||||
/* first check for valid drive */
|
||||
if ((UCOUNT)drive >= lastdrive)
|
||||
{
|
||||
*spc = -1;
|
||||
return;
|
||||
}
|
||||
if (drive >= lastdrive)
|
||||
return;
|
||||
|
||||
cdsp = &CDSp->cds_table[drive];
|
||||
|
||||
if (!(cdsp->cdsFlags & CDSVALID))
|
||||
return;
|
||||
|
||||
/* next - "log" in the drive */
|
||||
drive = (drive == 0 ? default_drive : drive - 1);
|
||||
if (CDSp->cds_table[drive].cdsFlags & CDSNETWDRV) {
|
||||
printf("FatGetDrvData not yet supported over network drives\n");
|
||||
*spc = -1;
|
||||
if (cdsp->cdsFlags & CDSNETWDRV) {
|
||||
/* Undoc DOS says, its not supported for
|
||||
network drives. so it's probably OK */
|
||||
/*printf("FatGetDrvData not yet supported over network drives\n");*/
|
||||
return;
|
||||
}
|
||||
dpbp = CDSp->cds_table[drive].cdsDpb;
|
||||
|
||||
if (dpbp == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
dpbp->dpb_flags = -1;
|
||||
if ((media_check(dpbp) < 0))
|
||||
{
|
||||
*spc = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -36,6 +36,9 @@ static BYTE *Globals_hRcsId = "$Id$";
|
||||
|
||||
/*
|
||||
* $Log$
|
||||
* Revision 1.13 2001/06/03 14:16:17 bartoldeman
|
||||
* BUFFERS tuning and misc bug fixes/cleanups (2024c).
|
||||
*
|
||||
* Revision 1.12 2001/04/21 22:32:53 bartoldeman
|
||||
* Init DS=Init CS, fixed stack overflow problems and misc bugs.
|
||||
*
|
||||
@ -557,16 +560,20 @@ extern struct cds
|
||||
GLOBAL seg
|
||||
RootPsp; /* Root process -- do not abort */
|
||||
|
||||
/* don't know what it should do, but its no longer in use TE
|
||||
GLOBAL struct f_node
|
||||
*pDirFileNode;
|
||||
*/
|
||||
|
||||
#ifdef DEBUG
|
||||
GLOBAL iregs error_regs; /* registers for dump */
|
||||
|
||||
GLOBAL WORD
|
||||
dump_regs; /* dump registers of bad call */
|
||||
|
||||
GLOBAL struct f_node FAR
|
||||
* f_nodes; /* pointer to the array */
|
||||
#endif
|
||||
|
||||
GLOBAL f_node_ptr f_nodes; /* pointer to the array */
|
||||
|
||||
GLOBAL UWORD f_nodes_cnt; /* number of allocated f_nodes */
|
||||
|
||||
@ -574,8 +581,8 @@ GLOBAL struct buffer
|
||||
FAR *lastbuf; /* tail of ditto */
|
||||
/* FAR * buffers; /* pointer to array of track buffers */
|
||||
|
||||
GLOBAL BYTE /* scratchpad used for working around */
|
||||
FAR * dma_scratch; /* DMA transfers during disk I/O */
|
||||
/*GLOBAL BYTE FAR * dma_scratch;*/ /* scratchpad used for working around */
|
||||
/* DMA transfers during disk I/O */
|
||||
|
||||
GLOBAL iregs
|
||||
FAR * ustackp, /* user stack */
|
||||
|
@ -152,6 +152,7 @@ int close(int fd);
|
||||
int dup2(int oldfd, int newfd);
|
||||
int allocmem(UWORD size, seg *segp);
|
||||
INIT VOID init_PSPInit(seg psp_seg);
|
||||
INIT VOID init_PSPSet(seg psp_seg);
|
||||
INIT COUNT init_DosExec(COUNT mode, exec_blk * ep, BYTE * lp);
|
||||
INIT VOID keycheck(VOID);
|
||||
|
||||
|
@ -37,6 +37,9 @@ BYTE *RcsId = "$Id$";
|
||||
|
||||
/*
|
||||
* $Log$
|
||||
* Revision 1.24 2001/06/03 14:16:18 bartoldeman
|
||||
* BUFFERS tuning and misc bug fixes/cleanups (2024c).
|
||||
*
|
||||
* Revision 1.23 2001/04/29 17:34:40 bartoldeman
|
||||
* A new SYS.COM/config.sys single stepping/console output/misc fixes.
|
||||
*
|
||||
@ -486,7 +489,7 @@ dispatch:
|
||||
case 0x0a:
|
||||
((keyboard FAR *) FP_DS_DX)->kb_count = 0;
|
||||
sti((keyboard FAR *) FP_DS_DX);
|
||||
((keyboard FAR *) FP_DS_DX)->kb_count -= 2;
|
||||
((keyboard FAR *) FP_DS_DX)->kb_count--;
|
||||
break;
|
||||
|
||||
/* Check Stdin Status */
|
||||
|
@ -90,12 +90,6 @@ intr?1:
|
||||
ret
|
||||
|
||||
|
||||
global _int3
|
||||
_int3:
|
||||
int 3
|
||||
retf
|
||||
|
||||
|
||||
segment INIT_TEXT
|
||||
;
|
||||
; void init_call_intr(nr, rp)
|
||||
@ -266,6 +260,15 @@ _init_PSPInit:
|
||||
pop si
|
||||
ret
|
||||
|
||||
;; VOID init_PSPSet(seg psp_seg)
|
||||
global _init_PSPSet
|
||||
_init_PSPSet:
|
||||
mov ah, 50h
|
||||
mov bx, sp
|
||||
mov bx, [bx+2]
|
||||
int 21h
|
||||
ret
|
||||
|
||||
;; COUNT init_DosExec(COUNT mode, exec_blk * ep, BYTE * lp)
|
||||
global _init_DosExec
|
||||
_init_DosExec:
|
||||
|
@ -7,4 +7,3 @@ struct REGPACK {
|
||||
};
|
||||
|
||||
extern void intr(int intrnr, struct REGPACK *rp);
|
||||
extern void FAR int3();
|
||||
|
@ -35,6 +35,9 @@ static BYTE *RcsId = "$Id$";
|
||||
|
||||
/*
|
||||
* $Log$
|
||||
* Revision 1.9 2001/06/03 14:16:18 bartoldeman
|
||||
* BUFFERS tuning and misc bug fixes/cleanups (2024c).
|
||||
*
|
||||
* Revision 1.8 2001/04/15 03:21:50 bartoldeman
|
||||
* See history.txt for the list of fixes.
|
||||
*
|
||||
@ -110,11 +113,6 @@ static BYTE *RcsId = "$Id$";
|
||||
* Initial revision.
|
||||
*/
|
||||
|
||||
#ifdef PROTO
|
||||
sft FAR *get_sft(COUNT);
|
||||
#else
|
||||
sft FAR *get_sft();
|
||||
#endif
|
||||
|
||||
/*
|
||||
* WARNING: this code is non-portable (8086 specific).
|
||||
@ -243,12 +241,12 @@ COUNT DosDevIOctl(iregs FAR * r)
|
||||
r->AL = CharReqHdr.r_status & S_BUSY ? 00 : 0xff;
|
||||
|
||||
}
|
||||
if (r->AL == 0x02 || r->AL == 0x03)
|
||||
else if (r->AL == 0x02 || r->AL == 0x03)
|
||||
{
|
||||
r->AX = CharReqHdr.r_count;
|
||||
}
|
||||
|
||||
if (r->AL == 0x0c || r->AL == 0x10)
|
||||
else if (r->AL == 0x0c || r->AL == 0x10)
|
||||
{
|
||||
r->AX = CharReqHdr.r_status;
|
||||
}
|
||||
@ -300,12 +298,12 @@ COUNT DosDevIOctl(iregs FAR * r)
|
||||
|
||||
}
|
||||
|
||||
if (r->AL == 0x04 || r->AL == 0x05)
|
||||
else if (r->AL == 0x04 || r->AL == 0x05)
|
||||
{
|
||||
r->AX = CharReqHdr.r_count;
|
||||
|
||||
}
|
||||
if (r->AL == 0x0d || r->AL == 0x11)
|
||||
else if (r->AL == 0x0d || r->AL == 0x11)
|
||||
{
|
||||
r->AX = CharReqHdr.r_status;
|
||||
}
|
||||
|
@ -28,6 +28,9 @@
|
||||
; $Id$
|
||||
;
|
||||
; $Log$
|
||||
; Revision 1.13 2001/06/03 14:16:18 bartoldeman
|
||||
; BUFFERS tuning and misc bug fixes/cleanups (2024c).
|
||||
;
|
||||
; Revision 1.12 2001/04/29 17:34:40 bartoldeman
|
||||
; A new SYS.COM/config.sys single stepping/console output/misc fixes.
|
||||
;
|
||||
@ -625,7 +628,7 @@ __ib_end:
|
||||
|
||||
; kernel startup stack
|
||||
global init_tos
|
||||
resw 256
|
||||
resw 384
|
||||
init_tos:
|
||||
; the last paragraph of conventional memory might become an MCB
|
||||
resb 16
|
||||
@ -915,8 +918,10 @@ __EnableA20:
|
||||
|
||||
enableUsingXMSdriver:
|
||||
mov ah,3
|
||||
UsingXMSdriver:
|
||||
UsingXMSdriver:
|
||||
push bx
|
||||
call far [cs:_XMSDriverAddress]
|
||||
pop bx
|
||||
retf
|
||||
|
||||
global __DisableA20
|
||||
|
@ -71,6 +71,9 @@ static BYTE *mainRcsId = "$Id$";
|
||||
|
||||
/*
|
||||
* $Log$
|
||||
* Revision 1.17 2001/06/03 14:16:18 bartoldeman
|
||||
* BUFFERS tuning and misc bug fixes/cleanups (2024c).
|
||||
*
|
||||
* Revision 1.16 2001/04/29 17:34:40 bartoldeman
|
||||
* A new SYS.COM/config.sys single stepping/console output/misc fixes.
|
||||
*
|
||||
@ -300,6 +303,7 @@ INIT void init_kernel(void)
|
||||
setvec(0x2f, int2f_handler);
|
||||
#endif
|
||||
|
||||
init_PSPSet(DOS_PSP);
|
||||
init_PSPInit(DOS_PSP);
|
||||
|
||||
/* Do first initialization of system variable buffers so that */
|
||||
|
20
kernel/nls.c
20
kernel/nls.c
@ -44,6 +44,9 @@ static BYTE *RcsId = "$Id$";
|
||||
|
||||
/*
|
||||
* $Log$
|
||||
* Revision 1.7 2001/06/03 14:16:18 bartoldeman
|
||||
* BUFFERS tuning and misc bug fixes/cleanups (2024c).
|
||||
*
|
||||
* Revision 1.6 2001/04/15 03:21:50 bartoldeman
|
||||
* See history.txt for the list of fixes.
|
||||
*
|
||||
@ -337,7 +340,9 @@ log( ("NLS: nlsGetData(): subfunction found\n") );
|
||||
case NLS_DOS_38: /* Normal Country Information */
|
||||
return cpyBuf(buf, bufsize
|
||||
, &(((struct nlsExtCntryInfo FAR*)poi)->dateFmt)
|
||||
, 34); /* standard cinfo has no more 34 _used_ bytes */
|
||||
, 24); /* standard cinfo has no more 34 _used_ bytes */
|
||||
/* don't copy 34, copy only 0x18 instead,
|
||||
see comment at DosGetCountryInformation TE */
|
||||
default:
|
||||
/* All other subfunctions just return the found nlsPoinerInf
|
||||
structure */
|
||||
@ -356,8 +361,7 @@ log( ("NLS: nlsGetData(): Subfunction not found\n") );
|
||||
VOID nlsCPchange(UWORD cp)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(cp);
|
||||
printf("\7\nSorry, to change the codepage is not implemented, yet.\n\
|
||||
Hope it's OK to proceed ignoring this call.\n-- 2000/02/26 ska\n");
|
||||
printf("\7\nchange codepage not yet done ska\n");
|
||||
}
|
||||
|
||||
/*
|
||||
@ -564,9 +568,17 @@ log( ("NLS: GetData(): subfct=%x, cp=%u, cntry=%u, bufsize=%u\n",
|
||||
* it is assumed the buffer is large enough as described in RBIL,
|
||||
* which is 34 bytes _hardcoded_.
|
||||
*/
|
||||
/* TE 05/04/01
|
||||
* NETX calls Int 21 AX=3800
|
||||
* and gives a buffer of (at most) 0x20 bytes
|
||||
* MSDOS 6.2 copies only 0x18 bytes
|
||||
* RBIL documents 0x18 bytes and calls 10 bytes 'reserved'
|
||||
* so we change the amount of copied bytes to 0x18
|
||||
*/
|
||||
|
||||
#ifndef DosGetCountryInformation
|
||||
COUNT DosGetCountryInformation(UWORD cntry, VOID FAR *buf)
|
||||
{ return DosGetData(NLS_DOS_38, NLS_DEFAULT, cntry, 34, buf);
|
||||
{ return DosGetData(NLS_DOS_38, NLS_DEFAULT, cntry, 0x18, buf);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -34,6 +34,9 @@ static BYTE *Proto_hRcsId = "$Id$";
|
||||
|
||||
/*
|
||||
* $Log$
|
||||
* Revision 1.17 2001/06/03 14:16:18 bartoldeman
|
||||
* BUFFERS tuning and misc bug fixes/cleanups (2024c).
|
||||
*
|
||||
* Revision 1.16 2001/04/29 17:34:40 bartoldeman
|
||||
* A new SYS.COM/config.sys single stepping/console output/misc fixes.
|
||||
*
|
||||
@ -175,8 +178,8 @@ static BYTE *Proto_hRcsId = "$Id$";
|
||||
/* blockio.c */
|
||||
ULONG getblkno(struct buffer FAR *);
|
||||
VOID setblkno(struct buffer FAR *, ULONG);
|
||||
struct buffer FAR *getblock(ULONG blkno, COUNT dsk);
|
||||
BOOL getbuf(struct buffer FAR ** pbp, ULONG blkno, COUNT dsk);
|
||||
struct buffer FAR *getblock (ULONG blkno, COUNT dsk);
|
||||
struct buffer FAR *getblockOver(ULONG blkno, COUNT dsk);
|
||||
VOID setinvld(REG COUNT dsk);
|
||||
BOOL flush_buffers(REG COUNT dsk);
|
||||
BOOL flush1(struct buffer FAR * bp);
|
||||
@ -199,7 +202,7 @@ VOID KbdFlush(void);
|
||||
VOID Do_DosIdle_loop(void);
|
||||
UCOUNT sti(keyboard FAR * kp);
|
||||
|
||||
sft FAR *get_sft(COUNT);
|
||||
sft FAR *get_sft(UCOUNT);
|
||||
|
||||
/* dosfns.c */
|
||||
BYTE FAR *get_root(BYTE FAR *);
|
||||
@ -256,13 +259,14 @@ COUNT char_error(request * rq, struct dhdr FAR * lpDevice);
|
||||
COUNT block_error(request * rq, COUNT nDrive, struct dhdr FAR * lpDevice);
|
||||
|
||||
/* fatdir.c */
|
||||
struct f_node FAR *dir_open(BYTE FAR * dirname);
|
||||
COUNT dir_read(REG struct f_node FAR * fnp);
|
||||
COUNT dir_write(REG struct f_node FAR * fnp);
|
||||
VOID dir_close(REG struct f_node FAR * fnp);
|
||||
f_node_ptr dir_open(BYTE FAR * dirname);
|
||||
COUNT dir_read(REG f_node_ptr fnp);
|
||||
COUNT dir_write(REG f_node_ptr fnp);
|
||||
VOID dir_close(REG f_node_ptr fnp);
|
||||
COUNT dos_findfirst(UCOUNT attr, BYTE FAR * name);
|
||||
COUNT dos_findnext(void);
|
||||
void ConvertName83ToNameSZ(BYTE FAR *destSZ, BYTE FAR *srcFCBName);
|
||||
int FileName83Length(BYTE *filename83);
|
||||
|
||||
/* fatfs.c */
|
||||
COUNT dos_open(BYTE FAR * path, COUNT flag);
|
||||
@ -282,8 +286,8 @@ LONG dos_getcufsize(COUNT fd);
|
||||
LONG dos_getfsize(COUNT fd);
|
||||
BOOL dos_setfsize(COUNT fd, LONG size);
|
||||
COUNT dos_mkdir(BYTE FAR * dir);
|
||||
BOOL last_link(struct f_node FAR * fnp);
|
||||
COUNT map_cluster(REG struct f_node FAR * fnp, COUNT mode);
|
||||
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);
|
||||
COUNT dos_read(COUNT fd, VOID FAR * buffer, UCOUNT count);
|
||||
@ -295,14 +299,14 @@ VOID trim_path(BYTE FAR * s);
|
||||
|
||||
COUNT dos_cd(struct cds FAR * cdsp, BYTE FAR * PathName);
|
||||
|
||||
struct f_node FAR *get_f_node(void);
|
||||
VOID release_f_node(struct f_node FAR * fnp);
|
||||
f_node_ptr get_f_node(void);
|
||||
VOID release_f_node(f_node_ptr fnp);
|
||||
VOID dos_setdta(BYTE FAR * newdta);
|
||||
COUNT dos_getfattr(BYTE FAR * name, UWORD FAR * attrp);
|
||||
COUNT dos_setfattr(BYTE FAR * name, UWORD FAR * attrp);
|
||||
COUNT media_check(REG struct dpb FAR *dpbp);
|
||||
struct f_node FAR *xlt_fd(COUNT fd);
|
||||
COUNT xlt_fnp(struct f_node FAR * fnp);
|
||||
f_node_ptr xlt_fd(COUNT fd);
|
||||
COUNT xlt_fnp(f_node_ptr fnp);
|
||||
struct dhdr FAR *select_unit(COUNT drive);
|
||||
VOID bpb_to_dpb(bpb FAR *bpbp, REG struct dpb FAR * dpbp);
|
||||
|
||||
@ -321,7 +325,7 @@ int DosCharInput(VOID);
|
||||
VOID DosDirectConsoleIO(iregs FAR * r);
|
||||
VOID DosCharOutput(COUNT c);
|
||||
VOID DosDisplayOutput(COUNT c);
|
||||
VOID FatGetDrvData(COUNT drive, COUNT FAR * spc, COUNT FAR * bps, COUNT FAR * nc, BYTE FAR ** mdp);
|
||||
VOID FatGetDrvData(UCOUNT drive, COUNT FAR * spc, COUNT FAR * bps, COUNT FAR * nc, BYTE FAR ** mdp);
|
||||
WORD FcbParseFname(int wTestMode, BYTE FAR ** lpFileName, fcb FAR * lpFcb);
|
||||
BYTE FAR *ParseSkipWh(BYTE FAR * lpFileName);
|
||||
BOOL TestCmnSeps(BYTE FAR * lpFileName);
|
||||
@ -385,7 +389,7 @@ VOID fstrcpy(REG BYTE FAR * d, REG BYTE FAR * s);
|
||||
VOID fstrcpy(REG BYTE FAR * d, REG BYTE FAR * s);
|
||||
|
||||
/*VOID bcopy(REG BYTE * s, REG BYTE * d, REG COUNT n);*/
|
||||
void memcpy(REG BYTE * d, REG BYTE * s, REG COUNT n);
|
||||
void memcpy(REG void * d, REG VOID * s, REG COUNT n);
|
||||
#define bcopy(s,d,n) memcpy(d,s,n)
|
||||
|
||||
void fmemset(REG VOID FAR * s, REG int ch, REG COUNT n);
|
||||
|
@ -35,6 +35,9 @@ static BYTE *RcsId = "$Id$";
|
||||
|
||||
/*
|
||||
* $Log$
|
||||
* Revision 1.14 2001/06/03 14:16:18 bartoldeman
|
||||
* BUFFERS tuning and misc bug fixes/cleanups (2024c).
|
||||
*
|
||||
* Revision 1.13 2001/04/21 22:32:53 bartoldeman
|
||||
* Init DS=Init CS, fixed stack overflow problems and misc bugs.
|
||||
*
|
||||
@ -234,7 +237,7 @@ COUNT ChildEnv(exec_blk FAR * exp, UWORD * pChildEnvSeg, char far * pathname)
|
||||
/* create a new environment for the process */
|
||||
/* copy parent's environment if exec.env_seg == 0 */
|
||||
|
||||
pDest = pSrc = exp->exec.env_seg ?
|
||||
pSrc = exp->exec.env_seg ?
|
||||
MK_FP(exp->exec.env_seg, 0) :
|
||||
MK_FP(ppsp->ps_environ, 0);
|
||||
|
||||
@ -254,24 +257,19 @@ COUNT ChildEnv(exec_blk FAR * exp, UWORD * pChildEnvSeg, char far * pathname)
|
||||
-- 1999/04/21 ska */
|
||||
if (pSrc)
|
||||
{ /* if no environment is available, one byte is required */
|
||||
while (*pSrc != '\0')
|
||||
|
||||
for (nEnvSize = 0; ; nEnvSize++)
|
||||
{
|
||||
while (*pSrc != '\0' && pSrc < pDest + MAXENV - ENV_KEEPFREE)
|
||||
{
|
||||
++pSrc;
|
||||
++nEnvSize;
|
||||
}
|
||||
/* account for terminating null */
|
||||
++nEnvSize;
|
||||
++pSrc;
|
||||
/* Test env size and abort if greater than max */
|
||||
if (nEnvSize >= MAXENV - ENV_KEEPFREE)
|
||||
return DE_INVLDENV;
|
||||
|
||||
if (*(UWORD FAR *)(pSrc+nEnvSize) == 0)
|
||||
break;
|
||||
}
|
||||
pSrc = pDest;
|
||||
nEnvSize += 2; /* account for trailing \0\0 */
|
||||
}
|
||||
|
||||
/* Test env size and abort if greater than max */
|
||||
if (nEnvSize >= MAXENV)
|
||||
return DE_INVLDENV;
|
||||
|
||||
/* allocate enough space for env + path */
|
||||
if ((RetCode = DosMemAlloc(long2para(nEnvSize + ENV_KEEPFREE),
|
||||
mem_access_mode, (seg FAR *) pChildEnvSeg,
|
||||
@ -291,21 +289,7 @@ COUNT ChildEnv(exec_blk FAR * exp, UWORD * pChildEnvSeg, char far * pathname)
|
||||
else
|
||||
*pDest++ = '\0'; /* create an empty environment */
|
||||
|
||||
#if 0
|
||||
/* The size is already known, use a quicker copy function
|
||||
-- 1999/04/21 ska */
|
||||
for (; *pSrc != '\0';)
|
||||
{
|
||||
while (*pSrc)
|
||||
{
|
||||
*pDest++ = *pSrc++;
|
||||
}
|
||||
pSrc++;
|
||||
*pDest++ = 0;
|
||||
}
|
||||
*pDest++ = 0;
|
||||
#endif
|
||||
/* initialize 'extra strings' count */
|
||||
/* initialize 'extra strings' count */
|
||||
*((UWORD FAR *) pDest)++ = 1;
|
||||
|
||||
/* copy complete pathname */
|
||||
|
@ -5,6 +5,9 @@
|
||||
#
|
||||
|
||||
# $Log$
|
||||
# Revision 1.5 2001/06/03 14:16:18 bartoldeman
|
||||
# BUFFERS tuning and misc bug fixes/cleanups (2024c).
|
||||
#
|
||||
# Revision 1.4 2001/03/19 04:50:56 bartoldeman
|
||||
# See history.txt for overview: put kernel 2022beo1 into CVS
|
||||
#
|
||||
@ -37,7 +40,7 @@
|
||||
!include "..\config.mak"
|
||||
|
||||
|
||||
libm.lib: $(CLIB)
|
||||
libm.lib: $(CLIB) ..\config.mak
|
||||
$(LIBUTIL) $(CLIB) $(MATH_EXTRACT)
|
||||
$(LIBUTIL) libm $(MATH_INSERT)
|
||||
$(RM) *.OBJ
|
||||
|
Loading…
Reference in New Issue
Block a user