diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-02-02 16:43:51 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-02-02 16:43:51 +0000 |
commit | 5de754a395a36afe7ed89f300d3421ef05c2401b (patch) | |
tree | 37b1a19ed3664b093551ee228a7c62e6a4c92f61 | |
parent | 7cff01ec2dcdd04657fca1b5c572cb2b53d2d4aa (diff) | |
download | busybox-w32-5de754a395a36afe7ed89f300d3421ef05c2401b.tar.gz busybox-w32-5de754a395a36afe7ed89f300d3421ef05c2401b.tar.bz2 busybox-w32-5de754a395a36afe7ed89f300d3421ef05c2401b.zip |
ps: add (disabled) compat code
-rw-r--r-- | procps/ps.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/procps/ps.c b/procps/ps.c index 3002fb9ad..e954da66f 100644 --- a/procps/ps.c +++ b/procps/ps.c | |||
@@ -157,7 +157,21 @@ static unsigned get_kernel_HZ(void) | |||
157 | 157 | ||
158 | static void func_user(char *buf, int size, const procps_status_t *ps) | 158 | static void func_user(char *buf, int size, const procps_status_t *ps) |
159 | { | 159 | { |
160 | #if 1 | ||
160 | safe_strncpy(buf, get_cached_username(ps->uid), size+1); | 161 | safe_strncpy(buf, get_cached_username(ps->uid), size+1); |
162 | #else | ||
163 | /* "compatible" version, but it's larger */ | ||
164 | /* procps 2.18 shows numeric UID if name overflows the field */ | ||
165 | /* TODO: get_cached_username() returns numeric string if | ||
166 | * user has no passwd record, we will display it | ||
167 | * left-justified here; too long usernames are shown | ||
168 | * as _right-justified_ IDs. Is it worth fixing? */ | ||
169 | const char *user = get_cached_username(ps->uid); | ||
170 | if (strlen(user) <= size) | ||
171 | safe_strncpy(buf, get_cached_username(ps->uid), size+1); | ||
172 | else | ||
173 | sprintf(buf, "%*u", size, (unsigned)ps->uid); | ||
174 | #endif | ||
161 | } | 175 | } |
162 | 176 | ||
163 | static void func_comm(char *buf, int size, const procps_status_t *ps) | 177 | static void func_comm(char *buf, int size, const procps_status_t *ps) |