shithub: mc

Download patch

ref: dc761f00dc490f161d42dc3f6f442d47f1444fce
parent: 2b9433bff2e1fead347679bcaae825d1c106bc30
author: Ori Bernstein <[email protected]>
date: Sun Dec 14 15:53:31 EST 2014

Fix next() for single char args.

--- a/libstd/optparse.myr
+++ b/libstd/optparse.myr
@@ -64,7 +64,7 @@
 
 	match optinfo(ctx, c)
 	| `None:
-		fatal(1, "Unexpected argument %c\n", c)
+		fatal(1, "Unexpected argument '%c'\n", c)
 	| `Some (true, needed):
 		/* -arg => '-a' 'rg' */
 		if ctx.curarg.len > 0
@@ -82,7 +82,7 @@
 		;;
 	| `Some (false, _):
 		arg = ""
-		if ctx.curarg.len != 0
+		if ctx.curarg.len == 0
 			next(ctx)
 		;;
 	;;