void test_init(void) { static int counter = 0; if (counter != 0) c_critical("We don't support running more than one test at a time\n" "in a single test run due to the state leakage that can\n" "cause subsequent tests to fail.\n" "\n" "If you want to run all the tests you should run\n" "$ make check"); counter++; if (is_boolean_env_set("V")) _test_is_verbose = true; /* NB: This doesn't have any effect since commit 47444dac of glib * because the environment variable is read in a magic constructor * so it is too late to set them here */ if (c_getenv("G_DEBUG")) { char *debug = c_strconcat(c_getenv("G_DEBUG"), ",fatal-warnings", NULL); c_setenv("G_DEBUG", debug, true); c_free(debug); } else c_setenv("G_DEBUG", "fatal-warnings", true); }
const char * c_get_user_name(void) { const char *retName = c_getenv("USER"); if (!retName) retName = c_getenv("USERNAME"); return retName; }
static int handle_luainit (lua_State *L) { const char *name = "=" LUA_INITVARVERSION; const char *init = c_getenv(name + 1); if (init == NULL) { name = "=" LUA_INIT_VAR; init = c_getenv(name + 1); /* try alternative name */ } if (init == NULL) return LUA_OK; else if (init[0] == '@') return dofile(L, init+1); else return dostring(L, init, name); }
const char * c_get_home_dir(void) { /* FIXME */ const char *drive = c_getenv("HOMEDRIVE"); const char *path = c_getenv("HOMEPATH"); char *home_dir = NULL; if (drive && path) { home_dir = c_malloc(strlen(drive) + strlen(path) + 1); if (home_dir) { sprintf(home_dir, "%s%s", drive, path); } } return home_dir; }
const char * c_get_tmp_dir(void) { if (tmp_dir == NULL) { if (tmp_dir == NULL) { tmp_dir = c_getenv("TMPDIR"); if (tmp_dir == NULL) { tmp_dir = c_getenv("TMP"); if (tmp_dir == NULL) { tmp_dir = c_getenv("TEMP"); if (tmp_dir == NULL) tmp_dir = "C:\\temp"; } } } } return tmp_dir; }
const char * _cg_device_get_gl_version(cg_device_t *dev) { const char *version_override; if ((version_override = c_getenv("CG_OVERRIDE_GL_VERSION"))) return version_override; else if (_cg_config_override_gl_version) return _cg_config_override_gl_version; else return (const char *)dev->glGetString(GL_VERSION); }