Added base_name() since basename() is not portable.
Some variables in imap4d/* were not initialize.
Showing
4 changed files
with
12 additions
and
10 deletions
... | @@ -21,9 +21,13 @@ | ... | @@ -21,9 +21,13 @@ |
21 | * imap4d/logout.c: Initialise variable sp. | 21 | * imap4d/logout.c: Initialise variable sp. |
22 | * imap4d/noop.c: Initialise variable sp. | 22 | * imap4d/noop.c: Initialise variable sp. |
23 | 23 | ||
24 | * mailbox/attachement.c (message_create_attachment): Use base_name(). | ||
25 | * mailbox/mbx_mbox.c (mbox_tmpfile): Use base_name(). | ||
24 | * configure.in: AC_REP_FUNC(vasprintf). | 26 | * configure.in: AC_REP_FUNC(vasprintf). |
25 | * include/mailutils/Makefile.am: Add property.h, parse822.h. | 27 | * include/mailutils/Makefile.am: Add property.h, parse822.h. |
26 | * lib/vasprintf.c: Taken from libit. | 28 | * lib/vasprintf.c: Taken from libit. |
29 | * lib/basename.c: Taken from libit/fileutils. | ||
30 | * lib/Makefile.am.c: Always use our basename(base_name). | ||
27 | (AM_INIT_AUTOMAKE): Change version to 0.0.9 | 31 | (AM_INIT_AUTOMAKE): Change version to 0.0.9 |
28 | 32 | ||
29 | 2001-04-13 Sam Roberts | 33 | 2001-04-13 Sam Roberts | ... | ... |
1 | noinst_LIBRARIES = libmailutils.a | 1 | noinst_LIBRARIES = libmailutils.a |
2 | 2 | ||
3 | libmailutils_a_SOURCES = getopt.c getopt1.c md5.c getline.c xstrdup.c \ | 3 | libmailutils_a_SOURCES = basename.c getopt.c getopt1.c md5.c getline.c \ |
4 | xmalloc.c argcv.c | 4 | xstrdup.c xmalloc.c argcv.c |
5 | 5 | ||
6 | EXTRA_DIST = alloca.c snprintf.c strtok_r.c xstrtol.c | 6 | EXTRA_DIST = alloca.c snprintf.c strtok_r.c xstrtol.c |
7 | 7 | ||
... | @@ -10,4 +10,4 @@ noinst_HEADERS = getopt.h md5.h getline.h snprintf.h xstrtol.h xalloc.h \ | ... | @@ -10,4 +10,4 @@ noinst_HEADERS = getopt.h md5.h getline.h snprintf.h xstrtol.h xalloc.h \ |
10 | 10 | ||
11 | libmailutils_a_LIBADD = @LIBOBJS@ @ALLOCA@ | 11 | libmailutils_a_LIBADD = @LIBOBJS@ @ALLOCA@ |
12 | 12 | ||
13 | CFLAGS = -Wall -pedantic -g -DTESTING | 13 | CFLAGS = -Wall -pedantic -g | ... | ... |
... | @@ -43,6 +43,7 @@ | ... | @@ -43,6 +43,7 @@ |
43 | 43 | ||
44 | /* FIXME: this should be in a public header. */ | 44 | /* FIXME: this should be in a public header. */ |
45 | extern int message_attachment_filename __P ((message_t, const char **filename)); | 45 | extern int message_attachment_filename __P ((message_t, const char **filename)); |
46 | extern char *base_name __P ((char const *)); | ||
46 | 47 | ||
47 | struct _msg_info { | 48 | struct _msg_info { |
48 | char *buf; | 49 | char *buf; |
... | @@ -76,7 +77,7 @@ int message_create_attachment(const char *content_type, const char *encoding, co | ... | @@ -76,7 +77,7 @@ int message_create_attachment(const char *content_type, const char *encoding, co |
76 | if ( encoding == NULL ) | 77 | if ( encoding == NULL ) |
77 | encoding = "7bit"; | 78 | encoding = "7bit"; |
78 | if ( ( fname = strdup(filename) ) != NULL ) { | 79 | if ( ( fname = strdup(filename) ) != NULL ) { |
79 | name = basename(fname); | 80 | name = base_name(fname); |
80 | if ( ( header = alloca(strlen(MSG_HDR) + strlen(content_type) + strlen(name) * 2 + strlen(encoding) + 1) ) == NULL ) | 81 | if ( ( header = alloca(strlen(MSG_HDR) + strlen(content_type) + strlen(name) * 2 + strlen(encoding) + 1) ) == NULL ) |
81 | ret = ENOMEM; | 82 | ret = ENOMEM; |
82 | else { | 83 | else { | ... | ... |
... | @@ -153,6 +153,8 @@ struct _mbox_data | ... | @@ -153,6 +153,8 @@ struct _mbox_data |
153 | mailbox_t mailbox; /* Back pointer. */ | 153 | mailbox_t mailbox; /* Back pointer. */ |
154 | }; | 154 | }; |
155 | 155 | ||
156 | extern char *base_name __P ((char const *)); | ||
157 | |||
156 | /* Mailbox concrete implementation. */ | 158 | /* Mailbox concrete implementation. */ |
157 | static int mbox_open __P ((mailbox_t, int)); | 159 | static int mbox_open __P ((mailbox_t, int)); |
158 | static int mbox_close __P ((mailbox_t)); | 160 | static int mbox_close __P ((mailbox_t)); |
... | @@ -492,12 +494,7 @@ mbox_tmpfile (mailbox_t mailbox, char **pbox) | ... | @@ -492,12 +494,7 @@ mbox_tmpfile (mailbox_t mailbox, char **pbox) |
492 | # define P_tmpdir "/tmp" | 494 | # define P_tmpdir "/tmp" |
493 | #endif | 495 | #endif |
494 | 496 | ||
495 | /* FIXME: Use a macro for the separator to be portable. */ | 497 | basename = base_name (mud->name); |
496 | basename = strrchr (mud->name, '/'); | ||
497 | if (basename) | ||
498 | basename++; | ||
499 | else | ||
500 | basename = mud->name; | ||
501 | 498 | ||
502 | tmpdir = getenv ("TMPDIR") ? getenv ("TMPDIR") : P_tmpdir; | 499 | tmpdir = getenv ("TMPDIR") ? getenv ("TMPDIR") : P_tmpdir; |
503 | /* (separator + null) == 2 + XXXXXX == 6 + ... */ | 500 | /* (separator + null) == 2 + XXXXXX == 6 + ... */ | ... | ... |
-
Please register or sign in to post a comment