Commit ab94653e authored by Hugh McMaster's avatar Hugh McMaster Committed by Alexandre Julliard

reg: Use is_switch() where possible.

parent 0ad80117
...@@ -361,13 +361,7 @@ static HANDLE get_file_handle(WCHAR *filename, BOOL overwrite_file) ...@@ -361,13 +361,7 @@ static HANDLE get_file_handle(WCHAR *filename, BOOL overwrite_file)
static BOOL is_overwrite_switch(const WCHAR *s) static BOOL is_overwrite_switch(const WCHAR *s)
{ {
if (lstrlenW(s) > 2) return is_switch(s, 'y');
return FALSE;
if ((s[0] == '/' || s[0] == '-') && (s[1] == 'y' || s[1] == 'Y'))
return TRUE;
return FALSE;
} }
int reg_export(int argc, WCHAR *argv[]) int reg_export(int argc, WCHAR *argv[])
......
...@@ -289,7 +289,7 @@ BOOL parse_registry_key(const WCHAR *key, HKEY *root, WCHAR **path, WCHAR **long ...@@ -289,7 +289,7 @@ BOOL parse_registry_key(const WCHAR *key, HKEY *root, WCHAR **path, WCHAR **long
return TRUE; return TRUE;
} }
static BOOL is_switch(const WCHAR *s, const WCHAR c) BOOL is_switch(const WCHAR *s, const WCHAR c)
{ {
if (lstrlenW(s) > 2) if (lstrlenW(s) > 2)
return FALSE; return FALSE;
...@@ -302,10 +302,7 @@ static BOOL is_switch(const WCHAR *s, const WCHAR c) ...@@ -302,10 +302,7 @@ static BOOL is_switch(const WCHAR *s, const WCHAR c)
static BOOL is_help_switch(const WCHAR *s) static BOOL is_help_switch(const WCHAR *s)
{ {
if (is_switch(s, '?') || is_switch(s, 'h')) return (is_switch(s, '?') || is_switch(s, 'h'));
return TRUE;
return FALSE;
} }
enum operations { enum operations {
......
...@@ -40,6 +40,7 @@ BOOL ask_confirm(unsigned int msgid, WCHAR *reg_info); ...@@ -40,6 +40,7 @@ BOOL ask_confirm(unsigned int msgid, WCHAR *reg_info);
HKEY path_get_rootkey(const WCHAR *path); HKEY path_get_rootkey(const WCHAR *path);
WCHAR *build_subkey_path(WCHAR *path, DWORD path_len, WCHAR *subkey_name, DWORD subkey_len); WCHAR *build_subkey_path(WCHAR *path, DWORD path_len, WCHAR *subkey_name, DWORD subkey_len);
BOOL parse_registry_key(const WCHAR *key, HKEY *root, WCHAR **path, WCHAR **long_key); BOOL parse_registry_key(const WCHAR *key, HKEY *root, WCHAR **path, WCHAR **long_key);
BOOL is_switch(const WCHAR *s, const WCHAR c);
/* add.c */ /* add.c */
int reg_add(HKEY root, WCHAR *path, WCHAR *value_name, BOOL value_empty, int reg_add(HKEY root, WCHAR *path, WCHAR *value_name, BOOL value_empty,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment