mirror of
https://github.com/9fans/plan9port.git
synced 2025-01-12 11:10:07 +00:00
diff: continue after i/o errors when diffing many files
This commit is contained in:
parent
e84044be84
commit
eb5d2a54d5
2 changed files with 13 additions and 5 deletions
|
@ -19,8 +19,10 @@ scandir(char *name)
|
||||||
int nitems;
|
int nitems;
|
||||||
int fd, n;
|
int fd, n;
|
||||||
|
|
||||||
if ((fd = open(name, OREAD)) < 0)
|
if ((fd = open(name, OREAD)) < 0){
|
||||||
panic(2, "can't open %s\n", name);
|
panic(mflag ? 0 : 2, "can't open %s\n", name);
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
cp = 0;
|
cp = 0;
|
||||||
nitems = 0;
|
nitems = 0;
|
||||||
if((n = dirreadall(fd, &db)) > 0){
|
if((n = dirreadall(fd, &db)) > 0){
|
||||||
|
@ -63,6 +65,8 @@ diffdir(char *f, char *t, int level)
|
||||||
dt = scandir(t);
|
dt = scandir(t);
|
||||||
dirf = df;
|
dirf = df;
|
||||||
dirt = dt;
|
dirt = dt;
|
||||||
|
if(df == nil || dt == nil)
|
||||||
|
goto Out;
|
||||||
while (*df || *dt) {
|
while (*df || *dt) {
|
||||||
from = *df;
|
from = *df;
|
||||||
to = *dt;
|
to = *dt;
|
||||||
|
@ -99,9 +103,10 @@ diffdir(char *f, char *t, int level)
|
||||||
diff(fb, tb, level+1);
|
diff(fb, tb, level+1);
|
||||||
df++; dt++;
|
df++; dt++;
|
||||||
}
|
}
|
||||||
for (df = dirf; *df; df++)
|
Out:
|
||||||
|
for (df = dirf; df && *df; df++)
|
||||||
FREE(*df);
|
FREE(*df);
|
||||||
for (dt = dirt; *dt; dt++)
|
for (dt = dirt; dt && *dt; dt++)
|
||||||
FREE(*dt);
|
FREE(*dt);
|
||||||
FREE(dirf);
|
FREE(dirf);
|
||||||
FREE(dirt);
|
FREE(dirt);
|
||||||
|
|
|
@ -183,7 +183,9 @@ main(int argc, char *argv[])
|
||||||
char *p;
|
char *p;
|
||||||
int i;
|
int i;
|
||||||
Dir *fsb, *tsb;
|
Dir *fsb, *tsb;
|
||||||
|
extern int _p9usepwlibrary;
|
||||||
|
|
||||||
|
_p9usepwlibrary = 0;
|
||||||
Binit(&stdout, 1, OWRITE);
|
Binit(&stdout, 1, OWRITE);
|
||||||
progname = *argv;
|
progname = *argv;
|
||||||
while (--argc && (*++argv)[0] == '-' && (*argv)[1]) {
|
while (--argc && (*++argv)[0] == '-' && (*argv)[1]) {
|
||||||
|
@ -208,6 +210,7 @@ main(int argc, char *argv[])
|
||||||
|
|
||||||
case 'r':
|
case 'r':
|
||||||
rflag = 1;
|
rflag = 1;
|
||||||
|
mflag = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'm':
|
case 'm':
|
||||||
|
|
Loading…
Reference in a new issue