X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;f=uip%2Fforw.c;h=53b09683b083848178bfbe01dc52c11c8fe61c47;hb=694fc4000bfe9e5091c30773c49b14c8fbc5c1ad;hp=031c191b5d87f2fe8a44b8108ea88f137bb1d757;hpb=43ea5347b6b445d926082d6e3c1ddec376e8692d;p=mmh diff --git a/uip/forw.c b/uip/forw.c index 031c191..53b0968 100644 --- a/uip/forw.c +++ b/uip/forw.c @@ -238,7 +238,7 @@ main(int argc, char **argv) close(in); } else { fmtstr = new_fs(form, forwcomps); - if (write(out, fmtstr, strlen(fmtstr)) != strlen(fmtstr)) { + if (write(out, fmtstr, strlen(fmtstr)) != (int)strlen(fmtstr)) { adios(drft, "error writing"); } } @@ -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); }