1 /* whatnowproc.c - exec whatnowproc */
3 static char ident[] = "@(#)$Id: whatnowproc.c,v 1.4 1992/12/15 00:20:22 jromine Exp $";
9 what_now (ed, nedit, use, file, altmsg, dist, mp, text, inplace, cwd)
30 vec[vecp++] = r1bindex (whatnowproc, '/');
33 (void) m_putenv ("mhdraft", file);
35 (void) m_putenv ("mhfolder", mp -> foldpath);
37 (void) unputenv ("mhfolder");
39 if (mp == NULL || *altmsg == '/' || cwd == NULL)
40 (void) m_putenv ("mhaltmsg", altmsg);
42 (void) sprintf (buffer, "%s/%s", mp -> foldpath, altmsg);
43 (void) m_putenv ("mhaltmsg", buffer);
46 (void) unputenv ("mhaltmsg");
47 if (bp = getenv ("mhaltmsg"))/* XXX */
48 (void) m_putenv ("editalt", bp);
49 (void) sprintf (buffer, "%d", dist);
50 (void) m_putenv ("mhdist", buffer);
52 (void) unputenv ("mheditor");
54 (void) m_putenv ("mheditor", ed ? ed : (ed = m_find ("editor")) ? ed : sysed);
55 (void) sprintf (buffer, "%d", use);
56 (void) m_putenv ("mhuse", buffer);
58 (void) unputenv ("mhmessages");
59 (void) unputenv ("mhannotate");
60 (void) unputenv ("mhinplace");
61 if (text && mp && !(mp -> msgflags & READONLY)) {
64 for (msgnum = mp -> lowmsg; msgnum <= mp -> hghmsg; msgnum++)
65 if (mp -> msgstats[msgnum] & SELECTED) {
66 (void) sprintf (bp, "%s%s", found ? " " : "", m_name (msgnum));
69 k <= mp -> hghmsg && mp -> msgstats[k] & SELECTED;
73 (void) sprintf (bp, "-%s", m_name (k));
80 (void) m_putenv ("mhmessages", buffer);
81 (void) m_putenv ("mhannotate", text);
82 (void) sprintf (buffer, "%d", inplace);
83 (void) m_putenv ("mhinplace", buffer);
88 (void) fflush (stdout);
93 if (strcmp (vec[0], "whatnow") == 0) {
98 execvp (whatnowproc, vec);
99 fprintf (stderr, "unable to exec ");
100 perror (whatnowproc);