From 744a6de25bf363f633e01a891dfd89e1bf039bd1 Mon Sep 17 00:00:00 2001 From: Georg Lehner Date: Mon, 30 Dec 2019 12:32:29 +0100 Subject: [PATCH 1/2] Fix pointer, add sysconfdir awareness and domain/day up link Data.c: cast form (user **) to (int *) fixed. Global.h, main.c: add sysconfdir as default config directory. daily.html: don't go up one directory, just go to the index of the current. --- isoqlog/Data.c | 46 ++++++++++++++----------------------- isoqlog/Data.h | 2 +- isoqlog/Global.h | 3 +++ isoqlog/Makefile.am | 14 ++++++----- isoqlog/htmltemp/daily.html | 2 +- isoqlog/main.c | 2 +- 6 files changed, 31 insertions(+), 38 deletions(-) diff --git a/isoqlog/Data.c b/isoqlog/Data.c index 8d181ea..f42c9b4 100644 --- a/isoqlog/Data.c +++ b/isoqlog/Data.c @@ -173,34 +173,33 @@ void freeSortDomainTab() int addUserToSortTab(user *usr) { - int *u; + user **u; if (SortDomain.allusers == NULL) { /* first time */ - SortDomain.allusers = (int *)malloc(NVINIT * sizeof(int *)); + SortDomain.allusers = (user **)malloc(NVINIT * sizeof(user *)); if (SortDomain.allusers == NULL) return -1; SortDomain.max = NVINIT; SortDomain.nval = 0; } else if (SortDomain.nval >= SortDomain.max) { /* growing....*/ - u = (int *)realloc(SortDomain.allusers, - (NVGROW * SortDomain.max) * sizeof(int *)); + u = (user **)realloc(SortDomain.allusers, + (NVGROW * SortDomain.max) * sizeof(user *)); if (u == NULL) return -1; SortDomain.max *= NVGROW; SortDomain.allusers = u; } - SortDomain.allusers[SortDomain.nval] = (int)usr; + SortDomain.allusers[SortDomain.nval] = usr; return SortDomain.nval++; } void sortDomainUsersFrom(char *domain) { - int tmpnval, i, j, max, tmp; + int tmpnval, i, j, max; struct domain *domainptr; - struct user *sym; - struct user *tmp1, *tmp2; + struct user *sym, *tmp1, *tmp2, *tmp; tmpnval = -1; for (i = 0; i < DomainsTab.nval; i++) @@ -233,10 +232,9 @@ void sortDomainUsersFrom(char *domain) void sortDomainUsersTo(char *domain) { - int tmpnval, i, j, max, tmp; + int tmpnval, i, j, max; struct domain *domainptr; - struct user *sym; - struct user *tmp1, *tmp2; + struct user *sym, *tmp1, *tmp2, *tmp; tmpnval = -1; for (i = 0; i < DomainsTab.nval; i++) @@ -268,10 +266,9 @@ void sortDomainUsersTo(char *domain) void sortDomainUsersTotal(char *domain) { - int tmpnval, i, j, max, tmp; + int tmpnval, i, j, max; struct domain *domainptr; - struct user *sym; - struct user *tmp1, *tmp2; + struct user *sym, *tmp1, *tmp2, *tmp; tmpnval = -1; for (i = 0; i < DomainsTab.nval; i++) @@ -307,10 +304,9 @@ void sortDomainUsersTotal(char *domain) void sortDomainUsersByte(char *domain) { - int tmpnval, i, j, max, tmp; + int tmpnval, i, j, max; struct domain *domainptr; - struct user *sym; - struct user *tmp1, *tmp2; + struct user *sym, *tmp1, *tmp2, *tmp; tmpnval = -1; for (i = 0; i < DomainsTab.nval; i++) @@ -345,9 +341,7 @@ void sortUsersFrom() { int i, j, max; globuser *sym; - int tmp; - user *tmp1; - user *tmp2; + user *tmp1, *tmp2, *tmp; for (i = 0; i < MAXUSERS; i++) @@ -373,9 +367,7 @@ void sortUsersTo() { int i, j, max; globuser *sym; - int tmp; - user *tmp1; - user *tmp2; + user *tmp1, *tmp2, *tmp; for (i = 0; i < MAXUSERS; i++) @@ -402,9 +394,7 @@ void sortUsersTotal() { int i, j, max; globuser *sym; - int tmp; - user *tmp1; - user *tmp2; + user *tmp1,*tmp2, *tmp; for (i = 0; i < MAXUSERS; i++) @@ -430,9 +420,7 @@ void sortUsersByte() { int i, j, max; globuser *sym; - int tmp; - user *tmp1; - user *tmp2; + user *tmp1, *tmp2, *tmp; for (i = 0; i < MAXUSERS; i++) diff --git a/isoqlog/Data.h b/isoqlog/Data.h index 9b3b6bc..ee194f7 100644 --- a/isoqlog/Data.h +++ b/isoqlog/Data.h @@ -107,7 +107,7 @@ struct UsersTab { struct SortDomain { int nval; int max; - int *allusers; + user **allusers; } SortDomain; #endif diff --git a/isoqlog/Global.h b/isoqlog/Global.h index f063101..377da94 100644 --- a/isoqlog/Global.h +++ b/isoqlog/Global.h @@ -5,6 +5,9 @@ #define VERSION_STRING "EnderUNIX Isoqlog 2.2-BETA" +#define TO_STR2(x) #x +#define TO_STR(x) TO_STR2(x) +#define CONFFILE (TO_STR(SYSCONFDIR) "/isoqlog.conf") enum { BUFSIZE = 1024, diff --git a/isoqlog/Makefile.am b/isoqlog/Makefile.am index f935d4c..c755e4b 100644 --- a/isoqlog/Makefile.am +++ b/isoqlog/Makefile.am @@ -1,3 +1,5 @@ +AM_CPPFLAGS = -DSYSCONFDIR='$(sysconfdir)' + bin_PROGRAMS = isoqlog @@ -9,14 +11,14 @@ SUBDIRS = lang htmltemp EXTRA_DIST = Data.c Dir.c Html.c LangCfg.c loadconfig.c main.c Parser.c Store.c Data.h Dir.h Html.h Global.h LangCfg.h loadconfig.h Parser.h Store.h isoqlog.conf-dist isoqlog.conf.sample1 isoqlog.conf.sample2 isoqlog.conf.sample3 isoqlog.domains-dist install-data-local: - $(mkinstalldirs) /usr/local/etc/ - $(INSTALL_DATA) $(srcdir)/isoqlog.conf-dist /usr/local/etc/isoqlog.conf-dist - $(mkinstalldirs) /usr/local/etc/ - $(INSTALL_DATA) $(srcdir)/isoqlog.domains-dist /usr/local/etc/isoqlog.domains-dist + $(mkinstalldirs) $(sysconfdir)/ + $(INSTALL_DATA) $(srcdir)/isoqlog.conf-dist $(sysconfdir)/isoqlog.conf-dist + $(mkinstalldirs) $(sysconfdir)/ + $(INSTALL_DATA) $(srcdir)/isoqlog.domains-dist $(sysconfdir)/isoqlog.domains-dist uninstall-local: - -rm -f /usr/local/etc/isoqlog.conf-dist - -rm -f /usr/local/etc/isoqlog.domains-dist + -rm -f $(sysconfdir)/isoqlog.conf-dist + -rm -f $(sysconfdir)/isoqlog.domains-dist # set the include path found by configure INCLUDES= $(all_includes) diff --git a/isoqlog/htmltemp/daily.html b/isoqlog/htmltemp/daily.html index a10a0c3..92c5260 100644 --- a/isoqlog/htmltemp/daily.html +++ b/isoqlog/htmltemp/daily.html @@ -38,7 +38,7 @@ - +
home.gifup.gifup.gif
diff --git a/isoqlog/main.c b/isoqlog/main.c index ca0ed23..59cebb6 100644 --- a/isoqlog/main.c +++ b/isoqlog/main.c @@ -50,7 +50,7 @@ int main(int argc, char **argv) general.from_byte = 0; if (f == 0) - readconfig("/usr/local/etc/isoqlog.conf"); + readconfig(CONFFILE); else readconfig(isoqlogconf); loadLang(langfile); From 1c738d02599c211da1aca2fd2a48383dee49414f Mon Sep 17 00:00:00 2001 From: Georg Lehner Date: Mon, 30 Dec 2019 15:31:15 +0100 Subject: [PATCH 2/2] Get HTML validator icon via secure connection. And also link via https to the validator. The first change will avoid getting a security warning in the browser. --- isoqlog/Html.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/isoqlog/Html.c b/isoqlog/Html.c index d45488d..0213bb5 100644 --- a/isoqlog/Html.c +++ b/isoqlog/Html.c @@ -51,8 +51,8 @@ void addFooter(FILE *fp) fprintf(fp, "

" "Generated by %s" ", EnderUNIX software development team @Istanbul/Turkey

\n" - "

\n" - "Valid HTML 4.01!\n" + "

\n" + "Valid HTML 4.01!\n" "

\n", VERSION_STRING); }