source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: fix base directory detection for makewhatis -t
@ 2017-01-27  1:04 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2017-01-27  1:04 UTC (permalink / raw)
  To: source

Log Message:
-----------
fix base directory detection for makewhatis -t

Modified Files:
--------------
    mdocml:
        mandocdb.c

Revision Data
-------------
Index: mandocdb.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mandocdb.c,v
retrieving revision 1.238
retrieving revision 1.239
diff -Lmandocdb.c -Lmandocdb.c -u -p -r1.238 -r1.239
--- mandocdb.c
+++ mandocdb.c
@@ -872,6 +872,20 @@ filescan(const char *file)
 	}
 
 	/*
+	 * In test mode or when the original name is absolute
+	 * but outside our tree, guess the base directory.
+	 */
+
+	if (op == OP_TEST || (start == buf && *start == '/')) {
+		if (strncmp(buf, "man/", 4) == 0)
+			start = buf + 4;
+		else if ((start = strstr(buf, "/man/")) != NULL)
+			start += 5;
+		else
+			start = buf;
+	}
+
+	/*
 	 * First try to guess our directory structure.
 	 * If we find a separator, try to look for man* or cat*.
 	 * If we find one of these and what's underneath is a directory,
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-01-27  1:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-27  1:04 mdocml: fix base directory detection for makewhatis -t schwarze

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).