Deleted Added
sdiff udiff text old ( 86514 ) new ( 92839 )
full compact
1/*
2 * Copyright (c) 1980, 1986, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 28 unchanged lines hidden (view full) ---

37 The Regents of the University of California. All rights reserved.\n";
38#endif /* not lint */
39
40#ifndef lint
41#if 0
42static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 5/14/95";
43#endif
44static const char rcsid[] =
45 "$FreeBSD: head/sbin/fsck_ffs/main.c 86514 2001-11-17 23:48:21Z iedowse $";
46#endif /* not lint */
47
48#include <sys/param.h>
49#include <sys/stat.h>
50#include <sys/file.h>
51#include <sys/time.h>
52#include <sys/mount.h>
53#include <sys/resource.h>

--- 6 unchanged lines hidden (view full) ---

60#include <err.h>
61#include <errno.h>
62#include <fstab.h>
63#include <paths.h>
64#include <string.h>
65
66#include "fsck.h"
67
68static void usage __P((void));
69static int argtoi __P((int flag, char *req, char *str, int base));
70static int checkfilesys __P((char *filesys));
71static struct statfs *getmntpt __P((const char *));
72int main __P((int argc, char *argv[]));
73
74int
75main(argc, argv)
76 int argc;
77 char *argv[];
78{
79 int ch;
80 struct rlimit rlimit;
81 int ret = 0;
82
83 sync();
84 skipclean = 1;
85 while ((ch = getopt(argc, argv, "b:Bc:dfFm:npy")) != -1) {

--- 73 unchanged lines hidden (view full) ---

159 (void)checkfilesys(*argv++);
160
161 if (returntosingle)
162 ret = 2;
163 exit(ret);
164}
165
166static int
167argtoi(flag, req, str, base)
168 int flag;
169 char *req, *str;
170 int base;
171{
172 char *cp;
173 int ret;
174
175 ret = (int)strtol(str, &cp, base);
176 if (cp == str || *cp)
177 errx(EEXIT, "-%c flag requires a %s", flag, req);
178 return (ret);
179}
180
181/*
182 * Check the specified filesystem.
183 */
184/* ARGSUSED */
185static int
186checkfilesys(filesys)
187 char *filesys;
188{
189 ufs_daddr_t n_ffree, n_bfree;
190 struct ufs_args args;
191 struct dups *dp;
192 struct statfs *mntp;
193 struct zlncnt *zlnp;
194 ufs_daddr_t blks;
195 ufs_daddr_t files;

--- 263 unchanged lines hidden (view full) ---

459 }
460 return (0);
461}
462
463/*
464 * Get the mount point information for name.
465 */
466static struct statfs *
467getmntpt(name)
468 const char *name;
469{
470 struct stat devstat, mntdevstat;
471 char device[sizeof(_PATH_DEV) - 1 + MNAMELEN];
472 char *devname;
473 struct statfs *mntbuf, *statfsp;
474 int i, mntsize, isdev;
475
476 if (stat(name, &devstat) != 0)

--- 20 unchanged lines hidden (view full) ---

497 mntdevstat.st_rdev == devstat.st_rdev)
498 return (statfsp);
499 }
500 statfsp = NULL;
501 return (statfsp);
502}
503
504static void
505usage()
506{
507 extern char *__progname;
508
509 (void) fprintf(stderr,
510 "Usage: %s [-BFpfny] [-b block] [-c level] [-m mode] "
511 "filesystem ...\n",
512 __progname);
513 exit(1);
514}