-/***********************************************************
-* Artsoft Retro-Game Library *
-*----------------------------------------------------------*
-* (c) 1994-2006 Artsoft Entertainment *
-* Holger Schemel *
-* Detmolder Strasse 189 *
-* 33604 Bielefeld *
-* Germany *
-* e-mail: info@artsoft.org *
-*----------------------------------------------------------*
-* misc.c *
-***********************************************************/
+// ============================================================================
+// Artsoft Retro-Game Library
+// ----------------------------------------------------------------------------
+// (c) 1995-2014 by Artsoft Entertainment
+// Holger Schemel
+// info@artsoft.org
+// http://www.artsoft.org/
+// ----------------------------------------------------------------------------
+// misc.c
+// ============================================================================
#include <time.h>
#include <sys/time.h>
/* command line option handling functions */
/* ------------------------------------------------------------------------- */
-void GetOptions(char *argv[], void (*print_usage_function)(void))
+void GetOptions(char *argv[],
+ void (*print_usage_function)(void),
+ void (*print_version_function)(void))
{
char *ro_base_path = RO_BASE_PATH;
char *rw_base_path = RW_BASE_PATH;
option_len = strlen(option);
if (strEqual(option, "-"))
+ {
Error(ERR_EXIT_HELP, "unrecognized option '%s'", option);
+ }
else if (strncmp(option, "-help", option_len) == 0)
{
print_usage_function();
{
options.serveronly = TRUE;
}
- else if (strncmp(option, "-verbose", option_len) == 0)
- {
- options.verbose = TRUE;
- }
else if (strncmp(option, "-debug", option_len) == 0)
{
options.debug = TRUE;
{
options.debug_x11_sync = TRUE;
}
+ else if (strncmp(option, "-verbose", option_len) == 0)
+ {
+ options.verbose = TRUE;
+ }
+ else if (strncmp(option, "-version", option_len) == 0 ||
+ strncmp(option, "-V", option_len) == 0)
+ {
+ print_version_function();
+
+ exit(0);
+ }
else if (strPrefix(option, "-D"))
{
#if 1
Error(ERR_WARN, "cannot open file '%s' for writing: %s",
program.error_filename, strerror(errno));
}
+
+ /* error output should be unbuffered so it is not truncated in a crash */
+ setbuf(program.error_file, NULL);
}
void closeErrorFile()