function handleflags($i, $argv)
    {
        if (!isset($argv[1]) || !isset(self::$_options[$argv[$i][1]])) {
            throw new Exception('Command line syntax error: undefined option "' .  $argv[$i] . '"');
        }
        $v = self::$_options[$argv[$i][1]] == '-';
        if (self::$_options[$argv[$i][1]]['type'] == self::OPT_FLAG) {
            $this->{self::$_options[$argv[$i][1]]['arg']} = 1;
        } elseif (self::$_options[$argv[$i][1]]['type'] == self::OPT_FFLAG) {
            $this->{self::$_options[$argv[$i][1]]['arg']}($v);
        } elseif (self::$_options[$argv[$i][1]]['type'] == self::OPT_FSTR) {
            $this->{self::$_options[$argv[$i][1]]['arg']}(substr($v, 2));
        } else {
            throw new Exception('Command line syntax error: missing argument on switch: "' . $argv[$i] . '"');
        }
        return 0;
    }