mirror of
https://github.com/NickHu/sway
synced 2024-12-30 22:23:30 +01:00
2a684cad5f
Patch tested by compiling with `__attribute__ ((format (printf, 2, 3)))` applied to `cmd_results_new`. String usage constants have been converted from pointers to arrays when encountered. General handler format strings were sometimes modified to include the old input string, especially for unknown command errors.
23 lines
585 B
C
23 lines
585 B
C
#include "sway/commands.h"
|
|
#include "sway/config.h"
|
|
|
|
struct cmd_results *cmd_force_display_urgency_hint(int argc, char **argv) {
|
|
struct cmd_results *error = NULL;
|
|
if ((error = checkarg(argc, "force_display_urgency_hint",
|
|
EXPECTED_AT_LEAST, 1))) {
|
|
return error;
|
|
}
|
|
|
|
char *err;
|
|
int timeout = (int)strtol(argv[0], &err, 10);
|
|
if (*err) {
|
|
if (strcmp(err, "ms") != 0) {
|
|
return cmd_results_new(CMD_INVALID,
|
|
"Expected 'force_display_urgency_hint <timeout> ms'");
|
|
}
|
|
}
|
|
|
|
config->urgent_timeout = timeout > 0 ? timeout : 0;
|
|
|
|
return cmd_results_new(CMD_SUCCESS, NULL);
|
|
}
|