diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2017-01-27 01:04:25 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2017-01-27 01:04:25 +0000 |
commit | f4f3ff2a22776dac1056b1df38593aada770e186 (patch) | |
tree | 3a2b0909af5a84c68b0185584fb80ddace13aa9f /mandocdb.c | |
parent | d82b8844224205bec613a0e8017033b2b8f7058f (diff) | |
download | mandoc-f4f3ff2a22776dac1056b1df38593aada770e186.tar.gz |
fix base directory detection for makewhatis -t
Diffstat (limited to 'mandocdb.c')
-rw-r--r-- | mandocdb.c | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -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, |