Merged with 4.4lite.
Changed to conform to NetBSD's new RCS Id convention. Changed to use err() and warn().
This commit is contained in:
parent
d9a436e9ca
commit
fdc1920d23
@ -1,5 +1,5 @@
|
||||
# from: @(#)Makefile 5.3 (Berkeley) 5/11/90
|
||||
# $Id: Makefile,v 1.2 1993/07/30 23:51:03 mycroft Exp $
|
||||
# $NetBSD: Makefile,v 1.3 1994/12/21 08:07:19 jtc Exp $
|
||||
# @(#)Makefile 8.1 (Berkeley) 6/6/93
|
||||
|
||||
PROG= size
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
.\" Copyright (c) 1990 The Regents of the University of California.
|
||||
.\" All rights reserved.
|
||||
.\" $NetBSD: size.1,v 1.5 1994/12/21 08:07:20 jtc Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1990, 1993, 1994
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
@ -29,10 +31,9 @@
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" from: @(#)size.1 6.7 (Berkeley) 3/2/92
|
||||
.\" $Id: size.1,v 1.4 1994/01/14 02:19:09 jtc Exp $
|
||||
.\" @(#)size.1 8.2 (Berkeley) 4/18/94
|
||||
.\"
|
||||
.Dd March 2, 1992
|
||||
.Dd April 18, 1994
|
||||
.Dt SIZE 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
@ -1,6 +1,8 @@
|
||||
/* $NetBSD: size.c,v 1.6 1994/12/21 08:07:21 jtc Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 Regents of the University of California.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 1988, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@ -32,26 +34,26 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
char copyright[] =
|
||||
"@(#) Copyright (c) 1988 Regents of the University of California.\n\
|
||||
All rights reserved.\n";
|
||||
static char copyright[] =
|
||||
"@(#) Copyright (c) 1988, 1993\n\
|
||||
The Regents of the University of California. All rights reserved.\n";
|
||||
#endif /* not lint */
|
||||
|
||||
#ifndef lint
|
||||
/*static char sccsid[] = "from: @(#)size.c 5.1 (Berkeley) 3/2/92";*/
|
||||
static char rcsid[] = "$Id: size.c,v 1.5 1993/11/18 21:00:39 mycroft Exp $";
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)size.c 8.2 (Berkeley) 12/9/93";
|
||||
#endif
|
||||
static char rcsid[] = "$NetBSD: size.c,v 1.6 1994/12/21 08:07:21 jtc Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/file.h>
|
||||
#include <errno.h>
|
||||
#include <a.out.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <err.h>
|
||||
|
||||
void err __P((const char *, ...));
|
||||
int show __P((int, char *));
|
||||
void usage __P((void));
|
||||
|
||||
@ -92,12 +94,12 @@ show(count, name)
|
||||
int fd;
|
||||
|
||||
if ((fd = open(name, O_RDONLY, 0)) < 0) {
|
||||
err("%s: %s", name, strerror(errno));
|
||||
warn("%s", name);
|
||||
return (1);
|
||||
}
|
||||
if (read(fd, &head, sizeof(head)) != sizeof(head) || N_BADMAG(head)) {
|
||||
err("%s: not in a.out format", name);
|
||||
(void)close(fd);
|
||||
warnx("%s: not in a.out format", name);
|
||||
return (1);
|
||||
}
|
||||
(void)close(fd);
|
||||
@ -121,30 +123,3 @@ usage()
|
||||
(void)fprintf(stderr, "usage: size [file ...]\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
#if __STDC__
|
||||
#include <stdarg.h>
|
||||
#else
|
||||
#include <varargs.h>
|
||||
#endif
|
||||
|
||||
void
|
||||
#if __STDC__
|
||||
err(const char *fmt, ...)
|
||||
#else
|
||||
err(fmt, va_alist)
|
||||
char *fmt;
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list ap;
|
||||
#if __STDC__
|
||||
va_start(ap, fmt);
|
||||
#else
|
||||
va_start(ap);
|
||||
#endif
|
||||
(void)fprintf(stderr, "size: ");
|
||||
(void)vfprintf(stderr, fmt, ap);
|
||||
va_end(ap);
|
||||
(void)fprintf(stderr, "\n");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user