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

+18
View File
@@ -0,0 +1,18 @@
CC = gcc
CFLAGS = -Wall -g
LDFLAGS = -lm
LIBS = -lmysyslog -lmysyslog-text -lmysyslog-json
all: mysyslog-client
mysyslog-client: src/mysyslog-client.o
$(CC) -o $@ $^ $(LIBS)
clean:
rm -f src/*.o mysyslog-client
deb:
# Deb package building logic
.PHONY: all clean deb
+29
View File
@@ -0,0 +1,29 @@
#include <stdio.h>
#include <stdlib.h>
#include <getopt.h>
#include "mysyslog.h"
int main(int argc, char *argv[]) {
int level = INFO;
int driver = 1; // Default to text driver
int format = 1; // Default to text format
const char* msg = NULL;
const char* path = "/var/log/mysyslog.log";
int opt;
while ((opt = getopt(argc, argv, "m:l:d:f:p:")) != -1) {
switch (opt) {
case 'm': msg = optarg; break;
case 'l': level = atoi(optarg); break;
case 'd': driver = atoi(optarg); break;
case 'f': format = atoi(optarg); break;
case 'p': path = optarg; break;
}
}
if (msg != NULL) {
mysyslog(msg, level, driver, format, path);
}
return 0;
}