9 date 92.12.15.00.20.22; author jromine; state Exp;
14 date 92.11.04.02.28.49; author jromine; state Exp;
19 date 92.05.19.21.00.21; author jromine; state Exp;
24 date 92.02.10.17.33.44; author jromine; state Exp;
29 date 92.01.31.22.30.01; author jromine; state Exp;
34 date 92.01.31.16.35.55; author jromine; state Exp;
39 date 92.01.30.22.39.58; author jromine; state Exp;
44 date 90.04.05.15.00.25; author sources; state Exp;
49 date 90.03.16.15.27.30; author sources; state Exp;
54 date 90.02.05.15.32.06; author sources; state Exp;
59 date 90.02.05.15.31.51; author sources; state Exp;
73 @/* whom.c - report who a message would go to */
75 static char ident[] = "@@(#)$Id: whom.c,v 1.10 1992/11/04 02:28:49 jromine Exp jromine $";
87 static struct swit switches[] = {
100 "draftfolder +folder", 6,
102 "draftmessage msg", 6,
145 setlocale(LC_ALL, "");
147 invo_name = r1bindex (argv[0], '/');
148 if ((cp = m_find (invo_name)) != NULL) {
149 ap = brkstring (cp = getcpy (cp), " ", "\n");
150 ap = copyip (ap, arguments);
154 (void) copyip (argv + 1, ap);
157 vec[vecp++] = invo_name;
158 vec[vecp++] = "-whom";
159 vec[vecp++] = "-library";
160 vec[vecp++] = getcpy (m_maildir (""));
164 while (cp = *argp++) {
166 switch (smatch (++cp, switches)) {
168 ambigsw (cp, switches);
171 adios (NULLCP, "-%s unknown", cp);
173 (void) sprintf (buf, "%s [switches] [file]", invo_name);
174 help (buf, switches);
189 adios (NULLCP, "only one draft folder at a time!");
190 if (!(cp = *argp++) || *cp == '-')
191 adios (NULLCP, "missing argument to %s", argp[-2]);
192 dfolder = path (*cp == '+' || *cp == '@@' ? cp + 1 : cp,
193 *cp != '@@' ? TFOLDER : TSUBCWF);
197 adios (NULLCP, "only one draft message at a time!");
198 if (!(dmsg = *argp++) || *dmsg == '-')
199 adios (NULLCP, "missing argument to %s", argp[-2]);
210 if (!(cp = *argp++) || *cp == '-')
211 adios (NULLCP, "missing argument to %s", argp[-2]);
216 adios (NULLCP, "only one draft at a time!");
218 vec[vecp++] = msg = cp;
220 if (cp = m_find ("Aliasfile")) { /* allow Aliasfile: profile entry */
223 for (ap = brkstring(dp = getcpy(cp), " ", "\n"); ap && *ap; ap++) {
224 vec[vecp++] = "-alias";
233 if (dfolder || (cp = getenv ("mhdraft")) == NULL || *cp == '\0')
235 cp = getcpy (m_draft (dfolder, dmsg, 1, &isdf));
236 msg = vec[vecp++] = cp;
238 if ((cp = getenv ("mhdist"))
240 && (distsw = atoi (cp))
241 && (cp = getenv ("mhaltmsg"))
243 if (distout (msg, cp, backup) == NOTOK)
245 vec[vecp++] = "-dist";
253 for (i = 0; (child_id = fork ()) == NOTOK && i < 5; i++)
255 switch (distsw ? child_id : OK) {
257 advise (NULLCP, "unable to fork, so checking directly...");
259 execvp (postproc, vec);
260 fprintf (stderr, "unable to exec ");
265 (void) signal (SIGHUP, SIG_IGN);
266 (void) signal (SIGINT, SIG_IGN);
267 (void) signal (SIGQUIT, SIG_IGN);
268 (void) signal (SIGTERM, SIG_IGN);
270 status = pidwait (child_id, OK);
273 if (rename (backup, msg) == NOTOK)
274 adios (msg, "unable to rename %s to", backup);
288 static char ident[] = "@@(#)$Id: whom.c,v 1.9 1992/05/19 21:00:21 jromine Exp jromine $";
303 static char ident[] = "@@(#)$Id: whom.c,v 1.8 1992/02/10 17:33:44 jromine Exp jromine $";
311 @allow "Aliasfile" to be multiple files
316 static char ident[] = "@@(#)$Id: whom.c,v 1.7 1992/01/31 22:30:01 jromine Exp jromine $";
319 if (dfolder || (cp = getenv ("mhdraft")) == NULL || *cp == NULL)
330 static char ident[] = "@@(#)$Id: whom.c,v 1.6 1992/01/31 16:35:55 jromine Exp jromine $";
333 vec[vecp++] = "-alias";
334 vec[vecp++] = getcpy(cp);
345 static char ident[] = "@@(#)$Id: whom.c,v 1.5 1992/01/30 22:39:58 jromine Exp $";
359 static char ident[] = "@@(#)$Id: whom.c,v 1.4 1990/04/05 15:00:25 sources Exp jromine $";
362 if ((cp = getenv ("mhdraft")) == NULL || *cp == NULL)
373 static char ident[] = "@@(#)$Id:$";
385 @add "Aliasfile: file" profile entry (like -alias file)
394 @WP Changes -- "-fill-in file"