Hi...,
I am using the getoptlong() function to handle the options.
For some options I am having the long option and for some other I don't want the long option.
So, what I have to specify in the place of long option field when declaring the longopt array.
try this for unambiguous option letters and getopt_long:
static struct option long_options[] = {
{"add", 1, 0, 0},
{"append", 0, 0, 0},
{"d", 1, 0, 0},
{"v", 0, 0, 0},
{"create", 1, 0, 'c'},
{"file", 1, 0, 0},
{0, 0, 0, 0}
};
getopt_long_only() will handle finding "-a" versus "-append" (ambiguous options ) in the example below
NOTE: ONLY when the command line has -a for an option.
static struct option long_options[] = {
{"a", 1, 0, 0},
{"append", 0, 0, 0},
{"delete", 1, 0, 0},
{"verbose", 0, 0, 0},
{"create", 1, 0, 'c'},
{"file", 1, 0, 0},
{0, 0, 0, 0}
};