fixed some path parsing problems
This commit is contained in:
parent
5cc1497967
commit
f2feaf1ba6
|
|
@ -7,6 +7,7 @@ config.cache
|
||||||
config.guess
|
config.guess
|
||||||
config.log
|
config.log
|
||||||
config.status
|
config.status
|
||||||
|
configure.lineno
|
||||||
config.sub
|
config.sub
|
||||||
configure
|
configure
|
||||||
depcomp
|
depcomp
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,8 @@ Version NEXT
|
||||||
pathes with dot after slash are now detected at parse level (side
|
pathes with dot after slash are now detected at parse level (side
|
||||||
effect of prev. fix)
|
effect of prev. fix)
|
||||||
tests moved from server/ into tests/ directory
|
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
|
Version 2.8.1b17 -- 17 Nov 2003
|
||||||
Allow filenames with spaces inside
|
Allow filenames with spaces inside
|
||||||
|
|
|
||||||
|
|
@ -40,18 +40,11 @@ const char *parse_path PROTO3(char *, fullp, unsigned int, len, PPATH *, pp)
|
||||||
int state;
|
int state;
|
||||||
|
|
||||||
if(len < 1) return("Path must have non-zero length");
|
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->passwd = NULL; /* default, no password */
|
||||||
pp->d_len = 0;
|
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++)
|
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;
|
pp->f_len = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* turn empty fullp into "." */
|
||||||
|
if(pp->fullp[0] == 0)
|
||||||
|
{
|
||||||
|
/* null path --> root */
|
||||||
|
pp->fullp = ".";
|
||||||
|
}
|
||||||
|
|
||||||
return(NULLP);
|
return(NULLP);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
int dbug=0;
|
int dbug=0;
|
||||||
|
|
||||||
const char *testcases[]={ "", ".","filename","/filename","//filename","//dirname/filename","//dirname//filename","dirname//dir3name//","filename\npasswd",
|
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};
|
NULL};
|
||||||
|
|
||||||
static void print_path(PPATH *pp)
|
static void print_path(PPATH *pp)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user