int pgpinfd, int pgpoutfd, int pgperrfd,
enum PgpRing keyring, struct ListHead *hints)
{
- char uids[HUGE_STRING];
- char tmpuids[HUGE_STRING];
+ struct Buffer *uids = NULL;
char quoted[HUGE_STRING];
- *uids = '\0';
+ pid_t rc;
+
+ uids = mutt_buffer_new();
+ mutt_buffer_increase_size(uids, HUGE_STRING);
struct ListNode *np = NULL;
STAILQ_FOREACH(np, hints, entries)
{
mutt_file_quote_filename((char *) np->data, quoted, sizeof(quoted));
- snprintf(tmpuids, sizeof(tmpuids), "%s %s", uids, quoted);
- strcpy(uids, tmpuids);
+ mutt_buffer_addstr(uids, quoted);
+ if (STAILQ_NEXT(np, entries))
+ mutt_buffer_addch(uids, ' ');
}
- return pgp_invoke(pgpin, pgpout, pgperr, pgpinfd, pgpoutfd, pgperrfd, false,
- NULL, NULL, uids,
- keyring == PGP_SECRING ? PgpListSecringCommand : PgpListPubringCommand);
+ rc = pgp_invoke(pgpin, pgpout, pgperr, pgpinfd, pgpoutfd, pgperrfd, 0, NULL,
+ NULL, uids->data,
+ keyring == PGP_SECRING ? PgpListSecringCommand : PgpListPubringCommand);
+
+ mutt_buffer_free(&uids);
+ return rc;
}
*/
int mix_send_message(struct ListHead *chain, const char *tempfile)
{
- char cmd[HUGE_STRING];
- char tmp[HUGE_STRING];
+ struct Buffer *cmd = NULL;
char cd_quoted[STRING];
- int i;
+ int i = 0;
- snprintf(cmd, sizeof(cmd), "cat %s | %s -m ", tempfile, Mixmaster);
+ cmd = mutt_buffer_new();
+ mutt_buffer_increase_size(cmd, HUGE_STRING);
+ mutt_buffer_printf(cmd, "cat %s | %s -m ", tempfile, Mixmaster);
struct ListNode *np = NULL;
STAILQ_FOREACH(np, chain, entries)
{
- mutt_str_strfcpy(tmp, cmd, sizeof(tmp));
+ mutt_buffer_addstr(cmd, i ? "," : " -l ");
mutt_file_quote_filename(np->data, cd_quoted, sizeof(cd_quoted));
- snprintf(cmd, sizeof(cmd), "%s%s%s", tmp,
- (np == STAILQ_FIRST(chain)) ? " -l " : ",", cd_quoted);
+ mutt_buffer_addstr(cmd, cd_quoted);
+ i = 1;
}
mutt_endwin();
- i = mutt_system(cmd);
+ i = mutt_system(cmd->data);
if (i != 0)
{
fprintf(stderr, _("Error sending message, child exited %d.\n"), i);
}
}
+ mutt_buffer_free(&cmd);
unlink(tempfile);
return i;
}