version 1.16, 2000/06/30 16:00:18 |
version 1.17, 2001/01/16 05:36:08 |
|
|
struct headline hl; |
struct headline hl; |
int subjlen; |
int subjlen; |
char *name; |
char *name; |
|
char *to, *from; |
|
struct name *np; |
|
char **ap; |
|
|
mp = &message[mesg-1]; |
mp = &message[mesg-1]; |
(void)readline(setinput(mp), headline, LINESIZE); |
(void)readline(setinput(mp), headline, LINESIZE); |
|
|
if (mp->m_flag & MBOX) |
if (mp->m_flag & MBOX) |
dispc = 'M'; |
dispc = 'M'; |
parse(headline, &hl, pbuf); |
parse(headline, &hl, pbuf); |
(void)snprintf(wcount, sizeof(wcount), "%3d/%-5d", mp->m_lines, |
(void)snprintf(wcount, sizeof(wcount), "%4d/%-5d", mp->m_lines, |
mp->m_size); |
mp->m_size); |
subjlen = screenwidth - 50 - strlen(wcount); |
subjlen = screenwidth - 44 - strlen(wcount); |
name = value("show-rcpt") != NULL ? |
from = nameof(mp, 0); |
skin(hfield("to", mp)) : nameof(mp, 0); |
to = skin(hfield("to", mp)); |
if (subjline == NULL || subjlen < 0) /* pretty pathetic */ |
np = extract(from, GTO); |
printf("%c%c%3d %-20.20s %16.16s %s\n", |
np = delname(np, myname); |
curind, dispc, mesg, name, hl.l_date, wcount); |
if (altnames) |
|
for (ap = altnames; *ap; ap++) |
|
np = delname(np, *ap); |
|
if (np) |
|
/* not from me */ |
|
name = value("show-rcpt") != NULL && to ? to : from; |
else |
else |
printf("%c%c%3d %-20.20s %16.16s %s \"%.*s\"\n", |
/* from me - show TO */ |
|
name = value("showto") != NULL && to ? to : from; |
|
if (subjline == NULL || subjlen < 0) { /* pretty pathetic */ |
|
subjline=""; |
|
subjlen=0; |
|
} |
|
if (name == to) |
|
printf("%c%c%3d TO %-14.14s %16.16s %s %.*s\n", |
curind, dispc, mesg, name, hl.l_date, wcount, |
curind, dispc, mesg, name, hl.l_date, wcount, |
subjlen, subjline); |
subjlen, subjline); |
|
else |
|
printf("%c%c%3d %-17.17s %16.16s %s %.*s\n", |
|
curind, dispc, mesg, name, hl.l_date, wcount, |
|
subjlen, subjline); |
} |
} |
|
|
/* |
/* |
|
|
} |
} |
|
|
/* |
/* |
|
* Pipe message to command |
|
*/ |
|
int |
|
pipeit(ml, sl) |
|
void *ml, *sl; |
|
{ |
|
int *msgvec = ml; |
|
char *cmd = sl; |
|
|
|
return(type1(msgvec, cmd, 0, 0)); |
|
} |
|
|
|
/* |
* Paginate messages, honor ignored fields. |
* Paginate messages, honor ignored fields. |
*/ |
*/ |
int |
int |
|
|
void *v; |
void *v; |
{ |
{ |
int *msgvec = v; |
int *msgvec = v; |
return(type1(msgvec, 1, 1)); |
return(type1(msgvec, NULL, 1, 1)); |
} |
} |
|
|
/* |
/* |
|
|
{ |
{ |
int *msgvec = v; |
int *msgvec = v; |
|
|
return(type1(msgvec, 0, 1)); |
return(type1(msgvec, NULL, 0, 1)); |
} |
} |
|
|
/* |
/* |
|
|
{ |
{ |
int *msgvec = v; |
int *msgvec = v; |
|
|
return(type1(msgvec, 1, 0)); |
return(type1(msgvec, NULL, 1, 0)); |
} |
} |
|
|
/* |
/* |
|
|
{ |
{ |
int *msgvec = v; |
int *msgvec = v; |
|
|
return(type1(msgvec, 0, 0)); |
return(type1(msgvec, NULL, 0, 0)); |
} |
} |
|
|
/* |
/* |
|
|
*/ |
*/ |
sigjmp_buf pipestop; |
sigjmp_buf pipestop; |
int |
int |
type1(msgvec, doign, page) |
type1(msgvec, cmd, doign, page) |
int *msgvec; |
int *msgvec; |
|
char *cmd; |
int doign, page; |
int doign, page; |
{ |
{ |
int nlines, *ip; |
int nlines, *ip; |
struct message *mp; |
struct message *mp; |
char *cp; |
char *cp; |
FILE *obuf; |
FILE *obuf; |
|
|
#if __GNUC__ |
#if __GNUC__ |
/* Avoid siglongjmp clobbering */ |
/* Avoid siglongjmp clobbering */ |
(void)&cp; |
(void)&cp; |
|
|
obuf = stdout; |
obuf = stdout; |
if (sigsetjmp(pipestop, 1)) |
if (sigsetjmp(pipestop, 1)) |
goto close_pipe; |
goto close_pipe; |
if (value("interactive") != NULL && |
|
(page || (cp = value("crt")) != NULL)) { |
/* |
|
* start a pipe if needed. |
|
*/ |
|
if (cmd) { |
|
obuf = Popen(cmd, "w"); |
|
if (obuf == NULL) { |
|
warn("%s", cp); |
|
obuf = stdout; |
|
} else { |
|
(void)signal(SIGPIPE, brokpipe); |
|
} |
|
} else if (value("interactive") != NULL && |
|
(page || (cp = value("crt")) != NULL)) { |
nlines = 0; |
nlines = 0; |
if (!page) { |
if (!page) { |
for (ip = msgvec; *ip && ip-msgvec < msgCount; ip++) |
for (ip = msgvec; *ip && ip-msgvec < msgCount; ip++) |
nlines += message[*ip - 1].m_lines; |
nlines += message[*ip - 1].m_lines; |
} |
} |
if (page || nlines > (*cp ? atoi(cp) : realscreenheight)) { |
if (page || nlines > (*cp ? atoi(cp) : realscreenheight)) { |
cp = value("PAGER"); |
obuf = Popen(value("PAGER"), "w"); |
if (cp == NULL || *cp == '\0') |
|
cp = _PATH_MORE; |
|
obuf = Popen(cp, "w"); |
|
if (obuf == NULL) { |
if (obuf == NULL) { |
warn("%s", cp); |
warn("%s", cp); |
obuf = stdout; |
obuf = stdout; |
|
|
(void)signal(SIGPIPE, brokpipe); |
(void)signal(SIGPIPE, brokpipe); |
} |
} |
} |
} |
|
|
|
/* |
|
* send messages to the output. |
|
*/ |
for (ip = msgvec; *ip && ip - msgvec < msgCount; ip++) { |
for (ip = msgvec; *ip && ip - msgvec < msgCount; ip++) { |
mp = &message[*ip - 1]; |
mp = &message[*ip - 1]; |
touch(mp); |
touch(mp); |
dot = mp; |
dot = mp; |
if (value("quiet") == NULL) |
if (cmd == NULL && value("quiet") == NULL) |
fprintf(obuf, "Message %d:\n", *ip); |
fprintf(obuf, "Message %d:\n", *ip); |
(void)sendmessage(mp, obuf, doign ? ignore : 0, NULL); |
(void)sendmessage(mp, obuf, doign ? ignore : 0, NULL); |
} |
} |
|
|
close_pipe: |
close_pipe: |
if (obuf != stdout) { |
if (obuf != stdout) { |
/* |
/* |
|
|
folders(v) |
folders(v) |
void *v; |
void *v; |
{ |
{ |
|
char *files = (char *)v; |
char dirname[PATHSIZE]; |
char dirname[PATHSIZE]; |
char *cmd; |
char cmd[BUFSIZ]; |
|
|
if (getfold(dirname, sizeof(dirname)) < 0) { |
if (getfold(dirname, sizeof(dirname)) < 0) { |
puts("No value set for \"folder\""); |
strcpy(dirname, "$HOME"); |
return(1); |
|
} |
} |
if ((cmd = value("LISTER")) == NULL) |
|
cmd = "ls"; |
snprintf(cmd, sizeof(cmd), "cd %s; %s %s", dirname, value("LISTER"), |
(void)run_command(cmd, 0, -1, -1, dirname, NULL, NULL); |
files && *files ? files : ""); |
|
|
|
(void)run_command(value("SHELL"), 0, -1, -1, "-c", cmd, NULL); |
return(0); |
return(0); |
} |
} |
|
|
|
|
} else if (nmsg > 0) { |
} else if (nmsg > 0) { |
mdot = newfileinfo(msgCount - nmsg); |
mdot = newfileinfo(msgCount - nmsg); |
dot = &message[mdot - 1]; |
dot = &message[mdot - 1]; |
clearnew(); |
|
} else { |
} else { |
puts("\"inc\" command failed..."); |
puts("\"inc\" command failed..."); |
} |
} |