head 1.4; access; symbols; locks; strict; comment @ * @; 1.4 date 92.12.15.00.20.22; author jromine; state Exp; branches; next 1.3; 1.3 date 92.11.04.00.36.34; author jromine; state Exp; branches; next 1.2; 1.2 date 92.02.04.17.46.56; author jromine; state Exp; branches; next 1.1; 1.1 date 92.02.04.17.44.08; author jromine; state Exp; branches; next ; desc @formerly sbr/m_whatnow.c @ 1.4 log @endif sugar @ text @/* whatnowproc.c - exec whatnowproc */ #ifndef lint static char ident[] = "@@(#)$Id: whatnowproc.c,v 1.3 1992/11/04 00:36:34 jromine Exp jromine $"; #endif /* lint */ #include "../h/mh.h" #include what_now (ed, nedit, use, file, altmsg, dist, mp, text, inplace, cwd) struct msgs *mp; char *ed, *file, *altmsg, *text, *cwd; int nedit, use, dist, inplace; { int found, k, msgnum, vecp; register char *bp; char buffer[BUFSIZ], *vec[MAXARGS]; vecp = 0; vec[vecp++] = r1bindex (whatnowproc, '/'); vec[vecp] = NULL; (void) m_putenv ("mhdraft", file); if (mp) (void) m_putenv ("mhfolder", mp -> foldpath); else (void) unputenv ("mhfolder"); if (altmsg) if (mp == NULL || *altmsg == '/' || cwd == NULL) (void) m_putenv ("mhaltmsg", altmsg); else { (void) sprintf (buffer, "%s/%s", mp -> foldpath, altmsg); (void) m_putenv ("mhaltmsg", buffer); } else (void) unputenv ("mhaltmsg"); if (bp = getenv ("mhaltmsg"))/* XXX */ (void) m_putenv ("editalt", bp); (void) sprintf (buffer, "%d", dist); (void) m_putenv ("mhdist", buffer); if (nedit) (void) unputenv ("mheditor"); else (void) m_putenv ("mheditor", ed ? ed : (ed = m_find ("editor")) ? ed : sysed); (void) sprintf (buffer, "%d", use); (void) m_putenv ("mhuse", buffer); (void) unputenv ("mhmessages"); (void) unputenv ("mhannotate"); (void) unputenv ("mhinplace"); if (text && mp && !(mp -> msgflags & READONLY)) { found = 0; bp = buffer; for (msgnum = mp -> lowmsg; msgnum <= mp -> hghmsg; msgnum++) if (mp -> msgstats[msgnum] & SELECTED) { (void) sprintf (bp, "%s%s", found ? " " : "", m_name (msgnum)); bp += strlen (bp); for (k = msgnum + 1; k <= mp -> hghmsg && mp -> msgstats[k] & SELECTED; k++) continue; if (--k > msgnum) { (void) sprintf (bp, "-%s", m_name (k)); bp += strlen (bp); } msgnum = k + 1; found++; } if (found) { (void) m_putenv ("mhmessages", buffer); (void) m_putenv ("mhannotate", text); (void) sprintf (buffer, "%d", inplace); (void) m_putenv ("mhinplace", buffer); } } m_update (); (void) fflush (stdout); if (cwd) (void) chdir (cwd); if (strcmp (vec[0], "whatnow") == 0) { WhatNow (vecp, vec); done (0); } execvp (whatnowproc, vec); fprintf (stderr, "unable to exec "); perror (whatnowproc); return 0; } @ 1.3 log @putenv -> m_putenv @ text @d3 2 a4 2 static char ident[] = "@@(#)$Id: whatnowproc.c,v 1.2 1992/02/04 17:46:56 jromine Exp jromine $"; #endif lint @ 1.2 log @rename m_whatnow() to what_now() since it's not a m_ routine @ text @d3 1 a3 1 static char ident[] = "@@(#)$Id: whatnowproc.c,v 1.1 1992/02/04 17:44:08 jromine Exp jromine $"; d33 1 a33 1 (void) putenv ("mhdraft", file); d35 1 a35 1 (void) putenv ("mhfolder", mp -> foldpath); d40 1 a40 1 (void) putenv ("mhaltmsg", altmsg); d43 1 a43 1 (void) putenv ("mhaltmsg", buffer); d48 1 a48 1 (void) putenv ("editalt", bp); d50 1 a50 1 (void) putenv ("mhdist", buffer); d54 1 a54 1 (void) putenv ("mheditor", ed ? ed : (ed = m_find ("editor")) ? ed : sysed); d56 1 a56 1 (void) putenv ("mhuse", buffer); d80 2 a81 2 (void) putenv ("mhmessages", buffer); (void) putenv ("mhannotate", text); d83 1 a83 1 (void) putenv ("mhinplace", buffer); @ 1.1 log @Initial revision @ text @d1 1 a1 1 /* m_whatnow.c - exec whatnowproc */ d3 1 a3 1 static char ident[] = "@@(#)$Id: scan.c,v 1.11 1992/02/03 22:45:20 jromine Exp $"; d9 1 a9 1 m_whatnow (ed, nedit, use, file, altmsg, dist, mp, text, inplace, cwd) @