Various minor fixes.
* include/mailutils/diag.h (mu_full_program_name): New extern. * libmailutils/diag/diag.c (mu_full_program_name): New global. (mu_set_program_name): Set mu_full_program_name. (mu_diag_at_locus): Fix format specifier. * libmailutils/diag/bt.c: Use mu_full_program_name instead of program_invocation_name. * libmailutils/diag/wd.c (mu_wd): Likewise. * comsat/comsat.c: Fix format specifiers. * lib/mailcap.c: Likewise. * libmu_sieve/util.c: Cast formatted arguments to match format specs. * mh/mh_getopt.c: Likewise. * libmailutils/cidr/fromstr.c: Add missing includes. * libproto/mailer/smtp.c: Likewise. * libproto/pop/mbox.c: Likewise. * testsuite/smtpsend.c: Likewise. * mu/getarg.c: Likewise. * mu/imap.c: Likewise. * mu/pop.c (com_connect): Protect TLS code with #ifdef. * mu/Makefile.am (EXTRA_DIST): Add mu-setup.awk. * mail/summary.c (mail_summary): Fix data types of the counters.
Showing
17 changed files
with
46 additions
and
35 deletions
... | @@ -379,9 +379,10 @@ comsat_connection (int fd, struct sockaddr *sa, int salen, | ... | @@ -379,9 +379,10 @@ comsat_connection (int fd, struct sockaddr *sa, int salen, |
379 | { | 379 | { |
380 | char *p = mu_sockaddr_to_astr (sa, salen); | 380 | char *p = mu_sockaddr_to_astr (sa, salen); |
381 | mu_diag_output (MU_DIAG_INFO, | 381 | mu_diag_output (MU_DIAG_INFO, |
382 | ngettext ("received %d byte from %s", | 382 | ngettext ("received %lu byte from %s", |
383 | "received %d bytes from %s", rdlen), | 383 | "received %lu bytes from %s", |
384 | rdlen, p); | 384 | (unsigned long) rdlen), |
385 | (unsigned long) rdlen, p); | ||
385 | mu_diag_output (MU_DIAG_INFO, "string: %s", buffer); | 386 | mu_diag_output (MU_DIAG_INFO, "string: %s", buffer); |
386 | free (p); | 387 | free (p); |
387 | } | 388 | } | ... | ... |
... | @@ -30,6 +30,7 @@ extern "C" { | ... | @@ -30,6 +30,7 @@ extern "C" { |
30 | #endif | 30 | #endif |
31 | 31 | ||
32 | extern const char *mu_program_name; | 32 | extern const char *mu_program_name; |
33 | extern const char *mu_full_program_name; | ||
33 | 34 | ||
34 | #define MU_DIAG_EMERG MU_LOG_EMERG | 35 | #define MU_DIAG_EMERG MU_LOG_EMERG |
35 | #define MU_DIAG_ALERT MU_LOG_ALERT | 36 | #define MU_DIAG_ALERT MU_LOG_ALERT | ... | ... |
... | @@ -387,7 +387,7 @@ dump_mailcap_entry (mu_mailcap_entry_t entry) | ... | @@ -387,7 +387,7 @@ dump_mailcap_entry (mu_mailcap_entry_t entry) |
387 | mu_strerror (status)); | 387 | mu_strerror (status)); |
388 | break; | 388 | break; |
389 | } | 389 | } |
390 | printf ("fields[%d]: %s\n", i, buffer); | 390 | printf ("fields[%u]: %s\n", (unsigned) i, buffer); |
391 | } | 391 | } |
392 | printf ("\n"); | 392 | printf ("\n"); |
393 | } | 393 | } | ... | ... |
... | @@ -18,9 +18,13 @@ | ... | @@ -18,9 +18,13 @@ |
18 | #ifdef HAVE_CONFIG_H | 18 | #ifdef HAVE_CONFIG_H |
19 | # include <config.h> | 19 | # include <config.h> |
20 | #endif | 20 | #endif |
21 | #include <sys/types.h> | ||
22 | #include <sys/socket.h> | ||
23 | #include <netinet/in.h> | ||
24 | #include <arpa/inet.h> | ||
25 | #include <netdb.h> | ||
21 | #include <string.h> | 26 | #include <string.h> |
22 | #include <stdlib.h> | 27 | #include <stdlib.h> |
23 | #include <arpa/inet.h> | ||
24 | #include <mailutils/cidr.h> | 28 | #include <mailutils/cidr.h> |
25 | #include <mailutils/errno.h> | 29 | #include <mailutils/errno.h> |
26 | #include <mailutils/sockaddr.h> | 30 | #include <mailutils/sockaddr.h> | ... | ... |
... | @@ -23,8 +23,9 @@ | ... | @@ -23,8 +23,9 @@ |
23 | #include <fcntl.h> | 23 | #include <fcntl.h> |
24 | #include <unistd.h> | 24 | #include <unistd.h> |
25 | #include <stdlib.h> | 25 | #include <stdlib.h> |
26 | #include <stdio.h> | ||
26 | #include <string.h> | 27 | #include <string.h> |
27 | #include <argp.h> | 28 | #include <mailutils/diag.h> |
28 | #include <mailutils/util.h> | 29 | #include <mailutils/util.h> |
29 | 30 | ||
30 | /* Dump a stack trace and terminate current program. | 31 | /* Dump a stack trace and terminate current program. |
... | @@ -40,16 +41,13 @@ mu_gdb_bt () | ... | @@ -40,16 +41,13 @@ mu_gdb_bt () |
40 | pid_t pid; | 41 | pid_t pid; |
41 | static char buf[1024]; | 42 | static char buf[1024]; |
42 | static char fname[1024]; | 43 | static char fname[1024]; |
43 | char *p; | ||
44 | int fd; | 44 | int fd; |
45 | char *argv[8]; | 45 | char *argv[8]; |
46 | 46 | ||
47 | p = strrchr (program_invocation_name, '/'); | 47 | if (!mu_program_name) |
48 | if (p) | 48 | abort (); |
49 | p++; | 49 | sprintf (fname, "/tmp/mailutils.%s.%lu", |
50 | else | 50 | mu_program_name, (unsigned long) master_pid); |
51 | p = program_invocation_name; | ||
52 | sprintf (fname, "/tmp/mailutils.%s.%lu", p, (unsigned long) master_pid); | ||
53 | 51 | ||
54 | pid = fork (); | 52 | pid = fork (); |
55 | if (pid == (pid_t)-1) | 53 | if (pid == (pid_t)-1) |
... | @@ -72,7 +70,7 @@ mu_gdb_bt () | ... | @@ -72,7 +70,7 @@ mu_gdb_bt () |
72 | close (fd); | 70 | close (fd); |
73 | 71 | ||
74 | argv[0] = "/usr/bin/gdb"; | 72 | argv[0] = "/usr/bin/gdb"; |
75 | argv[1] = program_invocation_name; | 73 | argv[1] = (char*) mu_full_program_name; |
76 | sprintf (buf, "%lu", (unsigned long) master_pid); | 74 | sprintf (buf, "%lu", (unsigned long) master_pid); |
77 | argv[2] = buf; | 75 | argv[2] = buf; |
78 | argv[3] = "-ex"; | 76 | argv[3] = "-ex"; | ... | ... |
... | @@ -31,12 +31,14 @@ | ... | @@ -31,12 +31,14 @@ |
31 | #include <mailutils/stream.h> | 31 | #include <mailutils/stream.h> |
32 | 32 | ||
33 | const char *mu_program_name; | 33 | const char *mu_program_name; |
34 | const char *mu_full_program_name; | ||
34 | 35 | ||
35 | void | 36 | void |
36 | mu_set_program_name (const char *name) | 37 | mu_set_program_name (const char *name) |
37 | { | 38 | { |
38 | const char *progname; | 39 | const char *progname; |
39 | 40 | ||
41 | mu_full_program_name = name; | ||
40 | if (!name) | 42 | if (!name) |
41 | progname = name; | 43 | progname = name; |
42 | else | 44 | else |
... | @@ -86,7 +88,8 @@ mu_diag_at_locus (int level, struct mu_locus const *loc, const char *fmt, ...) | ... | @@ -86,7 +88,8 @@ mu_diag_at_locus (int level, struct mu_locus const *loc, const char *fmt, ...) |
86 | 88 | ||
87 | va_start (ap, fmt); | 89 | va_start (ap, fmt); |
88 | mu_stream_printf (mu_strerr, "\033f<%d>%s\033l<%u>\033c<%u>", | 90 | mu_stream_printf (mu_strerr, "\033f<%d>%s\033l<%u>\033c<%u>", |
89 | strlen (loc->mu_file), loc->mu_file, loc->mu_line, | 91 | (unsigned) strlen (loc->mu_file), loc->mu_file, |
92 | loc->mu_line, | ||
90 | loc->mu_col); | 93 | loc->mu_col); |
91 | mu_diag_voutput (level, fmt, ap); | 94 | mu_diag_voutput (level, fmt, ap); |
92 | va_end (ap); | 95 | va_end (ap); | ... | ... |
... | @@ -20,7 +20,6 @@ | ... | @@ -20,7 +20,6 @@ |
20 | #endif | 20 | #endif |
21 | 21 | ||
22 | #include <unistd.h> | 22 | #include <unistd.h> |
23 | #include <argp.h> | ||
24 | #include <mailutils/diag.h> | 23 | #include <mailutils/diag.h> |
25 | 24 | ||
26 | /* A debugging hook. | 25 | /* A debugging hook. |
... | @@ -46,7 +45,7 @@ mu_wd (unsigned to) | ... | @@ -46,7 +45,7 @@ mu_wd (unsigned to) |
46 | (unsigned long) pid); | 45 | (unsigned long) pid); |
47 | mu_diag_output (MU_DIAG_CRIT, | 46 | mu_diag_output (MU_DIAG_CRIT, |
48 | "to attach: gdb -ex 'set variable mu_wd::_count_down=0' %s %lu", | 47 | "to attach: gdb -ex 'set variable mu_wd::_count_down=0' %s %lu", |
49 | program_invocation_name, (unsigned long) pid); | 48 | mu_full_program_name, (unsigned long) pid); |
50 | if (to) | 49 | if (to) |
51 | { | 50 | { |
52 | _count_down = to; | 51 | _count_down = to; | ... | ... |
... | @@ -213,7 +213,8 @@ mu_sieve_error (mu_sieve_machine_t mach, const char *fmt, ...) | ... | @@ -213,7 +213,8 @@ mu_sieve_error (mu_sieve_machine_t mach, const char *fmt, ...) |
213 | if (mach->locus.mu_file) | 213 | if (mach->locus.mu_file) |
214 | mu_stream_printf (mach->errstream, "\033O<%d>\033f<%u>%s\033l<%u>", | 214 | mu_stream_printf (mach->errstream, "\033O<%d>\033f<%u>%s\033l<%u>", |
215 | MU_LOGMODE_LOCUS, | 215 | MU_LOGMODE_LOCUS, |
216 | strlen (mach->locus.mu_file), mach->locus.mu_file, | 216 | (unsigned) strlen (mach->locus.mu_file), |
217 | mach->locus.mu_file, | ||
217 | mach->locus.mu_line); | 218 | mach->locus.mu_line); |
218 | if (mach->identifier) | 219 | if (mach->identifier) |
219 | mu_stream_printf (mach->errstream, "%s: ", mach->identifier); | 220 | mu_stream_printf (mach->errstream, "%s: ", mach->identifier); |
... | @@ -238,7 +239,8 @@ mu_sieve_debug (mu_sieve_machine_t mach, const char *fmt, ...) | ... | @@ -238,7 +239,8 @@ mu_sieve_debug (mu_sieve_machine_t mach, const char *fmt, ...) |
238 | if (mach->locus.mu_file) | 239 | if (mach->locus.mu_file) |
239 | mu_stream_printf (mach->errstream, "\033O<%d>\033f<%u>%s\033l<%u>", | 240 | mu_stream_printf (mach->errstream, "\033O<%d>\033f<%u>%s\033l<%u>", |
240 | MU_LOGMODE_LOCUS, | 241 | MU_LOGMODE_LOCUS, |
241 | strlen (mach->locus.mu_file), mach->locus.mu_file, | 242 | (unsigned) strlen (mach->locus.mu_file), |
243 | mach->locus.mu_file, | ||
242 | mach->locus.mu_line); | 244 | mach->locus.mu_line); |
243 | mu_stream_vprintf (mach->errstream, fmt, ap); | 245 | mu_stream_vprintf (mach->errstream, fmt, ap); |
244 | mu_stream_write (mach->errstream, "\n", 1, NULL); | 246 | mu_stream_write (mach->errstream, "\n", 1, NULL); |
... | @@ -258,7 +260,8 @@ mu_sieve_log_action (mu_sieve_machine_t mach, const char *action, | ... | @@ -258,7 +260,8 @@ mu_sieve_log_action (mu_sieve_machine_t mach, const char *action, |
258 | if (mach->locus.mu_file) | 260 | if (mach->locus.mu_file) |
259 | mu_stream_printf (mach->errstream, "\033O<%d>\033f<%u>%s\033l<%u>", | 261 | mu_stream_printf (mach->errstream, "\033O<%d>\033f<%u>%s\033l<%u>", |
260 | MU_LOGMODE_LOCUS, | 262 | MU_LOGMODE_LOCUS, |
261 | strlen (mach->locus.mu_file), mach->locus.mu_file, | 263 | (unsigned) strlen (mach->locus.mu_file), |
264 | mach->locus.mu_file, | ||
262 | mach->locus.mu_line); | 265 | mach->locus.mu_line); |
263 | mach->logger (mach->data, mach->errstream, mach->msgno, mach->msg, | 266 | mach->logger (mach->data, mach->errstream, mach->msgno, mach->msg, |
264 | action, fmt, ap); | 267 | action, fmt, ap); | ... | ... |
... | @@ -30,6 +30,7 @@ | ... | @@ -30,6 +30,7 @@ |
30 | #include <stdlib.h> | 30 | #include <stdlib.h> |
31 | #include <string.h> | 31 | #include <string.h> |
32 | #include <unistd.h> | 32 | #include <unistd.h> |
33 | #include <netinet/in.h> | ||
33 | 34 | ||
34 | #include <mailutils/nls.h> | 35 | #include <mailutils/nls.h> |
35 | #include <mailutils/address.h> | 36 | #include <mailutils/address.h> | ... | ... |
... | @@ -28,6 +28,7 @@ | ... | @@ -28,6 +28,7 @@ |
28 | #include <sys/types.h> | 28 | #include <sys/types.h> |
29 | #include <unistd.h> | 29 | #include <unistd.h> |
30 | #include <netdb.h> | 30 | #include <netdb.h> |
31 | #include <netinet/in.h> | ||
31 | 32 | ||
32 | #include <mailutils/pop3.h> | 33 | #include <mailutils/pop3.h> |
33 | #include <mailutils/attribute.h> | 34 | #include <mailutils/attribute.h> | ... | ... |
... | @@ -28,8 +28,8 @@ mail_summary (int argc MU_ARG_UNUSED, char **argv MU_ARG_UNUSED) | ... | @@ -28,8 +28,8 @@ mail_summary (int argc MU_ARG_UNUSED, char **argv MU_ARG_UNUSED) |
28 | mu_attribute_t attr; | 28 | mu_attribute_t attr; |
29 | size_t msgno; | 29 | size_t msgno; |
30 | size_t count = 0; | 30 | size_t count = 0; |
31 | int mseen = 0, mnew = 0, mdelete = 0; | 31 | unsigned long mseen = 0, mnew = 0, mdelete = 0; |
32 | int first_new = 0, first_unread = 0; | 32 | size_t first_new = 0, first_unread = 0; |
33 | 33 | ||
34 | mu_mailbox_messages_count (mbox, &count); | 34 | mu_mailbox_messages_count (mbox, &count); |
35 | for (msgno = 1; msgno <= count; msgno++) | 35 | for (msgno = 1; msgno <= count; msgno++) |
... | @@ -62,16 +62,14 @@ mail_summary (int argc MU_ARG_UNUSED, char **argv MU_ARG_UNUSED) | ... | @@ -62,16 +62,14 @@ mail_summary (int argc MU_ARG_UNUSED, char **argv MU_ARG_UNUSED) |
62 | mu_mailbox_get_url (mbox, &url); | 62 | mu_mailbox_get_url (mbox, &url); |
63 | mu_printf ("\"%s\": ", util_url_to_string (url)); | 63 | mu_printf ("\"%s\": ", util_url_to_string (url)); |
64 | } | 64 | } |
65 | mu_printf ( | 65 | mu_printf (ngettext ("%lu message", "%lu messages", |
66 | ngettext ("%d message", "%d messages", count), count); | 66 | (unsigned long) count), (unsigned long) count); |
67 | if (mnew > 0) | 67 | if (mnew > 0) |
68 | mu_printf (ngettext (" %d new", " %d new", mnew), mnew); | 68 | mu_printf (ngettext (" %lu new", " %lu new", mnew), mnew); |
69 | if (mseen > 0) | 69 | if (mseen > 0) |
70 | mu_printf (ngettext (" %d unread", " %d unread", mseen), | 70 | mu_printf (ngettext (" %lu unread", " %lu unread", mseen), mseen); |
71 | mseen); | ||
72 | if (mdelete > 0) | 71 | if (mdelete > 0) |
73 | mu_printf ( | 72 | mu_printf (ngettext (" %lu deleted", " %lu deleted", mdelete), |
74 | ngettext (" %d deleted", " %d deleted", mdelete), | ||
75 | mdelete); | 73 | mdelete); |
76 | mu_printf ("\n"); | 74 | mu_printf ("\n"); |
77 | 75 | ... | ... |
... | @@ -135,7 +135,7 @@ mh_help (struct mh_option *mh_opt, const char *doc) | ... | @@ -135,7 +135,7 @@ mh_help (struct mh_option *mh_opt, const char *doc) |
135 | printf ("[no]"); | 135 | printf ("[no]"); |
136 | if (len > p->match_len) | 136 | if (len > p->match_len) |
137 | printf ("(%*.*s)%s", | 137 | printf ("(%*.*s)%s", |
138 | p->match_len, p->match_len, p->opt, | 138 | (int) p->match_len, (int) p->match_len, p->opt, |
139 | p->opt + p->match_len); | 139 | p->opt + p->match_len); |
140 | else | 140 | else |
141 | printf ("%s", p->opt); | 141 | printf ("%s", p->opt); | ... | ... |
... | @@ -80,7 +80,7 @@ AM_CPPFLAGS = \ | ... | @@ -80,7 +80,7 @@ AM_CPPFLAGS = \ |
80 | -DI18NLIBS="\"$(LIBINTL)\"" | 80 | -DI18NLIBS="\"$(LIBINTL)\"" |
81 | 81 | ||
82 | BUILT_SOURCES=mu-setup.c mu-setup.h | 82 | BUILT_SOURCES=mu-setup.c mu-setup.h |
83 | EXTRA_DIST=mu-setup.c mu-setup.h template.c | 83 | EXTRA_DIST=mu-setup.awk mu-setup.c mu-setup.h template.c |
84 | 84 | ||
85 | mu-setup.h: Makefile.am $(MODULES) $(IDLE_MODULES) | 85 | mu-setup.h: Makefile.am $(MODULES) $(IDLE_MODULES) |
86 | $(AM_V_GEN)$(AWK) -f $(top_srcdir)/mu/mu-setup.awk -v mode=h \ | 86 | $(AM_V_GEN)$(AWK) -f $(top_srcdir)/mu/mu-setup.awk -v mode=h \ | ... | ... |
... | @@ -21,6 +21,7 @@ | ... | @@ -21,6 +21,7 @@ |
21 | #include <string.h> | 21 | #include <string.h> |
22 | #include <unistd.h> | 22 | #include <unistd.h> |
23 | #include <netdb.h> | 23 | #include <netdb.h> |
24 | #include <netinet/in.h> | ||
24 | #include <mailutils/mailutils.h> | 25 | #include <mailutils/mailutils.h> |
25 | #include "mu.h" | 26 | #include "mu.h" |
26 | 27 | ... | ... |
... | @@ -22,6 +22,7 @@ | ... | @@ -22,6 +22,7 @@ |
22 | #include <termios.h> | 22 | #include <termios.h> |
23 | #include <unistd.h> | 23 | #include <unistd.h> |
24 | #include <netdb.h> | 24 | #include <netdb.h> |
25 | #include <netinet/in.h> | ||
25 | #include <mailutils/mailutils.h> | 26 | #include <mailutils/mailutils.h> |
26 | #include <mailutils/imap.h> | 27 | #include <mailutils/imap.h> |
27 | #include "mu.h" | 28 | #include "mu.h" | ... | ... |
... | @@ -501,13 +501,12 @@ com_connect (int argc, char **argv) | ... | @@ -501,13 +501,12 @@ com_connect (int argc, char **argv) |
501 | { | 501 | { |
502 | if (strcmp (argv[i], "-tls") == 0) | 502 | if (strcmp (argv[i], "-tls") == 0) |
503 | { | 503 | { |
504 | if (WITH_TLS) | 504 | #ifdef WITH_TLS |
505 | tls = 1; | 505 | tls = 1; |
506 | else | 506 | #else |
507 | { | ||
508 | mu_error ("TLS not supported"); | 507 | mu_error ("TLS not supported"); |
509 | return 0; | 508 | return 0; |
510 | } | 509 | #endif |
511 | } | 510 | } |
512 | else | 511 | else |
513 | break; | 512 | break; | ... | ... |
... | @@ -21,6 +21,7 @@ | ... | @@ -21,6 +21,7 @@ |
21 | #include <stdio.h> | 21 | #include <stdio.h> |
22 | #include <stdlib.h> | 22 | #include <stdlib.h> |
23 | #include <netdb.h> | 23 | #include <netdb.h> |
24 | #include <netinet/in.h> | ||
24 | #include <mailutils/cctype.h> | 25 | #include <mailutils/cctype.h> |
25 | #include <mailutils/mailutils.h> | 26 | #include <mailutils/mailutils.h> |
26 | #include <mailutils/smtp.h> | 27 | #include <mailutils/smtp.h> | ... | ... |
-
Please register or sign in to post a comment