Syntax | #include <unistd.h> int getopt(int argc, char * const argv[ ], const char *optstring); | |
Description |
conventions for entering commands defined in the XPG4 specification (see the manual "POSIX Commands" [2]. The remaining guidelines are the responsibility of the application.
argc is the argument count, as passed to argv points to an array of argc optstring is a string of recognized option characters (see the manual "POSIX Commands" [2]). If a character in this string is followed by a colon (:), the option is expected to take one or more arguments.
| |
Return val. | Next option character from the command line | |
upon successful completion. | ||
: | if an option-argument is missing and the first character in optstring was a colon; | |
? | if an option character that is not contained in optstring is found or if an option-argument is missing and the first character in optstring was not a colon or if the next option character is the question mark (?) from the command line. In these cases, An error has occurred only if the | |
-1 | if argv | |
-1 | if argv | |
Notes |
Multiple options cannot be combined if the last option requires an argument. For example, if BS2000 If the integer value returned by | |
See also |
|