Skip to content

Commit

Permalink
Add a new field 'offset' to the struct query_args, fix the API and th…
Browse files Browse the repository at this point in the history
…e usage by apropos.
  • Loading branch information
abhinav-upadhyay committed Sep 6, 2011
1 parent db92354 commit 238eae2
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion apropos-utils.c
Expand Up @@ -537,7 +537,7 @@ run_query(sqlite3 *db, const char *snippet_args[3], query_args *args)
* number of rows
*/
if (nrec) {
easprintf(&temp, "LIMIT %s OFFSET 0", nrec);
easprintf(&temp, "LIMIT %s OFFSET %d", nrec, args->offset);
concat(&sqlstr, temp, strlen(temp));
free(temp);
free(nrec);
Expand Down
1 change: 1 addition & 0 deletions apropos-utils.h
Expand Up @@ -66,6 +66,7 @@ typedef struct query_args {
const char *search_str; // user query
const char **sec_nums; // Section in which to do the search
int nrec; // number of records to fetch
int offset; //From which position to start processing the records
int (*callback) (void *, int, char **, char **); // The callback function
void *callback_data; // data to pass to the callback function
char **errmsg; // buffer for storing the error msg
Expand Down
1 change: 1 addition & 0 deletions apropos.c
Expand Up @@ -143,6 +143,7 @@ main(int argc, char *argv[])
args.search_str = query;
args.sec_nums = aflags.sec_nums;
args.nrec = nrec;
args.offset = 0;
args.callback = &query_callback;
args.callback_data = out;
args.errmsg = &errmsg;
Expand Down

0 comments on commit 238eae2

Please sign in to comment.