Quote:
Originally Posted by bsdplus
with getopt, I thought all arguments passed on on command line have to be processed by it and it would be treated as error if more arguments are passed than it would expect.
|
getopt(3) will only process what it is instructed to interpret.
Recognize that the example I provided is limited in the way that
optind was used. Here, all command-line parameters understood by
getopt(3) had to be provided first. This is not a limitation by
getopt(3) itself; it is merely a limitation imposed by how
optind was being used to distinguish which parameters were not processed by
getopt(3). A more complicated scheme could be implemented which would allow any kind of ordering, but that would be more involved than a twenty line example.