struct option { const char *name; int has_arg; int *flag; int val;};
static struct option long_options[] = { {"add", required_argument, 0, 0 }, {"append", no_argument, 0, 0 }, {"create", required_argument, 0, 'c'}, {0, 0, 0, 0 }
long_options dd offset szAdd, 1, 0, 0, offset szAppend, 0, 0, 0, offset szCreate, 1, 0, offset szC, 0, 0, 0, 0
long_options dd szAdd, 1, 0, 0, szAppend, 0, 0, 0, szCreate, 1, 0, 0, 0, 0, 0, 0
Let me answer my own question:Code: [Select]long_options dd szAdd, 1, 0, 0, szAppend, 0, 0, 0, szCreate, 1, 0, 0, 0, 0, 0, 0Works just fine. But I still would like to know how to use that structure.
struc option .name: resd 1 .has_arg: resd 1 .flag: resd 1 .val: resd 1endstruc
static struct option long_options[] = { {"add", required_argument, 0, 0 }, {"append", no_argument, 0, 0 }, {"create", required_argument, 0, 'c'}, {0, 0, 0, 0 };
%define required_argument 1%define no_argument 0long_options:long_options_0: istruc option at option.name, dd szAdd at option.has_name, dd required_argument at option.flag, dd 0 at option.val, dd 0 iendlong_options_1: istruc option at option.name, dd szAppend at option.has_name, dd no_argument at option.flag, dd 0 at option.val, dd 0 iendlong_options_2: istruc option at option.name, dd szCreate at option.has_name, dd required_argument at option.flag, dd 0 at option.val, dd 0x00000063 iendlong_options_3: istruc option at option.name, dd 0 at option.has_name, dd 0 at option.flag, dd 0 at option.val, dd 0 iend