10Sstevel@tonic-gate 20Sstevel@tonic-gate /* 3*3857Sstevel * Portions Copyright 1998 Sun Microsystems, Inc. All rights reserved. 4*3857Sstevel * Use is subject to license terms. 50Sstevel@tonic-gate */ 60Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 70Sstevel@tonic-gate /* 80Sstevel@tonic-gate * Copyright (c) 1990 Regents of the University of Michigan. 90Sstevel@tonic-gate * All rights reserved. 100Sstevel@tonic-gate * 110Sstevel@tonic-gate * addentry.c 120Sstevel@tonic-gate */ 130Sstevel@tonic-gate 140Sstevel@tonic-gate #ifndef lint 150Sstevel@tonic-gate static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of Michigan.\nAll rights reserved.\n"; 160Sstevel@tonic-gate #endif 170Sstevel@tonic-gate 180Sstevel@tonic-gate #include <stdio.h> 190Sstevel@tonic-gate #include <ctype.h> 200Sstevel@tonic-gate #include <string.h> 210Sstevel@tonic-gate #ifdef MACOS 220Sstevel@tonic-gate #include <stdlib.h> 230Sstevel@tonic-gate #include "macos.h" 240Sstevel@tonic-gate #else /* MACOS */ 250Sstevel@tonic-gate #if defined( DOS ) || defined( _WIN32 ) 260Sstevel@tonic-gate #include <malloc.h> 270Sstevel@tonic-gate #include "msdos.h" 280Sstevel@tonic-gate #else /* DOS */ 290Sstevel@tonic-gate #include <sys/types.h> 300Sstevel@tonic-gate #include <sys/socket.h> 310Sstevel@tonic-gate #endif /* DOS */ 320Sstevel@tonic-gate #endif /* MACOS */ 330Sstevel@tonic-gate 340Sstevel@tonic-gate #include "lber.h" 350Sstevel@tonic-gate #include "ldap.h" 360Sstevel@tonic-gate #include "ldap-private.h" 370Sstevel@tonic-gate 380Sstevel@tonic-gate LDAPMessage * ldap_delete_result_entry(LDAPMessage ** list,LDAPMessage * e)390Sstevel@tonic-gateldap_delete_result_entry( LDAPMessage **list, LDAPMessage *e ) 400Sstevel@tonic-gate { 410Sstevel@tonic-gate LDAPMessage *tmp, *prev = NULL; 420Sstevel@tonic-gate 430Sstevel@tonic-gate for ( tmp = *list; tmp != NULL && tmp != e; tmp = tmp->lm_chain ) 440Sstevel@tonic-gate prev = tmp; 450Sstevel@tonic-gate 460Sstevel@tonic-gate if ( tmp == NULL ) 470Sstevel@tonic-gate return( NULL ); 480Sstevel@tonic-gate 490Sstevel@tonic-gate if ( prev == NULL ) 500Sstevel@tonic-gate *list = tmp->lm_chain; 510Sstevel@tonic-gate else 520Sstevel@tonic-gate prev->lm_chain = tmp->lm_chain; 530Sstevel@tonic-gate tmp->lm_chain = NULL; 540Sstevel@tonic-gate 550Sstevel@tonic-gate return( tmp ); 560Sstevel@tonic-gate } 570Sstevel@tonic-gate 580Sstevel@tonic-gate void ldap_add_result_entry(LDAPMessage ** list,LDAPMessage * e)590Sstevel@tonic-gateldap_add_result_entry( LDAPMessage **list, LDAPMessage *e ) 600Sstevel@tonic-gate { 610Sstevel@tonic-gate e->lm_chain = *list; 620Sstevel@tonic-gate *list = e; 630Sstevel@tonic-gate } 64