summaryrefslogtreecommitdiff
path: root/libbb/procps.c
diff options
context:
space:
mode:
authorDenis Vlasenko2007-09-29 22:26:01 +0000
committerDenis Vlasenko2007-09-29 22:26:01 +0000
commit72e1c89d971aa2e37abf705c6a01f002deac09b8 (patch)
tree6edb25e260701f9f6e49769e4bb7e31e7e2e6063 /libbb/procps.c
parent2450e4ba44707a64920ea6c9276930a1210e76cc (diff)
downloadbusybox-72e1c89d971aa2e37abf705c6a01f002deac09b8.zip
busybox-72e1c89d971aa2e37abf705c6a01f002deac09b8.tar.gz
pgrep,pkill: new applets by Loic Grenie <loic.grenie@gmail.com>
Diffstat (limited to 'libbb/procps.c')
-rw-r--r--libbb/procps.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/libbb/procps.c b/libbb/procps.c
index e62e5a1..476e1f3 100644
--- a/libbb/procps.c
+++ b/libbb/procps.c
@@ -375,13 +375,22 @@ procps_status_t *procps_scan(procps_status_t* sp, int flags)
}
}
#else
- if (flags & PSSCAN_ARGV0) {
+ if (flags & *PSSCAN_ARGV0|PSSCAN_ARGVN)) {
free(sp->argv0);
sp->argv0 = NULL;
strcpy(filename_tail, "/cmdline");
n = read_to_buf(filename, buf);
if (n <= 0)
break;
+#if ENABLE_PGREP || ENABLE_PKILL
+ if (flags & PSSCAN_ARGVN) {
+ do {
+ n--;
+ if (buf[n] == '\0')
+ buf[n] = ' ';
+ } while (n);
+ }
+#endif
sp->argv0 = xstrdup(buf);
}
#endif