=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/mandoc/Attic/apropos.c,v retrieving revision 1.6 retrieving revision 1.7 diff -c -r1.6 -r1.7 *** src/usr.bin/mandoc/Attic/apropos.c 2011/11/17 14:52:32 1.6 --- src/usr.bin/mandoc/Attic/apropos.c 2011/11/18 01:10:03 1.7 *************** *** 1,4 **** ! /* $Id: apropos.c,v 1.6 2011/11/17 14:52:32 schwarze Exp $ */ /* * Copyright (c) 2011 Kristaps Dzonsons * --- 1,4 ---- ! /* $Id: apropos.c,v 1.7 2011/11/18 01:10:03 schwarze Exp $ */ /* * Copyright (c) 2011 Kristaps Dzonsons * *************** *** 26,32 **** #include "mandoc.h" static int cmp(const void *, const void *); ! static void list(struct rec *, size_t, void *); static void usage(void); static char *progname; --- 26,32 ---- #include "mandoc.h" static int cmp(const void *, const void *); ! static void list(struct res *, size_t, void *); static void usage(void); static char *progname; *************** *** 91,111 **** if (use_man_conf) man_conf_parse(&dirs); ! apropos_search(dirs.argc, dirs.argv, &opts, e, terms, NULL, list); man_conf_free(&dirs); exprfree(e); ! return(EXIT_SUCCESS); } /* ARGSUSED */ static void ! list(struct rec *res, size_t sz, void *arg) { int i; ! qsort(res, sz, sizeof(struct rec), cmp); for (i = 0; i < (int)sz; i++) printf("%s(%s%s%s) - %s\n", res[i].title, --- 91,113 ---- if (use_man_conf) man_conf_parse(&dirs); ! ch = apropos_search(dirs.argc, dirs.argv, &opts, e, terms, NULL, list); man_conf_free(&dirs); exprfree(e); ! if (0 == ch) ! fprintf(stderr, "%s: Database error\n", progname); ! return(ch ? EXIT_SUCCESS : EXIT_FAILURE); } /* ARGSUSED */ static void ! list(struct res *res, size_t sz, void *arg) { int i; ! qsort(res, sz, sizeof(struct res), cmp); for (i = 0; i < (int)sz; i++) printf("%s(%s%s%s) - %s\n", res[i].title, *************** *** 119,126 **** cmp(const void *p1, const void *p2) { ! return(strcmp(((const struct rec *)p1)->title, ! ((const struct rec *)p2)->title)); } static void --- 121,128 ---- cmp(const void *p1, const void *p2) { ! return(strcmp(((const struct res *)p1)->title, ! ((const struct res *)p2)->title)); } static void *************** *** 132,137 **** "[-m path] " "[-S arch] " "[-s section] " ! "EXPR\n", progname); } --- 134,139 ---- "[-m path] " "[-S arch] " "[-s section] " ! "expression...\n", progname); }