* Copyright (c) 1988, 1989, 1990, 1993
* The Regents of the University of California. All rights reserved.
* This code is derived from software contributed to Berkeley by
* %sccs.include.redist.c%
static char sccsid
[] = "@(#)lstDupl.c 8.2 (Berkeley) %G%";
* Duplicate a list. This includes duplicating the individual
*-----------------------------------------------------------------------
* Duplicate an entire list. If a function to copy a ClientData is
* given, the individual client elements will be duplicated as well.
* The new Lst structure or NILLST if failure.
*-----------------------------------------------------------------------
Lst_Duplicate (l
, copyProc
)
Lst l
; /* the list to duplicate */
/* A function to duplicate each ClientData */
ClientData (*copyProc
) __P((ClientData
));
register List list
= (List
)l
;
nl
= Lst_Init (list
->isCirc
);
while (ln
!= NilListNode
) {
if (copyProc
!= NOCOPY
) {
if (Lst_AtEnd (nl
, (*copyProc
) (ln
->datum
)) == FAILURE
) {
} else if (Lst_AtEnd (nl
, ln
->datum
) == FAILURE
) {
if (list
->isCirc
&& ln
== list
->lastPtr
) {