Freeciv-3.1: /fast/freeciv/nightly/S3_1/server/civserver.c Source File

Freeciv-3.1

Loading...
Searching...
No Matches
civserver.c
Go to the documentation of this file.
1/***********************************************************************
2 Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
6 any later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12***********************************************************************/
13
14#ifdef HAVE_CONFIG_H
15#include <fc_config.h>
16#endif
17
18#include "fc_prehdrs.h"
19
20#include <stdio.h>
21#include <stdlib.h>
22#include <string.h>
23
24#ifdef HAVE_UNISTD_H
25#include <unistd.h>
26#endif
27
28#ifdef HAVE_SIGNAL_H
29#include <signal.h>
30#endif
31
32#ifdef GENERATING_MAC /* mac header(s) */
33#include <Controls.h>
34#include <Dialogs.h>
35#endif
36
37#ifdef FREECIV_MSWINDOWS
38#include <windows.h>
39#endif
40
41/* utility */
42#include "deprecations.h"
43#include "fc_cmdline.h"
44#include "fciconv.h"
45#include "fcintl.h"
46#include "log.h"
47#include "support.h"
48#include "timing.h"
49
50/* common */
51#include "capstr.h"
52#include "fc_cmdhelp.h"
53#include "game.h"
54#include "version.h"
55
56/* server */
57#include "aiiface.h"
58#include "console.h"
59#include "meta.h"
60#include "sernet.h"
61#include "srv_main.h"
62
63/* server/savegame */
64#include "savemain.h"
65
66#ifdef GENERATING_MAC
67static void Mac_options(int argc); /* don't need argv */
68#endif
69
70#ifdef HAVE_SIGNAL_H
71# define USE_INTERRUPT_HANDLERS
72#endif
73
74#ifdef USE_INTERRUPT_HANDLERS
75#define save_and_exit(sig) \
76if (S_S_RUNNING == server_state()) { \
77 save_game_auto(#sig, AS_INTERRUPT); \
78 save_system_close(); \
79} \
80exit(EXIT_SUCCESS);
81
82/**********************************************************************/
86static void signal_handler(int sig)
87{
88 static struct timer *timer = NULL;
89
90 switch (sig) {
91 case SIGINT:
92 if (timer && timer_read_seconds(timer) <= 1.0) {
93 save_and_exit(SIGINT);
94 } else {
95 if (game.info.timeout == -1) {
96 log_normal(_("Setting timeout to 0. Autogame will stop."));
97 game.info.timeout = 0;
98 }
99 if (!timer) {
100 log_normal(_("You must interrupt Freeciv twice "
101 "within one second to make it exit."));
102 }
103 }
104 timer = timer_renew(timer, TIMER_USER, TIMER_ACTIVE);
105 timer_start(timer);
106 break;
107
108#ifdef SIGHUP
109 case SIGHUP:
110 save_and_exit(SIGHUP);
111 break;
112#endif /* SIGHUP */
113
114 case SIGTERM:
115 save_and_exit(SIGTERM);
116 break;
117
118#ifdef SIGPIPE
119 case SIGPIPE:
120 if (signal(SIGPIPE, signal_handler) == SIG_ERR) {
121 /* Because the signal may have interrupted arbitrary code, we use
122 * fprintf() and _exit() here instead of log_*() and exit() so
123 * that we don't accidentally call any "unsafe" functions here
124 * (see the manual page for the signal function). */
125 fprintf(stderr, "\nFailed to reset SIGPIPE handler "
126 "while handling SIGPIPE.\n");
127 _exit(EXIT_FAILURE);
128 }
129 break;
130#endif /* SIGPIPE */
131 }
132}
133#endif /* USE_INTERRUPT_HANDLERS */
134
135/**********************************************************************/
140 int main(int argc, char *argv[])
141{
142 int inx;
143 bool showhelp = FALSE;
144 bool showvers = FALSE;
145 char *option = NULL;
146
147 /* Load Windows post-crash debugger */
148#ifdef FREECIV_MSWINDOWS
149# ifndef FREECIV_NDEBUG
150 if (LoadLibrary("exchndl.dll") == NULL) {
151# ifdef FREECIV_DEBUG
152 fprintf(stderr, "exchndl.dll could not be loaded, no crash debugger\n");
153# endif /* FREECIV_DEBUG */
154 }
155# endif /* FREECIV_NDEBUG */
156#endif /* FREECIV_MSWINDOWS */
157
158#ifdef USE_INTERRUPT_HANDLERS
159 if (SIG_ERR == signal(SIGINT, signal_handler)) {
160 fc_fprintf(stderr, _("Failed to install SIGINT handler: %s\n"),
161 fc_strerror(fc_get_errno()));
162 exit(EXIT_FAILURE);
163 }
164
165#ifdef SIGHUP
166 if (SIG_ERR == signal(SIGHUP, signal_handler)) {
167 fc_fprintf(stderr, _("Failed to install SIGHUP handler: %s\n"),
168 fc_strerror(fc_get_errno()));
169 exit(EXIT_FAILURE);
170 }
171#endif /* SIGHUP */
172
173 if (SIG_ERR == signal(SIGTERM, signal_handler)) {
174 fc_fprintf(stderr, _("Failed to install SIGTERM handler: %s\n"),
175 fc_strerror(fc_get_errno()));
176 exit(EXIT_FAILURE);
177 }
178
179#ifdef SIGPIPE
180 /* Ignore SIGPIPE, the error is handled by the return value
181 * of the write call. */
182 if (SIG_ERR == signal(SIGPIPE, signal_handler)) {
183 fc_fprintf(stderr, _("Failed to ignore SIGPIPE: %s\n"),
184 fc_strerror(fc_get_errno()));
185 exit(EXIT_FAILURE);
186 }
187#endif /* SIGPIPE */
188#endif /* USE_INTERRUPT_HANDLERS */
189
190 /* initialize server */
191 srv_init();
192
193 /* parse command-line arguments... */
194
195#ifdef GENERATING_MAC
196 Mac_options(argc);
197#endif
198 srvarg.announce = ANNOUNCE_DEFAULT;
199
200 game.server.meta_info.type[0] = '\0';
201
202 /* no we don't use GNU's getopt or even the "standard" getopt */
203 /* yes we do have reasons ;) */
204 /* FIXME: and that are? */
205 inx = 1;
206 while (inx < argc) {
207 if ((option = get_option_malloc("--file", argv, &inx, argc,
208 FALSE))) {
209 sz_strlcpy(srvarg.load_filename, option);
210 free(option);
211 } else if (is_option("--help", argv[inx])) {
212 showhelp = TRUE;
213 break;
214 } else if ((option = get_option_malloc("--log", argv, &inx, argc, TRUE))) {
215 srvarg.log_filename = option;
216#ifndef FREECIV_NDEBUG
217 } else if (is_option("--Fatal", argv[inx])) {
218 if (inx + 1 >= argc || '-' == argv[inx + 1][0]) {
219 srvarg.fatal_assertions = SIGABRT;
220 } else if (str_to_int(argv[inx + 1], &srvarg.fatal_assertions)) {
221 inx++;
222 } else {
223 fc_fprintf(stderr, _("Invalid signal number \"%s\".\n"),
224 argv[inx + 1]);
225 inx++;
226 showhelp = TRUE;
227 }
228#endif /* FREECIV_NDEBUG */
229 } else if ((option = get_option_malloc("--Ranklog", argv, &inx, argc, TRUE))) {
230 srvarg.ranklog_filename = option;
231 } else if (is_option("--keep", argv[inx])) {
232 srvarg.metaconnection_persistent = TRUE;
233 /* Implies --meta */
234 srvarg.metaserver_no_send = FALSE;
235 } else if (is_option("--nometa", argv[inx])) {
236 fc_fprintf(stderr, _("Warning: the %s option is obsolete. "
237 "Use -m to enable the metaserver.\n"), argv[inx]);
238 showhelp = TRUE;
239 } else if (is_option("--meta", argv[inx])) {
240 srvarg.metaserver_no_send = FALSE;
241 } else if ((option = get_option_malloc("--Metaserver",
242 argv, &inx, argc, FALSE))) {
243 sz_strlcpy(srvarg.metaserver_addr, option);
244 free(option);
245 srvarg.metaserver_no_send = FALSE; /* --Metaserver implies --meta */
246 } else if ((option = get_option_malloc("--identity",
247 argv, &inx, argc, FALSE))) {
248 sz_strlcpy(srvarg.identity_name, option);
249 free(option);
250 } else if ((option = get_option_malloc("--port", argv, &inx, argc, FALSE))) {
251 if (!str_to_int(option, &srvarg.port)) {
252 showhelp = TRUE;
253 break;
254 }
255 free(option);
256 } else if ((option = get_option_malloc("--bind", argv, &inx, argc, TRUE))) {
257 srvarg.bind_addr = option;
258 } else if ((option = get_option_malloc("--Bind-meta", argv, &inx, argc, TRUE))) {
259 srvarg.bind_meta_addr = option;
260#ifdef FREECIV_WEB
261 } else if ((option = get_option_malloc("--type", argv, &inx, argc, FALSE))) {
262 sz_strlcpy(game.server.meta_info.type, option);
263 free(option);
264#endif /* FREECIV_WEB */
265 } else if ((option = get_option_malloc("--read", argv, &inx, argc, TRUE)))
266 srvarg.script_filename = option;
267 else if ((option = get_option_malloc("--quitidle", argv, &inx, argc, FALSE))) {
268 if (!str_to_int(option, &srvarg.quitidle)) {
269 showhelp = TRUE;
270 break;
271 }
272 free(option);
273 } else if (is_option("--exit-on-end", argv[inx])) {
274 srvarg.exit_on_end = TRUE;
275 } else if ((option = get_option_malloc("--debug", argv, &inx, argc, FALSE))) {
276 if (!log_parse_level_str(option, &srvarg.loglevel)) {
277 showhelp = TRUE;
278 break;
279 }
280 free(option);
281#ifdef HAVE_FCDB
282 } else if ((option = get_option_malloc("--Database", argv, &inx, argc, FALSE))) {
283 /* Freed after file has been loaded - not here nor in server quit */
284 srvarg.fcdb_enabled = TRUE;
285 srvarg.fcdb_conf = option;
286 } else if (is_option("--auth", argv[inx])) {
287 srvarg.auth_enabled = TRUE;
288 } else if (is_option("--Guests", argv[inx])) {
289 srvarg.auth_allow_guests = TRUE;
290 } else if (is_option("--Newusers", argv[inx])) {
291 srvarg.auth_allow_newusers = TRUE;
292#endif /* HAVE_FCDB */
293 } else if ((option = get_option_malloc("--Serverid", argv, &inx, argc, FALSE))) {
294 sz_strlcpy(srvarg.serverid, option);
295 free(option);
296 } else if ((option = get_option_malloc("--saves", argv, &inx, argc, TRUE))) {
297 srvarg.saves_pathname = option;
298 } else if ((option = get_option_malloc("--scenarios", argv, &inx, argc, TRUE))) {
299 srvarg.scenarios_pathname = option;
300 } else if ((option = get_option_malloc("--ruleset", argv, &inx, argc, TRUE))) {
301 srvarg.ruleset = option;
302 } else if (is_option("--version", argv[inx])) {
303 showvers = TRUE;
304 } else if ((option = get_option_malloc("--Announce", argv, &inx, argc, FALSE))) {
305 if (!fc_strcasecmp(option, "ipv4")) {
306 srvarg.announce = ANNOUNCE_IPV4;
307 } else if (!fc_strcasecmp(option, "none")) {
308 srvarg.announce = ANNOUNCE_NONE;
309#ifdef FREECIV_IPV6_SUPPORT
310 } else if (!fc_strcasecmp(option, "ipv6")) {
311 srvarg.announce = ANNOUNCE_IPV6;
312#endif /* IPv6 support */
313 } else {
314 log_error(_("Illegal value \"%s\" for --Announce"), option);
315 }
316 free(option);
317 } else if (is_option("--warnings", argv[inx])) {
318 deprecation_warnings_enable();
319#ifdef AI_MODULES
320 } else if ((option = get_option_malloc("--LoadAI", argv, &inx, argc, FALSE))) {
321 if (!load_ai_module(option)) {
322 fc_fprintf(stderr, _("Failed to load AI module \"%s\"\n"), option);
323 exit(EXIT_FAILURE);
324 }
325 free(option);
326#endif /* AI_MODULES */
327 } else {
328 fc_fprintf(stderr, _("Error: unknown option '%s'\n"), argv[inx]);
329 showhelp = TRUE;
330 break;
331 }
332 inx++;
333 }
334
335 if (showvers && !showhelp) {
336 fc_fprintf(stderr, "%s \n", freeciv_name_version());
337 exit(EXIT_SUCCESS);
338 }
339 con_write(C_VERSION, _("This is the server for %s"), freeciv_name_version());
340 /* TRANS: No full stop after the URL, could cause confusion. */
341 con_write(C_COMMENT, _("You can learn a lot about Freeciv at %s"),
342 WIKI_URL);
343
344 if (showhelp) {
345 struct cmdhelp *help = cmdhelp_new(argv[0]);
346
347 cmdhelp_add(help, "A",
348 /* TRANS: "Announce" is exactly what user must type, do not translate. */
349 _("Announce PROTO"),
350 _("Announce game in LAN using protocol PROTO "
351 "(IPv4/IPv6/none)"));
352#ifdef HAVE_FCDB
353 cmdhelp_add(help, "D",
354 /* TRANS: "Database" is exactly what user must type, do not translate. */
355 _("Database FILE"),
356 _("Enable database connection with configuration from "
357 "FILE."));
358 cmdhelp_add(help, "a", "auth",
359 _("Enable server authentication (requires --Database)."));
360 cmdhelp_add(help, "G", "Guests",
361 _("Allow guests to login if auth is enabled."));
362 cmdhelp_add(help, "N", "Newusers",
363 _("Allow new users to login if auth is enabled."));
364#endif /* HAVE_FCDB */
365 cmdhelp_add(help, "b",
366 /* TRANS: "bind" is exactly what user must type, do not translate. */
367 _("bind ADDR"),
368 _("Listen for clients on ADDR"));
369 cmdhelp_add(help, "B", "Bind-meta ADDR",
370 _("Connect to metaserver from this address"));
371#ifdef FREECIV_DEBUG
372 cmdhelp_add(help, "d",
373 /* TRANS: "debug" is exactly what user must type, do not translate. */
374 _("debug LEVEL"),
375 _("Set debug log level (one of f,e,w,n,v,d, or "
376 "d:file1,min,max:...)"));
377#else /* FREECIV_DEBUG */
378 cmdhelp_add(help, "d",
379 /* TRANS: "debug" is exactly what user must type, do not translate. */
380 _("debug LEVEL"),
381 _("Set debug log level (one of f,e,w,n,v)"));
382#endif /* FREECIV_DEBUG */
383#ifndef FREECIV_NDEBUG
384 cmdhelp_add(help, "F",
385 /* TRANS: "Fatal" is exactly what user must type, do not translate. */
386 _("Fatal [SIGNAL]"),
387 _("Raise a signal on failed assertion"));
388#endif /* FREECIV_NDEBUG */
389 cmdhelp_add(help, "f",
390 /* TRANS: "file" is exactly what user must type, do not translate. */
391 _("file FILE"),
392 _("Load saved game FILE"));
393 cmdhelp_add(help, "h", "help",
394 _("Print a summary of the options"));
395 cmdhelp_add(help, "i",
396 /* TRANS: "identity" is exactly what user must type, do not translate. */
397 _("identity ADDR"),
398 _("Be known as ADDR at metaserver or LAN client"));
399 cmdhelp_add(help, "l",
400 /* TRANS: "log" is exactly what user must type, do not translate. */
401 _("log FILE"),
402 _("Use FILE as logfile"));
403 cmdhelp_add(help, "m", "meta",
404 _("Notify metaserver and send server's info"));
405 cmdhelp_add(help, "M",
406 /* TRANS: "Metaserver" is exactly what user must type, do not translate. */
407 _("Metaserver ADDR"),
408 _("Set ADDR as metaserver address"));
409#ifdef FREECIV_WEB
410 cmdhelp_add(help, "t",
411 /* TRANS: "type" is exactly what user must type, do not translate. */
412 _("type TYPE"),
413 _("Set TYPE as server type in metaserver"));
414#endif /* FREECIV_WEB */
415 cmdhelp_add(help, "k", "keep",
416 _("Keep updating game information on metaserver even after "
417 "failure")),
418 cmdhelp_add(help, "p",
419 /* TRANS: "port" is exactly what user must type, do not translate. */
420 _("port PORT"),
421 _("Listen for clients on port PORT"));
422 cmdhelp_add(help, "q",
423 /* TRANS: "quitidle" is exactly what user must type, do not translate. */
424 _("quitidle TIME"),
425 _("Quit if no players for TIME seconds"));
426 cmdhelp_add(help, "e", "exit-on-end",
427 _("When a game ends, exit instead of restarting"));
428 cmdhelp_add(help, "s",
429 /* TRANS: "saves" is exactly what user must type, do not translate. */
430 _("saves DIR"),
431 _("Save games to directory DIR"));
432 cmdhelp_add(help, NULL,
433 /* TRANS: "scenarios" is exactly what user must type, do not translate. */
434 _("scenarios DIR"),
435 _("Save scenarios to directory DIR"));
436 cmdhelp_add(help, "S",
437 /* TRANS: "Serverid" is exactly what user must type, do not translate. */
438 _("Serverid ID"),
439 _("Sets the server id to ID"));
440 cmdhelp_add(help, "r",
441 /* TRANS: "read" is exactly what user must type, do not translate. */
442 _("read FILE"),
443 _("Read startup script FILE"));
444 cmdhelp_add(help, "R",
445 /* TRANS: "Ranklog" is exactly what user must type, do not translate. */
446 _("Ranklog FILE"),
447 _("Use FILE as ranking logfile"));
448 cmdhelp_add(help, NULL,
449 /* TRANS: "ruleset" is exactly what user must type, do not translate. */
450 _("ruleset RULESET"),
451 _("Load ruleset RULESET"));
452#ifdef AI_MODULES
453 cmdhelp_add(help, "L",
454 /* TRANS: "LoadAI" is exactly what user must type, do not translate. */
455 _("LoadAI MODULE"),
456 _("Load ai module MODULE. Can appear multiple times"));
457#endif /* AI_MODULES */
458 cmdhelp_add(help, "v", "version",
459 _("Print the version number"));
460 cmdhelp_add(help, "w", "warnings",
461 _("Warn about deprecated modpack constructs"));
462
463 /* The function below prints a header and footer for the options.
464 * Furthermore, the options are sorted. */
465 cmdhelp_display(help, TRUE, FALSE, TRUE);
466 cmdhelp_destroy(help);
467
468 exit(EXIT_SUCCESS);
469 }
470
471#ifdef HAVE_FCDB
472 if (srvarg.auth_enabled && !srvarg.fcdb_enabled) {
473 fc_fprintf(stderr,
474 _("Requested authentication with --auth, "
475 "but no --Database given\n"));
476 exit(EXIT_FAILURE);
477 }
478#endif /* HAVE_FCDB */
479
480 /* disallow running as root -- too dangerous */
481 dont_run_as_root(argv[0], "freeciv_server");
482
483 init_our_capability();
484
485 /* have arguments, call the main server loop... */
486 srv_main();
487
488 /* Technically, we won't ever get here. We exit via server_quit. */
489
490 /* done */
491 exit(EXIT_SUCCESS);
492}
493
494#ifdef GENERATING_MAC
495/**********************************************************************/
498static void Mac_options(int argc)
499{
500#define HARDCODED_OPT
501 /*temporary hack since GetNewDialog() doesn't want to work*/
502#ifdef HARDCODED_OPT
503 srvarg.log_filename = "log.out";
504 srvarg.loglevel = LOG_DEBUG;
505#else /* HARDCODED_OPT */
506 if (argc == 0) {
507 OSErr err;
508 DialogPtr optptr;
509 Ptr storage;
510 Handle ditl;
511 Handle dlog;
512 short the_type;
513 Handle the_handle;
514 Rect the_rect;
515 short the_item, old_item=16;
516 int done = false;
517 Str255 the_string;
518
519 /* load/init the stuff for the dialog */
520 storage = NewPtr(sizeof(DialogRecord));
521 if (storage == 0) {
522 exit(EXIT_FAILURE);
523 }
524 ditl = Get1Resource('DITL',200);
525 if ((ditl == 0) || (ResError())) {
526 exit(EXIT_FAILURE);
527 }
528 dlog = Get1Resource('DLOG',200);
529 if ((dlog == 0) || (ResError())) {
530 exit(EXIT_FAILURE);
531 }
532 /* make the dialog */
533 optptr = GetNewDialog(200, storage, (WindowPtr)-1L);
534 /* setup the dialog */
535 err = SetDialogDefaultItem(optptr, 1);
536 if (err != 0) {
537 exit(EXIT_FAILURE);
538 }
539 /* insert default highlight draw code? */
540 err=SetDialogCancelItem(optptr, 2);
541 if (err != 0) {
542 exit(EXIT_FAILURE);
543 }
544 err=SetDialogTracksCursor(optptr, true);
545 if (err != 0) {
546 exit(EXIT_FAILURE);
547 }
548 GetDItem(optptr, 16/*normal radio button*/, &the_type, &the_handle, &the_rect);
549 SetCtlValue((ControlHandle)the_handle, true);
550
551 while (!done) /* loop */
552 {
553 ModalDialog(0L, &the_item);/* don't feed 0 where a upp is expected? */
554 /* old book suggests using OL(NIL) as the first argument, but
555 It doesn't include anything about UPPs either, so... */
556 switch (the_item) {
557 case 1:
558 done = true;
559 break;
560 case 2:
561 exit(EXIT_SUCCESS);
562 break;
563 case 13:
564 GetDItem(optptr, 13, &the_type, &the_handle, &the_rect);
565 srvarg.metaserver_no_send=GetCtlValue((ControlHandle)the_handle);
566 SetCtlValue((ControlHandle)the_handle, !srvarg.metaserver_no_send);
567 break;
568 case 15:
569 case 16:
570 case 17:
571 GetDItem(optptr, old_item, &the_type, &the_handle, &the_rect);
572 SetCtlValue((ControlHandle)the_handle, false);
573 old_item=the_item;
574 GetDItem(optptr, the_item, &the_type, &the_handle, &the_rect);
575 SetCtlValue((ControlHandle)the_handle, true);
576 break;
577 }
578 }
579 /* now, load the dialog items into the correct variables interpritation */
580 GetDItem( optptr, 4, &the_type, &the_handle, &the_rect);
581 GetIText( the_handle, (unsigned char *)srvarg.load_filename);
582 GetDItem( optptr, 8, &the_type, &the_handle, &the_rect);
583 GetIText( the_handle, (unsigned char *)srvarg.log_filename);
584 GetDItem( optptr, 12, &the_type, &the_handle, &the_rect);
585 GetIText( the_handle, the_string);
586 sscanf(the_string, "%d", srvarg.port);
587 GetDItem( optptr, 10, &the_type, &the_handle, &the_rect);
588 GetIText( the_handle, (unsigned char *)srvarg.script_filename);
589 GetDItem(optptr, 15, &the_type, &the_handle, &the_rect);
590 if (GetControlValue((ControlHandle)the_handle)) {
591 srvarg.loglevel = LOG_FATAL;
592 }
593 GetDItem(optptr, 16, &the_type, &the_handle, &the_rect);
594 if (GetControlValue((ControlHandle)the_handle)) {
595 srvarg.loglevel = LOG_NORMAL;
596 }
597 GetDItem(optptr, 17, &the_type, &the_handle, &the_rect);
598 if (GetControlValue((ControlHandle)the_handle)) {
599 srvarg.loglevel = LOG_VERBOSE;
600 }
601 DisposeDialog(optptr);/*get rid of the dialog after sorting out the options*/
602 DisposePtr(storage);/*clean up the allocated memory*/
603 }
604#endif /* HARDCODED_OPT */
605#undef HARDCODED_OPT
606}
607#endif /* GENERATING_MAC */
aiiface.h
load_ai_module
bool load_ai_module(const char *modname)
init_our_capability
void init_our_capability(void)
Definition capstr.c:87
capstr.h
main
int main(int argc, char *argv[])
Definition civserver.c:140
con_write
void con_write(enum rfc_status rfc_status, const char *message,...)
Definition console.c:203
console.h
C_COMMENT
@ C_COMMENT
Definition console.h:37
C_VERSION
@ C_VERSION
Definition console.h:38
deprecation_warnings_enable
void deprecation_warnings_enable(void)
Definition deprecations.c:35
deprecations.h
cmdhelp_destroy
void cmdhelp_destroy(struct cmdhelp *pcmdhelp)
Definition fc_cmdhelp.c:70
cmdhelp_display
void cmdhelp_display(struct cmdhelp *pcmdhelp, bool sort, bool gui_options, bool report_bugs)
Definition fc_cmdhelp.c:104
cmdhelp_new
struct cmdhelp * cmdhelp_new(const char *cmdname)
Definition fc_cmdhelp.c:57
cmdhelp_add
void cmdhelp_add(struct cmdhelp *pcmdhelp, const char *shortarg, const char *longarg, const char *helpstr,...)
Definition fc_cmdhelp.c:86
fc_cmdhelp.h
is_option
bool is_option(const char *option_name, char *option)
Definition fc_cmdline.c:112
get_option_malloc
char * get_option_malloc(const char *option_name, char **argv, int *i, int argc, bool gc)
Definition fc_cmdline.c:50
fc_cmdline.h
fc_prehdrs.h
fciconv.h
fc_fprintf
void fc_fprintf(FILE *stream, const char *format,...) fc__attribute((__format__(__printf__
fcintl.h
_
#define _(String)
Definition fcintl.h:67
game
struct civ_game game
Definition game.c:57
game.h
log_parse_level_str
bool log_parse_level_str(const char *level_str, enum log_level *ret_level)
Definition log.c:86
log.h
log_normal
#define log_normal(message,...)
Definition log.h:107
LOG_DEBUG
@ LOG_DEBUG
Definition log.h:34
LOG_NORMAL
@ LOG_NORMAL
Definition log.h:32
LOG_FATAL
@ LOG_FATAL
Definition log.h:29
LOG_VERBOSE
@ LOG_VERBOSE
Definition log.h:33
log_error
#define log_error(message,...)
Definition log.h:103
meta.h
ANNOUNCE_IPV6
@ ANNOUNCE_IPV6
Definition net_types.h:56
ANNOUNCE_IPV4
@ ANNOUNCE_IPV4
Definition net_types.h:55
ANNOUNCE_NONE
@ ANNOUNCE_NONE
Definition net_types.h:54
ANNOUNCE_DEFAULT
#define ANNOUNCE_DEFAULT
Definition net_types.h:59
savemain.h
sernet.h
dont_run_as_root
void dont_run_as_root(const char *argv0, const char *fallback)
Definition shared.c:1539
str_to_int
bool str_to_int(const char *str, int *pint)
Definition shared.c:512
srv_main
void srv_main(void)
Definition srv_main.c:3451
srvarg
struct server_arguments srvarg
Definition srv_main.c:173
srv_init
void srv_init(void)
Definition srv_main.c:224
srv_main.h
civ_game::type
char type[20]
Definition game.h:263
civ_game::server
struct civ_game::@30::@34 server
civ_game::info
struct packet_game_info info
Definition game.h:89
civ_game::meta_info
struct civ_game::@30::@34::@37 meta_info
cmdhelp
Definition fc_cmdhelp.c:43
option
Definition options.c:454
packet_game_info::timeout
int timeout
Definition packets_gen.h:233
server_arguments::metaconnection_persistent
bool metaconnection_persistent
Definition srv_main.h:30
server_arguments::bind_addr
char * bind_addr
Definition srv_main.h:34
server_arguments::loglevel
enum log_level loglevel
Definition srv_main.h:40
server_arguments::metaserver_addr
char metaserver_addr[256]
Definition srv_main.h:29
server_arguments::scenarios_pathname
char * scenarios_pathname
Definition srv_main.h:47
server_arguments::exit_on_end
bool exit_on_end
Definition srv_main.h:53
server_arguments::announce
enum announce_type announce
Definition srv_main.h:60
server_arguments::load_filename
char load_filename[512]
Definition srv_main.h:44
server_arguments::fcdb_conf
char * fcdb_conf
Definition srv_main.h:56
server_arguments::auth_allow_guests
bool auth_allow_guests
Definition srv_main.h:58
server_arguments::fcdb_enabled
bool fcdb_enabled
Definition srv_main.h:55
server_arguments::saves_pathname
char * saves_pathname
Definition srv_main.h:46
server_arguments::log_filename
char * log_filename
Definition srv_main.h:42
server_arguments::fatal_assertions
int fatal_assertions
Definition srv_main.h:61
server_arguments::ranklog_filename
char * ranklog_filename
Definition srv_main.h:43
server_arguments::quitidle
int quitidle
Definition srv_main.h:51
server_arguments::metaserver_no_send
bool metaserver_no_send
Definition srv_main.h:28
server_arguments::bind_meta_addr
char * bind_meta_addr
Definition srv_main.h:38
server_arguments::ruleset
char * ruleset
Definition srv_main.h:48
server_arguments::auth_enabled
bool auth_enabled
Definition srv_main.h:57
server_arguments::auth_allow_newusers
bool auth_allow_newusers
Definition srv_main.h:59
server_arguments::script_filename
char * script_filename
Definition srv_main.h:45
server_arguments::serverid
char serverid[256]
Definition srv_main.h:49
server_arguments::identity_name
char identity_name[256]
Definition srv_main.h:31
server_arguments::port
int port
Definition srv_main.h:36
signal
Definition luascript_signal.c:75
timer
Definition timing.c:81
fc_strcasecmp
int fc_strcasecmp(const char *str0, const char *str1)
Definition support.c:189
fc_strerror
const char * fc_strerror(fc_errno err)
Definition support.c:610
fc_get_errno
fc_errno fc_get_errno(void)
Definition support.c:593
support.h
sz_strlcpy
#define sz_strlcpy(dest, src)
Definition support.h:161
TRUE
#define TRUE
Definition support.h:46
FALSE
#define FALSE
Definition support.h:47
timer_start
void timer_start(struct timer *t)
Definition timing.c:224
timer_read_seconds
double timer_read_seconds(struct timer *t)
Definition timing.c:344
timer_renew
struct timer * timer_renew(struct timer *t, enum timer_timetype type, enum timer_use use)
Definition timing.c:176
timing.h
TIMER_ACTIVE
@ TIMER_ACTIVE
Definition timing.h:45
TIMER_USER
@ TIMER_USER
Definition timing.h:41
freeciv_name_version
const char * freeciv_name_version(void)
Definition version.c:35
version.h