log_add_output_all_levs(&main_dstream_no_stderr_log_out);
log_register_thread("main");
-
- // This enables internatonal characters input
- if( setlocale(LC_ALL, "") == NULL )
- {
- fprintf( stderr, "%s: warning: could not set default locale\n", argv[0] );
- }
-
- // Set locale. This is for forcing '.' as the decimal point.
- try {
- std::locale::global(std::locale(std::locale(""), "C", std::locale::numeric));
- setlocale(LC_NUMERIC, "C");
- } catch (const std::exception& ex) {
- errorstream<<"Could not set numeric locale to C"<<std::endl;
- }
/*
Parse command line
*/
std::map<std::string, ValueSpec> allowed_options;
allowed_options.insert(std::make_pair("help", ValueSpec(VALUETYPE_FLAG,
_("Show allowed options"))));
+ allowed_options.insert(std::make_pair("version", ValueSpec(VALUETYPE_FLAG,
+ _("Show version information"))));
allowed_options.insert(std::make_pair("config", ValueSpec(VALUETYPE_STRING,
_("Load configuration from specified file"))));
allowed_options.insert(std::make_pair("port", ValueSpec(VALUETYPE_STRING,
return cmd_args.getFlag("help") ? 0 : 1;
}
+
+ if(cmd_args.getFlag("version"))
+ {
+#ifdef SERVER
+ dstream<<"minetestserver "<<minetest_version_hash<<std::endl;
+#else
+ dstream<<"Minetest "<<minetest_version_hash<<std::endl;
+ dstream<<"Using Irrlicht "<<IRRLICHT_SDK_VERSION<<std::endl;
+#endif
+ dstream<<"Build info: "<<minetest_build_info<<std::endl;
+ return 0;
+ }
/*
Low-level initialization
// Create user data directory
fs::CreateDir(porting::path_user);
- init_gettext((porting::path_share + DIR_DELIM + "locale").c_str());
-
infostream<<"path_share = "<<porting::path_share<<std::endl;
infostream<<"path_user = "<<porting::path_user<<std::endl;
{
run_tests();
}
-
- std::string language = g_settings->get("language");
- if (language.length()) {
-#ifndef _WIN32
- setenv("LANGUAGE", language.c_str(), 1);
+#ifdef _MSC_VER
+ init_gettext((porting::path_share + DIR_DELIM + "locale").c_str(),g_settings->get("language"),argc,argv);
#else
- char *lang_str = (char*)calloc(10 + language.length(), sizeof(char));
- strcat(lang_str, "LANGUAGE=");
- strcat(lang_str, language.c_str());
- putenv(lang_str);
+ init_gettext((porting::path_share + DIR_DELIM + "locale").c_str(),g_settings->get("language"));
#endif
- }
/*
Game parameters
++count;
if (count % 500 == 0)
actionstream << "Migrated " << count << " blocks "
- << (100.0 * count / blocks.size()) << "\% completed" << std::endl;
+ << (100.0 * count / blocks.size()) << "% completed" << std::endl;
}
new_db->endSave();