version 1.6, 2011/11/17 14:52:32 |
version 1.7, 2011/11/18 01:10:03 |
|
|
#include "mandoc.h" |
#include "mandoc.h" |
|
|
static int cmp(const void *, const void *); |
static int cmp(const void *, const void *); |
static void list(struct rec *, size_t, void *); |
static void list(struct res *, size_t, void *); |
static void usage(void); |
static void usage(void); |
|
|
static char *progname; |
static char *progname; |
|
|
|
|
if (use_man_conf) |
if (use_man_conf) |
man_conf_parse(&dirs); |
man_conf_parse(&dirs); |
apropos_search(dirs.argc, dirs.argv, &opts, |
ch = apropos_search(dirs.argc, dirs.argv, &opts, |
e, terms, NULL, list); |
e, terms, NULL, list); |
|
|
man_conf_free(&dirs); |
man_conf_free(&dirs); |
exprfree(e); |
exprfree(e); |
return(EXIT_SUCCESS); |
if (0 == ch) |
|
fprintf(stderr, "%s: Database error\n", progname); |
|
return(ch ? EXIT_SUCCESS : EXIT_FAILURE); |
} |
} |
|
|
/* ARGSUSED */ |
/* ARGSUSED */ |
static void |
static void |
list(struct rec *res, size_t sz, void *arg) |
list(struct res *res, size_t sz, void *arg) |
{ |
{ |
int i; |
int i; |
|
|
qsort(res, sz, sizeof(struct rec), cmp); |
qsort(res, sz, sizeof(struct res), cmp); |
|
|
for (i = 0; i < (int)sz; i++) |
for (i = 0; i < (int)sz; i++) |
printf("%s(%s%s%s) - %s\n", res[i].title, |
printf("%s(%s%s%s) - %s\n", res[i].title, |
|
|
cmp(const void *p1, const void *p2) |
cmp(const void *p1, const void *p2) |
{ |
{ |
|
|
return(strcmp(((const struct rec *)p1)->title, |
return(strcmp(((const struct res *)p1)->title, |
((const struct rec *)p2)->title)); |
((const struct res *)p2)->title)); |
} |
} |
|
|
static void |
static void |
|
|
"[-m path] " |
"[-m path] " |
"[-S arch] " |
"[-S arch] " |
"[-s section] " |
"[-s section] " |
"EXPR\n", |
"expression...\n", |
progname); |
progname); |
} |
} |