diff --git a/usr.bin/diff/diff.h b/usr.bin/diff/diff.h --- a/usr.bin/diff/diff.h +++ b/usr.bin/diff/diff.h @@ -48,6 +48,7 @@ #define D_BRIEF 6 /* Say if the files differ */ #define D_GFORMAT 7 /* Diff with defined changed group format */ #define D_SIDEBYSIDE 8 /* Side by side */ +#define D_QUIET 9 /* Dont output anything */ #define D_UNSET -2 diff --git a/usr.bin/diff/diff.c b/usr.bin/diff/diff.c --- a/usr.bin/diff/diff.c +++ b/usr.bin/diff/diff.c @@ -273,7 +273,10 @@ case 'q': if (FORMAT_MISMATCHED(D_BRIEF)) conflicting_format(); - diff_format = D_BRIEF; + if (diff_format == D_BRIEF) + diff_format = D_QUIET; + else + diff_format = D_BRIEF; break; case 'S': start = optarg; diff --git a/usr.bin/diff/diffreg.c b/usr.bin/diff/diffreg.c --- a/usr.bin/diff/diffreg.c +++ b/usr.bin/diff/diffreg.c @@ -407,7 +407,8 @@ goto closem; } - if (diff_format == D_BRIEF && ignore_pats == NULL && + if ((diff_format == D_BRIEF || diff_format == D_QUIET) && + ignore_pats == NULL && (flags & (D_FOLDBLANKS|D_IGNOREBLANKS|D_IGNORECASE| D_SKIPBLANKLINES|D_STRIPCR)) == 0) { @@ -1094,7 +1095,8 @@ return; } proceed: - if (*pflags & D_HEADER && diff_format != D_BRIEF) { + if (*pflags & D_HEADER && + (diff_format != D_BRIEF && diff_format != D_QUIET)) { printf("%s %s %s\n", diffargs, file1, file2); *pflags &= ~D_HEADER; } @@ -1142,6 +1144,7 @@ anychange = 1; switch (diff_format) { case D_BRIEF: + case D_QUIET: return; case D_NORMAL: case D_EDIT: