diff options
author | welch <welch> | 1999-03-11 06:16:37 (GMT) |
---|---|---|
committer | welch <welch> | 1999-03-11 06:16:37 (GMT) |
commit | 4a327a6afdf45b23c8606d5f3d5a51b2b7876384 (patch) | |
tree | c00d629d8705ea776694d51d23e1e1f5088eb8a9 /win | |
parent | b78a73949a64a7dabbedb9b59bcf54e5610c311c (diff) | |
download | tcl-4a327a6afdf45b23c8606d5f3d5a51b2b7876384.zip tcl-4a327a6afdf45b23c8606d5f3d5a51b2b7876384.tar.gz tcl-4a327a6afdf45b23c8606d5f3d5a51b2b7876384.tar.bz2 |
Added tcl_platform
Diffstat (limited to 'win')
-rw-r--r-- | win/tclWinInit.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/win/tclWinInit.c b/win/tclWinInit.c index 5d13a8d..d9ea943 100644 --- a/win/tclWinInit.c +++ b/win/tclWinInit.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinInit.c,v 1.1.2.6 1999/03/11 01:50:33 stanton Exp $ + * RCS: @(#) $Id: tclWinInit.c,v 1.1.2.7 1999/03/11 06:16:51 welch Exp $ */ #include "tclWinInt.h" @@ -498,6 +498,7 @@ TclpSetVariables(interp) SYSTEM_INFO sysInfo; OemId *oemId; OSVERSIONINFOA osInfo; + Tcl_DString ds; osInfo.dwOSVersionInfoSize = sizeof(osInfo); GetVersionExA(&osInfo); @@ -548,11 +549,9 @@ TclpSetVariables(interp) * environment variables, if necessary. */ + Tcl_DStringInit(&ds); ptr = Tcl_GetVar2(interp, "env", "HOME", TCL_GLOBAL_ONLY); if (ptr == NULL) { - Tcl_DString ds; - - Tcl_DStringInit(&ds); ptr = Tcl_GetVar2(interp, "env", "HOMEDRIVE", TCL_GLOBAL_ONLY); if (ptr != NULL) { Tcl_DStringAppend(&ds, ptr, -1); @@ -567,8 +566,16 @@ TclpSetVariables(interp) } else { Tcl_SetVar2(interp, "env", "HOME", "c:\\", TCL_GLOBAL_ONLY); } - Tcl_DStringFree(&ds); } + + Tcl_DStringSetLength(&ds, 100); + if (GetUserName(Tcl_DStringValue(&ds), &Tcl_DStringLength(&ds)) != 0) { + Tcl_SetVar2(interp, "tcl_platform", "user", Tcl_DStringValue(&ds), + TCL_GLOBAL_ONLY); + } else { + Tcl_SetVar2(interp, "tcl_platform", "user", "", TCL_GLOBAL_ONLY); + } + Tcl_DStringFree(&ds); } /* |