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