Debian Codegraph @

src/bnetd/support.cpp

raw symbols SCIP
1 /*
2 * Copyright (C) 2004 Lector
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18
19 #include "common/setup_before.h"cxx . . $ `<file>/src/common/setup_before.h`/
20 #include "support.h"cxx . . $ `<file>/src/bnetd/support.h`/
21
22 #include <cstdio>
23 #include <cerrno>
24 #include <cstring>
25
26 #include "compat/access.h"cxx . . $ `<file>/src/compat/access.h`/
27 #include "common/eventlog.h"cxx . . $ `<file>/src/common/eventlog.h`/
28 #include "common/util.h"cxx . . $ `<file>/src/common/util.h`/
29 #include "common/xalloc.h"cxx . . $ `<file>/src/common/xalloc.h`/
30
31 #include "prefs.h"cxx . . $ `<file>/src/bnetd/prefs.h`/
32 #include "common/setup_after.h"cxx . . $ `<file>/src/common/setup_after.h`/
33
34 namespace pvpgncxx . . $ pvpgn/
35 {
36
37 namespace bnetdcxx . . $ pvpgn/bnetd/
38 {
39
40 extern int support_check_filescxx . . $ pvpgn/bnetd/support_check_files(5c4306d8553b3696).(char const * supportfile)
41 {
42
43 stdcxx . . $ std/::FILEcxx . . $ std/FILE# *fp;
44 char *buff;
45 unsigned int line;
46 int filedirlen;
47 char * namebuff;
48
49 if (!(supportfile))
50 {
51 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL supportfile");
52 return -1;
53 }
54
55 if (!(fp = stdcxx . . $ std/::fopencxx . . $ std/fopen(82ec0787cd37e0a3).(supportfile, "r")))
56 {
57 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "could not open file \"{}\" for reading (std::fopen: {})", supportfile, stdcxx . . $ std/::strerror(errnocxx . . $ `<external>/17633486526465735210/errno.h:38:10`!));
58 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "can't guarantee that everything will run smooth");
59 return 0;
60 }
61
62 filedirlen = stdcxx . . $ std/::strlen(prefs_get_filedircxx . . $ pvpgn/bnetd/prefs_get_filedir(33a1f659e94feb42).());
63
64 for (line = 1; (buff = file_get_linecxx . . $ pvpgn/file_get_line(e31226b218f63160).(fp)); line++)
65 {
66 if (buff[0] == '#' || buff[0] == '\0')
67 {
68 continue;
69 }
70
71 namebuff = (char*)xmalloccxx . . $ `src/common/xalloc.h:43:9`!(filedirlen + 1 + std::strlen(buff) + 1);
72 stdcxx . . $ std/::sprintfcxx . . $ std/sprintf(bb743b22d71e45d5).(namebuff, "%s/%s", prefs_get_filedircxx . . $ pvpgn/bnetd/prefs_get_filedir(33a1f659e94feb42).(), buff);
73
74 if (access(namebuff, F_OKcxx . . $ `<external>/12628407106812493757/unistd.h:284:9`!) < 0)
75 {
76 eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_fatalcxx . . $ pvpgn/eventlog_level_fatal., __FUNCTION__, "necessary file \"{}\" missing", namebuff);
77 xfreecxx . . $ `src/common/xalloc.h:51:9`!((void *)namebuff);
78 stdcxx . . $ std/::fclosecxx . . $ std/fclose(89bc1efcdac0ca22).(fp);
79 return -1;
80 }
81
82 xfreecxx . . $ `src/common/xalloc.h:51:9`!((void *)namebuff);
83 }
84
85 file_get_linecxx . . $ pvpgn/file_get_line(e31226b218f63160).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); // clear file_get_line buffer
86 stdcxx . . $ std/::fclosecxx . . $ std/fclose(89bc1efcdac0ca22).(fp);
87
88 return 0;
89 }
90
91 }
92
93 }