From 3fd4319828935eaaebd32cca675372c3dd1edf91 Mon Sep 17 00:00:00 2001 From: markm Date: Sun, 28 Apr 2002 11:59:43 +0000 Subject: [PATCH] ANSIfy functions, and move extern declarations into a shared header where ${DEITY} intended them to be. --- usr.bin/ranlib/build.c | 35 +++++++++++++----------------- usr.bin/ranlib/extern.h | 47 +++++++++++++++++++++++++++++++++++++++++ usr.bin/ranlib/misc.c | 16 ++++++++------ usr.bin/ranlib/ranlib.c | 18 ++++++++-------- usr.bin/ranlib/touch.c | 15 ++++++------- 5 files changed, 88 insertions(+), 43 deletions(-) create mode 100644 usr.bin/ranlib/extern.h diff --git a/usr.bin/ranlib/build.c b/usr.bin/ranlib/build.c index 88bebf7738b1..f9e3664f6f2a 100644 --- a/usr.bin/ranlib/build.c +++ b/usr.bin/ranlib/build.c @@ -38,13 +38,16 @@ #if 0 static char sccsid[] = "@(#)build.c 8.1 (Berkeley) 6/6/93"; #endif -static const char rcsid[] = - "$FreeBSD$"; #endif /* not lint */ +#include +__FBSDID("$FreeBSD$"); + #include #include +#include + #include #include #include @@ -56,15 +59,7 @@ static const char rcsid[] = #include #include "archive.h" - -extern int tmp( void ); -extern void error( char * ); -extern void badfmt( void ); -extern void settime( int ); - -extern CHDR chdr; /* converted header */ -extern char *archive; /* archive name */ -extern char *tname; /* temporary file "name" */ +#include "extern.h" typedef struct _rlib { struct _rlib *next; /* next structure */ @@ -82,6 +77,8 @@ long tsymlen; /* total string length */ static void rexec(int, int); static void symobj(void); +static char tname[] = "temporary file"; /* temporary file "name" */ + int build(void) { @@ -131,14 +128,12 @@ build(void) * exactly right. */ static void -rexec(rfd, wfd) - register int rfd; - int wfd; +rexec(int rfd, int wfd) { - register RLIB *rp; - register long nsyms; - register int nr, symlen; - register char *strtab = 0, *sym; + RLIB *rp; + long nsyms; + int nr, symlen; + char *strtab = 0, *sym; struct exec ebuf; struct nlist nl; off_t r_off, w_off; @@ -231,9 +226,9 @@ bad1: (void)lseek(rfd, r_off, SEEK_SET); * writing. */ static void -symobj() +symobj(void) { - register RLIB *rp, *rpnext; + RLIB *rp, *rpnext; struct ranlib rn; off_t ransize; long size, stroff; diff --git a/usr.bin/ranlib/extern.h b/usr.bin/ranlib/extern.h new file mode 100644 index 000000000000..6014f9011513 --- /dev/null +++ b/usr.bin/ranlib/extern.h @@ -0,0 +1,47 @@ +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Hugh Smith at The University of Guelph. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +extern int build(void); +extern int touch(void); +extern int tmp(void); +extern void error(char *); +extern void badfmt(void); +extern void settime(int); + +extern CHDR chdr; /* converted header */ +extern char *archive; /* archive name */ diff --git a/usr.bin/ranlib/misc.c b/usr.bin/ranlib/misc.c index b67def08823d..f98120de2325 100644 --- a/usr.bin/ranlib/misc.c +++ b/usr.bin/ranlib/misc.c @@ -38,12 +38,15 @@ #if 0 static char sccsid[] = "@(#)misc.c 8.1 (Berkeley) 6/6/93"; #endif -static const char rcsid[] = - "$FreeBSD$"; #endif /* not lint */ +#include +__FBSDID("$FreeBSD$"); + #include #include + +#include #include #include #include @@ -51,12 +54,14 @@ static const char rcsid[] = #include #include #include + +#include "archive.h" +#include "extern.h" #include "pathnames.h" extern char *archive; /* archive name */ -char *tname = "temporary file"; /* temporary file "name" */ -void error( char * ); +void error(char *); int tmp(void) @@ -87,8 +92,7 @@ badfmt(void) } void -error(name) - char *name; +error(char *name) { err(1, "%s", name); } diff --git a/usr.bin/ranlib/ranlib.c b/usr.bin/ranlib/ranlib.c index 290339bb18f0..933a23ad941a 100644 --- a/usr.bin/ranlib/ranlib.c +++ b/usr.bin/ranlib/ranlib.c @@ -44,19 +44,21 @@ static const char copyright[] = #if 0 static char sccsid[] = "@(#)ranlib.c 8.1 (Berkeley) 6/6/93"; #endif -static const char rcsid[] = - "$FreeBSD$"; #endif /* not lint */ +#include +__FBSDID("$FreeBSD$"); + #include + #include #include #include #include -#include "archive.h" -extern int build( void ); -extern int touch( void ); +#include "archive.h" +#include "extern.h" + static void usage(void); CHDR chdr; @@ -64,9 +66,7 @@ u_int options; /* UNUSED -- keep open_archive happy */ char *archive; int -main(argc, argv) - int argc; - char **argv; +main(int argc, char *argv[]) { int ch, eval, tflag; @@ -92,7 +92,7 @@ main(argc, argv) } static void -usage() +usage(void) { (void)fprintf(stderr, "usage: ranlib [-t] archive ...\n"); exit(1); diff --git a/usr.bin/ranlib/touch.c b/usr.bin/ranlib/touch.c index aca8ee61b215..0ede6b3f8326 100644 --- a/usr.bin/ranlib/touch.c +++ b/usr.bin/ranlib/touch.c @@ -38,11 +38,13 @@ #if 0 static char sccsid[] = "@(#)touch.c 8.1 (Berkeley) 6/6/93"; #endif -static const char rcsid[] = - "$FreeBSD$"; #endif /* not lint */ #include +__FBSDID("$FreeBSD$"); + +#include + #include #include #include @@ -52,12 +54,10 @@ static const char rcsid[] = #include #include #include + #include "archive.h" +#include "extern.h" -extern CHDR chdr; /* converted header */ -extern char *archive; /* archive name */ - -extern void error( char * ); void settime( int ); int touch( void ); @@ -79,8 +79,7 @@ touch(void) } void -settime(afd) - int afd; +settime(int afd) { struct ar_hdr *hdr; off_t size;