-while (($opt = chr(psi\getopt($args, $opts)))) {
- switch ($opt) {
- case "v":
- printf("got v\n");
- break;
- case "x":
- case "s":
- printf("got %s: %s\n", $opt, psi\optarg());
- break;
- default:
- printf("error '%s'\n", $opt);
- case chr(-1):
- break 2;
+for ($i = 0; $i<3; ++$i) {
+ psi\opterr(0);
+ psi\optind\set(1);
+
+ while (($opt = chr(psi\getopt($args, $opts)))) {
+ switch ($opt) {
+ case "v":
+ printf("got v\n");
+ break;
+ case "x":
+ case "s":
+ printf("got %s: %s\n", $opt, psi\optarg());
+ break;
+ default:
+ printf("error '%s'\n", $opt);
+ case chr(-1):
+ break 2;
+ }