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 <h/fmt_scan.h>
10 #include <h/fmt_compile.h>
11 #include <h/signals.h>
19 #ifdef HAVE_SYS_TIME_H
20 # include <sys/time.h>
28 #include "sbr/m_maildir.h"
29 #include "sbr/m_mktemp.h"
30 #include "sbr/message_id.h"
33 static int setup_oauth_params(char *[], int *, const char *, const char **);
34 #endif /* OAUTH_SUPPORT */
36 int debugsw
= 0; /* global */
44 char *altmsg
= NULL
; /* .. */
45 char *annotext
= NULL
;
46 char *distfile
= NULL
;
53 static void alert (char *, int);
54 static int tmp_fd (void);
55 static void anno (int, struct stat
*);
56 static void annoaux (int);
57 static int splitmsg (char **, int, char *, char *, struct stat
*, int);
58 static int sendaux (char **, int, char *, char *, struct stat
*);
59 static void handle_sendfrom(char **, int *, char *, const char *);
60 static int get_from_header_info(const char *, const char **, const char **, const char **);
61 static const char *get_message_header_info(FILE *, char *);
62 static void merge_profile_entry(const char *, const char *, char *[], int *);
63 static void armed_done (int) NORETURN
;
66 * Entry point into (back-end) routines to send message.
70 sendsbr (char **vec
, int vecp
, char *program
, char *draft
, struct stat
*st
,
71 int rename_drft
, const char *auth_svc
)
75 char buffer
[BUFSIZ
], file
[BUFSIZ
];
77 char **buildvec
, *buildprogram
;
78 char *volatile drft
= draft
;
79 /* nvecs is volatile to prevent warning from gcc about possible clobbering
81 volatile int nvecs
= vecp
;
82 int *nvecsp
= (int *) &nvecs
;
85 * Run the mimebuildproc (which is by default mhbuild) on the message
86 * with the addition of the "-auto" flag
89 switch (child
= fork()) {
91 adios("fork", "unable to");
95 buildvec
= argsplit(buildmimeproc
, &buildprogram
, &i
);
96 buildvec
[i
++] = "-auto";
98 buildvec
[i
++] = "-dist";
99 buildvec
[i
++] = (char *) drft
;
101 execvp(buildprogram
, buildvec
);
102 fprintf(stderr
, "unable to exec ");
103 perror(buildmimeproc
);
108 if (pidXwait(child
, buildmimeproc
))
113 set_done(armed_done
);
114 switch (setjmp (env
)) {
117 * If given -push and -unique (which is undocumented), then
118 * rename the draft file. I'm not quite sure why.
120 if (pushsw
&& unique
) {
121 char *cp
= m_mktemp2(drft
, invo_name
, NULL
, NULL
);
123 adios(NULL
, "unable to create temporary file in %s",
126 if (rename (drft
, strncpy(file
, cp
, sizeof(file
))) == NOTOK
)
127 adios (file
, "unable to rename %s to", drft
);
132 * Add in any necessary profile entries for xoauth
138 if (setup_oauth_params(vec
, nvecsp
, auth_svc
, &errmsg
) != OK
) {
139 adios(NULL
, "%s", errmsg
);
142 adios(NULL
, "send built without OAUTH_SUPPORT, "
143 "so auth_svc %s is not supported", auth_svc
);
144 #endif /* OAUTH_SUPPORT */
148 * Rework the vec based on From: header in draft, as specified
149 * by sendfrom-address entries in profile.
151 if (context_find_prefix("sendfrom-")) {
152 handle_sendfrom(vec
, nvecsp
, draft
, auth_svc
);
156 * Check if we need to split the message into
157 * multiple messages of type "message/partial".
159 if (splitsw
>= 0 && !distfile
&& stat ((char *) drft
, &sts
) != NOTOK
160 && sts
.st_size
>= CPERMSG
) {
161 status
= splitmsg (vec
, nvecs
, program
, drft
,
162 st
, splitsw
) ? NOTOK
: OK
;
164 status
= sendaux (vec
, nvecs
, program
, drft
, st
) ? NOTOK
: OK
;
167 /* rename the original draft */
168 if (rename_drft
&& status
== OK
&&
169 rename (drft
, strncpy (buffer
, m_backup (drft
),
170 sizeof(buffer
))) == NOTOK
)
171 advise (buffer
, "unable to rename %s to", drft
);
181 (void) m_unlink (distfile
);
187 * Split large message into several messages of
188 * type "message/partial" and send them.
192 splitmsg (char **vec
, int vecp
, char *program
, char *drft
,
193 struct stat
*st
, int delay
)
195 int compnum
, nparts
, partno
, state
, status
;
198 char *cp
, *dp
, buffer
[NMH_BUFSIZ
], msgid
[BUFSIZ
];
199 char subject
[BUFSIZ
];
200 char name
[NAMESZ
], partnum
[BUFSIZ
];
202 m_getfld_state_t gstate
;
204 if ((in
= fopen (drft
, "r")) == NULL
)
205 adios (drft
, "unable to open for reading");
211 * Scan through the message and examine the various header fields,
212 * as well as locate the beginning of the message body.
214 gstate
= m_getfld_state_init(in
);
215 m_getfld_track_filepos2(&gstate
);
216 for (compnum
= 1;;) {
217 int bufsz
= sizeof buffer
;
218 switch (state
= m_getfld2(&gstate
, name
, buffer
, &bufsz
)) {
224 * This header field is discarded.
226 if (!strcasecmp (name
, "Message-ID")) {
227 while (state
== FLDPLUS
) {
228 bufsz
= sizeof buffer
;
229 state
= m_getfld2(&gstate
, name
, buffer
, &bufsz
);
231 } else if (uprf (name
, XXX_FIELD_PRF
)
232 || !strcasecmp (name
, VRSN_FIELD
)
233 || !strcasecmp (name
, "Subject")
234 || !strcasecmp (name
, "Encrypted")) {
236 * These header fields are copied to the enclosed
237 * header of the first message in the collection
238 * of message/partials. For the "Subject" header
239 * field, we also record it, so that a modified
240 * version of it, can be copied to the header
241 * of each message/partial in the collection.
243 if (!strcasecmp (name
, "Subject")) {
246 strncpy (subject
, buffer
, BUFSIZ
);
247 sublen
= strlen (subject
);
248 if (sublen
> 0 && subject
[sublen
- 1] == '\n')
249 subject
[sublen
- 1] = '\0';
252 dp
= add (concat (name
, ":", buffer
, NULL
), dp
);
253 while (state
== FLDPLUS
) {
254 bufsz
= sizeof buffer
;
255 state
= m_getfld2(&gstate
, name
, buffer
, &bufsz
);
256 dp
= add (buffer
, dp
);
260 * These header fields are copied to the header of
261 * each message/partial in the collection.
263 cp
= add (concat (name
, ":", buffer
, NULL
), cp
);
264 while (state
== FLDPLUS
) {
265 bufsz
= sizeof buffer
;
266 state
= m_getfld2(&gstate
, name
, buffer
, &bufsz
);
267 cp
= add (buffer
, cp
);
271 start
= ftell (in
) + 1;
280 adios (NULL
, "message format error in component #%d", compnum
);
283 adios (NULL
, "getfld () returned %d", state
);
288 m_getfld_state_destroy (&gstate
);
290 adios (NULL
, "headers missing from draft");
294 while (fgets (buffer
, sizeof buffer
, in
)) {
297 if ((pos
+= (len
= strlen (buffer
))) > CPERMSG
) {
303 /* Only one part, nothing to split */
309 return sendaux (vec
, vecp
, program
, drft
, st
);
313 printf ("Sending as %d Partial Messages\n", nparts
);
318 vec
[vecp
++] = "-partno";
319 vec
[vecp
++] = partnum
;
321 vec
[vecp
++] = "-queued";
324 snprintf (msgid
, sizeof(msgid
), "%s", message_id (clock
, 0));
326 fseek (in
, start
, SEEK_SET
);
327 for (partno
= 1; partno
<= nparts
; partno
++) {
331 char *cp
= m_mktemp2(drft
, invo_name
, NULL
, &out
);
333 adios(NULL
, "unable to create temporary file in %s",
336 strncpy(tmpdrf
, cp
, sizeof(tmpdrf
));
339 * Output the header fields
342 fprintf (out
, "Subject: %s (part %d of %d)\n", subject
, partno
, nparts
);
343 fprintf (out
, "%s: %s\n", VRSN_FIELD
, VRSN_VALUE
);
344 fprintf (out
, "%s: message/partial; id=\"%s\";\n", TYPE_FIELD
, msgid
);
345 fprintf (out
, "\tnumber=%d; total=%d\n", partno
, nparts
);
346 fprintf (out
, "%s: part %d of %d\n\n", DESCR_FIELD
, partno
, nparts
);
349 * If this is the first in the collection, output the
350 * header fields we are encapsulating at the beginning
351 * of the body of the first message.
356 fprintf (out
, "Message-ID: %s\n", msgid
);
364 if (!fgets (buffer
, sizeof buffer
, in
)) {
365 if (partno
== nparts
)
367 adios (NULL
, "premature eof");
370 if ((pos
+= (len
= strlen (buffer
))) > CPERMSG
) {
371 fseek (in
, -len
, SEEK_CUR
);
379 adios (tmpdrf
, "error writing to");
383 if (!pushsw
&& verbsw
) {
388 /* Pause here, if a delay is specified */
389 if (delay
> 0 && 1 < partno
&& partno
<= nparts
) {
391 printf ("pausing %d seconds before sending part %d...\n",
395 sleep ((unsigned int) delay
);
398 snprintf (partnum
, sizeof(partnum
), "%d", partno
);
399 status
= sendaux (vec
, vecp
, program
, tmpdrf
, st
);
400 (void) m_unlink (tmpdrf
);
405 * This is so sendaux will only annotate
406 * the altmsg the first time it is called.
414 fclose (in
); /* close the draft */
420 * Annotate original message, and
421 * call `postproc' (which is passed down in "program") to send message.
425 sendaux (char **vec
, int vecp
, char *program
, char *drft
, struct stat
*st
)
429 char backup
[BUFSIZ
], buf
[BUFSIZ
];
431 fd
= pushsw
? tmp_fd () : NOTOK
;
435 if ((fd2
= tmp_fd ()) != NOTOK
) {
436 vec
[vecp
++] = "-idanno";
437 snprintf (buf
, sizeof(buf
), "%d", fd2
);
440 inform("unable to create temporary file in %s for "
441 "annotation list, continuing...", get_temp_dir());
445 if (distfile
&& distout (drft
, distfile
, backup
) == NOTOK
)
452 /* oops -- fork error */
453 adios ("fork", "unable to");
454 break; /* NOT REACHED */
458 * child process -- send it
460 * If fd is OK, then we are pushing and fd points to temp
461 * file, so capture anything on stdout and stderr there.
464 dup2 (fd
, fileno (stdout
));
465 dup2 (fd
, fileno (stderr
));
468 execvp (program
, vec
);
469 fprintf (stderr
, "unable to exec ");
475 * parent process -- wait for it
477 if ((status
= pidwait(child_id
, NOTOK
)) == OK
) {
478 if (annotext
&& fd2
!= NOTOK
)
482 * If postproc failed, and we have good fd (which means
483 * we pushed), then mail error message (and possibly the
484 * draft) back to the user.
490 inform("message not delivered to anyone");
492 if (annotext
&& fd2
!= NOTOK
)
495 (void) m_unlink (drft
);
496 if (rename (backup
, drft
) == NOTOK
)
497 advise (drft
, "unable to rename %s to", backup
);
508 * Mail error notification (and possibly a copy of the
509 * message) back to the user, using the mailproc
513 alert (char *file
, int out
)
524 /* oops -- fork error */
525 advise ("fork", "unable to");
529 /* child process -- send it */
530 SIGNAL (SIGHUP
, SIG_IGN
);
531 SIGNAL (SIGINT
, SIG_IGN
);
532 SIGNAL (SIGQUIT
, SIG_IGN
);
533 SIGNAL (SIGTERM
, SIG_IGN
);
535 if ((in
= open (file
, O_RDONLY
)) == NOTOK
) {
536 admonish (file
, "unable to re-open");
538 lseek(out
, 0, SEEK_END
);
539 strncpy (buf
, "\nMessage not delivered to anyone.\n", sizeof(buf
));
540 if (write (out
, buf
, strlen (buf
)) < 0) {
541 advise (file
, "write");
543 strncpy (buf
, "\n------- Unsent Draft\n\n", sizeof(buf
));
544 if (write (out
, buf
, strlen (buf
)) < 0) {
545 advise (file
, "write");
547 cpydgst (in
, out
, file
, "temporary file");
549 strncpy (buf
, "\n------- End of Unsent Draft\n", sizeof(buf
));
550 if (write (out
, buf
, strlen (buf
)) < 0) {
551 advise (file
, "write");
553 if (rename (file
, strncpy (buf
, m_backup (file
), sizeof(buf
))) == NOTOK
)
554 admonish (buf
, "unable to rename %s to", file
);
557 lseek(out
, 0, SEEK_SET
);
558 dup2 (out
, fileno (stdin
));
560 /* create subject for error notification */
561 snprintf (buf
, sizeof(buf
), "send failed on %s",
562 forwsw
? "enclosed draft" : file
);
564 arglist
= argsplit(mailproc
, &program
, &argp
);
566 arglist
[argp
++] = getusername();
567 arglist
[argp
++] = "-subject";
568 arglist
[argp
++] = buf
;
569 arglist
[argp
] = NULL
;
571 execvp (program
, arglist
);
572 fprintf (stderr
, "unable to exec ");
576 default: /* no waiting... */
588 if ((tfile
= m_mktemp2(NULL
, invo_name
, &fd
, NULL
)) == NULL
) return NOTOK
;
591 inform("temporary file %s selected", tfile
);
592 else 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 inform("$mhaltmsg mismatch, continuing...");
617 child_id
= debugsw
? NOTOK
: fork ();
619 case NOTOK
: /* oops */
621 inform("unable to fork, so doing annotations by hand...");
623 cwd
= mh_xstrdup(pwd ());
627 /* block a few signals */
629 sigaddset (&set
, SIGHUP
);
630 sigaddset (&set
, SIGINT
);
631 sigaddset (&set
, SIGQUIT
);
632 sigaddset (&set
, SIGTERM
);
633 sigprocmask (SIG_BLOCK
, &set
, &oset
);
635 unregister_for_removal(0);
641 /* reset the signal mask */
642 sigprocmask (SIG_SETMASK
, &oset
, &set
);
644 if (chdir (cwd
) < 0) {
645 advise (cwd
, "chdir");
649 default: /* no waiting... */
659 int fd2
, fd3
, msgnum
;
660 char *cp
, *folder
, *maildir
;
661 char buffer
[BUFSIZ
], **ap
;
665 if ((folder
= getenv ("mhfolder")) == NULL
|| *folder
== 0) {
667 inform("$mhfolder not set, continuing...");
670 maildir
= m_maildir (folder
);
671 if (chdir (maildir
) == NOTOK
) {
673 admonish (maildir
, "unable to change directory to");
676 if (!(mp
= folder_read (folder
, 0))) {
678 inform("unable to read folder %s, continuing...", folder
);
682 /* check for empty folder */
683 if (mp
->nummsg
== 0) {
685 inform("no messages in %s, continuing...", folder
);
689 if ((cp
= getenv ("mhmessages")) == NULL
|| *cp
== 0) {
691 inform("$mhmessages not set, continuing...");
694 if (!debugsw
/* MOBY HACK... */
696 && (fd3
= open ("/dev/null", O_RDWR
)) != NOTOK
697 && (fd2
= dup (fileno (stderr
))) != NOTOK
) {
698 dup2 (fd3
, fileno (stderr
));
703 for (ap
= brkstring (cp
= mh_xstrdup(cp
), " ", NULL
); *ap
; ap
++)
707 dup2 (fd2
, fileno (stderr
));
708 if (mp
->numsel
== 0) {
710 inform("no messages to annotate, continuing...");
714 lseek(fd
, 0, SEEK_SET
);
715 if ((fp
= fdopen (fd
, "r")) == NULL
) {
717 inform("unable to fdopen annotation list, continuing...");
721 while (fgets (buffer
, sizeof(buffer
), fp
) != NULL
)
722 cp
= add (buffer
, cp
);
726 inform("annotate%s with %s: \"%s\"",
727 inplace
? " inplace" : "", annotext
, cp
);
728 for (msgnum
= mp
->lowsel
; msgnum
<= mp
->hghsel
; msgnum
++) {
729 if (is_selected(mp
, msgnum
)) {
731 inform("annotate message %d", msgnum
);
732 annotate (m_name (msgnum
), annotext
, cp
, inplace
, 1, -2, 0);
739 folder_free (mp
); /* free folder/message structure */
745 handle_sendfrom(char **vec
, int *vecp
, char *draft
, const char *auth_svc
) {
746 const char *addr
, *host
;
749 /* Extract address and host from From: header line in draft. */
750 if (get_from_header_info(draft
, &addr
, &host
, &message
) != OK
) {
751 adios(draft
, "%s", message
);
754 /* Merge in any address or host specific switches to post(1) from profile. */
755 merge_profile_entry(addr
, host
, vec
, vecp
);
764 for (vp
= vec
; *vp
; ++vp
) {
765 if (strcmp(*vp
, "xoauth2") == 0) {
767 if (setup_oauth_params(vec
, vecp
, auth_svc
, &message
) != OK
) {
768 adios(NULL
, "%s", message
);
772 NMH_UNUSED(auth_svc
);
773 adios(NULL
, "send built without OAUTH_SUPPORT, "
774 "so -saslmech xoauth2 is not supported");
775 #endif /* OAUTH_SUPPORT */
784 * For XOAUTH2, append profile entries so post can do the heavy lifting
787 setup_oauth_params(char *vec
[], int *vecp
, const char *auth_svc
,
788 const char **message
) {
789 const char *saslmech
= NULL
, *user
= NULL
;
790 mh_oauth_service_info svc
;
794 /* Make sure we have all the information we need. */
795 for (i
= 1; i
< *vecp
; ++i
) {
796 /* Don't support abbreviated switches, to avoid collisions in the
797 future if new ones are added. */
798 if (! strcmp(vec
[i
-1], "-saslmech")) {
800 } else if (! strcmp(vec
[i
-1], "-user")) {
802 } else if (! strcmp(vec
[i
-1], "-authservice")) {
807 if (auth_svc
== NULL
) {
808 if (saslmech
&& ! strcasecmp(saslmech
, "xoauth2")) {
809 *message
= "must specify -authservice with -saslmech xoauth2";
814 *message
= "must specify -user with -saslmech xoauth2";
818 if (saslmech
&& ! strcasecmp(saslmech
, "xoauth2")) {
819 if (! mh_oauth_get_service_info(auth_svc
, &svc
, errbuf
,
821 adios(NULL
, "Unable to retrieve oauth profile entries: %s",
824 vec
[(*vecp
)++] = mh_xstrdup("-authservice");
825 vec
[(*vecp
)++] = mh_xstrdup(auth_svc
);
826 vec
[(*vecp
)++] = mh_xstrdup("-oauthcredfile");
827 vec
[(*vecp
)++] = mh_oauth_cred_fn(auth_svc
);
828 vec
[(*vecp
)++] = mh_xstrdup("-oauthclientid");
829 vec
[(*vecp
)++] = getcpy(svc
.client_id
);
830 vec
[(*vecp
)++] = mh_xstrdup("-oauthclientsecret");
831 vec
[(*vecp
)++] = getcpy(svc
.client_secret
);
832 vec
[(*vecp
)++] = mh_xstrdup("-oauthauthendpoint");
833 vec
[(*vecp
)++] = getcpy(svc
.auth_endpoint
);
834 vec
[(*vecp
)++] = mh_xstrdup("-oauthredirect");
835 vec
[(*vecp
)++] = getcpy(svc
.redirect_uri
);
836 vec
[(*vecp
)++] = mh_xstrdup("-oauthtokenendpoint");
837 vec
[(*vecp
)++] = getcpy(svc
.token_endpoint
);
838 vec
[(*vecp
)++] = mh_xstrdup("-oauthscope");
839 vec
[(*vecp
)++] = getcpy(svc
.scope
);
845 #endif /* OAUTH_SUPPORT */
849 * Extract user and domain from From: header line in draft.
853 get_from_header_info(const char *filename
, const char **addr
, const char **host
, const char **message
) {
857 if (stat (filename
, &st
) == NOTOK
) {
858 *message
= "unable to stat draft file";
862 if ((in
= fopen (filename
, "r")) != NULL
) {
863 /* There must be a non-blank Envelope-From or {Resent-}Sender or
864 {Resent-}From header. */
865 char *addrformat
= "%(addr{Envelope-From})";
866 char *hostformat
= "%(host{Envelope-From})";
868 if ((*addr
= get_message_header_info (in
, addrformat
)) == NULL
||
870 addrformat
= distfile
== NULL
? "%(addr{Sender})" : "%(addr{Resent-Sender})";
871 hostformat
= distfile
== NULL
? "%(host{Sender})" : "%(host{Resent-Sender})";
873 if ((*addr
= get_message_header_info (in
, addrformat
)) == NULL
) {
874 addrformat
= distfile
== NULL
? "%(addr{From})" : "%(addr{Resent-From})";
875 hostformat
= distfile
== NULL
? "%(host{From})" : "%(host{Resent-From})";
877 if ((*addr
= get_message_header_info (in
, addrformat
)) == NULL
) {
878 *message
= "unable to find sender address in";
885 /* Use the hostformat that corresponds to the successful addrformat. */
886 if ((*host
= get_message_header_info(in
, hostformat
)) == NULL
) {
887 *message
= "unable to find sender host";
896 *message
= "unable to open";
902 * Get formatted information from header of a message.
903 * Adapted from process_single_file() in uip/fmttest.c.
907 get_message_header_info(FILE *in
, char *format
) {
912 m_getfld_state_t gstate
;
913 charstring_t buffer
= charstring_create(0);
916 dat
[0] = dat
[1] = dat
[4] = 0;
917 dat
[2] = fstat(fileno(in
), &st
) == 0 ? st
.st_size
: 0;
920 (void) fmt_compile(new_fs(NULL
, NULL
, format
), &fmt
, 1);
924 * Read in the message and process the header.
928 gstate
= m_getfld_state_init(in
);
930 char name
[NAMESZ
], rbuf
[NMH_BUFSIZ
];
931 int bufsz
= sizeof rbuf
;
932 int state
= m_getfld2(&gstate
, name
, rbuf
, &bufsz
);
937 int bucket
= fmt_addcomptext(name
, rbuf
);
940 while (state
== FLDPLUS
) {
942 state
= m_getfld2(&gstate
, name
, rbuf
, &bufsz
);
943 fmt_appendcomp(bucket
, name
, rbuf
);
947 while (state
== FLDPLUS
) {
949 state
= m_getfld2(&gstate
, name
, rbuf
, &bufsz
);
956 } while (parsing_header
);
957 m_getfld_state_destroy(&gstate
);
959 fmt_scan(fmt
, buffer
, INT_MAX
, dat
, NULL
);
962 /* Trim trailing newline, if any. */
963 retval
= rtrim(charstring_buffer_copy((buffer
)));
964 charstring_free(buffer
);
974 * Look in profile for entry corresponding to addr or host, and add its contents to vec.
976 * Could do some of this automatically, by looking for:
977 * 1) access-$(mbox{from}) in oauth-svc file using mh_oauth_cred_load(), which isn't
978 * static and doesn't have side effects; free the result with mh_oauth_cred_free())
979 * 2) machine $(mbox{from}) in creds
980 * If no -server passed in from profile or commandline, could use smtp.<svc>.com for gmail,
981 * but that might not generalize for other svcs.
985 merge_profile_entry(const char *addr
, const char *host
, char *vec
[], int *vecp
) {
986 char *addr_entry
= concat("sendfrom-", addr
, NULL
);
987 char *profile_entry
= context_find(addr_entry
);
990 if (profile_entry
== NULL
) {
991 /* No entry for the user. Look for one for the host. */
992 char *host_entry
= concat("sendfrom-", host
, NULL
);
994 profile_entry
= context_find(host_entry
);
998 /* Use argsplit() to do the real work of splitting the args in the profile entry. */
999 if (profile_entry
&& *profile_entry
) {
1002 char **profile_vec
= argsplit(profile_entry
, &file
, &profile_vecp
);
1005 for (i
= 0; i
< profile_vecp
; ++i
) {
1006 vec
[(*vecp
)++] = getcpy(profile_vec
[i
]);
1009 arglist_free(file
, profile_vec
);
1014 static void NORETURN
1015 armed_done (int status
)
1017 longjmp (env
, status
? status
: NOTOK
);