X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;f=uip%2Fforw.c;h=e79e39584ccf637831c76702ec3da8b2a3e8a2aa;hb=d4f5f9d551c05931478fcdfb5cd4ac06b419eeda;hp=8992b33cc97136dfaa33743ec2c755d494bca98c;hpb=88a0787554de9c618e657c31940e734178a25730;p=mmh diff --git a/uip/forw.c b/uip/forw.c index 8992b33..e79e395 100644 --- a/uip/forw.c +++ b/uip/forw.c @@ -278,17 +278,25 @@ add_forw_hdr(char *draft) int msgnum; char buffer[BUFSIZ]; - snprintf(buffer, sizeof(buffer), "+%s", mp->foldpath); + snprintf(buffer, sizeof buffer, "anno -append -nodate '%s' " + "-comp '%s' -text '+%s", + draft, attach_hdr, mp->foldpath); for (msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++) { if (!is_selected(mp, msgnum)) { continue; } - /* TODO: improve the code */ - strncat(buffer, " ", sizeof(buffer)-strlen(buffer)-1); - strncat(buffer, m_name(msgnum), - sizeof(buffer)-strlen(buffer)-1); + /* TODO: Check for buffer length! */ + strcat(buffer, " "); + strcat(buffer, m_name(msgnum)); + } + strcat(buffer, "'"); + /* TODO: This check is bad, but better than nothing */ + if (strlen(buffer) > BUFSIZ) { + adios(NULL, "Too long attachment header line. Forward less messages."); + } + if (system(buffer) != 0) { + advise(NULL, "unable to add attachment header"); } - annotate(draft, attach_hdr, buffer, 0, -2, 1, 0); }