From 44b8447ff073e983bcf91e70559b474c55744e2a Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Sat, 1 Mar 2014 17:25:48 +0100 Subject: trigger: make optional the alignment on second and max calls (in hook timer) --- src/plugins/trigger/trigger-command.c | 3 +-- src/plugins/trigger/trigger.c | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/plugins/trigger/trigger-command.c b/src/plugins/trigger/trigger-command.c index 315757f9d..4a6e5e1a8 100644 --- a/src/plugins/trigger/trigger-command.c +++ b/src/plugins/trigger/trigger-command.c @@ -915,8 +915,7 @@ trigger_command_init () " command: command (required), description, arguments, " "description of arguments, completion\n" " command_run: command (required)\n" - " timer: interval (required), align on second (required), " - "max calls (required)\n" + " timer: interval (required), align on second, max calls\n" " config: name of option (required)\n" " focus: name(s) of area (required)\n" " conditions: evaluated conditions for the trigger\n" diff --git a/src/plugins/trigger/trigger.c b/src/plugins/trigger/trigger.c index 4a580469a..d74c2dda4 100644 --- a/src/plugins/trigger/trigger.c +++ b/src/plugins/trigger/trigger.c @@ -365,14 +365,14 @@ trigger_hook (struct t_trigger *trigger) } break; case TRIGGER_HOOK_TIMER: - if (argv && (argc >= 3)) + if (argv && (argc >= 1)) { error1 = NULL; error2 = NULL; error3 = NULL; interval = strtol (argv[0], &error1, 10); - align_second = strtol (argv[1], &error2, 10); - max_calls = strtol (argv[2], &error3, 10); + align_second = strtol ((argc >= 2) ? argv[1] : "0", &error2, 10); + max_calls = strtol ((argc >= 3) ? argv[2] : "0", &error3, 10); if (error1 && !error1[0] && error2 && !error2[0] && error3 && !error3[0] -- cgit v1.2.3