aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/diff
diff options
context:
space:
mode:
authorRuss Cox <rsc@swtch.com>2007-11-05 11:09:39 -0500
committerRuss Cox <rsc@swtch.com>2007-11-05 11:09:39 -0500
commiteb5d2a54d5ee79118c8081c7de3409f93e500b54 (patch)
treeebe49506ca94edc461527c51e6ccbbc9b429b76a /src/cmd/diff
parente84044be84489b6f4f9ce69d0d6eba6cac66a9b6 (diff)
downloadplan9port-eb5d2a54d5ee79118c8081c7de3409f93e500b54.tar.gz
plan9port-eb5d2a54d5ee79118c8081c7de3409f93e500b54.tar.bz2
plan9port-eb5d2a54d5ee79118c8081c7de3409f93e500b54.zip
diff: continue after i/o errors when diffing many files
Diffstat (limited to 'src/cmd/diff')
-rw-r--r--src/cmd/diff/diffdir.c13
-rw-r--r--src/cmd/diff/main.c5
2 files changed, 13 insertions, 5 deletions
diff --git a/src/cmd/diff/diffdir.c b/src/cmd/diff/diffdir.c
index c9446d6b..b6c696ab 100644
--- a/src/cmd/diff/diffdir.c
+++ b/src/cmd/diff/diffdir.c
@@ -19,8 +19,10 @@ scandir(char *name)
int nitems;
int fd, n;
- if ((fd = open(name, OREAD)) < 0)
- panic(2, "can't open %s\n", name);
+ if ((fd = open(name, OREAD)) < 0){
+ panic(mflag ? 0 : 2, "can't open %s\n", name);
+ return nil;
+ }
cp = 0;
nitems = 0;
if((n = dirreadall(fd, &db)) > 0){
@@ -63,6 +65,8 @@ diffdir(char *f, char *t, int level)
dt = scandir(t);
dirf = df;
dirt = dt;
+ if(df == nil || dt == nil)
+ goto Out;
while (*df || *dt) {
from = *df;
to = *dt;
@@ -99,9 +103,10 @@ diffdir(char *f, char *t, int level)
diff(fb, tb, level+1);
df++; dt++;
}
- for (df = dirf; *df; df++)
+Out:
+ for (df = dirf; df && *df; df++)
FREE(*df);
- for (dt = dirt; *dt; dt++)
+ for (dt = dirt; dt && *dt; dt++)
FREE(*dt);
FREE(dirf);
FREE(dirt);
diff --git a/src/cmd/diff/main.c b/src/cmd/diff/main.c
index a80f76e1..408ad90f 100644
--- a/src/cmd/diff/main.c
+++ b/src/cmd/diff/main.c
@@ -183,7 +183,9 @@ main(int argc, char *argv[])
char *p;
int i;
Dir *fsb, *tsb;
-
+ extern int _p9usepwlibrary;
+
+ _p9usepwlibrary = 0;
Binit(&stdout, 1, OWRITE);
progname = *argv;
while (--argc && (*++argv)[0] == '-' && (*argv)[1]) {
@@ -208,6 +210,7 @@ main(int argc, char *argv[])
case 'r':
rflag = 1;
+ mflag = 1;
break;
case 'm':