Commit d88edc69 d88edc69d744b6975bf74862eb4f4da906bfcc57 by Alain Magloire

Added base_name() since basename() is not portable.

Some variables in imap4d/* were not initialize.
1 parent ff9293be
......@@ -21,9 +21,13 @@
* imap4d/logout.c: Initialise variable sp.
* imap4d/noop.c: Initialise variable sp.
* mailbox/attachement.c (message_create_attachment): Use base_name().
* mailbox/mbx_mbox.c (mbox_tmpfile): Use base_name().
* configure.in: AC_REP_FUNC(vasprintf).
* include/mailutils/Makefile.am: Add property.h, parse822.h.
* lib/vasprintf.c: Taken from libit.
* lib/basename.c: Taken from libit/fileutils.
* lib/Makefile.am.c: Always use our basename(base_name).
(AM_INIT_AUTOMAKE): Change version to 0.0.9
2001-04-13 Sam Roberts
......
noinst_LIBRARIES = libmailutils.a
libmailutils_a_SOURCES = getopt.c getopt1.c md5.c getline.c xstrdup.c \
xmalloc.c argcv.c
libmailutils_a_SOURCES = basename.c getopt.c getopt1.c md5.c getline.c \
xstrdup.c xmalloc.c argcv.c
EXTRA_DIST = alloca.c snprintf.c strtok_r.c xstrtol.c
......@@ -10,4 +10,4 @@ noinst_HEADERS = getopt.h md5.h getline.h snprintf.h xstrtol.h xalloc.h \
libmailutils_a_LIBADD = @LIBOBJS@ @ALLOCA@
CFLAGS = -Wall -pedantic -g -DTESTING
CFLAGS = -Wall -pedantic -g
......
......@@ -43,6 +43,7 @@
/* FIXME: this should be in a public header. */
extern int message_attachment_filename __P ((message_t, const char **filename));
extern char *base_name __P ((char const *));
struct _msg_info {
char *buf;
......@@ -76,7 +77,7 @@ int message_create_attachment(const char *content_type, const char *encoding, co
if ( encoding == NULL )
encoding = "7bit";
if ( ( fname = strdup(filename) ) != NULL ) {
name = basename(fname);
name = base_name(fname);
if ( ( header = alloca(strlen(MSG_HDR) + strlen(content_type) + strlen(name) * 2 + strlen(encoding) + 1) ) == NULL )
ret = ENOMEM;
else {
......
......@@ -153,6 +153,8 @@ struct _mbox_data
mailbox_t mailbox; /* Back pointer. */
};
extern char *base_name __P ((char const *));
/* Mailbox concrete implementation. */
static int mbox_open __P ((mailbox_t, int));
static int mbox_close __P ((mailbox_t));
......@@ -492,12 +494,7 @@ mbox_tmpfile (mailbox_t mailbox, char **pbox)
# define P_tmpdir "/tmp"
#endif
/* FIXME: Use a macro for the separator to be portable. */
basename = strrchr (mud->name, '/');
if (basename)
basename++;
else
basename = mud->name;
basename = base_name (mud->name);
tmpdir = getenv ("TMPDIR") ? getenv ("TMPDIR") : P_tmpdir;
/* (separator + null) == 2 + XXXXXX == 6 + ... */
......