From 1bf844232802d2deec7a2e9bee355e4c26259101 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Tue, 29 Dec 2015 11:19:02 -0600 Subject: Make pidof use comma_scan() --- toys/lsb/pidof.c | 13 ++----------- 1 file 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; -- cgit v1.2.3