- if (text && mp && !is_readonly(mp)) {
- found = 0;
- bp = buffer;
- buflen = sizeof(buffer);
- for (msgnum = mp->lowmsg; msgnum <= mp->hghmsg; msgnum++) {
- if (is_selected(mp, msgnum)) {
- snprintf (bp, buflen, "%s%s", found ? " " : "", m_name (msgnum));
- len = strlen (bp);
- bp += len;
- buflen -= len;
- for (k = msgnum + 1; k <= mp->hghmsg && is_selected(mp, k); k++)
- continue;
- if (--k > msgnum) {
- snprintf (bp, buflen, "-%s", m_name (k));
- len = strlen (bp);
- bp += len;
- buflen -= len;
+ if (text && mp && !is_readonly(mp)) {
+ found = 0;
+ bp = buffer;
+ buflen = sizeof(buffer);
+ for (msgnum = mp->lowmsg; msgnum <= mp->hghmsg; msgnum++) {
+ if (is_selected(mp, msgnum)) {
+ snprintf(bp, buflen, "%s%s", found ? " " : "",
+ m_name(msgnum));
+ len = strlen(bp);
+ bp += len;
+ buflen -= len;
+ for (k = msgnum + 1; k <= mp->hghmsg && is_selected(mp, k); k++)
+ continue;
+ if (--k > msgnum) {
+ snprintf(bp, buflen, "-%s", m_name(k));
+ len = strlen(bp);
+ bp += len;
+ buflen -= len;
+ }
+ msgnum = k + 1;
+ found++;
+ }
+ }
+ if (found) {
+ m_putenv("mhmessages", buffer);
+ m_putenv("mhannotate", text);
+ snprintf(buffer, sizeof(buffer), "%d", inplace);
+ m_putenv("mhinplace", buffer);