home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ldapsdk.zip / libraries / libldap / addentry.c < prev    next >
C/C++ Source or Header  |  2000-07-05  |  1KB  |  57 lines

  1. /* $OpenLDAP: pkg/ldap/libraries/libldap/addentry.c,v 1.6.4.3 2000/07/04 17:58:51 kurt Exp $ */
  2. /*
  3.  * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
  4.  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  5.  */
  6. /*  Portions
  7.  *  Copyright (c) 1990 Regents of the University of Michigan.
  8.  *  All rights reserved.
  9.  *
  10.  *  addentry.c
  11.  */
  12.  
  13. #include "portable.h"
  14.  
  15. #include <stdio.h>
  16.  
  17. #include <ac/stdlib.h>
  18.  
  19. #include <ac/socket.h>
  20. #include <ac/string.h>
  21. #include <ac/time.h>
  22.  
  23. #include "ldap-int.h"
  24.  
  25. LDAPMessage *
  26. ldap_delete_result_entry( LDAPMessage **list, LDAPMessage *e )
  27. {
  28.     LDAPMessage    *tmp, *prev = NULL;
  29.  
  30.     assert( list != NULL );
  31.     assert( e != NULL );
  32.  
  33.     for ( tmp = *list; tmp != NULL && tmp != e; tmp = tmp->lm_chain )
  34.         prev = tmp;
  35.  
  36.     if ( tmp == NULL )
  37.         return( NULL );
  38.  
  39.     if ( prev == NULL )
  40.         *list = tmp->lm_chain;
  41.     else
  42.         prev->lm_chain = tmp->lm_chain;
  43.     tmp->lm_chain = NULL;
  44.  
  45.     return( tmp );
  46. }
  47.  
  48. void
  49. ldap_add_result_entry( LDAPMessage **list, LDAPMessage *e )
  50. {
  51.     assert( list != NULL );
  52.     assert( e != NULL );
  53.  
  54.     e->lm_chain = *list;
  55.     *list = e;
  56. }
  57.