summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsuresh <suresh>1998-06-12 16:49:08 (GMT)
committersuresh <suresh>1998-06-12 16:49:08 (GMT)
commit8139ad0bcb4d52515ad4c4d897de9d575fb4dd7a (patch)
treecbf74d7a2d8e0bab6e7c0eb453a4cffc331856b6
parente7fef6f610fcd771b4294eac1faed99e6f9d841d (diff)
downloadtcl-8139ad0bcb4d52515ad4c4d897de9d575fb4dd7a.zip
tcl-8139ad0bcb4d52515ad4c4d897de9d575fb4dd7a.tar.gz
tcl-8139ad0bcb4d52515ad4c4d897de9d575fb4dd7a.tar.bz2
Moved the definition of "char *tclExecutableName" to this file.
Added implementation for the new public routine 'Tcl_GetNameOfExecutable(...)'.
-rw-r--r--generic/tclUtil.c38
1 files changed, 37 insertions, 1 deletions
diff --git a/generic/tclUtil.c b/generic/tclUtil.c
index e43482f..dc4dd20 100644
--- a/generic/tclUtil.c
+++ b/generic/tclUtil.c
@@ -10,13 +10,22 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * SCCS: @(#) tclUtil.c 1.161 97/08/12 17:07:18
+ * SCCS: %Z% $Id: tclUtil.c,v 1.2 1998/06/12 16:49:08 suresh Exp $
*/
#include "tclInt.h"
#include "tclPort.h"
/*
+ * The following variable holds the full path name of the binary
+ * from which this application was executed, or NULL if it isn't
+ * know. The value of the variable is set by the procedure
+ * Tcl_FindExecutable. The storage space is dynamically allocated.
+ */
+
+char *tclExecutableName = NULL;
+
+/*
* The following values are used in the flags returned by Tcl_ScanElement
* and used by Tcl_ConvertElement. The value TCL_DONT_USE_BRACES is also
* defined in tcl.h; make sure its value doesn't overlap with any of the
@@ -2805,3 +2814,30 @@ TclGetIntForIndex(interp, objPtr, endValue, indexPtr)
*indexPtr = index;
return TCL_OK;
}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * Tcl_GetNameOfExecutable --
+ *
+ * This procedure simply returns a pointer to the internal full
+ * path name of the executable file as computed by
+ * Tcl_FindExecutable. This procedure call is the C API
+ * equivalent to the "info nameofexecutable" command.
+ *
+ * Results:
+ * A pointer to the internal string or NULL if the internal full
+ * path name has not been computed or unknown.
+ *
+ * Side effects:
+ * The object referenced by "objPtr" might be converted to an
+ * integer object.
+ *
+ *----------------------------------------------------------------------
+ */
+
+CONST char *
+Tcl_GetNameOfExecutable()
+{
+ return (tclExecutableName);
+}