code: purgatorio

Download patch

ref: 654935ba71201d7215d9fcd96181a330ec6ff617
parent: 0644aa11c120a581eec1d47c66208e08b946ec08
author: henesy <devnull@localhost>
date: Sun Sep 27 23:39:55 EDT 2020

update arg(2) to show earg(), setusage(), and usage() examples

--- a/man/2/arg
+++ b/man/2/arg
@@ -120,12 +120,15 @@
     bflag := cflag := 0;
     file := "";
     arg->init(args);
+    arg->setusage("prog [-bc] [-f file] args ...");
     while((c := arg->opt()) != 0)
         case c {
         'b' => bflag = 1;
         'c' => cflag = 1;
-        'f' => file = arg->arg();
-        * =>   sys->print("unknown option (%c)\en", c);
+        'f' => file = arg->earg();
+        * =>
+            sys->print("unknown option (%c)\en", c);
+            arg->usage();
         }
     args = arg->argv();
     sys->print("%s %d %d %s\en", arg->progname(), bflag, cflag, file);