*** tclUnixInit.c.orig 2011-07-26 14:21:13.000000000 -0500 --- tclUnixInit.c 2011-07-26 14:27:57.000000000 -0500 *************** *** 934,954 **** --- 934,965 ---- /* * Copy the username of the real user (according to getuid()) into * tcl_platform(user). */ { + #if 0 struct passwd *pwEnt = TclpGetPwUid(getuid()); const char *user; if (pwEnt == NULL) { user = ""; Tcl_DStringInit(&ds); /* ensure cleanliness */ } else { user = Tcl_ExternalToUtfDString(NULL, pwEnt->pw_name, -1, &ds); } + #else + Tcl_DStringInit(&ds); + const char *user = TclGetEnv("USER", &ds); + if (user == NULL) { + user = TclGetEnv("LOGNAME", &ds); + if (user == NULL) { + user = ""; + } + } + #endif Tcl_SetVar2(interp, "tcl_platform", "user", user, TCL_GLOBAL_ONLY); Tcl_DStringFree(&ds); } }