=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mandoc/mandocdb.c,v retrieving revision 1.37 retrieving revision 1.38 diff -c -r1.37 -r1.38 *** src/usr.bin/mandoc/mandocdb.c 2012/01/09 23:21:47 1.37 --- src/usr.bin/mandoc/mandocdb.c 2012/01/15 16:31:05 1.38 *************** *** 1,4 **** ! /* $Id: mandocdb.c,v 1.37 2012/01/09 23:21:47 schwarze Exp $ */ /* * Copyright (c) 2011 Kristaps Dzonsons * Copyright (c) 2011 Ingo Schwarze --- 1,4 ---- ! /* $Id: mandocdb.c,v 1.38 2012/01/15 16:31:05 schwarze Exp $ */ /* * Copyright (c) 2011 Kristaps Dzonsons * Copyright (c) 2011 Ingo Schwarze *************** *** 643,664 **** } /* ! * By default, skip a file if the manual section ! * given in the file disagrees with the directory ! * where the file is located. */ skip = 0; assert(of->sec); assert(msec); ! if (strcasecmp(msec, of->sec)) { ! if (warnings) fprintf(stderr, "%s: " "section \"%s\" manual " "in \"%s\" directory\n", fn, msec, of->sec); - skip = 1; - } /* * Manual page directories exist for each kernel --- 643,666 ---- } /* ! * Check whether the manual section given in a file ! * agrees with the directory where the file is located. ! * Some manuals have suffixes like (3p) on their ! * section number either inside the file or in the ! * directory name, some are linked into more than one ! * section, like encrypt(1) = makekey(8). Do not skip ! * manuals for such reasons. */ skip = 0; assert(of->sec); assert(msec); ! if (warnings) ! if (strcasecmp(msec, of->sec)) fprintf(stderr, "%s: " "section \"%s\" manual " "in \"%s\" directory\n", fn, msec, of->sec); /* * Manual page directories exist for each kernel *************** *** 677,705 **** assert(of->arch); assert(march); ! if (strcasecmp(march, of->arch)) { ! if (warnings) fprintf(stderr, "%s: " "architecture \"%s\" manual " "in \"%s\" directory\n", fn, march, of->arch); - march = of->arch; - } /* * By default, skip a file if the title given * in the file disagrees with the file name. * Do not warn, this happens for all MLINKs. - * If both agree, use the file name as the title, - * because the one in the file usually is all caps. */ assert(of->title); assert(mtitle); if (strcasecmp(mtitle, of->title)) skip = 1; - else - mtitle = of->title; /* * Build a title string for the file. If it matches --- 679,701 ---- assert(of->arch); assert(march); ! if (warnings) ! if (strcasecmp(march, of->arch)) fprintf(stderr, "%s: " "architecture \"%s\" manual " "in \"%s\" directory\n", fn, march, of->arch); /* * By default, skip a file if the title given * in the file disagrees with the file name. * Do not warn, this happens for all MLINKs. */ assert(of->title); assert(mtitle); if (strcasecmp(mtitle, of->title)) skip = 1; /* * Build a title string for the file. If it matches *************** *** 749,766 **** /* * The index record value consists of a nil-terminated * filename, a nil-terminated manual section, and a ! * nil-terminated description. Since the description ! * may not be set, we set a sentinel to see if we're ! * going to write a nil byte in its place. */ dbuf->len = 0; type = mdoc ? 'd' : (man ? 'a' : 'c'); buf_appendb(dbuf, &type, 1); buf_appendb(dbuf, fn, strlen(fn) + 1); ! buf_appendb(dbuf, msec, strlen(msec) + 1); ! buf_appendb(dbuf, mtitle, strlen(mtitle) + 1); ! buf_appendb(dbuf, march, strlen(march) + 1); sv = dbuf->len; --- 745,764 ---- /* * The index record value consists of a nil-terminated * filename, a nil-terminated manual section, and a ! * nil-terminated description. Use the actual ! * location of the file, such that the user can find ! * it with man(1). Since the description may not be ! * set, we set a sentinel to see if we're going to ! * write a nil byte in its place. */ dbuf->len = 0; type = mdoc ? 'd' : (man ? 'a' : 'c'); buf_appendb(dbuf, &type, 1); buf_appendb(dbuf, fn, strlen(fn) + 1); ! buf_appendb(dbuf, of->sec, strlen(of->sec) + 1); ! buf_appendb(dbuf, of->title, strlen(of->title) + 1); ! buf_appendb(dbuf, of->arch, strlen(of->arch) + 1); sv = dbuf->len; *************** *** 782,787 **** --- 780,793 ---- if (NULL == mdb->db || NULL == mdb->idx) continue; + + /* + * Make sure the file name is always registered + * as an .Nm search key. + */ + buf->len = 0; + buf_append(buf, of->title); + hash_put(hash, buf, TYPE_Nm); /* * Reclaim an empty index record, if available.