int main(int argc, char **argv) { int ret = 0, erg; int ch; skipclean = 1; while ((ch = getopt(argc, argv, "CfFnpy")) != -1) { switch (ch) { case 'C': /* for fsck_ffs compatibility */ break; case 'f': skipclean = 0; break; case 'F': /* * We can never run in the background. We must exit * silently with a nonzero exit code so that fsck(8) * can probe our support for -F. The exit code * doesn't really matter, but we use an unusual one * in case someone tries -F directly. The -F flag * is intentionally left out of the usage message. */ exit(5); case 'n': alwaysno = 1; alwaysyes = preen = 0; break; case 'y': alwaysyes = 1; alwaysno = preen = 0; break; case 'p': preen = 1; alwaysyes = alwaysno = 0; break; default: usage(); break; } } argc -= optind; argv += optind; if (!argc) usage(); while (--argc >= 0) { // setcdevname(*argv, preen); erg = checkfilesys(*argv++); if (erg > ret) ret = erg; } return ret; }
int main(int argc, char *argv[]) { int ret = 0, erg; int ch; while ((ch = getopt(argc, argv, "pynf")) != -1) { switch (ch) { case 'f': /* Ignore for consistency with fsck_ffs */ break; case 'n': alwaysno = 1; alwaysyes = preen = 0; break; case 'y': alwaysyes = 1; alwaysno = preen = 0; break; case 'p': preen = 1; alwaysyes = alwaysno = 0; break; default: usage(); break; } } argc -= optind; argv += optind; if (!argc) usage(); while (argc-- > 0) { setcdevname(*argv, preen); erg = checkfilesys(*argv++); if (erg > ret) ret = erg; } exit(ret); }
int main(int argc, char **argv) { int ret = 0, erg; int ch; skipclean = 1; debugmessage = 0; printf("The fsck_msdos options input by caller :\n") ; while ((ch = getopt(argc, argv, "CfFnpyd")) != -1) { switch (ch) { case 'C': /* for fsck_ffs compatibility */ printf(" -C\n") ; break; case 'f': printf(" -f\n") ; skipclean = 0; break; case 'F': /* * We can never run in the background. We must exit * silently with a nonzero exit code so that fsck(8) * can probe our support for -F. The exit code * doesn't really matter, but we use an unusual one * in case someone tries -F directly. The -F flag * is intentionally left out of the usage message. */ printf(" -F\n") ; exit(5); case 'n': alwaysno = 1; alwaysyes = preen = 0; printf(" -n\n") ; break; case 'y': alwaysyes = 1; alwaysno = preen = 0; printf(" -y\n") ; break; case 'p': preen = 1; alwaysyes = alwaysno = 0; printf(" -p\n") ; break; case 'd': debugmessage = 1; printf(" -d\n") ; break; default: usage(); break; } } argc -= optind; argv += optind; if (!argc) usage(); start_count(&fsck_total_time) ; while (--argc >= 0) { // setcdevname(*argv, preen); erg = checkfilesys(*argv++); if (erg > ret) ret = erg; } end_count("Total fsck time", &fsck_total_time) ; printf("\n=== FSCK Time Usage ===\n") ; printf("Phase#1 tooks %lu usecs.\n", print_time(&fsck_p1_time)) ; printf("Phase#2 tooks %lu usecs.\n", print_time(&fsck_p2_time)) ; printf("Phase#3 tooks %lu usecs.\n", print_time(&fsck_p3_time)) ; printf("Phase#4 tooks %lu usecs.\n", print_time(&fsck_p4_time)) ; printf("Total fsck tooks %lu usecs.\n", print_time(&fsck_total_time)) ; return ret; }
int main(int argc, char *argv[]) { int ch; int ret = 0; sync(); check_skipclean = 1; check_inoopt = 0; while ((ch = getopt(argc, argv, "b:c:CdEfm:nprSyZ")) != -1) { switch (ch) { case 'b': check_skipclean = 0; check_bflag = argtoi('b', "number", optarg, 10); printf("Alternate super block location: %d\n", check_bflag); break; case 'c': check_skipclean = 0; check_cvtlevel = argtoi('c', "conversion level", optarg, 10); if (check_cvtlevel < 3) errx(EEXIT, "cannot do level %d conversion", check_cvtlevel); break; case 'd': check_debug++; break; case 'E': check_Eflag++; break; case 'f': check_skipclean = 0; break; case 'm': check_lfmode = argtoi('m', "mode", optarg, 8); if (check_lfmode &~ 07777) errx(EEXIT, "bad mode to -m: %o", check_lfmode); printf("** lost+found creation mode %o\n", check_lfmode); break; case 'n': check_nflag++; check_yflag = 0; break; case 'p': check_preen++; /*FALLTHROUGH*/ case 'C': check_clean++; break; case 'r': check_inoopt++; break; case 'S': check_surrender = 1; break; case 'y': check_yflag++; check_nflag = 0; break; case 'Z': check_Zflag++; break; default: usage(); } } argc -= optind; argv += optind; if (!argc) usage(); if (signal(SIGINT, SIG_IGN) != SIG_IGN) (void)signal(SIGINT, check_catch); if (check_clean) (void)signal(SIGQUIT, check_catchquit); while (argc-- > 0) (void)checkfilesys(*argv++); if (check_returntosingle) ret = 2; exit(ret); }