The original DosGetCuDir is now inlined in truename(). DosGetCuDir now

does truename("D:", CDS_MODE_SKIP_PHYSICAL), and this mode was changed
to no longer call QRemote_Fn (int2f/ax=1123).


git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1472 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
Bart Oldeman 2009-07-05 21:09:34 +00:00
parent 39a9574824
commit 95653072d3
2 changed files with 35 additions and 33 deletions

View File

@ -887,38 +887,19 @@ COUNT DosGetExtFree(BYTE FAR * DriveString, struct xfreespace FAR * xfsp)
COUNT DosGetCuDir(UBYTE drive, BYTE FAR * s)
{
BYTE *cp;
struct cds FAR *cdsp;
char path[3];
/* next - "log" in the drive */
/* first check for valid drive */
cdsp = get_cds1(drive);
if (cdsp == NULL)
if (drive-- == 0) /* get default drive or convert to 0 = A:, 1 = B:, ... */
drive = default_drive;
path[0] = 'A' + (drive & 0x1f);
path[1] = ':';
path[2] = '\0';
if (truename(path, PriPathName, CDS_MODE_SKIP_PHYSICAL) < SUCCESS)
return DE_INVLDDRV;
fmemcpy(&TempCDS, cdsp, sizeof(TempCDS));
cp = TempCDS.cdsCurrentPath;
/* ensure termination of fstrcpy */
cp[MAX_CDSPATH - 1] = '\0';
if ((TempCDS.cdsFlags & CDSNETWDRV) == 0)
{
/* dos_cd ensures that the path exists; if not, we
need to change to the root directory */
int result = dos_cd(cp);
if (result == DE_PATHNOTFND)
cp[TempCDS.cdsBackslashOffset + 1] =
cdsp->cdsCurrentPath[TempCDS.cdsBackslashOffset + 1] = '\0';
else if (result < SUCCESS)
return result;
}
cp += TempCDS.cdsBackslashOffset;
if (*cp == '\0')
s[0] = '\0';
else
fstrcpy(s, cp + 1);
/* skip d:\ */
fstrcpy(s, PriPathName + 3);
return SUCCESS;
}

View File

@ -368,7 +368,8 @@ COUNT truename(const char FAR * src, char * dest, COUNT mode)
dest[0] = '\0'; /* better probable for sanity check below --
included by original truename() */
/* MUX succeeded and really something */
if (QRemote_Fn(dest, src) == SUCCESS && dest[0] != '\0')
if (!(mode & CDS_MODE_SKIP_PHYSICAL) &&
QRemote_Fn(dest, src) == SUCCESS && dest[0] != '\0')
{
tn_printf(("QRemoteFn() returned: \"%S\"\n", dest));
#ifdef DEBUG_TRUENAME
@ -431,7 +432,7 @@ COUNT truename(const char FAR * src, char * dest, COUNT mode)
rootPos = p = dest + 2;
if (*p != '/') /* i.e., it's a backslash! */
{
COUNT prevresult = result;
BYTE *cp;
if (!(mode & CDS_MODE_SKIP_PHYSICAL))
{
tn_printf(("SUBSTing from: %S\n", cdsEntry->cdsCurrentPath));
@ -459,8 +460,28 @@ COUNT truename(const char FAR * src, char * dest, COUNT mode)
p++;
/* truename must use the CuDir of the "virtual" drive letter! */
/* tn_printf(("DosGetCuDir drive #%u\n", prevresult & 0x1f)); */
if (DosGetCuDir((UBYTE)((prevresult & 0x1f) + 1), p) < 0)
return DE_PATHNOTFND;
fmemcpy(&TempCDS, cdsEntry, sizeof(TempCDS));
cp = TempCDS.cdsCurrentPath;
/* ensure termination of strcpy */
cp[MAX_CDSPATH - 1] = '\0';
if ((TempCDS.cdsFlags & CDSNETWDRV) == 0)
{
/* dos_cd ensures that the path exists; if not, we
need to change to the root directory */
int result = dos_cd(cp);
if (result == DE_PATHNOTFND)
cp[TempCDS.cdsBackslashOffset + 1] =
cdsEntry->cdsCurrentPath[TempCDS.cdsBackslashOffset + 1] = '\0';
else if (result < SUCCESS)
return DE_PATHNOTFND;
}
cp += TempCDS.cdsBackslashOffset;
if (*cp == '\0')
p[0] = '\0';
else
strcpy(p, cp + 1);
if (*src != '\\' && *src != '/')
p += strlen(p);
else /* skip the absolute path marker */