summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorMartijn van Duren <martijn@cvs.openbsd.org>2018-10-23 08:41:46 +0000
committerMartijn van Duren <martijn@cvs.openbsd.org>2018-10-23 08:41:46 +0000
commit1fbd0b1e1bd4c05bac2d41ff89e83a58cd10b2e6 (patch)
tree31c8462d3aa82392ba59f68023c2ba70d451a58a /usr.bin
parente2273658516db78ddb1348aecb70defac3890063 (diff)
Allow us to join on NULL columns. This is similar to what the other
implementations do and new behaviour was most likely added by accident in r1.4. OK otto@
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/join/join.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/usr.bin/join/join.c b/usr.bin/join/join.c
index 173deacba96..c4e829918b4 100644
--- a/usr.bin/join/join.c
+++ b/usr.bin/join/join.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: join.c,v 1.29 2018/10/18 09:36:48 otto Exp $ */
+/* $OpenBSD: join.c,v 1.30 2018/10/23 08:41:45 martijn Exp $ */
/*-
* Copyright (c) 1991, 1993, 1994
@@ -362,10 +362,10 @@ int
cmp(LINE *lp1, u_long fieldno1, LINE *lp2, u_long fieldno2)
{
if (lp1->fieldcnt <= fieldno1)
- return (-1);
- else if (lp2->fieldcnt <= fieldno2)
- return (1);
- return (strcmp(lp1->fields[fieldno1], lp2->fields[fieldno2]));
+ return lp2->fieldcnt <= fieldno2 ? 0 : -1;
+ if (lp2->fieldcnt <= fieldno2)
+ return 1;
+ return strcmp(lp1->fields[fieldno1], lp2->fields[fieldno2]);
}
void