aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexey Zaytsev <alexey.zaytsev@gmail.com>2008-12-17 22:01:17 +0300
committerAlexey Zaytsev <alexey.zaytsev@gmail.com>2008-12-18 20:30:22 +0300
commit4d7c98921a8204501a7c3748dd0c400e469f8356 (patch)
tree64e6a34cd662227232923c8c880501bd6a53a309
parent775c9d92e4f9de1c6611bdbc317fdf2d9210ef18 (diff)
downloadsparse-4d7c98921a8204501a7c3748dd0c400e469f8356.tar.gz
sparse-4d7c98921a8204501a7c3748dd0c400e469f8356.tar.xz
sparse-4d7c98921a8204501a7c3748dd0c400e469f8356.zip
Handle a terminal -o option properly.
Signed-off-by: Alexey Zaytsev <alexey.zaytsev@gmail.com>
-rw-r--r--lib.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib.c b/lib.c
index ea40ce1..665a6b7 100644
--- a/lib.c
+++ b/lib.c
@@ -347,10 +347,13 @@ static char **handle_switch_m(char *arg, char **next)
static char **handle_switch_o(char *arg, char **next)
{
- if (!strcmp (arg, "o") && *next)
- return next + 1; // "-o foo"
- else
- return next; // "-ofoo" or (bogus) terminal "-o"
+ if (!strcmp (arg, "o")) { // "-o foo"
+ if (!*++next)
+ die("argument to '-o' is missing");
+ }
+ // else "-ofoo"
+
+ return next;
}
static const struct warning {