version 1.7, 2011/11/17 14:52:32 |
version 1.8, 2011/11/17 15:02:29 |
|
|
*db, /* keyword database */ |
*db, /* keyword database */ |
*hash; /* temporary keyword hashtable */ |
*hash; /* temporary keyword hashtable */ |
BTREEINFO info; /* btree configuration */ |
BTREEINFO info; /* btree configuration */ |
recno_t maxrec; /* supremum of all records */ |
recno_t maxrec; /* last record number in the index */ |
recno_t *recs; /* buffer of empty records */ |
recno_t *recs; /* the numbers of all empty records */ |
size_t sz1, sz2, |
size_t sz1, sz2, |
recsz, /* buffer size of recs */ |
recsz, /* number of allocated slots in recs */ |
reccur; /* valid number of recs */ |
reccur; /* current number of empty records */ |
struct buf buf, /* keyword buffer */ |
struct buf buf, /* keyword buffer */ |
dbuf; /* description buffer */ |
dbuf; /* description buffer */ |
struct of *of; /* list of files for processing */ |
struct of *of; /* list of files for processing */ |
|
|
if (NULL == db) { |
if (NULL == db) { |
perror(fbuf); |
perror(fbuf); |
exit((int)MANDOCLEVEL_SYSERR); |
exit((int)MANDOCLEVEL_SYSERR); |
} else if (NULL == db) { |
} else if (NULL == idx) { |
perror(ibuf); |
perror(ibuf); |
exit((int)MANDOCLEVEL_SYSERR); |
exit((int)MANDOCLEVEL_SYSERR); |
} |
} |
|
|
if (NULL == db) { |
if (NULL == db) { |
perror(fbuf); |
perror(fbuf); |
exit((int)MANDOCLEVEL_SYSERR); |
exit((int)MANDOCLEVEL_SYSERR); |
} else if (NULL == db) { |
} else if (NULL == idx) { |
perror(ibuf); |
perror(ibuf); |
exit((int)MANDOCLEVEL_SYSERR); |
exit((int)MANDOCLEVEL_SYSERR); |
} |
} |
|
|
continue; |
continue; |
|
|
/* |
/* |
* Make sure the manual section and architecture |
* By default, skip a file if the manual section |
* agree with the directory where the file is located |
* and architecture given in the file disagree |
* or man(1) will not be able to find it. |
* with the directory where the file is located. |
*/ |
*/ |
|
|
msec = NULL != mdoc ? |
msec = NULL != mdoc ? |
|
|
arch = ""; |
arch = ""; |
|
|
/* |
/* |
* Case is relevant for man(1), so use the file name |
* By default, skip a file if the title given |
* instead of the (usually) all caps page title, |
* in the file disagrees with the file name. |
* if the two agree. |
* If both agree, use the file name as the title, |
|
* because the one in the file usually is all caps. |
*/ |
*/ |
|
|
mtitle = NULL != mdoc ? |
mtitle = NULL != mdoc ? |
|
|
for (i = 0; i < argc; i++) { |
for (i = 0; i < argc; i++) { |
|
|
/* |
/* |
* Analyze the path. |
* Try to infer the manual section, architecture and |
|
* page title from the path, assuming it looks like |
|
* man*[/<arch>]/<title>.<section> |
*/ |
*/ |
|
|
if (strlcpy(buf, argv[i], sizeof(buf)) >= sizeof(buf)) { |
if (strlcpy(buf, argv[i], sizeof(buf)) >= sizeof(buf)) { |
|
|
arch = parch; |
arch = parch; |
|
|
/* |
/* |
* Don't bother parsing directories |
* By default, only use directories called: |
* that man(1) won't find. |
* man<section>/[<arch>/] |
*/ |
*/ |
|
|
if (NULL == sec) { |
if (NULL == sec) { |
|
|
continue; |
continue; |
|
|
/* |
/* |
* Don't bother parsing files that man(1) won't find. |
* By default, skip files where the file name suffix |
|
* does not agree with the section directory |
|
* they are located in. |
*/ |
*/ |
|
|
suffix = strrchr(fn, '.'); |
suffix = strrchr(fn, '.'); |
|
|
nof->sec = mandoc_strdup(psec); |
nof->sec = mandoc_strdup(psec); |
if (NULL != parch) |
if (NULL != parch) |
nof->arch = mandoc_strdup(parch); |
nof->arch = mandoc_strdup(parch); |
|
|
|
/* |
|
* Remember the file name without the extension, |
|
* to be used as the page title in the database. |
|
*/ |
|
|
if (NULL != suffix) |
if (NULL != suffix) |
*suffix = '\0'; |
*suffix = '\0'; |
nof->title = mandoc_strdup(fn); |
nof->title = mandoc_strdup(fn); |