comparison 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
comparison
equal deleted inserted replaced
1056:2b35f9c797ad 1057:242c5de2bb22
41 (res[len] == ',' || res[len] == 0)) return 1; 41 (res[len] == ',' || res[len] == 0)) return 1;
42 } 42 }
43 xprintf("%*s", len+(!toys.exitval), toybuf); 43 xprintf("%*s", len+(!toys.exitval), toybuf);
44 toys.exitval = 0; 44 toys.exitval = 0;
45 45
46 return !(toys.optflags & FLAG_s); 46 return toys.optflags & FLAG_s;
47 } 47 }
48 48
49 void pidof_main(void) 49 void pidof_main(void)
50 { 50 {
51 toys.exitval = 1; 51 toys.exitval = 1;
52 for_each_pid_with_name_in(toys.optargs, print_pid); 52 name_to_pid(toys.optargs, print_pid);
53 if (!toys.exitval) xputc('\n'); 53 if (!toys.exitval) xputc('\n');
54 } 54 }