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