version 1.357, 2021/09/04 12:52:57 |
version 1.359, 2021/10/04 20:24:06 |
Line 132 main(int argc, char *argv[]) |
|
Line 132 main(int argc, char *argv[]) |
|
struct mparse *mp; /* Opaque parser object. */ |
struct mparse *mp; /* Opaque parser object. */ |
const char *conf_file; /* -C: alternate config file. */ |
const char *conf_file; /* -C: alternate config file. */ |
const char *os_s; /* -I: Operating system for display. */ |
const char *os_s; /* -I: Operating system for display. */ |
const char *progname, *sec; |
const char *progname, *sec, *ep; |
char *defpaths; /* -M: override manpaths. */ |
char *defpaths; /* -M: override manpaths. */ |
char *auxpaths; /* -m: additional manpaths. */ |
char *auxpaths; /* -m: additional manpaths. */ |
char *oarg; /* -O: output option string. */ |
char *oarg; /* -O: output option string. */ |
Line 516 main(int argc, char *argv[]) |
|
Line 516 main(int argc, char *argv[]) |
|
memcpy(res + ressz, resn, |
memcpy(res + ressz, resn, |
sizeof(*resn) * resnsz); |
sizeof(*resn) * resnsz); |
ressz += resnsz; |
ressz += resnsz; |
|
free(resn); |
|
resn = NULL; |
|
resnsz = 0; |
continue; |
continue; |
} |
} |
|
|
Line 536 main(int argc, char *argv[]) |
|
Line 539 main(int argc, char *argv[]) |
|
sec++; /* Prefer without suffix. */ |
sec++; /* Prefer without suffix. */ |
if (*sec != '/') |
if (*sec != '/') |
prio += 10; /* Wrong dir name. */ |
prio += 10; /* Wrong dir name. */ |
if (search.sec != NULL && |
if (search.sec != NULL) { |
(strlen(sec) <= ssz + 3 || |
ep = strchr(sec, '\0'); |
strcmp(sec + strlen(sec) - ssz, |
if (ep - sec > 3 && |
search.sec) != 0)) |
strncmp(ep - 3, ".gz", 3) == 0) |
prio += 20; /* Wrong file ext. */ |
ep -= 3; |
|
if ((size_t)(ep - sec) < ssz + 3 || |
|
strncmp(ep - ssz, search.sec, |
|
ssz) != 0) /* Wrong file */ |
|
prio += 20; /* extension. */ |
|
} |
if (prio >= best_prio) |
if (prio >= best_prio) |
continue; |
continue; |
best_prio = prio; |
best_prio = prio; |
Line 549 main(int argc, char *argv[]) |
|
Line 557 main(int argc, char *argv[]) |
|
res = mandoc_reallocarray(res, ressz + 1, |
res = mandoc_reallocarray(res, ressz + 1, |
sizeof(*res)); |
sizeof(*res)); |
memcpy(res + ressz++, resn + ib, sizeof(*resn)); |
memcpy(res + ressz++, resn + ib, sizeof(*resn)); |
|
memset(resn + ib, 0, sizeof(*resn)); |
|
mansearch_free(resn, resnsz); |
|
resn = NULL; |
|
resnsz = 0; |
} |
} |
|
|
/* apropos(1), whatis(1): Process the full search expression. */ |
/* apropos(1), whatis(1): Process the full search expression. */ |