Update to 4.4-lite.

This commit is contained in:
pk 1994-06-10 17:42:09 +00:00
parent 928beac1da
commit e681ff5f4a
3 changed files with 32 additions and 23 deletions

View File

@ -1,5 +1,4 @@
# from: @(#)Makefile 5.3 (Berkeley) 5/11/90
# $Id: Makefile,v 1.4 1993/08/01 05:38:36 mycroft Exp $
# @(#)Makefile 8.1 (Berkeley) 6/5/93
PROG= badsect
MAN8= badsect.0

View File

@ -1,5 +1,5 @@
.\" Copyright (c) 1985, 1991 The Regents of the University of California.
.\" All rights reserved.
.\" Copyright (c) 1985, 1991, 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
@ -29,10 +29,10 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" from: @(#)badsect.8 6.4 (Berkeley) 3/16/91
.\" $Id: badsect.8,v 1.4 1993/08/01 07:39:41 mycroft Exp $
.\" @(#)badsect.8 8.1 (Berkeley) 6/5/93
.\" $Id: badsect.8,v 1.5 1994/06/10 17:42:10 pk Exp $
.\"
.Dd March 16, 1991
.Dd June 5, 1993
.Dt BADSECT 8
.Os BSD 4
.Sh NAME

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 1981, 1983 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 1981, 1983, 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,14 +32,14 @@
*/
#ifndef lint
char copyright[] =
"@(#) Copyright (c) 1981, 1983 The Regents of the University of California.\n\
All rights reserved.\n";
static char copyright[] =
"@(#) Copyright (c) 1981, 1983, 1993\n\
The Regents of the University of California. All rights reserved.\n";
#endif /* not lint */
#ifndef lint
/*static char sccsid[] = "from: @(#)badsect.c 5.9 (Berkeley) 6/1/90";*/
static char rcsid[] = "$Id: badsect.c,v 1.5 1993/12/15 17:01:36 jtc Exp $";
/*static char sccsid[] = "@(#)badsect.c 8.1 (Berkeley) 6/5/93";*/
static char rcsid[] = "$Id: badsect.c,v 1.6 1994/06/10 17:42:11 pk Exp $";
#endif /* not lint */
/*
@ -53,12 +53,17 @@ static char rcsid[] = "$Id: badsect.c,v 1.5 1993/12/15 17:01:36 jtc Exp $";
* does not support bad block forwarding.
*/
#include <sys/param.h>
#include <sys/dir.h>
#include <sys/stat.h>
#include <dirent.h>
#include <ufs/fs.h>
#include <ufs/dinode.h>
#include <stdio.h>
#include <ufs/ffs/fs.h>
#include <ufs/ufs/dinode.h>
#include <fcntl.h>
#include <paths.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
union {
struct fs fs;
@ -77,16 +82,18 @@ long dev_bsize = 1;
char buf[MAXBSIZE];
void rdfs __P((daddr_t, int, char *));
int chkuse __P((daddr_t, int));
int
main(argc, argv)
int argc;
char *argv[];
{
daddr_t number;
struct stat stbuf, devstat;
register struct dirent *dp;
register struct direct *dp;
DIR *dirp;
int fd;
char name[BUFSIZ];
if (argc < 3) {
@ -138,6 +145,7 @@ main(argc, argv)
exit(errs);
}
int
chkuse(blkno, cnt)
daddr_t blkno;
int cnt;
@ -180,13 +188,15 @@ chkuse(blkno, cnt)
/*
* read a block from the file system
*/
void
rdfs(bno, size, bf)
int bno, size;
daddr_t bno;
int size;
char *bf;
{
int n;
if (lseek(fsi, bno * dev_bsize, 0) < 0) {
if (lseek(fsi, (off_t)bno * dev_bsize, SEEK_SET) < 0) {
printf("seek error: %ld\n", bno);
perror("rdfs");
exit(1);