top: let's exploit the new standardized errno handling

With the library having now normalized errno handling,
perhaps it is time at least one program took advantage
of it. So, instead of printing just a message with the
programs's line number, top will now also provide that
associated errno string text, compliments of strerror.

[ with those newlib functions returning NULL, we can ]
[ use errno directly in strerror. for the ones which ]
[ yield an int, all we need do is invert such return ]
[ values before passing it to the strerror function. ]

Reference(s):

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner
2017-12-16 00:00:00 -06:00
committed by Craig Small
parent 71b3de01f2
commit 0a502adfd0
2 changed files with 20 additions and 19 deletions

View File

@@ -496,9 +496,9 @@ static void build_norm_nlstab (void) {
. padding with extra spaces as necessary */
Norm_nlstab[WORD_abv_mem_txt] = _("Mem ");
Norm_nlstab[WORD_abv_swp_txt] = _("Swap");
Norm_nlstab[LIB_errormem_fmt] = _("library failed memory statistics, at %d");
Norm_nlstab[LIB_errorcpu_fmt] = _("library failed cpu statistics, at %d");
Norm_nlstab[LIB_errorpid_fmt] = _("library failed pids statistics, at %d");
Norm_nlstab[LIB_errormem_fmt] = _("library failed memory statistics, at %d: %s");
Norm_nlstab[LIB_errorcpu_fmt] = _("library failed cpu statistics, at %d: %s");
Norm_nlstab[LIB_errorpid_fmt] = _("library failed pids statistics, at %d: %s");
Norm_nlstab[BAD_memscale_fmt] = _("bad memory scaling arg '%c'");
}