version 1.19, 2001/11/16 17:10:06 |
version 1.20, 2001/11/20 20:50:00 |
|
|
*/ |
*/ |
|
|
static int screen; |
static int screen; |
|
static volatile sig_atomic_t gothdrint; |
|
|
int |
int |
headers(v) |
headers(v) |
|
|
int *msgvec = v; |
int *msgvec = v; |
int n, mesg, flag, size; |
int n, mesg, flag, size; |
struct message *mp; |
struct message *mp; |
|
struct sigaction act, oact; |
|
sigset_t oset; |
|
|
size = screensize(); |
size = screensize(); |
n = msgvec[0]; |
n = msgvec[0]; |
|
|
mesg = mp - &message[0]; |
mesg = mp - &message[0]; |
if (dot != &message[n-1]) |
if (dot != &message[n-1]) |
dot = mp; |
dot = mp; |
for (; mp < &message[msgCount]; mp++) { |
sigemptyset(&act.sa_mask); |
|
act.sa_flags = SA_RESTART; |
|
act.sa_handler = hdrint; |
|
if (sigaction(SIGINT, NULL, &oact) == 0 && |
|
oact.sa_handler != SIG_IGN) { |
|
(void)sigaction(SIGINT, &act, &oact); |
|
(void)sigprocmask(SIG_UNBLOCK, &intset, &oset); |
|
} |
|
for (gothdrint = 0; !gothdrint && mp < &message[msgCount]; mp++) { |
mesg++; |
mesg++; |
if (mp->m_flag & MDELETED) |
if (mp->m_flag & MDELETED) |
continue; |
continue; |
|
|
break; |
break; |
printhead(mesg); |
printhead(mesg); |
} |
} |
|
if (gothdrint) { |
|
fflush(stdout); |
|
fputs("\nInterrupt\n", stderr); |
|
} |
|
if (oact.sa_handler != SIG_IGN) { |
|
(void)sigprocmask(SIG_SETMASK, &oset, NULL); |
|
(void)sigaction(SIGINT, &oact, NULL); |
|
} |
if (flag == 0) { |
if (flag == 0) { |
puts("No more mail."); |
puts("No more mail."); |
return(1); |
return(1); |
|
|
char **ap; |
char **ap; |
|
|
mp = &message[mesg-1]; |
mp = &message[mesg-1]; |
(void)readline(setinput(mp), headline, LINESIZE); |
(void)readline(setinput(mp), headline, LINESIZE, NULL); |
if ((subjline = hfield("subject", mp)) == NULL) |
if ((subjline = hfield("subject", mp)) == NULL) |
subjline = hfield("subj", mp); |
subjline = hfield("subj", mp); |
/* |
/* |
|
|
int nlines, *ip, restoreterm; |
int nlines, *ip, restoreterm; |
struct message *mp; |
struct message *mp; |
struct termios tbuf; |
struct termios tbuf; |
char * volatile cp; |
char *cp; |
FILE * volatile obuf; |
FILE *obuf; |
|
|
obuf = stdout; |
obuf = stdout; |
restoreterm = 0; |
restoreterm = 0; |
|
|
restoreterm = (tcgetattr(fileno(stdin), &tbuf) == 0); |
restoreterm = (tcgetattr(fileno(stdin), &tbuf) == 0); |
obuf = Popen(cmd, "w"); |
obuf = Popen(cmd, "w"); |
if (obuf == NULL) { |
if (obuf == NULL) { |
warn("%s", cp); |
warn("%s", cmd); |
obuf = stdout; |
obuf = stdout; |
} else { |
|
(void)signal(SIGPIPE, SIG_IGN); |
|
} |
} |
} else if (value("interactive") != NULL && |
} else if (value("interactive") != NULL && |
(page || (cp = value("crt")) != NULL)) { |
(page || (cp = value("crt")) != NULL)) { |
|
|
if (obuf == NULL) { |
if (obuf == NULL) { |
warn("%s", cp); |
warn("%s", cp); |
obuf = stdout; |
obuf = stdout; |
} else |
} |
(void)signal(SIGPIPE, SIG_IGN); |
|
} |
} |
} |
} |
|
|
|
|
|
|
if (obuf != stdout) { |
if (obuf != stdout) { |
(void)Pclose(obuf); |
(void)Pclose(obuf); |
(void)signal(SIGPIPE, SIG_DFL); |
|
if (restoreterm) |
if (restoreterm) |
(void)tcsetattr(fileno(stdin), TCSADRAIN, &tbuf); |
(void)tcsetattr(fileno(stdin), TCSADRAIN, &tbuf); |
} |
} |
|
|
if (!lineb) |
if (!lineb) |
putchar('\n'); |
putchar('\n'); |
for (lines = 0; lines < c && lines <= topl; lines++) { |
for (lines = 0; lines < c && lines <= topl; lines++) { |
if (readline(ibuf, linebuf, sizeof(linebuf)) < 0) |
if (readline(ibuf, linebuf, sizeof(linebuf), NULL) < 0) |
break; |
break; |
puts(linebuf); |
puts(linebuf); |
lineb = blankline(linebuf); |
lineb = blankline(linebuf); |
|
|
} |
} |
|
|
return(0); |
return(0); |
|
} |
|
|
|
/* |
|
* User hit ^C while printing the headers. |
|
*/ |
|
void |
|
hdrint(s) |
|
int s; |
|
{ |
|
|
|
gothdrint = 1; |
} |
} |