3 * sendsbr.c -- routines to help WhatNow/Send along
5 * This code is Copyright (c) 2002, by the authors of nmh. See the
6 * COPYRIGHT file in the root directory of the nmh distribution for
7 * complete copyright information.
11 #include <h/fmt_scan.h>
12 #include <h/fmt_compile.h>
13 #include <h/signals.h>
21 #ifdef HAVE_SYS_TIME_H
22 # include <sys/time.h>
29 static int setup_oauth_params(char *[], int *, const char *, const char **);
30 #endif /* OAUTH_SUPPORT */
32 int debugsw
= 0; /* global */
40 char *altmsg
= NULL
; /* .. */
41 char *annotext
= NULL
;
42 char *distfile
= NULL
;
49 static void alert (char *, int);
50 static int tmp_fd (void);
51 static void anno (int, struct stat
*);
52 static void annoaux (int);
53 static int splitmsg (char **, int, char *, char *, struct stat
*, int);
54 static int sendaux (char **, int, char *, char *, struct stat
*);
55 static void handle_sendfrom(char **, int *, char *, const char *);
56 static int get_from_header_info(const char *, const char **, const char **, const char **);
57 static const char *get_message_header_info(FILE *, char *);
58 static void merge_profile_entry(const char *, const char *, char *[], int *);
59 static void armed_done (int) NORETURN
;
62 * Entry point into (back-end) routines to send message.
66 sendsbr (char **vec
, int vecp
, char *program
, char *draft
, struct stat
*st
,
67 int rename_drft
, const char *auth_svc
)
71 char buffer
[BUFSIZ
], file
[BUFSIZ
];
73 char **buildvec
, *buildprogram
;
74 char *volatile drft
= draft
;
75 /* nvecs is volatile to prevent warning from gcc about possible clobbering
77 volatile int nvecs
= vecp
;
78 int *nvecsp
= (int *) &nvecs
;
81 * Run the mimebuildproc (which is by default mhbuild) on the message
82 * with the addition of the "-auto" flag
85 switch (child
= fork()) {
87 adios("fork", "unable to");
91 buildvec
= argsplit(buildmimeproc
, &buildprogram
, &i
);
92 buildvec
[i
++] = "-auto";
94 buildvec
[i
++] = "-dist";
95 buildvec
[i
++] = (char *) drft
;
97 execvp(buildprogram
, buildvec
);
98 fprintf(stderr
, "unable to exec ");
99 perror(buildmimeproc
);
104 if (pidXwait(child
, buildmimeproc
))
110 switch (setjmp (env
)) {
113 * If given -push and -unique (which is undocumented), then
114 * rename the draft file. I'm not quite sure why.
116 if (pushsw
&& unique
) {
117 char *cp
= m_mktemp2(drft
, invo_name
, NULL
, NULL
);
119 adios(NULL
, "unable to create temporary file in %s",
122 if (rename (drft
, strncpy(file
, cp
, sizeof(file
))) == NOTOK
)
123 adios (file
, "unable to rename %s to", drft
);
128 * Add in any necessary profile entries for xoauth
134 if (setup_oauth_params(vec
, nvecsp
, auth_svc
, &errmsg
) != OK
) {
138 adios(NULL
, "send built without OAUTH_SUPPORT, "
139 "so auth_svc %s is not supported", auth_svc
);
140 #endif /* OAUTH_SUPPORT */
144 * Rework the vec based on From: header in draft, as specified
145 * by sendfrom-address entries in profile.
147 if (context_find_prefix("sendfrom-")) {
148 handle_sendfrom(vec
, nvecsp
, draft
, auth_svc
);
152 * Check if we need to split the message into
153 * multiple messages of type "message/partial".
155 if (splitsw
>= 0 && !distfile
&& stat ((char *) drft
, &sts
) != NOTOK
156 && sts
.st_size
>= CPERMSG
) {
157 status
= splitmsg (vec
, nvecs
, program
, drft
,
158 st
, splitsw
) ? NOTOK
: OK
;
160 status
= sendaux (vec
, nvecs
, program
, drft
, st
) ? NOTOK
: OK
;
163 /* rename the original draft */
164 if (rename_drft
&& status
== OK
&&
165 rename (drft
, strncpy (buffer
, m_backup (drft
),
166 sizeof(buffer
))) == NOTOK
)
167 advise (buffer
, "unable to rename %s to", drft
);
177 (void) m_unlink (distfile
);
183 * Split large message into several messages of
184 * type "message/partial" and send them.
188 splitmsg (char **vec
, int vecp
, char *program
, char *drft
,
189 struct stat
*st
, int delay
)
191 int compnum
, nparts
, partno
, state
, status
;
194 char *cp
, *dp
, buffer
[BUFSIZ
], msgid
[BUFSIZ
];
195 char subject
[BUFSIZ
];
196 char name
[NAMESZ
], partnum
[BUFSIZ
];
198 m_getfld_state_t gstate
= 0;
200 if ((in
= fopen (drft
, "r")) == NULL
)
201 adios (drft
, "unable to open for reading");
207 * Scan through the message and examine the various header fields,
208 * as well as locate the beginning of the message body.
210 m_getfld_track_filepos (&gstate
, in
);
211 for (compnum
= 1;;) {
212 int bufsz
= sizeof buffer
;
213 switch (state
= m_getfld (&gstate
, name
, buffer
, &bufsz
, in
)) {
219 * This header field is discarded.
221 if (!strcasecmp (name
, "Message-ID")) {
222 while (state
== FLDPLUS
) {
223 bufsz
= sizeof buffer
;
224 state
= m_getfld (&gstate
, name
, buffer
, &bufsz
, in
);
226 } else if (uprf (name
, XXX_FIELD_PRF
)
227 || !strcasecmp (name
, VRSN_FIELD
)
228 || !strcasecmp (name
, "Subject")
229 || !strcasecmp (name
, "Encrypted")) {
231 * These header fields are copied to the enclosed
232 * header of the first message in the collection
233 * of message/partials. For the "Subject" header
234 * field, we also record it, so that a modified
235 * version of it, can be copied to the header
236 * of each message/partial in the collection.
238 if (!strcasecmp (name
, "Subject")) {
241 strncpy (subject
, buffer
, BUFSIZ
);
242 sublen
= strlen (subject
);
243 if (sublen
> 0 && subject
[sublen
- 1] == '\n')
244 subject
[sublen
- 1] = '\0';
247 dp
= add (concat (name
, ":", buffer
, NULL
), dp
);
248 while (state
== FLDPLUS
) {
249 bufsz
= sizeof buffer
;
250 state
= m_getfld (&gstate
, name
, buffer
, &bufsz
, in
);
251 dp
= add (buffer
, dp
);
255 * These header fields are copied to the header of
256 * each message/partial in the collection.
258 cp
= add (concat (name
, ":", buffer
, NULL
), cp
);
259 while (state
== FLDPLUS
) {
260 bufsz
= sizeof buffer
;
261 state
= m_getfld (&gstate
, name
, buffer
, &bufsz
, in
);
262 cp
= add (buffer
, cp
);
266 start
= ftell (in
) + 1;
275 adios (NULL
, "message format error in component #%d", compnum
);
278 adios (NULL
, "getfld () returned %d", state
);
283 m_getfld_state_destroy (&gstate
);
285 adios (NULL
, "headers missing from draft");
289 while (fgets (buffer
, sizeof buffer
, in
)) {
292 if ((pos
+= (len
= strlen (buffer
))) > CPERMSG
) {
298 /* Only one part, nothing to split */
304 return sendaux (vec
, vecp
, program
, drft
, st
);
308 printf ("Sending as %d Partial Messages\n", nparts
);
313 vec
[vecp
++] = "-partno";
314 vec
[vecp
++] = partnum
;
316 vec
[vecp
++] = "-queued";
319 snprintf (msgid
, sizeof(msgid
), "%s", message_id (clock
, 0));
321 fseek (in
, start
, SEEK_SET
);
322 for (partno
= 1; partno
<= nparts
; partno
++) {
326 char *cp
= m_mktemp2(drft
, invo_name
, NULL
, &out
);
328 adios(NULL
, "unable to create temporary file in %s",
331 strncpy(tmpdrf
, cp
, sizeof(tmpdrf
));
334 * Output the header fields
337 fprintf (out
, "Subject: %s (part %d of %d)\n", subject
, partno
, nparts
);
338 fprintf (out
, "%s: %s\n", VRSN_FIELD
, VRSN_VALUE
);
339 fprintf (out
, "%s: message/partial; id=\"%s\";\n", TYPE_FIELD
, msgid
);
340 fprintf (out
, "\tnumber=%d; total=%d\n", partno
, nparts
);
341 fprintf (out
, "%s: part %d of %d\n\n", DESCR_FIELD
, partno
, nparts
);
344 * If this is the first in the collection, output the
345 * header fields we are encapsulating at the beginning
346 * of the body of the first message.
351 fprintf (out
, "Message-ID: %s\n", msgid
);
359 if (!fgets (buffer
, sizeof buffer
, in
)) {
360 if (partno
== nparts
)
362 adios (NULL
, "premature eof");
365 if ((pos
+= (len
= strlen (buffer
))) > CPERMSG
) {
366 fseek (in
, -len
, SEEK_CUR
);
374 adios (tmpdrf
, "error writing to");
378 if (!pushsw
&& verbsw
) {
383 /* Pause here, if a delay is specified */
384 if (delay
> 0 && 1 < partno
&& partno
<= nparts
) {
386 printf ("pausing %d seconds before sending part %d...\n",
390 sleep ((unsigned int) delay
);
393 snprintf (partnum
, sizeof(partnum
), "%d", partno
);
394 status
= sendaux (vec
, vecp
, program
, tmpdrf
, st
);
395 (void) m_unlink (tmpdrf
);
400 * This is so sendaux will only annotate
401 * the altmsg the first time it is called.
409 fclose (in
); /* close the draft */
415 * Annotate original message, and
416 * call `postproc' (which is passed down in "program") to send message.
420 sendaux (char **vec
, int vecp
, char *program
, char *drft
, struct stat
*st
)
423 int i
, status
, fd
, fd2
;
424 char backup
[BUFSIZ
], buf
[BUFSIZ
];
426 fd
= pushsw
? tmp_fd () : NOTOK
;
430 if ((fd2
= tmp_fd ()) != NOTOK
) {
431 vec
[vecp
++] = "-idanno";
432 snprintf (buf
, sizeof(buf
), "%d", fd2
);
435 admonish (NULL
, "unable to create temporary file in %s "
436 "for annotation list", get_temp_dir());
440 if (distfile
&& distout (drft
, distfile
, backup
) == NOTOK
)
444 for (i
= 0; (child_id
= fork()) == NOTOK
&& i
< 5; i
++)
449 /* oops -- fork error */
450 adios ("fork", "unable to");
451 break; /* NOT REACHED */
455 * child process -- send it
457 * If fd is ok, then we are pushing and fd points to temp
458 * file, so capture anything on stdout and stderr there.
461 dup2 (fd
, fileno (stdout
));
462 dup2 (fd
, fileno (stderr
));
465 execvp (program
, vec
);
466 fprintf (stderr
, "unable to exec ");
472 * parent process -- wait for it
474 if ((status
= pidwait(child_id
, NOTOK
)) == OK
) {
475 if (annotext
&& fd2
!= NOTOK
)
479 * If postproc failed, and we have good fd (which means
480 * we pushed), then mail error message (and possibly the
481 * draft) back to the user.
487 advise (NULL
, "message not delivered to anyone");
489 if (annotext
&& fd2
!= NOTOK
)
492 (void) m_unlink (drft
);
493 if (rename (backup
, drft
) == NOTOK
)
494 advise (drft
, "unable to rename %s to", backup
);
505 * Mail error notification (and possibly a copy of the
506 * message) back to the user, using the mailproc
510 alert (char *file
, int out
)
518 for (i
= 0; (child_id
= fork()) == NOTOK
&& i
< 5; i
++)
523 /* oops -- fork error */
524 advise ("fork", "unable to");
528 /* child process -- send it */
529 SIGNAL (SIGHUP
, SIG_IGN
);
530 SIGNAL (SIGINT
, SIG_IGN
);
531 SIGNAL (SIGQUIT
, SIG_IGN
);
532 SIGNAL (SIGTERM
, SIG_IGN
);
534 if ((in
= open (file
, O_RDONLY
)) == NOTOK
) {
535 admonish (file
, "unable to re-open");
537 lseek (out
, (off_t
) 0, SEEK_END
);
538 strncpy (buf
, "\nMessage not delivered to anyone.\n", sizeof(buf
));
539 if (write (out
, buf
, strlen (buf
)) < 0) {
540 advise (file
, "write");
542 strncpy (buf
, "\n------- Unsent Draft\n\n", sizeof(buf
));
543 if (write (out
, buf
, strlen (buf
)) < 0) {
544 advise (file
, "write");
546 cpydgst (in
, out
, file
, "temporary file");
548 strncpy (buf
, "\n------- End of Unsent Draft\n", sizeof(buf
));
549 if (write (out
, buf
, strlen (buf
)) < 0) {
550 advise (file
, "write");
552 if (rename (file
, strncpy (buf
, m_backup (file
), sizeof(buf
))) == NOTOK
)
553 admonish (buf
, "unable to rename %s to", file
);
556 lseek (out
, (off_t
) 0, SEEK_SET
);
557 dup2 (out
, fileno (stdin
));
559 /* create subject for error notification */
560 snprintf (buf
, sizeof(buf
), "send failed on %s",
561 forwsw
? "enclosed draft" : file
);
563 arglist
= argsplit(mailproc
, &program
, &argp
);
565 arglist
[argp
++] = getusername();
566 arglist
[argp
++] = "-subject";
567 arglist
[argp
++] = buf
;
568 arglist
[argp
] = NULL
;
570 execvp (program
, arglist
);
571 fprintf (stderr
, "unable to exec ");
575 default: /* no waiting... */
587 if ((tfile
= m_mktemp2(NULL
, invo_name
, &fd
, NULL
)) == NULL
) return NOTOK
;
590 advise (NULL
, "temporary file %s selected", tfile
);
592 if (m_unlink (tfile
) == NOTOK
)
593 advise (tfile
, "unable to remove");
600 anno (int fd
, struct stat
*st
)
604 static char *cwd
= NULL
;
608 (stat (altmsg
, &st2
) == NOTOK
609 || st
->st_mtime
!= st2
.st_mtime
610 || st
->st_dev
!= st2
.st_dev
611 || st
->st_ino
!= st2
.st_ino
)) {
613 admonish (NULL
, "$mhaltmsg mismatch");
617 child_id
= debugsw
? NOTOK
: fork ();
619 case NOTOK
: /* oops */
622 "unable to fork, so doing annotations by hand...");
624 cwd
= mh_xstrdup(pwd ());
628 /* block a few signals */
630 sigaddset (&set
, SIGHUP
);
631 sigaddset (&set
, SIGINT
);
632 sigaddset (&set
, SIGQUIT
);
633 sigaddset (&set
, SIGTERM
);
634 sigprocmask (SIG_BLOCK
, &set
, &oset
);
636 unregister_for_removal(0);
642 /* reset the signal mask */
643 sigprocmask (SIG_SETMASK
, &oset
, &set
);
645 if (chdir (cwd
) < 0) {
646 advise (cwd
, "chdir");
650 default: /* no waiting... */
660 int fd2
, fd3
, msgnum
;
661 char *cp
, *folder
, *maildir
;
662 char buffer
[BUFSIZ
], **ap
;
666 if ((folder
= getenv ("mhfolder")) == NULL
|| *folder
== 0) {
668 admonish (NULL
, "$mhfolder not set");
671 maildir
= m_maildir (folder
);
672 if (chdir (maildir
) == NOTOK
) {
674 admonish (maildir
, "unable to change directory to");
677 if (!(mp
= folder_read (folder
, 0))) {
679 admonish (NULL
, "unable to read folder %s", folder
);
683 /* check for empty folder */
684 if (mp
->nummsg
== 0) {
686 admonish (NULL
, "no messages in %s", folder
);
690 if ((cp
= getenv ("mhmessages")) == NULL
|| *cp
== 0) {
692 admonish (NULL
, "$mhmessages not set");
695 if (!debugsw
/* MOBY HACK... */
697 && (fd3
= open ("/dev/null", O_RDWR
)) != NOTOK
698 && (fd2
= dup (fileno (stderr
))) != NOTOK
) {
699 dup2 (fd3
, fileno (stderr
));
704 for (ap
= brkstring (cp
= mh_xstrdup(cp
), " ", NULL
); *ap
; ap
++)
708 dup2 (fd2
, fileno (stderr
));
709 if (mp
->numsel
== 0) {
711 admonish (NULL
, "no messages to annotate");
715 lseek (fd
, (off_t
) 0, SEEK_SET
);
716 if ((fp
= fdopen (fd
, "r")) == NULL
) {
718 admonish (NULL
, "unable to fdopen annotation list");
722 while (fgets (buffer
, sizeof(buffer
), fp
) != NULL
)
723 cp
= add (buffer
, cp
);
727 advise (NULL
, "annotate%s with %s: \"%s\"",
728 inplace
? " inplace" : "", annotext
, cp
);
729 for (msgnum
= mp
->lowsel
; msgnum
<= mp
->hghsel
; msgnum
++) {
730 if (is_selected(mp
, msgnum
)) {
732 advise (NULL
, "annotate message %d", msgnum
);
733 annotate (m_name (msgnum
), annotext
, cp
, inplace
, 1, -2, 0);
740 folder_free (mp
); /* free folder/message structure */
746 handle_sendfrom(char **vec
, int *vecp
, char *draft
, const char *auth_svc
) {
747 const char *addr
, *host
;
750 /* Extract address and host from From: header line in draft. */
751 if (get_from_header_info(draft
, &addr
, &host
, &message
) != OK
) {
752 adios(draft
, message
);
755 /* Merge in any address or host specific switches to post(1) from profile. */
756 merge_profile_entry(addr
, host
, vec
, vecp
);
765 for (vp
= vec
; *vp
; ++vp
) {
766 if (strcmp(*vp
, "xoauth2") == 0) {
768 if (setup_oauth_params(vec
, vecp
, auth_svc
, &message
) != OK
) {
769 adios(NULL
, message
);
773 NMH_UNUSED(auth_svc
);
774 adios(NULL
, "send built without OAUTH_SUPPORT, "
775 "so -saslmech xoauth2 is not supported");
776 #endif /* OAUTH_SUPPORT */
785 * For XOAUTH2, append profile entries so post can do the heavy lifting
788 setup_oauth_params(char *vec
[], int *vecp
, const char *auth_svc
,
789 const char **message
) {
790 const char *saslmech
= NULL
, *user
= NULL
;
791 mh_oauth_service_info svc
;
795 /* Make sure we have all the information we need. */
796 for (i
= 1; i
< *vecp
; ++i
) {
797 /* Don't support abbreviated switches, to avoid collisions in the
798 future if new ones are added. */
799 if (! strcmp(vec
[i
-1], "-saslmech")) {
801 } else if (! strcmp(vec
[i
-1], "-user")) {
803 } else if (! strcmp(vec
[i
-1], "-authservice")) {
808 if (auth_svc
== NULL
) {
809 if (saslmech
&& ! strcasecmp(saslmech
, "xoauth2")) {
810 *message
= "must specify -authservice with -saslmech xoauth2";
815 *message
= "must specify -user with -saslmech xoauth2";
819 if (saslmech
&& ! strcasecmp(saslmech
, "xoauth2")) {
820 if (! mh_oauth_get_service_info(auth_svc
, &svc
, errbuf
,
822 adios(NULL
, "Unable to retrieve oauth profile entries: %s",
825 vec
[(*vecp
)++] = mh_xstrdup("-authservice");
826 vec
[(*vecp
)++] = mh_xstrdup(auth_svc
);
827 vec
[(*vecp
)++] = mh_xstrdup("-oauthcredfile");
828 vec
[(*vecp
)++] = mh_xstrdup(mh_oauth_cred_fn(auth_svc
));
829 vec
[(*vecp
)++] = mh_xstrdup("-oauthclientid");
830 vec
[(*vecp
)++] = getcpy(svc
.client_id
);
831 vec
[(*vecp
)++] = mh_xstrdup("-oauthclientsecret");
832 vec
[(*vecp
)++] = getcpy(svc
.client_secret
);
833 vec
[(*vecp
)++] = mh_xstrdup("-oauthauthendpoint");
834 vec
[(*vecp
)++] = getcpy(svc
.auth_endpoint
);
835 vec
[(*vecp
)++] = mh_xstrdup("-oauthredirect");
836 vec
[(*vecp
)++] = getcpy(svc
.redirect_uri
);
837 vec
[(*vecp
)++] = mh_xstrdup("-oauthtokenendpoint");
838 vec
[(*vecp
)++] = getcpy(svc
.token_endpoint
);
839 vec
[(*vecp
)++] = mh_xstrdup("-oauthscope");
840 vec
[(*vecp
)++] = getcpy(svc
.scope
);
846 #endif /* OAUTH_SUPPORT */
850 * Extract user and domain from From: header line in draft.
854 get_from_header_info(const char *filename
, const char **addr
, const char **host
, const char **message
) {
858 if (stat (filename
, &st
) == NOTOK
) {
859 *message
= "unable to stat draft file";
863 if ((in
= fopen (filename
, "r")) != NULL
) {
864 /* There must be a non-blank Envelope-From or {Resent-}Sender or
865 {Resent-}From header. */
866 char *addrformat
= "%(addr{Envelope-From})";
867 char *hostformat
= "%(host{Envelope-From})";
869 if ((*addr
= get_message_header_info (in
, addrformat
)) == NULL
||
871 addrformat
= distfile
== NULL
? "%(addr{Sender})" : "%(addr{Resent-Sender})";
872 hostformat
= distfile
== NULL
? "%(host{Sender})" : "%(host{Resent-Sender})";
874 if ((*addr
= get_message_header_info (in
, addrformat
)) == NULL
) {
875 addrformat
= distfile
== NULL
? "%(addr{From})" : "%(addr{Resent-From})";
876 hostformat
= distfile
== NULL
? "%(host{From})" : "%(host{Resent-From})";
878 if ((*addr
= get_message_header_info (in
, addrformat
)) == NULL
) {
879 *message
= "unable to find sender address in";
886 /* Use the hostformat that corresponds to the successful addrformat. */
887 if ((*host
= get_message_header_info(in
, hostformat
)) == NULL
) {
889 *message
= "unable to find sender host in";
898 *message
= "unable to open";
904 * Get formatted information from header of a message.
905 * Adapted from process_single_file() in uip/fmttest.c.
909 get_message_header_info(FILE *in
, char *format
) {
914 m_getfld_state_t gstate
= 0;
915 charstring_t buffer
= charstring_create(0);
918 dat
[0] = dat
[1] = dat
[4] = 0;
919 dat
[2] = fstat(fileno(in
), &st
) == 0 ? st
.st_size
: 0;
922 (void) fmt_compile(new_fs(NULL
, NULL
, format
), &fmt
, 1);
926 * Read in the message and process the header.
931 char name
[NAMESZ
], rbuf
[NMH_BUFSIZ
];
932 int bufsz
= sizeof rbuf
;
933 int state
= m_getfld(&gstate
, name
, rbuf
, &bufsz
, in
);
938 int bucket
= fmt_addcomptext(name
, rbuf
);
941 while (state
== FLDPLUS
) {
943 state
= m_getfld(&gstate
, name
, rbuf
, &bufsz
, in
);
944 fmt_appendcomp(bucket
, name
, rbuf
);
948 while (state
== FLDPLUS
) {
950 state
= m_getfld(&gstate
, name
, rbuf
, &bufsz
, in
);
957 } while (parsing_header
);
958 m_getfld_state_destroy(&gstate
);
960 fmt_scan(fmt
, buffer
, INT_MAX
, dat
, NULL
);
963 /* Trim trailing newline, if any. */
964 retval
= rtrim(charstring_buffer_copy((buffer
)));
965 charstring_free(buffer
);
975 * Look in profile for entry corresponding to addr or host, and add its contents to vec.
977 * Could do some of this automatically, by looking for:
978 * 1) access-$(mbox{from}) in oauth-svc file using mh_oauth_cred_load(), which isn't
979 * static and doesn't have side effects; free the result with mh_oauth_cred_free())
980 * 2) machine $(mbox{from}) in creds
981 * If no -server passed in from profile or commandline, could use smtp.<svc>.com for gmail,
982 * but that might not generalize for other svcs.
986 merge_profile_entry(const char *addr
, const char *host
, char *vec
[], int *vecp
) {
987 char *addr_entry
= concat("sendfrom-", addr
, NULL
);
988 char *profile_entry
= context_find(addr_entry
);
991 if (profile_entry
== NULL
) {
992 /* No entry for the user. Look for one for the host. */
993 char *host_entry
= concat("sendfrom-", host
, NULL
);
995 profile_entry
= context_find(host_entry
);
999 /* Use argsplit() to do the real work of splitting the args in the profile entry. */
1000 if (profile_entry
&& *profile_entry
) {
1003 char **profile_vec
= argsplit(profile_entry
, &file
, &profile_vecp
);
1006 for (i
= 0; i
< profile_vecp
; ++i
) {
1007 vec
[(*vecp
)++] = getcpy(profile_vec
[i
]);
1010 arglist_free(file
, profile_vec
);
1016 armed_done (int status
)
1018 longjmp (env
, status
? status
: NOTOK
);