From e681ff5f4a2beda40f79776033e428d96246ca4c Mon Sep 17 00:00:00 2001 From: pk Date: Fri, 10 Jun 1994 17:42:09 +0000 Subject: [PATCH] Update to 4.4-lite. --- sbin/badsect/Makefile | 3 +-- sbin/badsect/badsect.8 | 10 +++++----- sbin/badsect/badsect.c | 42 ++++++++++++++++++++++++++---------------- 3 files changed, 32 insertions(+), 23 deletions(-) diff --git a/sbin/badsect/Makefile b/sbin/badsect/Makefile index c4a17adcb757..ff9f4f1d22cb 100644 --- a/sbin/badsect/Makefile +++ b/sbin/badsect/Makefile @@ -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 diff --git a/sbin/badsect/badsect.8 b/sbin/badsect/badsect.8 index b3a11f2f7589..4b9922718ac8 100644 --- a/sbin/badsect/badsect.8 +++ b/sbin/badsect/badsect.8 @@ -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 diff --git a/sbin/badsect/badsect.c b/sbin/badsect/badsect.c index ceaf024e2e1b..c01dbe2f2efc 100644 --- a/sbin/badsect/badsect.c +++ b/sbin/badsect/badsect.c @@ -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 +#include #include -#include -#include -#include -#include + +#include +#include + +#include #include +#include +#include +#include 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,19 +188,21 @@ 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); } n = read(fsi, bf, size); - if(n != size) { + if (n != size) { printf("read error: %ld\n", bno); perror("rdfs"); exit(1);