summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org.ua>2008-02-04 21:49:35 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2008-02-04 21:49:35 (GMT)
commit77757c8d84e0fdde04be923c8a7f3ea8cd7bcf39 (patch) (side-by-side diff)
tree63683ad99b6d4ee2ec858255efa14a4b81a07b11
parent6460de7d7ac87145594f28a416f926f830df9b8c (diff)
downloadmailfromd-77757c8d84e0fdde04be923c8a7f3ea8cd7bcf39.tar.gz
mailfromd-77757c8d84e0fdde04be923c8a7f3ea8cd7bcf39.tar.bz2
* configure.ac: Check for locale.h
* src/db.c, src/bi_sprintf.m4, src/prog.c, src/bi_db.m4, src/engine.c: Fix format arguments (ported from branches/gmach@{2008-01-28 and 2008-01-09). * src/main.c, src/mtasim.c: Include locale.h git-svn-id: file:///svnroot/mailfromd/trunk@1603 7a8a7f39-df28-0410-adc6-e0d955640f24
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--ChangeLog8
-rw-r--r--configure.ac2
-rw-r--r--gacopyz/server.c5
-rw-r--r--src/bi_db.m415
-rw-r--r--src/bi_sprintf.m46
-rw-r--r--src/db.c8
-rw-r--r--src/engine.c2
-rw-r--r--src/main.c5
-rw-r--r--src/mtasim.c5
-rw-r--r--src/prog.c8
10 files changed, 38 insertions, 26 deletions
diff --git a/ChangeLog b/ChangeLog
index e547c40..0335e49 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,14 @@
+2008-02-04 Sergey Poznyakoff <gray@gnu.org.ua>
+
+ * configure.ac: Check for locale.h
+ * src/db.c, src/bi_sprintf.m4, src/prog.c, src/bi_db.m4,
+ src/engine.c: Fix format arguments (ported from
+ branches/gmach@{2008-01-28 and 2008-01-09).
+ * src/main.c, src/mtasim.c: Include locale.h
+
2008-01-21 Sergey Poznyakoff <gray@gnu.org.ua>
* src/symtab.c: Ported r1584 from branches/gmach.
* NEWS: Update.
* doc/mailfromd.texi: Updated.
* configure.ac: Version 4.3 (preparing for the release).
diff --git a/configure.ac b/configure.ac
index 056f46d..5972335 100644
--- a/configure.ac
+++ b/configure.ac
@@ -44,13 +44,13 @@ AC_PROG_LEX
# Checks for libraries.
AC_CHECK_LIB(resolv, res_query)
# Checks for header files.
AC_HEADER_STDC
-AC_CHECK_HEADERS([stdlib.h unistd.h sysexits.h paths.h])
+AC_CHECK_HEADERS([stdlib.h unistd.h sysexits.h paths.h locale.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_SIGNAL
AC_TYPE_SIZE_T
AC_CHECK_SIZEOF(uint32_t)
AC_CHECK_SIZEOF(unsigned long)
diff --git a/gacopyz/server.c b/gacopyz/server.c
index a4a05e4..1c1f108 100644
--- a/gacopyz/server.c
+++ b/gacopyz/server.c
@@ -1,8 +1,8 @@
/* This file is part of gacopyz.
- Copyright (C) 2007 Sergey Poznyakoff
+ Copyright (C) 2007, 2008 Sergey Poznyakoff
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
@@ -116,13 +116,12 @@ add_def(gacopyz_srv_t srv, const char *name, size_t len,
}
void
del_def(gacopyz_srv_t srv, const char *name, size_t len)
{
struct gacopyz_macro_def *def = find_def(srv, name, len);
- size_t n;
if (!def)
return;
free(def->name);
free(def->value);
@@ -295,13 +294,12 @@ struct timeval default_gacopyz_timeout[GACOPYZ_TO_COUNT] = {
};
int
gacopyz_srv_create(gacopyz_srv_t *p, const char *name,
const char *portspec, unsigned logmask)
{
- int i;
gacopyz_srv_t srv = calloc(1, sizeof(*srv));
if (!srv)
return MI_FAILURE;
srv->id = strdup(name);
srv->portspec = strdup(portspec);
@@ -801,13 +799,12 @@ srv_connect(gacopyz_srv_t srv, char *proto, char *port, char *path)
int
gacopyz_srv_connect(gacopyz_srv_t srv)
{
char *proto;
char *port;
char *path;
- int rc;
GACOPYZ_ASSERT(srv);
gacopyz_io_log(&srv->iod, SMI_LOG_DEBUG,
_("Conecting to %s"), srv->portspec);
diff --git a/src/bi_db.m4 b/src/bi_db.m4
index bb0b9f4..f366008 100644
--- a/src/bi_db.m4
+++ b/src/bi_db.m4
@@ -1,8 +1,8 @@
-/* This file is part of mailfromd. -*- c -*-
- Copyright (C) 2006, 2007 Sergey Poznyakoff
+/* This file is part of Mailfromd. -*- c -*-
+ Copyright (C) 2006, 2007, 2008 Sergey Poznyakoff
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
@@ -134,13 +134,13 @@ MF_DEFUN(dbdel, VOID, STRING dbname, STRING keystr, OPTIONAL, NUMBER null)
MU_DATUM_SIZE(key)++;
rc = mu_dbm_delete(&db, key);
mu_dbm_close(&db);
MF_ASSERT(rc == 0,
mf_dbfailure,
_("Failed to delete data `%s' from `%s': %s"),
- key,
+ keystr,
dbname,
mu_dbm_strerror());
}
END
@@ -235,15 +235,16 @@ MF_DEFUN(greylist, NUMBER, STRING email, NUMBER interval)
debug1(20, "greylist record for %s expired",
email);
if (!readonly) {
memcpy(MU_DATUM_PTR(contents),
&now, sizeof now);
if (mu_dbm_insert(&db, key, contents, 1))
- mu_error(_("Cannot insert datum `%s' in "
+ mu_error(_("Cannot insert datum `%-.*s' in "
"greylist database %s: %s"),
- key,
+ MU_DATUM_SIZE(key),
+ (char*)MU_DATUM_PTR(key),
greylist_format->dbname,
mu_dbm_strerror());
} else
debug(20, "database opened in readonly mode: "
"not updating");
rc = 1;
@@ -256,15 +257,15 @@ MF_DEFUN(greylist, NUMBER, STRING email, NUMBER interval)
} else if (!readonly) {
debug1(20, "greylisting %s", email);
MF_VAR_REF(greylist_seconds_left, interval);
MU_DATUM_PTR(contents) = (void*)&now;
MU_DATUM_SIZE(contents) = sizeof now;
if (mu_dbm_insert(&db, key, contents, 1))
- mu_error(_("Cannot insert datum `%s' in greylist "
+ mu_error(_("Cannot insert datum `%-.*s' in greylist "
"database %s: %s"),
- key,
+ MU_DATUM_SIZE(key), (char*)MU_DATUM_PTR(key),
greylist_format->dbname,
mu_dbm_strerror());
rc = 1;
} else
rc = 0;
diff --git a/src/bi_sprintf.m4 b/src/bi_sprintf.m4
index 3f3f434..afd63d3 100644
--- a/src/bi_sprintf.m4
+++ b/src/bi_sprintf.m4
@@ -1,8 +1,8 @@
-/* This file is part of mailfromd. -*- c -*-
- Copyright (C) 2007 Sergey Poznyakoff
+/* This file is part of Mailfromd. -*- c -*-
+ Copyright (C) 2007, 2008 Sergey Poznyakoff
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
@@ -373,13 +373,13 @@ MF_DEFUN_VARARGS(sprintf, STRING, STRING format)
/* If a precision is given with a
numeric conversion, the 0 flag is ignored.
*/
/* A - overrides a 0 if both are given.*/
if (prec || (flags & FMT_ADJUST_LEFT))
flags &= ~FMT_PADZERO;
- snprintf(buf+1, sizeof(buf)-1, "%o", num);
+ snprintf(buf+1, sizeof(buf)-1, "%lo", num);
str = buf + 2;
n = strlen(str);
if (prec && prec > n) {
memmove(str + prec - n, str, n + 1);
memset(str, '0', prec - n);
}
diff --git a/src/db.c b/src/db.c
index d8efaa6..4ab865d 100644
--- a/src/db.c
+++ b/src/db.c
@@ -1,8 +1,8 @@
-/* This file is part of mailfromd.
- Copyright (C) 2005, 2006, 2007 Sergey Poznyakoff
+/* This file is part of Mailfromd.
+ Copyright (C) 2005, 2006, 2007, 2008 Sergey Poznyakoff
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
@@ -125,13 +125,13 @@ db_enumerate(DBM_FILE *db, db_enum_func fun, void *data)
mu_dbm_datum_free(&key);
break;
}
} else {
mu_error(_("Cannot fetch data `%*.*s' from `%s': %s"),
MU_DATUM_SIZE(key), MU_DATUM_SIZE(key),
- MU_DATUM_PTR(key),
+ (char*) MU_DATUM_PTR(key),
db->name,
mu_dbm_strerror());
rc = 1;
}
}
if (res != MU_ERR_NOENT) {
@@ -324,13 +324,13 @@ db_compact_func(DBM_DATUM key, DBM_DATUM contents, void *data)
dp->rc = 1;
}
free(p);
} else if (mu_dbm_insert(&dp->ndb, key, contents, 1)) {
mu_error(_("Cannot insert datum `%*.*s' into `%s': %s"),
MU_DATUM_SIZE(key), MU_DATUM_SIZE(key),
- MU_DATUM_PTR(key),
+ (char*) MU_DATUM_PTR(key),
dp->ndb.name,
mu_dbm_strerror());
dp->rc = 1;
}
}
return 0;
diff --git a/src/engine.c b/src/engine.c
index a2b26f5..b40e75e 100644
--- a/src/engine.c
+++ b/src/engine.c
@@ -1282,13 +1282,13 @@ check_pidfile(char *name)
name);
exit(EX_USAGE);
}
}
fclose(fp);
if (unlink(pidfile)) {
- mu_error(_("Cannot unlink pidfile `%s'"),
+ mu_error(_("Cannot unlink pidfile `%s': %s"),
name, mu_strerror(errno));
exit(EX_USAGE);
}
}
/* Check whether local socket P exists. Act in accordance with the settings
diff --git a/src/main.c b/src/main.c
index 6efb0e8..416916b 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,8 +1,8 @@
/* This file is part of mailfromd.
- Copyright (C) 2005, 2006, 2007 Sergey Poznyakoff
+ Copyright (C) 2005, 2006, 2007, 2008 Sergey Poznyakoff
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
@@ -30,12 +30,15 @@
#include <pwd.h>
#include <grp.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
+#ifdef HAVE_LOCALE_H
+# include <locale.h>
+#endif
#include <mailutils/mailutils.h>
#if MAILUTILS_VERSION_NUMBER < 1290
# include <mailutils/argp.h>
#else
# include <mailutils/libargp.h>
diff --git a/src/mtasim.c b/src/mtasim.c
index 2a12a43..8940b7a 100644
--- a/src/mtasim.c
+++ b/src/mtasim.c
@@ -1,9 +1,9 @@
/*
This file is part of Mailfromd.
- Copyright (C) 2003, 2004, 2007 The Anubis Team.
+ Copyright (C) 2003, 2004, 2007, 2008 The Anubis Team.
Mailfromd is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
@@ -33,12 +33,15 @@
#include <sys/types.h>
#include <dirent.h>
#ifdef HAVE_READLINE_READLINE_H
# include <readline/readline.h>
# include <readline/history.h>
#endif
+#ifdef HAVE_LOCALE_H
+# include <locale.h>
+#endif
#include <pwd.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <netinet/in.h>
diff --git a/src/prog.c b/src/prog.c
index 4d9724c..abb9ce8 100644
--- a/src/prog.c
+++ b/src/prog.c
@@ -1,8 +1,8 @@
/* This file is part of mailfromd.
- Copyright (C) 2006, 2007 Sergey Poznyakoff
+ Copyright (C) 2006, 2007, 2008 Sergey Poznyakoff
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
@@ -407,18 +407,18 @@ runtime_stack_trace(eval_environ_t env)
ploc = &loc;
break;
}
}
if (ploc)
- mu_error("%04d: %s:%lu: %s",
+ mu_error("%04lu: %s:%lu: %s",
(unsigned long) pc,
ploc->file, (unsigned long) ploc->line,
name);
else
- mu_error("%04d: %s",
+ mu_error("%04lu: %s",
(unsigned long) pc,
name);
}
mu_error(_("Stack trace finishes"));
}
@@ -1084,13 +1084,13 @@ instr_div(eval_environ_t env)
long b = (long) get_numeric_arg(env, 0);
adjust_stack(env, 2);
if (PROG_TRACE_ENGINE)
prog_trace(env, "DIV %ld %ld", a, b);
if (b == 0)
env_throw(env, mf_divzero,
- "Division by zero at %08x", env->pc);
+ "Division by zero at %08lx", (unsigned long)env->pc);
push(env, (STKVAL) (a / b));
}
void
instr_neg(eval_environ_t env)
{

Return to:

Send suggestions and report system problems to the System administrator.