From: Kurt Zeilenga Date: Mon, 16 Nov 1998 05:07:27 +0000 (+0000) Subject: Remove extern declarations of library functions from source.c. X-Git-Tag: OPENLDAP_SLAPD_BACK_LDAP~1111 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=b5494457d86d7b57b8de5fccda725e143c8e30bd;p=openldap Remove extern declarations of library functions from source.c. This could cause problems on odd systems. The generic headers should be extended as needed to include necessary system headers or, if necessary, make explicit declarations. Extended ac/string.h header to look for string.h/strings.h if STDC_HEADERS is not defined. Also provide basic declarations for str*() functions. This could cause problems on odd systems. Extended ac/unistd.h header to define basic declaration for misc functions that might be missing from headers. This includes externs for getenv(), getopt(), mktemp(), tempname(). Protect fax500.h from multiple inclusion. Moved includes of system/generic headers back to source files. Made mail500 helper functions static. Fixed includes of ctype.h, signal.h, etc. to use generics. lutil/tempname.c: was including stdlib.h twice, one should stdio.h. Wrapped with HAVE_SYS_RESOURCE_H. lber/io.c/ber_get_next(): Changed noctets back to signed. Used with BerRead which expects signed int as second arg and returns signed int. --- diff --git a/clients/fax500/fax500.h b/clients/fax500/fax500.h index 41d08495ec..74c8809678 100644 --- a/clients/fax500/fax500.h +++ b/clients/fax500/fax500.h @@ -1,10 +1,10 @@ -#include -#include -#include -extern char *strdup (const char *); +#ifndef FAX500_H +#define FAX500_H 1 /* in faxtotpc.c */ void strip_nonnum ( char *str ); char *remove_parens( char *ibuf, char *obuf ); char *munge_phone ( char *ibuf, char *obuf ); char *faxtotpc ( char *phone, char *userinfo ); + +#endif diff --git a/clients/fax500/faxtotpc.c b/clients/fax500/faxtotpc.c index 73cadf2f16..b5b677b5a0 100644 --- a/clients/fax500/faxtotpc.c +++ b/clients/fax500/faxtotpc.c @@ -19,9 +19,15 @@ */ #include "portable.h" -#include "fax500.h" + +#include #include +#include +#include + +#include "fax500.h" + #define TPCDOMAIN "tpc.int" /* diff --git a/clients/fax500/main.c b/clients/fax500/main.c index bc6d6a869e..cf5fb5e7fd 100644 --- a/clients/fax500/main.c +++ b/clients/fax500/main.c @@ -11,29 +11,32 @@ */ #include "portable.h" -#include "fax500.h" +#include #include #include +#include #include #include #include #include #include -extern int optind, errno; -extern char *optarg; #ifdef HAVE_SYS_PARAM_H #include #endif - +#ifdef HAVE_SYS_RESOURCE_H #include +#endif + #include #include "lber.h" #include "ldap.h" +#include "fax500.h" + #include #define USER 0 diff --git a/clients/fax500/rp500.c b/clients/fax500/rp500.c index eb54335dc4..6d5d955e06 100644 --- a/clients/fax500/rp500.c +++ b/clients/fax500/rp500.c @@ -11,21 +11,26 @@ */ #include "portable.h" -#include "fax500.h" #include -#include +#include #include +#include #include #include +#include #include +#ifdef HAVE_SYS_RESOURCE_H #include +#endif #include #include +#include "fax500.h" + #include #define DEFAULT_PORT 79 @@ -61,8 +66,6 @@ main( int argc, char **argv ) static char *attrs[] = { "title", "o", "ou", "postalAddress", "telephoneNumber", "mail", "facsimileTelephoneNumber", NULL }; - extern char *optarg; - extern int optind; while ( (i = getopt( argc, argv, "ab:d:f:x:z:" )) != EOF ) { switch( i ) { diff --git a/clients/finger/main.c b/clients/finger/main.c index a617ae9b56..0a53a63efb 100644 --- a/clients/finger/main.c +++ b/clients/finger/main.c @@ -14,19 +14,19 @@ #include #include -#include -#include +#include +#include #include #include #include #include #include #include -extern char *strdup (const char *); -extern int strcasecmp(const char *, const char *); +#ifdef HAVE_SYS_RESOURCE_H #include +#endif #include "lber.h" #include "ldap.h" @@ -66,7 +66,6 @@ main( int argc, char **argv ) struct sockaddr_in peername; int peernamelen; int interactive = 0; - extern char *optarg; deref = FINGER_DEREF; while ( (i = getopt( argc, argv, "f:ilp:t:x:p:c:" )) != EOF ) { diff --git a/clients/gopher/go500.c b/clients/gopher/go500.c index 3f21c9cbbc..de0059380a 100644 --- a/clients/gopher/go500.c +++ b/clients/gopher/go500.c @@ -23,9 +23,6 @@ #include #include #include -extern char *strdup (const char *); -extern int strcasecmp(const char *, const char *); -extern int gethostname (char *, int); #include @@ -33,7 +30,9 @@ extern int gethostname (char *, int); #include #endif +#ifdef HAVE_SYS_RESOURCE_H #include +#endif #include "ldapconfig.h" #include "lber.h" @@ -83,7 +82,6 @@ main( int argc, char **argv ) struct hostent *hp; struct sockaddr_in from; int fromlen; - extern char *optarg; #if defined( LDAP_PROCTITLE ) && !defined( HAVE_SETPROCTITLE ) /* for setproctitle */ @@ -559,7 +557,7 @@ do_search( LDAP *ld, FILE *fp, char *buf ) static int entry2textwrite( void *fp, char *buf, int len ) { - return( fwrite( buf, len, 1, (FILE *)fp ) == 0 ? -1 : len ); + return( fwrite( buf, len, 1, (FILE *)fp ) == 0 ? -1 : len ); } static void diff --git a/clients/gopher/go500gw.c b/clients/gopher/go500gw.c index 5e903beb65..ce37e796ec 100644 --- a/clients/gopher/go500gw.c +++ b/clients/gopher/go500gw.c @@ -23,16 +23,18 @@ #include #include #include -extern int strcasecmp(const char *, const char *); #include -#include - #ifdef HAVE_SYS_PARAM_H #include #endif +#ifdef HAVE_SYS_RESOURCE_H +#include +#endif + + #include "lber.h" #include "ldap.h" #include "ldap_log.h" @@ -94,7 +96,6 @@ main (int argc, char **argv ) struct hostent *hp; struct sockaddr_in from; int fromlen; - extern char *optarg; #if defined( LDAP_PROCTITLE ) && !defined( HAVE_SETPROCTITLE ) /* for setproctitle */ diff --git a/clients/mail500/main.c b/clients/mail500/main.c index 4efa295f4c..7acc1d74d5 100644 --- a/clients/mail500/main.c +++ b/clients/mail500/main.c @@ -14,22 +14,21 @@ #include #include -#include +#include #include #include #include #include #include -extern char *strdup (const char *); -extern int optind, errno; -extern char *optarg; #ifdef HAVE_SYS_PARAM_H #include #endif +#ifdef HAVE_SYS_RESOURCE_H #include +#endif #include @@ -145,10 +144,10 @@ static char **get_attributes_mail_dn( LDAPMessage *e, char *attr1, char *attr2 ) static char *canonical( char *s ); static int connect_to_x500( void ); -void do_group_errors( LDAPMessage *e, char *dn, char ***to, int *nto, Error **err, int *nerr ); -void do_group_request( LDAPMessage *e, char *dn, char ***to, int *nto, Error **err, int *nerr ); -void do_group_owner( LDAPMessage *e, char *dn, char ***to, int *nto, Error **err, int *nerr ); -void add_member( char *gdn, char *dn, char ***to, int *nto, Group **togroups, int *ngroups, Error **err, int *nerr, char **suppress ); +static void do_group_errors( LDAPMessage *e, char *dn, char ***to, int *nto, Error **err, int *nerr ); +static void do_group_request( LDAPMessage *e, char *dn, char ***to, int *nto, Error **err, int *nerr ); +static void do_group_owner( LDAPMessage *e, char *dn, char ***to, int *nto, Error **err, int *nerr ); +static void add_member( char *gdn, char *dn, char ***to, int *nto, Group **togroups, int *ngroups, Error **err, int *nerr, char **suppress ); int main ( int argc, char **argv ) @@ -915,7 +914,7 @@ do_group_members( } } -void +static void add_member( char *gdn, char *dn, @@ -985,7 +984,7 @@ add_member( free( ndn ); } -void +static void do_group_request( LDAPMessage *e, char *dn, @@ -1007,7 +1006,7 @@ do_group_request( } } -void +static void do_group_errors( LDAPMessage *e, char *dn, @@ -1029,7 +1028,7 @@ do_group_errors( } } -void +static void do_group_owner( LDAPMessage *e, char *dn, diff --git a/clients/rcpt500/main.c b/clients/rcpt500/main.c index 4a1b637a41..346c5fc10d 100644 --- a/clients/rcpt500/main.c +++ b/clients/rcpt500/main.c @@ -14,8 +14,7 @@ #include #include #include -extern char *strdup (const char *); -extern char *strstr (const char *, const char *); +#include #include "ldapconfig.h" #include "rcpt500.h" @@ -57,9 +56,6 @@ main( int argc, char **argv ) int c, errflg; char *replytext; - extern int optind; - extern char *optarg; - *reply = '\0'; if (( prog = strrchr( argv[ 0 ], '/' )) == NULL ) { diff --git a/clients/rcpt500/query.c b/clients/rcpt500/query.c index f1dc4a25af..e70a224ec0 100644 --- a/clients/rcpt500/query.c +++ b/clients/rcpt500/query.c @@ -10,12 +10,11 @@ #include #include -#include +#include #include #include #include -extern int strcasecmp(const char *, const char *); #include "lber.h" #include "ldap.h" diff --git a/clients/tools/ldapdelete.c b/clients/tools/ldapdelete.c index 3a24aff5a3..6638fee629 100644 --- a/clients/tools/ldapdelete.c +++ b/clients/tools/ldapdelete.c @@ -8,7 +8,6 @@ #include #include -extern char *strdup (const char *); #include #include @@ -36,9 +35,6 @@ main( int argc, char **argv ) FILE *fp; int i, rc, kerberos, authmethod; - extern char *optarg; - extern int optind; - kerberos = not = verbose = contoper = 0; fp = NULL; diff --git a/clients/tools/ldapmodify.c b/clients/tools/ldapmodify.c index 821a8120d3..f30815a706 100644 --- a/clients/tools/ldapmodify.c +++ b/clients/tools/ldapmodify.c @@ -8,7 +8,6 @@ #include #include #include -extern char *strdup (const char *); #include @@ -72,9 +71,6 @@ main( int argc, char **argv ) int rc, i, kerberos, use_ldif, authmethod; char *usage = "usage: %s [-abcknrvF] [-d debug-level] [-h ldaphost] [-p ldapport] [-D binddn] [-w passwd] [ -f file | < entryfile ]\n"; - extern char *optarg; - extern int optind; - if (( prog = strrchr( argv[ 0 ], '/' )) == NULL ) { prog = argv[ 0 ]; } else { diff --git a/clients/tools/ldapmodrdn.c b/clients/tools/ldapmodrdn.c index 436d8c9978..4697b283cd 100644 --- a/clients/tools/ldapmodrdn.c +++ b/clients/tools/ldapmodrdn.c @@ -8,7 +8,6 @@ #include #include #include -extern char *strdup (const char *); #include #include @@ -38,9 +37,6 @@ main(int argc, char **argv) FILE *fp; int rc, i, kerberos, remove, havedn, authmethod; - extern char *optarg; - extern int optind; - infile = NULL; kerberos = not = contoper = verbose = remove = 0; diff --git a/clients/tools/ldapsearch.c b/clients/tools/ldapsearch.c index bc6f1f6d67..7ae964cd76 100644 --- a/clients/tools/ldapsearch.c +++ b/clients/tools/ldapsearch.c @@ -6,9 +6,6 @@ #include #include #include -extern char *strdup (const char *); -extern int strcasecmp(const char *, const char *); -extern char *mktemp(char *); #include #include @@ -91,8 +88,6 @@ main( int argc, char **argv ) int rc, i, first, scope, kerberos, deref, attrsonly; int referrals, timelimit, sizelimit, authmethod; LDAP *ld; - extern char *optarg; - extern int optind; infile = NULL; deref = verbose = allow_binary = not = kerberos = vals2tmp = diff --git a/clients/ud/auth.c b/clients/ud/auth.c index ccb44282e0..56891cebfd 100644 --- a/clients/ud/auth.c +++ b/clients/ud/auth.c @@ -20,7 +20,6 @@ #include #include #include -extern char *strdup (const char *); #ifdef HAVE_PWD_H #include diff --git a/clients/ud/edit.c b/clients/ud/edit.c index cce199024f..b34790ca92 100644 --- a/clients/ud/edit.c +++ b/clients/ud/edit.c @@ -21,8 +21,6 @@ #include #include #include -extern char *strdup (const char *); -extern char * mktemp(char *); #ifdef HAVE_SYS_RESOURCE_H #include diff --git a/clients/ud/find.c b/clients/ud/find.c index 3a8b72efde..ce4f1558b0 100644 --- a/clients/ud/find.c +++ b/clients/ud/find.c @@ -18,7 +18,6 @@ #include #include #include -extern char *strdup (const char *); #include #include diff --git a/clients/ud/group.c b/clients/ud/group.c index 5ce609bb96..e9c9c49cde 100644 --- a/clients/ud/group.c +++ b/clients/ud/group.c @@ -19,7 +19,6 @@ #include #include #include -extern char *strdup (const char *); #include #include diff --git a/clients/ud/main.c b/clients/ud/main.c index d1d61964e5..46fe1de720 100644 --- a/clients/ud/main.c +++ b/clients/ud/main.c @@ -21,8 +21,6 @@ #include #include #include -extern char *strdup (const char *); -extern char *getenv(const char *); #ifdef HAVE_PWD_H #include @@ -88,7 +86,6 @@ int debug; /* debug flag */ int main( int argc, char **argv ) { - extern char *optarg; /* for parsing argv */ register int c; /* for parsing argv */ register char *cp; /* for parsing Version */ diff --git a/clients/ud/print.c b/clients/ud/print.c index ce09772091..ba665222b1 100644 --- a/clients/ud/print.c +++ b/clients/ud/print.c @@ -17,7 +17,6 @@ #include #include #include -extern char *strdup (const char *); #include #include diff --git a/include/ac/string.h b/include/ac/string.h index 7283de2d8f..8df4116cff 100644 --- a/include/ac/string.h +++ b/include/ac/string.h @@ -31,6 +31,8 @@ int strcmp(), strncmp(); int strcasecmp(), strncasecmp(); char *strdup(); + char *strtok(); + char *strpbrk(); int memcmp(); # endif diff --git a/include/ac/unistd.h b/include/ac/unistd.h index 5e4501f589..a52b288417 100644 --- a/include/ac/unistd.h +++ b/include/ac/unistd.h @@ -9,16 +9,34 @@ #if HAVE_UNISTD_H # include +#else + /* we really should test for these */ + char *crypt(); + char *gethostname(); + char *getenv(); + long *random(); + int flock(); #endif /* getopt() defines may be in separate include file */ #if HAVE_GETOPT_H -# include +# include + +#elif !defined(HAVE_GETOPT) + /* no getopt, assume we need getopt-compat.h */ +# include + +#else + /* assume we need to declare these externs */ + extern char *optarg; + extern int optind, opterr, optopt; #endif -#ifndef HAVE_GETOPT -/* no getopt, assume we need getopt-compat.h */ -# include +#ifndef HAVE_TEMPNAM + extern char *tempnam(const char *tmpdir, const char *prefix); +#endif +#ifndef HAVE_MKTEMP + extern char *mktemp(char *); #endif /* use _POSIX_VERSION for POSIX.1 code */ diff --git a/include/lutil.h b/include/lutil.h index 3f3a09d392..be0fd47599 100644 --- a/include/lutil.h +++ b/include/lutil.h @@ -17,16 +17,6 @@ LDAP_F void lutil_detach LDAP_P((int debug, int do_close)); /* passwd.c */ LDAP_F int lutil_passwd LDAP_P((const char *cred, const char *passwd)); -/* strdup.c */ -#ifndef HAVE_STRDUP -char *strdup (); /* No prototype, might conflict with someone else''s */ -#endif - -/* tempnam.c */ -#ifndef HAVE_TEMPNAM -LDAP_F char *tempnam (); /* No prototype, might conflict with someone else''s */ -#endif - LDAP_END_DECL #endif /* _LUTIL_H */ diff --git a/libraries/libavl/testavl.c b/libraries/libavl/testavl.c index 56e3121ce2..b551c8ba69 100644 --- a/libraries/libavl/testavl.c +++ b/libraries/libavl/testavl.c @@ -7,7 +7,6 @@ #include #include -extern char *strdup (const char *); #include "avl.h" diff --git a/libraries/liblber/dtest.c b/libraries/liblber/dtest.c index 5776321321..d2f72154b4 100644 --- a/libraries/liblber/dtest.c +++ b/libraries/liblber/dtest.c @@ -18,6 +18,7 @@ #include #include +#include #ifdef HAVE_CONSOLE_H #include @@ -38,7 +39,6 @@ main( int argc, char **argv ) int tag; BerElement ber; Sockbuf sb; - extern char *optarg; #ifdef HAVE_CONSOLE_H ccommand( &argv ); diff --git a/libraries/liblber/etest.c b/libraries/liblber/etest.c index ae1321b568..ca1acc742b 100644 --- a/libraries/liblber/etest.c +++ b/libraries/liblber/etest.c @@ -10,6 +10,7 @@ #include #include +#include #ifdef HAVE_CONSOLE_H #include @@ -32,7 +33,6 @@ main( int argc, char **argv ) Seqorset *sos = NULLSEQORSET; BerElement *ber; Sockbuf sb; - extern char *optarg; if ( argc < 2 ) { usage( argv[0] ); diff --git a/libraries/liblber/io.c b/libraries/liblber/io.c index 0a6954996c..e1dfdda505 100644 --- a/libraries/liblber/io.c +++ b/libraries/liblber/io.c @@ -473,7 +473,8 @@ ber_get_next( Sockbuf *sb, unsigned long *len, BerElement *ber ) unsigned long tag = 0, netlen, toread; unsigned char lc; long rc; - unsigned int noctets, diff; + int noctets; + unsigned int diff; #ifdef LDAP_DEBUG if ( lber_debug ) diff --git a/libraries/libldap/disptmpl.c b/libraries/libldap/disptmpl.c index 426681eb96..54b493e7c7 100644 --- a/libraries/libldap/disptmpl.c +++ b/libraries/libldap/disptmpl.c @@ -22,7 +22,6 @@ #include #include #include -extern char *strdup (const char *); #ifdef HAVE_SYS_FILE_H #include diff --git a/libraries/libldap/dsparse.c b/libraries/libldap/dsparse.c index e0a40daa1d..394e61ec34 100644 --- a/libraries/libldap/dsparse.c +++ b/libraries/libldap/dsparse.c @@ -23,7 +23,6 @@ #include #include #include -extern char *strdup (const char *); #ifdef HAVE_SYS_FILE_H #include diff --git a/libraries/libldap/friendly.c b/libraries/libldap/friendly.c index a18a2456d2..12896aad83 100644 --- a/libraries/libldap/friendly.c +++ b/libraries/libldap/friendly.c @@ -19,7 +19,6 @@ static char copyright[] = "@(#) Copyright (c) 1993 Regents of the University of #include #include #include -extern char *strdup (const char *); #include "ldap-int.h" diff --git a/libraries/libldap/getdn.c b/libraries/libldap/getdn.c index 1abe7668d8..70c09c7933 100644 --- a/libraries/libldap/getdn.c +++ b/libraries/libldap/getdn.c @@ -18,8 +18,6 @@ static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of #include #include #include -extern char *strdup (const char *); -extern char *strtok (char *, const char *); #include "ldap-int.h" diff --git a/libraries/libldap/init.c b/libraries/libldap/init.c index 9836277748..049274d54a 100644 --- a/libraries/libldap/init.c +++ b/libraries/libldap/init.c @@ -7,7 +7,6 @@ #include #include #include -extern char *strdup (const char *); #include "ldap-int.h" #include "ldapconfig.h" diff --git a/libraries/libldap/options.c b/libraries/libldap/options.c index 5c5580cb27..182e7df67d 100644 --- a/libraries/libldap/options.c +++ b/libraries/libldap/options.c @@ -5,7 +5,6 @@ #include #include -extern char *strdup (const char *); #include "ldap-int.h" diff --git a/libraries/libldap/request.c b/libraries/libldap/request.c index 846d1989b1..f9b724ef8a 100644 --- a/libraries/libldap/request.c +++ b/libraries/libldap/request.c @@ -19,7 +19,6 @@ static char copyright[] = "@(#) Copyright (c) 1995 Regents of the University of #include #include #include -extern char *strdup (const char *); #include "ldap-int.h" @@ -213,8 +212,6 @@ ldap_send_server_request( LDAP *ld, BerElement *ber, int msgid, LDAPRequest if ( ber_flush( lc->lconn_sb, ber, 0 ) != 0 ) { #ifdef notyet - extern int errno; - if ( errno == EWOULDBLOCK ) { /* need to continue write later */ lr->lr_status = LDAP_REQST_WRITING; diff --git a/libraries/libldap/search.c b/libraries/libldap/search.c index 3ac8de7489..2a45f1ce6d 100644 --- a/libraries/libldap/search.c +++ b/libraries/libldap/search.c @@ -18,7 +18,6 @@ static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of #include #include #include -extern char *strdup (const char *); #include "ldap-int.h" diff --git a/libraries/libldap/test.c b/libraries/libldap/test.c index d37556a5cf..66e86efb85 100644 --- a/libraries/libldap/test.c +++ b/libraries/libldap/test.c @@ -8,7 +8,6 @@ #include #include #include -extern char *strdup (const char *); #include @@ -278,9 +277,6 @@ main( int argc, char **argv ) int copyoptions = 0; LDAPURLDesc *ludp; - extern char *optarg; - extern int optind; - host = NULL; port = LDAP_PORT; dnsuffix = ""; diff --git a/libraries/libldap/ufn.c b/libraries/libldap/ufn.c index 546481b2e4..6a2ef9ec83 100644 --- a/libraries/libldap/ufn.c +++ b/libraries/libldap/ufn.c @@ -18,7 +18,6 @@ static char copyright[] = "@(#) Copyright (c) 1993 Regents of the University of #include #include -extern char *strdup (const char *); #include "ldap-int.h" #include "ldapconfig.h" diff --git a/libraries/libldap/url.c b/libraries/libldap/url.c index 39826e117e..4de1a914e0 100644 --- a/libraries/libldap/url.c +++ b/libraries/libldap/url.c @@ -30,7 +30,6 @@ static char copyright[] = "@(#) Copyright (c) 1996 Regents of the University of #include #include #include -extern char *strdup (const char *); #include "ldap-int.h" diff --git a/libraries/liblutil/passwd.c b/libraries/liblutil/passwd.c index 3abbc3041b..89b45b92c3 100644 --- a/libraries/liblutil/passwd.c +++ b/libraries/liblutil/passwd.c @@ -16,7 +16,6 @@ #include "lutil_md5.h" #include "lutil_sha1.h" #include "lutil.h" -extern char *crypt (const char *, const char *); /* */ diff --git a/libraries/liblutil/tempnam.c b/libraries/liblutil/tempnam.c index cdd5385a2e..d4aa9cc239 100644 --- a/libraries/liblutil/tempnam.c +++ b/libraries/liblutil/tempnam.c @@ -2,15 +2,15 @@ #ifndef HAVE_TEMPNAM -#include +#include #include #include -extern char *mktemp (char *); +#include #include "lutil.h" char * -tempnam( char *dir, char *pfx ) +tempnam( const char *dir, const char *pfx ) { char *s; @@ -41,4 +41,4 @@ tempnam( char *dir, char *pfx ) return( s ); } -#endif /* nextstep */ +#endif /* TEMPNAM */ diff --git a/servers/ldapd/association.c b/servers/ldapd/association.c index a1c77ac14a..3ca61c9e47 100644 --- a/servers/ldapd/association.c +++ b/servers/ldapd/association.c @@ -18,7 +18,6 @@ #include #include #include -extern int errno; #include #include diff --git a/servers/ldapd/main.c b/servers/ldapd/main.c index f4e179a5ff..3542146091 100644 --- a/servers/ldapd/main.c +++ b/servers/ldapd/main.c @@ -117,8 +117,6 @@ main( int argc, char **argv ) #ifdef LDAP_PROCTITLE char title[80]; #endif - extern char *optarg; - extern int optind; #ifdef VMS /* Pick up socket from inetd-type server on VMS */ diff --git a/servers/slapd/attr.c b/servers/slapd/attr.c index 99cd92b2ca..51752ee9ac 100644 --- a/servers/slapd/attr.c +++ b/servers/slapd/attr.c @@ -9,6 +9,7 @@ #endif #include +#include #include #include #include @@ -21,8 +22,6 @@ #include "slap.h" -extern int errno; - void attr_free( Attribute *a ) { diff --git a/servers/slapd/back-ldbm/bind.c b/servers/slapd/back-ldbm/bind.c index dce574b95e..591e488c9c 100644 --- a/servers/slapd/back-ldbm/bind.c +++ b/servers/slapd/back-ldbm/bind.c @@ -8,7 +8,6 @@ #include #include #include -extern char *crypt (); #include "slap.h" #include "back-ldbm.h" diff --git a/servers/slapd/lock.c b/servers/slapd/lock.c index 8d5d7f2ec5..f634b220aa 100644 --- a/servers/slapd/lock.c +++ b/servers/slapd/lock.c @@ -8,7 +8,6 @@ #include #include #include -extern int flock (); #include #include diff --git a/servers/slapd/main.c b/servers/slapd/main.c index 733fb10e7f..3c6ddb62a3 100644 --- a/servers/slapd/main.c +++ b/servers/slapd/main.c @@ -68,7 +68,6 @@ main( int argc, char **argv ) char *myname; Backend *be = NULL; FILE *fp = NULL; - extern char *optarg; configfile = SLAPD_DEFAULT_CONFIGFILE; port = LDAP_PORT; diff --git a/servers/slapd/shell-backends/passwd-shell.c b/servers/slapd/shell-backends/passwd-shell.c index 1f035ca11e..89d2fd73d6 100644 --- a/servers/slapd/shell-backends/passwd-shell.c +++ b/servers/slapd/shell-backends/passwd-shell.c @@ -17,9 +17,11 @@ #include #include -#include #include +#include + +#include #include #include @@ -39,8 +41,6 @@ main( int argc, char **argv ) { int c, errflg; struct ldop op; - extern int optind; - extern char *optarg; if (( progname = strrchr( argv[ 0 ], '/' )) == NULL ) { progname = estrdup( argv[ 0 ] ); diff --git a/servers/slapd/shell-backends/shellutil.c b/servers/slapd/shell-backends/shellutil.c index 68266efd37..59d43cb707 100644 --- a/servers/slapd/shell-backends/shellutil.c +++ b/servers/slapd/shell-backends/shellutil.c @@ -18,18 +18,13 @@ #include -#ifdef STDC_HEADERS #include -#include -#else -#include -#endif +#include #include -#include #include -extern long int random (void); +#include #include #include diff --git a/servers/slapd/tools/centipede.c b/servers/slapd/tools/centipede.c index 1ce5765405..8792fb58ad 100644 --- a/servers/slapd/tools/centipede.c +++ b/servers/slapd/tools/centipede.c @@ -9,9 +9,6 @@ #include #include #include /* get link(), unlink() */ -extern char *strdup (const char *); -extern char *strtok (char *, const char *); -extern char *strpbrk (const char *, const char *); #include #include @@ -89,8 +86,6 @@ main( int argc, char **argv ) char buf[BUFSIZ]; int i, j, k, count; char *s; - extern int optind; - extern char *optarg; ldapsrcurl = NULL; ldapdesturl = NULL; diff --git a/servers/slapd/tools/edb2ldif.c b/servers/slapd/tools/edb2ldif.c index 5be7cba614..9aad796369 100644 --- a/servers/slapd/tools/edb2ldif.c +++ b/servers/slapd/tools/edb2ldif.c @@ -16,8 +16,10 @@ #include #include +#include #include #include +#include #include #include @@ -88,8 +90,6 @@ main( int argc, char **argv ) char *usage = "usage: %s [-d] [-o] [-r] [-v] [-b basedn] [-a addvalsfile] [-f fileattrdir] [-i ignoreattr...] [edbfile...]\n"; char edbfile[ MAXNAMLEN ], *basedn; int c, rc, errflg, ignore_count, recurse; - extern int optind; - extern char *optarg; extern char dsa_mode; #ifdef HAVE_FILE_ATTR_DIR extern char *file_attr_directory; @@ -856,10 +856,6 @@ free_edbmap( struct edbmap *edbmap ) static void print_err( char *msg ) { - extern int sys_nerr; - extern char *sys_errlist[]; - extern int errno; - #ifdef LDAP_DEBUG if ( debugflg ) { fprintf( stderr, "print_err( \"%s\" )\n", msg ); diff --git a/servers/slapd/tools/ldbmtest.c b/servers/slapd/tools/ldbmtest.c index beee4046cf..99fdee67c8 100644 --- a/servers/slapd/tools/ldbmtest.c +++ b/servers/slapd/tools/ldbmtest.c @@ -14,7 +14,6 @@ #include #include #include -extern int mkstemp (char *); #ifdef HAVE_FCNTL_H #include @@ -66,7 +65,6 @@ main( int argc, char **argv ) IDList *idl; Backend *tbe; int i; - extern char *optarg; #ifdef HAVE_BERKELEY_DB2 DBC *cursorp; diff --git a/servers/slapd/tools/ldif2id2children.c b/servers/slapd/tools/ldif2id2children.c index 7af679e068..4c802e1f44 100644 --- a/servers/slapd/tools/ldif2id2children.c +++ b/servers/slapd/tools/ldif2id2children.c @@ -4,6 +4,7 @@ #include #include +#include #include "ldapconfig.h" #include "../slap.h" @@ -61,7 +62,6 @@ main( int argc, char **argv ) struct berval bv; struct berval *vals[2]; Avlnode *avltypes = NULL; - extern char *optarg; tailorfile = SLAPD_DEFAULT_CONFIGFILE; dbnum = -1; diff --git a/servers/slapd/tools/ldif2id2entry.c b/servers/slapd/tools/ldif2id2entry.c index e043e6ce25..226d8232db 100644 --- a/servers/slapd/tools/ldif2id2entry.c +++ b/servers/slapd/tools/ldif2id2entry.c @@ -4,7 +4,7 @@ #include #include -extern int strcasecmp(const char *, const char *); +#include #include "ldapconfig.h" #include "../slap.h" @@ -59,7 +59,6 @@ main( int argc, char **argv ) struct berval *vals[2]; Avlnode *avltypes = NULL; FILE *fp; - extern char *optarg; tailorfile = SLAPD_DEFAULT_CONFIGFILE; dbnum = -1; diff --git a/servers/slapd/tools/ldif2index.c b/servers/slapd/tools/ldif2index.c index 6bcc3c9caa..1287f502d0 100644 --- a/servers/slapd/tools/ldif2index.c +++ b/servers/slapd/tools/ldif2index.c @@ -4,6 +4,7 @@ #include #include +#include #include "../slap.h" #include "../back-ldbm/back-ldbm.h" @@ -57,7 +58,6 @@ main( int argc, char **argv ) Backend *be = NULL; struct berval bv; struct berval *vals[2]; - extern char *optarg; inputfile = NULL; tailorfile = SLAPD_DEFAULT_CONFIGFILE; diff --git a/servers/slapd/tools/ldif2ldbm.c b/servers/slapd/tools/ldif2ldbm.c index 38f0dea765..53c8fa008c 100644 --- a/servers/slapd/tools/ldif2ldbm.c +++ b/servers/slapd/tools/ldif2ldbm.c @@ -73,7 +73,6 @@ main( int argc, char **argv ) struct berval bv; struct berval *vals[2]; Avlnode *avltypes = NULL; - extern char *optarg; sbindir = DEFAULT_SBINDIR; tailorfile = SLAPD_DEFAULT_CONFIGFILE; diff --git a/servers/slurpd/args.c b/servers/slurpd/args.c index 3a51d53c95..c3b202065c 100644 --- a/servers/slurpd/args.c +++ b/servers/slurpd/args.c @@ -21,6 +21,7 @@ #include #include +#include #include #include @@ -54,7 +55,6 @@ doargs( ) { int i; - extern char *optarg; int rflag = 0; if ( (g->myname = strrchr( argv[0], '/' )) == NULL ) { diff --git a/servers/slurpd/lock.c b/servers/slurpd/lock.c index 6fbd4bbf9c..692c9c3f88 100644 --- a/servers/slurpd/lock.c +++ b/servers/slurpd/lock.c @@ -22,12 +22,11 @@ #include #include #include -extern int flock (); #include #include -#include "slurp.h" /* Was ../slapd/slap.h */ +#include "slurp.h" FILE *