mirror of
https://github.com/swaywm/sway.git
synced 2024-11-23 00:11:28 +00:00
fix force_display_urgency_hint parsing
This commit is contained in:
parent
d25e308f9c
commit
12a9ae013e
|
@ -1,5 +1,6 @@
|
||||||
#include "sway/commands.h"
|
#include "sway/commands.h"
|
||||||
#include "sway/config.h"
|
#include "sway/config.h"
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
struct cmd_results *cmd_force_display_urgency_hint(int argc, char **argv) {
|
struct cmd_results *cmd_force_display_urgency_hint(int argc, char **argv) {
|
||||||
struct cmd_results *error = NULL;
|
struct cmd_results *error = NULL;
|
||||||
|
@ -8,13 +9,16 @@ struct cmd_results *cmd_force_display_urgency_hint(int argc, char **argv) {
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *err;
|
errno = 0;
|
||||||
int timeout = (int)strtol(argv[0], &err, 10);
|
char *end;
|
||||||
if (*err) {
|
int timeout = (int)strtol(argv[0], &end, 10);
|
||||||
if (strcmp(err, "ms") != 0) {
|
if (errno || end == argv[0] || (*end && strcmp(end, "ms") != 0)) {
|
||||||
return cmd_results_new(CMD_INVALID,
|
return cmd_results_new(CMD_INVALID, "timeout integer invalid");
|
||||||
"Expected 'force_display_urgency_hint <timeout> ms'");
|
}
|
||||||
}
|
|
||||||
|
if (argc > 1 && strcmp(argv[1], "ms") != 0) {
|
||||||
|
return cmd_results_new(CMD_INVALID,
|
||||||
|
"Expected 'force_display_urgency_hint <timeout> [ms]'");
|
||||||
}
|
}
|
||||||
|
|
||||||
config->urgent_timeout = timeout > 0 ? timeout : 0;
|
config->urgent_timeout = timeout > 0 ? timeout : 0;
|
||||||
|
|
Loading…
Reference in a new issue