Lines 4-12
Link Here
|
4 |
* redistributable in accordance with the |
4 |
* redistributable in accordance with the |
5 |
* GNU General Public License v2 |
5 |
* GNU General Public License v2 |
6 |
* |
6 |
* |
7 |
* $FreeBSD: ports/sysutils/e2fsprogs/files/fsck_ext2fs.c,v 1.2 2004/02/24 21:55:22 krion Exp $ |
7 |
* $FreeBSD: ports/sysutils/e2fsprogs/files/fsck_ext2fs.c,v 1.2 2004/02/24 21:55:22 krion Exp $ |
8 |
* |
8 |
* |
9 |
* Upstream: $Id: fsck_ext2fs.c,v 1.2 2004/02/24 20:57:02 emma Exp $ |
9 |
* Upstream: $Id: fsck_ext2fs.c,v 1.3 2004/03/09 01:10:22 emma Exp $ |
10 |
* |
10 |
* |
11 |
* format: gindent -kr |
11 |
* format: gindent -kr |
12 |
*/ |
12 |
*/ |
Lines 29-42
Link Here
|
29 |
|
29 |
|
30 |
int main(int argc, char **argv) |
30 |
int main(int argc, char **argv) |
31 |
{ |
31 |
{ |
32 |
int ch, i = 1, force = 0, status; |
32 |
int ch, i = 1, force = 0, status, verbose = 0, t; |
33 |
long block = 0; |
33 |
long block = 0; |
34 |
enum { normal, preen, yes, no } mode = normal; |
34 |
enum { normal, preen, yes, no } mode = normal; |
35 |
char *cmd[256]; |
35 |
char *cmd[256]; |
36 |
pid_t pid; |
36 |
pid_t pid; |
37 |
|
37 |
|
38 |
cmd[0] = "/sbin/e2fsck"; |
38 |
cmd[0] = "/sbin/e2fsck"; |
39 |
while ((ch = getopt(argc, argv, "BFpfnyb:")) != -1) { |
39 |
while ((ch = getopt(argc, argv, "BFpfnyb:v")) != -1) { |
40 |
switch (ch) { |
40 |
switch (ch) { |
41 |
case 'p': |
41 |
case 'p': |
42 |
mode = preen; |
42 |
mode = preen; |
Lines 53-58
Link Here
|
53 |
case 'b': |
53 |
case 'b': |
54 |
block = atol(optarg); |
54 |
block = atol(optarg); |
55 |
break; |
55 |
break; |
|
|
56 |
case 'v': |
57 |
verbose++; |
58 |
break; |
56 |
case 'B': |
59 |
case 'B': |
57 |
case 'F': |
60 |
case 'F': |
58 |
default: |
61 |
default: |
Lines 67-72
Link Here
|
67 |
|
70 |
|
68 |
switch (mode) { |
71 |
switch (mode) { |
69 |
case normal: |
72 |
case normal: |
|
|
73 |
/* FreeBSD needs -f to force a check only in context |
74 |
* with -p -- so map normal to force to match |
75 |
* expectations */ |
76 |
if (!force) |
77 |
cmd[i++] = "-f"; |
70 |
break; |
78 |
break; |
71 |
case yes: |
79 |
case yes: |
72 |
cmd[i++] = "-y"; |
80 |
cmd[i++] = "-y"; |
Lines 86-95
Link Here
|
86 |
cmd[i++] = b; |
94 |
cmd[i++] = b; |
87 |
} |
95 |
} |
88 |
|
96 |
|
|
|
97 |
for (t = verbose; t > 1; t--) |
98 |
cmd[i++] = "-v"; |
99 |
|
89 |
while (optind < argc) |
100 |
while (optind < argc) |
90 |
cmd[i++] = argv[optind++]; |
101 |
cmd[i++] = argv[optind++]; |
91 |
|
102 |
|
92 |
cmd[i++] = 0; |
103 |
cmd[i++] = 0; |
|
|
104 |
|
105 |
if (verbose) { |
106 |
for (i=0; cmd[i]; i++) |
107 |
fputs(cmd[i], stderr), |
108 |
fputc(' ', stderr); |
109 |
fputc('\n', stderr); |
110 |
} |
93 |
|
111 |
|
94 |
pid = fork(); |
112 |
pid = fork(); |
95 |
switch (pid) { |
113 |
switch (pid) { |