NAME

run_query_html - run a query against /var/db/man.db and returns the results in HTML format

SYNOPSIS



int run_query_html(sqlite3 *db, query_args *args)

DESCRIPTION

The run_query_html() is very much similar to run_query() but with the following two differences.

  1. run_query_html takes only two arguments.

  2. run_query_html will return a single column result set, unlike run_query(3) which returns a 5 column result set.

  3. The value returned by run_query_html in the callback function is in HTML format, enclosed between <p> and </p> tags.
For more details, refer to the manual page of run_query(3).

RETURN VALUES

On successful execution the run_query_html() function will return 0 and in case of an error -1 will be returned.

FILES

/var/db/man.db
The Sqlite FTS database which contains an index of the manual pages.

EXAMPLES

Following is a code excerpt of how run_query_html can be used.
#include 
query_args args;
char *errmsg = NULL;
const char **sec_nums = {NULL, "2", "3", NULL, NULL, NULL, NULL, NULL, NULL};
args.search_str = argv[1];
args.sec_nums = sec_nums;
args.nrec = "10";
args.callback = &query_callback;
args.callback_data = NULL;
args.errmsg = &errmsg;
if (run_query(db, &args) < 0)
                errx(EXIT_FAILURE, "%s", errmsg);
}
        

free(query); free(errmsg);

static int query_callback(void *data, int ncol, char **col_values, char **col_names) { char *html_result = col_values[0]; fprintf(stdout, "%s\n", html_result); return 0; }

SEE ALSO

apropos-utils(3), close_db(3), init_db(3), run_query(3), run_query_pager(3)

AUTHORS

Abhinav Upadhyay

Get NetBSD Summer of Code projects at SourceForge.net. Fast, secure and Free Open Source software downloads
Abhinav Upadhyay <er.abhinav.upadhyay at gmail dot com>
$Id: run_query_html.html3,v 1.2 2011/08/25 06:52:59 abhinavupadhyay Exp $