Attachment "parseargs.diff" to
ticket [beecfca5fd]
added by
emiliano
2025-04-21 13:12:54.
Index: generic/tclIndexObj.c
==================================================================
--- generic/tclIndexObj.c
+++ generic/tclIndexObj.c
@@ -1088,11 +1088,12 @@
* prefers an error to be registered.
*/
if (remObjv == NULL) {
Tcl_SetObjResult(interp, Tcl_ObjPrintf(
- "unrecognized argument \"%s\"", str));
+ "unrecognized argument \"%s\"\n", str));
+ PrintUsage(interp, argTable);
goto error;
}
dstIndex++; /* This argument is now handled */
leftovers[nrem++] = curArg;
@@ -1293,11 +1294,12 @@
/*
* Now add the option information, with pretty-printing.
*/
- msg = Tcl_NewStringObj("Command-specific options:", TCL_INDEX_NONE);
+ msg = Tcl_GetObjResult(interp);
+ Tcl_AppendToObj(msg, "Command-specific options:", TCL_INDEX_NONE);
for (infoPtr = argTable; infoPtr->type != TCL_ARGV_END; infoPtr++) {
if ((infoPtr->type == TCL_ARGV_HELP) && (infoPtr->keyStr == NULL)) {
Tcl_AppendPrintfToObj(msg, "\n%s", infoPtr->helpStr);
continue;
}
@@ -1332,11 +1334,10 @@
}
default:
break;
}
}
- Tcl_SetObjResult(interp, msg);
}
/*
*----------------------------------------------------------------------
*