if (did_message == 0) {
char *msghook;
if ((msghook = context_find("msg-hook")) != NULL)
- inform(msghook);
+ inform("%s", msghook);
else {
char errbuf[BUFSIZ];
snprintf(errbuf, sizeof(errbuf), "external hook \"%s\"", hook);
message_id (time_t tclock, int content_id) {
switch (message_id_style) {
case NMH_MESSAGE_ID_LOCALNAME: {
- char *format = content_id ? "<%d.%ld.%%d@%s>" : "<%d.%ld@%s>";
-
- snprintf (message_id_, sizeof message_id_, format,
- (int) getpid (), (long) tclock, LocalName (1));
-
+#define P(fmt) \
+ snprintf(message_id_, sizeof message_id_, \
+ (fmt), (int)getpid(), (long)tclock, LocalName(1))
+
+ if (content_id)
+ P("<%d.%ld.%%d@%s>");
+ else
+ P("<%d.%ld@%s>");
+#undef P
break;
}
case NMH_MESSAGE_ID_RANDOM: {
- char *format = content_id
- ? "<%d-%ld.%06ld%%d@%.*s.%.*s.%.*s>"
- : "<%d-%ld.%06ld@%.*s.%.*s.%.*s>";
/* Use a sequence of digits divisible by 3 because that will
expand to base64 without any waste. Must be shorter than 58,
see below. */
/* The format string inserts a couple of dots, for the benefit
of spam filters that want to see a message id with a final
part that resembles a hostname. */
- snprintf (message_id_, sizeof message_id_, format,
- getpid (), (long) now.tv_sec, (long) now.tv_usec,
- one_third, rnd_base64,
- one_third, &rnd_base64[one_third],
- one_third, &rnd_base64[2*one_third]);
+#define P(fmt) \
+ snprintf(message_id_, sizeof message_id_, (fmt), \
+ getpid(), (long)now.tv_sec, (long)now.tv_usec, \
+ (int)one_third, rnd_base64, \
+ (int)one_third, &rnd_base64[one_third], \
+ (int)one_third, &rnd_base64[2*one_third])
+
+ if (content_id)
+ P("<%d-%ld.%06ld%%d@%.*s.%.*s.%.*s>");
+ else
+ P("<%d-%ld.%06ld@%.*s.%.*s.%.*s>");
+#undef P
}
break;
FILE *fp;
char *client_res;
- if (!mh_oauth_new (&ctx, svc)) adios(NULL, mh_oauth_get_err_string(ctx));
+ if (!mh_oauth_new (&ctx, svc))
+ adios(NULL, "%s", mh_oauth_get_err_string(ctx));
if (log != NULL) mh_oauth_log_to(stderr, ctx);
}
if ((cred = mh_oauth_cred_load(fp, ctx, user)) == NULL) {
- adios(NULL, mh_oauth_get_err_string(ctx));
+ adios(NULL, "%s", mh_oauth_get_err_string(ctx));
}
if (!mh_oauth_access_token_valid(time(NULL), cred)) {
adios(NULL, "credentials rejected -- run mhlogin -saslmech xoauth2 -authservice %s", svc);
}
inform("error refreshing OAuth2 token");
- adios(NULL, mh_oauth_get_err_string(ctx));
+ adios(NULL, "%s", mh_oauth_get_err_string(ctx));
}
fseek(fp, 0, SEEK_SET);
if (!mh_oauth_cred_save(fp, cred, user)) {
- adios(NULL, mh_oauth_get_err_string(ctx));
+ adios(NULL, "%s", mh_oauth_get_err_string(ctx));
}
}
}
if (stat(file, &s) == -1) {
- advise("can't get access and modification times for %s", file);
+ inform("can't get access and modification times for %s", file);
preserve_actime_and_modtime = 0;
}
i = annosbr (fd, file, comp, text, inplace, datesw, delete, append);
if (preserve_actime_and_modtime && utime(file, &b) == -1)
- advise("can't set access and modification times for %s", file);
+ inform("can't set access and modification times for %s", file);
lkclosedata (fd, file);
return i;
case FT_V_MATCH: return("V_MATCH");
case FT_V_AMATCH: return("V_AMATCH");
default:
- printf(buf, "/* ??? #%d */", t);
+ snprintf(buf, sizeof buf, "/* ??? #%d */", t);
return(buf);
}
}
buf[0] = '\0';
if (t & ~(CT_ADDR|CT_DATE))
- printf(buf, "0x%x ", t);
+ snprintf(buf, sizeof buf, "0x%x ", t);
strcat(buf, "<");
i = 0;
FNORD(CT_ADDR, "ADDR");
buf[0] = '\0';
if (t & ~(CF_TRUE|CF_PARSED|CF_DATEFAB|CF_TRIMMED))
- printf(buf, "0x%x ", t);
+ snprintf(buf, sizeof buf, "0x%x ", t);
strcat(buf, "<");
i = 0;
FNORD(CF_TRUE, "TRUE");
}
if (!mh_oauth_new(&ctx, svc)) {
- adios(NULL, mh_oauth_get_err_string(ctx));
+ adios(NULL, "%s", mh_oauth_get_err_string(ctx));
}
if (snoop) {
fn = mh_xstrdup(mh_oauth_cred_fn(svc));
if ((url = mh_oauth_get_authorize_url(ctx)) == NULL) {
- adios(NULL, mh_oauth_get_err_string(ctx));
+ adios(NULL, "%s", mh_oauth_get_err_string(ctx));
}
if (browser) {
}
if (cred == NULL) {
inform("error exchanging code for OAuth2 token");
- adios(NULL, mh_oauth_get_err_string(ctx));
+ adios(NULL, "%s", mh_oauth_get_err_string(ctx));
}
cred_file = lkfopendata(fn, "r+", &failed_to_lock);
adios(fn, "oops");
}
if (!mh_oauth_cred_save(cred_file, cred, user)) {
- adios(NULL, mh_oauth_get_err_string(ctx));
+ adios(NULL, "%s", mh_oauth_get_err_string(ctx));
}
if (lkfclosedata(cred_file, fn) != 0) {
adios (fn, "oops");
#ifdef OAUTH_SUPPORT
const char *errmsg;
if (setup_oauth_params(vec, nvecsp, auth_svc, &errmsg) != OK) {
- adios(NULL, errmsg);
+ adios(NULL, "%s", errmsg);
}
#else
adios(NULL, "send built without OAUTH_SUPPORT, "
/* Extract address and host from From: header line in draft. */
if (get_from_header_info(draft, &addr, &host, &message) != OK) {
- adios(draft, message);
+ adios(draft, "%s", message);
}
/* Merge in any address or host specific switches to post(1) from profile. */
if (strcmp(*vp, "xoauth2") == 0) {
#ifdef OAUTH_SUPPORT
if (setup_oauth_params(vec, vecp, auth_svc, &message) != OK) {
- adios(NULL, message);
+ adios(NULL, "%s", message);
}
break;
#else