1 /*@ S-nail - a mail user agent derived from Berkeley Mail.
2 *@ Lexical processing of commands.
4 * Copyright (c) 2000-2004 Gunnar Ritter, Freiburg i. Br., Germany.
5 * Copyright (c) 2012 - 2013 Steffen "Daode" Nurpmeso <sdaoden@users.sf.net>.
8 * Copyright (c) 1980, 1993
9 * The Regents of the University of California. All rights reserved.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 * 3. All advertising materials mentioning features or use of this software
20 * must display the following acknowledgement:
21 * This product includes software developed by the University of
22 * California, Berkeley and its contributors.
23 * 4. Neither the name of the University nor the names of its contributors
24 * may be used to endorse or promote products derived from this software
25 * without specific prior written permission.
27 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
28 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
31 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
32 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
33 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
50 static int _reset_on_stop
; /* do a reset() if stopped */
51 static sighandler_type _oldpipe
;
53 /* Update mailname (if *name* != NULL) and displayname */
54 static void _update_mailname(char const *name
);
55 #ifdef HAVE_MBLEN /* TODO unite __narrow_{pre,suf}fix() into one function! */
56 SINLINE
size_t __narrow_prefix(char const *cp
, size_t maxl
);
57 SINLINE
size_t __narrow_suffix(char const *cp
, size_t cpl
, size_t maxl
);
60 static const struct cmd
*lex(char *Word
);
61 static void stop(int s
);
62 static void hangup(int s
);
66 __narrow_prefix(char const *cp
, size_t maxl
)
71 for (err
= ok
= i
= 0; i
< maxl
;) {
72 int ml
= mblen(cp
, maxl
- i
);
73 if (ml
< 0) { /* XXX _narrow_prefix(): mblen() error; action? */
91 __narrow_suffix(char const *cp
, size_t cpl
, size_t maxl
)
96 for (err
= ok
= i
= 0; cpl
> maxl
|| err
;) {
97 int ml
= mblen(cp
, cpl
);
98 if (ml
< 0) { /* XXX _narrow_suffix(): mblen() error; action? */
115 #endif /* HAVE_MBLEN */
118 _update_mailname(char const *name
)
120 char tbuf
[MAXPATHLEN
], *mailp
, *dispp
;
123 /* Don't realpath(3) if it's only an update request */
126 enum protocol p
= which_protocol(name
);
127 if (p
== PROTO_FILE
|| p
== PROTO_MAILDIR
) {
128 if (realpath(name
, mailname
) == NULL
) {
129 fprintf(stderr
, tr(151,
130 "Can't canonicalize `%s'\n"), name
);
135 (void)n_strlcpy(mailname
, name
, MAXPATHLEN
);
141 /* Don't display an absolute path but "+FOLDER" if under *folder* */
142 if (getfold(tbuf
, sizeof tbuf
)) {
144 if (i
< sizeof(tbuf
) - 1)
146 if (strncmp(tbuf
, mailp
, i
) == 0) {
152 /* We want to see the name of the folder .. on the screen */
154 if (i
< sizeof(displayname
) - 1)
155 memcpy(dispp
, mailp
, i
+ 1);
157 /* Avoid disrupting multibyte sequences (if possible) */
159 j
= sizeof(displayname
) / 3 - 1;
160 i
-= sizeof(displayname
) - (1/* + */ + 3) - j
;
162 j
= __narrow_prefix(mailp
, sizeof(displayname
) / 3);
163 i
= j
+ __narrow_suffix(mailp
+ j
, i
- j
,
164 sizeof(displayname
) - (1/* + */ + 3 + 1) - j
);
166 (void)snprintf(dispp
, sizeof(displayname
), "%.*s...%s",
167 (int)j
, mailp
, mailp
+ i
);
175 * Set up editing on the given file name.
176 * If the first character of name is %, we are considered to be
177 * editing the file, otherwise we are reading our mail which has
178 * signficance for mbox and so forth.
180 * nmail: Check for new mail in the current folder only.
183 setfile(char const *name
, int nmail
)
186 int i
, compressed
= 0;
189 char const *who
= name
[1] ? name
+ 1 : myname
;
196 isedit
= (*name
!= '%' && ((sh
= get_shortcut(name
)) == NULL
||
197 *sh
->sh_long
!= '%'));
198 if ((name
= expand(name
)) == NULL
)
201 switch (which_protocol(name
)) {
205 return (maildir_setfile(name
, nmail
, isedit
));
209 return (pop3_setfile(name
, nmail
, isedit
));
215 if (mb
.mb_type
== MB_CACHE
)
218 return imap_setfile(name
, nmail
, isedit
);
221 fprintf(stderr
, tr(217, "Cannot handle protocol: %s\n"), name
);
225 if ((ibuf
= Zopen(name
, "r", &compressed
)) == NULL
) {
226 if ((!isedit
&& errno
== ENOENT
) || nmail
) {
235 if (fstat(fileno(ibuf
), &stb
) < 0) {
243 if (S_ISDIR(stb
.st_mode
)) {
250 } else if (S_ISREG(stb
.st_mode
)) {
262 * Looks like all will be well. We must now relinquish our
263 * hold on the current set of stuff. Must hold signals
264 * while we are reading the new file, else we will ruin
265 * the message[] data structure.
268 holdsigs(); /* TODO note on this one in quit.c:quit() */
269 if (shudclob
&& !nmail
)
272 if (!nmail
&& mb
.mb_sock
.s_fd
>= 0)
277 * Copy the messages into /tmp
281 flp
.l_type
= F_RDLCK
;
283 flp
.l_whence
= SEEK_SET
;
285 mb
.mb_type
= MB_FILE
;
286 mb
.mb_perm
= (options
& OPT_R_FLAG
) ? 0 : MB_DELE
|MB_EDIT
;
287 mb
.mb_compressed
= compressed
;
289 if (compressed
& 0200)
292 if ((i
= open(name
, O_WRONLY
)) < 0)
312 if (!edit
&& fcntl(fileno(ibuf
), F_SETLKW
, &flp
) < 0) {
313 perror("Unable to lock mailbox");
318 fseek(mb
.mb_otf
, 0L, SEEK_END
);
319 fseek(ibuf
, mailsize
, SEEK_SET
);
321 omsgCount
= msgCount
;
323 if (!edit
&& fcntl(fileno(ibuf
), F_SETLKW
, &flp
) < 0)
326 mailsize
= fsize(ibuf
);
327 if (nmail
&& (size_t)mailsize
<= offset
) {
331 setptr(ibuf
, offset
);
333 if (nmail
&& mb
.mb_sorted
) {
341 if ((!edit
|| nmail
) && msgCount
== 0) {
344 if (value("emptystart") == NULL
)
345 nomail
: fprintf(stderr
, catgets(catd
, CATSET
, 88,
346 "No mail for %s\n"), who
);
351 newmailinfo(omsgCount
);
357 newmailinfo(int omsgCount
)
362 for (i
= 0; i
< omsgCount
; i
++)
363 message
[i
].m_flag
&= ~MNEWEST
;
364 if (msgCount
> omsgCount
) {
365 for (i
= omsgCount
; i
< msgCount
; i
++)
366 message
[i
].m_flag
|= MNEWEST
;
367 printf(tr(158, "New mail has arrived.\n"));
368 if (msgCount
- omsgCount
== 1)
369 printf(tr(214, "Loaded 1 new message.\n"));
371 printf(tr(215, "Loaded %d new messages.\n"),
372 msgCount
- omsgCount
);
374 printf(tr(224, "Loaded %d messages.\n"), msgCount
);
375 callhook(mailname
, 1);
377 if (value("header")) {
379 if (mb
.mb_type
== MB_IMAP
)
380 imap_getheaders(omsgCount
+1, msgCount
);
382 time_current_update(&time_current
, FAL0
);
383 while (++omsgCount
<= msgCount
)
384 if (visible(&message
[omsgCount
-1]))
385 printhead(omsgCount
, stdout
, 0);
391 * Interpret user commands one by one. If standard input is not a tty,
398 char *linebuf
= NULL
, *av
, *nv
;
405 if (safe_signal(SIGINT
, SIG_IGN
) != SIG_IGN
)
406 safe_signal(SIGINT
, onintr
);
407 if (safe_signal(SIGHUP
, SIG_IGN
) != SIG_IGN
)
408 safe_signal(SIGHUP
, hangup
);
409 /* TODO We do a lot of redundant signal handling, especially
410 * TODO with the line editor(s); try to merge this */
411 safe_signal(SIGTSTP
, stop
);
412 safe_signal(SIGTTOU
, stop
);
413 safe_signal(SIGTTIN
, stop
);
415 _oldpipe
= safe_signal(SIGPIPE
, SIG_IGN
);
416 safe_signal(SIGPIPE
, _oldpipe
);
421 handlerstacktop
= NULL
;
423 * Print the prompt, if needed. Clear out
424 * string space, and flush the output.
426 if (! sourcing
&& (options
& OPT_INTERACTIVE
)) {
427 av
= (av
= value("autoinc")) ? savestr(av
) : NULL
;
428 nv
= (nv
= value("newmail")) ? savestr(nv
) : NULL
;
429 if ((options
& OPT_TTYIN
) &&
430 (av
!= NULL
|| nv
!= NULL
||
431 mb
.mb_type
== MB_IMAP
)) {
434 n
= (av
&& strcmp(av
, "noimap") &&
435 strcmp(av
, "nopoll")) |
436 (nv
&& strcmp(nv
, "noimap") &&
437 strcmp(nv
, "nopoll"));
441 if ((mb
.mb_type
== MB_FILE
&&
442 stat(mailname
, &st
) == 0 &&
443 st
.st_size
> mailsize
) ||
445 (mb
.mb_type
== MB_IMAP
&&
446 imap_newmail(n
) > x
) ||
448 (mb
.mb_type
== MB_MAILDIR
&&
450 int odot
= dot
- &message
[0];
451 bool_t odid
= did_print_dot
;
453 setfile(mailname
, 1);
454 if (mb
.mb_type
!= MB_IMAP
) {
455 dot
= &message
[odot
];
456 did_print_dot
= odid
;
466 /* TODO Note: this buffer may contain a password
467 * TODO We should redefine the code flow which has
469 if ((nv
= termios_state
.ts_linebuf
) != NULL
) {
470 termios_state
.ts_linebuf
= NULL
;
471 termios_state
.ts_linesize
= 0;
472 free(nv
); /* TODO pool give-back */
474 /* TODO Due to expand-on-tab of our line editor the
475 * TODO buffer may grow */
476 if (linesize
> LINESIZE
* 3) {
477 free(linebuf
); /* TODO pool! but what? */
484 * Read a line of commands from the current input
485 * and handle end of file specially.
487 n
= readline_input(LNED_LF_ESC
| LNED_HIST_ADD
, NULL
,
488 &linebuf
, &linesize
);
498 if ((options
& OPT_INTERACTIVE
) &&
499 value("ignoreeof") && ++eofloop
< 25) {
500 printf(tr(89, "Use `quit' to quit.\n"));
508 if (execute(linebuf
, 0, n
))
510 if (exit_status
!= EXIT_OK
&& (options
& OPT_BATCH_FLAG
) &&
511 boption("batch-exit-on-error"))
522 * Execute a single command.
523 * Command functions return 0 for success, 1 for error, and -1
524 * for abort. A 1 or -1 aborts a load or source. A -1 aborts
525 * the interactive command loop.
526 * Contxt is non-zero if called while composing mail.
529 execute(char *linebuf
, int contxt
, size_t linesize
)
531 char _wordbuf
[2], *arglist
[MAXARGC
], *cp
, *word
;
532 struct cmd
const *com
= (struct cmd
*)NULL
;
533 int muvec
[2], c
, e
= 1;
535 /* Strip the white space away from the beginning of the command */
536 for (cp
= linebuf
; whitechar(*cp
); ++cp
)
539 /* Ignore comments */
543 /* Handle ! differently to get the correct lexical conventions */
546 fprintf(stderr
, tr(90, "Can't `!' while sourcing\n"));
553 /* Isolate the actual command; since it may not necessarily be
554 * separated from the arguments (as in `p1') we need to duplicate it to
555 * be able to create a NUL terminated version.
556 * We must be aware of special one letter commands here */
566 while (*cp
&& strchr(" \t0123456789$^.:/-+*'\",;(`",
571 c
= (int)(cp
- arglist
[0]);
573 word
= (c
<= 1) ? _wordbuf
: salloc(c
+ 1);
574 memcpy(word
, arglist
[0], c
);
577 /* Look up the command; if not found, bitch.
578 * Normally, a blank command would map to the first command in the
579 * table; while sourcing, however, we ignore blank lines to eliminate
581 if (sourcing
&& *word
== '\0')
585 if (com
== NULL
|| com
->c_func
== &ccmdnotsupp
) {
586 fprintf(stderr
, tr(91, "Unknown command: `%s'\n"), word
);
595 * See if we should execute the command -- if a conditional
596 * we always execute it, otherwise, check the state of cond.
598 if ((com
->c_argtype
& F
) == 0) {
599 if ((cond
== CRCV
&& (options
& OPT_SENDMODE
)) ||
600 (cond
== CSEND
&& ! (options
& OPT_SENDMODE
)) ||
601 (cond
== CTERM
&& ! (options
& OPT_TTYIN
)) ||
602 (cond
== CNONTERM
&& (options
& OPT_TTYIN
)))
607 * Process the arguments to the command, depending
608 * on the type he expects. Default to an error.
609 * If we are sourcing an interactive command, it's
612 if ((options
& OPT_SENDMODE
) && (com
->c_argtype
& M
) == 0) {
613 fprintf(stderr
, tr(92,
614 "May not execute `%s' while sending\n"),
618 if (sourcing
&& com
->c_argtype
& I
) {
619 fprintf(stderr
, tr(93,
620 "May not execute `%s' while sourcing\n"),
624 if ((mb
.mb_perm
& MB_DELE
) == 0 && com
->c_argtype
& W
) {
625 fprintf(stderr
, tr(94, "May not execute `%s' -- "
626 "message file is read only\n"),
630 if (contxt
&& com
->c_argtype
& R
) {
631 fprintf(stderr
, tr(95,
632 "Cannot recursively invoke `%s'\n"), com
->c_name
);
635 if (mb
.mb_type
== MB_VOID
&& com
->c_argtype
& A
) {
636 fprintf(stderr
, tr(257,
637 "Cannot execute `%s' without active mailbox\n"),
642 switch (com
->c_argtype
& ~(F
|P
|I
|M
|T
|W
|R
|A
)) {
644 /* Message list defaulting to nearest forward legal message */
647 if ((c
= getmsglist(cp
, _msgvec
, com
->c_msgflag
)) < 0)
650 *_msgvec
= first(com
->c_msgflag
, com
->c_msgmask
);
656 printf(tr(97, "No applicable messages\n"));
659 e
= (*com
->c_func
)(_msgvec
);
663 /* Message list with no defaults, but no error if none exist */
666 fprintf(stderr
, tr(96,
667 "Illegal use of `message list'\n"));
670 if ((c
= getmsglist(cp
, _msgvec
, com
->c_msgflag
)) < 0)
672 e
= (*com
->c_func
)(_msgvec
);
676 /* Just the straight string, with leading blanks removed */
677 while (whitechar(*cp
))
679 e
= (*com
->c_func
)(cp
);
684 /* A vector of strings, in shell style */
685 if ((c
= getrawlist(cp
, linesize
, arglist
,
686 sizeof arglist
/ sizeof *arglist
,
687 (com
->c_argtype
&~(F
|P
|I
|M
|T
|W
|R
|A
)) == ECHOLIST
)
690 if (c
< com
->c_minargs
) {
691 fprintf(stderr
, tr(99,
692 "`%s' requires at least %d arg(s)\n"),
693 com
->c_name
, com
->c_minargs
);
696 if (c
> com
->c_maxargs
) {
697 fprintf(stderr
, tr(100,
698 "`%s' takes no more than %d arg(s)\n"),
699 com
->c_name
, com
->c_maxargs
);
702 e
= (*com
->c_func
)(arglist
);
706 /* Just the constant zero, for exiting, eg. */
707 e
= (*com
->c_func
)(0);
711 panic(tr(101, "Unknown argument type"));
715 /* Exit the current source file on error */
716 if ((exec_last_comm_error
= (e
!= 0))) {
725 if (com
== (struct cmd
*)NULL
)
727 if (boption("autoprint") && com
->c_argtype
& P
)
729 muvec
[0] = dot
- &message
[0] + 1;
733 if (! sourcing
&& ! inhook
&& (com
->c_argtype
& T
) == 0)
740 * Set the size of the message vector used to construct argument
741 * lists to message list functions.
749 _msgvec
= (int*)scalloc(sz
+ 1, sizeof *_msgvec
);
753 * Find the correct command in the command table corresponding
754 * to the passed command "word"
757 static const struct cmd
*
760 extern const struct cmd cmdtab
[];
761 const struct cmd
*cp
;
763 for (cp
= &cmdtab
[0]; cp
->c_name
!= NULL
; cp
++)
764 if (is_prefix(Word
, cp
->c_name
))
770 * The following gets called on receipt of an interrupt. This is
771 * to abort printout of a command, mainly.
772 * Dispatching here when command() is inactive crashes rcv.
773 * Close all open files except 0, 1, 2, and the temporary.
774 * Also, unstack all source files.
777 static int inithdr
; /* am printing startup headers */
783 if (handlerstacktop
!= NULL
) {
787 safe_signal(SIGINT
, onintr
);
802 fprintf(stderr
, catgets(catd
, CATSET
, 102, "Interrupt\n"));
803 safe_signal(SIGPIPE
, _oldpipe
);
808 * When we wake up after ^Z, reprint the prompt.
813 sighandler_type old_action
= safe_signal(s
, SIG_DFL
);
818 sigprocmask(SIG_UNBLOCK
, &nset
, (sigset_t
*)NULL
);
820 sigprocmask(SIG_BLOCK
, &nset
, (sigset_t
*)NULL
);
821 safe_signal(s
, old_action
);
822 if (_reset_on_stop
) {
829 * Branch here on hangup signal and simulate "exit".
841 * Announce the presence of the current Mail version,
842 * give the message count, and print a header listing.
845 announce(int printheaders
)
849 mdot
= newfileinfo();
852 dot
= &message
[mdot
- 1];
853 if (printheaders
&& msgCount
> 0 && value("header") != NULL
) {
861 * Announce information about the file we are editing.
862 * Return a likely place to set dot.
868 int u
, n
, mdot
, d
, s
, hidden
, moved
;
870 if (mb
.mb_type
== MB_VOID
)
873 s
= d
= hidden
= moved
=0;
874 for (mp
= &message
[0], n
= 0, u
= 0; mp
< &message
[msgCount
]; mp
++) {
875 if (mp
->m_flag
& MNEW
)
877 if ((mp
->m_flag
& MREAD
) == 0)
879 if ((mp
->m_flag
& (MDELETED
|MSAVED
)) == (MDELETED
|MSAVED
))
881 if ((mp
->m_flag
& (MDELETED
|MSAVED
)) == MDELETED
)
883 if ((mp
->m_flag
& (MDELETED
|MSAVED
)) == MSAVED
)
885 if (mp
->m_flag
& MHIDDEN
)
888 _update_mailname(NULL
);
889 printf(tr(103, "\"%s\": "), displayname
);
891 printf(tr(104, "1 message"));
893 printf(tr(105, "%d messages"), msgCount
);
895 printf(tr(106, " %d new"), n
);
897 printf(tr(107, " %d unread"), u
);
899 printf(tr(108, " %d deleted"), d
);
901 printf(tr(109, " %d saved"), s
);
903 printf(tr(136, " %d moved"), moved
);
905 printf(tr(139, " %d hidden"), hidden
);
906 if (mb
.mb_type
== MB_CACHE
)
907 printf(" [Disconnected]");
908 else if (mb
.mb_perm
== 0)
909 printf(tr(110, " [Read only]"));
920 enum mflag avoid
= MHIDDEN
|MDELETED
;
923 if (value("autothread"))
925 else if ((cp
= value("autosort")) != NULL
) {
927 mb
.mb_sorted
= sstrdup(cp
);
931 if (mb
.mb_type
== MB_VOID
)
934 for (mp
= &message
[0]; mp
< &message
[msgCount
]; mp
++)
935 if ((mp
->m_flag
& (MNEWEST
|avoid
)) == MNEWEST
)
937 if (!nmail
|| mp
>= &message
[msgCount
]) {
938 for (mp
= mb
.mb_threaded
? threadroot
: &message
[0];
940 mp
!= NULL
: mp
< &message
[msgCount
];
942 mp
= next_in_thread(mp
) : mp
++)
943 if ((mp
->m_flag
& (MNEW
|avoid
)) == MNEW
)
946 if (mb
.mb_threaded
? mp
== NULL
: mp
>= &message
[msgCount
])
947 for (mp
= mb
.mb_threaded
? threadroot
: &message
[0];
948 mb
.mb_threaded
? mp
!= NULL
:
949 mp
< &message
[msgCount
];
950 mb
.mb_threaded
? mp
= next_in_thread(mp
) : mp
++)
951 if (mp
->m_flag
& MFLAGGED
)
953 if (mb
.mb_threaded
? mp
== NULL
: mp
>= &message
[msgCount
])
954 for (mp
= mb
.mb_threaded
? threadroot
: &message
[0];
955 mb
.mb_threaded
? mp
!= NULL
:
956 mp
< &message
[msgCount
];
957 mb
.mb_threaded
? mp
= next_in_thread(mp
) : mp
++)
958 if ((mp
->m_flag
& (MREAD
|avoid
)) == 0)
960 if (mb
.mb_threaded
? mp
!= NULL
: mp
< &message
[msgCount
])
961 mdot
= mp
- &message
[0] + 1;
962 else if (value("showlast")) {
963 if (mb
.mb_threaded
) {
964 for (mp
= this_in_thread(threadroot
, -1); mp
;
965 mp
= prev_in_thread(mp
))
966 if ((mp
->m_flag
& avoid
) == 0)
968 mdot
= mp
? mp
- &message
[0] + 1 : msgCount
;
970 for (mp
= &message
[msgCount
-1]; mp
>= &message
[0]; mp
--)
971 if ((mp
->m_flag
& avoid
) == 0)
973 mdot
= mp
>= &message
[0] ? mp
-&message
[0]+1 : msgCount
;
975 } else if (mb
.mb_threaded
) {
976 for (mp
= threadroot
; mp
; mp
= next_in_thread(mp
))
977 if ((mp
->m_flag
& avoid
) == 0)
979 mdot
= mp
? mp
- &message
[0] + 1 : 1;
981 for (mp
= &message
[0]; mp
< &message
[msgCount
]; mp
++)
982 if ((mp
->m_flag
& avoid
) == 0)
984 mdot
= mp
< &message
[msgCount
] ? mp
-&message
[0]+1 : 1;
990 * Print the current version number.
998 printf(catgets(catd
, CATSET
, 111, "Version %s\n"), version
);
1003 initbox(const char *name
)
1008 if (mb
.mb_type
!= MB_VOID
)
1009 (void)n_strlcpy(prevfile
, mailname
, MAXPATHLEN
);
1010 _update_mailname(name
!= mailname
? name
: NULL
);
1011 if ((mb
.mb_otf
= Ftemp(&tempMesg
, "tmpbox", "w", 0600, 0)) == NULL
) {
1012 perror(tr(87, "temporary mail message file"));
1015 (void)fcntl(fileno(mb
.mb_otf
), F_SETFD
, FD_CLOEXEC
);
1016 if ((mb
.mb_itf
= safe_fopen(tempMesg
, "r", &dummy
)) == NULL
) {
1017 perror(tr(87, "temporary mail message file"));
1020 (void)fcntl(fileno(mb
.mb_itf
), F_SETFD
, FD_CLOEXEC
);
1030 if (mb
.mb_sorted
!= NULL
) {
1032 mb
.mb_sorted
= NULL
;
1035 mb
.mb_flags
= MB_NOFLAGS
;
1039 did_print_dot
= FAL0
;