summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuigi Gangitano <luigi@debian.org>2010-02-01 19:45:21 +0100
committerDave Airlie <airlied@redhat.com>2010-02-08 15:32:28 +1000
commit1c638ad1ef262bc6162f87389a425652fc437808 (patch)
tree0d33666a228e0d22a4c2abfb0a7d0a62b5caa098
parentcdadd2753aa792649ac6853e3ca5771ed5a02158 (diff)
radeontool: parse command options reliably
Signed-off-by: Luigi Gangitano <luigi@debian.org> Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r--radeontool.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/radeontool.c b/radeontool.c
index ca2785b..f7f2b23 100644
--- a/radeontool.c
+++ b/radeontool.c
@@ -26,8 +26,8 @@
#include "radeon_reg.h"
-int debug;
-int skip;
+int debug = 0;
+int skip = 0;
/* *radeon_cntl_mem is mapped to the actual device's memory mapped control area. */
/* Not the address but what it points to is volatile. */
@@ -2697,14 +2697,17 @@ int main(int argc,char *argv[])
map_radeon_cntl_mem();
usage();
}
- if(strcmp(argv[1],"--debug") == 0) {
- debug=1;
- argv++; argc--;
- };
- if(argc > 1 && strcmp(argv[1],"--skip=") == 0) {
- skip=atoi(argv[1]+7);
- argv++; argc--;
- };
+ while (argc >= 2) {
+ if(strcmp(argv[1],"--debug") == 0) {
+ debug=1;
+ argv++; argc--;
+ } else if (strncmp(argv[1],"--skip=", 7) == 0) {
+ skip=atoi(argv[1]+7);
+ argv++; argc--;
+ } else {
+ break;
+ }
+ }
map_radeon_cntl_mem();
if(argc == 2) {
if(strcmp(argv[1],"regs") == 0) {