Use err(3). Use #include "" instead of <> for local headers.

This commit is contained in:
Philippe Charnier 1997-08-04 06:48:25 +00:00
parent 9d63ad4978
commit ee461acc1a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=27889
7 changed files with 41 additions and 25 deletions

View File

@ -35,11 +35,14 @@
*/
#ifndef lint
#if 0
static char sccsid[] = "@(#)build.c 8.1 (Berkeley) 6/6/93";
#endif
static const char rcsid[] =
"$Id$";
#endif /* not lint */
#include <sys/types.h>
#include <sys/errno.h>
#include <sys/stat.h>
#include <a.out.h>

View File

@ -35,17 +35,22 @@
*/
#ifndef lint
#if 0
static char sccsid[] = "@(#)misc.c 8.1 (Berkeley) 6/6/93";
#endif
static const char rcsid[] =
"$Id$";
#endif /* not lint */
#include <sys/param.h>
#include <sys/signal.h>
#include <err.h>
#include <errno.h>
#include <unistd.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "pathnames.h"
extern char *archive; /* archive name */
@ -105,6 +110,5 @@ void
error(name)
char *name;
{
(void)fprintf(stderr, "ranlib: %s: %s\n", name, strerror(errno));
exit(1);
err(1, "%s", name);
}

View File

@ -30,7 +30,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)ranlib.1 8.1 (Berkeley) 6/6/93
.\" $Id$
.\" $Id: ranlib.1,v 1.5 1997/02/22 19:56:39 peter Exp $
.\"
.Dd June 6, 1993
.Dt RANLIB 1
@ -39,7 +39,7 @@
.Nm ranlib
.Nd table-of-contents for archive libraries
.Sh SYNOPSIS
.Nm ranlib
.Nm
.Op Fl t
.Ar file ...
.Sh DESCRIPTION
@ -84,6 +84,6 @@ Temporary file names.
.Xr ranlib 5
.Sh HISTORY
A
.Nm ranlib
.Nm
command appeared in
.At v7 .

View File

@ -30,7 +30,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)ranlib.1 8.1 (Berkeley) 6/6/93
.\" $Id$
.\" $Id: ranlib.1,v 1.5 1997/02/22 19:56:39 peter Exp $
.\"
.Dd June 6, 1993
.Dt RANLIB 1
@ -39,7 +39,7 @@
.Nm ranlib
.Nd table-of-contents for archive libraries
.Sh SYNOPSIS
.Nm ranlib
.Nm
.Op Fl t
.Ar file ...
.Sh DESCRIPTION
@ -84,6 +84,6 @@ Temporary file names.
.Xr ranlib 5
.Sh HISTORY
A
.Nm ranlib
.Nm
command appeared in
.At v7 .

View File

@ -41,7 +41,7 @@
.Fd #include <ranlib.h>
.Sh DESCRIPTION
The archive table-of-contents command
.Nm ranlib
.Nm
creates a table of contents for archives, containing object files, to
be used by the link-editor
.Xr ld 1 .
@ -49,7 +49,7 @@ It operates on archives created with the utility
.Xr ar 1 .
.Pp
The
.Nm Ranlib
.Nm
function
prepends a new file to the archive which has three separate parts.
The first part is a standard archive header, which has a special name

View File

@ -35,24 +35,29 @@
*/
#ifndef lint
static char copyright[] =
static const char copyright[] =
"@(#) Copyright (c) 1990, 1993\n\
The Regents of the University of California. All rights reserved.\n";
#endif /* not lint */
#ifndef lint
#if 0
static char sccsid[] = "@(#)ranlib.c 8.1 (Berkeley) 6/6/93";
#endif
static const char rcsid[] =
"$Id$";
#endif /* not lint */
#include <sys/types.h>
#include <dirent.h>
#include <stdio.h>
#include <stdlib.h>
#include <archive.h>
#include <unistd.h>
#include "archive.h"
extern int build __P(( void ));
extern int touch __P(( void ));
void usage __P((void));
static void usage __P((void));
CHDR chdr;
u_int options; /* UNUSED -- keep open_archive happy */
@ -87,8 +92,8 @@ main(argc, argv)
exit(eval);
}
void
usage(void)
static void
usage()
{
(void)fprintf(stderr, "usage: ranlib [-t] archive ...\n");
exit(1);

View File

@ -35,19 +35,24 @@
*/
#ifndef lint
#if 0
static char sccsid[] = "@(#)touch.c 8.1 (Berkeley) 6/6/93";
#endif
static const char rcsid[] =
"$Id$";
#endif /* not lint */
#include <sys/types.h>
#include <fcntl.h>
#include <dirent.h>
#include <ranlib.h>
#include <ar.h>
#include <time.h>
#include <unistd.h>
#include <dirent.h>
#include <err.h>
#include <fcntl.h>
#include <ranlib.h>
#include <stdio.h>
#include <string.h>
#include <archive.h>
#include <time.h>
#include <unistd.h>
#include "archive.h"
extern CHDR chdr; /* converted header */
extern char *archive; /* archive name */
@ -65,8 +70,7 @@ touch(void)
if (!get_arobj(afd) ||
strncmp(RANLIBMAG, chdr.name, sizeof(RANLIBMAG) - 1)) {
(void)fprintf(stderr,
"ranlib: %s: no symbol table.\n", archive);
warnx("%s: no symbol table", archive);
return(1);
}
settime(afd);