mirror of
https://github.com/FDOS/kernel.git
synced 2025-07-22 21:34:33 +02:00
Remove dosnames.c and inline ParseDosName, because there is only one user left
(split_path()) which only uses it to find out if the path ends in a backslash and the length of the directory part. git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@1442 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
parent
60915d3cd0
commit
78fc7a1e6d
@ -1,83 +0,0 @@
|
||||
/****************************************************************/
|
||||
/* */
|
||||
/* dosnames.c */
|
||||
/* DOS-C */
|
||||
/* */
|
||||
/* Generic parsing functions for file name specifications */
|
||||
/* */
|
||||
/* Copyright (c) 1994 */
|
||||
/* Pasquale J. Villani */
|
||||
/* All Rights Reserved */
|
||||
/* */
|
||||
/* This file is part of DOS-C. */
|
||||
/* */
|
||||
/* DOS-C is free software; you can redistribute it and/or */
|
||||
/* modify it under the terms of the GNU General Public License */
|
||||
/* as published by the Free Software Foundation; either version */
|
||||
/* 2, or (at your option) any later version. */
|
||||
/* */
|
||||
/* DOS-C is distributed in the hope that it will be useful, but */
|
||||
/* WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See */
|
||||
/* the GNU General Public License for more details. */
|
||||
/* */
|
||||
/* You should have received a copy of the GNU General Public */
|
||||
/* License along with DOS-C; see the file COPYING. If not, */
|
||||
/* write to the Free Software Foundation, 675 Mass Ave, */
|
||||
/* Cambridge, MA 02139, USA. */
|
||||
/* */
|
||||
/****************************************************************/
|
||||
|
||||
#include "portab.h"
|
||||
|
||||
#ifdef VERSION_STRINGS
|
||||
static BYTE *dosnamesRcsId =
|
||||
"$Id$";
|
||||
#endif
|
||||
|
||||
#include "globals.h"
|
||||
|
||||
/*
|
||||
MSD durring an FindFirst search string looks like this;
|
||||
(*), & (.) == Current directory *.*
|
||||
(\) == Root directory *.*
|
||||
(..) == Back one directory *.*
|
||||
|
||||
This always has a "truename" as input, so we may do some shortcuts
|
||||
|
||||
returns number of characters in the directory component (up to the
|
||||
last backslash, including d:) or negative if error
|
||||
*/
|
||||
int ParseDosName(const char *filename)
|
||||
{
|
||||
int nDirCnt;
|
||||
const char *lpszLclDir, *lpszLclFile;
|
||||
|
||||
/* Initialize the users data fields */
|
||||
nDirCnt = 0;
|
||||
|
||||
/* NB: this code assumes ASCII */
|
||||
|
||||
/* Now see how long a directory component we have. */
|
||||
lpszLclDir = lpszLclFile = filename;
|
||||
filename += 2;
|
||||
|
||||
while (*filename)
|
||||
{
|
||||
if (*filename == '\\')
|
||||
lpszLclFile = filename + 1;
|
||||
++filename;
|
||||
}
|
||||
nDirCnt = lpszLclFile - lpszLclDir;
|
||||
|
||||
/* Parse out the file name portion. */
|
||||
filename = lpszLclFile;
|
||||
while (*filename)
|
||||
++filename;
|
||||
|
||||
if (filename == lpszLclFile)
|
||||
return DE_PATHNOTFND;
|
||||
|
||||
return nDirCnt;
|
||||
}
|
||||
|
@ -257,9 +257,15 @@ COUNT dos_close(COUNT fd)
|
||||
f_node_ptr split_path(char * path, f_node_ptr fnp)
|
||||
{
|
||||
/* Start off by parsing out the components. */
|
||||
int dirlength = ParseDosName(path);
|
||||
int i = 2, dirlength = 3;
|
||||
|
||||
if (dirlength < SUCCESS)
|
||||
/* Now see how long a directory component we have. */
|
||||
while (path[i])
|
||||
if (path[i++] == '\\')
|
||||
dirlength = i;
|
||||
|
||||
/* check if the path ends in a backslash */
|
||||
if (path[dirlength] == '\0')
|
||||
return (f_node_ptr) 0;
|
||||
|
||||
/* 11/29/99 jt
|
||||
|
@ -21,7 +21,7 @@ OBJS3=apisupt.obj intr.obj irqstack.obj blockio.obj chario.obj systime.obj \
|
||||
error.obj
|
||||
OBJS4=break.obj dosfns.obj fatdir.obj fatfs.obj fattab.obj fcbfns.obj \
|
||||
inthndlr.obj
|
||||
OBJS5=ioctl.obj dosnames.obj memmgr.obj task.obj newstuff.obj nls.obj network.obj
|
||||
OBJS5=ioctl.obj memmgr.obj task.obj newstuff.obj nls.obj network.obj
|
||||
OBJS6=prf.obj misc.obj strings.obj syspack.obj lfnapi.obj iasmsupt.obj
|
||||
OBJS7=main.obj config.obj initoem.obj inithma.obj dyninit.obj iprf.obj \
|
||||
initdisk.obj initclk.obj
|
||||
@ -97,7 +97,6 @@ blockio.obj: blockio.c $(HEADERS) $(TARGET).lnk
|
||||
break.obj: break.c $(HEADERS) $(TARGET).lnk
|
||||
chario.obj: chario.c $(HEADERS) $(TARGET).lnk
|
||||
dosfns.obj: dosfns.c $(HEADERS) $(TARGET).lnk
|
||||
dosnames.obj: dosnames.c $(HEADERS) $(TARGET).lnk
|
||||
dsk.obj: dsk.c $(HEADERS) $(TARGET).lnk
|
||||
error.obj: error.c $(HEADERS) $(TARGET).lnk
|
||||
fatdir.obj: fatdir.c $(HEADERS) $(TARGET).lnk
|
||||
|
@ -129,9 +129,6 @@ VOID ASMCFUNC DosIdle_hlt(void);
|
||||
#pragma aux (cdecl) DosIdle_hlt modify exact []
|
||||
#endif
|
||||
|
||||
/* dosnames.c */
|
||||
int ParseDosName(const char *);
|
||||
|
||||
/* error.c */
|
||||
VOID dump(void);
|
||||
VOID panic(BYTE * s);
|
||||
|
Loading…
x
Reference in New Issue
Block a user