Added argument parser and set all logs to STDERR

This commit is contained in:
Nikita Tyukalov, ASUS, Linux
2026-03-24 20:44:22 +03:00
parent 1cc2ef41d1
commit c8b0a5fe5a
5 changed files with 170 additions and 17 deletions

View File

@@ -23,7 +23,7 @@ static struct epoll_event _evs[MAX_EPOLL_EVENTS];
bool loop_init(loop_cb_t callback) {
_efd = epoll_create1(0);
if (_efd == -1) {
printf("[!] epoll_create1 failed: %d\n", errno);
fprintf(stderr, "[!] epoll_create1 failed: %d\n", errno);
return false;
}
_cb = callback;
@@ -36,7 +36,7 @@ void loop_deinit() {
bool loop_ctl(int op, int fd, struct epoll_event *event) {
if (epoll_ctl(_efd, op, fd, event) == -1) {
printf("[!] epoll_ctl failed: %d\n", errno);
fprintf(stderr, "[!] epoll_ctl failed: %d\n", errno);
return false;
}
return true;
@@ -50,7 +50,7 @@ bool loop_wait() {
-1
);
if (result < 0) {
printf("[!] epoll_wait failed: %d\n", errno);
fprintf(stderr, "[!] epoll_wait failed: %d\n", errno);
return false;
}
if (!result) {