version 1.24, 2003/06/03 02:56:11 |
version 1.25, 2003/12/03 20:59:45 |
|
|
printhead(int mesg) |
printhead(int mesg) |
{ |
{ |
struct message *mp; |
struct message *mp; |
char headline[LINESIZE], wcount[LINESIZE], *subjline, dispc, curind; |
char headline[LINESIZE], *subjline, dispc, curind; |
char visline[LINESIZE]; |
char visname[LINESIZE], vissub[LINESIZE]; |
char pbuf[BUFSIZ]; |
char pbuf[LINESIZE]; |
|
char fmtline[LINESIZE]; |
|
const char *fmt; |
struct headline hl; |
struct headline hl; |
int subjlen; |
|
char *name; |
char *name; |
char *to, *from; |
char *to, *from; |
struct name *np; |
struct name *np; |
|
|
|
|
mp = &message[mesg-1]; |
mp = &message[mesg-1]; |
(void)readline(setinput(mp), headline, LINESIZE, NULL); |
(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)) == NULL) |
|
subjline = ""; |
/* |
/* |
* Bletch! |
* Bletch! |
*/ |
*/ |
|
|
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), "%4d/%-5d", mp->m_lines, |
|
mp->m_size); |
|
subjlen = screenwidth - 44 - strlen(wcount); |
|
from = nameof(mp, 0); |
from = nameof(mp, 0); |
to = skin(hfield("to", mp)); |
to = skin(hfield("to", mp)); |
np = extract(from, GTO); |
np = extract(from, GTO); |
|
|
else |
else |
/* from me - show TO */ |
/* from me - show TO */ |
name = value("showto") != NULL && to ? to : from; |
name = value("showto") != NULL && to ? to : from; |
if (subjline == NULL || subjlen < 0) { /* pretty pathetic */ |
strnvis(visname, name, sizeof(visname), VIS_SAFE|VIS_NOSLASH); |
subjline=""; |
|
subjlen=0; |
|
} |
|
printf("%c%c%3d ", curind, dispc, mesg); |
|
strnvis(visline, name, sizeof(visline), VIS_SAFE|VIS_NOSLASH); |
|
if (name == to) |
if (name == to) |
printf("TO %-14.14s", visline); |
fmt = "%c%c%3d TO %-14.14s %16.16s %4d/%-5d %s"; |
else |
else |
printf("%-17.17s", visline); |
fmt = "%c%c%3d %-17.17s %16.16s %4d/%-5d %s"; |
/* hl.l_date was sanity-checked when read in. wcount we just made. */ |
strnvis(vissub, subjline, sizeof(vissub), VIS_SAFE|VIS_NOSLASH); |
strnvis(visline, subjline, sizeof(visline), VIS_SAFE|VIS_NOSLASH); |
/* hl.l_date was sanity-checked when read in. */ |
printf(" %16.16s %s %.*s\n", hl.l_date, wcount, subjlen, visline); |
snprintf(fmtline, sizeof(fmtline), fmt, curind, dispc, mesg, visname, |
|
hl.l_date, mp->m_lines, mp->m_size, vissub); |
|
printf("%.*s\n", screenwidth, fmtline); |
} |
} |
|
|
/* |
/* |