1*0Sstevel@tonic-gate 
2*0Sstevel@tonic-gate /*
3*0Sstevel@tonic-gate  *
4*0Sstevel@tonic-gate  * Portions Copyright %G% Sun Microsystems, Inc.
5*0Sstevel@tonic-gate  * All Rights Reserved
6*0Sstevel@tonic-gate  *
7*0Sstevel@tonic-gate  */
8*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
9*0Sstevel@tonic-gate /*
10*0Sstevel@tonic-gate  *  Copyright (c) 1990 Regents of the University of Michigan.
11*0Sstevel@tonic-gate  *  All rights reserved.
12*0Sstevel@tonic-gate  *
13*0Sstevel@tonic-gate  *  addentry.c
14*0Sstevel@tonic-gate  */
15*0Sstevel@tonic-gate 
16*0Sstevel@tonic-gate #ifndef lint
17*0Sstevel@tonic-gate static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of Michigan.\nAll rights reserved.\n";
18*0Sstevel@tonic-gate #endif
19*0Sstevel@tonic-gate 
20*0Sstevel@tonic-gate #include <stdio.h>
21*0Sstevel@tonic-gate #include <ctype.h>
22*0Sstevel@tonic-gate #include <string.h>
23*0Sstevel@tonic-gate #ifdef MACOS
24*0Sstevel@tonic-gate #include <stdlib.h>
25*0Sstevel@tonic-gate #include "macos.h"
26*0Sstevel@tonic-gate #else /* MACOS */
27*0Sstevel@tonic-gate #if defined( DOS ) || defined( _WIN32 )
28*0Sstevel@tonic-gate #include <malloc.h>
29*0Sstevel@tonic-gate #include "msdos.h"
30*0Sstevel@tonic-gate #else /* DOS */
31*0Sstevel@tonic-gate #include <sys/types.h>
32*0Sstevel@tonic-gate #include <sys/socket.h>
33*0Sstevel@tonic-gate #endif /* DOS */
34*0Sstevel@tonic-gate #endif /* MACOS */
35*0Sstevel@tonic-gate 
36*0Sstevel@tonic-gate #include "lber.h"
37*0Sstevel@tonic-gate #include "ldap.h"
38*0Sstevel@tonic-gate #include "ldap-private.h"
39*0Sstevel@tonic-gate 
40*0Sstevel@tonic-gate LDAPMessage *
41*0Sstevel@tonic-gate ldap_delete_result_entry( LDAPMessage **list, LDAPMessage *e )
42*0Sstevel@tonic-gate {
43*0Sstevel@tonic-gate 	LDAPMessage	*tmp, *prev = NULL;
44*0Sstevel@tonic-gate 
45*0Sstevel@tonic-gate 	for ( tmp = *list; tmp != NULL && tmp != e; tmp = tmp->lm_chain )
46*0Sstevel@tonic-gate 		prev = tmp;
47*0Sstevel@tonic-gate 
48*0Sstevel@tonic-gate 	if ( tmp == NULL )
49*0Sstevel@tonic-gate 		return( NULL );
50*0Sstevel@tonic-gate 
51*0Sstevel@tonic-gate 	if ( prev == NULL )
52*0Sstevel@tonic-gate 		*list = tmp->lm_chain;
53*0Sstevel@tonic-gate 	else
54*0Sstevel@tonic-gate 		prev->lm_chain = tmp->lm_chain;
55*0Sstevel@tonic-gate 	tmp->lm_chain = NULL;
56*0Sstevel@tonic-gate 
57*0Sstevel@tonic-gate 	return( tmp );
58*0Sstevel@tonic-gate }
59*0Sstevel@tonic-gate 
60*0Sstevel@tonic-gate void
61*0Sstevel@tonic-gate ldap_add_result_entry( LDAPMessage **list, LDAPMessage *e )
62*0Sstevel@tonic-gate {
63*0Sstevel@tonic-gate 	e->lm_chain = *list;
64*0Sstevel@tonic-gate 	*list = e;
65*0Sstevel@tonic-gate }
66