Skip to content

Commit

Permalink
Fix argument requirements.
Browse files Browse the repository at this point in the history
  • Loading branch information
Matlo committed Oct 31, 2014
1 parent d984e82 commit de8fa5c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions core/args.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ int args_read(int argc, char *argv[], s_gimx_params* params)
int ret = 0;
int c;
unsigned char controller = 0;
unsigned char event = 0;
unsigned char input = 0;

struct option long_options[] =
{
Expand Down Expand Up @@ -169,6 +169,7 @@ int args_read(int argc, char *argv[], s_gimx_params* params)
case 'c':
params->config_file = optarg;
printf(_("option -c with value `%s'\n"), optarg);
input = 1;
break;

case 'e':
Expand All @@ -188,7 +189,7 @@ int args_read(int argc, char *argv[], s_gimx_params* params)
printf(_("option -e with value `%s(%d)'\n"), axis_label, value);
adapter_set_axis(controller, axis, value);
adapter_get(controller)->event = 1;
event = 1;
input = 1;
}
else
{
Expand Down Expand Up @@ -232,6 +233,7 @@ int args_read(int argc, char *argv[], s_gimx_params* params)
else
{
printf(_("option -s with value `%s'\n"), optarg);
input = 1;
}
break;

Expand Down Expand Up @@ -338,9 +340,9 @@ int args_read(int argc, char *argv[], s_gimx_params* params)
if(params->window_events)
printf(_("window_events flag is set\n"));

if(!params->config_file && !event)
if(!input)
{
fprintf(stderr, "At least a config file or an event should be specified as argument.\n");
fprintf(stderr, "At least a config file, an event, or a source IP:port should be specified as argument.\n");
ret = -1;
}

Expand Down

0 comments on commit de8fa5c

Please sign in to comment.