diff toys/lsb/pidof.c @ 1057:242c5de2bb22 draft

Replace for_each_pid_with_name_in_array_perform_callback_function_upon_translated_value() with name_to_pid(), comparing absolute paths or just basename() consistently as spotted by Lukasz Skalski, and adjust callers.
author Rob Landley <rob@landley.net>
date Tue, 03 Sep 2013 18:43:32 -0500
parents f169d9708518
children 7ada6da9540a
line wrap: on
line diff
--- a/toys/lsb/pidof.c	Thu Sep 05 23:58:35 2013 -0500
+++ b/toys/lsb/pidof.c	Tue Sep 03 18:43:32 2013 -0500
@@ -43,12 +43,12 @@
   xprintf("%*s", len+(!toys.exitval), toybuf);
   toys.exitval = 0;
 
-  return !(toys.optflags & FLAG_s);
+  return toys.optflags & FLAG_s;
 }
 
 void pidof_main(void)
 {
   toys.exitval = 1;
-  for_each_pid_with_name_in(toys.optargs, print_pid);
+  name_to_pid(toys.optargs, print_pid);
   if (!toys.exitval) xputc('\n');
 }