- int found, k, msgnum, vecp;
- int len, buflen;
- register char *bp;
- char buffer[BUFSIZ], *vec[MAXARGS];
-
- vecp = 0;
- vec[vecp++] = r1bindex (whatnowproc, '/');
- vec[vecp] = NULL;
-
- m_putenv ("mhdraft", file);
- if (mp)
- m_putenv ("mhfolder", mp->foldpath);
- else
- unputenv ("mhfolder");
- if (altmsg) {
- if (mp == NULL || *altmsg == '/' || cwd == NULL)
- m_putenv ("mhaltmsg", altmsg);
- else {
- snprintf (buffer, sizeof(buffer), "%s/%s", mp->foldpath, altmsg);
- m_putenv ("mhaltmsg", buffer);
- }
- } else {
- unputenv ("mhaltmsg");
- }
- if ((bp = getenv ("mhaltmsg")))/* XXX */
- m_putenv ("editalt", bp);
- snprintf (buffer, sizeof(buffer), "%d", dist);
- m_putenv ("mhdist", buffer);
- if (nedit) {
- unputenv ("mheditor");
- } else {
- m_putenv ("mheditor", ed ? ed : (ed = context_find ("editor"))
- ? ed : defaulteditor);
- }
- snprintf (buffer, sizeof(buffer), "%d", use);
- m_putenv ("mhuse", buffer);
-
- unputenv ("mhmessages");
- unputenv ("mhannotate");
- unputenv ("mhinplace");
-
- 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;
+ int found, k, msgnum, vecp;
+ int len, buflen;
+ register char *bp;
+ char buffer[BUFSIZ], *vec[MAXARGS];
+
+ vecp = 0;
+ vec[vecp++] = mhbasename(whatnowproc);
+ vec[vecp] = NULL;
+
+ m_putenv("mhdraft", file);
+ if (mp)
+ m_putenv("mhfolder", mp->foldpath);
+ else
+ unputenv("mhfolder");
+ if (altmsg) {
+ if (mp == NULL || *altmsg == '/' || cwd == NULL)
+ m_putenv("mhaltmsg", altmsg);
+ else {
+ snprintf(buffer, sizeof(buffer), "%s/%s",
+ mp->foldpath, altmsg);
+ m_putenv("mhaltmsg", buffer);