if (unfolded != NULL) {
oldunfolded = *unfolded;
- *unfolded = concatstr(2, oldunfolded, line);
+ xasprintf(unfolded, "%s%s", oldunfolded, line);
free(oldunfolded);
}
chomp(line);
oldretstr = retstr;
- retstr = concatstr(2, oldretstr, line);
+ xasprintf(&retstr, "%s%s", oldretstr, line);
free(oldretstr);
free(line);
#include <sys/stat.h>
#include <ctype.h>
+#include "xmalloc.h"
#include "mlmmj.h"
#include "listcontrol.h"
#include "strgen.h"
#include "controls.h"
#include "mygetline.h"
#include "chomp.h"
-#include "xmalloc.h"
#include "log_oper.h"
#include "subscriberfuncs.h"
/* listname+subconf-digest-COOKIE@domain.tld */
case CTRL_CONFSUB_DIGEST:
- conffilename = concatstr(3, list->dir, "/subconf/", param);
+ xasprintf(&conffilename, "%s/subconf/%s", list->dir, param);
free(param);
if((tmpfd = open(conffilename, O_RDONLY)) < 0) {
/* invalid COOKIE */
/* listname+subconf-nomail-COOKIE@domain.tld */
case CTRL_CONFSUB_NOMAIL:
- conffilename = concatstr(3, list->dir, "/subconf/", param);
+ xasprintf(&conffilename, "%s/subconf/%s", list->dir, param);
free(param);
if((tmpfd = open(conffilename, O_RDONLY)) < 0) {
/* invalid COOKIE */
/* listname+subconf-both-COOKIE@domain.tld */
case CTRL_CONFSUB_BOTH:
- conffilename = concatstr(3, list->dir, "/subconf/", param);
+ xasprintf(&conffilename, "%s/subconf/%s/", list->dir, param);
free(param);
if((tmpfd = open(conffilename, O_RDONLY)) < 0) {
/* invalid COOKIE */
/* listname+subconf-COOKIE@domain.tld */
case CTRL_CONFSUB:
- conffilename = concatstr(3, list->dir, "/subconf/", param);
+ xasprintf(&conffilename, "%s/subconf/%s", list->dir, param);
free(param);
if((tmpfd = open(conffilename, O_RDONLY)) < 0) {
/* invalid COOKIE */
" sent to a closed list. Ignoring mail");
return -1;
}
- conffilename = concatstr(3, list->dir, "/unsubconf/", param);
+ xasprintf(&conffilename, "%s/unsubconf/%s", list->dir, param);
free(param);
if((tmpfd = open(conffilename, O_RDONLY)) < 0) {
/* invalid COOKIE */
" sent to a closed list. Ignoring mail");
return -1;
}
- conffilename = concatstr(3, list->dir, "/unsubconf/", param);
+ xasprintf(&conffilename, "%s/unsubconf/%s", list->dir, param);
free(param);
if((tmpfd = open(conffilename, O_RDONLY)) < 0) {
/* invalid COOKIE */
" sent to a closed list. Ignoring mail");
return -1;
}
- conffilename = concatstr(3, list->dir, "/unsubconf/", param);
+ xasprintf(&conffilename, "%s/unsubconf/%s", list->dir, param);
free(param);
if((tmpfd = open(conffilename, O_RDONLY)) < 0) {
/* invalid COOKIE */
goto permit;
}
- moderatefilename = concatstr(3, list->dir, "/moderation/", param);
+ xasprintf(&moderatefilename, "%s/moderation/%s", list->dir, param);
if(stat(moderatefilename, &stbuf) < 0) {
free(moderatefilename);
/* no mail to moderate */
return -1;
}
- sendfilename = concatstr(2, moderatefilename, ".sending");
+ xasprintf(&sendfilename, "%s.sending", moderatefilename);
/* Rename it to avoid mail being sent twice */
if(rename(moderatefilename, sendfilename) < 0) {
log_error(LOG_ARGS, "Could not rename to .sending");
exit(EXIT_FAILURE);
}
- omitfilename = concatstr(2, moderatefilename, ".omit");
+ xasprintf(&omitfilename, "%s.omit", moderatefilename);
if(stat(omitfilename, &stbuf) == 0) {
tmpfd = open(omitfilename, O_RDONLY);
if(tmpfd < 0) {
/* listname+reject-COOKIE@domain.tld */
case CTRL_REJECT:
- moderatefilename = concatstr(3, list->dir, "/moderation/", param);
+ xasprintf(&moderatefilename, "%s/moderation/%s", list->dir, param);
if(stat(moderatefilename, &stbuf) < 0) {
free(moderatefilename);
/* no mail to moderate */
/* listname+permit-COOKIE@domain.tld */
case CTRL_PERMIT:
permit:
- gatekeepfilename = concatstr(3, list->dir,
- "/moderation/subscribe", param);
+ xasprintf(&gatekeepfilename, "%s/moderation/subscribe%s",
+ list->dir, param);
if(stat(gatekeepfilename, &stbuf) < 0) {
free(gatekeepfilename);
/* no mail to moderate */
/* listname+obstruct-COOKIE@domain.tld */
case CTRL_OBSTRUCT:
- gatekeepfilename = concatstr(3, list->dir,
- "/moderation/subscribe", param);
+ xasprintf(&gatekeepfilename, "%s/moderation/subscribe%s",
+ list->dir, param);
if(stat(gatekeepfilename, &stbuf) < 0) {
free(gatekeepfilename);
/* no mail to moderate */
return -1;
}
}
- archivefilename = concatstr(3, list->dir, "/archive/",
- param);
+ xasprintf(&archivefilename, "%s/archive/%s", list->dir, param);
if(stat(archivefilename, &stbuf) < 0) {
log_error(LOG_ARGS, "Unable to open archive file");
exit(EXIT_FAILURE);
#include <stdlib.h>
#include <stdarg.h>
+#include "xmalloc.h"
#include "mlmmj.h"
#include "log_error.h"
#include "log_oper.h"
#include "strgen.h"
#include "wrappers.h"
-#include "xmalloc.h"
int log_oper(const char *prefix, const char *basename, const char *fmt, ...)
{
int fd, statres;
- char ct[26], *logstr, *logfilename, *tmp, log_msg[256];
+ char ct[26], *logfilename, *tmp, log_msg[256];
struct stat st;
time_t t;
va_list ap;
size_t i;
- logfilename = concatstr(3, prefix, "/", basename);
+ xasprintf(&logfilename, "%s/%s", prefix, basename);
statres = lstat(logfilename, &st);
if(statres < 0 && errno != ENOENT) {
log_error(LOG_ARGS, "Could not stat logfile %s", logfilename);
}
if(statres >= 0 && st.st_size > (off_t)OPLOGSIZE) {
- tmp = concatstr(2, logfilename, ".rotated");
+ xasprintf(&tmp, "%s.rotated", logfilename);
if(rename(logfilename, tmp) < 0) {
log_error(LOG_ARGS, "Could not rename %s,%s",
logfilename, tmp);
va_end(ap);
- logstr = concatstr(4, ct, " ", log_msg, "\n");
- if(dprintf(fd, "%s", logstr) < 0)
+ if(dprintf(fd, "%s %s\n", ct, log_msg) < 0)
log_error(LOG_ARGS, "Could not write to %s", logfilename);
close(fd);
free(logfilename);
- free(logstr);
return 0;
}
myaddr = xstrdup(addr);
- from = concatstr(6, list->name, list->delim, "bounces-probe-", myaddr, "@",
- list->fqdn);
+ xasprintf(&from, "%s%sbounces-probe-%s@%s", list->name, list->delim,
+ myaddr, list->fqdn);
a = strrchr(myaddr, '=');
if (!a) {
free(myaddr);
finish_file_lines(fls);
- probefile = concatstr(4, list->dir, "/bounce/", addr, "-probe");
+ xasprintf(&probefile, "%s/bounce/%s-probe", list->dir, addr);
MY_ASSERT(probefile);
t = time(NULL);
a = xmalloc(32);
CHECKFULLPATH(argv[0]);
bindir = mydirname(argv[0]);
- mlmmjsend = concatstr(2, bindir, "/mlmmj-send");
+ xasprintf(&mlmmjsend, "%s/mlmmj-send", bindir);
free(bindir);
while ((opt = getopt(argc, argv, "hdVL:a:n:m:p")) != -1) {
* construction of the sub/unsub confirmation From header.
*/
if(strcmp(number, "confsub") == 0) {
- a = concatstr(3, list.dir, "/subconf/", address);
+ xasprintf(&a, "%s/subconf/%s", list.dir, address);
unlink(a);
free(a);
if(mailname)
exit(EXIT_SUCCESS);
}
if(strcmp(number, "confunsub") == 0) {
- a = concatstr(3, list.dir, "/unsubconf/", address);
+ xasprintf(&a, "%s/unsubconf/%s", list.dir, address);
unlink(a);
free(a);
if(mailname)
* have horrible names, but please bear with me.
*/
if(strcmp(number, "probe") == 0) {
- a = concatstr(4, list.dir, "/bounce/", address, "-probe");
+ xasprintf(&a, "%s/bounce/%s-probe", list.dir, address);
unlink(a);
unlink(mailname);
free(a);
}
/* save the filename with '=' before replacing it with '@' */
- bfilename = concatstr(3, list.dir, "/bounce/", address);
+ xasprintf(&bfilename, "%s/bounce/%s", address);
a = strrchr(address, '=');
if (!a) {
close(fd);
if(mailname) {
- savename = concatstr(2, bfilename, ".lastmsg");
+ xasprintf(&savename, "%s.lastmsg", bfilename);
rename(mailname, savename);
free(savename);
}
}
if (moderators) {
tmp = *moderators;
- *moderators = concatstr(3, *moderators, buf, "\n");
+ xasprintf(moderators, "%s\n", buf);
free(tmp);
}
free(buf);
memory_lines_state *mls;
char *queuefilename = NULL;
const char *efromismod = NULL;
- const char *mailbasename = mybasename(mailfilename), *to, *reject;
+ const char *mailbasename = mybasename(mailfilename);
+ char *to, *reject;
int notifymod = 0, status, queuefd;
pid_t childpid, pid;
#if 0
free(moderators);
- replyto = concatstr(6, list->name, list->delim, "release-", mailbasename,
- "@", list->fqdn);
- reject = concatstr(6, list->name, list->delim, "reject-", mailbasename,
- "@", list->fqdn);
+ xasprintf(&replyto, "%s%srelease-%s@%s", list->name, list->delim,
+ mailbasename, list->fqdn);
+ xasprintf(&reject, "%s%sreject-%s@%s", list->name, list->delim,
+ mailbasename, list->fqdn);
- from = concatstr(4, list->name, list->delim, "owner@", list->fqdn);
- to = concatstr(3, list->name, "-moderators@", list->fqdn); /* FIXME JFA: Should this be converted? Why, why not? */
+ xasprintf(&from, "%s%sowner@%s", list->name, list->delim, list->fqdn);
+ xasprintf(&to, "%s-moderators@%s", list->name, list->fqdn); /* FIXME JFA: Should this be converted? Why, why not? */
txt = open_text(list, "moderate", "post",
modreason_strs[modreason], NULL, "moderation");
struct mail_headers mh;
int queuefd;
- fromaddr = concatstr(4, list->name, list->delim, "bounces-help@", list->fqdn);
+ xasprintf(&fromaddr, "%s%sbounces-help@%s", list->name, list->delim, list->fqdn);
txt = open_text(list, "deny", "post", cause, NULL, subcause);
MY_ASSERT(txt);
register_unformatted(txt, "subject", subject);
int maxmailsize = 0;
int notmetoo = 0;
int subonlypost = 0, modonlypost = 0, modnonsubposts = 0, foundaddr = 0;
- char *mailfile = NULL, *headerfilename = NULL;
- char *footerfilename = NULL, *donemailname = NULL;
+ char *mailfile = NULL, *donemailname = NULL;
char *randomstr = NULL, *mqueuename, *omitfilename;
char *mlmmjsend, *mlmmjsub, *mlmmjunsub, *mlmmjbounce;
char *bindir, *subjectprefix, *discardname;
log_set_name(argv[0]);
bindir = mydirname(argv[0]);
- mlmmjsend = concatstr(2, bindir, "/mlmmj-send");
- mlmmjsub = concatstr(2, bindir, "/mlmmj-sub");
- mlmmjunsub = concatstr(2, bindir, "/mlmmj-unsub");
- mlmmjbounce = concatstr(2, bindir, "/mlmmj-bounce");
+ xasprintf(&mlmmjsend, "%s/mlmmj-send", bindir);
+ xasprintf(&mlmmjsub, "%s/mlmmj-sub", bindir);
+ xasprintf(&mlmmjunsub, "%s/mlmmj-unsub", bindir);
+ xasprintf(&mlmmjbounce, "%s/mlmmj-bounce", bindir);
free(bindir);
while ((opt = getopt(argc, argv, "hVPm:L:")) != -1) {
free(donemailname);
free(randomstr);
randomstr = random_str();
- donemailname = concatstr(3, list.dir, "/queue/", randomstr);
+ xasprintf(&donemailname, "%s/queue/%s", list.dir, randomstr);
donemailfd = open(donemailname, O_RDWR|O_CREAT|O_EXCL,
S_IRUSR|S_IWUSR);
/* hdrfd is checked in do_all_the_voodoo_here(), because the
* customheaders file might not exist */
- headerfilename = concatstr(2, list.dir, "/control/customheaders");
- hdrfd = open(headerfilename, O_RDONLY);
- free(headerfilename);
+ hdrfd = openat(list.fd, "control/customheaders", O_RDONLY);
/* footfd is checked in do_all_the_voodoo_here(), see above */
- footerfilename = concatstr(2, list.dir, "/control/footer");
- footfd = open(footerfilename, O_RDONLY);
- free(footerfilename);
+ footfd = openat(list.fd, "control/footer", O_RDONLY);
delheaders = ctrlvalues(&list, "delheaders");
if(delheaders == NULL) {
for(i = 0; i < fromemails.emailcount; i++)
printf("fromemails.emaillist[%d] = %s\n",
i, fromemails.emaillist[i]);
- discardname = concatstr(3, list.dir,
- "/queue/discarded/", randomstr);
+ xasprintf(&discardname, "%s/queue/discarded/%s", list.dir,
+ randomstr);
log_error(LOG_ARGS, "Discarding %s due to invalid From:",
mailfile);
for(i = 0; i < fromemails.emailcount; i++)
if (!subject) subject = xstrdup("");
if(recipextra) {
- owner = concatstr(2, list.dir, "/control/owner");
+ xasprintf(&owner, "%s/control/owner", list.dir);
if(owner && strcmp(recipextra, "owner") == 0) {
/* Why is this here, and not in listcontrol() ?
* -- mortenp 20060409 */
if(strcmp(efrom, "") == 0) { /* don't send mails with <> in From
to the list */
- discardname = concatstr(3, list.dir,
- "/queue/discarded/",
- randomstr);
+ xasprintf(&discardname, "%s/queue/discarded/%s", list.dir,
+ randomstr);
errno = 0;
log_error(LOG_ARGS, "Discarding %s due to missing envelope"
" from address", mailfile);
moderated = 1;
modreason = ACCESS;
} else if (accret == DISCARD) {
- discardname = concatstr(3, list.dir,
- "/queue/discarded/", randomstr);
+ xasprintf(&discardname, "%s/queue/discarded/%s",
+ list.dir, randomstr);
free(randomstr);
if(rename(donemailname, discardname) < 0) {
log_error(LOG_ARGS, "could not rename(%s,%s)",
notmetoo = statctrl(&list, "notmetoo");
if(moderated) {
- mqueuename = concatstr(3, list.dir, "/moderation/",
- randomstr);
+ xasprintf(&mqueuename, "%s/moderation/%s", list.dir, randomstr);
free(randomstr);
if(rename(donemailname, mqueuename) < 0) {
log_error(LOG_ARGS, "could not rename(%s,%s)",
}
free(donemailname);
if (notmetoo) {
- omitfilename = concatstr(2, mqueuename, ".omit");
+ xasprintf(&omitfilename, "%s.omit", mqueuename);
omitfd = open(omitfilename, O_RDWR|O_CREAT|O_EXCL, S_IRUSR|S_IWUSR);
if (omitfd < 0) {
log_error(LOG_ARGS, "could not open %s",
#include <fcntl.h>
#include <libgen.h>
+#include "xmalloc.h"
#include "mlmmj.h"
#include "wrappers.h"
#include "mygetline.h"
#include "strgen.h"
#include "log_error.h"
-#include "xmalloc.h"
extern char *optarg;
log_set_name(argv[0]);
bindir = mydirname(argv[0]);
- mlmmjprocess = concatstr(2, bindir, "/mlmmj-process");
+ xasprintf(&mlmmjprocess, "%s/mlmmj-process", bindir);
free(bindir);
while ((opt = getopt(argc, argv, "hPVL:s:e:F")) != -1) {
exit(EXIT_FAILURE);
}
}
-
- infilename = concatstr(3, listdir, "/incoming/", randomstr);
+
+ xasprintf(&infilename, "%s/incoming/%s", listdir, randomstr);
free(randomstr);
fd = open(infilename, O_RDWR|O_CREAT|O_EXCL, S_IRUSR|S_IWUSR);
while(fd < 0 && errno == EEXIST) {
free(infilename);
randomstr = random_str();
- infilename = concatstr(3, listdir, "/incoming/", randomstr);
+ xasprintf(&infilename, "%s/incoming/%s", listdir, randomstr);
free(randomstr);
fd = open(infilename, O_RDWR|O_CREAT|O_EXCL, S_IRUSR|S_IWUSR);
}
log_set_name(argv[0]);
bindir = mydirname(argv[0]);
- mlmmjbounce = concatstr(2, bindir, "/mlmmj-bounce");
+ xasprintf(&mlmmjbounce, "%s/mlmmj-bounce", bindir);
free(bindir);
/* install signal handler for SIGTERM */
deletewhensent = 0;
/* dump data we want when resending first check
* if it already exists. In that case continue */
- tmpstr = concatstr(2, mailfilename, ".mailfrom");
+ xasprintf(&tmpstr, "%s.mailfrom", mailfilename);
if(stat(tmpstr, &st) == 0) {
free(tmpstr);
break;
fsync(tmpfd);
}
close(tmpfd);
- tmpstr = concatstr(2, mailfilename, ".reciptto");
+ xasprintf(&tmpstr, "%s.reciptto", mailfilename);
if(stat(tmpstr, &st) == 0) {
free(tmpstr);
break;
}
close(tmpfd);
if(replyto) {
- tmpstr = concatstr(2, mailfilename,
- ".reply-to");
+ xasprintf(&tmpstr, "%s.reply-to",
+ mailfilename);
if(stat(tmpstr, &st) == 0) {
free(tmpstr);
break;
a = strchr(tmpstr, '@');
MY_ASSERT(a);
*a = '=';
- probefile = concatstr(4, list.dir, "/bounce/", tmpstr,
- "-probe");
+ xasprintf(&probefile, "%s/bounce/%s-probe", list.dir,
+ tmpstr);
unlink(probefile);
free(probefile);
free(tmpstr);
exit(EXIT_FAILURE);
}
- verpfrom = concatstr(6, list.name, list.delim, "bounces-",
- strindex, "@", list.fqdn);
+ xasprintf(&verpfrom, "%s%sbounces-%s@%s", list.name, list.delim,
+ strindex, list.fqdn);
if(digest)
verp = NULL;
for(i = 0; i < submods->count; i++) {
printf("%s", submods->strs[i]);
str = moderators;
- moderators = concatstr(3, moderators, submods->strs[i], "\n");
+ xasprintf(&moderators, "%s%s\n", moderators, submods->strs[i]);
free(str);
}
mls = init_memory_lines(moderators);
}
if (value != NULL) {
- line = concatstr(3, line, value, endpos + 1);
+ xasprintf(&line, "%s%s%s", line, value, endpos + 1);
*pos_p = line + (*pos_p - *line_p);
if (strcmp(value, "$") == 0) {
(*pos_p)++;
char *filename;
text *txt;
- filename = concatstr(7,purpose,"-",action,"-",reason,"-",type);
- filenamelen = strlen(filename);
+ filenamelen = xasprintf(&filename, "%s-%s-%s-%s", purpose, action,
+ reason, type);
do {
if ((txt = open_text_file(list, filename)) != NULL) break;
len = type ? strlen(type) : 0;
free(tmp);
tmp = esc;
}
- line = concatstr(2, line, tmp);
+ xasprintf(&line, "%s%s", line, tmp);
*pos_p = line + (*pos_p - *line_p);
free(*line_p);
*line_p = line;
return;
}
if (!transparent) str = unistr_escaped_to_utf8(str);
- line = concatstr(2, line, str);
+ xasprintf(&line, "%s%s", line, str);
/* The suffix will be added back in get_processed_text_line() */
*pos_p = line + strlen(*line_p);
free(*line_p);
if (*skipwhite_p) {
while (*pos == ' ' || *pos == '\t') pos++;
}
- line = concatstr(2, line, pos);
+ xasprintf(&line, "%s%s", line, pos);
*pos_p = line + (*pos_p - *line_p);
free(*line_p);
*line_p = line;
while (*endpos == ' ' || *endpos == '\t')
endpos++;
}
- line = concatstr(2, line, endpos);
+ xasprintf(&line, "%s%s", line, endpos);
*pos_p = line + (*pos_p - *line_p);
free(*line_p);
*line_p = line;
while (*endpos == ' ' || *endpos == '\t')
endpos++;
}
- line = concatstr(2, line, endpos);
+ xasprintf(&line, "%s%s", line, endpos);
*pos_p = line + (*pos_p - *line_p);
free(*line_p);
*line_p = line;
*skipwhite_p = 0;
if(strcmp(token, "") == 0) {
- line = concatstr(3, line, "%", endpos + 1);
+ xasprintf(&line, "%s%%%s", line, endpos + 1);
*pos_p = line + (*pos_p - *line_p) + 1;
(*width_p)++;
free(*line_p);
} else if(strcmp(token, "^") == 0) {
if (txt->src->prefixlen != 0) {
line[txt->src->prefixlen] = '\0';
- line = concatstr(2, line, endpos + 1);
+ xasprintf(&line, "%s%s", line, endpos + 1);
*width_p = txt->src->prefixwidth;
} else {
line = xstrdup(endpos + 1);
} else if(strcmp(token, "comment") == 0 || strcmp(token, "$") == 0 ) {
pos = endpos + 1;
while (*pos != '\0' && *pos != '\r' && *pos != '\n') pos++;
- line = concatstr(2, line, pos);
+ xasprintf(&line, "%s%s", line, pos);
*pos_p = line + (*pos_p - *line_p);
free(*line_p);
*line_p = line;
if (limit != 0) {
txt->wrapindent = *width_p;
txt->wrapwidth = limit;
- line = concatstr(2, line, endpos + 1);
+ xasprintf(&line, "%s%s", line, endpos + 1);
*pos_p = line + (*pos_p - *line_p);
free(*line_p);
*line_p = line;
}
} else if(strcmp(token, "nowrap") == 0) {
txt->wrapwidth = 0;
- line = concatstr(2, line, endpos + 1);
+ xasprintf(&line, "%s%s", line, endpos + 1);
*pos_p = line + (*pos_p - *line_p);
free(*line_p);
*line_p = line;
if (*token == 'w') txt->wrapmode = WRAP_WORD;
if (*token == 'c') txt->wrapmode = WRAP_CHAR;
if (*token == 'u') txt->wrapmode = WRAP_USER;
- line = concatstr(2, line, endpos + 1);
+ xasprintf(&line, "%s%s", line, endpos + 1);
*pos_p = line + (*pos_p - *line_p);
free(*line_p);
*line_p = line;
return 0;
} else if(strcmp(token, "thin") == 0) {
txt->widthreckoning = WIDTH_THIN;
- line = concatstr(2, line, endpos + 1);
+ xasprintf(&line, "%s%s", line, endpos + 1);
*pos_p = line + (*pos_p - *line_p);
free(*line_p);
*line_p = line;
return 0;
} else if(strcmp(token, "wide") == 0) {
txt->widthreckoning = WIDTH_WIDE;
- line = concatstr(2, line, endpos + 1);
+ xasprintf(&line, "%s%s", line, endpos + 1);
*pos_p = line + (*pos_p - *line_p);
free(*line_p);
*line_p = line;
token += 5;
if (txt->zerowidth != NULL) free(txt->zerowidth);
txt->zerowidth = xstrdup(token);
- line = concatstr(2, line, endpos + 1);
+ xasprintf(&line, "%s%s", line, endpos + 1);
*pos_p = line + (*pos_p - *line_p);
free(*line_p);
*line_p = line;
} else {
if (txt->wrapmode == WRAP_WORD &&
len > wrapindentlen) {
- tmp = concatstr(3, prev, " ", pos);
- len++;
- width++;
+ xasprintf(&tmp, "%s %s", prev,
+ pos);
+ len++;
+ width++;
} else {
- tmp = concatstr(2, prev, pos);
+ xasprintf(&tmp, "%s %s", prev,
+ pos);
}
}
free(line);
else inhibitbreak = 0;
}
*pos = '\0';
- tmp = concatstr(2, line, tmp);
+ xasprintf(&tmp, "%s %s", line, tmp);
pos = tmp + len;
free(line);
line = tmp;
/* Time to cut */
if (pos - line != incision) {
line[incision] = '\0';
- tmp = concatstr(2, line, pos);
+ xasprintf(&tmp, "%s%s", line,
+ pos);
pos = tmp + incision;
free(line);
line = tmp;
/* If something's coming up, it's because
* it was a new line. */
if (*(line + linebreak) != '\0') {
- tmp = concatstr(3, line + linebreak,
- "\n", txt->src->upcoming);
+ xasprintf(&tmp, "%s\n%s",
+ line + linebreak,
+ txt->src->upcoming);
free(txt->src->upcoming);
} else {
tmp = txt->src->upcoming;
txt->src->processedwidth = width;
} else {
tmp = txt->src->upcoming;
- txt->src->upcoming = concatstr(3,
- line, "\n",
- txt->src->upcoming);
+ xasprintf(&txt->src->upcoming, "%s\n%s",
+ line, txt->src->upcoming);
txt->src->processedlen = len;
txt->src->processedwidth = width;
free(line);
}
if (txt->src->suffix != NULL) {
- tmp = concatstr(2, line, txt->src->suffix);
+ xasprintf(&tmp, "%s%s", line, txt->src->suffix);
free(line);
return tmp;
} else {
}
tmp = substitute(from, list, txt);
- headers[0] = concatstr(2, "From: ", tmp);
+ xasprintf(&headers[0], "From: %s", tmp);
free(tmp);
tmp = substitute(to, list, txt);
- headers[1] = concatstr(2, "To: ", tmp);
+ xasprintf(&headers[1], "To: %s", tmp);
free(tmp);
headers[2] = genmsgid(list->fqdn);
chomp(headers[2]);
if(replyto) {
tmp = substitute(replyto, list, txt);
- headers[8] = concatstr(2, "Reply-To: ", tmp);
+ xasprintf(&headers[8], "Reply-To: %s", tmp);
free(tmp);
}
if (strncasecmp(line, "Subject:", len) == 0) {
tmp = unistr_utf8_to_header(tmp);
free(line);
- line = concatstr(2, "Subject: ", tmp);
+ xasprintf(&line, "Subject: %s", tmp);
free(tmp);
}
if(dprintf(outfd, "%s\n", line) < 0) {