filteredquery: miscellaneous fixes

* Remove the TFilteredQuery::GetNextDirents() stub as it was preventing the
results from showing

* Fix the getopt string so that a -p argument is recognized

* Move the folder_params declaration out one level so that it doesn't go
out of scope when needed

* Clean up the help output

Change-Id: If37c300b4b67773ffc33fd637c2ef9add3c12275
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6901
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This commit is contained in:
Chris Roberts 2023-09-09 15:06:49 -06:00 committed by waddlesplash
parent f4de95a66b
commit 49f7074b65
3 changed files with 5 additions and 14 deletions

View File

@ -126,14 +126,6 @@ TFilteredQuery::GetNextEntry(BEntry *entry, bool traverse)
}
int32
TFilteredQuery::GetNextDirents(dirent *buf, size_t length, int32 count)
{
// TODO: Implement ?
return 0;
}
status_t
TFilteredQuery::Clear()
{

View File

@ -34,7 +34,6 @@ public:
virtual status_t GetNextRef(entry_ref *ref);
virtual status_t GetNextEntry(BEntry *entry, bool traverse = false);
virtual int32 GetNextDirents(dirent *buf, size_t length, int32 count = INT_MAX);
status_t Clear();

View File

@ -63,10 +63,10 @@ bool o_subfolders = false;
void
usage(void)
{
printf("usage: %s [ -e ] [ -a || -v <path-to-volume> ] expression\n"
printf("usage: %s [ -e ] [ -p <path-to-search> ] [ -s ] [ -a || -v <path-to-volume> ] expression\n"
" -e\t\tdon't escape meta-characters\n"
" -p <path>\tsearch only in the given path\n"
" -s\t\tinclude subfolders (valid only if -p is used)\n"
" -p <path>\tsearch only in the given path. Defaults to the current directory.\n"
" -s\t\tinclude subfolders\n"
" -a\t\tperform the query on all volumes\n"
" -v <file>\tperform the query on just one volume; <file> can be any\n"
"\t\tfile on that volume. Defaults to the current volume.\n"
@ -84,8 +84,8 @@ perform_query(BVolume &volume, const char *predicate, const char *filterpath)
// Set up the volume and predicate for the query.
query.SetVolume(&volume);
query.SetPredicate(predicate);
folder_params options;
if (filterpath != NULL) {
folder_params options;
options.path = filterpath;
options.includeSubFolders = o_subfolders;
query.AddFilter(FilterByFolder, &options);
@ -137,7 +137,7 @@ main(int32 argc, const char **argv)
// Parse command-line arguments.
int opt;
while ((opt = getopt(argc, (char **)argv, "eavsd:")) != -1) {
while ((opt = getopt(argc, (char **)argv, "easv:p:")) != -1) {
switch(opt) {
case 'a':
o_all_volumes = true;