X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Flibgame%2Fmisc.c;h=27cf37c6d2e48a655162471db25681b059084c59;hb=4a8368abd71c718621838773eed914b5bbd4e1d8;hp=f3e191047b59bd4f79e657ae6d76b6f507ecdf5e;hpb=e3a53d28634c52a0b1de6d0609de911e5d01c344;p=rocksndiamonds.git diff --git a/src/libgame/misc.c b/src/libgame/misc.c index f3e19104..27cf37c6 100644 --- a/src/libgame/misc.c +++ b/src/libgame/misc.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -468,6 +469,16 @@ char *getRealName() return real_name; } +time_t getFileTimestampEpochSeconds(char *filename) +{ + struct stat file_status; + + if (stat(filename, &file_status) != 0) /* cannot stat file */ + return 0; + + return file_status.st_mtime; +} + /* ------------------------------------------------------------------------- */ /* path manipulation functions */ @@ -685,6 +696,7 @@ void GetOptions(char *argv[], void (*print_usage_function)(void)) options.display_name = NULL; options.server_host = NULL; options.server_port = 0; + options.ro_base_directory = ro_base_path; options.rw_base_directory = rw_base_path; options.level_directory = getPath2(ro_base_path, LEVELS_DIRECTORY); @@ -692,7 +704,10 @@ void GetOptions(char *argv[], void (*print_usage_function)(void)) options.sounds_directory = getPath2(ro_base_path, SOUNDS_DIRECTORY); options.music_directory = getPath2(ro_base_path, MUSIC_DIRECTORY); options.docs_directory = getPath2(ro_base_path, DOCS_DIRECTORY); + options.execute_command = NULL; + options.special_flags = NULL; + options.serveronly = FALSE; options.network = FALSE; options.verbose = FALSE; @@ -827,6 +842,25 @@ void GetOptions(char *argv[], void (*print_usage_function)(void)) { options.debug_x11_sync = TRUE; } + else if (strPrefix(option, "-D")) + { +#if 1 + options.special_flags = getStringCopy(&option[2]); +#else + char *flags_string = &option[2]; + unsigned long flags_value; + + if (*flags_string == '\0') + Error(ERR_EXIT_HELP, "empty flag ignored"); + + flags_value = get_special_flags_function(flags_string); + + if (flags_value == 0) + Error(ERR_EXIT_HELP, "unknown flag '%s'", flags_string); + + options.special_flags |= flags_value; +#endif + } else if (strncmp(option, "-execute", option_len) == 0) { if (option_arg == NULL)