summaryrefslogtreecommitdiffstats
path: root/usr.bin/ranlib
diff options
context:
space:
mode:
authormarkm <markm@FreeBSD.org>2002-04-28 11:59:43 +0000
committermarkm <markm@FreeBSD.org>2002-04-28 11:59:43 +0000
commit6e62811ca30b49afadd571304d15357244bd77af (patch)
treef88f75abadd5ac367b1a0dfc4ad6b65b65765bfb /usr.bin/ranlib
parent679fd48b5c4e4d6775ad4fa1c131410cd1e3fc6e (diff)
downloadFreeBSD-src-6e62811ca30b49afadd571304d15357244bd77af.zip
FreeBSD-src-6e62811ca30b49afadd571304d15357244bd77af.tar.gz
ANSIfy functions, and move extern declarations into a shared header
where ${DEITY} intended them to be.
Diffstat (limited to 'usr.bin/ranlib')
-rw-r--r--usr.bin/ranlib/build.c35
-rw-r--r--usr.bin/ranlib/extern.h47
-rw-r--r--usr.bin/ranlib/misc.c16
-rw-r--r--usr.bin/ranlib/ranlib.c16
-rw-r--r--usr.bin/ranlib/touch.c15
5 files changed, 87 insertions, 42 deletions
diff --git a/usr.bin/ranlib/build.c b/usr.bin/ranlib/build.c
index 88bebf7..f9e3664 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 <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
#include <sys/types.h>
#include <sys/stat.h>
+#include <arpa/inet.h>
+
#include <a.out.h>
#include <ar.h>
#include <dirent.h>
@@ -56,15 +59,7 @@ static const char rcsid[] =
#include <unistd.h>
#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 0000000..6014f90
--- /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 b67def0..f98120d 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 <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
#include <sys/param.h>
#include <sys/signal.h>
+
+#include <dirent.h>
#include <err.h>
#include <errno.h>
#include <signal.h>
@@ -51,12 +54,14 @@ static const char rcsid[] =
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+
+#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 290339b..933a23a 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 <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
#include <sys/types.h>
+
#include <dirent.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
+
#include "archive.h"
+#include "extern.h"
-extern int build( void );
-extern int touch( void );
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 aca8ee6..0ede6b3 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 <sys/types.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/types.h>
+
#include <ar.h>
#include <dirent.h>
#include <err.h>
@@ -52,12 +54,10 @@ static const char rcsid[] =
#include <string.h>
#include <time.h>
#include <unistd.h>
-#include "archive.h"
-extern CHDR chdr; /* converted header */
-extern char *archive; /* archive name */
+#include "archive.h"
+#include "extern.h"
-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;
OpenPOWER on IntegriCloud