aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.c
diff options
context:
space:
mode:
authorM.Gergő2020-05-06 23:03:17 +0200
committerM.Gergő2020-05-06 23:03:17 +0200
commit3cff0f1ab97bf61a53cc9c74b5e259947b3e2861 (patch)
tree0ec96a912c896fa78c25fb996d762144c80a1561 /src/main.c
downloadlightconfini-3cff0f1ab97bf61a53cc9c74b5e259947b3e2861.tar.gz
lightconfini-3cff0f1ab97bf61a53cc9c74b5e259947b3e2861.zip
LightConfINI rewrite & rework
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
new file mode 100644
index 0000000..1e6246f
--- /dev/null
+++ b/src/main.c
@@ -0,0 +1,56 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdbool.h>
+
+#include <linux/limits.h> /* PATH_MAX*/
+#include "ini_rw.h"
+#define main_c
+
+
+
+int main()
+{
+ char filename[] = "tests/test.ini", *buff1, *buff2, *buff3, *buff4, *buff5;
+ lci_data *ini=NULL, *tmp=NULL;
+ int len=0, elen=50;
+ FILE *fp;
+
+ fp = fopen(filename, "rb");
+ len = getFileMaxLineLen(fp);
+ fclose(fp);
+
+ buff1 = malloc((len+3)*sizeof(char));
+ buff2 = malloc((len+3)*sizeof(char));
+ buff3 = malloc((len+3)*sizeof(char));
+ buff4 = malloc((len+3)*sizeof(char));
+ buff5 = malloc((elen+3)*sizeof(char));
+
+
+ ini = iniReadOut(filename);
+
+
+ printf("\n");
+
+
+ tmp = ini;
+ while(tmp != NULL){
+
+ snprintf(buff1, len+3, "'%s' %3ld",tmp->section, tmp->sectionLen);
+ snprintf(buff2, len+3, "'%s' %3ld",tmp->param, tmp->paramLen);
+ snprintf(buff3, len+3, "'%s' %3ld",tmp->value, tmp->valueLen);
+ snprintf(buff4, len+3, "'%s' %3ld",tmp->comment, tmp->commentLen);
+ snprintf(buff5, elen, "'%s' %3ld", tmp->errorMsg, tmp->errorMsgLen);
+
+
+ printf("LN: %ld,\tLL: %ld,\tSE: %*s, P: %*s, V: %*s, C: %*s, ER: %*s \n", tmp->lineNum, tmp->lineLen,len+6, buff1, len+6, buff2, len+6, buff3, len+6, buff4, elen, buff5);
+
+ tmp=tmp->next;
+ }
+
+
+
+
+ return 0;
+}