main.c (86514) | main.c (92839) |
---|---|
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[] = | 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 $"; | 45 "$FreeBSD: head/sbin/fsck_ffs/main.c 92839 2002-03-20 22:57:10Z imp $"; |
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 | 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[])); | 68static void usage(void) __dead2; 69static int argtoi(int flag, char *req, char *str, int base); 70static int checkfilesys(char *filesys); 71static struct statfs *getmntpt(const char *); |
73 74int | 72 73int |
75main(argc, argv) 76 int argc; 77 char *argv[]; | 74main(int argc, 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 | 75{ 76 int ch; 77 struct rlimit rlimit; 78 int ret = 0; 79 80 sync(); 81 skipclean = 1; 82 while ((ch = getopt(argc, argv, "b:Bc:dfFm:npy")) != -1) { --- 73 unchanged lines hidden (view full) --- 156 (void)checkfilesys(*argv++); 157 158 if (returntosingle) 159 ret = 2; 160 exit(ret); 161} 162 163static int |
167argtoi(flag, req, str, base) 168 int flag; 169 char *req, *str; 170 int base; | 164argtoi(int flag, char *req, char *str, 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 | 165{ 166 char *cp; 167 int ret; 168 169 ret = (int)strtol(str, &cp, base); 170 if (cp == str || *cp) 171 errx(EEXIT, "-%c flag requires a %s", flag, req); 172 return (ret); 173} 174 175/* 176 * Check the specified filesystem. 177 */ 178/* ARGSUSED */ 179static int |
186checkfilesys(filesys) 187 char *filesys; | 180checkfilesys(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 * | 181{ 182 ufs_daddr_t n_ffree, n_bfree; 183 struct ufs_args args; 184 struct dups *dp; 185 struct statfs *mntp; 186 struct zlncnt *zlnp; 187 ufs_daddr_t blks; 188 ufs_daddr_t files; --- 263 unchanged lines hidden (view full) --- 452 } 453 return (0); 454} 455 456/* 457 * Get the mount point information for name. 458 */ 459static struct statfs * |
467getmntpt(name) 468 const char *name; | 460getmntpt(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 | 461{ 462 struct stat devstat, mntdevstat; 463 char device[sizeof(_PATH_DEV) - 1 + MNAMELEN]; 464 char *devname; 465 struct statfs *mntbuf, *statfsp; 466 int i, mntsize, isdev; 467 468 if (stat(name, &devstat) != 0) --- 20 unchanged lines hidden (view full) --- 489 mntdevstat.st_rdev == devstat.st_rdev) 490 return (statfsp); 491 } 492 statfsp = NULL; 493 return (statfsp); 494} 495 496static void |
505usage() | 497usage(void) |
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} | 498{ 499 extern char *__progname; 500 501 (void) fprintf(stderr, 502 "Usage: %s [-BFpfny] [-b block] [-c level] [-m mode] " 503 "filesystem ...\n", 504 __progname); 505 exit(1); 506} |