- if (is_selected(mp, msgnum)) {
- if (digest) {
- strncpy(buffer, msgnum == mp->lowsel ?
- delim3 : delim4, sizeof(buffer));
- } else {
- /* Get buffer ready to go */
- bp = buffer;
- buflen = sizeof(buffer);
-
- strncpy(bp, "\n-------", buflen);
- len = strlen(bp);
- bp += len;
- buflen -= len;
-
- if (msgnum == mp->lowsel) {
- snprintf(bp, buflen, " Forwarded Message%s", mp->numsel > 1 ? "s" : "");
- } else {
- snprintf(bp, buflen, " Message %d", msgcnt);
- }
- len = strlen(bp);
- bp += len;
- buflen -= len;
-
- strncpy(bp, "\n\n", buflen);
- }
- write(out, buffer, strlen(buffer));
-
- if ((fd = open(msgnam = m_name (msgnum), O_RDONLY))
- == NOTOK) {
- admonish(msgnam, "unable to read message");
- continue;
- }
-
- /*
- ** Copy the message. Add RFC934 quoting (dashstuffing)
- ** unless given the -nodashstuffing flag.
- */
- if (dashstuff >= 0)
- cpydgst(fd, out, msgnam, file);
- else
- cpydata(fd, out, msgnam, file);
-
- close(fd);
- msgcnt++;