summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2016-11-05 16:35:32 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2016-11-05 16:35:32 +0000
commit304107c793e7da2ff7480477d42c382918153f90 (patch)
tree8a96656bc2e637da50de5f9a55d678cfc4e7df94 /regress
parent665367c7654fcd461f2563503a84e53f0cc22613 (diff)
don't skip names that match the beginning of the file name;
joint work with bcook@
Diffstat (limited to 'regress')
-rw-r--r--regress/usr.bin/mandoc/db/mlinks/mlinks.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/regress/usr.bin/mandoc/db/mlinks/mlinks.c b/regress/usr.bin/mandoc/db/mlinks/mlinks.c
index f3e56fe10e0..9fa0543042d 100644
--- a/regress/usr.bin/mandoc/db/mlinks/mlinks.c
+++ b/regress/usr.bin/mandoc/db/mlinks/mlinks.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mlinks.c,v 1.1 2016/11/04 19:57:27 schwarze Exp $ */
+/* $OpenBSD: mlinks.c,v 1.2 2016/11/05 16:35:31 schwarze Exp $ */
/*
* Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
*
@@ -33,7 +33,7 @@ main(int argc, char *argv[])
const char *np; /* Names of the page. */
const char *fp; /* Primary filename of the page. */
const char *ep; /* Filname extension including the dot. */
- size_t nlen;
+ size_t flen, nlen;
int32_t i, npages;
if (argc != 2)
@@ -67,6 +67,7 @@ main(int argc, char *argv[])
ep = strrchr(fp, '/');
if (ep != NULL)
fp = ep + 1;
+ flen = ep - fp;
ep = strrchr(fp, '.');
if (ep == NULL)
@@ -79,7 +80,7 @@ main(int argc, char *argv[])
/* Skip the primary filename. */
nlen = strlen(np);
- if (strncmp(fp, np, nlen) == 0) {
+ if (nlen == flen && strncmp(fp, np, nlen) == 0) {
np = strchr(np, '\0') + 1;
continue;
}