? .pidof.c.swp ? pidof ? pidof.core Index: pidof.c =================================================================== RCS file: /cvsroot/bmp-plugins/pidof/pidof.c,v retrieving revision 1.4 diff -u -r1.4 pidof.c --- pidof.c 1 May 2005 16:26:19 -0000 1.4 +++ pidof.c 13 Sep 2005 16:11:08 -0000 @@ -26,6 +26,7 @@ * $Id$ */ +#include #include #include #include @@ -37,56 +38,91 @@ #include #include #include +#include -static int get_pid_of_process(char *process_name); +static int get_pid_of_process(const char *process_name); static void usage(void); +static int match_argv; +static pid_t own_pid; + static int -get_pid_of_process(char *process_name) +get_pid_of_process(const char *process_name) { static kvm_t *kd = NULL; struct kinfo_proc *p; - int i, n_processes, processes_found; - - processes_found = 0; + int i, n_processes, + processes_found = 0; if ((kd = kvm_open("/dev/null", "/dev/null", "/dev/null", O_RDONLY, "kvm_open")) == NULL) (void)errx(1, "%s", kvm_geterr(kd)); else { p = kvm_getprocs(kd, KERN_PROC_PROC, 0, &n_processes); - for (i = 0; i 0) ? 0 : 1; + return ((procs_found > 0) ? 0 : 1); }