=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mandoc/mansearch.c,v retrieving revision 1.37 retrieving revision 1.38 diff -c -r1.37 -r1.38 *** src/usr.bin/mandoc/mansearch.c 2014/11/18 01:14:40 1.37 --- src/usr.bin/mandoc/mansearch.c 2014/11/27 01:57:42 1.38 *************** *** 1,4 **** ! /* $OpenBSD: mansearch.c,v 1.37 2014/11/18 01:14:40 schwarze Exp $ */ /* * Copyright (c) 2012 Kristaps Dzonsons * Copyright (c) 2013, 2014 Ingo Schwarze --- 1,4 ---- ! /* $OpenBSD: mansearch.c,v 1.38 2014/11/27 01:57:42 schwarze Exp $ */ /* * Copyright (c) 2012 Kristaps Dzonsons * Copyright (c) 2013, 2014 Ingo Schwarze *************** *** 402,408 **** { char *newnames, *prevsec, *prevarch; const char *oldnames, *sep1, *name, *sec, *sep2, *arch, *fsec; - const char *gzip; size_t i; int c; --- 402,407 ---- *************** *** 465,471 **** /* Also save the first file name encountered. */ ! if (NULL != mpage->file) continue; if (form & FORM_SRC) { --- 464,470 ---- /* Also save the first file name encountered. */ ! if (mpage->file != NULL) continue; if (form & FORM_SRC) { *************** *** 475,496 **** sep1 = "cat"; fsec = "0"; } ! if (form & FORM_GZ) ! gzip = ".gz"; ! else ! gzip = ""; ! sep2 = '\0' == *arch ? "" : "/"; ! mandoc_asprintf(&mpage->file, "%s/%s%s%s%s/%s.%s%s", ! path, sep1, sec, sep2, arch, name, fsec, gzip); } ! if (SQLITE_DONE != c) fprintf(stderr, "%s\n", sqlite3_errmsg(db)); sqlite3_reset(s); /* Append one final section to the names. */ ! if (NULL != prevsec) { ! sep2 = '\0' == *prevarch ? "" : "/"; mandoc_asprintf(&newnames, "%s(%s%s%s)", mpage->names, prevsec, sep2, prevarch); free(mpage->names); --- 474,491 ---- sep1 = "cat"; fsec = "0"; } ! sep2 = *arch == '\0' ? "" : "/"; ! mandoc_asprintf(&mpage->file, "%s/%s%s%s%s/%s.%s", ! path, sep1, sec, sep2, arch, name, fsec); } ! if (c != SQLITE_DONE) fprintf(stderr, "%s\n", sqlite3_errmsg(db)); sqlite3_reset(s); /* Append one final section to the names. */ ! if (prevsec != NULL) { ! sep2 = *prevarch == '\0' ? "" : "/"; mandoc_asprintf(&newnames, "%s(%s%s%s)", mpage->names, prevsec, sep2, prevarch); free(mpage->names);