static char sccsid
[] = "@(#)getopt.c 4.2 (Berkeley) 82/11/06";
#define ERR(s, c) if(opterr){\
getopt (argc
, argv
, opts
)
argv
[optind
][0] != '-' || argv
[optind
][1] == '\0')
else if (strcmp(argv
[optind
], "--") == NULL
) {
optopt
= c
= argv
[optind
][sp
];
if (c
== ':' || (cp
=index(opts
, c
)) == NULL
) {
ERR (": illegal option -- ", c
);
if (argv
[optind
][++sp
] == '\0') {
if (argv
[optind
][sp
+1] != '\0')
optarg
= &argv
[optind
++][sp
+1];
else if (++optind
>= argc
) {
ERR (": option requires an argument -- ", c
);
if (argv
[optind
][++sp
] == '\0') {