summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2010-10-27 19:03:17 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2010-10-27 19:03:17 +0300
commit697384c64dadb0a4db97136a6cbcf2166c48897b (patch)
tree90212f478fc439cdc83412bd8a6d13d5b89d49ed
parentb24bf339e41212dfd1a0d88f76150ff0503b7bb2 (diff)
downloadmailutils-697384c64dadb0a4db97136a6cbcf2166c48897b.tar.gz
mailutils-697384c64dadb0a4db97136a6cbcf2166c48897b.tar.bz2
Use mu_asprintf and mu_vasnprintf instead of asprintf and vasprintf.
*gnulib.modules (snprintf, vasprintf): Remove. *sieve/tests/reject.at: Use AT_PACKAGE_VERSION instead of the hardcoded version number. *lib/mu_asprintf.h: Remove. * imap4d/auth_gss.c: Replace asprintf with mu_asprintf and vasprintf by mu_vasnprintf. * guimb/guimb.h: Likewise. * imap4d/imap4d.h: Likewise. * imap4d/unsubscribe.c: Likewise. * lib/Makefile.am * lib/mailcap.c: Likewise. * libmu_argp/muinit.c: Likewise. * maidag/deliver.c: Likewise. * maidag/maidag.h: Likewise. * mail/escape.c: Likewise. * mail/mail.c: Likewise. * mail/mail.h: Likewise. * mail/util.c: Likewise. * mail/write.c: Likewise. * mh/burst.c: Likewise. * mh/forw.c: Likewise. * mh/mh.h: Likewise. * mh/mh_alias.l: Likewise. * mh/mh_format.c: Likewise. * mh/mh_getopt.c: Likewise. * mh/mh_init.c: Likewise. * mh/mh_msgset.c: Likewise. * mh/mh_sequence.c: Likewise. * mh/mh_whatnow.c: Likewise. * mh/mhn.c: Likewise. * mh/send.c: Likewise. * mimeview/mimetypes.l: Likewise. * mimeview/mimetypes.y: Likewise. * mimeview/mimeview.c: Likewise. * movemail/movemail.c: Likewise. * mu/ldflags.c: Likewise. * pop3d/expire.c: Likewise. * pop3d/pop3d.h: Likewise. * sieve/sieve.c: Likewise.
-rw-r--r--gnulib.modules2
-rw-r--r--guimb/guimb.h2
-rw-r--r--imap4d/auth_gss.c4
-rw-r--r--imap4d/imap4d.h2
-rw-r--r--imap4d/unsubscribe.c2
-rw-r--r--lib/Makefile.am1
-rw-r--r--lib/mailcap.c2
-rw-r--r--lib/mu_asprintf.h38
-rw-r--r--libmu_argp/muinit.c20
-rw-r--r--maidag/deliver.c18
-rw-r--r--maidag/maidag.h2
-rw-r--r--mail/escape.c2
-rw-r--r--mail/mail.c4
-rw-r--r--mail/mail.h2
-rw-r--r--mail/util.c22
-rw-r--r--mail/write.c2
-rw-r--r--mh/burst.c2
-rw-r--r--mh/forw.c4
-rw-r--r--mh/mh.h4
-rw-r--r--mh/mh_alias.l12
-rw-r--r--mh/mh_format.c4
-rw-r--r--mh/mh_getopt.c10
-rw-r--r--mh/mh_init.c7
-rw-r--r--mh/mh_msgset.c4
-rw-r--r--mh/mh_sequence.c2
-rw-r--r--mh/mh_whatnow.c4
-rw-r--r--mh/mhn.c12
-rw-r--r--mh/send.c4
-rw-r--r--mimeview/mimetypes.l2
-rw-r--r--mimeview/mimetypes.y12
-rw-r--r--mimeview/mimeview.c2
-rw-r--r--movemail/movemail.c5
-rw-r--r--mu/ldflags.c4
-rw-r--r--pop3d/expire.c2
-rw-r--r--pop3d/pop3d.h2
-rw-r--r--sieve/sieve.c2
-rw-r--r--sieve/tests/reject.at6
37 files changed, 97 insertions, 134 deletions
diff --git a/gnulib.modules b/gnulib.modules
index 66399597e..cedbcb7b5 100644
--- a/gnulib.modules
+++ b/gnulib.modules
@@ -20,8 +20,6 @@ mbswidth
obstack
realloc
setenv
-snprintf
stdint
strtok_r
-vasprintf
xalloc
diff --git a/guimb/guimb.h b/guimb/guimb.h
index 621a3ec92..e0384e84d 100644
--- a/guimb/guimb.h
+++ b/guimb/guimb.h
@@ -42,7 +42,7 @@
#include <mailutils/util.h>
#include <mailutils/attribute.h>
#include <mailutils/envelope.h>
-#include <mu_asprintf.h>
+#include <mailutils/io.h>
extern char *program_file;
extern char *program_expr;
diff --git a/imap4d/auth_gss.c b/imap4d/auth_gss.c
index 11f074519..68f3bf402 100644
--- a/imap4d/auth_gss.c
+++ b/imap4d/auth_gss.c
@@ -62,7 +62,7 @@ display_status_1 (char *m, OM_uint32 code, int type)
type, GSS_C_NO_OID, &msg_ctx, &msg);
if (GSS_ERROR (maj_stat))
{
- asprintf ((char**)&msg.value, "code %d", code);
+ mu_asprintf ((char**)&msg.value, "code %d", code);
msg.length = strlen (msg.value);
}
@@ -136,7 +136,7 @@ auth_gssapi (struct imap4d_auth *ap)
work (possibly due to a bug in krb5_gss_accept_sec_context()), so
we acquire server credentials explicitly. */
- asprintf ((char **) &tmp, "imap@%s", util_localname ());
+ mu_asprintf ((char **) &tmp, "imap@%s", util_localname ());
tokbuf.value = tmp;
tokbuf.length = strlen (tokbuf.value) + 1;
maj_stat = gss_import_name (&min_stat, &tokbuf,
diff --git a/imap4d/imap4d.h b/imap4d/imap4d.h
index 6cf6f587e..21d3b7221 100644
--- a/imap4d/imap4d.h
+++ b/imap4d/imap4d.h
@@ -103,8 +103,8 @@
#include <mailutils/vartab.h>
#include <mailutils/cctype.h>
#include <mailutils/cstr.h>
+#include <mailutils/io.h>
-#include <mu_asprintf.h>
#include <mu_umaxtostr.h>
#include <muaux.h>
diff --git a/imap4d/unsubscribe.c b/imap4d/unsubscribe.c
index 108f7f3d8..9379da51f 100644
--- a/imap4d/unsubscribe.c
+++ b/imap4d/unsubscribe.c
@@ -115,7 +115,7 @@ imap4d_unsubscribe (struct imap4d_command *command, imap4d_tokbuf_t tok)
if (sd.result)
{
char *tmpname = NULL;
- asprintf (&tmpname, "%s.%d", file, getpid ());
+ mu_asprintf (&tmpname, "%s.%d", file, getpid ());
sd.tmp = fopen (tmpname, "a");
if (!sd.tmp)
rc = -1;
diff --git a/lib/Makefile.am b/lib/Makefile.am
index ed88cd0d2..504e46396 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -35,7 +35,6 @@ noinst_HEADERS +=\
mailcap.h\
muaux.h\
mu_dbm.h\
- mu_asprintf.h\
tcpwrap.h
EXTRA_DIST += utmp.c
diff --git a/lib/mailcap.c b/lib/mailcap.c
index e4f0b57b2..fc2c3ec0c 100644
--- a/lib/mailcap.c
+++ b/lib/mailcap.c
@@ -658,7 +658,7 @@ display_stream_mailcap (const char *ident, mu_stream_t stream, mu_header_t hdr,
if (!mailcap_path)
{
char *home = mu_get_homedir ();
- asprintf (&mailcap_path, "%s/.mailcap:%s", home, DEFAULT_MAILCAP);
+ mu_asprintf (&mailcap_path, "%s/.mailcap:%s", home, DEFAULT_MAILCAP);
free (home);
if (!mailcap_path)
return 1;
diff --git a/lib/mu_asprintf.h b/lib/mu_asprintf.h
deleted file mode 100644
index 0f893e99f..000000000
--- a/lib/mu_asprintf.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Copyright (C) 2007, 2010 Free Software Foundation, Inc.
-
- GNU Mailutils is free software; you can redistribute it and/or modify
- it under the terms of the GNU Library General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- GNU Mailutils is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Library General Public License for more details.
-
- You should have received a copy of the GNU Library General
- Public License along with GNU Mailutils. If not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifndef MUASPRINTF_H
-#define MUASPRINTF_H
-
-#ifndef _GNU_SOURCE
-# define _GNU_SOURCE
-#endif
-#include <stdarg.h>
-#include <stdio.h>
-
-#if !HAVE_DECL_VASPRINTF
-extern int vasprintf (char **result, const char *format, va_list args);
-#endif
-#if !HAVE_DECL_ASPRINTF
-#if __STDC__
-extern int asprintf (char **result, const char *format, ...);
-#else
-extern int asprintf ();
-#endif
-#endif
-
-#endif
-
diff --git a/libmu_argp/muinit.c b/libmu_argp/muinit.c
index 413389b77..ab6e9c94d 100644
--- a/libmu_argp/muinit.c
+++ b/libmu_argp/muinit.c
@@ -132,20 +132,20 @@ mu_app_init (struct argp *myargp, const char **capa,
char *canonical_name = get_canonical_name ();
mu_stream_t stream;
mu_stdio_stream_create (&stream, MU_STDOUT_FD, 0);
- asprintf (&comment,
- "Configuration file structure for %s utility.",
- mu_program_name);
+ mu_asprintf (&comment,
+ "Configuration file structure for %s utility.",
+ mu_program_name);
mu_cfg_format_docstring (stream, comment, 0);
free (comment);
- asprintf (&comment,
- "For use in global configuration file (%s), enclose it "
- "in `program %s { ... };",
- MU_CONFIG_FILE,
- mu_program_name);
+ mu_asprintf (&comment,
+ "For use in global configuration file (%s), enclose it "
+ "in `program %s { ... };",
+ MU_CONFIG_FILE,
+ mu_program_name);
mu_cfg_format_docstring (stream, comment, 0);
free (comment);
- asprintf (&comment, "For more information, use `info %s'.",
- canonical_name);
+ mu_asprintf (&comment, "For more information, use `info %s'.",
+ canonical_name);
mu_cfg_format_docstring (stream, comment, 0);
free (comment);
diff --git a/maidag/deliver.c b/maidag/deliver.c
index 25a7ab642..47d9a54d6 100644
--- a/maidag/deliver.c
+++ b/maidag/deliver.c
@@ -140,8 +140,8 @@ notify_action (mu_observer_t obs, size_t type, void *data, void *action_data)
char *buf;
mu_mailbox_get_url (mbox, &url);
- asprintf (&buf, "%s@%s:%s", biff_user_name,
- qid, mu_url_to_string (url));
+ mu_asprintf (&buf, "%s@%s:%s", biff_user_name,
+ qid, mu_url_to_string (url));
if (buf)
{
sendto (biff_fd, buf, strlen (buf), 0,
@@ -251,8 +251,8 @@ deliver_to_mailbox (mu_mailbox_t mbox, mu_message_t msg,
maidag_error (_("%s: mailbox quota exceeded for this recipient"),
auth->name);
if (errp)
- asprintf (errp, "%s: mailbox quota exceeded for this recipient",
- auth->name);
+ mu_asprintf (errp, "%s: mailbox quota exceeded for this recipient",
+ auth->name);
exit_code = EX_QUOTA();
failed++;
break;
@@ -274,10 +274,10 @@ deliver_to_mailbox (mu_mailbox_t mbox, mu_message_t msg,
"this recipient"),
auth->name);
if (errp)
- asprintf (errp,
- "%s: message would exceed maximum mailbox size "
- "for this recipient",
- auth->name);
+ mu_asprintf (errp,
+ "%s: message would exceed maximum mailbox size "
+ "for this recipient",
+ auth->name);
exit_code = EX_QUOTA();
failed++;
}
@@ -339,7 +339,7 @@ do_delivery (mu_url_t url, mu_message_t msg, const char *name, char **errp)
{
maidag_error (_("%s: no such user"), name);
if (errp)
- asprintf (errp, "%s: no such user", name);
+ mu_asprintf (errp, "%s: no such user", name);
exit_code = EX_NOUSER;
return EX_NOUSER;
}
diff --git a/maidag/maidag.h b/maidag/maidag.h
index 6c7224d7b..b77491f25 100644
--- a/maidag/maidag.h
+++ b/maidag/maidag.h
@@ -84,9 +84,9 @@
#include <mailutils/acl.h>
#include <mailutils/server.h>
#include <mailutils/cctype.h>
+#include <mailutils/io.h>
#include <mu_dbm.h>
-#include <mu_asprintf.h>
#if defined (USE_DBM) || defined (USE_SQL)
# define USE_MAILBOX_QUOTAS 1
diff --git a/mail/escape.c b/mail/escape.c
index f35bbe127..efa2d7977 100644
--- a/mail/escape.c
+++ b/mail/escape.c
@@ -93,7 +93,7 @@ parse_headers (FILE *fp, compose_env_t *env)
if (name)
{
char *p = NULL;
- asprintf (&p, "%s\n%s", value, buf);
+ mu_asprintf (&p, "%s\n%s", value, buf);
free (value);
value = p;
}
diff --git a/mail/mail.c b/mail/mail.c
index 6cd68f302..3f70e6610 100644
--- a/mail/mail.c
+++ b/mail/mail.c
@@ -175,14 +175,14 @@ parse_opt (int key, char *arg, struct argp_state *state)
_("-f requires at most one command line argument"));
}
else if (args->user)
- asprintf (&args->file, "~/%s/mbox", args->user);
+ mu_asprintf (&args->file, "~/%s/mbox", args->user);
else
args->file = "~/mbox";
}
else if (args->argc || (args->hint & HINT_SEND_MODE))
util_cache_command (&command_list, "setq mode=send");
else if (args->user)
- asprintf (&args->file, "%%%s", args->user);
+ mu_asprintf (&args->file, "%%%s", args->user);
break;
default:
diff --git a/mail/mail.h b/mail/mail.h
index cc2de6ee2..3b33a521b 100644
--- a/mail/mail.h
+++ b/mail/mail.h
@@ -79,7 +79,7 @@
#include <mailutils/argcv.h>
#include <mailutils/cctype.h>
#include <mailutils/cstr.h>
-#include <mu_asprintf.h>
+#include <mailutils/io.h>
#ifdef __cplusplus
extern "C" {
diff --git a/mail/util.c b/mail/util.c
index ae6625f0c..f337fe7d3 100644
--- a/mail/util.c
+++ b/mail/util.c
@@ -30,7 +30,7 @@
#else
# include <sys/fcntl.h>
#endif
-#include <mu_asprintf.h>
+#include <mailutils/io.h>
/*
* expands command into its command and arguments, then runs command
@@ -38,20 +38,21 @@
* returns exit status of the command
*/
int
-util_do_command (const char *c, ...)
+util_do_command (const char *fmt, ...)
{
int argc = 0;
char **argv = NULL;
int status = 0;
const struct mail_command_entry *entry = NULL;
char *cmd = NULL;
+ size_t size = 0;
va_list ap;
- va_start (ap, c);
- status = vasprintf (&cmd, c, ap);
+ va_start (ap, fmt);
+ status = mu_vasnprintf (&cmd, &size, fmt, ap);
va_end (ap);
- if (status < 0)
- return 0;
+ if (status)
+ return status;
if (cmd)
{
@@ -84,7 +85,7 @@ util_do_command (const char *c, ...)
&& ((strtoul (argv[0], &p, 10) > 0 && *p == 0)
|| (argv[0][1] == 0 && strchr("^$", argv[0][0]))))
{
- asprintf (&p, "print %s", argv[0]);
+ mu_asprintf (&p, "print %s", argv[0]);
mu_argcv_free (argc, argv);
mu_argcv_get (p, NULL, NULL, &argc, &argv);
free (p);
@@ -685,7 +686,7 @@ util_outfolder_name (char *str)
if (mailvar_get (&outfolder, "outfolder", mailvar_type_string, 0) == 0)
{
char *ns = NULL;
- asprintf (&ns, "%s/%s", outfolder, str);
+ mu_asprintf (&ns, "%s/%s", outfolder, str);
str = util_fullpath (ns);
free (ns);
}
@@ -1035,11 +1036,12 @@ util_noapp ()
void
util_cache_command (mu_list_t *list, const char *fmt, ...)
{
- char *cmd;
+ char *cmd = NULL;
+ size_t size = 0;
va_list ap;
va_start (ap, fmt);
- vasprintf (&cmd, fmt, ap);
+ mu_vasnprintf (&cmd, &size, fmt, ap);
va_end (ap);
if (!*list)
diff --git a/mail/write.c b/mail/write.c
index 484087345..1368d116b 100644
--- a/mail/write.c
+++ b/mail/write.c
@@ -46,7 +46,7 @@ mail_write (int argc, char **argv)
util_error (_("No applicable message"));
return 1;
}
- asprintf (&p, "%lu", (unsigned long) n);
+ mu_asprintf (&p, "%lu", (unsigned long) n);
filename = util_outfolder_name (p);
free (p);
}
diff --git a/mh/burst.c b/mh/burst.c
index 1078fdaba..8dc916328 100644
--- a/mh/burst.c
+++ b/mh/burst.c
@@ -594,7 +594,7 @@ main (int argc, char **argv)
last_uid += burst_map[i].count;
VERBOSE ((_("Estimated last UID: %s"), mu_umaxtostr (0, last_uid)));
- asprintf (&xargv[0], "%s-last", mu_umaxtostr (0, burst_map[0].msgno));
+ mu_asprintf (&xargv[0], "%s-last", mu_umaxtostr (0, burst_map[0].msgno));
xargv[1] = NULL;
mh_msgset_parse (mbox, &ms, 1, xargv, NULL);
free (xargv[0]);
diff --git a/mh/forw.c b/mh/forw.c
index 388960115..06a9de535 100644
--- a/mh/forw.c
+++ b/mh/forw.c
@@ -291,7 +291,7 @@ format_message (mu_mailbox_t mbox, mu_message_t msg, size_t num, void *data)
if (fp->num)
{
- asprintf (&s, "\n------- Message %d\n", fp->num++);
+ mu_asprintf (&s, "\n------- Message %d\n", fp->num++);
rc = mu_stream_write (fp->stream, s, strlen (s), NULL);
free (s);
}
@@ -357,7 +357,7 @@ finish_draft ()
mbox_path = mu_url_to_string (url);
if (memcmp (mbox_path, "mh:", 3) == 0)
mbox_path += 3;
- asprintf (&str, "#forw [] +%s", mbox_path);
+ mu_asprintf (&str, "#forw [] +%s", mbox_path);
rc = mu_stream_write (stream, str, strlen (str), NULL);
free (str);
for (i = 0; rc == 0 && i < msgset.count; i++)
diff --git a/mh/mh.h b/mh/mh.h
index ec78d017b..0ed009c89 100644
--- a/mh/mh.h
+++ b/mh/mh.h
@@ -25,7 +25,7 @@
#include <unistd.h>
#include <mh_getopt.h>
#include <xalloc.h>
-#include <mu_asprintf.h>
+#include <mailutils/io.h>
#include <string.h>
@@ -53,8 +53,8 @@
#include <mailutils/mailer.h>
#include <mailutils/envelope.h>
#include <mailutils/mime.h>
+#include <mailutils/io.h>
-#include <mu_asprintf.h>
#include <mu_umaxtostr.h>
#if !HAVE_DECL_STRCHRNUL
diff --git a/mh/mh_alias.l b/mh/mh_alias.l
index b002343c9..e99747686 100644
--- a/mh/mh_alias.l
+++ b/mh/mh_alias.l
@@ -26,7 +26,7 @@
#include <mh_alias.h>
#include <sys/stat.h>
#include <mailutils/cctype.h>
-#include <mu_asprintf.h>
+#include <mailutils/io.h>
char *ali_filename;
size_t ali_line_num;
@@ -36,9 +36,10 @@ void
va_ali_parse_error_loc (const char *name, size_t line,
const char *fmt, va_list ap)
{
- char *buf;
+ char *buf = NULL;
+ size_t size = 0;
- vasprintf (&buf, fmt, ap);
+ mu_vasnprintf (&buf, &size, fmt, ap);
if (name)
mu_error ("%s:%lu: %s", name, (unsigned long) line, buf);
else
@@ -372,8 +373,9 @@ SPEC [,:;+=\*]
yylval.string[yyleng] = 0;
return STRING;}
. { char *p;
- asprintf (&p,
- _("Stray character %03o in alias file"), yytext[0]);
+ mu_asprintf (&p,
+ _("Stray character %03o in alias file"),
+ yytext[0]);
yyerror (p);
free (p); }
%%
diff --git a/mh/mh_format.c b/mh/mh_format.c
index f084f31fc..60b8d7b95 100644
--- a/mh/mh_format.c
+++ b/mh/mh_format.c
@@ -1136,7 +1136,7 @@ static void
builtin_putnum (struct mh_machine *mach)
{
char *p;
- asprintf (&p, "%ld", mach->arg_num);
+ mu_asprintf (&p, "%ld", mach->arg_num);
print_string (mach, 0, p);
free (p);
}
@@ -1609,7 +1609,7 @@ builtin_pers (struct mh_machine *mach)
if (mu_address_sget_personal (addr, 1, &str) == 0 && str)
{
char *p;
- asprintf (&p, "\"%s\"", str);
+ mu_asprintf (&p, "\"%s\"", str);
strobj_create (&mach->arg_str, p);
free (p);
}
diff --git a/mh/mh_getopt.c b/mh/mh_getopt.c
index 09b8a3e85..138baa78c 100644
--- a/mh/mh_getopt.c
+++ b/mh/mh_getopt.c
@@ -25,7 +25,7 @@
#include <stdlib.h>
#include <string.h>
#include <mh_getopt.h>
-#include <mu_asprintf.h>
+#include <mailutils/io.h>
static int mh_optind = 1;
static char *mh_optarg;
@@ -55,7 +55,7 @@ mh_getopt (int argc, char **argv, struct mh_option *mh_opt, const char *doc)
}
if (strcmp (mh_optptr, "-version") == 0)
- asprintf (&argv[mh_optind], "--version");
+ mu_asprintf (&argv[mh_optind], "--version");
else
{
optlen = strlen (mh_optptr+1);
@@ -81,16 +81,16 @@ mh_getopt (int argc, char **argv, struct mh_option *mh_opt, const char *doc)
mh_optarg = "no";
else
mh_optarg = "yes";
- asprintf (&argv[mh_optind], "--%s=%s", longopt, mh_optarg);
+ mu_asprintf (&argv[mh_optind], "--%s=%s", longopt, mh_optarg);
break;
case MH_OPT_ARG:
- asprintf (&argv[mh_optind], "--%s", longopt);
+ mu_asprintf (&argv[mh_optind], "--%s", longopt);
mh_optarg = argv[++mh_optind];
break;
default:
- asprintf (&argv[mh_optind], "--%s", longopt);
+ mu_asprintf (&argv[mh_optind], "--%s", longopt);
mh_optarg = NULL;
}
mh_optind++;
diff --git a/mh/mh_init.c b/mh/mh_init.c
index 9153476c0..1f64cc3aa 100644
--- a/mh/mh_init.c
+++ b/mh/mh_init.c
@@ -496,12 +496,13 @@ mh_expand_name (const char *base, const char *name, int is_folder)
if (memcmp (namep, "mh:/", 4) == 0)
return namep;
else if (namep[0] == '/')
- asprintf (&p, "mh:%s", namep);
+ mu_asprintf (&p, "mh:%s", namep);
else
- asprintf (&p, "mh:%s/%s", base ? base : mu_folder_directory (), namep);
+ mu_asprintf (&p, "mh:%s/%s", base ? base : mu_folder_directory (),
+ namep);
}
else if (namep[0] != '/')
- asprintf (&p, "%s/%s", base ? base : mu_folder_directory (), namep);
+ mu_asprintf (&p, "%s/%s", base ? base : mu_folder_directory (), namep);
else
return namep;
diff --git a/mh/mh_msgset.c b/mh/mh_msgset.c
index f4706fd7b..fdf5df28c 100644
--- a/mh/mh_msgset.c
+++ b/mh/mh_msgset.c
@@ -201,7 +201,7 @@ msgset_preproc (mu_mailbox_t mbox, char *arg)
{
char *rest = msgset_preproc_part (mbox, tail+1, &tail);
char *p = NULL;
- asprintf (&p, "%s-%s", buf, rest);
+ mu_asprintf (&p, "%s-%s", buf, rest);
free (rest);
free (buf);
buf = p;
@@ -210,7 +210,7 @@ msgset_preproc (mu_mailbox_t mbox, char *arg)
if (tail[0])
{
char *p = NULL;
- asprintf (&p, "%s%s", buf, tail);
+ mu_asprintf (&p, "%s%s", buf, tail);
free (buf);
buf = p;
}
diff --git a/mh/mh_sequence.c b/mh/mh_sequence.c
index 4e7f5cf55..737461a51 100644
--- a/mh/mh_sequence.c
+++ b/mh/mh_sequence.c
@@ -22,7 +22,7 @@ private_sequence_name (const char *name)
{
char *p;
char *mbox_dir = mh_expand_name (NULL, mh_current_folder (), 0);
- asprintf (&p, "atr-%s-%s", name, mbox_dir);
+ mu_asprintf (&p, "atr-%s-%s", name, mbox_dir);
free (mbox_dir);
return p;
}
diff --git a/mh/mh_whatnow.c b/mh/mh_whatnow.c
index 527e73abb..672481083 100644
--- a/mh/mh_whatnow.c
+++ b/mh/mh_whatnow.c
@@ -375,7 +375,7 @@ edit (struct mh_whatnow_env *wh, int argc, char **argv, int *status)
{
char *name;
- asprintf (&name, "%s-next", wh->editor);
+ mu_asprintf (&name, "%s-next", wh->editor);
invoke (name, wh->editor, argc, argv, wh->file, NULL);
free (name);
@@ -631,7 +631,7 @@ mh_usedraft (const char *filename)
memset (&wh, 0, sizeof (wh));
wh.file = xstrdup (filename);
- asprintf (&wh.prompt, _("Use \"%s\"?"), filename);
+ mu_asprintf (&wh.prompt, _("Use \"%s\"?"), filename);
rc = _whatnow (&wh, usedraft_tab);
free (wh.prompt);
free (wh.file);
diff --git a/mh/mhn.c b/mh/mhn.c
index 2f95838ce..5aef07ff5 100644
--- a/mh/mhn.c
+++ b/mh/mhn.c
@@ -583,7 +583,7 @@ _mhn_profile_get (char *prefix, char *type, char *subtype, char *defval)
if (subtype)
{
- asprintf (&name, "mhn-%s-%s/%s", prefix, type, subtype);
+ mu_asprintf (&name, "mhn-%s-%s/%s", prefix, type, subtype);
str = mh_global_profile_get (name, NULL);
free (name);
if (!str)
@@ -591,7 +591,7 @@ _mhn_profile_get (char *prefix, char *type, char *subtype, char *defval)
}
else
{
- asprintf (&name, "mhn-%s-%s", prefix, type);
+ mu_asprintf (&name, "mhn-%s-%s", prefix, type);
str = mh_global_profile_get (name, defval);
free (name);
}
@@ -1596,7 +1596,7 @@ store_handler (mu_message_t msg, msg_part_t part, char *type, char *encoding,
char *p;
int rc;
- asprintf (&p, _("File %s already exists. Rewrite"), name);
+ mu_asprintf (&p, _("File %s already exists. Rewrite"), name);
rc = mh_getyn (p);
free (p);
if (!rc)
@@ -2131,7 +2131,7 @@ edit_forw (char *cmd, struct compose_env *env, mu_message_t *pmsg, int level)
sp = strchr (val, ';');
if (!sp)
abort ();
- asprintf (&newval, "multipart/digest%s", sp);
+ mu_asprintf (&newval, "multipart/digest%s", sp);
mu_header_set_value (hdr, MU_HEADER_CONTENT_TYPE, newval, 1);
free (val);
free (newval);
@@ -2576,13 +2576,13 @@ mhn_compose ()
{
*p = 0;
name = mu_tempname (input_file);
- asprintf (&backup, "%s/,%s.orig", input_file, p + 1);
+ mu_asprintf (&backup, "%s/,%s.orig", input_file, p + 1);
*p = '/';
}
else
{
name = mu_tempname (NULL);
- asprintf (&backup, ",%s.orig", input_file);
+ mu_asprintf (&backup, ",%s.orig", input_file);
}
/* Create working draft file */
diff --git a/mh/send.c b/mh/send.c
index a642d8047..ef39d8403 100644
--- a/mh/send.c
+++ b/mh/send.c
@@ -647,7 +647,7 @@ _action_send (void *item, void *data)
const char *pers = get_sender_personal ();
if (pers)
{
- asprintf (&from, "\"%s\" <%s>", pers, email);
+ mu_asprintf (&from, "\"%s\" <%s>", pers, email);
free (email);
}
else
@@ -733,7 +733,7 @@ do_send (int argc, char **argv)
/* Prepend url specifier to the folder dir. We won't need this
when the default format becomes configurable */
- asprintf (&p, "mh:%s", mu_folder_directory ());
+ mu_asprintf (&p, "mh:%s", mu_folder_directory ());
mu_set_folder_directory (p);
free (p);
diff --git a/mimeview/mimetypes.l b/mimeview/mimetypes.l
index 222f9bf79..0d4c126ba 100644
--- a/mimeview/mimetypes.l
+++ b/mimeview/mimetypes.l
@@ -26,7 +26,7 @@
#include <sys/stat.h>
#include <mimeview.h>
#include <mimetypes-decl.h>
-#include <mu_asprintf.h>
+#include <mailutils/io.h>
static int line_num;
static char *file_name;
diff --git a/mimeview/mimetypes.y b/mimeview/mimetypes.y
index 50be1335c..44593c3e2 100644
--- a/mimeview/mimetypes.y
+++ b/mimeview/mimetypes.y
@@ -533,7 +533,7 @@ make_functional_node (char *ident, mu_list_t list)
if (!p->name)
{
char *s;
- asprintf (&s, _("%s: unknown function"), ident);
+ mu_asprintf (&s, _("%s: unknown function"), ident);
yyerror (s);
free (s);
return NULL;
@@ -549,7 +549,7 @@ make_functional_node (char *ident, mu_list_t list)
if (count < i)
{
char *s;
- asprintf (&s, _("too few arguments in call to `%s'"), ident);
+ mu_asprintf (&s, _("too few arguments in call to `%s'"), ident);
yyerror (s);
free (s);
return NULL;
@@ -557,7 +557,7 @@ make_functional_node (char *ident, mu_list_t list)
else if (count > i)
{
char *s;
- asprintf (&s, _("too many arguments in call to `%s'"), ident);
+ mu_asprintf (&s, _("too many arguments in cal