bug-parted
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Abort on invalid options.


From: bensberg
Subject: [PATCH] Abort on invalid options.
Date: Thu, 05 Apr 2007 12:51:24 +0200

From: Benno Schulenberg <address@hidden>

---
 parted/parted.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/parted/parted.c b/parted/parted.c
index 4107ae0..74a5a41 100644
--- a/parted/parted.c
+++ b/parted/parted.c
@@ -2259,7 +2259,7 @@ _version ()
 static int
 _parse_options (int* argc_ptr, char*** argv_ptr)
 {
-int     opt;
+int     opt, wrong = 0;
 
 while (1)
 {
@@ -2274,9 +2274,13 @@ while (1)
                 case 'm': opt_machine_mode = 1; break;
                 case 's': opt_script_mode = 1; break;
                 case 'v': _version (); break;
+                case '?': wrong = 1; break;
         }
 }
 
+if (wrong == 1)
+        return 0;
+
 *argc_ptr -= optind;
 *argv_ptr += optind;
 return 1;
-- 
1.4.4.4





reply via email to

[Prev in Thread] Current Thread [Next in Thread]