Hugh McMaster : regedit: Replace error_unknown_switch() with simpler error handling.

Alexandre Julliard julliard at winehq.org
Thu Jun 23 11:15:24 CDT 2016


Module: wine
Branch: master
Commit: 7e72247d07014feb61843f24c4e45c4177b7825f
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=7e72247d07014feb61843f24c4e45c4177b7825f

Author: Hugh McMaster <hugh.mcmaster at outlook.com>
Date:   Wed Jun 22 12:02:56 2016 +0000

regedit: Replace error_unknown_switch() with simpler error handling.

Signed-off-by: Hugh McMaster <hugh.mcmaster at outlook.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 programs/regedit/regedit.c | 24 ++++--------------------
 1 file changed, 4 insertions(+), 20 deletions(-)

diff --git a/programs/regedit/regedit.c b/programs/regedit/regedit.c
index 2cbd4bb..050a031 100644
--- a/programs/regedit/regedit.c
+++ b/programs/regedit/regedit.c
@@ -230,24 +230,6 @@ static BOOL PerformRegAction(REGEDIT_ACTION action, LPSTR s)
     return TRUE;
 }
 
-/**
- * Process unknown switch.
- *
- * Params:
- *   chu - the switch character in upper-case.
- *   s - the command line string where s points to the switch character.
- */
-static void error_unknown_switch(char chu, char *s)
-{
-    if (isalpha(chu)) {
-        fprintf(stderr,"%s: Undefined switch /%c!\n", getAppName(), chu);
-    } else {
-        fprintf(stderr,"%s: Alphabetic character is expected after '%c' "
-                "in switch specification\n", getAppName(), *(s - 1));
-    }
-    exit(1);
-}
-
 BOOL ProcessCmdLine(LPSTR lpCmdLine)
 {
     REGEDIT_ACTION action = ACTION_UNDEF;
@@ -284,7 +266,8 @@ BOOL ProcessCmdLine(LPSTR lpCmdLine)
                     exit(0);
                     break;
                 default:
-                    error_unknown_switch(chu, s);
+                    fprintf(stderr, "regedit: Invalid or unrecognized switch [/%c]\n", chu);
+                    exit(1);
                     break;
                 }
             }
@@ -301,7 +284,8 @@ BOOL ProcessCmdLine(LPSTR lpCmdLine)
                     }
                     break;
                 default:
-                    error_unknown_switch(chu, s);
+                    fprintf(stderr, "regedit: Invalid or unrecognized switch [/%c]\n", chu);
+                    exit(1);
                     break;
                 }
             } else {




More information about the wine-cvs mailing list