summaryrefslogtreecommitdiffstats
path: root/usr.bin/diff/diff.c
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2003-07-06 22:02:36 +0000
committermillert <millert@openbsd.org>2003-07-06 22:02:36 +0000
commitaeb82612035e635c909e64ee78ff8209bfb3bf4a (patch)
tree5657e05479560713723d58644c28619a4cab42a8 /usr.bin/diff/diff.c
parentknf (cedric did not do it right) (diff)
downloadwireguard-openbsd-aeb82612035e635c909e64ee78ff8209bfb3bf4a.tar.xz
wireguard-openbsd-aeb82612035e635c909e64ee78ff8209bfb3bf4a.zip
Implement -P from GNU diff (like -N but only for files that are missing
from dir1).
Diffstat (limited to 'usr.bin/diff/diff.c')
-rw-r--r--usr.bin/diff/diff.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/usr.bin/diff/diff.c b/usr.bin/diff/diff.c
index 6c570cc98e4..eaaf15c629e 100644
--- a/usr.bin/diff/diff.c
+++ b/usr.bin/diff/diff.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: diff.c,v 1.23 2003/07/06 20:48:59 millert Exp $ */
+/* $OpenBSD: diff.c,v 1.24 2003/07/06 22:02:36 millert Exp $ */
/*
* Copyright (c) 2003 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -21,7 +21,7 @@
*/
#ifndef lint
-static const char rcsid[] = "$OpenBSD: diff.c,v 1.23 2003/07/06 20:48:59 millert Exp $";
+static const char rcsid[] = "$OpenBSD: diff.c,v 1.24 2003/07/06 22:02:36 millert Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -38,13 +38,13 @@ static const char rcsid[] = "$OpenBSD: diff.c,v 1.23 2003/07/06 20:48:59 millert
#include "diff.h"
-int aflag, bflag, iflag, Nflag, rflag, sflag, tflag, wflag;
+int aflag, bflag, iflag, Nflag, Pflag, rflag, sflag, tflag, wflag;
int format, context, status;
char *start, *ifdefname, *diffargs;
struct stat stb1, stb2;
struct excludes *excludes_list;
-#define OPTIONS "abC:cD:efhinNrS:stU:uwX:x:"
+#define OPTIONS "abC:cD:efhinNPrS:stU:uwX:x:"
static struct option longopts[] = {
{ "text", no_argument, 0, 'a' },
{ "ignore-space-change", no_argument, 0, 'b' },
@@ -55,6 +55,7 @@ static struct option longopts[] = {
{ "ignore-case", no_argument, 0, 'i' },
{ "new-file", no_argument, 0, 'N' },
{ "rcs", no_argument, 0, 'n' },
+ { "unidirectional-new-file", no_argument, 0, 'P' },
{ "recursive", no_argument, 0, 'r' },
{ "report-identical-files", no_argument, 0, 's' },
{ "starting-file", required_argument, 0, 'S' },
@@ -121,6 +122,9 @@ main(int argc, char **argv)
case 'n':
format = D_NREVERSE;
break;
+ case 'P':
+ Pflag = 1;
+ break;
case 'r':
rflag = 1;
break;
@@ -314,7 +318,7 @@ usage(void)
" diff [-bitw] -C number file1 file2\n"
" diff [-bitw] -D string file1 file2\n"
" diff [-bitw] -U number file1 file2\n"
- " diff [-biNwt] [-c | -e | -f | -n | -u ] [-r] [-s] [-S name]"
+ " diff [-biNPwt] [-c | -e | -f | -n | -u ] [-r] [-s] [-S name]"
" [-X file]\n [-x pattern] dir1 dir2\n");
exit(2);