shithub: mc

Download patch

ref: 954ff1977d4345d53a0e1996c7c3b39c51a2d470
parent: effa98dac67fd796ef9414afef330722657e45cb
author: Ori Bernstein <[email protected]>
date: Wed Jun 5 12:10:21 EDT 2013

Improve the test program a tad.

--- a/libstd/test.myr
+++ b/libstd/test.myr
@@ -8,17 +8,21 @@
         var o
 	var a
 
-	std.put("args.len = %i\n", args.len)
-	for i = 0; i < args.len; i++
-		std.put("args[%i] = %s\n", i, args[i])
-	;;
-
-        ctx = std.optinit("asdf:g?", args)
+        ctx = std.optinit("asdf:g?h", args)
 	std.put("arglen = %i\n", ctx.args.len)
         while !std.optdone(ctx)
 		(o, a) = std.optnext(ctx)
+		if o == 'h'
+			usage()
+		;;
 		std.put("option %c, arg = %s\n", o, a)
         ;;
+
+	std.put("args.len = %i\n", args.len)
+	for i = 0; i < args.len; i++
+		std.put("args[%i] = %s\n", i, args[i])
+	;;
+
 	for i = 0; i < ctx.args.len; i++
 		std.put("arg %s\n", ctx.args[i])
 	;;
@@ -85,4 +89,10 @@
 		std.put("r[%i] = %l\n", i, std.rand32(r) castto(int64))
 	;;
 	std.put("\n");
+}
+
+const usage = {
+	std.put("Pokes a bit at the standard library.\n")
+	std.put("Option string is asdf:g?h\n")
+	std.exit(0)
 }