summaryrefslogtreecommitdiffstats
path: root/generic/tclBasic.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2005-09-14 17:13:18 (GMT)
committerdgp <dgp@users.sourceforge.net>2005-09-14 17:13:18 (GMT)
commit9e5a076c152f19abbf9f1b67392bd2072bac77c7 (patch)
tree6faa8807c6893dae4bd8cd9d5668a911697e0dfe /generic/tclBasic.c
parentd6a5a988b1a1360a77a043ec10d175c8a6c0fd36 (diff)
downloadtcl-9e5a076c152f19abbf9f1b67392bd2072bac77c7.zip
tcl-9e5a076c152f19abbf9f1b67392bd2072bac77c7.tar.gz
tcl-9e5a076c152f19abbf9f1b67392bd2072bac77c7.tar.bz2
* generic/tclStringObj.c: Bug fixes: ObjPrintfVA needed to
support "*" fields and needed to interpret precision limits on %s conversions as a number of bytes, not Tcl_UniChars, to take from the (char *) argument. * generic/tclBasic.c: Updated several callers to use * generic/tclCmdMZ.c: TclFormatToErrorInfo(). * generic/tclIOUtil.c: * library/init.tcl: Keep [unknown] in sync with errorInfo formatting rules.
Diffstat (limited to 'generic/tclBasic.c')
-rw-r--r--generic/tclBasic.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index a038550..c70b5ad 100644
--- a/generic/tclBasic.c
+++ b/generic/tclBasic.c
@@ -13,7 +13,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclBasic.c,v 1.171 2005/09/14 03:46:50 dgp Exp $
+ * RCS: @(#) $Id: tclBasic.c,v 1.172 2005/09/14 17:13:18 dgp Exp $
*/
#include "tclInt.h"
@@ -3540,7 +3540,7 @@ Tcl_LogCommandInfo(interp, script, command, length)
{
register CONST char *p;
Interp *iPtr = (Interp *) interp;
- Tcl_Obj *message;
+ int overflow, limit = 150;
if (iPtr->flags & ERR_ALREADY_LOGGED) {
/*
@@ -3562,16 +3562,11 @@ Tcl_LogCommandInfo(interp, script, command, length)
}
}
- if (iPtr->errorInfo == NULL) {
- message = Tcl_NewStringObj("\n while executing\n\"", -1);
- } else {
- message = Tcl_NewStringObj("\n invoked from within\n\"", -1);
- }
- Tcl_IncrRefCount(message);
- TclAppendLimitedToObj(message, command, length, 153, NULL);
- Tcl_AppendToObj(message, "\"", -1);
- TclAppendObjToErrorInfo(interp, message);
- Tcl_DecrRefCount(message);
+ overflow = (length > limit);
+ TclFormatToErrorInfo(interp, "\n %s\n\"%.*s%s\"",
+ ((iPtr->errorInfo == NULL)
+ ? "while executing" : "invoked from within"),
+ (overflow ? limit : length), command, (overflow ? "..." : ""));
}
/*