Skip to content

Commit 53c3002

Browse files
committed
bin/xbps-query: refactor search
1 parent 4589625 commit 53c3002

File tree

3 files changed

+230
-151
lines changed

3 files changed

+230
-151
lines changed

bin/xbps-query/defs.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ int list_pkgs_pkgdb(struct xbps_handle *);
6464
int repo_list(struct xbps_handle *);
6565

6666
/* from search.c */
67-
int search(struct xbps_handle *, bool, const char *, const char *, bool);
68-
67+
int search(
68+
struct xbps_handle *xhp, bool repo_mode, const char *pattern, bool regex);
69+
int search_prop(struct xbps_handle *xhp, bool repo_mode, const char *prop,
70+
const char *pattern, bool regex);
6971

7072
#endif /* !_XBPS_QUERY_DEFS_H_ */

bin/xbps-query/main.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,10 @@ main(int argc, char **argv)
301301

302302
} else if (pkg_search) {
303303
/* search mode */
304-
rv = search(&xh, repo_mode, pkg, props, regex);
304+
if (props)
305+
rv = search_prop(&xh, repo_mode, pkg, props, regex);
306+
else
307+
rv = search(&xh, repo_mode, pkg, regex);
305308

306309
} else if (catfile) {
307310
/* repo cat file mode */

0 commit comments

Comments
 (0)