ref: f1eaa84bca784511be2b98c4f82a858c42110b4d
parent: fb8caa10ab63d72b0ffadd4a6ce592db13672958
author: henesy <unknown>
date: Sun Sep 27 16: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);