Commit 79253688 authored by Daniel Salzman's avatar Daniel Salzman

Program parameters processing unification

parent c86c4efb
......@@ -266,11 +266,11 @@ int main(int argc, char **argv)
/* Long options. */
struct option opts[] = {
{ "config", required_argument, 0, 'c' },
{ "confdb", required_argument, 0, 'C' },
{ "daemonize", optional_argument, 0, 'd' },
{ "help", no_argument, 0, 'h' },
{ "version", no_argument, 0, 'V' },
{ "config", required_argument, NULL, 'c' },
{ "confdb", required_argument, NULL, 'C' },
{ "daemonize", optional_argument, NULL, 'd' },
{ "help", no_argument, NULL, 'h' },
{ "version", no_argument, NULL, 'V' },
{ NULL }
};
......
......@@ -327,8 +327,8 @@ int zs_set_input_file(
* \note Error code is stored in the scanner context.
*
* \param scanner Scanner context.
* \param process_record Processing callback function.
* \param process_error Error callback function.
* \param process_record Processing callback function (may be NULL).
* \param process_error Error callback function (may be NULL).
* \param data Arbitrary data useful in callback functions.
*
* \retval 0 if success.
......
......@@ -134,22 +134,21 @@ int state_parsing(
int main(int argc, char *argv[])
{
// Parsed command line arguments.
int c = 0, li = 0, ret;
int mode = DEFAULT_MODE, state = 0, test = 0;
// Command line long options.
struct option opts[] = {
{ "mode", required_argument, 0, 'm' },
{ "state", no_argument, 0, 's' },
{ "test", no_argument, 0, 't' },
{ "help", no_argument, 0, 'h' },
{ 0, 0, 0, 0 }
{ "mode", required_argument, NULL, 'm' },
{ "state", no_argument, NULL, 's' },
{ "test", no_argument, NULL, 't' },
{ "help", no_argument, NULL, 'h' },
{ NULL }
};
// Command line options processing.
while ((c = getopt_long(argc, argv, "m:sth", opts, &li)) != -1) {
switch (c) {
// Parsed command line arguments.
int opt = 0, li = 0;
while ((opt = getopt_long(argc, argv, "m:sth", opts, &li)) != -1) {
switch (opt) {
case 'm':
mode = atoi(optarg);
break;
......@@ -200,6 +199,7 @@ int main(int argc, char *argv[])
}
// Set the processing mode.
int ret;
switch (mode) {
case 0:
ret = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment