diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2006-09-27 14:17:31 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2006-09-27 14:17:31 +0000 |
commit | be905d550c96da8c75d697842ba4169a62d05190 (patch) | |
tree | 10dd9d6a9ef0bab7345b7696f66fcf9339e6cce6 /libbb/find_pid_by_name.c | |
parent | 2f4399c6cc966d39ba74fc4727a0493b3b52ffd8 (diff) | |
download | busybox-w32-be905d550c96da8c75d697842ba4169a62d05190.tar.gz busybox-w32-be905d550c96da8c75d697842ba4169a62d05190.tar.bz2 busybox-w32-be905d550c96da8c75d697842ba4169a62d05190.zip |
process utilities related style cleanup
Diffstat (limited to 'libbb/find_pid_by_name.c')
-rw-r--r-- | libbb/find_pid_by_name.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/libbb/find_pid_by_name.c b/libbb/find_pid_by_name.c index 5520220b3..247d79f9f 100644 --- a/libbb/find_pid_by_name.c +++ b/libbb/find_pid_by_name.c | |||
@@ -23,18 +23,17 @@ | |||
23 | * Returns a list of all matching PIDs | 23 | * Returns a list of all matching PIDs |
24 | * It is the caller's duty to free the returned pidlist. | 24 | * It is the caller's duty to free the returned pidlist. |
25 | */ | 25 | */ |
26 | long* find_pid_by_name( const char* pidName) | 26 | long* find_pid_by_name(const char* pidName) |
27 | { | 27 | { |
28 | long* pidList; | 28 | long* pidList; |
29 | int i=0; | 29 | int i = 0; |
30 | procps_status_t * p; | 30 | procps_status_t* p; |
31 | 31 | ||
32 | pidList = xmalloc(sizeof(long)); | 32 | pidList = xmalloc(sizeof(long)); |
33 | while ((p = procps_scan(0)) != 0) | 33 | while ((p = procps_scan(0)) != 0) { |
34 | { | ||
35 | if (strncmp(p->short_cmd, pidName, COMM_LEN-1) == 0) { | 34 | if (strncmp(p->short_cmd, pidName, COMM_LEN-1) == 0) { |
36 | pidList=xrealloc( pidList, sizeof(long) * (i+2)); | 35 | pidList = xrealloc( pidList, sizeof(long) * (i+2)); |
37 | pidList[i++]=p->pid; | 36 | pidList[i++] = p->pid; |
38 | } | 37 | } |
39 | } | 38 | } |
40 | 39 | ||
@@ -44,9 +43,9 @@ long* find_pid_by_name( const char* pidName) | |||
44 | 43 | ||
45 | long *pidlist_reverse(long *pidList) | 44 | long *pidlist_reverse(long *pidList) |
46 | { | 45 | { |
47 | int i=0; | 46 | int i = 0; |
48 | while (pidList[i] > 0 && ++i); | 47 | while (pidList[i] > 0 && ++i); |
49 | if ( i-- > 0) { | 48 | if (i-- > 0) { |
50 | long k; | 49 | long k; |
51 | int j; | 50 | int j; |
52 | for (j = 0; i > j; i--, j++) { | 51 | for (j = 0; i > j; i--, j++) { |