luciano de souza wrote 12 lines
Hello listers,
Getopts offers very good features to process commandline arguments. As
far as I could understand, I used it successfully. But it remains one
unknown aspect for me. What is the field "flag"" of TOption record?
How to use it?
TOption = Record
Name : String;
Has_arg : Integer;
Flag : PChar;
Value : Char;
end;
I think the man page for getopt explains best how this is supposed to work:
flag specifies how results are returned for a long option. If flag is NULL, then getopt_long() returns val. (For example, the calling program may set val to the equivalent short option character.) Otherwise, getopt_long() returns 0, and flag points to a variable which is set to val if the option is found, but left unchanged if the option is not found.
Henry