From a390c05f9b22706b9aca8040b4553a4b14aab228 Mon Sep 17 00:00:00 2001 From: albert <> Date: Thu, 5 Dec 2002 03:17:32 +0000 Subject: [PATCH] found the bug --- top.c | 39 ++++++--------------------------------- 1 file changed, 6 insertions(+), 33 deletions(-) diff --git a/top.c b/top.c index 9761d547..4bec344d 100644 --- a/top.c +++ b/top.c @@ -1264,7 +1264,7 @@ static int rc_read_old (const char *const buf, RCF_t *rc) { if (c == 'N') c = 'n'; // usage differs, so turn this off if (c == 'Q') c = 'q'; // usage differs, so turn this off if (c == 'R') c = 'r'; // usage differs, so turn this off - ft_cvt_char(FT_OLD_fmt, FT_NEW_fmt, c); + c = ft_cvt_char(FT_OLD_fmt, FT_NEW_fmt, c); if (!c) return -4; // error value if (c == '.') return -5; // error value if (scoreboard[c&0x1fu]) badchar++; // duplicates not allowed @@ -1278,35 +1278,6 @@ static int rc_read_old (const char *const buf, RCF_t *rc) { if (badchar > 3) return -8; // too much junk if (!c_show) return -9; // nothing was shown -#if 0 - // Due to Rik blindly accepting damem's broken patches, procps-2.0.10 - // has 3 ("three"!!!) instances of "#C", "LC", or "CPU". Fix that here. - // Some people are maintainers, and others are human patchbots. - // The 'y' and 'Y' above have become 'j' and 'J' after translation. - if (scoreboard['j' & 0x1fu] > 1) { // more than one "#C" column - int letter; - char *fields = rc->win[0].fieldscur; - char *tmp = strchr(fields, 'J'); - if (tmp) { - *tmp = '.'; // save one by hiding it - letter = 'J'; - } else { - tmp = strchr(fields, 'j'); - *tmp = '.'; - letter = 'j'; - } - while ((tmp = strchr(fields, 'J'))) *tmp='j'; // cannonicalize it - while ((tmp = strchr(fields, 'j'))) { - char *dst = tmp; - char *src = tmp + 1; - int n = strlen(src) + 1; - memmove(dst, src, n); - } - tmp = strchr(fields, '.'); // find back saved spot - *tmp = letter; - } -#endif - // rest of file is optional, but better look right if it exists if (!*cp) return 12; if (*cp < '2' || *cp > '9') return -13; // stupid, and why isn't '1' valid? @@ -1532,12 +1503,16 @@ static void before (char *me) // Anything missing won't show as a choice in the field editor, // so make sure there is exactly one of each letter. +// +// Due to Rik blindly accepting damem's broken patches, procps-2.0.1x +// has 3 ("three"!!!) instances of "#C", "LC", or "CPU". Fix that too. +// Some people are maintainers, and others are human patchbots. static void add_missing_fields(char *fields){ unsigned upper[32]; unsigned lower[32]; char c; char *cp; - + memset(upper, '\0', sizeof upper); memset(lower, '\0', sizeof lower); @@ -1646,8 +1621,6 @@ static void configs_read (void) add_missing_fields(Winstk[i].rc.fieldscur); } -rc_bugless(&rcf); sleep(2); - // lastly, establish the true runtime secure mode and delay time if (!getuid()) Secure_mode = 0; if (!Secure_mode) Rc.delay_time = delay;