]> git.sur5r.net Git - openldap/blobdiff - libraries/librewrite/rewrite.c
ITS#5360 move tls option setup
[openldap] / libraries / librewrite / rewrite.c
index b040ee7fd2b2a755c18801bbaf265d44d6a1e1ce..372018ac74f45ebfd19d4eb337ed7adfcc759617 100644 (file)
@@ -1,7 +1,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 2000-2005 The OpenLDAP Foundation.
+ * Copyright 2000-2008 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -30,6 +30,7 @@
 #include <stdio.h>
 
 #include <rewrite.h>
+#include <lutil.h>
 #include <ldap.h>
 
 int ldap_debug;
@@ -127,7 +128,6 @@ main( int argc, char *argv[] )
        FILE    *fin = NULL;
        char    *rewriteContext = REWRITE_DEFAULT_CONTEXT;
        int     debug = 0;
-       char    *next;
 
        while ( 1 ) {
                int opt = getopt( argc, argv, "d:f:hr:" );
@@ -138,8 +138,7 @@ main( int argc, char *argv[] )
 
                switch ( opt ) {
                case 'd':
-                       debug = strtol( optarg, &next, 10 );
-                       if ( next == NULL || next[0] != '\0' ) {
+                       if ( lutil_atoi( &debug, optarg ) != 0 ) {
                                fprintf( stderr, "illegal log level '%s'\n",
                                                optarg );
                                exit( EXIT_FAILURE );