Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
John McEleney
/
mailutils
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
dcd50df5
...
dcd50df50fb73f9eea1042d2b1ac1b06cd5ece70
authored
2001-11-01 15:31:40 +0000
by
Sergey Poznyakoff
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Removed declaration of util_normalize_path().
1 parent
b8f2274d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
67 deletions
imap4d/imap4d.h
imap4d/util.c
imap4d/imap4d.h
View file @
dcd50df
...
...
@@ -80,6 +80,7 @@
#include <mailutils/parse822.h>
#include <mailutils/registrar.h>
#include <mailutils/stream.h>
#include <mailutils/mutil.h>
#ifndef _PATH_MAILDIR
# define _PATH_MAILDIR "/usr/spool/mail"
...
...
@@ -232,7 +233,6 @@ extern int util_parse_internal_date __P((char *date, time_t *timep));
extern
int
util_parse_822_date
__P
((
char
*
date
,
time_t
*
timep
));
extern
int
util_parse_ctime_date
__P
((
const
char
*
date
,
time_t
*
timep
));
extern
char
*
util_strcasestr
__P
((
const
char
*
haystack
,
const
char
*
needle
));
extern
char
*
util_normalize_path
__P
((
char
*
path
,
const
char
*
delim
));
extern
int
util_parse_attributes
__P
((
char
*
items
,
char
**
save
,
int
*
flags
));
#ifdef __cplusplus
...
...
imap4d/util.c
View file @
dcd50df
...
...
@@ -115,71 +115,6 @@ util_tilde_expansion (const char *ref, const char *delim)
return
mu_tilde_expansion
(
ref
,
delim
,
homedir
);
}
/* util_normalize_path: convert pathname containig relative paths specs (../)
into an equivalent absolute path. Strip trailing delimiter if present,
unless it is the only character left. E.g.:
/home/user/../smith --> /home/smith
/home/user/../.. --> /
FIXME: delim is superfluous. The function deals with unix filesystem
paths, so delim should be always "/" */
char
*
util_normalize_path
(
char
*
path
,
const
char
*
delim
)
{
int
len
;
char
*
p
;
if
(
!
path
)
return
path
;
len
=
strlen
(
path
);
/* Empty string is returned as is */
if
(
len
==
0
)
return
path
;
/* delete trailing delimiter if any */
if
(
len
&&
path
[
len
-
1
]
==
delim
[
0
])
path
[
len
-
1
]
=
0
;
/* Eliminate any /../ */
for
(
p
=
strchr
(
path
,
'.'
);
p
;
p
=
strchr
(
p
,
'.'
))
{
if
(
p
>
path
&&
p
[
-
1
]
==
delim
[
0
])
{
if
(
p
[
1
]
==
'.'
&&
(
p
[
2
]
==
0
||
p
[
2
]
==
delim
[
0
]))
/* found */
{
char
*
q
,
*
s
;
/* Find previous delimiter */
for
(
q
=
p
-
2
;
*
q
!=
delim
[
0
]
&&
q
>=
path
;
q
--
)
;
if
(
q
<
path
)
break
;
/* Copy stuff */
s
=
p
+
2
;
p
=
q
;
while
((
*
q
++
=
*
s
++
))
;
continue
;
}
}
p
++
;
}
if
(
path
[
0
]
==
0
)
{
path
[
0
]
=
delim
[
0
];
path
[
1
]
=
0
;
}
return
path
;
}
/* Get the absolute path. */
/* NOTE: Path is allocated and must be free()d by the caller. */
char
*
...
...
@@ -193,7 +128,7 @@ util_getfullpath (char *name, const char *delim)
free
(
p
);
p
=
s
;
}
return
util
_normalize_path
(
p
,
delim
);
return
mu
_normalize_path
(
p
,
delim
);
}
/* Return in set an allocated array contain (n) numbers, for imap messsage set
...
...
Please
register
or
sign in
to post a comment