| 1 | /* |
| 2 | * Copyright (C) 1998 Mark Baysinger ([email protected]) |
| 3 | * Copyright (C) 1998,1999,2000 Ross Combs ([email protected]) |
| 4 | * Copyright (C) 2005 Dizzy |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU General Public License |
| 8 | * as published by the Free Software Foundation; either version 2 |
| 9 | * of the License, or (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program; if not, write to the Free Software |
| 18 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 19 | */ |
| 20 | #include "common/setup_before.h"cxx . . $ `<file>/src/common/setup_before.h`/ |
| 21 | #include "cmdline.h"cxx . . $ `<file>/src/bnetd/cmdline.h`/ |
| 22 | |
| 23 | #include <cstdio> |
| 24 | |
| 25 | #include "common/xalloc.h"cxx . . $ `<file>/src/common/xalloc.h`/ |
| 26 | #ifdef WIN32 |
| 27 | # include "win32/service.h" |
| 28 | #endif |
| 29 | #ifdef WIN32_GUI |
| 30 | # include "common/gui_printf.h" |
| 31 | #endif |
| 32 | #include "compat/strcasecmp.h"cxx . . $ `<file>/src/compat/strcasecmp.h`/ |
| 33 | #include "common/eventlog.h"cxx . . $ `<file>/src/common/eventlog.h`/ |
| 34 | #include "common/conf.h"cxx . . $ `<file>/src/common/conf.h`/ |
| 35 | #include "common/setup_after.h"cxx . . $ `<file>/src/common/setup_after.h`/ |
| 36 | |
| 37 | namespace pvpgncxx . . $ pvpgn/ |
| 38 | { |
| 39 | |
| 40 | namespace bnetdcxx . . $ pvpgn/bnetd/ |
| 41 | { |
| 42 | |
| 43 | static structcxx . . $ pvpgn/bnetd/$anonymous_type_d3bcaaac0f07f7e3_0# { |
| 44 | #ifdef DO_DAEMONIZEcxx . . $ `src/common/setup_before.h:353:10`! |
| 45 | unsigned foregroundcxx . . $ pvpgn/bnetd/$anonymous_type_d3bcaaac0f07f7e3_0#foreground.; |
| 46 | #endif |
| 47 | const char *preffilecxx . . $ pvpgn/bnetd/$anonymous_type_d3bcaaac0f07f7e3_0#preffile.; |
| 48 | const char *hexfilecxx . . $ pvpgn/bnetd/$anonymous_type_d3bcaaac0f07f7e3_0#hexfile.; |
| 49 | unsigned debugcxx . . $ pvpgn/bnetd/$anonymous_type_d3bcaaac0f07f7e3_0#debug.; |
| 50 | #ifdef WIN32_GUI |
| 51 | unsigned console; |
| 52 | unsigned gui; |
| 53 | #endif |
| 54 | } cmdline_configcxx . . $ pvpgn/bnetd/cmdline_config.; |
| 55 | |
| 56 | static unsigned exitflagcxx . . $ pvpgn/bnetd/exitflag.; |
| 57 | static const char *prognamecxx . . $ pvpgn/bnetd/progname.; |
| 58 | |
| 59 | #ifdef DO_DAEMONIZEcxx . . $ `src/common/setup_before.h:353:10`! |
| 60 | static int conf_set_foregroundcxx . . $ pvpgn/bnetd/conf_set_foreground(5c4306d8553b3696).(const char *valstr); |
| 61 | static int conf_setdef_foregroundcxx . . $ pvpgn/bnetd/conf_setdef_foreground(b126dc7c1de90089).(void); |
| 62 | #endif |
| 63 | |
| 64 | static int conf_set_preffilecxx . . $ pvpgn/bnetd/conf_set_preffile(5c4306d8553b3696).(const char *valstr); |
| 65 | static int conf_setdef_preffilecxx . . $ pvpgn/bnetd/conf_setdef_preffile(b126dc7c1de90089).(void); |
| 66 | |
| 67 | static int conf_set_hexfilecxx . . $ pvpgn/bnetd/conf_set_hexfile(5c4306d8553b3696).(const char *valstr); |
| 68 | static int conf_setdef_hexfilecxx . . $ pvpgn/bnetd/conf_setdef_hexfile(b126dc7c1de90089).(void); |
| 69 | |
| 70 | static int conf_set_debugcxx . . $ pvpgn/bnetd/conf_set_debug(5c4306d8553b3696).(const char *valstr); |
| 71 | static int conf_setdef_debugcxx . . $ pvpgn/bnetd/conf_setdef_debug(b126dc7c1de90089).(void); |
| 72 | |
| 73 | static int conf_set_helpcxx . . $ pvpgn/bnetd/conf_set_help(5c4306d8553b3696).(const char *valstr); |
| 74 | static int conf_setdef_helpcxx . . $ pvpgn/bnetd/conf_setdef_help(b126dc7c1de90089).(void); |
| 75 | |
| 76 | static int conf_set_versioncxx . . $ pvpgn/bnetd/conf_set_version(5c4306d8553b3696).(const char *valstr); |
| 77 | static int conf_setdef_versioncxx . . $ pvpgn/bnetd/conf_setdef_version(b126dc7c1de90089).(void); |
| 78 | |
| 79 | #ifdef WIN32 |
| 80 | static int conf_set_service(const char *valstr); |
| 81 | static int conf_setdef_service(void); |
| 82 | |
| 83 | static int conf_set_servaction(const char *valstr); |
| 84 | static int conf_setdef_servaction(void); |
| 85 | #endif |
| 86 | |
| 87 | #ifdef WIN32_GUI |
| 88 | static int conf_set_console(char const * valstr); |
| 89 | static int conf_setdef_console(void); |
| 90 | |
| 91 | static int conf_set_gui(char const * valstr); |
| 92 | static int conf_setdef_gui(void); |
| 93 | #endif |
| 94 | |
| 95 | static t_conf_entrycxx . . $ pvpgn/t_conf_entry# conftabcxx . . $ pvpgn/bnetd/conftab.[] = { |
| 96 | { "c", conf_set_preffilecxx . . $ pvpgn/bnetd/conf_set_preffile(5c4306d8553b3696)., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, conf_setdef_preffilecxx . . $ pvpgn/bnetd/conf_setdef_preffile(b126dc7c1de90089). }, |
| 97 | { "config", conf_set_preffilecxx . . $ pvpgn/bnetd/conf_set_preffile(5c4306d8553b3696)., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, conf_setdef_preffilecxx . . $ pvpgn/bnetd/conf_setdef_preffile(b126dc7c1de90089). }, |
| 98 | { "d", conf_set_hexfilecxx . . $ pvpgn/bnetd/conf_set_hexfile(5c4306d8553b3696)., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, conf_setdef_hexfilecxx . . $ pvpgn/bnetd/conf_setdef_hexfile(b126dc7c1de90089). }, |
| 99 | { "hexdump", conf_set_hexfilecxx . . $ pvpgn/bnetd/conf_set_hexfile(5c4306d8553b3696)., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, conf_setdef_hexfilecxx . . $ pvpgn/bnetd/conf_setdef_hexfile(b126dc7c1de90089). }, |
| 100 | #ifdef DO_DAEMONIZEcxx . . $ `src/common/setup_before.h:353:10`! |
| 101 | { "f", conf_set_foregroundcxx . . $ pvpgn/bnetd/conf_set_foreground(5c4306d8553b3696)., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, conf_setdef_foregroundcxx . . $ pvpgn/bnetd/conf_setdef_foreground(b126dc7c1de90089). }, |
| 102 | { "foreground", conf_set_foregroundcxx . . $ pvpgn/bnetd/conf_set_foreground(5c4306d8553b3696)., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, conf_setdef_foregroundcxx . . $ pvpgn/bnetd/conf_setdef_foreground(b126dc7c1de90089). }, |
| 103 | #endif |
| 104 | { "D", conf_set_debugcxx . . $ pvpgn/bnetd/conf_set_debug(5c4306d8553b3696)., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, conf_setdef_debugcxx . . $ pvpgn/bnetd/conf_setdef_debug(b126dc7c1de90089). }, |
| 105 | { "debug", conf_set_debugcxx . . $ pvpgn/bnetd/conf_set_debug(5c4306d8553b3696)., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, conf_setdef_debugcxx . . $ pvpgn/bnetd/conf_setdef_debug(b126dc7c1de90089). }, |
| 106 | { "h", conf_set_helpcxx . . $ pvpgn/bnetd/conf_set_help(5c4306d8553b3696)., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, conf_setdef_helpcxx . . $ pvpgn/bnetd/conf_setdef_help(b126dc7c1de90089). }, |
| 107 | { "help", conf_set_helpcxx . . $ pvpgn/bnetd/conf_set_help(5c4306d8553b3696)., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, conf_setdef_helpcxx . . $ pvpgn/bnetd/conf_setdef_help(b126dc7c1de90089). }, |
| 108 | { "usage", conf_set_helpcxx . . $ pvpgn/bnetd/conf_set_help(5c4306d8553b3696)., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, conf_setdef_helpcxx . . $ pvpgn/bnetd/conf_setdef_help(b126dc7c1de90089). }, |
| 109 | { "v", conf_set_versioncxx . . $ pvpgn/bnetd/conf_set_version(5c4306d8553b3696)., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, conf_setdef_versioncxx . . $ pvpgn/bnetd/conf_setdef_version(b126dc7c1de90089). }, |
| 110 | { "version", conf_set_versioncxx . . $ pvpgn/bnetd/conf_set_version(5c4306d8553b3696)., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, conf_setdef_versioncxx . . $ pvpgn/bnetd/conf_setdef_version(b126dc7c1de90089). }, |
| 111 | #ifdef WIN32 |
| 112 | { "service", conf_set_service, NULL, conf_setdef_service }, |
| 113 | { "s", conf_set_servaction, NULL, conf_setdef_servaction }, |
| 114 | #endif |
| 115 | #ifdef WIN32_GUI |
| 116 | { "console", conf_set_console, NULL, conf_setdef_console }, |
| 117 | { "gui", conf_set_gui, NULL, conf_setdef_gui }, |
| 118 | #endif |
| 119 | { NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`! } |
| 120 | }; |
| 121 | |
| 122 | static void usagecxx . . $ pvpgn/bnetd/usage(49f6e7a06ebc5aa8).(void) |
| 123 | { |
| 124 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, |
| 125 | "usage: %s [<options>]\n" |
| 126 | " -c FILE, --config=FILE use FILE as configuration file (default is " BNETD_DEFAULT_CONF_FILEcxx . . $ `build/config.h:88:9`! ")\n" |
| 127 | " -d FILE, --hexdump=FILE do hex dump of packets into FILE\n" |
| 128 | #ifdef DO_DAEMONIZEcxx . . $ `src/common/setup_before.h:353:10`! |
| 129 | " -f, --foreground don't daemonize\n" |
| 130 | #endif |
| 131 | " -D, --debug run in debug mode (run in foreground and log to stdout)\n" |
| 132 | " -h, --help, --usage show this information and exit\n" |
| 133 | " -v, --version print version number and exit\n" |
| 134 | #ifdef WIN32 |
| 135 | " Running as service functions:\n" |
| 136 | " --service run as service\n" |
| 137 | " -s install install service\n" |
| 138 | " -s uninstall uninstall service\n" |
| 139 | #endif |
| 140 | #ifdef WIN32GUI |
| 141 | " -console run in console mode\n" |
| 142 | #endif |
| 143 | , prognamecxx . . $ pvpgn/bnetd/progname.); |
| 144 | } |
| 145 | |
| 146 | extern int cmdline_loadcxx . . $ pvpgn/bnetd/cmdline_load(afcd3168fc1188a4).(int argc, char** argv) |
| 147 | { |
| 148 | int res; |
| 149 | |
| 150 | if (argc < 1 || !argv || !argv[0]) { |
| 151 | stdcxx . . $ std/::fprintfcxx . . $ std/fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "bad arguments\n"); |
| 152 | return -1; |
| 153 | } |
| 154 | |
| 155 | exitflagcxx . . $ pvpgn/bnetd/exitflag. = 0; |
| 156 | prognamecxx . . $ pvpgn/bnetd/progname. = argv[0]; |
| 157 | |
| 158 | res = conf_load_cmdlinecxx . . $ pvpgn/conf_load_cmdline(8a18c527fa86306c).(argc, argv, conftabcxx . . $ pvpgn/bnetd/conftab.); |
| 159 | if (res < 0) return -1; |
| 160 | return exitflagcxx . . $ pvpgn/bnetd/exitflag. ? 0 : 1; |
| 161 | } |
| 162 | |
| 163 | extern void cmdline_unloadcxx . . $ pvpgn/bnetd/cmdline_unload(49f6e7a06ebc5aa8).(void) |
| 164 | { |
| 165 | conf_unloadcxx . . $ pvpgn/conf_unload(ffbf16c7007c705c).(conftabcxx . . $ pvpgn/bnetd/conftab.); |
| 166 | } |
| 167 | |
| 168 | #ifdef DO_DAEMONIZEcxx . . $ `src/common/setup_before.h:353:10`! |
| 169 | extern int cmdline_get_foregroundcxx . . $ pvpgn/bnetd/cmdline_get_foreground(b126dc7c1de90089).(void) |
| 170 | { |
| 171 | return cmdline_configcxx . . $ pvpgn/bnetd/cmdline_config..foregroundcxx . . $ pvpgn/bnetd/$anonymous_type_d3bcaaac0f07f7e3_0#foreground.; |
| 172 | } |
| 173 | |
| 174 | static int conf_set_foregroundcxx . . $ pvpgn/bnetd/conf_set_foreground(5c4306d8553b3696).(const char *valstr) |
| 175 | { |
| 176 | return conf_set_boolcxx . . $ pvpgn/conf_set_bool(5db442afce5f848d).(&cmdline_configcxx . . $ pvpgn/bnetd/cmdline_config..foregroundcxx . . $ pvpgn/bnetd/$anonymous_type_d3bcaaac0f07f7e3_0#foreground., valstr, 0); |
| 177 | } |
| 178 | |
| 179 | static int conf_setdef_foregroundcxx . . $ pvpgn/bnetd/conf_setdef_foreground(b126dc7c1de90089).(void) |
| 180 | { |
| 181 | return conf_set_boolcxx . . $ pvpgn/conf_set_bool(5db442afce5f848d).(&cmdline_configcxx . . $ pvpgn/bnetd/cmdline_config..foregroundcxx . . $ pvpgn/bnetd/$anonymous_type_d3bcaaac0f07f7e3_0#foreground., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, 0); |
| 182 | } |
| 183 | #endif |
| 184 | |
| 185 | extern const char* cmdline_get_preffilecxx . . $ pvpgn/bnetd/cmdline_get_preffile(33a1f659e94feb42).(void) |
| 186 | { |
| 187 | return cmdline_configcxx . . $ pvpgn/bnetd/cmdline_config..preffilecxx . . $ pvpgn/bnetd/$anonymous_type_d3bcaaac0f07f7e3_0#preffile.; |
| 188 | } |
| 189 | |
| 190 | static int conf_set_preffilecxx . . $ pvpgn/bnetd/conf_set_preffile(5c4306d8553b3696).(const char *valstr) |
| 191 | { |
| 192 | return conf_set_strcxx . . $ pvpgn/conf_set_str(ef5efe93f374dbad).(&cmdline_configcxx . . $ pvpgn/bnetd/cmdline_config..preffilecxx . . $ pvpgn/bnetd/$anonymous_type_d3bcaaac0f07f7e3_0#preffile., valstr, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 193 | } |
| 194 | |
| 195 | static int conf_setdef_preffilecxx . . $ pvpgn/bnetd/conf_setdef_preffile(b126dc7c1de90089).(void) |
| 196 | { |
| 197 | return conf_set_strcxx . . $ pvpgn/conf_set_str(ef5efe93f374dbad).(&cmdline_configcxx . . $ pvpgn/bnetd/cmdline_config..preffilecxx . . $ pvpgn/bnetd/$anonymous_type_d3bcaaac0f07f7e3_0#preffile., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, BNETD_DEFAULT_CONF_FILEcxx . . $ `build/config.h:88:9`!); |
| 198 | } |
| 199 | |
| 200 | |
| 201 | extern const char* cmdline_get_hexfilecxx . . $ pvpgn/bnetd/cmdline_get_hexfile(33a1f659e94feb42).(void) |
| 202 | { |
| 203 | return cmdline_configcxx . . $ pvpgn/bnetd/cmdline_config..hexfilecxx . . $ pvpgn/bnetd/$anonymous_type_d3bcaaac0f07f7e3_0#hexfile.; |
| 204 | } |
| 205 | |
| 206 | static int conf_set_hexfilecxx . . $ pvpgn/bnetd/conf_set_hexfile(5c4306d8553b3696).(const char *valstr) |
| 207 | { |
| 208 | return conf_set_strcxx . . $ pvpgn/conf_set_str(ef5efe93f374dbad).(&cmdline_configcxx . . $ pvpgn/bnetd/cmdline_config..hexfilecxx . . $ pvpgn/bnetd/$anonymous_type_d3bcaaac0f07f7e3_0#hexfile., valstr, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 209 | } |
| 210 | |
| 211 | static int conf_setdef_hexfilecxx . . $ pvpgn/bnetd/conf_setdef_hexfile(b126dc7c1de90089).(void) |
| 212 | { |
| 213 | return conf_set_strcxx . . $ pvpgn/conf_set_str(ef5efe93f374dbad).(&cmdline_configcxx . . $ pvpgn/bnetd/cmdline_config..hexfilecxx . . $ pvpgn/bnetd/$anonymous_type_d3bcaaac0f07f7e3_0#hexfile., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!); |
| 214 | } |
| 215 | |
| 216 | |
| 217 | static int conf_set_debugcxx . . $ pvpgn/bnetd/conf_set_debug(5c4306d8553b3696).(const char *valstr) |
| 218 | { |
| 219 | conf_set_boolcxx . . $ pvpgn/conf_set_bool(5db442afce5f848d).(&cmdline_configcxx . . $ pvpgn/bnetd/cmdline_config..debugcxx . . $ pvpgn/bnetd/$anonymous_type_d3bcaaac0f07f7e3_0#debug., valstr, 0); |
| 220 | if (cmdline_configcxx . . $ pvpgn/bnetd/cmdline_config..debugcxx . . $ pvpgn/bnetd/$anonymous_type_d3bcaaac0f07f7e3_0#debug.) eventlog_set_debugmodecxx . . $ pvpgn/eventlog_set_debugmode(d4f767463ce0a6b3).(1); |
| 221 | #ifdef DO_DAEMONIZEcxx . . $ `src/common/setup_before.h:353:10`! |
| 222 | cmdline_configcxx . . $ pvpgn/bnetd/cmdline_config..foregroundcxx . . $ pvpgn/bnetd/$anonymous_type_d3bcaaac0f07f7e3_0#foreground. = 1; |
| 223 | #endif |
| 224 | return 0; |
| 225 | } |
| 226 | |
| 227 | static int conf_setdef_debugcxx . . $ pvpgn/bnetd/conf_setdef_debug(b126dc7c1de90089).(void) |
| 228 | { |
| 229 | return conf_set_boolcxx . . $ pvpgn/conf_set_bool(5db442afce5f848d).(&cmdline_configcxx . . $ pvpgn/bnetd/cmdline_config..debugcxx . . $ pvpgn/bnetd/$anonymous_type_d3bcaaac0f07f7e3_0#debug., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!, 0); |
| 230 | } |
| 231 | |
| 232 | static int conf_set_helpcxx . . $ pvpgn/bnetd/conf_set_help(5c4306d8553b3696).(const char *valstr) |
| 233 | { |
| 234 | unsigned tmp = 0; |
| 235 | |
| 236 | conf_set_boolcxx . . $ pvpgn/conf_set_bool(5db442afce5f848d).(&tmp, valstr, 0); |
| 237 | if (tmp) { |
| 238 | usagecxx . . $ pvpgn/bnetd/usage(49f6e7a06ebc5aa8).(); |
| 239 | exitflagcxx . . $ pvpgn/bnetd/exitflag. = 1; |
| 240 | } |
| 241 | |
| 242 | return 0; |
| 243 | } |
| 244 | |
| 245 | static int conf_setdef_helpcxx . . $ pvpgn/bnetd/conf_setdef_help(b126dc7c1de90089).(void) |
| 246 | { |
| 247 | return 0; |
| 248 | } |
| 249 | |
| 250 | |
| 251 | static int conf_set_versioncxx . . $ pvpgn/bnetd/conf_set_version(5c4306d8553b3696).(const char *valstr) |
| 252 | { |
| 253 | unsigned tmp = 0; |
| 254 | |
| 255 | conf_set_boolcxx . . $ pvpgn/conf_set_bool(5db442afce5f848d).(&tmp, valstr, 0); |
| 256 | if (tmp) { |
| 257 | #ifdef WIN32_GUI |
| 258 | gui_lvprintf(eventlog_level_info, PVPGN_SOFTWARE" version " PVPGN_VERSION "\n"); |
| 259 | #else |
| 260 | stdcxx . . $ std/::printfcxx . . $ std/printf(581fddd72a8db8fc).(PVPGN_SOFTWAREcxx . . $ `src/common/version.h:28:9`!" version " PVPGN_VERSIONcxx . . $ `src/common/version.h:23:9`! "\n"); |
| 261 | #endif |
| 262 | exitflagcxx . . $ pvpgn/bnetd/exitflag. = 1; |
| 263 | } |
| 264 | |
| 265 | return 0; |
| 266 | } |
| 267 | |
| 268 | static int conf_setdef_versioncxx . . $ pvpgn/bnetd/conf_setdef_version(b126dc7c1de90089).(void) |
| 269 | { |
| 270 | return 0; |
| 271 | } |
| 272 | |
| 273 | #ifdef WIN32 |
| 274 | static int conf_set_service(const char *valstr) |
| 275 | { |
| 276 | unsigned tmp = 0; |
| 277 | |
| 278 | conf_set_bool(&tmp, valstr, 0); |
| 279 | if (tmp) { |
| 280 | Win32_ServiceRun(); |
| 281 | exitflag = 1; |
| 282 | } |
| 283 | |
| 284 | return 0; |
| 285 | } |
| 286 | |
| 287 | static int conf_setdef_service(void) |
| 288 | { |
| 289 | return 0; |
| 290 | } |
| 291 | |
| 292 | |
| 293 | static int conf_set_servaction(const char *valstr) |
| 294 | { |
| 295 | const char* tmp = NULL; |
| 296 | |
| 297 | conf_set_str(&tmp, valstr, NULL); |
| 298 | |
| 299 | if (tmp) { |
| 300 | if (!strcasecmp(tmp, "install")) { |
| 301 | std::fprintf(stderr, "Installing service"); |
| 302 | Win32_ServiceInstall(); |
| 303 | } |
| 304 | else if (!strcasecmp(tmp, "uninstall")) { |
| 305 | std::fprintf(stderr, "Uninstalling service"); |
| 306 | Win32_ServiceUninstall(); |
| 307 | } |
| 308 | else { |
| 309 | std::fprintf(stderr, "Unknown service action '%s'\n", tmp); |
| 310 | } |
| 311 | |
| 312 | exitflag = 1; |
| 313 | xfree((void *)tmp); |
| 314 | } |
| 315 | |
| 316 | return 0; |
| 317 | } |
| 318 | |
| 319 | static int conf_setdef_servaction(void) |
| 320 | { |
| 321 | return 0; |
| 322 | } |
| 323 | #endif |
| 324 | |
| 325 | |
| 326 | #ifdef WIN32_GUI |
| 327 | |
| 328 | static int conf_set_console(const char *valstr) |
| 329 | { |
| 330 | conf_set_bool(&cmdline_config.console, valstr, 0); |
| 331 | if (cmdline_config.console){ |
| 332 | conf_set_bool(&cmdline_config.gui, NULL, 0); |
| 333 | } |
| 334 | return 0; |
| 335 | } |
| 336 | |
| 337 | static int conf_setdef_console(void) |
| 338 | { |
| 339 | return conf_set_bool(&cmdline_config.console, NULL, 0); |
| 340 | } |
| 341 | |
| 342 | extern unsigned cmdline_get_console(void){ |
| 343 | return cmdline_config.console; |
| 344 | } |
| 345 | |
| 346 | |
| 347 | static int conf_set_gui(const char *valstr) |
| 348 | { |
| 349 | conf_set_bool(&cmdline_config.gui, valstr, 0); |
| 350 | if (cmdline_config.gui){ |
| 351 | } |
| 352 | return 0; |
| 353 | } |
| 354 | |
| 355 | static int conf_setdef_gui(void) |
| 356 | { |
| 357 | return conf_set_bool(&cmdline_config.gui, NULL, 1); |
| 358 | } |
| 359 | |
| 360 | extern unsigned cmdline_get_gui(void){ |
| 361 | return cmdline_config.gui; |
| 362 | } |
| 363 | |
| 364 | #endif |
| 365 | |
| 366 | } |
| 367 | |
| 368 | } |