summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2011-06-08 09:19:15 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2011-06-08 09:19:15 +0300
commit79cbad0dff9d90f4b79fc09f2c5793ed28531608 (patch)
tree809028ce280e8d73622272552a4b07ca2073c110
parent73be707da183c2ed8d59e7da781790c8ee759d1d (diff)
downloadmailutils-79cbad0dff9d90f4b79fc09f2c5793ed28531608.tar.gz
mailutils-79cbad0dff9d90f4b79fc09f2c5793ed28531608.tar.bz2
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.
-rw-r--r--comsat/comsat.c7
-rw-r--r--include/mailutils/diag.h1
-rw-r--r--lib/mailcap.c2
-rw-r--r--libmailutils/cidr/fromstr.c6
-rw-r--r--libmailutils/diag/bt.c16
-rw-r--r--libmailutils/diag/diag.c5
-rw-r--r--libmailutils/diag/wd.c3
-rw-r--r--libmu_sieve/util.c9
-rw-r--r--libproto/mailer/smtp.c1
-rw-r--r--libproto/pop/mbox.c1
-rw-r--r--mail/summary.c18
-rw-r--r--mh/mh_getopt.c2
-rw-r--r--mu/Makefile.am2
-rw-r--r--mu/getarg.c1
-rw-r--r--mu/imap.c1
-rw-r--r--mu/pop.c11
-rw-r--r--testsuite/smtpsend.c1
17 files changed, 49 insertions, 38 deletions
diff --git a/comsat/comsat.c b/comsat/comsat.c
index 2d22414b3..9592e484c 100644
--- a/comsat/comsat.c
+++ b/comsat/comsat.c
@@ -379,9 +379,10 @@ comsat_connection (int fd, struct sockaddr *sa, int salen,
{
char *p = mu_sockaddr_to_astr (sa, salen);
mu_diag_output (MU_DIAG_INFO,
- ngettext ("received %d byte from %s",
- "received %d bytes from %s", rdlen),
- rdlen, p);
+ ngettext ("received %lu byte from %s",
+ "received %lu bytes from %s",
+ (unsigned long) rdlen),
+ (unsigned long) rdlen, p);
mu_diag_output (MU_DIAG_INFO, "string: %s", buffer);
free (p);
}
diff --git a/include/mailutils/diag.h b/include/mailutils/diag.h
index 84e28a368..1983b1392 100644
--- a/include/mailutils/diag.h
+++ b/include/mailutils/diag.h
@@ -30,6 +30,7 @@ extern "C" {
#endif
extern const char *mu_program_name;
+extern const char *mu_full_program_name;
#define MU_DIAG_EMERG MU_LOG_EMERG
#define MU_DIAG_ALERT MU_LOG_ALERT
diff --git a/lib/mailcap.c b/lib/mailcap.c
index be993f1b0..2ffa50dc4 100644
--- a/lib/mailcap.c
+++ b/lib/mailcap.c
@@ -387,7 +387,7 @@ dump_mailcap_entry (mu_mailcap_entry_t entry)
mu_strerror (status));
break;
}
- printf ("fields[%d]: %s\n", i, buffer);
+ printf ("fields[%u]: %s\n", (unsigned) i, buffer);
}
printf ("\n");
}
diff --git a/libmailutils/cidr/fromstr.c b/libmailutils/cidr/fromstr.c
index 4e7a56f80..95ef47c2e 100644
--- a/libmailutils/cidr/fromstr.c
+++ b/libmailutils/cidr/fromstr.c
@@ -18,9 +18,13 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <netdb.h>
#include <string.h>
#include <stdlib.h>
-#include <arpa/inet.h>
#include <mailutils/cidr.h>
#include <mailutils/errno.h>
#include <mailutils/sockaddr.h>
diff --git a/libmailutils/diag/bt.c b/libmailutils/diag/bt.c
index 6bdae8bcf..7f3f25714 100644
--- a/libmailutils/diag/bt.c
+++ b/libmailutils/diag/bt.c
@@ -23,8 +23,9 @@
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
+#include <stdio.h>
#include <string.h>
-#include <argp.h>
+#include <mailutils/diag.h>
#include <mailutils/util.h>
/* Dump a stack trace and terminate current program.
@@ -40,16 +41,13 @@ mu_gdb_bt ()
pid_t pid;
static char buf[1024];
static char fname[1024];
- char *p;
int fd;
char *argv[8];
- p = strrchr (program_invocation_name, '/');
- if (p)
- p++;
- else
- p = program_invocation_name;
- sprintf (fname, "/tmp/mailutils.%s.%lu", p, (unsigned long) master_pid);
+ if (!mu_program_name)
+ abort ();
+ sprintf (fname, "/tmp/mailutils.%s.%lu",
+ mu_program_name, (unsigned long) master_pid);
pid = fork ();
if (pid == (pid_t)-1)
@@ -72,7 +70,7 @@ mu_gdb_bt ()
close (fd);
argv[0] = "/usr/bin/gdb";
- argv[1] = program_invocation_name;
+ argv[1] = (char*) mu_full_program_name;
sprintf (buf, "%lu", (unsigned long) master_pid);
argv[2] = buf;
argv[3] = "-ex";
diff --git a/libmailutils/diag/diag.c b/libmailutils/diag/diag.c
index 06f3a97bf..f8cd53f87 100644
--- a/libmailutils/diag/diag.c
+++ b/libmailutils/diag/diag.c
@@ -31,12 +31,14 @@
#include <mailutils/stream.h>
const char *mu_program_name;
+const char *mu_full_program_name;
void
mu_set_program_name (const char *name)
{
const char *progname;
+ mu_full_program_name = name;
if (!name)
progname = name;
else
@@ -86,7 +88,8 @@ mu_diag_at_locus (int level, struct mu_locus const *loc, const char *fmt, ...)
va_start (ap, fmt);
mu_stream_printf (mu_strerr, "\033f<%d>%s\033l<%u>\033c<%u>",
- strlen (loc->mu_file), loc->mu_file, loc->mu_line,
+ (unsigned) strlen (loc->mu_file), loc->mu_file,
+ loc->mu_line,
loc->mu_col);
mu_diag_voutput (level, fmt, ap);
va_end (ap);
diff --git a/libmailutils/diag/wd.c b/libmailutils/diag/wd.c
index 9b78c12f6..0ccfd06b6 100644
--- a/libmailutils/diag/wd.c
+++ b/libmailutils/diag/wd.c
@@ -20,7 +20,6 @@
#endif
#include <unistd.h>
-#include <argp.h>
#include <mailutils/diag.h>
/* A debugging hook.
@@ -46,7 +45,7 @@ mu_wd (unsigned to)
(unsigned long) pid);
mu_diag_output (MU_DIAG_CRIT,
"to attach: gdb -ex 'set variable mu_wd::_count_down=0' %s %lu",
- program_invocation_name, (unsigned long) pid);
+ mu_full_program_name, (unsigned long) pid);
if (to)
{
_count_down = to;
diff --git a/libmu_sieve/util.c b/libmu_sieve/util.c
index 154c2c364..1fa73787c 100644
--- a/libmu_sieve/util.c
+++ b/libmu_sieve/util.c
@@ -213,7 +213,8 @@ mu_sieve_error (mu_sieve_machine_t mach, const char *fmt, ...)
if (mach->locus.mu_file)
mu_stream_printf (mach->errstream, "\033O<%d>\033f<%u>%s\033l<%u>",
MU_LOGMODE_LOCUS,
- strlen (mach->locus.mu_file), mach->locus.mu_file,
+ (unsigned) strlen (mach->locus.mu_file),
+ mach->locus.mu_file,
mach->locus.mu_line);
if (mach->identifier)
mu_stream_printf (mach->errstream, "%s: ", mach->identifier);
@@ -238,7 +239,8 @@ mu_sieve_debug (mu_sieve_machine_t mach, const char *fmt, ...)
if (mach->locus.mu_file)
mu_stream_printf (mach->errstream, "\033O<%d>\033f<%u>%s\033l<%u>",
MU_LOGMODE_LOCUS,
- strlen (mach->locus.mu_file), mach->locus.mu_file,
+ (unsigned) strlen (mach->locus.mu_file),
+ mach->locus.mu_file,
mach->locus.mu_line);
mu_stream_vprintf (mach->errstream, fmt, ap);
mu_stream_write (mach->errstream, "\n", 1, NULL);
@@ -258,7 +260,8 @@ mu_sieve_log_action (mu_sieve_machine_t mach, const char *action,
if (mach->locus.mu_file)
mu_stream_printf (mach->errstream, "\033O<%d>\033f<%u>%s\033l<%u>",
MU_LOGMODE_LOCUS,
- strlen (mach->locus.mu_file), mach->locus.mu_file,
+ (unsigned) strlen (mach->locus.mu_file),
+ mach->locus.mu_file,
mach->locus.mu_line);
mach->logger (mach->data, mach->errstream, mach->msgno, mach->msg,
action, fmt, ap);
diff --git a/libproto/mailer/smtp.c b/libproto/mailer/smtp.c
index 6487b6765..7177f3b7d 100644
--- a/libproto/mailer/smtp.c
+++ b/libproto/mailer/smtp.c
@@ -30,6 +30,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <netinet/in.h>
#include <mailutils/nls.h>
#include <mailutils/address.h>
diff --git a/libproto/pop/mbox.c b/libproto/pop/mbox.c
index b3a020356..067d244b7 100644
--- a/libproto/pop/mbox.c
+++ b/libproto/pop/mbox.c
@@ -28,6 +28,7 @@
#include <sys/types.h>
#include <unistd.h>
#include <netdb.h>
+#include <netinet/in.h>
#include <mailutils/pop3.h>
#include <mailutils/attribute.h>
diff --git a/mail/summary.c b/mail/summary.c
index 2339636a6..072a25f76 100644
--- a/mail/summary.c
+++ b/mail/summary.c
@@ -28,8 +28,8 @@ mail_summary (int argc MU_ARG_UNUSED, char **argv MU_ARG_UNUSED)
mu_attribute_t attr;
size_t msgno;
size_t count = 0;
- int mseen = 0, mnew = 0, mdelete = 0;
- int first_new = 0, first_unread = 0;
+ unsigned long mseen = 0, mnew = 0, mdelete = 0;
+ size_t first_new = 0, first_unread = 0;
mu_mailbox_messages_count (mbox, &count);
for (msgno = 1; msgno <= count; msgno++)
@@ -62,17 +62,15 @@ mail_summary (int argc MU_ARG_UNUSED, char **argv MU_ARG_UNUSED)
mu_mailbox_get_url (mbox, &url);
mu_printf ("\"%s\": ", util_url_to_string (url));
}
- mu_printf (
- ngettext ("%d message", "%d messages", count), count);
+ mu_printf (ngettext ("%lu message", "%lu messages",
+ (unsigned long) count), (unsigned long) count);
if (mnew > 0)
- mu_printf (ngettext (" %d new", " %d new", mnew), mnew);
+ mu_printf (ngettext (" %lu new", " %lu new", mnew), mnew);
if (mseen > 0)
- mu_printf (ngettext (" %d unread", " %d unread", mseen),
- mseen);
+ mu_printf (ngettext (" %lu unread", " %lu unread", mseen), mseen);
if (mdelete > 0)
- mu_printf (
- ngettext (" %d deleted", " %d deleted", mdelete),
- mdelete);
+ mu_printf (ngettext (" %lu deleted", " %lu deleted", mdelete),
+ mdelete);
mu_printf ("\n");
/* Set the cursor. */
diff --git a/mh/mh_getopt.c b/mh/mh_getopt.c
index 3399fb47c..7f911a376 100644
--- a/mh/mh_getopt.c
+++ b/mh/mh_getopt.c
@@ -135,7 +135,7 @@ mh_help (struct mh_option *mh_opt, const char *doc)
printf ("[no]");
if (len > p->match_len)
printf ("(%*.*s)%s",
- p->match_len, p->match_len, p->opt,
+ (int) p->match_len, (int) p->match_len, p->opt,
p->opt + p->match_len);
else
printf ("%s", p->opt);
diff --git a/mu/Makefile.am b/mu/Makefile.am
index f7fdfa46c..5534d0343 100644
--- a/mu/Makefile.am
+++ b/mu/Makefile.am
@@ -80,7 +80,7 @@ AM_CPPFLAGS = \
-DI18NLIBS="\"$(LIBINTL)\""
BUILT_SOURCES=mu-setup.c mu-setup.h
-EXTRA_DIST=mu-setup.c mu-setup.h template.c
+EXTRA_DIST=mu-setup.awk mu-setup.c mu-setup.h template.c
mu-setup.h: Makefile.am $(MODULES) $(IDLE_MODULES)
$(AM_V_GEN)$(AWK) -f $(top_srcdir)/mu/mu-setup.awk -v mode=h \
diff --git a/mu/getarg.c b/mu/getarg.c
index 6e6267cee..b148b9c79 100644
--- a/mu/getarg.c
+++ b/mu/getarg.c
@@ -21,6 +21,7 @@
#include <string.h>
#include <unistd.h>
#include <netdb.h>
+#include <netinet/in.h>
#include <mailutils/mailutils.h>
#include "mu.h"
diff --git a/mu/imap.c b/mu/imap.c
index 4fccd4d17..c531d9b80 100644
--- a/mu/imap.c
+++ b/mu/imap.c
@@ -22,6 +22,7 @@
#include <termios.h>
#include <unistd.h>
#include <netdb.h>
+#include <netinet/in.h>
#include <mailutils/mailutils.h>
#include <mailutils/imap.h>
#include "mu.h"
diff --git a/mu/pop.c b/mu/pop.c
index c76f00931..b0d71287d 100644
--- a/mu/pop.c
+++ b/mu/pop.c
@@ -501,13 +501,12 @@ com_connect (int argc, char **argv)
{
if (strcmp (argv[i], "-tls") == 0)
{
- if (WITH_TLS)
+#ifdef WITH_TLS
tls = 1;
- else
- {
- mu_error ("TLS not supported");
- return 0;
- }
+#else
+ mu_error ("TLS not supported");
+ return 0;
+#endif
}
else
break;
diff --git a/testsuite/smtpsend.c b/testsuite/smtpsend.c
index 2fe2d9f52..b4f37543c 100644
--- a/testsuite/smtpsend.c
+++ b/testsuite/smtpsend.c
@@ -21,6 +21,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <netdb.h>
+#include <netinet/in.h>
#include <mailutils/cctype.h>
#include <mailutils/mailutils.h>
#include <mailutils/smtp.h>

Return to:

Send suggestions and report system problems to the System administrator.