2023-11-16 04:38:29 +01:00
|
|
|
#ifndef BLOCK_H
|
|
|
|
#define BLOCK_H
|
2023-10-24 05:14:31 +02:00
|
|
|
|
|
|
|
#include <bits/stdint-uintn.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
#include "util.h"
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
const char *const command;
|
|
|
|
const unsigned int interval;
|
|
|
|
const int signal;
|
|
|
|
|
|
|
|
int pipe[PIPE_FD_COUNT];
|
|
|
|
char output[MAX_BLOCK_OUTPUT_LENGTH * UTF8_MAX_BYTE_COUNT + 1];
|
|
|
|
pid_t fork_pid;
|
|
|
|
} block;
|
|
|
|
|
2023-10-25 16:30:08 +02:00
|
|
|
block block_new(const char *const command, const unsigned int interval,
|
|
|
|
const int signal);
|
2023-10-24 05:14:31 +02:00
|
|
|
int block_init(block *const block);
|
|
|
|
int block_deinit(block *const block);
|
|
|
|
int block_execute(block *const block, const uint8_t button);
|
|
|
|
int block_update(block *const block);
|
|
|
|
bool block_must_run(const block *const block, const unsigned int time);
|
2023-11-16 04:38:29 +01:00
|
|
|
|
|
|
|
#endif // BLOCK_H
|