1 /* sendsbr.c -- routines to help WhatNow/Send along
3 * This code is Copyright (c) 2002, by the authors of nmh. See the
4 * COPYRIGHT file in the root directory of the nmh distribution for
5 * complete copyright information.
9 #include "sbr/m_backup.h"
10 #include "sbr/folder_read.h"
11 #include "sbr/folder_free.h"
12 #include "sbr/context_find.h"
13 #include "sbr/brkstring.h"
14 #include "sbr/pidstatus.h"
15 #include "sbr/arglist.h"
16 #include "sbr/error.h"
17 #include "h/fmt_scan.h"
18 #include "h/fmt_compile.h"
19 #include "h/signals.h"
27 #ifdef HAVE_SYS_TIME_H
28 # include <sys/time.h>
36 #include "sbr/m_maildir.h"
37 #include "sbr/m_mktemp.h"
38 #include "sbr/message_id.h"
41 static int setup_oauth_params(char *[], int *, const char *, const char **);
42 #endif /* OAUTH_SUPPORT */
44 int debugsw
= 0; /* global */
52 char *altmsg
= NULL
; /* .. */
53 char *annotext
= NULL
;
54 char *distfile
= NULL
;
61 static void alert (char *, int);
62 static int tmp_fd (void);
63 static void anno (int, struct stat
*);
64 static void annoaux (int);
65 static int splitmsg (char **, int, char *, char *, struct stat
*, int);
66 static int sendaux (char **, int, char *, char *, struct stat
*);
67 static void handle_sendfrom(char **, int *, char *, const char *);
68 static int get_from_header_info(const char *, const char **, const char **, const char **);
69 static const char *get_message_header_info(FILE *, char *);
70 static void merge_profile_entry(const char *, const char *, char *[], int *);
71 static void armed_done (int) NORETURN
;
74 * Entry point into (back-end) routines to send message.
78 sendsbr (char **vec
, int vecp
, char *program
, char *draft
, struct stat
*st
,
79 int rename_drft
, const char *auth_svc
)
83 char buffer
[BUFSIZ
], file
[BUFSIZ
];
85 char **buildvec
, *buildprogram
;
86 char *volatile drft
= draft
;
87 /* nvecs is volatile to prevent warning from gcc about possible clobbering
89 volatile int nvecs
= vecp
;
90 int *nvecsp
= (int *) &nvecs
;
93 * Run the mimebuildproc (which is by default mhbuild) on the message
94 * with the addition of the "-auto" flag
97 switch (child
= fork()) {
99 adios("fork", "unable to");
103 buildvec
= argsplit(buildmimeproc
, &buildprogram
, &i
);
104 buildvec
[i
++] = "-auto";
106 buildvec
[i
++] = "-dist";
107 buildvec
[i
++] = (char *) drft
;
109 execvp(buildprogram
, buildvec
);
110 fprintf(stderr
, "unable to exec ");
111 perror(buildmimeproc
);
116 if (pidXwait(child
, buildmimeproc
))
121 set_done(armed_done
);
122 switch (setjmp (env
)) {
125 * If given -push and -unique (which is undocumented), then
126 * rename the draft file. I'm not quite sure why.
128 if (pushsw
&& unique
) {
129 char *cp
= m_mktemp2(drft
, invo_name
, NULL
, NULL
);
131 die("unable to create temporary file");
133 if (rename (drft
, strncpy(file
, cp
, sizeof(file
))) == NOTOK
)
134 adios (file
, "unable to rename %s to", drft
);
139 * Add in any necessary profile entries for xoauth
145 if (setup_oauth_params(vec
, nvecsp
, auth_svc
, &errmsg
) != OK
) {
149 die("send built without OAUTH_SUPPORT, "
150 "so auth_svc %s is not supported", auth_svc
);
151 #endif /* OAUTH_SUPPORT */
155 * Rework the vec based on From: header in draft, as specified
156 * by sendfrom-address entries in profile.
158 if (context_find_prefix("sendfrom-")) {
159 handle_sendfrom(vec
, nvecsp
, draft
, auth_svc
);
163 * Check if we need to split the message into
164 * multiple messages of type "message/partial".
166 if (splitsw
>= 0 && !distfile
&& stat ((char *) drft
, &sts
) != NOTOK
167 && sts
.st_size
>= CPERMSG
) {
168 status
= splitmsg (vec
, nvecs
, program
, drft
,
169 st
, splitsw
) ? NOTOK
: OK
;
171 status
= sendaux (vec
, nvecs
, program
, drft
, st
) ? NOTOK
: OK
;
174 /* rename the original draft */
175 if (rename_drft
&& status
== OK
&&
176 rename (drft
, strncpy (buffer
, m_backup (drft
),
177 sizeof(buffer
))) == NOTOK
)
178 advise (buffer
, "unable to rename %s to", drft
);
188 (void) m_unlink (distfile
);
194 * Split large message into several messages of
195 * type "message/partial" and send them.
199 splitmsg (char **vec
, int vecp
, char *program
, char *drft
,
200 struct stat
*st
, int delay
)
202 int compnum
, nparts
, partno
, state
, status
;
205 char *cp
, *dp
, buffer
[NMH_BUFSIZ
], msgid
[BUFSIZ
];
206 char subject
[BUFSIZ
];
207 char name
[NAMESZ
], partnum
[BUFSIZ
];
209 m_getfld_state_t gstate
;
211 if ((in
= fopen (drft
, "r")) == NULL
)
212 adios (drft
, "unable to open for reading");
218 * Scan through the message and examine the various header fields,
219 * as well as locate the beginning of the message body.
221 gstate
= m_getfld_state_init(in
);
222 m_getfld_track_filepos2(&gstate
);
223 for (compnum
= 1;;) {
224 int bufsz
= sizeof buffer
;
225 switch (state
= m_getfld2(&gstate
, name
, buffer
, &bufsz
)) {
231 * This header field is discarded.
233 if (!strcasecmp (name
, "Message-ID")) {
234 while (state
== FLDPLUS
) {
235 bufsz
= sizeof buffer
;
236 state
= m_getfld2(&gstate
, name
, buffer
, &bufsz
);
238 } else if (uprf (name
, XXX_FIELD_PRF
)
239 || !strcasecmp (name
, VRSN_FIELD
)
240 || !strcasecmp (name
, "Subject")
241 || !strcasecmp (name
, "Encrypted")) {
243 * These header fields are copied to the enclosed
244 * header of the first message in the collection
245 * of message/partials. For the "Subject" header
246 * field, we also record it, so that a modified
247 * version of it, can be copied to the header
248 * of each message/partial in the collection.
250 if (!strcasecmp (name
, "Subject")) {
253 strncpy (subject
, buffer
, BUFSIZ
);
254 sublen
= strlen (subject
);
255 if (sublen
> 0 && subject
[sublen
- 1] == '\n')
256 subject
[sublen
- 1] = '\0';
259 dp
= add (concat (name
, ":", buffer
, NULL
), dp
);
260 while (state
== FLDPLUS
) {
261 bufsz
= sizeof buffer
;
262 state
= m_getfld2(&gstate
, name
, buffer
, &bufsz
);
263 dp
= add (buffer
, dp
);
267 * These header fields are copied to the header of
268 * each message/partial in the collection.
270 cp
= add (concat (name
, ":", buffer
, NULL
), cp
);
271 while (state
== FLDPLUS
) {
272 bufsz
= sizeof buffer
;
273 state
= m_getfld2(&gstate
, name
, buffer
, &bufsz
);
274 cp
= add (buffer
, cp
);
278 start
= ftell (in
) + 1;
287 die("message format error in component #%d", compnum
);
290 die("getfld () returned %d", state
);
295 m_getfld_state_destroy (&gstate
);
297 die("headers missing from draft");
301 while (fgets (buffer
, sizeof buffer
, in
)) {
304 if ((pos
+= (len
= strlen (buffer
))) > CPERMSG
) {
310 /* Only one part, nothing to split */
316 return sendaux (vec
, vecp
, program
, drft
, st
);
320 printf ("Sending as %d Partial Messages\n", nparts
);
325 vec
[vecp
++] = "-partno";
326 vec
[vecp
++] = partnum
;
328 vec
[vecp
++] = "-queued";
331 snprintf (msgid
, sizeof(msgid
), "%s", message_id (clock
, 0));
333 fseek (in
, start
, SEEK_SET
);
334 for (partno
= 1; partno
<= nparts
; partno
++) {
338 char *cp
= m_mktemp2(drft
, invo_name
, NULL
, &out
);
340 die("unable to create temporary file");
342 strncpy(tmpdrf
, cp
, sizeof(tmpdrf
));
345 * Output the header fields
348 fprintf (out
, "Subject: %s (part %d of %d)\n", subject
, partno
, nparts
);
349 fprintf (out
, "%s: %s\n", VRSN_FIELD
, VRSN_VALUE
);
350 fprintf (out
, "%s: message/partial; id=\"%s\";\n", TYPE_FIELD
, msgid
);
351 fprintf (out
, "\tnumber=%d; total=%d\n", partno
, nparts
);
352 fprintf (out
, "%s: part %d of %d\n\n", DESCR_FIELD
, partno
, nparts
);
355 * If this is the first in the collection, output the
356 * header fields we are encapsulating at the beginning
357 * of the body of the first message.
362 fprintf (out
, "Message-ID: %s\n", msgid
);
370 if (!fgets (buffer
, sizeof buffer
, in
)) {
371 if (partno
== nparts
)
373 die("premature eof");
376 if ((pos
+= (len
= strlen (buffer
))) > CPERMSG
) {
377 fseek (in
, -len
, SEEK_CUR
);
385 adios (tmpdrf
, "error writing to");
389 if (!pushsw
&& verbsw
) {
394 /* Pause here, if a delay is specified */
395 if (delay
> 0 && 1 < partno
&& partno
<= nparts
) {
397 printf ("pausing %d seconds before sending part %d...\n",
401 sleep ((unsigned int) delay
);
404 snprintf (partnum
, sizeof(partnum
), "%d", partno
);
405 status
= sendaux (vec
, vecp
, program
, tmpdrf
, st
);
406 (void) m_unlink (tmpdrf
);
411 * This is so sendaux will only annotate
412 * the altmsg the first time it is called.
420 fclose (in
); /* close the draft */
426 * Annotate original message, and
427 * call `postproc' (which is passed down in "program") to send message.
431 sendaux (char **vec
, int vecp
, char *program
, char *drft
, struct stat
*st
)
435 char backup
[BUFSIZ
], buf
[BUFSIZ
];
437 fd
= pushsw
? tmp_fd () : NOTOK
;
441 if ((fd2
= tmp_fd ()) != NOTOK
) {
442 vec
[vecp
++] = "-idanno";
443 snprintf (buf
, sizeof(buf
), "%d", fd2
);
446 inform("unable to create temporary file in %s for "
447 "annotation list, continuing...", get_temp_dir());
451 if (distfile
&& distout (drft
, distfile
, backup
) == NOTOK
)
458 /* oops -- fork error */
459 adios ("fork", "unable to");
460 break; /* NOT REACHED */
464 * child process -- send it
466 * If fd is OK, then we are pushing and fd points to temp
467 * file, so capture anything on stdout and stderr there.
470 dup2 (fd
, fileno (stdout
));
471 dup2 (fd
, fileno (stderr
));
474 execvp (program
, vec
);
475 fprintf (stderr
, "unable to exec ");
481 * parent process -- wait for it
483 if ((status
= pidwait(child_id
, NOTOK
)) == OK
) {
484 if (annotext
&& fd2
!= NOTOK
)
488 * If postproc failed, and we have good fd (which means
489 * we pushed), then mail error message (and possibly the
490 * draft) back to the user.
496 inform("message not delivered to anyone");
498 if (annotext
&& fd2
!= NOTOK
)
501 (void) m_unlink (drft
);
502 if (rename (backup
, drft
) == NOTOK
)
503 advise (drft
, "unable to rename %s to", backup
);
514 * Mail error notification (and possibly a copy of the
515 * message) back to the user, using the mailproc
519 alert (char *file
, int out
)
530 /* oops -- fork error */
531 advise ("fork", "unable to");
535 /* child process -- send it */
536 SIGNAL (SIGHUP
, SIG_IGN
);
537 SIGNAL (SIGINT
, SIG_IGN
);
538 SIGNAL (SIGQUIT
, SIG_IGN
);
539 SIGNAL (SIGTERM
, SIG_IGN
);
541 if ((in
= open (file
, O_RDONLY
)) == NOTOK
) {
542 admonish (file
, "unable to re-open");
544 lseek(out
, 0, SEEK_END
);
545 strncpy (buf
, "\nMessage not delivered to anyone.\n", sizeof(buf
));
546 if (write (out
, buf
, strlen (buf
)) < 0) {
547 advise (file
, "write");
549 strncpy (buf
, "\n------- Unsent Draft\n\n", sizeof(buf
));
550 if (write (out
, buf
, strlen (buf
)) < 0) {
551 advise (file
, "write");
553 cpydgst (in
, out
, file
, "temporary file");
555 strncpy (buf
, "\n------- End of Unsent Draft\n", sizeof(buf
));
556 if (write (out
, buf
, strlen (buf
)) < 0) {
557 advise (file
, "write");
559 if (rename (file
, strncpy (buf
, m_backup (file
), sizeof(buf
))) == NOTOK
)
560 admonish (buf
, "unable to rename %s to", file
);
563 lseek(out
, 0, SEEK_SET
);
564 dup2 (out
, fileno (stdin
));
566 /* create subject for error notification */
567 snprintf (buf
, sizeof(buf
), "send failed on %s",
568 forwsw
? "enclosed draft" : file
);
570 arglist
= argsplit(mailproc
, &program
, &argp
);
572 arglist
[argp
++] = getusername();
573 arglist
[argp
++] = "-subject";
574 arglist
[argp
++] = buf
;
575 arglist
[argp
] = NULL
;
577 execvp (program
, arglist
);
578 fprintf (stderr
, "unable to exec ");
582 default: /* no waiting... */
594 if ((tfile
= m_mktemp2(NULL
, invo_name
, &fd
, NULL
)) == NULL
) return NOTOK
;
597 inform("temporary file %s selected", tfile
);
598 else if (m_unlink (tfile
) == NOTOK
)
599 advise (tfile
, "unable to remove");
606 anno (int fd
, struct stat
*st
)
610 static char *cwd
= NULL
;
614 (stat (altmsg
, &st2
) == NOTOK
615 || st
->st_mtime
!= st2
.st_mtime
616 || st
->st_dev
!= st2
.st_dev
617 || st
->st_ino
!= st2
.st_ino
)) {
619 inform("$mhaltmsg mismatch, continuing...");
623 child_id
= debugsw
? NOTOK
: fork ();
625 case NOTOK
: /* oops */
627 inform("unable to fork, so doing annotations by hand...");
629 cwd
= mh_xstrdup(pwd ());
633 /* block a few signals */
635 sigaddset (&set
, SIGHUP
);
636 sigaddset (&set
, SIGINT
);
637 sigaddset (&set
, SIGQUIT
);
638 sigaddset (&set
, SIGTERM
);
639 sigprocmask (SIG_BLOCK
, &set
, &oset
);
641 unregister_for_removal(0);
647 /* reset the signal mask */
648 sigprocmask (SIG_SETMASK
, &oset
, &set
);
650 if (chdir (cwd
) < 0) {
651 advise (cwd
, "chdir");
655 default: /* no waiting... */
665 int fd2
, fd3
, msgnum
;
666 char *cp
, *folder
, *maildir
;
667 char buffer
[BUFSIZ
], **ap
;
671 if ((folder
= getenv ("mhfolder")) == NULL
|| *folder
== 0) {
673 inform("$mhfolder not set, continuing...");
676 maildir
= m_maildir (folder
);
677 if (chdir (maildir
) == NOTOK
) {
679 admonish (maildir
, "unable to change directory to");
682 if (!(mp
= folder_read (folder
, 0))) {
684 inform("unable to read folder %s, continuing...", folder
);
688 /* check for empty folder */
689 if (mp
->nummsg
== 0) {
691 inform("no messages in %s, continuing...", folder
);
695 if ((cp
= getenv ("mhmessages")) == NULL
|| *cp
== 0) {
697 inform("$mhmessages not set, continuing...");
700 if (!debugsw
/* MOBY HACK... */
702 && (fd3
= open ("/dev/null", O_RDWR
)) != NOTOK
703 && (fd2
= dup (fileno (stderr
))) != NOTOK
) {
704 dup2 (fd3
, fileno (stderr
));
709 for (ap
= brkstring (cp
= mh_xstrdup(cp
), " ", NULL
); *ap
; ap
++)
713 dup2 (fd2
, fileno (stderr
));
714 if (mp
->numsel
== 0) {
716 inform("no messages to annotate, continuing...");
720 lseek(fd
, 0, SEEK_SET
);
721 if ((fp
= fdopen (fd
, "r")) == NULL
) {
723 inform("unable to fdopen annotation list, continuing...");
727 while (fgets (buffer
, sizeof(buffer
), fp
) != NULL
)
728 cp
= add (buffer
, cp
);
732 inform("annotate%s with %s: \"%s\"",
733 inplace
? " inplace" : "", annotext
, cp
);
734 for (msgnum
= mp
->lowsel
; msgnum
<= mp
->hghsel
; msgnum
++) {
735 if (is_selected(mp
, msgnum
)) {
737 inform("annotate message %d", msgnum
);
738 annotate (m_name (msgnum
), annotext
, cp
, inplace
, 1, -2, 0);
745 folder_free (mp
); /* free folder/message structure */
750 handle_sendfrom(char **vec
, int *vecp
, char *draft
, const char *auth_svc
)
752 const char *addr
, *host
;
755 /* Extract address and host from From: header line in draft. */
756 if (get_from_header_info(draft
, &addr
, &host
, &message
) != OK
) {
757 adios(draft
, "%s", message
);
760 /* Merge in any address or host specific switches to post(1) from profile. */
761 merge_profile_entry(addr
, host
, vec
, vecp
);
770 for (vp
= vec
; *vp
; ++vp
) {
771 if (strcmp(*vp
, "xoauth2") == 0) {
773 if (setup_oauth_params(vec
, vecp
, auth_svc
, &message
) != OK
) {
778 NMH_UNUSED(auth_svc
);
779 die("send built without OAUTH_SUPPORT, "
780 "so -saslmech xoauth2 is not supported");
781 #endif /* OAUTH_SUPPORT */
790 * For XOAUTH2, append profile entries so post can do the heavy lifting
793 setup_oauth_params(char *vec
[], int *vecp
, const char *auth_svc
,
794 const char **message
)
796 const char *saslmech
= NULL
, *user
= NULL
;
797 mh_oauth_service_info svc
;
801 /* Make sure we have all the information we need. */
802 for (i
= 1; i
< *vecp
; ++i
) {
803 /* Don't support abbreviated switches, to avoid collisions in the
804 future if new ones are added. */
805 if (! strcmp(vec
[i
-1], "-saslmech")) {
807 } else if (! strcmp(vec
[i
-1], "-user")) {
809 } else if (! strcmp(vec
[i
-1], "-authservice")) {
814 if (auth_svc
== NULL
) {
815 if (saslmech
&& ! strcasecmp(saslmech
, "xoauth2")) {
816 *message
= "must specify -authservice with -saslmech xoauth2";
821 *message
= "must specify -user with -saslmech xoauth2";
825 if (saslmech
&& ! strcasecmp(saslmech
, "xoauth2")) {
826 if (! mh_oauth_get_service_info(auth_svc
, &svc
, errbuf
,
828 die("Unable to retrieve oauth profile entries: %s",
831 vec
[(*vecp
)++] = mh_xstrdup("-authservice");
832 vec
[(*vecp
)++] = mh_xstrdup(auth_svc
);
833 vec
[(*vecp
)++] = mh_xstrdup("-oauthcredfile");
834 vec
[(*vecp
)++] = mh_oauth_cred_fn(auth_svc
);
835 vec
[(*vecp
)++] = mh_xstrdup("-oauthclientid");
836 vec
[(*vecp
)++] = getcpy(svc
.client_id
);
837 vec
[(*vecp
)++] = mh_xstrdup("-oauthclientsecret");
838 vec
[(*vecp
)++] = getcpy(svc
.client_secret
);
839 vec
[(*vecp
)++] = mh_xstrdup("-oauthauthendpoint");
840 vec
[(*vecp
)++] = getcpy(svc
.auth_endpoint
);
841 vec
[(*vecp
)++] = mh_xstrdup("-oauthredirect");
842 vec
[(*vecp
)++] = getcpy(svc
.redirect_uri
);
843 vec
[(*vecp
)++] = mh_xstrdup("-oauthtokenendpoint");
844 vec
[(*vecp
)++] = getcpy(svc
.token_endpoint
);
845 vec
[(*vecp
)++] = mh_xstrdup("-oauthscope");
846 vec
[(*vecp
)++] = getcpy(svc
.scope
);
852 #endif /* OAUTH_SUPPORT */
856 * Extract user and domain from From: header line in draft.
859 get_from_header_info(const char *filename
, const char **addr
, const char **host
, const char **message
)
864 if (stat (filename
, &st
) == NOTOK
) {
865 *message
= "unable to stat draft file";
869 if ((in
= fopen (filename
, "r")) != NULL
) {
870 /* There must be a non-blank Envelope-From or {Resent-}Sender or
871 {Resent-}From header. */
872 char *addrformat
= "%(addr{Envelope-From})";
873 char *hostformat
= "%(host{Envelope-From})";
875 if ((*addr
= get_message_header_info (in
, addrformat
)) == NULL
||
877 addrformat
= distfile
== NULL
? "%(addr{Sender})" : "%(addr{Resent-Sender})";
878 hostformat
= distfile
== NULL
? "%(host{Sender})" : "%(host{Resent-Sender})";
880 if ((*addr
= get_message_header_info (in
, addrformat
)) == NULL
) {
881 addrformat
= distfile
== NULL
? "%(addr{From})" : "%(addr{Resent-From})";
882 hostformat
= distfile
== NULL
? "%(host{From})" : "%(host{Resent-From})";
884 if ((*addr
= get_message_header_info (in
, addrformat
)) == NULL
) {
885 *message
= "unable to find sender address in";
892 /* Use the hostformat that corresponds to the successful addrformat. */
893 if ((*host
= get_message_header_info(in
, hostformat
)) == NULL
) {
894 *message
= "unable to find sender host";
903 *message
= "unable to open";
909 * Get formatted information from header of a message.
910 * Adapted from process_single_file() in uip/fmttest.c.
913 get_message_header_info(FILE *in
, char *format
)
919 m_getfld_state_t gstate
;
920 charstring_t buffer
= charstring_create(0);
923 dat
[0] = dat
[1] = dat
[4] = 0;
924 dat
[2] = fstat(fileno(in
), &st
) == 0 ? st
.st_size
: 0;
927 (void) fmt_compile(new_fs(NULL
, NULL
, format
), &fmt
, 1);
931 * Read in the message and process the header.
934 parsing_header
= true;
935 gstate
= m_getfld_state_init(in
);
937 char name
[NAMESZ
], rbuf
[NMH_BUFSIZ
];
938 int bufsz
= sizeof rbuf
;
939 int state
= m_getfld2(&gstate
, name
, rbuf
, &bufsz
);
944 int bucket
= fmt_addcomptext(name
, rbuf
);
947 while (state
== FLDPLUS
) {
949 state
= m_getfld2(&gstate
, name
, rbuf
, &bufsz
);
950 fmt_appendcomp(bucket
, name
, rbuf
);
954 while (state
== FLDPLUS
) {
956 state
= m_getfld2(&gstate
, name
, rbuf
, &bufsz
);
961 parsing_header
= false;
963 } while (parsing_header
);
964 m_getfld_state_destroy(&gstate
);
966 fmt_scan(fmt
, buffer
, INT_MAX
, dat
, NULL
);
969 /* Trim trailing newline, if any. */
970 retval
= rtrim(charstring_buffer_copy((buffer
)));
971 charstring_free(buffer
);
981 * Look in profile for entry corresponding to addr or host, and add its contents to vec.
983 * Could do some of this automatically, by looking for:
984 * 1) access-$(mbox{from}) in oauth-svc file using mh_oauth_cred_load(), which isn't
985 * static and doesn't have side effects; free the result with mh_oauth_cred_free())
986 * 2) machine $(mbox{from}) in creds
987 * If no -server passed in from profile or commandline, could use smtp.<svc>.com for gmail,
988 * but that might not generalize for other svcs.
991 merge_profile_entry(const char *addr
, const char *host
, char *vec
[], int *vecp
)
993 char *addr_entry
= concat("sendfrom-", addr
, NULL
);
994 char *profile_entry
= context_find(addr_entry
);
997 if (profile_entry
== NULL
) {
998 /* No entry for the user. Look for one for the host. */
999 char *host_entry
= concat("sendfrom-", host
, NULL
);
1001 profile_entry
= context_find(host_entry
);
1005 /* Use argsplit() to do the real work of splitting the args in the profile entry. */
1006 if (profile_entry
&& *profile_entry
) {
1009 char **profile_vec
= argsplit(profile_entry
, &file
, &profile_vecp
);
1012 for (i
= 0; i
< profile_vecp
; ++i
) {
1013 vec
[(*vecp
)++] = getcpy(profile_vec
[i
]);
1016 arglist_free(file
, profile_vec
);
1021 static void NORETURN
1022 armed_done (int status
)
1024 longjmp (env
, status
? status
: NOTOK
);