summaryrefslogtreecommitdiff
path: root/sample/getopts.test
diff options
context:
space:
mode:
Diffstat (limited to 'sample/getopts.test')
-rwxr-xr-xsample/getopts.test31
1 files changed, 31 insertions, 0 deletions
diff --git a/sample/getopts.test b/sample/getopts.test
new file mode 100755
index 0000000..16f1bb0
--- /dev/null
+++ b/sample/getopts.test
@@ -0,0 +1,31 @@
+#! /mp/free/bin/ruby -- -*- ruby -*-
+
+load("parsearg.rb")
+
+def usage()
+ printf("Usage:\n")
+ printf("This is Getopt test program \n")
+end
+
+$USAGE = 'usage'
+parseArgs(0, !nil, "d", "x:", "y:", "version", "geometry:")
+if ($OPT_d)
+ if ($OPT_x)
+ printf("x = %d\n", $OPT_x.atoi)
+ end
+ if ($OPT_y)
+ printf("y = %d\n", $OPT_y.atoi)
+ end
+ if ($OPT_geometry)
+ printf("geometry = %s\n", $OPT_geometry)
+ end
+end
+
+if ($OPT_version)
+ printf("version 1.00\n")
+end
+
+while ($ARGV.length != 0)
+ print ("other = ", $ARGV[0], "\n")
+ $ARGV.shift
+end