top: tweak cmd/cmdline logic for a possible bad locale

Since this master library isn't quite as sophisticated
as the newlib version, this patch will protect against
the possibility of multibyte characters in a program's
name combined with some locale without UTF-8 encoding.

[ it is better to treat the COMMAND column length as ]
[ more than what's actually printed than to have the ]
[ line overflow & corrupt the remaining screen lines ]

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner authored and Craig Small committed 2021-01-02 15:40:02 +11:00
1 parent 0d386260b4
commit 8ff0dcbd4b
1 file changed
+4 -1
+4 -1
View File
@@ -6191,7 +6191,10 @@ static const char *task_show (const WIN_t *q, const int idx) {
varUTF8(p->cgroup[0]);
break;
case EU_CMD:
varUTF8(forest_display(q, p));
if (CHKw(q, Show_CMDLIN))
varUTF8(forest_display(q, p))
else
makeVAR(forest_display(q, p));
break;
case EU_COD:
cp = scale_mem(S, pages2K(p->trs), W, Jn);