From df938b17af1b0dac7bedd5f84bcf93cc67edcd38 Mon Sep 17 00:00:00 2001 From: Etienne Brateau <etienne.brateau@gmail.com> Date: Sun, 20 Oct 2019 16:40:30 +0200 Subject: [PATCH] Some syntac clean --- src/configreader.c | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/src/configreader.c b/src/configreader.c index fb0d2b9..44922fc 100644 --- a/src/configreader.c +++ b/src/configreader.c @@ -1,5 +1,6 @@ #include "configreader.h" +#include <utils/strings.h> #include "graphics/newci.h" #include "graphics/newcrt.h" #include "utils/strings.h" @@ -72,7 +73,7 @@ void readcnf(char *fn_, struct LOC_initialize *LINK) FILE *tx; char txbuf[256], txarg[256], txarg2[256]; int erasegates, eraseload, erasemenu; - strlist_t *l1, *l2; + strlist_t *l1; log_tool *tp; cnfrec *cnfp; char *TEMP; @@ -93,7 +94,6 @@ void readcnf(char *fn_, struct LOC_initialize *LINK) strcpy(fn, "log.cnf"); if (!locatefile(fn, LINK)) *fn = '\0'; - } } else @@ -160,8 +160,10 @@ void readcnf(char *fn_, struct LOC_initialize *LINK) doimmedcnffunction(); docnffunction(); } + if (*LINK->cmdbuf == '\0' || strcmp(gg.func, LINK->cmdbuf)) continue; + if (strends(LINK->cmdbuf, ":") && strlen(LINK->cmdbuf) > 1) { if (*txbuf == '\0') @@ -181,6 +183,7 @@ void readcnf(char *fn_, struct LOC_initialize *LINK) LINK->cnflast = cnfp; continue; } + if (!strcmp(LINK->cmdbuf, "INCLUDE")) { do @@ -193,11 +196,13 @@ void readcnf(char *fn_, struct LOC_initialize *LINK) continue; } + if (!strcmp(LINK->cmdbuf, "HOME")) { sethomedirname(txbuf); continue; } + if (!strcmp(LINK->cmdbuf, "GATES")) { strwordx(txbuf, txarg); @@ -216,6 +221,7 @@ void readcnf(char *fn_, struct LOC_initialize *LINK) } continue; } + if (!strcmp(LINK->cmdbuf, "HELP")) { if (locatefile(txbuf, LINK)) @@ -223,6 +229,7 @@ void readcnf(char *fn_, struct LOC_initialize *LINK) continue; } + if (!strcmp(LINK->cmdbuf, "NEWS")) { if (locatefile(txbuf, LINK)) @@ -230,6 +237,7 @@ void readcnf(char *fn_, struct LOC_initialize *LINK) continue; } + if (!strcmp(LINK->cmdbuf, "MENU")) { getword(txbuf, txarg); @@ -243,12 +251,13 @@ void readcnf(char *fn_, struct LOC_initialize *LINK) erasemenu = false; while (*txarg != '\0') { - l1 = strlist_append(&LINK->logmenu, txarg); + strlist_append(&LINK->logmenu, txarg); getword(txbuf, txarg); } continue; } + if (!strcmp(LINK->cmdbuf, "GET") || !strcmp(LINK->cmdbuf, "LOAD")) { getword(txbuf, txarg); @@ -262,11 +271,12 @@ void readcnf(char *fn_, struct LOC_initialize *LINK) eraseload = false; while (*txarg != '\0') { - l1 = strlist_append(&LINK->loadgates, txarg); + strlist_append(&LINK->loadgates, txarg); getword(txbuf, txarg); } continue; } + if (!strcmp(LINK->cmdbuf, "GETGROUP")) { getword(txbuf, txarg); @@ -282,11 +292,12 @@ void readcnf(char *fn_, struct LOC_initialize *LINK) l1->value = (na_long)NULL; while (*txarg != '\0') { - l2 = strlist_append((strlist_t **)(&l1->value), txarg); + strlist_append((strlist_t **)(&l1->value), txarg); getword(txbuf, txarg); } continue; } + if (!strcmp(LINK->cmdbuf, "TOOL")) { getword(txbuf, txarg); @@ -308,6 +319,7 @@ void readcnf(char *fn_, struct LOC_initialize *LINK) getword(txbuf, txarg); continue; } + if (!strcmp(LINK->cmdbuf, "COMMAND")) { getword(txbuf, txarg2); @@ -327,6 +339,7 @@ void readcnf(char *fn_, struct LOC_initialize *LINK) continue; } + if (!strcmp(LINK->cmdbuf, "SIGNALS") || !strcmp(LINK->cmdbuf, "NODES")) { LINK->j = getint(txbuf, 0L); @@ -338,13 +351,17 @@ void readcnf(char *fn_, struct LOC_initialize *LINK) gg.maxsignal = LINK->j; continue; } + if (!strcmp(LINK->cmdbuf, "DO")) { - l2 = strlist_append(&thingstodo, gg.funcarg); + strlist_append(&thingstodo, gg.funcarg); continue; } + if (!strcmp(LINK->cmdbuf, "UNDO")) + { strlist_empty(&thingstodo); + } else if (strcmp(LINK->cmdbuf, "CTOLERANCE") && strcmp(LINK->cmdbuf, "CLOCK") && strcmp(LINK->cmdbuf, "SCOPE") && @@ -374,6 +391,4 @@ void readcnf(char *fn_, struct LOC_initialize *LINK) } if (tx != NULL) fclose(tx); - - /*obsolete*/ } -- GitLab