Diff

Differences From Artifact [8565374f0c]:

To Artifact [2224f05581]:


157
158
159
160
161
162
163






















164
165
166
167
168
169
170
171
172
173




174
175
176
177
178
179
180
"} else continue\n";

/* SetExecName --

   Hack to get around Tcl bug 1224888.
*/
void SetExecName(Tcl_Interp *interp) {






















	if (tclExecutableName == NULL) {
		int len = 0;
		Tcl_Obj *execNameObj;
		Tcl_Obj *lobjv[1];

		lobjv[0] = Tcl_GetVar2Ex(interp, "argv0", NULL, TCL_GLOBAL_ONLY);
		execNameObj = Tcl_FSJoinToPath(Tcl_FSGetCwd(interp), 1, lobjv);

		tclExecutableName = strdup(Tcl_GetStringFromObj(execNameObj, &len));
	}




}

int TclKit_AppInit(Tcl_Interp *interp) {
#ifdef TCLKIT_CAN_SET_ENCODING
	Tcl_DString encodingName;
#endif








>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>









|
>
>
>
>







157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
"} else continue\n";

/* SetExecName --

   Hack to get around Tcl bug 1224888.
*/
void SetExecName(Tcl_Interp *interp) {
#if defined(HAVE_READLINK)
	if (tclExecutableName == NULL) {
		ssize_t readlink_ret;
		char procpath[PATH_MAX + 1];
		char exe_buf[PATH_MAX + 1];
		int snprintf_ret;

		snprintf_ret = snprintf(procpath, sizeof(procpath), "/proc/%lu/exe", (unsigned long) getpid());
		if (snprintf_ret < sizeof(procpath)) {
			readlink_ret = readlink(procpath, exe_buf, sizeof(exe_buf) - 1);

			if (readlink_ret > 0 && readlink_ret < (sizeof(exe_buf) - 1)) {
				exe_buf[readlink_ret] = '\0';

				tclExecutableName = strdup(exe_buf);

				return;
			}
		}
	}
#endif

	if (tclExecutableName == NULL) {
		int len = 0;
		Tcl_Obj *execNameObj;
		Tcl_Obj *lobjv[1];

		lobjv[0] = Tcl_GetVar2Ex(interp, "argv0", NULL, TCL_GLOBAL_ONLY);
		execNameObj = Tcl_FSJoinToPath(Tcl_FSGetCwd(interp), 1, lobjv);

		tclExecutableName = strdup(Tcl_GetStringFromObj(execNameObj, &len));

		return;
	}

	return;
}

int TclKit_AppInit(Tcl_Interp *interp) {
#ifdef TCLKIT_CAN_SET_ENCODING
	Tcl_DString encodingName;
#endif