From d8929296b801999f7679fd86e1e526a59d08e608 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Sat, 27 Jul 2002 00:06:27 +0000 Subject: [PATCH] Use lutil_progname, #include to get it. --- clients/tools/ldapcompare.c | 2 +- clients/tools/ldapdelete.c | 3 ++- clients/tools/ldapmodify.c | 7 ++----- clients/tools/ldapmodrdn.c | 3 ++- clients/tools/ldappasswd.c | 4 ++-- clients/tools/ldapsearch.c | 4 ++-- clients/tools/ldapwhoami.c | 4 ++-- 7 files changed, 13 insertions(+), 14 deletions(-) diff --git a/clients/tools/ldapcompare.c b/clients/tools/ldapcompare.c index b6082a61b3..3b731f9346 100644 --- a/clients/tools/ldapcompare.c +++ b/clients/tools/ldapcompare.c @@ -117,7 +117,7 @@ main( int argc, char **argv ) authmethod = -1; - prog = (prog = strrchr(argv[0], *LDAP_DIRSEP)) == NULL ? argv[0] : prog + 1; + prog = lutil_progname( "ldapcompare", argc, argv ); while (( i = getopt( argc, argv, "Cd:D:h:H:IkKMnO:p:P:qQR:U:vw:WxX:Y:zZ")) != EOF ) diff --git a/clients/tools/ldapdelete.c b/clients/tools/ldapdelete.c index 13230f5f78..bc04de2b5b 100644 --- a/clients/tools/ldapdelete.c +++ b/clients/tools/ldapdelete.c @@ -17,6 +17,7 @@ #include #include +#include "lutil.h" #include "lutil_ldap.h" #include "ldap_defaults.h" @@ -100,7 +101,7 @@ main( int argc, char **argv ) authmethod = -1; version = -1; - prog = (prog = strrchr(argv[0], *LDAP_DIRSEP)) == NULL ? argv[0] : prog + 1; + prog = lutil_progname( "ldapdelete", argc, argv ); while (( i = getopt( argc, argv, "cf:r" "Cd:D:h:H:IkKMnO:p:P:QR:U:vw:WxX:Y:Z" )) != EOF ) diff --git a/clients/tools/ldapmodify.c b/clients/tools/ldapmodify.c index a72f6f0a93..ed73a57b29 100644 --- a/clients/tools/ldapmodify.c +++ b/clients/tools/ldapmodify.c @@ -29,6 +29,7 @@ #include +#include "lutil.h" #include "lutil_ldap.h" #include "ldif.h" #include "ldap_defaults.h" @@ -146,11 +147,7 @@ main( int argc, char **argv ) int rc, i, authmethod, version, want_bindpw, debug, manageDSAit, referrals; int count, len; - if (( prog = strrchr( argv[ 0 ], *LDAP_DIRSEP )) == NULL ) { - prog = argv[ 0 ]; - } else { - ++prog; - } + prog = lutil_progname( "ldapmodify", argc, argv ); /* Print usage when no parameters */ if( argc < 2 ) usage( prog ); diff --git a/clients/tools/ldapmodrdn.c b/clients/tools/ldapmodrdn.c index 913481e1e3..b5d2d59283 100644 --- a/clients/tools/ldapmodrdn.c +++ b/clients/tools/ldapmodrdn.c @@ -29,6 +29,7 @@ #include #include +#include "lutil.h" #include "lutil_ldap.h" #include "ldap_defaults.h" @@ -116,7 +117,7 @@ main(int argc, char **argv) authmethod = -1; version = -1; - prog = (prog = strrchr(argv[0], *LDAP_DIRSEP)) == NULL ? argv[0] : prog + 1; + prog = lutil_progname( "ldapmodrdn", argc, argv ); while (( i = getopt( argc, argv, "cf:rs:" "Cd:D:h:H:IkKMnO:p:P:QR:U:vw:WxX:Y:Z" )) != EOF ) diff --git a/clients/tools/ldappasswd.c b/clients/tools/ldappasswd.c index 838eb0288e..f78d5ce5c4 100644 --- a/clients/tools/ldappasswd.c +++ b/clients/tools/ldappasswd.c @@ -18,7 +18,7 @@ #include #include - +#include "lutil.h" #include "lutil_ldap.h" #include "ldap_defaults.h" @@ -107,7 +107,7 @@ main( int argc, char *argv[] ) char *retoid = NULL; struct berval *retdata = NULL; - prog = (prog = strrchr(argv[0], *LDAP_DIRSEP)) == NULL ? argv[0] : prog + 1; + prog = lutil_progname( "ldappasswd", argc, argv ); while( (i = getopt( argc, argv, "Aa:Ss:" "Cd:D:h:H:InO:p:QR:U:vw:WxX:Y:Z" )) != EOF ) diff --git a/clients/tools/ldapsearch.c b/clients/tools/ldapsearch.c index 471e20a07a..0b3393e3c6 100644 --- a/clients/tools/ldapsearch.c +++ b/clients/tools/ldapsearch.c @@ -194,6 +194,8 @@ main( int argc, char **argv ) debug = verbose = not = vals2tmp = referrals = valuesReturnFilter = attrsonly = manageDSAit = ldif = want_bindpw = 0; + prog = lutil_progname( "ldapsearch", argc, argv ); + lutil_log_initialize(argc, argv); deref = sizelimit = timelimit = version = -1; @@ -223,8 +225,6 @@ main( int argc, char **argv ) urlize( def_urlpre ); - prog = (prog = strrchr(argv[0], *LDAP_DIRSEP)) == NULL ? argv[0] : prog + 1; - while (( i = getopt( argc, argv, "Aa:b:E:F:f:Ll:S:s:T:tuz:" "Cd:D:h:H:IkKMnO:p:P:QR:U:vw:WxX:Y:Z")) != EOF ) { diff --git a/clients/tools/ldapwhoami.c b/clients/tools/ldapwhoami.c index d69e35faa4..58d926fb34 100644 --- a/clients/tools/ldapwhoami.c +++ b/clients/tools/ldapwhoami.c @@ -18,7 +18,7 @@ #include #include - +#include "lutil.h" #include "lutil_ldap.h" #include "ldap_defaults.h" @@ -100,7 +100,7 @@ main( int argc, char *argv[] ) char *retoid = NULL; struct berval *retdata = NULL; - prog = (prog = strrchr(argv[0], *LDAP_DIRSEP)) == NULL ? argv[0] : prog + 1; + prog = lutil_progname( "ldapwhoami", argc, argv ); while( (i = getopt( argc, argv, "Aa:Ss:" "Cd:D:h:H:InO:p:QR:U:vw:WxX:Y:Z" )) != EOF ) -- 2.39.5