diff options
author | Fate <fate-tmw@googlemail.com> | 2009-09-11 05:38:13 +0000 |
---|---|---|
committer | Fate <fate-tmw@googlemail.com> | 2009-09-11 05:38:13 +0000 |
commit | 80361c9a3b7fde14bbc094cc1dd241b52e33d9bc (patch) | |
tree | 91a482b0e62ea440bd51ee6985ddd25d1d23d8da /src/map/map.c | |
parent | 77af951f441c1c455550e5473b4fb30b4a5f5302 (diff) | |
download | tmwa-80361c9a3b7fde14bbc094cc1dd241b52e33d9bc.tar.gz tmwa-80361c9a3b7fde14bbc094cc1dd241b52e33d9bc.tar.bz2 tmwa-80361c9a3b7fde14bbc094cc1dd241b52e33d9bc.tar.xz tmwa-80361c9a3b7fde14bbc094cc1dd241b52e33d9bc.zip |
Added mapserver config option log_file to specify gzipped player action log file
Diffstat (limited to 'src/map/map.c')
-rw-r--r-- | src/map/map.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/map/map.c b/src/map/map.c index cf50dfc..98be77b 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -1656,6 +1656,28 @@ int map_delmap(char *mapname) { extern char *gm_logfile_name; +FILE *map_logfile = NULL; + +static void +map_pclose_map_logfile() +{ + pclose(map_logfile); +} + +static void +map_setlogfile(const char *filename) +{ + char *filename_buf = malloc(strlen (filename) + 50); + sprintf(filename_buf, "gzip -c > %s", filename); + map_logfile = popen(filename_buf, "w"); + if (!map_logfile) + perror(filename); + else + atexit(map_pclose_map_logfile); + free(filename_buf); + MAP_LOG("log-start"); +} + /*========================================== * 設定ファイルを読み込む *------------------------------------------ @@ -1725,6 +1747,8 @@ int map_config_read(char *cfgName) { strcpy(mapreg_txt, w2); } else if (strcmpi(w1, "gm_log") == 0) { gm_logfile_name = strdup(w2); + } else if (strcmpi(w1, "log_file") == 0) { + map_setlogfile(w2); } else if (strcmpi(w1, "import") == 0) { map_config_read(w2); } |