static int getopt(int argc, char *argv[], char *opts)

{

    static int sp = 1;

    int c;

    char *cp;



    if (sp == 1)

        if (optind >= argc ||

            argv[optind][0] != '-' || argv[optind][1] == '\0')

            return EOF;

        else if (!strcmp(argv[optind], "--")) {

            optind++;

            return EOF;

        }

    optopt = c = argv[optind][sp];

    if (c == ':' || (cp = strchr(opts, c)) == NULL) {

        fprintf(stderr, ": illegal option -- %c\n", c);

        if (argv[optind][++sp] == '\0') {

            optind++;

            sp = 1;

        }

        return '?';

    }

    if (*++cp == ':') {

        if (argv[optind][sp+1] != '\0')

            optarg = &argv[optind++][sp+1];

        else if(++optind >= argc) {

            fprintf(stderr, ": option requires an argument -- %c\n", c);

            sp = 1;

            return '?';

        } else

            optarg = argv[optind++];

        sp = 1;

    } else {

        if (argv[optind][++sp] == '\0') {

            sp = 1;

            optind++;

        }

        optarg = NULL;

    }



    return c;

}

static int getopt(int argc, char *argv[], char *opts)

{

    static int sp = 1;

    int c;

    char *cp;



    if (sp == 1)

        if (optind >= argc ||

            argv[optind][0] != '-' || argv[optind][1] == '\0')

            return EOF;

        else if (!strcmp(argv[optind], "--")) {

            optind++;

            return EOF;

        }

    optopt = c = argv[optind][sp];

    if (c == ':' || (cp = strchr(opts, c)) == NULL) {

        fprintf(stderr, ": illegal option -- %c\n", c);

        if (argv[optind][++sp] == '\0') {

            optind++;

            sp = 1;

        }

        return '?';

    }

    if (*++cp == ':') {

        if (argv[optind][sp+1] != '\0')

            optarg = &argv[optind++][sp+1];

        else if(++optind >= argc) {

            fprintf(stderr, ": option requires an argument -- %c\n", c);

            sp = 1;

            return '?';

        } else

            optarg = argv[optind++];

        sp = 1;

    } else {

        if (argv[optind][++sp] == '\0') {

            sp = 1;

            optind++;

        }

        optarg = NULL;

    }



    return c;

}

static int FUNC_0(int VAR_0, char *VAR_1[], char *VAR_2)

{

    static int VAR_3 = 1;

    int VAR_4;

    char *VAR_5;



    if (VAR_3 == 1)

        if (optind >= VAR_0 ||

            VAR_1[optind][0] != '-' || VAR_1[optind][1] == '\0')

            return EOF;

        else if (!strcmp(VAR_1[optind], "--")) {

            optind++;

            return EOF;

        }

    optopt = VAR_4 = VAR_1[optind][VAR_3];

    if (VAR_4 == ':' || (VAR_5 = strchr(VAR_2, VAR_4)) == NULL) {

        fprintf(stderr, ": illegal option -- %VAR_4\n", VAR_4);

        if (VAR_1[optind][++VAR_3] == '\0') {

            optind++;

            VAR_3 = 1;

        }

        return '?';

    }

    if (*++VAR_5 == ':') {

        if (VAR_1[optind][VAR_3+1] != '\0')

            optarg = &VAR_1[optind++][VAR_3+1];

        else if(++optind >= VAR_0) {

            fprintf(stderr, ": option requires an argument -- %VAR_4\n", VAR_4);

            VAR_3 = 1;

            return '?';

        } else

            optarg = VAR_1[optind++];

        VAR_3 = 1;

    } else {

        if (VAR_1[optind][++VAR_3] == '\0') {

            VAR_3 = 1;

            optind++;

        }

        optarg = NULL;

    }



    return VAR_4;

}

static int FUNC_0(int VAR_0, char *VAR_1[], char *VAR_2)
{ static int VAR_3 = 1; int VAR_4; char *VAR_5; if (VAR_3 == 1)
if (optind >= VAR_0 ||
VAR_1[optind][0] != '-' || VAR_1[optind][1] == '\0')
return EOF; else if (!strcmp(VAR_1[optind], "--")) { optind++; return EOF; } optopt = VAR_4 = VAR_1[optind][VAR_3]; if (VAR_4 == ':' || (VAR_5 = strchr(VAR_2, VAR_4)) == NULL) { fprintf(stderr, ": illegal option -- %VAR_4\n", VAR_4); if (VAR_1[optind][++VAR_3] == '\0') { optind++; VAR_3 = 1; } return '?'; } if (*++VAR_5 == ':') { if (VAR_1[optind][VAR_3+1] != '\0')
optarg = &VAR_1[optind++][VAR_3+1]; else if(++optind >= VAR_0) { fprintf(stderr, ": option requires an argument -- %VAR_4\n", VAR_4); VAR_3 = 1; return '?'; } else optarg = VAR_1[optind++]; VAR_3 = 1; } else { if (VAR_1[optind][++VAR_3] == '\0') { VAR_3 = 1; optind++; } optarg = NULL; } return VAR_4; }