From: Ben Collins Date: Fri, 15 Sep 2000 02:48:10 +0000 (+0000) Subject: Fix fprintf\'s, missing `prog\' argument X-Git-Tag: LDBM_PRE_GIANT_RWLOCK~1998 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=bca61801a1251c90ca7399ea9f95bcc0c6ba9be2;p=openldap Fix fprintf\'s, missing `prog\' argument --- diff --git a/clients/tools/ldapdelete.c b/clients/tools/ldapdelete.c index 7be56175c1..0c8673723c 100644 --- a/clients/tools/ldapdelete.c +++ b/clients/tools/ldapdelete.c @@ -112,7 +112,7 @@ main( int argc, char **argv ) break; case 'f': /* read DNs from a file */ if( fp != NULL ) { - fprintf( stderr, "%s: -f previously specified\n" ); + fprintf( stderr, "%s: -f previously specified\n", prog ); return EXIT_FAILURE; } if (( fp = fopen( optarg, "r" )) == NULL ) { @@ -133,33 +133,33 @@ main( int argc, char **argv ) break; case 'D': /* bind DN */ if( binddn != NULL ) { - fprintf( stderr, "%s: -D previously specified\n" ); + fprintf( stderr, "%s: -D previously specified\n", prog ); return EXIT_FAILURE; } binddn = strdup( optarg ); break; case 'h': /* ldap host */ if( ldapuri != NULL ) { - fprintf( stderr, "%s: -h incompatible with -H\n" ); + fprintf( stderr, "%s: -h incompatible with -H\n", prog ); return EXIT_FAILURE; } if( ldaphost != NULL ) { - fprintf( stderr, "%s: -h previously specified\n" ); + fprintf( stderr, "%s: -h previously specified\n", prog ); return EXIT_FAILURE; } ldaphost = strdup( optarg ); break; case 'H': /* ldap URI */ if( ldaphost != NULL ) { - fprintf( stderr, "%s: -H incompatible with -h\n" ); + fprintf( stderr, "%s: -H incompatible with -h\n", prog ); return EXIT_FAILURE; } if( ldapport ) { - fprintf( stderr, "%s: -H incompatible with -p\n" ); + fprintf( stderr, "%s: -H incompatible with -p\n", prog ); return EXIT_FAILURE; } if( ldapuri != NULL ) { - fprintf( stderr, "%s: -H previously specified\n" ); + fprintf( stderr, "%s: -H previously specified\n", prog ); return EXIT_FAILURE; } ldapuri = strdup( optarg ); @@ -241,7 +241,7 @@ main( int argc, char **argv ) case 'O': #ifdef HAVE_CYRUS_SASL if( sasl_secprops != NULL ) { - fprintf( stderr, "%s: -O previously specified\n" ); + fprintf( stderr, "%s: -O previously specified\n", prog ); return EXIT_FAILURE; } if( version == LDAP_VERSION2 ) { @@ -265,7 +265,7 @@ main( int argc, char **argv ) break; case 'p': if( ldapport ) { - fprintf( stderr, "%s: -p previously specified\n" ); + fprintf( stderr, "%s: -p previously specified\n", prog ); return EXIT_FAILURE; } ldapport = atoi( optarg ); @@ -319,7 +319,7 @@ main( int argc, char **argv ) case 'R': #ifdef HAVE_CYRUS_SASL if( sasl_realm != NULL ) { - fprintf( stderr, "%s: -R previously specified\n" ); + fprintf( stderr, "%s: -R previously specified\n", prog ); return EXIT_FAILURE; } if( version == LDAP_VERSION2 ) { @@ -345,7 +345,7 @@ main( int argc, char **argv ) case 'U': #ifdef HAVE_CYRUS_SASL if( sasl_authc_id != NULL ) { - fprintf( stderr, "%s: -U previously specified\n" ); + fprintf( stderr, "%s: -U previously specified\n", prog ); return EXIT_FAILURE; } if( version == LDAP_VERSION2 ) { @@ -388,7 +388,7 @@ main( int argc, char **argv ) case 'Y': #ifdef HAVE_CYRUS_SASL if( sasl_mech != NULL ) { - fprintf( stderr, "%s: -Y previously specified\n" ); + fprintf( stderr, "%s: -Y previously specified\n", prog ); return EXIT_FAILURE; } if( version == LDAP_VERSION2 ) { @@ -420,7 +420,7 @@ main( int argc, char **argv ) case 'X': #ifdef HAVE_CYRUS_SASL if( sasl_authz_id != NULL ) { - fprintf( stderr, "%s: -X previously specified\n" ); + fprintf( stderr, "%s: -X previously specified\n", prog ); return EXIT_FAILURE; } if( version == LDAP_VERSION2 ) { diff --git a/clients/tools/ldapmodify.c b/clients/tools/ldapmodify.c index ab484c7bfd..e1629c55f0 100644 --- a/clients/tools/ldapmodify.c +++ b/clients/tools/ldapmodify.c @@ -172,7 +172,7 @@ main( int argc, char **argv ) break; case 'f': /* read from file */ if( infile != NULL ) { - fprintf( stderr, "%s: -f previously specified\n" ); + fprintf( stderr, "%s: -f previously specified\n", prog ); return EXIT_FAILURE; } infile = strdup( optarg ); @@ -193,33 +193,33 @@ main( int argc, char **argv ) break; case 'D': /* bind DN */ if( binddn != NULL ) { - fprintf( stderr, "%s: -D previously specified\n" ); + fprintf( stderr, "%s: -D previously specified\n", prog ); return EXIT_FAILURE; } binddn = strdup( optarg ); break; case 'h': /* ldap host */ if( ldapuri != NULL ) { - fprintf( stderr, "%s: -h incompatible with -H\n" ); + fprintf( stderr, "%s: -h incompatible with -H\n", prog ); return EXIT_FAILURE; } if( ldaphost != NULL ) { - fprintf( stderr, "%s: -h previously specified\n" ); + fprintf( stderr, "%s: -h previously specified\n", prog ); return EXIT_FAILURE; } ldaphost = strdup( optarg ); break; case 'H': /* ldap URI */ if( ldaphost != NULL ) { - fprintf( stderr, "%s: -H incompatible with -h\n" ); + fprintf( stderr, "%s: -H incompatible with -h\n", prog ); return EXIT_FAILURE; } if( ldapport ) { - fprintf( stderr, "%s: -H incompatible with -p\n" ); + fprintf( stderr, "%s: -H incompatible with -p\n", prog ); return EXIT_FAILURE; } if( ldapuri != NULL ) { - fprintf( stderr, "%s: -H previously specified\n" ); + fprintf( stderr, "%s: -H previously specified\n", prog ); return EXIT_FAILURE; } ldapuri = strdup( optarg ); @@ -301,7 +301,7 @@ main( int argc, char **argv ) case 'O': #ifdef HAVE_CYRUS_SASL if( sasl_secprops != NULL ) { - fprintf( stderr, "%s: -O previously specified\n" ); + fprintf( stderr, "%s: -O previously specified\n", prog ); return EXIT_FAILURE; } if( version == LDAP_VERSION2 ) { @@ -325,7 +325,7 @@ main( int argc, char **argv ) break; case 'p': if( ldapport ) { - fprintf( stderr, "%s: -p previously specified\n" ); + fprintf( stderr, "%s: -p previously specified\n", prog ); return EXIT_FAILURE; } ldapport = atoi( optarg ); @@ -379,7 +379,7 @@ main( int argc, char **argv ) case 'R': #ifdef HAVE_CYRUS_SASL if( sasl_realm != NULL ) { - fprintf( stderr, "%s: -R previously specified\n" ); + fprintf( stderr, "%s: -R previously specified\n", prog ); return EXIT_FAILURE; } if( version == LDAP_VERSION2 ) { @@ -405,7 +405,7 @@ main( int argc, char **argv ) case 'U': #ifdef HAVE_CYRUS_SASL if( sasl_authc_id != NULL ) { - fprintf( stderr, "%s: -U previously specified\n" ); + fprintf( stderr, "%s: -U previously specified\n", prog ); return EXIT_FAILURE; } if( version == LDAP_VERSION2 ) { @@ -448,7 +448,7 @@ main( int argc, char **argv ) case 'Y': #ifdef HAVE_CYRUS_SASL if( sasl_mech != NULL ) { - fprintf( stderr, "%s: -Y previously specified\n" ); + fprintf( stderr, "%s: -Y previously specified\n", prog ); return EXIT_FAILURE; } if( version == LDAP_VERSION2 ) { @@ -480,7 +480,7 @@ main( int argc, char **argv ) case 'X': #ifdef HAVE_CYRUS_SASL if( sasl_authz_id != NULL ) { - fprintf( stderr, "%s: -X previously specified\n" ); + fprintf( stderr, "%s: -X previously specified\n", prog ); return EXIT_FAILURE; } if( version == LDAP_VERSION2 ) { diff --git a/clients/tools/ldapmodrdn.c b/clients/tools/ldapmodrdn.c index 16da3786c0..a90a3d3e18 100644 --- a/clients/tools/ldapmodrdn.c +++ b/clients/tools/ldapmodrdn.c @@ -128,7 +128,7 @@ main(int argc, char **argv) break; case 'f': /* read from file */ if( infile != NULL ) { - fprintf( stderr, "%s: -f previously specified\n" ); + fprintf( stderr, "%s: -f previously specified\n", prog ); return EXIT_FAILURE; } infile = strdup( optarg ); @@ -155,33 +155,33 @@ main(int argc, char **argv) break; case 'D': /* bind DN */ if( binddn != NULL ) { - fprintf( stderr, "%s: -D previously specified\n" ); + fprintf( stderr, "%s: -D previously specified\n", prog ); return EXIT_FAILURE; } binddn = strdup( optarg ); break; case 'h': /* ldap host */ if( ldapuri != NULL ) { - fprintf( stderr, "%s: -h incompatible with -H\n" ); + fprintf( stderr, "%s: -h incompatible with -H\n", prog ); return EXIT_FAILURE; } if( ldaphost != NULL ) { - fprintf( stderr, "%s: -h previously specified\n" ); + fprintf( stderr, "%s: -h previously specified\n", prog ); return EXIT_FAILURE; } ldaphost = strdup( optarg ); break; case 'H': /* ldap URI */ if( ldaphost != NULL ) { - fprintf( stderr, "%s: -H incompatible with -h\n" ); + fprintf( stderr, "%s: -H incompatible with -h\n", prog ); return EXIT_FAILURE; } if( ldapport ) { - fprintf( stderr, "%s: -H incompatible with -p\n" ); + fprintf( stderr, "%s: -H incompatible with -p\n", prog ); return EXIT_FAILURE; } if( ldapuri != NULL ) { - fprintf( stderr, "%s: -H previously specified\n" ); + fprintf( stderr, "%s: -H previously specified\n", prog ); return EXIT_FAILURE; } ldapuri = strdup( optarg ); @@ -263,7 +263,7 @@ main(int argc, char **argv) case 'O': #ifdef HAVE_CYRUS_SASL if( sasl_secprops != NULL ) { - fprintf( stderr, "%s: -O previously specified\n" ); + fprintf( stderr, "%s: -O previously specified\n", prog ); return EXIT_FAILURE; } if( version == LDAP_VERSION2 ) { @@ -287,7 +287,7 @@ main(int argc, char **argv) break; case 'p': if( ldapport ) { - fprintf( stderr, "%s: -p previously specified\n" ); + fprintf( stderr, "%s: -p previously specified\n", prog ); return EXIT_FAILURE; } ldapport = atoi( optarg ); @@ -341,7 +341,7 @@ main(int argc, char **argv) case 'R': #ifdef HAVE_CYRUS_SASL if( sasl_realm != NULL ) { - fprintf( stderr, "%s: -R previously specified\n" ); + fprintf( stderr, "%s: -R previously specified\n", prog ); return EXIT_FAILURE; } if( version == LDAP_VERSION2 ) { @@ -367,7 +367,7 @@ main(int argc, char **argv) case 'U': #ifdef HAVE_CYRUS_SASL if( sasl_authc_id != NULL ) { - fprintf( stderr, "%s: -U previously specified\n" ); + fprintf( stderr, "%s: -U previously specified\n", prog ); return EXIT_FAILURE; } if( version == LDAP_VERSION2 ) { @@ -410,7 +410,7 @@ main(int argc, char **argv) case 'Y': #ifdef HAVE_CYRUS_SASL if( sasl_mech != NULL ) { - fprintf( stderr, "%s: -Y previously specified\n" ); + fprintf( stderr, "%s: -Y previously specified\n", prog ); return EXIT_FAILURE; } if( version == LDAP_VERSION2 ) { @@ -442,7 +442,7 @@ main(int argc, char **argv) case 'X': #ifdef HAVE_CYRUS_SASL if( sasl_authz_id != NULL ) { - fprintf( stderr, "%s: -X previously specified\n" ); + fprintf( stderr, "%s: -X previously specified\n", prog ); return EXIT_FAILURE; } if( version == LDAP_VERSION2 ) { diff --git a/clients/tools/ldappasswd.c b/clients/tools/ldappasswd.c index cf49fa678a..365db634e8 100644 --- a/clients/tools/ldappasswd.c +++ b/clients/tools/ldappasswd.c @@ -154,33 +154,33 @@ main( int argc, char *argv[] ) break; case 'D': /* bind DN */ if( binddn != NULL ) { - fprintf( stderr, "%s: -D previously specified\n" ); + fprintf( stderr, "%s: -D previously specified\n", prog ); return EXIT_FAILURE; } binddn = strdup( optarg ); break; case 'h': /* ldap host */ if( ldapuri != NULL ) { - fprintf( stderr, "%s: -h incompatible with -H\n" ); + fprintf( stderr, "%s: -h incompatible with -H\n", prog ); return EXIT_FAILURE; } if( ldaphost != NULL ) { - fprintf( stderr, "%s: -h previously specified\n" ); + fprintf( stderr, "%s: -h previously specified\n", prog ); return EXIT_FAILURE; } ldaphost = strdup( optarg ); break; case 'H': /* ldap URI */ if( ldaphost != NULL ) { - fprintf( stderr, "%s: -H incompatible with -h\n" ); + fprintf( stderr, "%s: -H incompatible with -h\n", prog ); return EXIT_FAILURE; } if( ldapport ) { - fprintf( stderr, "%s: -H incompatible with -p\n" ); + fprintf( stderr, "%s: -H incompatible with -p\n", prog ); return EXIT_FAILURE; } if( ldapuri != NULL ) { - fprintf( stderr, "%s: -H previously specified\n" ); + fprintf( stderr, "%s: -H previously specified\n", prog ); return EXIT_FAILURE; } ldapuri = strdup( optarg ); @@ -262,7 +262,7 @@ main( int argc, char *argv[] ) case 'O': #ifdef HAVE_CYRUS_SASL if( sasl_secprops != NULL ) { - fprintf( stderr, "%s: -O previously specified\n" ); + fprintf( stderr, "%s: -O previously specified\n", prog ); return EXIT_FAILURE; } if( version == LDAP_VERSION2 ) { @@ -286,7 +286,7 @@ main( int argc, char *argv[] ) break; case 'p': if( ldapport ) { - fprintf( stderr, "%s: -p previously specified\n" ); + fprintf( stderr, "%s: -p previously specified\n", prog ); return EXIT_FAILURE; } ldapport = atoi( optarg ); @@ -340,7 +340,7 @@ main( int argc, char *argv[] ) case 'R': #ifdef HAVE_CYRUS_SASL if( sasl_realm != NULL ) { - fprintf( stderr, "%s: -R previously specified\n" ); + fprintf( stderr, "%s: -R previously specified\n", prog ); return EXIT_FAILURE; } if( version == LDAP_VERSION2 ) { @@ -366,7 +366,7 @@ main( int argc, char *argv[] ) case 'U': #ifdef HAVE_CYRUS_SASL if( sasl_authc_id != NULL ) { - fprintf( stderr, "%s: -U previously specified\n" ); + fprintf( stderr, "%s: -U previously specified\n", prog ); return EXIT_FAILURE; } if( version == LDAP_VERSION2 ) { @@ -409,7 +409,7 @@ main( int argc, char *argv[] ) case 'Y': #ifdef HAVE_CYRUS_SASL if( sasl_mech != NULL ) { - fprintf( stderr, "%s: -Y previously specified\n" ); + fprintf( stderr, "%s: -Y previously specified\n", prog ); return EXIT_FAILURE; } if( version == LDAP_VERSION2 ) { @@ -441,7 +441,7 @@ main( int argc, char *argv[] ) case 'X': #ifdef HAVE_CYRUS_SASL if( sasl_authz_id != NULL ) { - fprintf( stderr, "%s: -X previously specified\n" ); + fprintf( stderr, "%s: -X previously specified\n", prog ); return EXIT_FAILURE; } if( version == LDAP_VERSION2 ) { diff --git a/clients/tools/ldapsearch.c b/clients/tools/ldapsearch.c index 0cbe940464..b07fedbc95 100644 --- a/clients/tools/ldapsearch.c +++ b/clients/tools/ldapsearch.c @@ -163,7 +163,7 @@ static int verbose, not, includeufn, vals2tmp, ldif; int main( int argc, char **argv ) { - char *infile, *filtpattern, **attrs, line[BUFSIZ]; + char *infile, *filtpattern, **attrs = NULL, line[BUFSIZ]; FILE *fp = NULL; int rc, i, first, scope, deref, attrsonly, manageDSAit; int referrals, timelimit, sizelimit, debug; @@ -208,7 +208,7 @@ main( int argc, char **argv ) break; case 'f': /* input file */ if( infile != NULL ) { - fprintf( stderr, "%s: -f previously specified\n" ); + fprintf( stderr, "%s: -f previously specified\n", prog ); return EXIT_FAILURE; } infile = strdup( optarg ); @@ -261,33 +261,33 @@ main( int argc, char **argv ) break; case 'D': /* bind DN */ if( binddn != NULL ) { - fprintf( stderr, "%s: -D previously specified\n" ); + fprintf( stderr, "%s: -D previously specified\n", prog ); return EXIT_FAILURE; } binddn = strdup( optarg ); break; case 'h': /* ldap host */ if( ldapuri != NULL ) { - fprintf( stderr, "%s: -h incompatible with -H\n" ); + fprintf( stderr, "%s: -h incompatible with -H\n", prog ); return EXIT_FAILURE; } if( ldaphost != NULL ) { - fprintf( stderr, "%s: -h previously specified\n" ); + fprintf( stderr, "%s: -h previously specified\n", prog ); return EXIT_FAILURE; } ldaphost = strdup( optarg ); break; case 'H': /* ldap URI */ if( ldaphost != NULL ) { - fprintf( stderr, "%s: -H incompatible with -h\n" ); + fprintf( stderr, "%s: -H incompatible with -h\n", prog ); return EXIT_FAILURE; } if( ldapport ) { - fprintf( stderr, "%s: -H incompatible with -p\n" ); + fprintf( stderr, "%s: -H incompatible with -p\n", prog ); return EXIT_FAILURE; } if( ldapuri != NULL ) { - fprintf( stderr, "%s: -H previously specified\n" ); + fprintf( stderr, "%s: -H previously specified\n", prog ); return EXIT_FAILURE; } ldapuri = strdup( optarg ); @@ -369,7 +369,7 @@ main( int argc, char **argv ) case 'O': #ifdef HAVE_CYRUS_SASL if( sasl_secprops != NULL ) { - fprintf( stderr, "%s: -O previously specified\n" ); + fprintf( stderr, "%s: -O previously specified\n", prog ); return EXIT_FAILURE; } if( version == LDAP_VERSION2 ) { @@ -393,7 +393,7 @@ main( int argc, char **argv ) break; case 'p': if( ldapport ) { - fprintf( stderr, "%s: -p previously specified\n" ); + fprintf( stderr, "%s: -p previously specified\n", prog ); return EXIT_FAILURE; } ldapport = atoi( optarg ); @@ -447,7 +447,7 @@ main( int argc, char **argv ) case 'R': #ifdef HAVE_CYRUS_SASL if( sasl_realm != NULL ) { - fprintf( stderr, "%s: -R previously specified\n" ); + fprintf( stderr, "%s: -R previously specified\n", prog ); return EXIT_FAILURE; } if( version == LDAP_VERSION2 ) { @@ -473,7 +473,7 @@ main( int argc, char **argv ) case 'U': #ifdef HAVE_CYRUS_SASL if( sasl_authc_id != NULL ) { - fprintf( stderr, "%s: -U previously specified\n" ); + fprintf( stderr, "%s: -U previously specified\n", prog ); return EXIT_FAILURE; } if( version == LDAP_VERSION2 ) { @@ -516,7 +516,7 @@ main( int argc, char **argv ) case 'Y': #ifdef HAVE_CYRUS_SASL if( sasl_mech != NULL ) { - fprintf( stderr, "%s: -Y previously specified\n" ); + fprintf( stderr, "%s: -Y previously specified\n", prog ); return EXIT_FAILURE; } if( version == LDAP_VERSION2 ) { @@ -548,7 +548,7 @@ main( int argc, char **argv ) case 'X': #ifdef HAVE_CYRUS_SASL if( sasl_authz_id != NULL ) { - fprintf( stderr, "%s: -X previously specified\n" ); + fprintf( stderr, "%s: -X previously specified\n", prog ); return EXIT_FAILURE; } if( version == LDAP_VERSION2 ) { @@ -612,9 +612,7 @@ main( int argc, char **argv ) filtpattern = strdup( argv[optind++] ); } - if ( argv[optind] == NULL ) { - attrs = NULL; - } else if ( sortattr == NULL || *sortattr == '\0' ) { + if ( (argv[optind] != NULL) && (sortattr == NULL || *sortattr == '\0') ) { attrs = &argv[optind]; } @@ -891,7 +889,7 @@ static int dosearch( int sizelimit ) { char filter[ BUFSIZ ]; - int rc, first; + int rc; int nresponses; int nentries; int nreferences; @@ -1218,7 +1216,6 @@ static int print_result( LDAP *ld, LDAPMessage *result, int search ) { - char rst[BUFSIZ]; int rc; int err; char *matcheddn = NULL;