diff options
author | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2002-10-22 12:21:15 +0000 |
---|---|---|
committer | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2002-10-22 12:21:15 +0000 |
commit | 0bc1512abd51128e2bf1692bb91915f6fea19384 (patch) | |
tree | 4555230653cdb82d998f076b29130d8fe18a6f7a /procps/pidof.c | |
parent | fd7f4ba70b04383b2b7b260419b5bf3c1246e109 (diff) | |
download | busybox-w32-0bc1512abd51128e2bf1692bb91915f6fea19384.tar.gz busybox-w32-0bc1512abd51128e2bf1692bb91915f6fea19384.tar.bz2 busybox-w32-0bc1512abd51128e2bf1692bb91915f6fea19384.zip |
Patch last_pach62 from vodz. This patch moves all the /proc parsing
code into libbb so it can be shared by ps, top, etc, saving over 1.5k.
git-svn-id: svn://busybox.net/trunk/busybox@5685 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'procps/pidof.c')
-rw-r--r-- | procps/pidof.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/procps/pidof.c b/procps/pidof.c index d0d65e0db..169a92007 100644 --- a/procps/pidof.c +++ b/procps/pidof.c | |||
@@ -54,21 +54,16 @@ extern int pidof_main(int argc, char **argv) | |||
54 | while(optind < argc) { | 54 | while(optind < argc) { |
55 | long* pidList; | 55 | long* pidList; |
56 | 56 | ||
57 | pidList = find_pid_by_name( argv[optind]); | 57 | pidList = find_pid_by_name(argv[optind]); |
58 | if (!pidList || *pidList<=0) { | 58 | for(; *pidList > 0; pidList++) { |
59 | break; | ||
60 | } | ||
61 | |||
62 | for(; pidList && *pidList!=0; pidList++) { | ||
63 | printf("%s%ld", (n++ ? " " : ""), (long)*pidList); | 59 | printf("%s%ld", (n++ ? " " : ""), (long)*pidList); |
64 | fail = 0; | 60 | fail = 0; |
65 | if (single_flag) | 61 | if (single_flag) |
66 | break; | 62 | break; |
67 | } | 63 | } |
68 | /* Note that we don't bother to free the memory | 64 | free(pidList); |
69 | * allocated in find_pid_by_name(). It will be freed | ||
70 | * upon exit, so we can save a byte or two */ | ||
71 | optind++; | 65 | optind++; |
66 | |||
72 | } | 67 | } |
73 | printf("\n"); | 68 | printf("\n"); |
74 | 69 | ||