X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=libraries%2Flibavl%2Ftestavl.c;h=55c1f2279f3b78277a2a70ecfe3b97ff01ecfc1c;hb=86717ac2d94d1865515b1d05e410472365955c23;hp=8183e167b3e028d1fc44ce0e3e0d743b0ce0045f;hpb=322bb86fa47e5abba57fab55d748b00ac8737df2;p=openldap diff --git a/libraries/libavl/testavl.c b/libraries/libavl/testavl.c index 8183e167b3..55c1f2279f 100644 --- a/libraries/libavl/testavl.c +++ b/libraries/libavl/testavl.c @@ -1,12 +1,18 @@ /* testavl.c - Test Tim Howes AVL code */ +/* $OpenLDAP$ */ +/* + * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved. + * COPYING RESTRICTIONS APPLY, see COPYRIGHT file + */ #include "portable.h" #include -#include +#include #include +#define AVL_INTERNAL #define AVL_NONREENTRANT #include "avl.h" @@ -16,7 +22,7 @@ static void myprint LDAP_P(( Avlnode *root )); int main( int argc, char **argv ) { - Avlnode *tree = NULLAVL; + Avlnode *tree = NULL; char command[ 10 ]; char name[ 80 ]; char *p; @@ -26,7 +32,7 @@ main( int argc, char **argv ) switch( *command ) { case 'n': /* new tree */ ( void ) avl_free( tree, (AVL_FREE) free ); - tree = NULLAVL; + tree = NULL; break; case 'p': /* print */ ( void ) myprint( tree ); @@ -46,7 +52,7 @@ main( int argc, char **argv ) case 'f': /* find */ printf( "data? " ); if ( fgets( name, sizeof( name ), stdin ) == NULL ) - exit( 0 ); + exit( EXIT_SUCCESS ); name[ strlen( name ) - 1 ] = '\0'; if ( (p = (char *) avl_find( tree, name, (AVL_CMP) strcmp )) == NULL ) @@ -57,7 +63,7 @@ main( int argc, char **argv ) case 'i': /* insert */ printf( "data? " ); if ( fgets( name, sizeof( name ), stdin ) == NULL ) - exit( 0 ); + exit( EXIT_SUCCESS ); name[ strlen( name ) - 1 ] = '\0'; if ( avl_insert( &tree, strdup( name ), (AVL_CMP) strcmp, avl_dup_error ) != 0 ) @@ -66,13 +72,13 @@ main( int argc, char **argv ) case 'd': /* delete */ printf( "data? " ); if ( fgets( name, sizeof( name ), stdin ) == NULL ) - exit( 0 ); + exit( EXIT_SUCCESS ); name[ strlen( name ) - 1 ] = '\0'; if ( avl_delete( &tree, name, (AVL_CMP) strcmp ) == NULL ) printf( "\nNot found!\n" ); break; case 'q': /* quit */ - exit( 0 ); + exit( EXIT_SUCCESS ); break; case '\n': break;