#include "mail.h"
void poplist (hdrtype, where)
register int hdrtype;
register int where;
{
struct hdrs *hdr2rm, *cont2rm, *nextcont;
hdr2rm = (where == HEAD ?
hdrlines[hdrtype].head : hdrlines[hdrtype].tail);
if (hdr2rm == (struct hdrs *)NULL) {
return;
}
if (where == HEAD) {
if (hdr2rm->next == (struct hdrs *)NULL) {
hdrlines[hdrtype].head = hdrlines[hdrtype].tail =
(struct hdrs *)NULL;
} else {
hdrlines[hdrtype].head = hdr2rm->next;
hdr2rm->next->prev = (struct hdrs *)NULL;
}
} else {
if (hdr2rm->prev == (struct hdrs *)NULL) {
hdrlines[hdrtype].head = hdrlines[hdrtype].tail =
(struct hdrs *)NULL;
} else {
hdrlines[hdrtype].tail = hdr2rm->prev;
hdr2rm->prev->next = (struct hdrs *)NULL;
}
}
if (hdrtype == H_AFWDFROM) {
affbytecnt -=
(strlen(header[H_AFWDFROM].tag) + strlen(hdr2rm->value) + 2);
affcnt--;
}
if (hdrtype == H_RECEIVED) {
rcvbytecnt -=
(strlen(header[H_RECEIVED].tag) + strlen(hdr2rm->value) + 2);
}
cont2rm = hdr2rm->cont;
while (cont2rm != (struct hdrs *)NULL) {
nextcont = cont2rm->next;
if (hdrtype == H_AFWDFROM) {
affbytecnt -= (strlen(cont2rm->value) + 1);
affcnt--;
}
if (hdrtype == H_RECEIVED) {
rcvbytecnt -= (strlen(cont2rm->value) + 1);
}
free ((char *)cont2rm);
cont2rm = nextcont;
}
free ((char *)hdr2rm);
}