diff options
author | apnadkarni <apnmbx-wits@yahoo.com> | 2022-07-31 11:54:14 (GMT) |
---|---|---|
committer | apnadkarni <apnmbx-wits@yahoo.com> | 2022-07-31 11:54:14 (GMT) |
commit | 515f8ab0440b2d4cb6411790c2c08210cadfee6a (patch) | |
tree | 5f85e0db518c62abc09ba9dcf9405773475c5c2e /generic/tclFCmd.c | |
parent | d2518017c7f55b82f10c7ee1e77cbe27218cc857 (diff) | |
download | tcl-515f8ab0440b2d4cb6411790c2c08210cadfee6a.zip tcl-515f8ab0440b2d4cb6411790c2c08210cadfee6a.tar.gz tcl-515f8ab0440b2d4cb6411790c2c08210cadfee6a.tar.bz2 |
Add 'file home' command
Diffstat (limited to 'generic/tclFCmd.c')
-rw-r--r-- | generic/tclFCmd.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/generic/tclFCmd.c b/generic/tclFCmd.c index c19623d..c786395 100644 --- a/generic/tclFCmd.c +++ b/generic/tclFCmd.c @@ -1653,6 +1653,45 @@ TclFileTempDirCmd( } /* + *---------------------------------------------------------------------- + * + * TclFileHomeCmd -- + * + * This function is invoked to process the "file home" Tcl command. + * See the user documentation for details on what it does. + * + * Results: + * A standard Tcl result. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +int +TclFileHomeCmd( + TCL_UNUSED(void *), + Tcl_Interp *interp, + int objc, + Tcl_Obj *const objv[]) +{ + Tcl_Obj *homeDirObj; + Tcl_DString dirString; + + if (objc != 1 && objc != 2) { + Tcl_WrongNumArgs(interp, 1, objv, "?user?"); + return TCL_ERROR; + } + if (TclGetHomeDir(interp, objc == 1 ? NULL : Tcl_GetString(objv[1]), &dirString) != TCL_OK) { + return TCL_ERROR; + } + homeDirObj = TclDStringToObj(&dirString); + Tcl_SetObjResult(interp, homeDirObj); + return TCL_OK; +} + +/* * Local Variables: * mode: c * c-basic-offset: 4 |