version 1.49.2.3, 2013/09/17 23:07:22 |
version 1.49.2.8, 2013/10/05 20:30:05 |
|
|
#include <string.h> |
#include <string.h> |
#include <unistd.h> |
#include <unistd.h> |
|
|
#if defined(__linux__) |
#if defined(__linux__) || defined(__sun) |
# include <endian.h> |
# include <endian.h> |
# include <db_185.h> |
# include <db_185.h> |
#elif defined(__APPLE__) |
#elif defined(__APPLE__) |
# include <libkern/OSByteOrder.h> |
# include <libkern/OSByteOrder.h> |
# include <db.h> |
# include <db.h> |
#else |
#else |
|
# include <sys/endian.h> |
# include <db.h> |
# include <db.h> |
#endif |
#endif |
|
|
|
#if defined(__sun) |
|
#include <sys/stat.h> |
|
#endif |
|
|
#include "man.h" |
#include "man.h" |
#include "mdoc.h" |
#include "mdoc.h" |
#include "mandoc.h" |
#include "mandoc.h" |
Line 299 main(int argc, char *argv[]) |
|
Line 304 main(int argc, char *argv[]) |
|
int ch, i, flags; |
int ch, i, flags; |
DB *hash; /* temporary keyword hashtable */ |
DB *hash; /* temporary keyword hashtable */ |
BTREEINFO info; /* btree configuration */ |
BTREEINFO info; /* btree configuration */ |
size_t sz1, sz2; |
size_t sz1, sz2, ipath; |
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 */ |
Line 482 main(int argc, char *argv[]) |
|
Line 487 main(int argc, char *argv[]) |
|
} else |
} else |
manpath_parse(&dirs, dir, NULL, NULL); |
manpath_parse(&dirs, dir, NULL, NULL); |
|
|
for (i = 0; i < dirs.sz; i++) { |
for (ipath = 0; ipath < dirs.sz; ipath++) { |
|
|
/* |
/* |
* Go to the root of the respective manual tree. |
* Go to the root of the respective manual tree. |
Line 490 main(int argc, char *argv[]) |
|
Line 495 main(int argc, char *argv[]) |
|
* They are indexed relative to the root. |
* They are indexed relative to the root. |
*/ |
*/ |
|
|
if (-1 == chdir(dirs.paths[i])) { |
if (-1 == chdir(dirs.paths[ipath])) { |
perror(dirs.paths[i]); |
perror(dirs.paths[ipath]); |
exit((int)MANDOCLEVEL_SYSERR); |
exit((int)MANDOCLEVEL_SYSERR); |
} |
} |
|
|
Line 615 index_merge(const struct of *of, struct mparse *mp, |
|
Line 620 index_merge(const struct of *of, struct mparse *mp, |
|
uint64_t vbuf[2]; |
uint64_t vbuf[2]; |
char type; |
char type; |
|
|
|
static char emptystring[] = ""; |
|
|
if (warnings) { |
if (warnings) { |
files = NULL; |
files = NULL; |
hash_reset(&files); |
hash_reset(&files); |
Line 733 index_merge(const struct of *of, struct mparse *mp, |
|
Line 740 index_merge(const struct of *of, struct mparse *mp, |
|
val.data = NULL; |
val.data = NULL; |
val.size = 0; |
val.size = 0; |
if (0 == skip) |
if (0 == skip) |
val.data = ""; |
val.data = emptystring; |
else { |
else { |
ch = (*files->get)(files, &key, &val, 0); |
ch = (*files->get)(files, &key, &val, 0); |
if (ch < 0) { |
if (ch < 0) { |
Line 1747 ofile_argbuild(int argc, char *argv[], struct of **of, |
|
Line 1754 ofile_argbuild(int argc, char *argv[], struct of **of, |
|
* Recursively build up a list of files to parse. |
* Recursively build up a list of files to parse. |
* We use this instead of ftw() and so on because I don't want global |
* We use this instead of ftw() and so on because I don't want global |
* variables hanging around. |
* variables hanging around. |
* This ignores the mandocdb.db and mandocdb.index files, but assumes that |
* This ignores the mandoc.db and mandoc.index files, but assumes that |
* everything else is a manual. |
* everything else is a manual. |
* Pass in a pointer to a NULL structure for the first invocation. |
* Pass in a pointer to a NULL structure for the first invocation. |
*/ |
*/ |
Line 1756 ofile_dirbuild(const char *dir, const char* psec, cons |
|
Line 1763 ofile_dirbuild(const char *dir, const char* psec, cons |
|
int p_src_form, struct of **of) |
int p_src_form, struct of **of) |
{ |
{ |
char buf[PATH_MAX]; |
char buf[PATH_MAX]; |
|
#if defined(__sun) |
|
struct stat sb; |
|
#endif |
size_t sz; |
size_t sz; |
DIR *d; |
DIR *d; |
const char *fn, *sec, *arch; |
const char *fn, *sec, *arch; |
Line 1778 ofile_dirbuild(const char *dir, const char* psec, cons |
|
Line 1788 ofile_dirbuild(const char *dir, const char* psec, cons |
|
|
|
src_form = p_src_form; |
src_form = p_src_form; |
|
|
|
#if defined(__sun) |
|
stat(dp->d_name, &sb); |
|
if (S_IFDIR & sb.st_mode) { |
|
#else |
if (DT_DIR == dp->d_type) { |
if (DT_DIR == dp->d_type) { |
|
#endif |
sec = psec; |
sec = psec; |
arch = parch; |
arch = parch; |
|
|
Line 1835 ofile_dirbuild(const char *dir, const char* psec, cons |
|
Line 1850 ofile_dirbuild(const char *dir, const char* psec, cons |
|
continue; |
continue; |
} |
} |
|
|
|
#if defined(__sun) |
|
if (0 == S_IFREG & sb.st_mode) { |
|
#else |
if (DT_REG != dp->d_type) { |
if (DT_REG != dp->d_type) { |
|
#endif |
if (warnings) |
if (warnings) |
fprintf(stderr, |
fprintf(stderr, |
"%s/%s: not a regular file\n", |
"%s/%s: not a regular file\n", |