]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/tmpltest.c
Add char* ldap_pvt_get_fqdn(char*) which returns the FQDN of the
[openldap] / libraries / libldap / tmpltest.c
index 697d4bc1859b7c036fe43e36ddca9986bbd29d3d..728724690d81727837cf216eab3a281fa23ca4bc 100644 (file)
@@ -1,28 +1,29 @@
+/* $OpenLDAP$ */
 /*
- * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2000 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/socket.h>
 #include <ac/time.h>
 
 #ifdef HAVE_CONSOLE_H
 #include <console.h>
-#endif /* MACOS */
+#endif /* HAVE_CONSOLE_H */
 
-#include "lber.h"
-#include "ldap.h"
-#include "disptmpl.h"
-#include "srchpref.h"
+#include <ldap.h>
+#include <disptmpl.h>
+#include <srchpref.h>
 
 static void dump_tmpl   ( struct ldap_disptmpl *tmpl );
 static void dump_srchpref( struct ldap_searchobj *sp );
 
-#define NULLSTRINGIFNULL( s )  ( s == NULL ? "(null)" : s )
+#define NULLSTRINGIFNULL( s )  ( (s) == NULL ? "(null)" : (s) )
 
 int
 main( int argc, char **argv )
@@ -42,25 +43,25 @@ main( int argc, char **argv )
     if (( err = ldap_init_templates( "ldaptemplates.conf", &templates ))
            != 0 ) {
        fprintf( stderr, "ldap_init_templates failed (%d)\n", err );
-       exit( 1 );
+       exit( EXIT_FAILURE );
     }
 
     if (( err = ldap_init_searchprefs( "ldapsearchprefs.conf", &so ))
            != 0 ) {
        fprintf( stderr, "ldap_init_searchprefs failed (%d)\n", err );
-       exit( 1 );
+       exit( EXIT_FAILURE );
     }
 
     if ( argc == 1 ) {
        printf( "*** Display Templates:\n" );
-       for ( dtp = ldap_first_disptmpl( templates ); dtp != NULLDISPTMPL;
+       for ( dtp = ldap_first_disptmpl( templates ); dtp != NULL;
                dtp = ldap_next_disptmpl( templates, dtp )) {
            dump_tmpl( dtp );
            printf( "\n\n" );
        }
 
        printf( "\n\n*** Search Objects:\n" );
-       for ( sop = ldap_first_searchobj( so ); sop != NULLSEARCHOBJ;
+       for ( sop = ldap_first_searchobj( so ); sop != NULL;
                    sop = ldap_next_searchobj( so, sop )) {
            dump_srchpref( sop );
            printf( "\n\n" );
@@ -78,7 +79,7 @@ main( int argc, char **argv )
     ldap_free_templates( templates );
     ldap_free_searchprefs( so );
 
-    exit( 0 );
+    exit( EXIT_SUCCESS );
 }
 
 
@@ -191,11 +192,11 @@ dump_tmpl( struct ldap_disptmpl *tmpl )
 
     printf( "\ntemplate items:\n" );
     rowcnt = 0;
-    for ( rowp = ldap_first_tmplrow( tmpl ); rowp != NULLTMPLITEM;
+    for ( rowp = ldap_first_tmplrow( tmpl ); rowp != NULL;
            rowp = ldap_next_tmplrow( tmpl, rowp )) {
        ++rowcnt;
        colcnt = 0;
-       for ( colp = ldap_first_tmplcol( tmpl, rowp ); colp != NULLTMPLITEM;
+       for ( colp = ldap_first_tmplcol( tmpl, rowp ); colp != NULL;
                colp = ldap_next_tmplcol( tmpl, rowp, colp )) {
            ++colcnt;
            printf( "  %2d-%d: %s (%s%s", rowcnt, colcnt,