10 static const PLLongOpt optArray
[] = {
11 { "longa", 'a' , PR_TRUE
},
12 { "longb", 'b' , PR_TRUE
},
13 { "longc", 'c' , PR_FALSE
},
14 { "longd", 'd' | 0x100, PR_TRUE
},
15 { "longe", 'e' | 0x100, PR_FALSE
},
20 main(int argc
, char **argv
)
25 opt
= PL_CreateLongOptState(argc
, argv
, "a:b:c", optArray
);
27 while (PL_OPT_OK
== (ostat
= PL_GetNextOpt(opt
))) {
28 if (opt
->option
== 0 && opt
->longOptIndex
< 0)
29 printf("Positional parameter: \"%s\"\n", opt
->value
);
31 printf("%s option: %x (\'%c\', index %d), argument: \"%s\"\n",
32 (ostat
== PL_OPT_BAD
) ? "BAD" : "GOOD",
33 opt
->longOption
, opt
->option
? opt
->option
: ' ',
34 opt
->longOptIndex
, opt
->value
);
37 printf("last result was %s\n", (ostat
== PL_OPT_BAD
) ? "BAD" : "EOL");
38 PL_DestroyOptState(opt
);