diff options
| author | onelin <oscar@nelin.dk> | 2026-05-01 20:13:44 +0000 |
|---|---|---|
| committer | onelin <oscar@nelin.dk> | 2026-05-01 20:13:44 +0000 |
| commit | f60fd8c98463a2847acf5a7d0c76c61d24d44ef4 (patch) | |
| tree | 603963538bd33d06ffa9199a494bbb2f11f14b75 /status_ctl.c | |
| parent | 88bc9994370779c4578f5843ee4e5c35e58b10dc (diff) | |
clang-format -i status_ctl.c
Diffstat (limited to 'status_ctl.c')
| -rw-r--r-- | status_ctl.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/status_ctl.c b/status_ctl.c index e4abda8..0016b93 100644 --- a/status_ctl.c +++ b/status_ctl.c @@ -1,18 +1,18 @@ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <errno.h> #include <err.h> +#include <errno.h> #include <fcntl.h> #include <mqueue.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include "config.h" -int main (int argc, char* argv[]) { +int +main(int argc, char* argv[]) { struct message_t msg = {.action = nop, .element = ELEMENT_INVALID}; char* queue_identifier; - if (argc != 3) { errx(EXIT_FAILURE, "Invalid argument(s): %s ACTION ELEMENT\n", argv[0]); } @@ -23,13 +23,13 @@ int main (int argc, char* argv[]) { errx(EXIT_FAILURE, "Invalid action\n"); } -#define ELEMENT(name, _arg, _minutes, _seconds) \ - else if (!strcmp(argv[2], #name)) { \ - msg.element = ELEMENT_##name; \ +#define ELEMENT(name, _arg, _minutes, _seconds) \ + else if (!strcmp(argv[2], #name)) { \ + msg.element = ELEMENT_##name; \ } if (!strcmp(argv[2], "all")) { - msg.element = ELEMENT_MAX; \ + msg.element = ELEMENT_MAX; } #include "config.def.h" #undef ELEMENT @@ -37,13 +37,12 @@ int main (int argc, char* argv[]) { errx(EXIT_FAILURE, "Invalid element\n"); } - queue_identifier = "/status"; + queue_identifier = "/status"; mqd_t msg_queue_id = mq_open(queue_identifier, O_WRONLY); if (msg_queue_id == -1) { errx(EXIT_FAILURE, "Failed to open mq\n"); } - if (mq_send(msg_queue_id, (char*)&msg, sizeof(struct message_t), 0) == -1) { err(EXIT_FAILURE, "Failed to send message\n"); } |
