diff options
author | Keith Packard <keithp@keithp.com> | 2009-01-06 08:36:39 -0800 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2009-01-06 08:58:53 -0800 |
commit | 4c326c4d342bede0de57e71c1431f56188f812ce (patch) | |
tree | 3c31f594d71e7aad2d2c487f2b208eec208ce531 | |
parent | 1da4a41b0881b605c7cfa4c4bf637efa132c58fc (diff) |
Make cvt complain about invalid arguments more often.
cvt doesn't correctly parse 'cvt -vr 1920 1080'. This patch doesn't fix
that, but it does at least generate an error message now.
Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r-- | hw/xfree86/utils/cvt/cvt.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/hw/xfree86/utils/cvt/cvt.c b/hw/xfree86/utils/cvt/cvt.c index 25a8e3220..500e31f23 100644 --- a/hw/xfree86/utils/cvt/cvt.c +++ b/hw/xfree86/utils/cvt/cvt.c @@ -202,7 +202,7 @@ main (int argc, char *argv[]) if ((argc < 3) || (argc > 7)) { PrintUsage(argv[0]); - return 0; + return 1; } /* This doesn't filter out bad flags properly. Bad flags get passed down @@ -219,15 +219,30 @@ main (int argc, char *argv[]) else if (!strcmp(argv[n], "-h") || !strcmp(argv[n], "--help")) { PrintUsage(argv[0]); return 0; - } else if (!HDisplay) + } else if (!HDisplay) { HDisplay = atoi(argv[n]); - else if (!VDisplay) + if (!HDisplay) { + PrintUsage(argv[0]); + return 1; + } + } + else if (!VDisplay) { VDisplay = atoi(argv[n]); - else if (!VRefresh) + if (!VDisplay) { + PrintUsage(argv[0]); + return 1; + } + } + else if (!VRefresh) { VRefresh = atof(argv[n]); + if (!VRefresh) { + PrintUsage(argv[0]); + return 1; + } + } else { PrintUsage(argv[0]); - return 0; + return 1; } } |