configure: add --enable-psi-maintainer-mode
[m6w6/ext-psi] / psi.d / getopt.psi
index 5e1e427ce50cec30c22d678b954bb9815c4e131b..ac7fd738c098d2c11bd208a89b4d9108caae985b 100644 (file)
@@ -1,9 +1,13 @@
 function psi\opterr(int $value) : void {
-       let _v = intval($value);
+       let opterr = intval($value);
        return void(opterr_set);
 }
-function psi\optind() : int {
-       return to_int(optind);
+function psi\optind\get() : int {
+       return to_int(optind_get);
+}
+function psi\optind\set(int $v) : void {
+       let optind = intval($v);
+       return void(optind_set);
 }
 function psi\optopt() : int {
        return to_int(optopt);
@@ -11,15 +15,22 @@ function psi\optopt() : int {
 function psi\optarg() : string {
        return to_string(optarg);
 }
-
-function psi\getopt(array &$argv, string $options) : int {
+/* OSX
+function psi\optreset() : void {
+       let _v = 1;
+       return void(optreset_set);
+}
+*/
+static function psi\getopt(array &$argv, string $options) : int {
        let argc = count($argv);
        let argv = &arrval($argv,
                *argv = strval($argv)
        );
        let optstring = strval($options);
-       return to_int(getopt); 
-       set $argv = to_array(argv,
-               to_string(argv)
+       return to_int(getopt);
+       set $argv = to_array(
+               *argv,
+               argc,
+               to_string(*argv)
        );
 }