From 05acaece4835f7d4f977cc6ed3fa9f70aef35346 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Sun, 4 Apr 2004 13:54:30 +0000 Subject: [PATCH] (kw_read, kw_find, kwtab, kw_list): Were used to evaluate the hours file until 4.2.7. Since then kw_read() is unused, and kw_find() always returns NULL. Remove. kw_find() callers changed. --- include/keyword.h | 2 -- src/lib/common/keyword.c | 59 ---------------------------------------- src/lib/player/empdis.c | 11 -------- src/server/update.c | 8 ------ 4 files changed, 80 deletions(-) diff --git a/include/keyword.h b/include/keyword.h index 49316830b..f3a40cde1 100644 --- a/include/keyword.h +++ b/include/keyword.h @@ -42,9 +42,7 @@ #define CF_TIMERANGE 3 #define CF_WEEKDAY 4 -extern s_char *kw_find(s_char *); extern s_char *kw_parse(int, s_char *, int *); -extern int kw_read(FILE *); extern s_char *get_time(s_char *, int *); extern s_char *weekday(s_char *, int *); diff --git a/src/lib/common/keyword.c b/src/lib/common/keyword.c index 335a2af3a..70aa2778b 100644 --- a/src/lib/common/keyword.c +++ b/src/lib/common/keyword.c @@ -40,65 +40,6 @@ #include #include "common.h" -struct kwtab { - struct kwtab *next; - s_char *name; - s_char *text; -}; - -struct kwtab *kw_list; - -int -kw_read(FILE * fp) -{ - register struct kwtab *kw; - register struct kwtab *next; - s_char buf[255]; - s_char *p; - int n; - - for (kw = kw_list; kw != 0; kw = next) { - next = kw->next; - free(kw->name); - free(kw->text); - free(kw); - } - kw_list = 0; - for (n = 0; fgets(buf, sizeof(buf), fp) != 0; n++) { - /* Allow for comments.. any line starting with # */ - if (buf[0] == '#') - continue; - p = strrchr(buf, '\n'); - if (p != 0) - *p = 0; - if ((p = strchr(buf, ':')) == 0) { - logerror("kw_read: Bad keyword line #%d\n", n); - return 0; - } - *p++ = 0; - while (*p && isspace(*p)) - p++; - kw = (struct kwtab *)malloc(sizeof(*kw)); - kw->name = strcpy(malloc(strlen(buf) + 1), buf); - kw->text = strcpy(malloc(strlen(p) + 1), p); - kw->next = kw_list; - kw_list = kw; - } - return n; -} - -s_char * -kw_find(s_char *name) -{ - register struct kwtab *kw; - - for (kw = kw_list; kw != 0; kw = kw->next) { - if (strcmp(kw->name, name) == 0) - return kw->text; - } - return 0; -} - /* * destructive parse */ diff --git a/src/lib/player/empdis.c b/src/lib/player/empdis.c index 7b15ea640..902237abf 100644 --- a/src/lib/player/empdis.c +++ b/src/lib/player/empdis.c @@ -210,19 +210,8 @@ getminleft(time_t now, int *hour, int *mpd) tm = localtime(&now); curtime = tm->tm_min + tm->tm_hour * 60; - if (NULL != (bp = kw_find("minutes"))) - kw_parse(CF_VALUE, bp, mpd); natp = getnatp(player->cnum); nminleft = *mpd - natp->nat_minused; - if (NULL != (bp = kw_find("hours"))) { - /* - * assume hours has already been set; just verify - * that it is present - */ - n = hour[1] - curtime; - if (n < nminleft) - nminleft = n; - } n = 60 * 24 - (tm->tm_min + tm->tm_hour * 60); if (n < nminleft) nminleft = n; diff --git a/src/server/update.c b/src/server/update.c index 24ab94a12..8a249ebdf 100644 --- a/src/server/update.c +++ b/src/server/update.c @@ -59,14 +59,6 @@ update_sched(void *unused) "Waits until players idle", 0); time(&now); (void)gamehours(now, hour); - if (NULL != (kw = kw_find("s_p_etu"))) - kw_parse(CF_VALUE, kw, &s_p_etu); - if (NULL != (kw = kw_find("etu_per_update"))) - kw_parse(CF_VALUE, kw, &etu_per_update); - if (NULL != (kw = kw_find("adj_update"))) - kw_parse(CF_VALUE, kw, &adj_update); - if (NULL != (kw = kw_find("update_window"))) - kw_parse(CF_VALUE, kw, &update_window); if (s_p_etu <= 0) { logerror("bad value for s_p_etu (%d)", s_p_etu); s_p_etu = 2 * 60; -- 2.43.0