]> gitweb.hhaalo.de Git - feierabend.git/commitdiff
add empty feierabendxml
authorBastian Dehn <hhaalo@arcor.de>
Fri, 21 Jun 2024 18:59:09 +0000 (20:59 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Sat, 22 Jun 2024 06:48:17 +0000 (08:48 +0200)
readme.md
src/CMakeLists.txt
src/feierabend.c
src/feierabend.h [new file with mode: 0644]
src/feierabendxml.c [new file with mode: 0644]

index f2f471e3fd815a3a0b9acfe1b02a9c76fe1b276a..5ce4cc935defd945551edc7e007bd422399e577a 100644 (file)
--- a/readme.md
+++ b/readme.md
@@ -49,4 +49,10 @@ kompiliert werden:
 
 ```bash
 cmake -DCMAKE_BUILD_TYPE=Release -DSOLL_HOUR=7 -DSOLL_MINUTES=30 ..
+```
+
+## Debian libxml
+
+```bash
+sudo ln -s /usr/include/libxml2/libxml /usr/include/libxml
 ```
\ No newline at end of file
index 1c27bc522c70b3c33191139d5f5dbdf27dcdf56a..a1bdd0aa3ccea746592228e3a7b09cab2edcdafd 100644 (file)
@@ -2,6 +2,8 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.25.1)
 
 PROJECT(feierabend VERSION 1.1.0)
 
+FIND_PACKAGE(LibXml2)
+
 SET(SOLL_HOUR 8 CACHE STRING "soll Stunden")
 SET(SOLL_MINUTES 0 CACHE STRING "soll Minuten")
 
@@ -16,4 +18,14 @@ ADD_EXECUTABLE(${PROJECT_NAME}
        feierabend.c
        time_format.c
        worktime.c
-       break.c)
\ No newline at end of file
+       break.c)
+
+IF(${LibXml2_FOUND})
+       ADD_EXECUTABLE(${PROJECT_NAME}xml
+               feierabendxml.c
+               time_format.c
+               worktime.c
+               break.c)
+       TARGET_LINK_LIBRARIES(${PROJECT_NAME}xml
+               ${LibXml2_LIBRARY})
+ENDIF()
\ No newline at end of file
index 9084dd8403546fc883d87119c56c44418a729891..dae6b4013edaaa12ba37dd573b95a824badd1be9 100644 (file)
@@ -1,24 +1,10 @@
 #include <stdio.h>
-#include <stdlib.h>
-#include <time.h>
+#include "feierabend.h"
 #include "time_format.h"
 #include "worktime.h"
 #include "break.h"
 #include "config.h"
 
-#define ONE_HOUR 3600
-
-typedef struct {
-       time_t* now;
-       time_t* begin;
-       time_t* worktime;
-       struct tm* now_tm;
-       struct tm* begin_tm;
-       struct tm* work_end_tm;
-       char* weekday;
-       char* timestr;
-} feierabend;
-
 void init_feierabend(feierabend* fabend)
 {
        fabend->now = malloc(sizeof(time_t));
diff --git a/src/feierabend.h b/src/feierabend.h
new file mode 100644 (file)
index 0000000..c41bfa7
--- /dev/null
@@ -0,0 +1,19 @@
+#ifndef FEIERABEND_H
+#define FEIERABEND_H
+#include <stdlib.h>
+#include <time.h>
+
+#define ONE_HOUR 3600
+
+typedef struct {
+       time_t* now;
+       time_t* begin;
+       time_t* worktime;
+       struct tm* now_tm;
+       struct tm* begin_tm;
+       struct tm* work_end_tm;
+       char* weekday;
+       char* timestr;
+} feierabend;
+
+#endif
\ No newline at end of file
diff --git a/src/feierabendxml.c b/src/feierabendxml.c
new file mode 100644 (file)
index 0000000..16049e9
--- /dev/null
@@ -0,0 +1,32 @@
+#include <stdio.h>
+#include <libxml/encoding.h>
+#include <libxml/xmlwriter.h>
+#include "feierabend.h"
+
+void init_feierabend(feierabend* fabend)
+{
+       fabend->now = malloc(sizeof(time_t));
+       fabend->begin = malloc(sizeof(time_t));
+       fabend->worktime = malloc(sizeof(time_t));
+       fabend->weekday = malloc(sizeof(char) * 11);
+       fabend->timestr = malloc(sizeof(char) * 7);
+}
+
+void free_feierabend(feierabend* fabend)
+{
+       free(fabend->now);
+       free(fabend->begin);
+       free(fabend->worktime);
+       free(fabend->weekday);
+       free(fabend->timestr);
+       fabend->now = NULL;
+       fabend->begin = NULL;
+       fabend->worktime = NULL;
+       fabend->weekday = NULL;
+       fabend->timestr = NULL;
+}
+
+int main(int argc, char* argv[])
+{
+       printf("Hello World!");
+}
\ No newline at end of file