mirror of https://github.com/FDOS/kernel.git
Add support for UNC style paths (David Bolen)
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@604 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
parent
d56013c885
commit
4c88863f24
|
@ -16,6 +16,9 @@
|
||||||
* distinguish between the builtin DOS version and the settable
|
* distinguish between the builtin DOS version and the settable
|
||||||
DOS version.
|
DOS version.
|
||||||
* console.asm now accepts extended scancodes (modified by Bart)
|
* console.asm now accepts extended scancodes (modified by Bart)
|
||||||
|
* added BOOTONLY option to SYS (modified by Bart)
|
||||||
|
+ Changes David Bolen
|
||||||
|
* add support for UNC-style paths (that start with "\\")
|
||||||
+ Changes Bart
|
+ Changes Bart
|
||||||
* flip some slashes in drivers/*.asm
|
* flip some slashes in drivers/*.asm
|
||||||
(enables cross-assembly on Linux)
|
(enables cross-assembly on Linux)
|
||||||
|
|
|
@ -92,7 +92,7 @@ STATIC int remote_lock_unlock(sft FAR *sftp, /* SFT for file */
|
||||||
/* get current directory structure for drive
|
/* get current directory structure for drive
|
||||||
return NULL if the CDS is not valid or the
|
return NULL if the CDS is not valid or the
|
||||||
drive is not within range */
|
drive is not within range */
|
||||||
struct cds FAR *get_cds(int drive)
|
struct cds FAR *get_cds(unsigned drive)
|
||||||
{
|
{
|
||||||
struct cds FAR *cdsp;
|
struct cds FAR *cdsp;
|
||||||
unsigned flags;
|
unsigned flags;
|
||||||
|
@ -966,7 +966,8 @@ COUNT DosChangeDir(BYTE FAR * s)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strlen(PriPathName) > sizeof(current_ldt->cdsCurrentPath) - 1)
|
if ((FP_OFF(current_ldt) != 0xFFFF) &&
|
||||||
|
(strlen(PriPathName) > sizeof(current_ldt->cdsCurrentPath) - 1))
|
||||||
return DE_PATHNOTFND;
|
return DE_PATHNOTFND;
|
||||||
|
|
||||||
#if defined(CHDIR_DEBUG)
|
#if defined(CHDIR_DEBUG)
|
||||||
|
@ -988,8 +989,12 @@ COUNT DosChangeDir(BYTE FAR * s)
|
||||||
SHSUCdX needs this. jt
|
SHSUCdX needs this. jt
|
||||||
*/
|
*/
|
||||||
fstrcpy(current_ldt->cdsCurrentPath, PriPathName);
|
fstrcpy(current_ldt->cdsCurrentPath, PriPathName);
|
||||||
if (PriPathName[7] == 0)
|
if (FP_OFF(current_ldt) != 0xFFFF)
|
||||||
current_ldt->cdsCurrentPath[8] = 0; /* Need two Zeros at the end */
|
{
|
||||||
|
fstrcpy(current_ldt->cdsCurrentPath, PriPathName);
|
||||||
|
if (PriPathName[7] == 0)
|
||||||
|
current_ldt->cdsCurrentPath[8] = 0; /* Need two Zeros at the end */
|
||||||
|
}
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1271,7 +1276,7 @@ COUNT DosRenameTrue(BYTE * path1, BYTE * path2, int attrib)
|
||||||
{
|
{
|
||||||
return DE_DEVICE; /* not same device */
|
return DE_DEVICE; /* not same device */
|
||||||
}
|
}
|
||||||
if (current_ldt->cdsFlags & CDSNETWDRV)
|
if (FP_OFF(current_ldt) == 0xFFFF || (current_ldt->cdsFlags & CDSNETWDRV))
|
||||||
return remote_rename();
|
return remote_rename();
|
||||||
|
|
||||||
return dos_rename(path1, path2, attrib);
|
return dos_rename(path1, path2, attrib);
|
||||||
|
|
|
@ -108,7 +108,7 @@ int DosMkTmp(BYTE FAR * pathname, UWORD attr)
|
||||||
#define DEBUG_TRUENAME
|
#define DEBUG_TRUENAME
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define drLetterToNr(dr) ((dr) - 'A')
|
#define drLetterToNr(dr) ((unsigned char)((dr) - 'A'))
|
||||||
/* Convert an uppercased drive letter into the drive index */
|
/* Convert an uppercased drive letter into the drive index */
|
||||||
#define drNrToLetter(dr) ((dr) + 'A')
|
#define drNrToLetter(dr) ((dr) + 'A')
|
||||||
/* the other direction */
|
/* the other direction */
|
||||||
|
@ -117,22 +117,6 @@ int DosMkTmp(BYTE FAR * pathname, UWORD attr)
|
||||||
is always a logical drive letter associated with a path
|
is always a logical drive letter associated with a path
|
||||||
spec. This letter is also the index into the CDS */
|
spec. This letter is also the index into the CDS */
|
||||||
|
|
||||||
COUNT get_verify_drive(const char FAR * src)
|
|
||||||
{
|
|
||||||
int drive;
|
|
||||||
|
|
||||||
/* Do we have a drive? */
|
|
||||||
if (src[1] == ':')
|
|
||||||
drive = drLetterToNr(DosUpFChar(src[0]));
|
|
||||||
else
|
|
||||||
drive = default_drive;
|
|
||||||
|
|
||||||
if (get_cds(drive) == NULL)
|
|
||||||
return DE_PATHNOTFND;
|
|
||||||
|
|
||||||
return drive;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Definition of functions for the handling of the Current
|
Definition of functions for the handling of the Current
|
||||||
Directory Structure.
|
Directory Structure.
|
||||||
|
@ -260,7 +244,7 @@ COUNT get_verify_drive(const char FAR * src)
|
||||||
|
|
||||||
#define addChar(c) \
|
#define addChar(c) \
|
||||||
{ \
|
{ \
|
||||||
if (p - dest >= SFTMAX) PATH_ERROR; /* path too long */ \
|
if (p >= dest + SFTMAX) PATH_ERROR; /* path too long */ \
|
||||||
*p++ = c; \
|
*p++ = c; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -321,6 +305,7 @@ COUNT truename(const char FAR * src, char * dest, COUNT mode)
|
||||||
struct cds FAR *cdsEntry;
|
struct cds FAR *cdsEntry;
|
||||||
char *p = dest; /* dynamic pointer into dest */
|
char *p = dest; /* dynamic pointer into dest */
|
||||||
char *rootPos;
|
char *rootPos;
|
||||||
|
char src0;
|
||||||
enum { DONT_ADD, ADD, ADD_UNLESS_LAST } addSep;
|
enum { DONT_ADD, ADD, ADD_UNLESS_LAST } addSep;
|
||||||
|
|
||||||
tn_printf(("truename(%S)\n", src));
|
tn_printf(("truename(%S)\n", src));
|
||||||
|
@ -330,14 +315,37 @@ COUNT truename(const char FAR * src, char * dest, COUNT mode)
|
||||||
|
|
||||||
/* In opposite of the TRUENAME shell command, an empty string is
|
/* In opposite of the TRUENAME shell command, an empty string is
|
||||||
rejected by MS DOS 6 */
|
rejected by MS DOS 6 */
|
||||||
if (src[0] == '\0')
|
src0 = src[0];
|
||||||
|
if (src0 == '\0')
|
||||||
return DE_FILENOTFND;
|
return DE_FILENOTFND;
|
||||||
|
|
||||||
result = get_verify_drive(src);
|
if (src0 == '\\' && src[1] == '\\') {
|
||||||
if (result < SUCCESS)
|
const char FAR *unc_src = src;
|
||||||
return result;
|
/* Flag UNC paths and short circuit processing. Set current LDT */
|
||||||
|
/* to sentinel (offset 0xFFFF) for redirector processing. */
|
||||||
|
tn_printf(("Truename: UNC detected\n"));
|
||||||
|
do {
|
||||||
|
src0 = unc_src[0];
|
||||||
|
addChar(src0);
|
||||||
|
unc_src++;
|
||||||
|
} while (src0);
|
||||||
|
current_ldt = (struct cds FAR *)MK_FP(0xFFFF,0xFFFF);
|
||||||
|
tn_printf(("Returning path: \"%s\"\n", dest));
|
||||||
|
/* Flag as network - drive bits are empty but shouldn't get */
|
||||||
|
/* referenced for network with empty current_ldt. */
|
||||||
|
return IS_NETWORK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Do we have a drive? */
|
||||||
|
if (src[1] == ':')
|
||||||
|
result = drLetterToNr(DosUpFChar(src0));
|
||||||
|
else
|
||||||
|
result = default_drive;
|
||||||
|
|
||||||
|
cdsEntry = get_cds(result);
|
||||||
|
if (cdsEntry == NULL)
|
||||||
|
return DE_PATHNOTFND;
|
||||||
|
|
||||||
cdsEntry = &CDSp[result];
|
|
||||||
tn_printf(("CDS entry: #%u @%p (%u) '%S'\n", result, cdsEntry,
|
tn_printf(("CDS entry: #%u @%p (%u) '%S'\n", result, cdsEntry,
|
||||||
cdsEntry->cdsBackslashOffset, cdsEntry->cdsCurrentPath));
|
cdsEntry->cdsBackslashOffset, cdsEntry->cdsCurrentPath));
|
||||||
/* is the current_ldt thing necessary for compatibly??
|
/* is the current_ldt thing necessary for compatibly??
|
||||||
|
|
|
@ -111,7 +111,7 @@ BOOL IsShareInstalled(void);
|
||||||
COUNT DosLockUnlock(COUNT hndl, LONG pos, LONG len, COUNT unlock);
|
COUNT DosLockUnlock(COUNT hndl, LONG pos, LONG len, COUNT unlock);
|
||||||
sft FAR *idx_to_sft(int SftIndex);
|
sft FAR *idx_to_sft(int SftIndex);
|
||||||
int get_sft_idx(UCOUNT hndl);
|
int get_sft_idx(UCOUNT hndl);
|
||||||
struct cds FAR *get_cds(int dsk);
|
struct cds FAR *get_cds(unsigned dsk);
|
||||||
COUNT DosTruename(const char FAR * src, char FAR * dest);
|
COUNT DosTruename(const char FAR * src, char FAR * dest);
|
||||||
|
|
||||||
/*dosidle.asm */
|
/*dosidle.asm */
|
||||||
|
@ -340,7 +340,6 @@ VOID InitPSP(VOID);
|
||||||
/* newstuff.c */
|
/* newstuff.c */
|
||||||
int SetJFTSize(UWORD nHandles);
|
int SetJFTSize(UWORD nHandles);
|
||||||
int DosMkTmp(BYTE FAR * pathname, UWORD attr);
|
int DosMkTmp(BYTE FAR * pathname, UWORD attr);
|
||||||
COUNT get_verify_drive(const char FAR * src);
|
|
||||||
COUNT truename(const char FAR * src, char * dest, COUNT t);
|
COUNT truename(const char FAR * src, char * dest, COUNT t);
|
||||||
|
|
||||||
/* network.c */
|
/* network.c */
|
||||||
|
|
|
@ -92,6 +92,10 @@ void DosGetTime(struct dostime *dt)
|
||||||
|
|
||||||
int DosSetTime(const struct dostime *dt)
|
int DosSetTime(const struct dostime *dt)
|
||||||
{
|
{
|
||||||
|
if (dt->hour > 23 || dt->minute > 59 ||
|
||||||
|
dt->second > 59 || dt->hundredth > 99)
|
||||||
|
return DE_INVLDDATA;
|
||||||
|
|
||||||
/* for ClkRecord.clkDays */
|
/* for ClkRecord.clkDays */
|
||||||
ExecuteClockDriverRequest(C_INPUT);
|
ExecuteClockDriverRequest(C_INPUT);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue