From dad3b789319c701ea931b27ef6f006333a414bd8 Mon Sep 17 00:00:00 2001 From: stefan schippers Date: Sat, 25 Jan 2025 19:39:53 +0100 Subject: [PATCH] Add a line number in error report if failed sourced tcl scripts --- src/xinit.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/xinit.c b/src/xinit.c index 82edc3a3..18dd4315 100644 --- a/src/xinit.c +++ b/src/xinit.c @@ -1169,12 +1169,14 @@ static int source_tcl_file(char *s) { char tmp[1024]; if(Tcl_EvalFile(interp, s)==TCL_ERROR) { + fprintf(errfp, "Tcl_AppInit() error: can not execute %s, please fix:\n", s); + fprintf(errfp, "Line No: %d\n", Tcl_GetErrorLine(interp)); fprintf(errfp, "%s", tclresult()); fprintf(errfp, "\n"); my_snprintf(tmp, S(tmp), "tk_messageBox -icon error -type ok -message \ - {Tcl_AppInit() err 1: can not execute %s, please fix:\n %s}", - s, tclresult()); + {Tcl_AppInit() err 1: can not execute %s, please fix:\n%s\nLine No: %d\n}", + s, tclresult(), Tcl_GetErrorLine(interp)); if(has_x) { tcleval( "wm withdraw ."); tcleval( tmp);