uninstaller: Add help switch and usage information
Hugh McMaster
hugh.mcmaster at outlook.com
Wed Aug 19 01:20:32 CDT 2015
---
programs/uninstaller/main.c | 9 ++++++++-
programs/uninstaller/resource.h | 2 ++
programs/uninstaller/uninstaller.rc | 9 +++++++++
3 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/programs/uninstaller/main.c b/programs/uninstaller/main.c
index a9aae73..5717675 100644
--- a/programs/uninstaller/main.c
+++ b/programs/uninstaller/main.c
@@ -161,6 +161,7 @@ static void RemoveSpecificProgram(WCHAR *nameW)
int wmain(int argc, WCHAR *argv[])
{
LPCWSTR token = NULL;
+ static const WCHAR helpW[] = { '-','-','h','e','l','p',0 };
static const WCHAR listW[] = { '-','-','l','i','s','t',0 };
static const WCHAR removeW[] = { '-','-','r','e','m','o','v','e',0 };
int i = 1;
@@ -169,8 +170,14 @@ int wmain(int argc, WCHAR *argv[])
{
token = argv[i++];
+ if (!lstrcmpW(token, helpW))
+ {
+ output_message(STRING_HEADER);
+ output_message(STRING_USAGE);
+ return 0;
+ }
/* Handle requests just to list the applications */
- if( !lstrcmpW( token, listW ) )
+ else if (!lstrcmpW(token, listW))
{
ListUninstallPrograms();
return 0;
diff --git a/programs/uninstaller/resource.h b/programs/uninstaller/resource.h
index f617b2a..72ba160 100644
--- a/programs/uninstaller/resource.h
+++ b/programs/uninstaller/resource.h
@@ -26,5 +26,7 @@
#define STRING_NO_APP_MATCH 2000
#define STRING_PARAMETER_REQUIRED 2001
#define STRING_INVALID_OPTION 2002
+#define STRING_HEADER 2003
+#define STRING_USAGE 2004
#define MAX_STRING_LEN 255
diff --git a/programs/uninstaller/uninstaller.rc b/programs/uninstaller/uninstaller.rc
index e408b91..dec670b 100644
--- a/programs/uninstaller/uninstaller.rc
+++ b/programs/uninstaller/uninstaller.rc
@@ -30,4 +30,13 @@ STRINGTABLE {
STRING_NO_APP_MATCH, "uninstaller: The application with GUID '%1' was not found\n"
STRING_PARAMETER_REQUIRED, "uninstaller: The option '--remove' must be followed by an application GUID\n"
STRING_INVALID_OPTION, "uninstaller: Invalid option [%1]\n"
+ STRING_HEADER, "Wine Application Uninstaller\n\n"
+ STRING_USAGE, "Usage:\n\
+\ uninstaller [options]\n\n\
+\Options:\n\
+\ --help\t Display this information.\n\
+\ --list\t List all programs installed in this Wine prefix.\n\
+\ --remove {GUID} Uninstall the specified application.\n\
+\t\t Use '--list' to obtain the application {GUID}.\n\
+\ [no option] Run the graphical version of this program.\n\n"
}
--
1.9.1
More information about the wine-patches
mailing list