- if (rc >= MANDOCLEVEL_FATAL) {
- fprintf(stderr, "fatal mandoc error: %s/%s\n",
- req->q.manpath, file);
- pg_error_internal();
- return;
- }
-
- snprintf(opts, sizeof(opts), "fragment,man=%s?"
- "manpath=%s&query=%%N&sec=%%S%s%s",
- scriptname, req->q.manpath,
- req->q.arch ? "&arch=" : "",
- req->q.arch ? req->q.arch : "");
-
- mparse_result(mp, &mdoc, &man, NULL);
- if (NULL == man && NULL == mdoc) {
+ memset(&conf, 0, sizeof(conf));
+ conf.fragment = 1;
+ usepath = strcmp(req->q.manpath, req->p[0]);
+ mandoc_asprintf(&conf.man, "%s?query=%%N&sec=%%S%s%s%s%s",
+ scriptname,
+ req->q.arch ? "&arch=" : "",
+ req->q.arch ? req->q.arch : "",
+ usepath ? "&manpath=" : "",
+ usepath ? req->q.manpath : "");
+
+ mparse_result(mp, &man, NULL);
+ if (man == NULL) {