create project structure

This commit is contained in:
gandc committed 2024-11-23 18:47:32 +03:00
1 parent 75f3e942e6
commit 15c07a898b
13 files changed
+221

No files matched your search

+16
View File
@@ -0,0 +1,16 @@
CC = gcc
CFLAGS = -Wall -g
LDFLAGS = -lm
LIBS = -lmysyslog -lmysyslog-text -lmysyslog-json
all: mysyslog-daemon
mysyslog-daemon: src/mysyslog-daemon.o
$(CC) -o $@ $^ $(LIBS)
clean: rm -f src/*.o mysyslog-daemon
deb: # Deb package building logic
.PHONY: all clean deb
+27
View File
@@ -0,0 +1,27 @@
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <unistd.h>
#include "mysyslog.h"
static volatile int keep_running = 1;
void int_handler(int dummy) {
keep_running = 0;
}
int main() {
signal(SIGINT, int_handler);
signal(SIGTERM, int_handler);
const char* path = "/var/log/mysyslog.log";
int driver = 1; // Default to text driver
int format = 1; // Default to text format
while (keep_running) {
mysyslog("Daemon log message", INFO, driver, format, path);
sleep(60); // Log every minute
}
return 0;
}