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>
27 #include "sbr/m_maildir.h"
28 #include "sbr/m_mktemp.h"
29 #include "sbr/message_id.h"
32 static int setup_oauth_params(char *[], int *, const char *, const char **);
33 #endif /* OAUTH_SUPPORT */
35 int debugsw
= 0; /* global */
43 char *altmsg
= NULL
; /* .. */
44 char *annotext
= NULL
;
45 char *distfile
= NULL
;
52 static void alert (char *, int);
53 static int tmp_fd (void);
54 static void anno (int, struct stat
*);
55 static void annoaux (int);
56 static int splitmsg (char **, int, char *, char *, struct stat
*, int);
57 static int sendaux (char **, int, char *, char *, struct stat
*);
58 static void handle_sendfrom(char **, int *, char *, const char *);
59 static int get_from_header_info(const char *, const char **, const char **, const char **);
60 static const char *get_message_header_info(FILE *, char *);
61 static void merge_profile_entry(const char *, const char *, char *[], int *);
62 static void armed_done (int) NORETURN
;
65 * Entry point into (back-end) routines to send message.
69 sendsbr (char **vec
, int vecp
, char *program
, char *draft
, struct stat
*st
,
70 int rename_drft
, const char *auth_svc
)
74 char buffer
[BUFSIZ
], file
[BUFSIZ
];
76 char **buildvec
, *buildprogram
;
77 char *volatile drft
= draft
;
78 /* nvecs is volatile to prevent warning from gcc about possible clobbering
80 volatile int nvecs
= vecp
;
81 int *nvecsp
= (int *) &nvecs
;
84 * Run the mimebuildproc (which is by default mhbuild) on the message
85 * with the addition of the "-auto" flag
88 switch (child
= fork()) {
90 adios("fork", "unable to");
94 buildvec
= argsplit(buildmimeproc
, &buildprogram
, &i
);
95 buildvec
[i
++] = "-auto";
97 buildvec
[i
++] = "-dist";
98 buildvec
[i
++] = (char *) drft
;
100 execvp(buildprogram
, buildvec
);
101 fprintf(stderr
, "unable to exec ");
102 perror(buildmimeproc
);
107 if (pidXwait(child
, buildmimeproc
))
113 switch (setjmp (env
)) {
116 * If given -push and -unique (which is undocumented), then
117 * rename the draft file. I'm not quite sure why.
119 if (pushsw
&& unique
) {
120 char *cp
= m_mktemp2(drft
, invo_name
, NULL
, NULL
);
122 adios(NULL
, "unable to create temporary file in %s",
125 if (rename (drft
, strncpy(file
, cp
, sizeof(file
))) == NOTOK
)
126 adios (file
, "unable to rename %s to", drft
);
131 * Add in any necessary profile entries for xoauth
137 if (setup_oauth_params(vec
, nvecsp
, auth_svc
, &errmsg
) != OK
) {
138 adios(NULL
, "%s", errmsg
);
141 adios(NULL
, "send built without OAUTH_SUPPORT, "
142 "so auth_svc %s is not supported", auth_svc
);
143 #endif /* OAUTH_SUPPORT */
147 * Rework the vec based on From: header in draft, as specified
148 * by sendfrom-address entries in profile.
150 if (context_find_prefix("sendfrom-")) {
151 handle_sendfrom(vec
, nvecsp
, draft
, auth_svc
);
155 * Check if we need to split the message into
156 * multiple messages of type "message/partial".
158 if (splitsw
>= 0 && !distfile
&& stat ((char *) drft
, &sts
) != NOTOK
159 && sts
.st_size
>= CPERMSG
) {
160 status
= splitmsg (vec
, nvecs
, program
, drft
,
161 st
, splitsw
) ? NOTOK
: OK
;
163 status
= sendaux (vec
, nvecs
, program
, drft
, st
) ? NOTOK
: OK
;
166 /* rename the original draft */
167 if (rename_drft
&& status
== OK
&&
168 rename (drft
, strncpy (buffer
, m_backup (drft
),
169 sizeof(buffer
))) == NOTOK
)
170 advise (buffer
, "unable to rename %s to", drft
);
180 (void) m_unlink (distfile
);
186 * Split large message into several messages of
187 * type "message/partial" and send them.
191 splitmsg (char **vec
, int vecp
, char *program
, char *drft
,
192 struct stat
*st
, int delay
)
194 int compnum
, nparts
, partno
, state
, status
;
197 char *cp
, *dp
, buffer
[NMH_BUFSIZ
], msgid
[BUFSIZ
];
198 char subject
[BUFSIZ
];
199 char name
[NAMESZ
], partnum
[BUFSIZ
];
201 m_getfld_state_t gstate
;
203 if ((in
= fopen (drft
, "r")) == NULL
)
204 adios (drft
, "unable to open for reading");
210 * Scan through the message and examine the various header fields,
211 * as well as locate the beginning of the message body.
213 gstate
= m_getfld_state_init(in
);
214 m_getfld_track_filepos2(&gstate
);
215 for (compnum
= 1;;) {
216 int bufsz
= sizeof buffer
;
217 switch (state
= m_getfld2(&gstate
, name
, buffer
, &bufsz
)) {
223 * This header field is discarded.
225 if (!strcasecmp (name
, "Message-ID")) {
226 while (state
== FLDPLUS
) {
227 bufsz
= sizeof buffer
;
228 state
= m_getfld2(&gstate
, name
, buffer
, &bufsz
);
230 } else if (uprf (name
, XXX_FIELD_PRF
)
231 || !strcasecmp (name
, VRSN_FIELD
)
232 || !strcasecmp (name
, "Subject")
233 || !strcasecmp (name
, "Encrypted")) {
235 * These header fields are copied to the enclosed
236 * header of the first message in the collection
237 * of message/partials. For the "Subject" header
238 * field, we also record it, so that a modified
239 * version of it, can be copied to the header
240 * of each message/partial in the collection.
242 if (!strcasecmp (name
, "Subject")) {
245 strncpy (subject
, buffer
, BUFSIZ
);
246 sublen
= strlen (subject
);
247 if (sublen
> 0 && subject
[sublen
- 1] == '\n')
248 subject
[sublen
- 1] = '\0';
251 dp
= add (concat (name
, ":", buffer
, NULL
), dp
);
252 while (state
== FLDPLUS
) {
253 bufsz
= sizeof buffer
;
254 state
= m_getfld2(&gstate
, name
, buffer
, &bufsz
);
255 dp
= add (buffer
, dp
);
259 * These header fields are copied to the header of
260 * each message/partial in the collection.
262 cp
= add (concat (name
, ":", buffer
, NULL
), cp
);
263 while (state
== FLDPLUS
) {
264 bufsz
= sizeof buffer
;
265 state
= m_getfld2(&gstate
, name
, buffer
, &bufsz
);
266 cp
= add (buffer
, cp
);
270 start
= ftell (in
) + 1;
279 adios (NULL
, "message format error in component #%d", compnum
);
282 adios (NULL
, "getfld () returned %d", state
);
287 m_getfld_state_destroy (&gstate
);
289 adios (NULL
, "headers missing from draft");
293 while (fgets (buffer
, sizeof buffer
, in
)) {
296 if ((pos
+= (len
= strlen (buffer
))) > CPERMSG
) {
302 /* Only one part, nothing to split */
308 return sendaux (vec
, vecp
, program
, drft
, st
);
312 printf ("Sending as %d Partial Messages\n", nparts
);
317 vec
[vecp
++] = "-partno";
318 vec
[vecp
++] = partnum
;
320 vec
[vecp
++] = "-queued";
323 snprintf (msgid
, sizeof(msgid
), "%s", message_id (clock
, 0));
325 fseek (in
, start
, SEEK_SET
);
326 for (partno
= 1; partno
<= nparts
; partno
++) {
330 char *cp
= m_mktemp2(drft
, invo_name
, NULL
, &out
);
332 adios(NULL
, "unable to create temporary file in %s",
335 strncpy(tmpdrf
, cp
, sizeof(tmpdrf
));
338 * Output the header fields
341 fprintf (out
, "Subject: %s (part %d of %d)\n", subject
, partno
, nparts
);
342 fprintf (out
, "%s: %s\n", VRSN_FIELD
, VRSN_VALUE
);
343 fprintf (out
, "%s: message/partial; id=\"%s\";\n", TYPE_FIELD
, msgid
);
344 fprintf (out
, "\tnumber=%d; total=%d\n", partno
, nparts
);
345 fprintf (out
, "%s: part %d of %d\n\n", DESCR_FIELD
, partno
, nparts
);
348 * If this is the first in the collection, output the
349 * header fields we are encapsulating at the beginning
350 * of the body of the first message.
355 fprintf (out
, "Message-ID: %s\n", msgid
);
363 if (!fgets (buffer
, sizeof buffer
, in
)) {
364 if (partno
== nparts
)
366 adios (NULL
, "premature eof");
369 if ((pos
+= (len
= strlen (buffer
))) > CPERMSG
) {
370 fseek (in
, -len
, SEEK_CUR
);
378 adios (tmpdrf
, "error writing to");
382 if (!pushsw
&& verbsw
) {
387 /* Pause here, if a delay is specified */
388 if (delay
> 0 && 1 < partno
&& partno
<= nparts
) {
390 printf ("pausing %d seconds before sending part %d...\n",
394 sleep ((unsigned int) delay
);
397 snprintf (partnum
, sizeof(partnum
), "%d", partno
);
398 status
= sendaux (vec
, vecp
, program
, tmpdrf
, st
);
399 (void) m_unlink (tmpdrf
);
404 * This is so sendaux will only annotate
405 * the altmsg the first time it is called.
413 fclose (in
); /* close the draft */
419 * Annotate original message, and
420 * call `postproc' (which is passed down in "program") to send message.
424 sendaux (char **vec
, int vecp
, char *program
, char *drft
, struct stat
*st
)
428 char backup
[BUFSIZ
], buf
[BUFSIZ
];
430 fd
= pushsw
? tmp_fd () : NOTOK
;
434 if ((fd2
= tmp_fd ()) != NOTOK
) {
435 vec
[vecp
++] = "-idanno";
436 snprintf (buf
, sizeof(buf
), "%d", fd2
);
439 inform("unable to create temporary file in %s for "
440 "annotation list, continuing...", get_temp_dir());
444 if (distfile
&& distout (drft
, distfile
, backup
) == NOTOK
)
451 /* oops -- fork error */
452 adios ("fork", "unable to");
453 break; /* NOT REACHED */
457 * child process -- send it
459 * If fd is OK, then we are pushing and fd points to temp
460 * file, so capture anything on stdout and stderr there.
463 dup2 (fd
, fileno (stdout
));
464 dup2 (fd
, fileno (stderr
));
467 execvp (program
, vec
);
468 fprintf (stderr
, "unable to exec ");
474 * parent process -- wait for it
476 if ((status
= pidwait(child_id
, NOTOK
)) == OK
) {
477 if (annotext
&& fd2
!= NOTOK
)
481 * If postproc failed, and we have good fd (which means
482 * we pushed), then mail error message (and possibly the
483 * draft) back to the user.
489 inform("message not delivered to anyone");
491 if (annotext
&& fd2
!= NOTOK
)
494 (void) m_unlink (drft
);
495 if (rename (backup
, drft
) == NOTOK
)
496 advise (drft
, "unable to rename %s to", backup
);
507 * Mail error notification (and possibly a copy of the
508 * message) back to the user, using the mailproc
512 alert (char *file
, int out
)
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
, 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
, 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 inform("temporary file %s selected", tfile
);
591 else if (m_unlink (tfile
) == NOTOK
)
592 advise (tfile
, "unable to remove");
599 anno (int fd
, struct stat
*st
)
603 static char *cwd
= NULL
;
607 (stat (altmsg
, &st2
) == NOTOK
608 || st
->st_mtime
!= st2
.st_mtime
609 || st
->st_dev
!= st2
.st_dev
610 || st
->st_ino
!= st2
.st_ino
)) {
612 inform("$mhaltmsg mismatch, continuing...");
616 child_id
= debugsw
? NOTOK
: fork ();
618 case NOTOK
: /* oops */
620 inform("unable to fork, so doing annotations by hand...");
622 cwd
= mh_xstrdup(pwd ());
626 /* block a few signals */
628 sigaddset (&set
, SIGHUP
);
629 sigaddset (&set
, SIGINT
);
630 sigaddset (&set
, SIGQUIT
);
631 sigaddset (&set
, SIGTERM
);
632 sigprocmask (SIG_BLOCK
, &set
, &oset
);
634 unregister_for_removal(0);
640 /* reset the signal mask */
641 sigprocmask (SIG_SETMASK
, &oset
, &set
);
643 if (chdir (cwd
) < 0) {
644 advise (cwd
, "chdir");
648 default: /* no waiting... */
658 int fd2
, fd3
, msgnum
;
659 char *cp
, *folder
, *maildir
;
660 char buffer
[BUFSIZ
], **ap
;
664 if ((folder
= getenv ("mhfolder")) == NULL
|| *folder
== 0) {
666 inform("$mhfolder not set, continuing...");
669 maildir
= m_maildir (folder
);
670 if (chdir (maildir
) == NOTOK
) {
672 admonish (maildir
, "unable to change directory to");
675 if (!(mp
= folder_read (folder
, 0))) {
677 inform("unable to read folder %s, continuing...", folder
);
681 /* check for empty folder */
682 if (mp
->nummsg
== 0) {
684 inform("no messages in %s, continuing...", folder
);
688 if ((cp
= getenv ("mhmessages")) == NULL
|| *cp
== 0) {
690 inform("$mhmessages not set, continuing...");
693 if (!debugsw
/* MOBY HACK... */
695 && (fd3
= open ("/dev/null", O_RDWR
)) != NOTOK
696 && (fd2
= dup (fileno (stderr
))) != NOTOK
) {
697 dup2 (fd3
, fileno (stderr
));
702 for (ap
= brkstring (cp
= mh_xstrdup(cp
), " ", NULL
); *ap
; ap
++)
706 dup2 (fd2
, fileno (stderr
));
707 if (mp
->numsel
== 0) {
709 inform("no messages to annotate, continuing...");
713 lseek(fd
, 0, SEEK_SET
);
714 if ((fp
= fdopen (fd
, "r")) == NULL
) {
716 inform("unable to fdopen annotation list, continuing...");
720 while (fgets (buffer
, sizeof(buffer
), fp
) != NULL
)
721 cp
= add (buffer
, cp
);
725 inform("annotate%s with %s: \"%s\"",
726 inplace
? " inplace" : "", annotext
, cp
);
727 for (msgnum
= mp
->lowsel
; msgnum
<= mp
->hghsel
; msgnum
++) {
728 if (is_selected(mp
, msgnum
)) {
730 inform("annotate message %d", msgnum
);
731 annotate (m_name (msgnum
), annotext
, cp
, inplace
, 1, -2, 0);
738 folder_free (mp
); /* free folder/message structure */
744 handle_sendfrom(char **vec
, int *vecp
, char *draft
, const char *auth_svc
) {
745 const char *addr
, *host
;
748 /* Extract address and host from From: header line in draft. */
749 if (get_from_header_info(draft
, &addr
, &host
, &message
) != OK
) {
750 adios(draft
, "%s", message
);
753 /* Merge in any address or host specific switches to post(1) from profile. */
754 merge_profile_entry(addr
, host
, vec
, vecp
);
763 for (vp
= vec
; *vp
; ++vp
) {
764 if (strcmp(*vp
, "xoauth2") == 0) {
766 if (setup_oauth_params(vec
, vecp
, auth_svc
, &message
) != OK
) {
767 adios(NULL
, "%s", message
);
771 NMH_UNUSED(auth_svc
);
772 adios(NULL
, "send built without OAUTH_SUPPORT, "
773 "so -saslmech xoauth2 is not supported");
774 #endif /* OAUTH_SUPPORT */
783 * For XOAUTH2, append profile entries so post can do the heavy lifting
786 setup_oauth_params(char *vec
[], int *vecp
, const char *auth_svc
,
787 const char **message
) {
788 const char *saslmech
= NULL
, *user
= NULL
;
789 mh_oauth_service_info svc
;
793 /* Make sure we have all the information we need. */
794 for (i
= 1; i
< *vecp
; ++i
) {
795 /* Don't support abbreviated switches, to avoid collisions in the
796 future if new ones are added. */
797 if (! strcmp(vec
[i
-1], "-saslmech")) {
799 } else if (! strcmp(vec
[i
-1], "-user")) {
801 } else if (! strcmp(vec
[i
-1], "-authservice")) {
806 if (auth_svc
== NULL
) {
807 if (saslmech
&& ! strcasecmp(saslmech
, "xoauth2")) {
808 *message
= "must specify -authservice with -saslmech xoauth2";
813 *message
= "must specify -user with -saslmech xoauth2";
817 if (saslmech
&& ! strcasecmp(saslmech
, "xoauth2")) {
818 if (! mh_oauth_get_service_info(auth_svc
, &svc
, errbuf
,
820 adios(NULL
, "Unable to retrieve oauth profile entries: %s",
823 vec
[(*vecp
)++] = mh_xstrdup("-authservice");
824 vec
[(*vecp
)++] = mh_xstrdup(auth_svc
);
825 vec
[(*vecp
)++] = mh_xstrdup("-oauthcredfile");
826 vec
[(*vecp
)++] = mh_xstrdup(mh_oauth_cred_fn(auth_svc
));
827 vec
[(*vecp
)++] = mh_xstrdup("-oauthclientid");
828 vec
[(*vecp
)++] = getcpy(svc
.client_id
);
829 vec
[(*vecp
)++] = mh_xstrdup("-oauthclientsecret");
830 vec
[(*vecp
)++] = getcpy(svc
.client_secret
);
831 vec
[(*vecp
)++] = mh_xstrdup("-oauthauthendpoint");
832 vec
[(*vecp
)++] = getcpy(svc
.auth_endpoint
);
833 vec
[(*vecp
)++] = mh_xstrdup("-oauthredirect");
834 vec
[(*vecp
)++] = getcpy(svc
.redirect_uri
);
835 vec
[(*vecp
)++] = mh_xstrdup("-oauthtokenendpoint");
836 vec
[(*vecp
)++] = getcpy(svc
.token_endpoint
);
837 vec
[(*vecp
)++] = mh_xstrdup("-oauthscope");
838 vec
[(*vecp
)++] = getcpy(svc
.scope
);
844 #endif /* OAUTH_SUPPORT */
848 * Extract user and domain from From: header line in draft.
852 get_from_header_info(const char *filename
, const char **addr
, const char **host
, const char **message
) {
856 if (stat (filename
, &st
) == NOTOK
) {
857 *message
= "unable to stat draft file";
861 if ((in
= fopen (filename
, "r")) != NULL
) {
862 /* There must be a non-blank Envelope-From or {Resent-}Sender or
863 {Resent-}From header. */
864 char *addrformat
= "%(addr{Envelope-From})";
865 char *hostformat
= "%(host{Envelope-From})";
867 if ((*addr
= get_message_header_info (in
, addrformat
)) == NULL
||
869 addrformat
= distfile
== NULL
? "%(addr{Sender})" : "%(addr{Resent-Sender})";
870 hostformat
= distfile
== NULL
? "%(host{Sender})" : "%(host{Resent-Sender})";
872 if ((*addr
= get_message_header_info (in
, addrformat
)) == NULL
) {
873 addrformat
= distfile
== NULL
? "%(addr{From})" : "%(addr{Resent-From})";
874 hostformat
= distfile
== NULL
? "%(host{From})" : "%(host{Resent-From})";
876 if ((*addr
= get_message_header_info (in
, addrformat
)) == NULL
) {
877 *message
= "unable to find sender address in";
884 /* Use the hostformat that corresponds to the successful addrformat. */
885 if ((*host
= get_message_header_info(in
, hostformat
)) == NULL
) {
886 *message
= "unable to find sender host";
895 *message
= "unable to open";
901 * Get formatted information from header of a message.
902 * Adapted from process_single_file() in uip/fmttest.c.
906 get_message_header_info(FILE *in
, char *format
) {
911 m_getfld_state_t gstate
;
912 charstring_t buffer
= charstring_create(0);
915 dat
[0] = dat
[1] = dat
[4] = 0;
916 dat
[2] = fstat(fileno(in
), &st
) == 0 ? st
.st_size
: 0;
919 (void) fmt_compile(new_fs(NULL
, NULL
, format
), &fmt
, 1);
923 * Read in the message and process the header.
927 gstate
= m_getfld_state_init(in
);
929 char name
[NAMESZ
], rbuf
[NMH_BUFSIZ
];
930 int bufsz
= sizeof rbuf
;
931 int state
= m_getfld2(&gstate
, name
, rbuf
, &bufsz
);
936 int bucket
= fmt_addcomptext(name
, rbuf
);
939 while (state
== FLDPLUS
) {
941 state
= m_getfld2(&gstate
, name
, rbuf
, &bufsz
);
942 fmt_appendcomp(bucket
, name
, rbuf
);
946 while (state
== FLDPLUS
) {
948 state
= m_getfld2(&gstate
, name
, rbuf
, &bufsz
);
955 } while (parsing_header
);
956 m_getfld_state_destroy(&gstate
);
958 fmt_scan(fmt
, buffer
, INT_MAX
, dat
, NULL
);
961 /* Trim trailing newline, if any. */
962 retval
= rtrim(charstring_buffer_copy((buffer
)));
963 charstring_free(buffer
);
973 * Look in profile for entry corresponding to addr or host, and add its contents to vec.
975 * Could do some of this automatically, by looking for:
976 * 1) access-$(mbox{from}) in oauth-svc file using mh_oauth_cred_load(), which isn't
977 * static and doesn't have side effects; free the result with mh_oauth_cred_free())
978 * 2) machine $(mbox{from}) in creds
979 * If no -server passed in from profile or commandline, could use smtp.<svc>.com for gmail,
980 * but that might not generalize for other svcs.
984 merge_profile_entry(const char *addr
, const char *host
, char *vec
[], int *vecp
) {
985 char *addr_entry
= concat("sendfrom-", addr
, NULL
);
986 char *profile_entry
= context_find(addr_entry
);
989 if (profile_entry
== NULL
) {
990 /* No entry for the user. Look for one for the host. */
991 char *host_entry
= concat("sendfrom-", host
, NULL
);
993 profile_entry
= context_find(host_entry
);
997 /* Use argsplit() to do the real work of splitting the args in the profile entry. */
998 if (profile_entry
&& *profile_entry
) {
1001 char **profile_vec
= argsplit(profile_entry
, &file
, &profile_vecp
);
1004 for (i
= 0; i
< profile_vecp
; ++i
) {
1005 vec
[(*vecp
)++] = getcpy(profile_vec
[i
]);
1008 arglist_free(file
, profile_vec
);
1013 static void NORETURN
1014 armed_done (int status
)
1016 longjmp (env
, status
? status
: NOTOK
);