SYNOPSIS
#include <unistd.h>
extern char *optarg;
extern int optind, opterr, optopt
int getopt(int argc, char * const argv[], const char *optstring);
DESCRIPTION
The
The variable optind is the index of the next element of
argv to be processed.
It is initialized to 1, and
The
-
If the option was the last character in the string pointed to by an element
of argv, optarg contains the next element of
argv, and optind is incremented by 2. If the
resulting value of optind is not less than argc,
this indicates a missing option-argument, and
getopt() returns an error. - Otherwise, optarg points to the string following the option character in that element of argv, and optind is incremented by 1.
PARAMETERS
- argc
-
Is the number of arguments in command line.
- argv
-
Is an array of strings that holds the command line arguments.
- optstring
-
Points to a string of allowable option letters.
RETURN VALUES
The
When
If
Otherwise
CONFORMANCE
POSIX.2 (1992).
MULTITHREAD SAFETY LEVEL
Unsafe.
PORTING ISSUES
Do not declare any of the global variables in your code. Always include the appropriate PTC MKS Toolkit UNIX APIs header file.
AVAILABILITY
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
SEE ALSO
- Functions:
exec()
PTC MKS Toolkit 10.5 Documentation Build 40.