changeset 76:0ca7343edec0 misc

Parse -s option correctly.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 09 Apr 2010 20:50:10 +0000
parents c4bb202b5cc4
children ece6f3a45ee1
files magestats.pl
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/magestats.pl	Fri Apr 09 18:22:25 2010 +0000
+++ b/magestats.pl	Fri Apr 09 20:50:10 2010 +0000
@@ -76,6 +76,14 @@
     $opt_prefix = shift or die("-p option requires an argument.\n");
   } elsif ($opt eq "-n") {
     $opt_noinput = 1;
+  } elsif ($opt eq "-s") {
+    my $tmp = shift or die("-s option requires an argument.\n");
+    if ($tmp =~ /^(\d+)[x:](\d+)$/) {
+      $opt_width = $1;
+      $opt_height = $2;
+    } else {
+      die("-s option expects WxH, for example 320x200.\n");
+    }
   }
 }