ANSIfy functions, and move extern declarations into a shared header

where ${DEITY} intended them to be.
This commit is contained in:
markm 2002-04-28 11:59:43 +00:00
parent 5f16d2530a
commit 3fd4319828
5 changed files with 88 additions and 43 deletions

View File

@ -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;

47
usr.bin/ranlib/extern.h Normal file
View File

@ -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 */

View File

@ -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);
}

View File

@ -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"
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);

View File

@ -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"
#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;