Use err(3).

This commit is contained in:
Philippe Charnier 1997-08-25 06:49:45 +00:00
parent 8c85cce77a
commit 05c5fed8f5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=28697
2 changed files with 15 additions and 8 deletions

View File

@ -31,14 +31,14 @@
.\"
.\" @(#)what.1 8.1 (Berkeley) 6/6/93
.\"
.\" $Id: what.1,v 1.4 1997/02/22 19:57:46 peter Exp $
.\" $Id: what.1,v 1.5 1997/05/25 18:47:33 max Exp $
.\"
.Dd June 6, 1993
.Dt WHAT 1
.Os BSD 4
.Sh NAME
.Nm what
.Nd "show what versions of object modules were used to construct a file"
.Nd show what versions of object modules were used to construct a file
.Sh SYNOPSIS
.Nm what
.Ar name Ar ...
@ -59,7 +59,7 @@ As
is not licensed to distribute
.Tn SCCS
this is a rewrite of the
.Nm what
.Nm
command which is part of
.Tn SCCS ,
and may not behave exactly the same as that

View File

@ -32,21 +32,29 @@
*/
#ifndef lint
static char copyright[] =
static const char copyright[] =
"@(#) Copyright (c) 1980, 1988, 1993\n\
The Regents of the University of California. All rights reserved.\n";
#endif /* not lint */
#ifndef lint
#if 0
static char sccsid[] = "@(#)what.c 8.1 (Berkeley) 6/6/93";
#endif
static const char rcsid[] =
"$Id$";
#endif /* not lint */
#include <err.h>
#include <stdio.h>
void search __P((void));
/*
* what
*/
/* ARGSUSED */
int
main(argc, argv)
int argc;
char **argv;
@ -54,16 +62,15 @@ main(argc, argv)
if (!*++argv)
search();
else do {
if (!freopen(*argv, "r", stdin)) {
perror(*argv);
exit(1);
}
if (!freopen(*argv, "r", stdin))
err(1, "%s", *argv);
printf("%s\n", *argv);
search();
} while(*++argv);
exit(0);
}
void
search()
{
register int c;