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 2021-01-01 00:00:00 -06:00 committed by Craig Small
parent 0d386260b4
commit 8ff0dcbd4b

View File

@ -6191,7 +6191,10 @@ static const char *task_show (const WIN_t *q, const int idx) {
varUTF8(p->cgroup[0]); varUTF8(p->cgroup[0]);
break; break;
case EU_CMD: 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; break;
case EU_COD: case EU_COD:
cp = scale_mem(S, pages2K(p->trs), W, Jn); cp = scale_mem(S, pages2K(p->trs), W, Jn);