Commit dcd50df5 dcd50df50fb73f9eea1042d2b1ac1b06cd5ece70 by Sergey Poznyakoff

Removed declaration of util_normalize_path().

1 parent b8f2274d
......@@ -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
......
......@@ -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
......