3 * whatnowsbr.c -- the WhatNow shell
7 * This code is Copyright (c) 2002, by the authors of nmh. See the
8 * COPYRIGHT file in the root directory of the nmh distribution for
9 * complete copyright information.
11 * Several options have been added to ease the inclusion of attachments
12 * using the header field name mechanism added to anno and send. The
13 * -attach option is used to specify the header field name for attachments.
15 * Several commands have been added at the whatnow prompt:
17 * cd [ directory ] This option works just like the shell's
18 * cd command and lets the user change the
19 * directory from which attachments are
20 * taken so that long path names are not
21 * needed with every file.
23 * ls [ ls-options ] This option works just like the normal
24 * ls command and exists to allow the user
25 * to verify file names in the directory.
27 * pwd This option works just like the normal
28 * pwd command and exists to allow the user
29 * to verify the directory.
31 * attach files This option attaches the named files to
34 * alist [-ln] This option lists the attachments on the
35 * draft. -l gets long listings, -n gets
38 * detach files This option removes attachments from the
39 * detach -n numbers draft. This can be done by file name or
40 * by attachment number.
49 static struct swit whatnowswitches[] = {
51 { "draftfolder +folder", 0 },
53 { "draftmessage msg", 0 },
55 { "nodraftfolder", 0 },
57 { "editor editor", 0 },
61 { "prompt string", 4 },
67 { "attach header-field-name", 0 },
72 * Options at the "whatnow" prompt
74 static struct swit aleqs[] = {
76 { "edit [<editor> <switches>]", 0 },
78 { "refile [<switches>] +folder", 0 },
80 { "mime [<switches>]", 0 },
82 { "display [<switches>]", 0 },
84 { "list [<switches>]", 0 },
86 { "send [<switches>]", 0 },
88 { "push [<switches>]", 0 },
90 { "whom [<switches>]", 0 },
92 { "quit [-delete]", 0 },
96 { "cd [directory]", 0 },
101 #define ATTACHCMDSW 13
103 #define DETACHCMDSW 14
104 { "detach [-n]", 2 },
105 #define ALISTCMDSW 15
106 { "alist [-ln] ", 2 },
110 static char *myprompt = "\nWhat now? ";
115 static int editfile (char **, char **, char *, int, struct msgs *,
116 char *, char *, int);
117 static int sendfile (char **, char *, int);
118 static void sendit (char *, char **, char *, int);
119 static int buildfile (char **, char *);
120 static int check_draft (char *);
121 static int whomfile (char **, char *);
122 static int removefile (char *);
123 static void writelscmd(char *, int, char *, char **);
126 static int copyf (char *, char *);
131 WhatNow (int argc, char **argv)
133 int isdf = 0, nedit = 0, use = 0;
134 char *cp, *dfolder = NULL, *dmsg = NULL;
135 char *ed = NULL, *drft = NULL, *msgnam = NULL;
136 char buf[BUFSIZ], prompt[BUFSIZ];
137 char **argp, **arguments;
139 char *attach = (char *)0; /* attachment header field name */
140 char cwd[MAXPATHLEN + 1]; /* current working directory */
141 char file[MAXPATHLEN + 1]; /* file name buffer */
142 char shell[MAXPATHLEN + 1]; /* shell response buffer */
143 FILE *f; /* read pointer for bgnd proc */
144 char *l; /* set on -l to alist command */
145 int n; /* set on -n to alist command */
147 invo_name = r1bindex (argv[0], '/');
149 /* read user profile/context */
152 arguments = getarguments (invo_name, argc, argv, 1);
156 * Get the initial current working directory.
159 if (getcwd(cwd, sizeof (cwd)) == (char *)0) {
160 adios("getcwd", "could not get working directory");
163 while ((cp = *argp++)) {
165 switch (smatch (++cp, whatnowswitches)) {
167 ambigsw (cp, whatnowswitches);
170 adios (NULL, "-%s unknown", cp);
173 snprintf (buf, sizeof(buf), "%s [switches] [file]", invo_name);
174 print_help (buf, whatnowswitches, 1);
177 print_version(invo_name);
182 adios (NULL, "only one draft folder at a time!");
183 if (!(cp = *argp++) || *cp == '-')
184 adios (NULL, "missing argument to %s", argp[-2]);
185 dfolder = path (*cp == '+' || *cp == '@' ? cp + 1 : cp,
186 *cp != '@' ? TFOLDER : TSUBCWF);
190 adios (NULL, "only one draft message at a time!");
191 if (!(dmsg = *argp++) || *dmsg == '-')
192 adios (NULL, "missing argument to %s", argp[-2]);
200 if (!(ed = *argp++) || *ed == '-')
201 adios (NULL, "missing argument to %s", argp[-2]);
209 if (!(myprompt = *argp++) || *myprompt == '-')
210 adios (NULL, "missing argument to %s", argp[-2]);
214 if (attach != (char *)0)
215 adios(NULL, "only one attachment header field name at a time!");
216 if (!(attach = *argp++) || *attach == '-')
217 adios (NULL, "missing argument to %s", argp[-2]);
222 adios (NULL, "only one draft at a time!");
227 if ((drft == NULL && (drft = getenv ("mhdraft")) == NULL) || *drft == 0)
228 drft = getcpy (m_draft (dfolder, dmsg, 1, &isdf));
230 msgnam = (cp = getenv ("mhaltmsg")) && *cp ? getcpy (cp) : NULL;
232 if ((cp = getenv ("mhuse")) && *cp)
235 if (ed == NULL && ((ed = getenv ("mheditor")) == NULL || *ed == 0)) {
240 /* start editing the draft, unless -noedit was given */
241 if (!nedit && editfile (&ed, NULL, drft, use, NULL, msgnam, NULL, 1) < 0)
244 snprintf (prompt, sizeof(prompt), myprompt, invo_name);
246 if (!(argp = getans (prompt, aleqs))) {
250 switch (smatch (*argp, aleqs)) {
252 /* display the message being replied to, or distributed */
254 showfile (++argp, msgnam);
256 advise (NULL, "no alternate message to display");
260 /* Translate MIME composition file */
261 buildfile (++argp, drft);
265 /* Call an editor on the draft file */
268 if (editfile (&ed, argp, drft, NOUSE, NULL, msgnam, NULL, 1) == NOTOK)
273 /* display the draft file */
274 showfile (++argp, drft);
278 /* Check to whom the draft would be sent */
279 whomfile (++argp, drft);
283 /* Quit, and possibly delete the draft */
284 if (*++argp && (*argp[0] == 'd' ||
285 ((*argp)[0] == '-' && (*argp)[1] == 'd'))) {
288 if (stat (drft, &st) != NOTOK)
289 advise (NULL, "draft left on %s", drft);
294 /* Delete draft and exit */
299 /* Send draft in background */
300 if (sendfile (++argp, drft, 1))
306 sendfile (++argp, drft, 0);
310 /* Refile the draft */
311 if (refile (++argp, drft) == 0)
316 /* Change the working directory for attachments
318 * Run the directory through the user's shell so that
319 * we can take advantage of any syntax that the user
320 * is accustomed to. Read back the absolute path.
323 if (*++argp == (char *)0) {
324 (void)sprintf(buf, "$SHELL -c \"cd;pwd\"");
326 else if (strlen(*argp) >= BUFSIZ) {
327 adios((char *)0, "arguments too long");
330 (void)sprintf(buf, "$SHELL -c \"cd %s;cd %s;pwd\"", cwd, *argp);
332 if ((f = popen(buf, "r")) != (FILE *)0) {
333 fgets(cwd, sizeof (cwd), f);
335 if (strchr(cwd, '\n') != (char *)0)
336 *strchr(cwd, '\n') = '\0';
341 advise("popen", "could not get directory");
347 /* Print the working directory for attachments */
352 /* List files in the current attachment working directory
354 * Use the user's shell so that we can take advantage of any
355 * syntax that the user is accustomed to.
357 writelscmd(buf, sizeof(buf), cwd, argp);
363 * List attachments on current draft. Options are:
365 * -l long listing (full path names)
369 if (attach == (char *)0) {
370 advise((char *)0, "can't list because no header field name was given.");
377 while (*++argp != (char *)0) {
378 if (strcmp(*argp, "-l") == 0)
381 else if (strcmp(*argp, "-n") == 0)
384 else if (strcmp(*argp, "-ln") == 0 || strcmp(*argp, "-nl") == 0) {
396 advise((char *)0, "usage is alist [-ln].");
399 annolist(drft, attach, l, n);
405 * Attach files to current draft.
408 if (attach == (char *)0) {
409 advise((char *)0, "can't attach because no header field name was given.");
414 * Build a command line that causes the user's shell to list the file name
415 * arguments. This handles and wildcard expansion, tilde expansion, etc.
417 writelscmd(buf, sizeof(buf), cwd, argp);
420 * Read back the response from the shell, which contains a number of lines
421 * with one file name per line. Remove off the newline. Determine whether
422 * we have an absolute or relative path name. Prepend the current working
423 * directory to relative path names. Add the attachment annotation to the
427 if ((f = popen(buf, "r")) != (FILE *)0) {
428 while (fgets(shell, sizeof (shell), f) != (char *)0) {
429 *(strchr(shell, '\n')) = '\0';
432 (void)annotate(drft, attach, shell, 1, 0, -2, 1);
434 (void)sprintf(file, "%s/%s", cwd, shell);
435 (void)annotate(drft, attach, file, 1, 0, -2, 1);
442 advise("popen", "could not get file from shell");
449 * Detach files from current draft.
452 if (attach == (char *)0) {
453 advise((char *)0, "can't detach because no header field name was given.");
458 * Scan the arguments for a -n. Mixed file names and numbers aren't allowed,
459 * so this catches a -n anywhere in the argument list.
462 for (n = 0, arguments = argp + 1; *arguments != (char *)0; arguments++) {
463 if (strcmp(*arguments, "-n") == 0) {
470 * A -n was found so interpret the arguments as attachment numbers.
471 * Decrement any remaining argument number that is greater than the one
472 * just processed after processing each one so that the numbering stays
477 for (arguments = argp + 1; *arguments != (char *)0; arguments++) {
478 if (strcmp(*arguments, "-n") == 0)
481 if (**arguments != '\0') {
482 n = atoi(*arguments);
483 (void)annotate(drft, attach, (char *)0, 1, 0, n, 1);
485 for (argp = arguments + 1; *argp != (char *)0; argp++) {
486 if (atoi(*argp) > n) {
487 if (atoi(*argp) == 1)
490 (void)sprintf(*argp, "%d", atoi(*argp) - 1);
498 * The arguments are interpreted as file names. Run them through the
499 * user's shell for wildcard expansion and other goodies. Do this from
500 * the current working directory if the argument is not an absolute path
501 * name (does not begin with a /).
505 for (arguments = argp + 1; *arguments != (char *)0; arguments++) {
506 if (**arguments == '/') {
507 if (strlen(*arguments) + sizeof ("$SHELL -c \"ls \"") >= sizeof (buf))
508 adios((char *)0, "arguments too long");
510 (void)sprintf(buf, "$SHELL -c \"ls %s\"", *arguments);
513 if (strlen(cwd) + strlen(*arguments) + sizeof ("$SHELL -c \" cd ; ls \"") >= sizeof (buf))
514 adios((char *)0, "arguments too long");
516 (void)sprintf(buf, "$SHELL -c \" cd %s;ls %s\"", cwd, *arguments);
519 if ((f = popen(buf, "r")) != (FILE *)0) {
520 while (fgets(shell, sizeof (cwd), f) != (char *)0) {
521 *(strchr(shell, '\n')) = '\0';
522 (void)annotate(drft, attach, shell, 1, 0, 0, 1);
528 advise("popen", "could not get file from shell");
536 /* Unknown command */
537 advise (NULL, "say what?");
546 * Build a command line that causes the user's shell to list the file name
547 * arguments. This handles and wildcard expansion, tilde expansion, etc.
550 writelscmd(char *buf, int bufsz, char *cwd, char **argp)
553 int ln = snprintf(buf, bufsz, "$SHELL -c \" cd %s;ls", cwd);
554 /* NB that some snprintf() return -1 on overflow rather than the
555 * new C99 mandated 'number of chars that would have been written'
557 /* length checks here and inside the loop allow for the
560 if (ln < 0 || ln + 2 > bufsz)
561 adios((char *)0, "arguments too long");
565 while (*++argp != (char *)0) {
567 /* +3 for leading space and trailing quote and NUL */
568 if (ln + 3 > bufsz - (cp-buf))
569 adios((char *)0, "arguments too long");
571 memcpy(cp, *argp, ln+1);
582 static int reedit = 0; /* have we been here before? */
583 static char *edsave = NULL; /* the editor we used previously */
587 editfile (char **ed, char **arg, char *file, int use, struct msgs *mp,
588 char *altmsg, char *cwd, int save_editor)
590 int pid, status, vecp;
591 char altpath[BUFSIZ], linkpath[BUFSIZ];
592 char *cp, *vec[MAXARGS];
598 int oumask; /* PJS: for setting permissions on symlinks. */
600 #endif /* HAVE_LSTAT */
602 /* Was there a previous edit session? */
604 if (!*ed) { /* no explicit editor */
605 *ed = edsave; /* so use the previous one */
606 if ((cp = r1bindex (*ed, '/')) == NULL)
609 /* unless we've specified it via "editor-next" */
610 cp = concat (cp, "-next", NULL);
611 if ((cp = context_find (cp)) != NULL)
615 /* set initial editor */
616 if (*ed == NULL && (*ed = context_find ("editor")) == NULL)
621 if (mp == NULL || *altmsg == '/' || cwd == NULL)
622 strncpy (altpath, altmsg, sizeof(altpath));
624 snprintf (altpath, sizeof(altpath), "%s/%s", mp->foldpath, altmsg);
626 strncpy (linkpath, LINK, sizeof(linkpath));
628 snprintf (linkpath, sizeof(linkpath), "%s/%s", cwd, LINK);
634 if (link (altpath, linkpath) == NOTOK) {
636 /* I don't think permission on symlinks matters /JLR */
637 oumask = umask(0044); /* PJS: else symlinks are world 'r' */
639 symlink (altpath, linkpath);
641 umask(oumask); /* PJS: else symlinks are world 'r' */
647 #else /* not HAVE_LSTAT */
648 link (altpath, linkpath);
649 #endif /* not HAVE_LSTAT */
652 context_save (); /* save the context file */
655 switch (pid = vfork ()) {
657 advise ("fork", "unable to");
666 m_putenv ("mhfolder", mp->foldpath);
667 m_putenv ("editalt", altpath);
671 vec[vecp++] = r1bindex (*ed, '/');
674 vec[vecp++] = *arg++;
679 fprintf (stderr, "unable to exec ");
684 if ((status = pidwait (pid, NOTOK))) {
686 if ((cp = r1bindex (*ed, '/'))
687 && strcmp (cp, "vi") == 0
688 && (status & 0x00ff) == 0)
692 if (((status & 0xff00) != 0xff00)
693 && (!reedit || (status & 0x00ff))) {
694 if (!use && (status & 0xff00) &&
695 (rename (file, cp = m_backup (file)) != NOTOK)) {
696 advise (NULL, "problems with edit--draft left in %s", cp);
698 advise (NULL, "problems with edit--%s preserved", file);
701 status = -2; /* maybe "reedit ? -2 : -1"? */
714 ? lstat (linkpath, &st) != NOTOK
715 && S_ISREG(st.st_mode)
716 && copyf (linkpath, altpath) == NOTOK
717 : stat (linkpath, &st) != NOTOK
719 && (unlink (altpath) == NOTOK
720 || link (linkpath, altpath) == NOTOK)))
721 advise (linkpath, "unable to update %s from", altmsg);
722 #else /* HAVE_LSTAT */
726 && stat (linkpath, &st) != NOTOK
728 && (unlink (altpath) == NOTOK
729 || link (linkpath, altpath) == NOTOK))
730 advise (linkpath, "unable to update %s from", altmsg);
731 #endif /* HAVE_LSTAT */
734 /* normally, we remember which editor we used */
736 edsave = getcpy (*ed);
748 copyf (char *ifile, char *ofile)
753 if ((in = open (ifile, O_RDONLY)) == NOTOK)
755 if ((out = open (ofile, O_WRONLY | O_TRUNC)) == NOTOK) {
756 admonish (ofile, "unable to open and truncate");
761 while ((i = read (in, buffer, sizeof(buffer))) > OK)
762 if (write (out, buffer, i) != i) {
763 advise (ofile, "may have damaged");
772 #endif /* HAVE_LSTAT */
780 sendfile (char **arg, char *file, int pushsw)
784 char *cp, *sp, *vec[MAXARGS];
786 /* Translate MIME composition file, if necessary */
787 if ((cp = context_find ("automimeproc"))
788 && (!strcmp (cp, "1"))
789 && !getenv ("NOMHNPROC")
790 && check_draft (file)
791 && (buildfile (NULL, file) == NOTOK))
794 /* For backwards compatibility */
795 if ((cp = context_find ("automhnproc"))
796 && !getenv ("NOMHNPROC")
797 && check_draft (file)
798 && (i = editfile (&cp, NULL, file, NOUSE, NULL, NULL, NULL, 0)))
802 * If the sendproc is the nmh command `send', then we call
803 * those routines directly rather than exec'ing the command.
805 if (strcmp (sp = r1bindex (sendproc, '/'), "send") == 0) {
807 sendit (invo_name = sp, arg, file, pushsw);
812 context_save (); /* save the context file */
815 for (i = 0; (child_id = vfork()) == NOTOK && i < 5; i++)
819 advise (NULL, "unable to fork, so sending directly...");
822 vec[vecp++] = invo_name;
824 vec[vecp++] = "-push";
827 vec[vecp++] = *arg++;
831 execvp (sendproc, vec);
832 fprintf (stderr, "unable to exec ");
837 if (pidwait(child_id, OK) == 0)
845 * Translate MIME composition file (call buildmimeproc)
849 buildfile (char **argp, char *file)
856 /* allocate space for arguments */
862 args = (char **) mh_xmalloc((i + 2) * sizeof(char *));
865 * For backward compatibility, we need to add -build
866 * if we are using mhn as buildmimeproc
869 if (strcmp (r1bindex (ed, '/'), "mhn") == 0)
870 args[i++] = "-build";
872 /* copy any other arguments */
873 while (argp && *argp)
877 i = editfile (&ed, args, file, NOUSE, NULL, NULL, NULL, 0);
880 return (i ? NOTOK : OK);
885 * Check if draft is a mhbuild composition file
889 check_draft (char *msgnam)
892 char buf[BUFSIZ], name[NAMESZ];
895 if ((fp = fopen (msgnam, "r")) == NULL)
898 switch (state = m_getfld (state, name, buf, sizeof(buf), fp)) {
903 * If draft already contains any of the
904 * Content-XXX fields, then assume it already
907 if (uprf (name, XXX_FIELD_PRF)) {
911 while (state == FLDPLUS)
912 state = m_getfld (state, name, buf, sizeof(buf), fp);
919 for (bp = buf; *bp; bp++)
920 if (*bp != ' ' && *bp != '\t' && *bp != '\n') {
925 state = m_getfld (state, name, buf, sizeof(buf), fp);
926 } while (state == BODY);
937 # define SASLminc(a) (a)
938 #else /* CYRUS_SASL */
939 # define SASLminc(a) 0
940 #endif /* CYRUS_SASL */
942 static struct swit sendswitches[] = {
944 { "alias aliasfile", 0 },
948 { "filter filterfile", 0 },
972 { "split seconds", 0 },
986 { "width columns", 0 },
987 #define SVERSIONSW 22
991 #define BITSTUFFSW 24
992 { "dashstuffing", -12 },
993 #define NBITSTUFFSW 25
994 { "nodashstuffing", -14 },
1004 { "client host", -6 },
1006 { "server host", -6 },
1010 { "draftfolder +folder", -6 },
1012 { "draftmessage msg", -6 },
1014 { "nodraftfolder", -3 },
1016 { "sasl", SASLminc(-4) },
1017 #define SASLMECHSW 37
1018 { "saslmech", SASLminc(-5) },
1020 { "user", SASLminc(-4) },
1021 #define SNDATTACHSW 39
1022 { "attach file", 6 },
1023 #define SNDATTACHFORMAT 40
1024 { "attachformat", 7 },
1029 extern int debugsw; /* from sendsbr.c */
1037 extern char *altmsg; /* .. */
1038 extern char *annotext;
1039 extern char *distfile;
1043 sendit (char *sp, char **arg, char *file, int pushed)
1046 char *cp, buf[BUFSIZ], **argp;
1047 char **arguments, *vec[MAXARGS];
1049 char *attach = (char *)0; /* attachment header field name */
1050 int attachformat = 0; /* mhbuild format specifier for
1061 * Make sure these are defined. In particular, we need
1062 * vec[1] to be NULL, in case "arg" is NULL below. It
1063 * doesn't matter what is the value of vec[0], but we
1064 * set it to NULL, to help catch "off-by-one" errors.
1070 * Temporarily copy arg to vec, since the brkstring() call in
1071 * getarguments() will wipe it out before it is merged in.
1072 * Also, we skip the first element of vec, since getarguments()
1073 * skips it. Then we count the number of arguments
1074 * copied. The value of "n" will be one greater than
1075 * this in order to simulate the standard argc/argv.
1080 copyip (arg, vec+1, MAXARGS-1);
1087 * Merge any arguments from command line (now in vec)
1088 * and arguments from profile.
1090 arguments = getarguments (sp, n, vec, 1);
1102 vecp = 1; /* we'll get the zero'th element later */
1103 vec[vecp++] = "-library";
1104 vec[vecp++] = getcpy (m_maildir (""));
1106 while ((cp = *argp++)) {
1108 switch (smatch (++cp, sendswitches)) {
1110 ambigsw (cp, sendswitches);
1113 advise (NULL, "-%s unknown\n", cp);
1117 snprintf (buf, sizeof(buf), "%s [switches]", sp);
1118 print_help (buf, sendswitches, 1);
1121 print_version (invo_name);
1132 if (!(cp = *argp++) || sscanf (cp, "%d", &splitsw) != 1) {
1133 advise (NULL, "missing argument to %s", argp[-2]);
1161 debugsw++; /* fall */
1190 if (!(cp = *argp++) || *cp == '-') {
1191 advise (NULL, "missing argument to %s", argp[-2]);
1199 if (!(cp = *argp++) || *cp == '-') {
1200 advise (NULL, "missing argument to %s", argp[-2]);
1207 if (!(attach = *argp++) || *attach == '-') {
1208 advise (NULL, "missing argument to %s", argp[-2]);
1213 case SNDATTACHFORMAT:
1214 if (! *argp || **argp == '-')
1215 adios (NULL, "missing argument to %s", argp[-1]);
1217 attachformat = atoi (*argp);
1218 if (attachformat < 0 ||
1219 attachformat > ATTACHFORMATS - 1) {
1220 advise (NULL, "unsupported attachformat %d",
1229 advise (NULL, "usage: %s [switches]", sp);
1233 /* allow Aliasfile: profile entry */
1234 if ((cp = context_find ("Aliasfile"))) {
1238 for (ap = brkstring (dp, " ", "\n"); ap && *ap; ap++) {
1239 vec[vecp++] = "-alias";
1244 if ((cp = getenv ("SIGNATURE")) == NULL || *cp == 0)
1245 if ((cp = context_find ("signature")) && *cp)
1246 m_putenv ("SIGNATURE", cp);
1249 snprintf (buf, sizeof(buf), "%s/.signature", mypath);
1250 if ((fp = fopen (buf, "r")) != NULL
1251 && fgets (buf, sizeof(buf), fp) != NULL) {
1253 if (cp = strchr (buf, '\n'))
1255 m_putenv ("SIGNATURE", buf);
1260 if ((annotext = getenv ("mhannotate")) == NULL || *annotext == 0)
1262 if ((altmsg = getenv ("mhaltmsg")) == NULL || *altmsg == 0)
1264 if (annotext && ((cp = getenv ("mhinplace")) != NULL && *cp != 0))
1265 inplace = atoi (cp);
1267 if ((cp = getenv ("mhdist"))
1270 && (distsw = atoi (cp))
1271 #endif /* not lint */
1273 vec[vecp++] = "-dist";
1274 distfile = getcpy (m_scratch (altmsg, invo_name));
1275 if (link (altmsg, distfile) == NOTOK)
1276 adios (distfile, "unable to link %s to", altmsg);
1281 if (altmsg == NULL || stat (altmsg, &st) == NOTOK) {
1286 if ((pushsw = pushed))
1289 vec[0] = r1bindex (postproc, '/');
1292 if (sendsbr (vec, vecp, file, &st, 1, attach, attachformat) == OK)
1301 whomfile (char **arg, char *file)
1307 context_save (); /* save the context file */
1310 switch (pid = vfork ()) {
1312 advise ("fork", "unable to");
1317 vec[vecp++] = r1bindex (whomproc, '/');
1321 vec[vecp++] = *arg++;
1324 execvp (whomproc, vec);
1325 fprintf (stderr, "unable to exec ");
1327 _exit (-1); /* NOTREACHED */
1330 return (pidwait (pid, NOTOK) & 0377 ? 1 : 0);
1336 * Remove the draft file
1340 removefile (char *drft)
1342 if (unlink (drft) == NOTOK)
1343 adios (drft, "unable to unlink");