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