[PATCH v4 0/1] MR9975: where: Add quiet mode.
Fixes Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=59234 -- v4: where: Add quiet mode. https://gitlab.winehq.org/wine/wine/-/merge_requests/9975
From: Thomas Csovcsity <thc.fr13nd@gmail.com> --- programs/where/main.c | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/programs/where/main.c b/programs/where/main.c index 3307ace1f45..4b83f9ead8c 100644 --- a/programs/where/main.c +++ b/programs/where/main.c @@ -25,9 +25,11 @@ WINE_DEFAULT_DEBUG_CHANNEL(where); +#define OPT_QUIET 0x00000001 + static BOOL found; -static void search(const WCHAR *search_path, const WCHAR *pattern) +static void search(const WCHAR *search_path, const WCHAR *pattern, DWORD flags) { static const WCHAR *extensions[] = {L"", L".bat", L".cmd", L".com", L".exe"}; WCHAR glob[MAX_PATH]; @@ -56,7 +58,8 @@ static void search(const WCHAR *search_path, const WCHAR *pattern) { if (PathCombineW(match_path, search_path, match.cFileName)) { - printf("%ls\n", match_path); + if(!(flags & OPT_QUIET)) + printf("%ls\n", match_path); found = TRUE; } } @@ -69,13 +72,25 @@ static void search(const WCHAR *search_path, const WCHAR *pattern) int __cdecl wmain(int argc, WCHAR *argv[]) { WCHAR *pattern, *colon, *search_paths, *search_path, *next_search_path; + DWORD flags = 0; int i; - for (i = 0; i < argc; i++) + for (i = 1; i < argc; i++) { - if (argv[i][0] == '/') + if (argv[i][0] == '/' && wcslen(argv[i]) == 2) + { + switch(toupper(argv[i][1])) + { + case 'Q': flags |= OPT_QUIET; break; + default: + FIXME("Unsupported option %s\n", wine_dbgstr_w(argv[i])); + return 1; + + } + } + else if (argv[i][0] == '/') { - FIXME("Unsupported option %ls\n", argv[i]); + FIXME("Unsupported option %s\n", wine_dbgstr_w(argv[i])); return 1; } } @@ -104,17 +119,18 @@ int __cdecl wmain(int argc, WCHAR *argv[]) /* If the search paths were not explicitly specified, search the current directory first */ WCHAR current_dir[MAX_PATH]; if (GetCurrentDirectoryW(ARRAY_SIZE(current_dir), current_dir)) - search(current_dir, pattern); + search(current_dir, pattern, flags); } next_search_path = wcsdup(search_paths); while ((search_path = wcstok(NULL, L";", &next_search_path))) - search(search_path, pattern); + search(search_path, pattern, flags); } if (!found) { - fputs("File not found\n", stderr); + if(!(flags & OPT_QUIET)) + fputs("File not found\n", stderr); return 1; } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9975
On Wed Jan 28 19:47:22 2026 +0000, Thomas Csovcsity wrote:
changed this line in [version 4 of the diff](/wine/wine/-/merge_requests/9975/diffs?diff_id=240798&start_sha=84ff7223c30eb07c8951a129cdbada9bbeb3b47e#4cd83d135efc7c3438e8bd4841e19b2fd8eabb52_93_93) Done
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/9975#note_128300
On Wed Jan 28 19:47:22 2026 +0000, Thomas Csovcsity wrote:
changed this line in [version 4 of the diff](/wine/wine/-/merge_requests/9975/diffs?diff_id=240798&start_sha=84ff7223c30eb07c8951a129cdbada9bbeb3b47e#4cd83d135efc7c3438e8bd4841e19b2fd8eabb52_86_86) Done
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/9975#note_128301
eric pouech (@epo) commented about programs/where/main.c:
{ if (PathCombineW(match_path, search_path, match.cFileName)) { - printf("%ls\n", match_path); + if(!(flags & OPT_QUIET))
nitpick: please keep style consistent with the rest of the file. 'if' isn't a function, so add a space between 'if' and '(' -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9975#note_128513
participants (3)
-
eric pouech (@epo) -
Thomas Csovcsity -
Thomas Csovcsity (@thc13)