fixed some path parsing problems

This commit is contained in:
hsn 2003-11-22 17:18:02 +00:00
parent 5cc1497967
commit f2feaf1ba6
4 changed files with 12 additions and 9 deletions

View File

@ -7,6 +7,7 @@ config.cache
config.guess
config.log
config.status
configure.lineno
config.sub
configure
depcomp

View File

@ -21,6 +21,8 @@ Version NEXT
pathes with dot after slash are now detected at parse level (side
effect of prev. fix)
tests moved from server/ into tests/ directory
removed special test case for root directory in path.c -> use more
general alg. instead. This fixed "/" dir.
Version 2.8.1b17 -- 17 Nov 2003
Allow filenames with spaces inside

View File

@ -40,18 +40,11 @@ const char *parse_path PROTO3(char *, fullp, unsigned int, len, PPATH *, pp)
int state;
if(len < 1) return("Path must have non-zero length");
if(fullp[len-1]) return("Path not null terminated");
if(fullp[len-1]) return("Path must be null terminated");
pp->passwd = NULL; /* default, no password */
pp->d_len = 0;
if(len == 1 && fullp[0] == 0)
{
/* null path --> root */
pp->fullp = pp->f_ptr = pp->d_ptr = ".";
pp->f_len = pp->d_len = 1;
return(NULLP);
}
for(s = pp->fullp = pp->f_ptr = pp->d_ptr = fullp, state = 0; *s; s++)
{
@ -115,5 +108,12 @@ const char *parse_path PROTO3(char *, fullp, unsigned int, len, PPATH *, pp)
pp->f_len = 1;
}
/* turn empty fullp into "." */
if(pp->fullp[0] == 0)
{
/* null path --> root */
pp->fullp = ".";
}
return(NULLP);
}

View File

@ -12,7 +12,7 @@
int dbug=0;
const char *testcases[]={ "", ".","filename","/filename","//filename","//dirname/filename","//dirname//filename","dirname//dir3name//","filename\npasswd",
"file/.dir","directory.ext/filename.",
"file/.dir","directory.ext/filename.","/",
NULL};
static void print_path(PPATH *pp)