From b5e261687723f47085b869dfa81e0c188089ed3f Mon Sep 17 00:00:00 2001 From: Bart Oldeman Date: Sun, 23 May 2004 14:10:39 +0000 Subject: [PATCH] Merge dosmkdir and dosrmdir (mostly from Lucho) git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@937 6ac86273-5f31-0410-b378-82cca8765d1b --- kernel/dosfns.c | 27 +++------------------------ kernel/inthndlr.c | 5 +---- kernel/proto.h | 3 +-- 3 files changed, 5 insertions(+), 30 deletions(-) diff --git a/kernel/dosfns.c b/kernel/dosfns.c index 51bfc84..52b7ca0 100644 --- a/kernel/dosfns.c +++ b/kernel/dosfns.c @@ -1327,7 +1327,7 @@ COUNT DosRename(BYTE FAR * path1, BYTE FAR * path2) return DosRenameTrue(PriPathName, SecPathName, D_ALL); } -COUNT DosMkdir(const char FAR * dir) +COUNT DosMkRmdir(const char FAR * dir, int action) { COUNT result; @@ -1336,33 +1336,12 @@ COUNT DosMkdir(const char FAR * dir) return result; if (result & IS_NETWORK) - return network_redirector(REM_MKDIR); + return network_redirector(action == 0x39 ? REM_MKDIR : REM_RMDIR); if (result & IS_DEVICE) return DE_ACCESS; - return dos_mkdir(PriPathName); -} - -/* This function is almost identical to DosMkdir(). - Maybe it would be nice to merge both functions. - -- 2001/09/03 ska*/ -COUNT DosRmdir(const char FAR * dir) -{ - COUNT result; - - result = truename(dir, PriPathName, CDS_MODE_CHECK_DEV_PATH); - - if (result < SUCCESS) - return result; - - if (result & IS_NETWORK) - return network_redirector(REM_RMDIR); - - if (result & IS_DEVICE) - return DE_ACCESS; - - return dos_rmdir(PriPathName); + return (action == 0x39 ? dos_mkdir : dos_rmdir)(PriPathName); } /* /// Added for SHARE. - Ron Cemer */ diff --git a/kernel/inthndlr.c b/kernel/inthndlr.c index 764b39e..fcf3d53 100644 --- a/kernel/inthndlr.c +++ b/kernel/inthndlr.c @@ -860,12 +860,9 @@ dispatch: /* Dos Create Directory */ case 0x39: - rc = DosMkdir(FP_DS_DX); - goto short_check; - /* Dos Remove Directory */ case 0x3a: - rc = DosRmdir(FP_DS_DX); + rc = DosMkRmdir(FP_DS_DX, lr.AL); goto short_check; /* Dos Change Directory */ diff --git a/kernel/proto.h b/kernel/proto.h index abe7bb7..6c2cbb3 100644 --- a/kernel/proto.h +++ b/kernel/proto.h @@ -112,8 +112,7 @@ UBYTE DosSelectDrv(UBYTE drv); COUNT DosDelete(BYTE FAR * path, int attrib); COUNT DosRename(BYTE FAR * path1, BYTE FAR * path2); COUNT DosRenameTrue(BYTE * path1, BYTE * path2, int attrib); -COUNT DosMkdir(const char FAR * dir); -COUNT DosRmdir(const char FAR * dir); +COUNT DosMkRmdir(const char FAR * dir, int action); struct dhdr FAR *IsDevice(const char FAR * FileName); BOOL IsShareInstalled(void); COUNT DosLockUnlock(COUNT hndl, LONG pos, LONG len, COUNT unlock);