4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
22 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
23 /* All Rights Reserved */
26 #pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 2. */
29 * Remove an entry from its linked list and free any malloc'd memory..
31 void poplist (hdrtype
, where
)
35 struct hdrs
*hdr2rm
, *cont2rm
, *nextcont
;
37 /* Remove first/last entry from list */
39 hdr2rm
= (where
== HEAD
?
40 hdrlines
[hdrtype
].head
: hdrlines
[hdrtype
].tail
);
42 if (hdr2rm
== (struct hdrs
*)NULL
) {
46 if (hdr2rm
->next
== (struct hdrs
*)NULL
) {
47 /* Only 1 entry in list */
48 hdrlines
[hdrtype
].head
= hdrlines
[hdrtype
].tail
=
51 hdrlines
[hdrtype
].head
= hdr2rm
->next
;
52 hdr2rm
->next
->prev
= (struct hdrs
*)NULL
;
55 if (hdr2rm
->prev
== (struct hdrs
*)NULL
) {
56 /* Only 1 entry in list */
57 hdrlines
[hdrtype
].head
= hdrlines
[hdrtype
].tail
=
60 hdrlines
[hdrtype
].tail
= hdr2rm
->prev
;
61 hdr2rm
->prev
->next
= (struct hdrs
*)NULL
;
64 /* Keep track of total bytes added to message due to */
65 /* selected lines in case non-delivery */
66 /* notification needs to be sent. (See also copylet()) */
67 if (hdrtype
== H_AFWDFROM
) {
69 (strlen(header
[H_AFWDFROM
].tag
) + strlen(hdr2rm
->value
) + 2);
72 if (hdrtype
== H_RECEIVED
) {
74 (strlen(header
[H_RECEIVED
].tag
) + strlen(hdr2rm
->value
) + 2);
77 cont2rm
= hdr2rm
->cont
;
78 while (cont2rm
!= (struct hdrs
*)NULL
) {
79 nextcont
= cont2rm
->next
;
80 if (hdrtype
== H_AFWDFROM
) {
81 affbytecnt
-= (strlen(cont2rm
->value
) + 1);
84 if (hdrtype
== H_RECEIVED
) {
85 rcvbytecnt
-= (strlen(cont2rm
->value
) + 1);
87 free ((char *)cont2rm
);
90 free ((char *)hdr2rm
);