5 int main(int argc
, char **argv
) {
10 struct opttype opts
[] = {
11 {"debug", 'd', OPTTYPE_BOOL
, &debug
},
12 {"name", 'n', OPTTYPE_STRING
, &name
},
13 {"boat", 'b', OPTTYPE_FLOAT
, &boat
},
16 fetchopts(&argc
, &argv
, opts
);
19 printf("Did debug.\n");
22 printf("Hi. My name is %s. What's yours?\n", name
);
24 printf("My boat is %f feet long. How about yours?\n", boat
);
26 printf("Looks like I have %d argument%s left over. Fancy that now!\n", argc
, (argc
== 1) ? "" : "s");
29 printf("They are:\n");
30 for (int i
= 1; i
<= argc
; i
++) {
31 printf("* %s\n", argv
[i
]);