mirror of
https://github.com/FDOS/kernel.git
synced 2025-07-23 05:44:41 +02:00
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:
parent
39a9574824
commit
95653072d3
@ -887,38 +887,19 @@ COUNT DosGetExtFree(BYTE FAR * DriveString, struct xfreespace FAR * xfsp)
|
|||||||
|
|
||||||
COUNT DosGetCuDir(UBYTE drive, BYTE FAR * s)
|
COUNT DosGetCuDir(UBYTE drive, BYTE FAR * s)
|
||||||
{
|
{
|
||||||
BYTE *cp;
|
char path[3];
|
||||||
struct cds FAR *cdsp;
|
|
||||||
|
|
||||||
/* next - "log" in the drive */
|
if (drive-- == 0) /* get default drive or convert to 0 = A:, 1 = B:, ... */
|
||||||
/* first check for valid drive */
|
drive = default_drive;
|
||||||
cdsp = get_cds1(drive);
|
path[0] = 'A' + (drive & 0x1f);
|
||||||
if (cdsp == NULL)
|
path[1] = ':';
|
||||||
|
path[2] = '\0';
|
||||||
|
|
||||||
|
if (truename(path, PriPathName, CDS_MODE_SKIP_PHYSICAL) < SUCCESS)
|
||||||
return DE_INVLDDRV;
|
return DE_INVLDDRV;
|
||||||
|
|
||||||
fmemcpy(&TempCDS, cdsp, sizeof(TempCDS));
|
/* skip d:\ */
|
||||||
cp = TempCDS.cdsCurrentPath;
|
fstrcpy(s, PriPathName + 3);
|
||||||
/* 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);
|
|
||||||
|
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -368,7 +368,8 @@ COUNT truename(const char FAR * src, char * dest, COUNT mode)
|
|||||||
dest[0] = '\0'; /* better probable for sanity check below --
|
dest[0] = '\0'; /* better probable for sanity check below --
|
||||||
included by original truename() */
|
included by original truename() */
|
||||||
/* MUX succeeded and really something */
|
/* 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));
|
tn_printf(("QRemoteFn() returned: \"%S\"\n", dest));
|
||||||
#ifdef DEBUG_TRUENAME
|
#ifdef DEBUG_TRUENAME
|
||||||
@ -431,7 +432,7 @@ COUNT truename(const char FAR * src, char * dest, COUNT mode)
|
|||||||
rootPos = p = dest + 2;
|
rootPos = p = dest + 2;
|
||||||
if (*p != '/') /* i.e., it's a backslash! */
|
if (*p != '/') /* i.e., it's a backslash! */
|
||||||
{
|
{
|
||||||
COUNT prevresult = result;
|
BYTE *cp;
|
||||||
if (!(mode & CDS_MODE_SKIP_PHYSICAL))
|
if (!(mode & CDS_MODE_SKIP_PHYSICAL))
|
||||||
{
|
{
|
||||||
tn_printf(("SUBSTing from: %S\n", cdsEntry->cdsCurrentPath));
|
tn_printf(("SUBSTing from: %S\n", cdsEntry->cdsCurrentPath));
|
||||||
@ -459,8 +460,28 @@ COUNT truename(const char FAR * src, char * dest, COUNT mode)
|
|||||||
p++;
|
p++;
|
||||||
/* truename must use the CuDir of the "virtual" drive letter! */
|
/* truename must use the CuDir of the "virtual" drive letter! */
|
||||||
/* tn_printf(("DosGetCuDir drive #%u\n", prevresult & 0x1f)); */
|
/* tn_printf(("DosGetCuDir drive #%u\n", prevresult & 0x1f)); */
|
||||||
if (DosGetCuDir((UBYTE)((prevresult & 0x1f) + 1), p) < 0)
|
fmemcpy(&TempCDS, cdsEntry, sizeof(TempCDS));
|
||||||
return DE_PATHNOTFND;
|
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 != '/')
|
if (*src != '\\' && *src != '/')
|
||||||
p += strlen(p);
|
p += strlen(p);
|
||||||
else /* skip the absolute path marker */
|
else /* skip the absolute path marker */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user