]> git.sur5r.net Git - openldap/blobdiff - libraries/libavl/testavl.c
NT port fixes
[openldap] / libraries / libavl / testavl.c
index 8183e167b3e028d1fc44ce0e3e0d743b0ce0045f..55c1f2279f3b78277a2a70ecfe3b97ff01ecfc1c 100644 (file)
@@ -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 <stdio.h>
-#include <stdlib.h>
 
+#include <ac/stdlib.h>
 #include <ac/string.h>
 
+#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;