aboutsummaryrefslogtreecommitdiff
path: root/toys
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2015-12-29 11:19:02 -0600
committerRob Landley <rob@landley.net>2015-12-29 11:19:02 -0600
commit1bf844232802d2deec7a2e9bee355e4c26259101 (patch)
tree0d8afb3d407239232f0bec264e7ea5f89b03bbc5 /toys
parent21ede0889bc585828c7dbd7023f93b491ce07944 (diff)
downloadtoybox-1bf844232802d2deec7a2e9bee355e4c26259101.tar.gz
Make pidof use comma_scan()
Diffstat (limited to 'toys')
-rw-r--r--toys/lsb/pidof.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/toys/lsb/pidof.c b/toys/lsb/pidof.c
index a8fc8ef9..e1facfa8 100644
--- a/toys/lsb/pidof.c
+++ b/toys/lsb/pidof.c
@@ -28,18 +28,9 @@ GLOBALS(
static int print_pid(pid_t pid, char *name)
{
- char * res;
- int len;
-
sprintf(toybuf, "%d", (int)pid);
- len = strlen(toybuf);
-
- // Check omit string
- if (TT.omit && (res = strstr(TT.omit, toybuf)))
- if ((res == TT.omit || res[-1] == ',') &&
- (res[len] == ',' || !res[len])) return 0;
-
- xprintf("%*s", len+(!toys.exitval), toybuf);
+ if (comma_scan(TT.omit, toybuf, 0)) return 0;
+ xprintf(" %s"+!!toys.exitval, toybuf);
toys.exitval = 0;
return toys.optflags & FLAG_s;