aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;