Get rid of all global variables

This commit is contained in:
Utkarsh Verma 2023-10-25 20:00:08 +05:30
commit 10f7d9b8db
No known key found for this signature in database
GPG key ID: 7A4885A7162BDF20
13 changed files with 121 additions and 69 deletions

View file

@ -14,6 +14,20 @@
#include "config.h"
#include "util.h"
block block_new(const char *const command, const unsigned int interval,
const int signal) {
block block = {
.command = command,
.interval = interval,
.signal = signal,
.output = {[0] = '\0'},
.fork_pid = -1,
};
return block;
}
int block_init(block *const block) {
if (pipe(block->pipe) != 0) {
(void)fprintf(stderr,
@ -22,8 +36,6 @@ int block_init(block *const block) {
return 1;
}
block->fork_pid = -1;
return 0;
}