From ee54ba4b4d3abc711198999b451c7cca26605aa7 Mon Sep 17 00:00:00 2001 From: OpenGnSys Support Team Date: Mon, 8 Jun 2020 18:26:24 +0200 Subject: #971 add str_toupper() Add new utils.c file and replace old StrToUpper(). --- admin/Sources/Services/ogAdmServer/Makefile.am | 3 ++- .../Sources/Services/ogAdmServer/sources/ogAdmServer.c | 17 +++++++++-------- admin/Sources/Services/ogAdmServer/sources/utils.c | 14 ++++++++++++++ admin/Sources/Services/ogAdmServer/sources/utils.h | 6 ++++++ 4 files changed, 31 insertions(+), 9 deletions(-) create mode 100644 admin/Sources/Services/ogAdmServer/sources/utils.c create mode 100644 admin/Sources/Services/ogAdmServer/sources/utils.h diff --git a/admin/Sources/Services/ogAdmServer/Makefile.am b/admin/Sources/Services/ogAdmServer/Makefile.am index 433cfd19..6904c095 100644 --- a/admin/Sources/Services/ogAdmServer/Makefile.am +++ b/admin/Sources/Services/ogAdmServer/Makefile.am @@ -4,4 +4,5 @@ AM_CFLAGS = -I../../Includes ${LIBDBI_CFLAGS} ${LIBJANSSON_CFLAGS} ${LIBEVENT_C ogAdmServer_SOURCES= sources/ogAdmServer.c \ sources/dbi.c \ - sources/schedule.c + sources/schedule.c \ + sources/utils.c diff --git a/admin/Sources/Services/ogAdmServer/sources/ogAdmServer.c b/admin/Sources/Services/ogAdmServer/sources/ogAdmServer.c index 422947d7..f4b287e5 100644 --- a/admin/Sources/Services/ogAdmServer/sources/ogAdmServer.c +++ b/admin/Sources/Services/ogAdmServer/sources/ogAdmServer.c @@ -9,6 +9,7 @@ #include "ogAdmServer.h" #include "ogAdmLib.c" #include "dbi.h" +#include "utils.h" #include "list.h" #include "schedule.h" #include @@ -75,21 +76,21 @@ static bool tomaConfiguracion(const char *filecfg) key = strtok(line, delim); value = strtok(NULL, delim); - if (!strcmp(StrToUpper(key), "SERVIDORADM")) + if (!strcmp(str_toupper(key), "SERVIDORADM")) snprintf(servidoradm, sizeof(servidoradm), "%s", value); - else if (!strcmp(StrToUpper(key), "PUERTO")) + else if (!strcmp(str_toupper(key), "PUERTO")) snprintf(puerto, sizeof(puerto), "%s", value); - else if (!strcmp(StrToUpper(key), "USUARIO")) + else if (!strcmp(str_toupper(key), "USUARIO")) snprintf(usuario, sizeof(usuario), "%s", value); - else if (!strcmp(StrToUpper(key), "PASSWORD")) + else if (!strcmp(str_toupper(key), "PASSWORD")) snprintf(pasguor, sizeof(pasguor), "%s", value); - else if (!strcmp(StrToUpper(key), "DATASOURCE")) + else if (!strcmp(str_toupper(key), "DATASOURCE")) snprintf(datasource, sizeof(datasource), "%s", value); - else if (!strcmp(StrToUpper(key), "CATALOG")) + else if (!strcmp(str_toupper(key), "CATALOG")) snprintf(catalog, sizeof(catalog), "%s", value); - else if (!strcmp(StrToUpper(key), "INTERFACE")) + else if (!strcmp(str_toupper(key), "INTERFACE")) snprintf(interface, sizeof(interface), "%s", value); - else if (!strcmp(StrToUpper(key), "APITOKEN")) + else if (!strcmp(str_toupper(key), "APITOKEN")) snprintf(auth_token, sizeof(auth_token), "%s", value); line = fgets(buf, sizeof(buf), fcfg); diff --git a/admin/Sources/Services/ogAdmServer/sources/utils.c b/admin/Sources/Services/ogAdmServer/sources/utils.c new file mode 100644 index 00000000..4aa76f8b --- /dev/null +++ b/admin/Sources/Services/ogAdmServer/sources/utils.c @@ -0,0 +1,14 @@ +#include +#include "utils.h" + +const char *str_toupper(char *str) +{ + char *c = str; + + while (*c) { + *c = toupper(*c); + c++; + } + + return str; +} diff --git a/admin/Sources/Services/ogAdmServer/sources/utils.h b/admin/Sources/Services/ogAdmServer/sources/utils.h new file mode 100644 index 00000000..e32d0067 --- /dev/null +++ b/admin/Sources/Services/ogAdmServer/sources/utils.h @@ -0,0 +1,6 @@ +#ifndef _OG_UTILS_H +#define _OG_UTILS_H + +const char *str_toupper(char *str); + +#endif -- cgit v1.2.3-18-g5258