rename dir
This commit is contained in:
parent
f850b75dfb
commit
aadd29ac73
52
mysyslog-client/.gitignore
vendored
52
mysyslog-client/.gitignore
vendored
@ -1,52 +0,0 @@
|
||||
# Prerequisites
|
||||
*.d
|
||||
|
||||
# Object files
|
||||
*.o
|
||||
*.ko
|
||||
*.obj
|
||||
*.elf
|
||||
|
||||
# Linker output
|
||||
*.ilk
|
||||
*.map
|
||||
*.exp
|
||||
|
||||
# Precompiled Headers
|
||||
*.gch
|
||||
*.pch
|
||||
|
||||
# Libraries
|
||||
*.lib
|
||||
*.a
|
||||
*.la
|
||||
*.lo
|
||||
|
||||
# Shared objects (inc. Windows DLLs)
|
||||
*.dll
|
||||
*.so
|
||||
*.so.*
|
||||
*.dylib
|
||||
|
||||
# Executables
|
||||
*.exe
|
||||
*.out
|
||||
*.app
|
||||
*.i*86
|
||||
*.x86_64
|
||||
*.hex
|
||||
|
||||
# Debug files
|
||||
*.dSYM/
|
||||
*.su
|
||||
*.idb
|
||||
*.pdb
|
||||
|
||||
# Kernel Module Compile Results
|
||||
*.mod*
|
||||
*.cmd
|
||||
.tmp_versions/
|
||||
modules.order
|
||||
Module.symvers
|
||||
Mkfile.old
|
||||
dkms.conf
|
||||
@ -1,17 +0,0 @@
|
||||
CC = gcc
|
||||
CFLAGS = -Wall -Wextra -I../libmysyslog
|
||||
LDFLAGS = -L../libmysyslog -lmysyslog
|
||||
TARGET = libmysyslog-client
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
$(TARGET): libmysyslog-client.o
|
||||
$(CC) -o $(TARGET) libmysyslog-client.o $(LDFLAGS)
|
||||
|
||||
libmysyslog.o: libmysyslog-client.c
|
||||
$(cc) $(CFLAGS) -c libmysyslog-client.c
|
||||
|
||||
clean:
|
||||
rm -f $(TARGET) *.o
|
||||
|
||||
.PHONY: all clean
|
||||
@ -1,52 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <getopt.h>
|
||||
#include "libmysyslog.h"
|
||||
|
||||
void print_usage(const char* prog_name) {
|
||||
printf("Usage: %s -m <message> -l <log_level> -d <driver> -f <format> -p <path>\n", prog_name);
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
int opt;
|
||||
char* message = NULL;
|
||||
int level = INFO;
|
||||
int driver = TEXT_DRIVER;
|
||||
int format = 0;
|
||||
char* path = NULL;
|
||||
|
||||
while ((opt = getopt(argc, argv, "m:l:d:f:p:")) != -1) {
|
||||
switch (opt) {
|
||||
case 'm':
|
||||
message = 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;
|
||||
default:
|
||||
print_usage(argv[0]);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
if (!message || !path) {
|
||||
print_usage(argv[0]);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (mysyslog(message, level, driver, format, path) != 0) {
|
||||
fprintf(stderr, "Failed to log message\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user