summaryrefslogtreecommitdiffstats
path: root/usr.bin/diff/diff.c
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2004-12-09 18:56:10 +0000
committermillert <millert@openbsd.org>2004-12-09 18:56:10 +0000
commit7bdb251ca794d7fa0900fc962cba0bd9ae2ce98d (patch)
tree6cc2b48f4b2a8641b47410912bd43611cb2d210a /usr.bin/diff/diff.c
parentwhile upgrading, protect deletion in an eval: we've got an extract (diff)
downloadwireguard-openbsd-7bdb251ca794d7fa0900fc962cba0bd9ae2ce98d.tar.xz
wireguard-openbsd-7bdb251ca794d7fa0900fc962cba0bd9ae2ce98d.zip
If the -L option is specified twice, use it for the second filename
like GNU diff does. Adapted from a diff by YAMAMOTO Takashi
Diffstat (limited to 'usr.bin/diff/diff.c')
-rw-r--r--usr.bin/diff/diff.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/usr.bin/diff/diff.c b/usr.bin/diff/diff.c
index 0d16791b4c1..065def887d1 100644
--- a/usr.bin/diff/diff.c
+++ b/usr.bin/diff/diff.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: diff.c,v 1.47 2004/12/07 11:53:29 espie Exp $ */
+/* $OpenBSD: diff.c,v 1.48 2004/12/09 18:56:10 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.47 2004/12/07 11:53:29 espie Exp $";
+static const char rcsid[] = "$OpenBSD: diff.c,v 1.48 2004/12/09 18:56:10 millert Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -43,7 +43,7 @@ static const char rcsid[] = "$OpenBSD: diff.c,v 1.47 2004/12/07 11:53:29 espie E
int aflag, bflag, dflag, iflag, lflag, Nflag, Pflag, pflag, rflag;
int sflag, tflag, Tflag, wflag;
int format, context, status;
-char *start, *ifdefname, *diffargs, *label, *ignore_pats;
+char *start, *ifdefname, *diffargs, *label[2], *ignore_pats;
struct stat stb1, stb2;
struct excludes *excludes_list;
regex_t ignore_re;
@@ -149,7 +149,12 @@ main(int argc, char **argv)
iflag = 1;
break;
case 'L':
- label = optarg;
+ if (label[0] == NULL)
+ label[0] = optarg;
+ else if (label[1] == NULL)
+ label[1] = optarg;
+ else
+ usage();
break;
case 'l':
lflag = 1;