![]() |
![]()
| ![]() |
![]()
NAME
SYNOPSIS#include <agar/core.h> DESCRIPTIONThe INTERFACEint
The
If a character is followed by ":" in optstring then a string is expected to follow the option character in the command-line arguments. This string is returned into pOptArg, if not NULL. The index of the last argument processed by
On platforms where command-line arguments are not
supported,
EXAMPLESThe following program uses static int debug = 0; int main(int argc, char *argv[]) { char *optArg, *filename; int c, optInd, i; while ((c = AG_Getopt(argc, argv, "df:?h", &optArg, &optInd)) != -1) { switch (c) { case 'd': debug = 1; break; case 'f': filename = optArg; break; default: printf("Usage: my-program [-d] " "[-f filename] [...]\n") return (1); } } for (i = optInd; i < argc; i++) printf("Extra argument: %s\n", argv[i]); return (0); } SEE ALSOHISTORYThe
|