argument of $cmdline_to_pid doesnt have to be the full commandline
authorNikolas Garofil <garo@dunaldi.garofil.be>
Sat, 14 Nov 2009 23:51:38 +0000 (00:51 +0100)
committerNikolas Garofil <garo@dunaldi.garofil.be>
Sat, 14 Nov 2009 23:51:38 +0000 (00:51 +0100)
doc/variables.xml
src/proc.c

index dc1c47a..92ad160 100644 (file)
             <command>
                 <option>cmdline_to_pid</option>
             </command>
-            <option>pid</option>
+            <option>string</option>
         </term>
-        <listitem>PID of process invoked with this command line
+        <listitem>PID of the first process that has string in it's
+       commandline
         <para /></listitem>
     </varlistentry>
     <varlistentry>
index 783af80..7030c05 100644 (file)
@@ -342,7 +342,7 @@ void print_cmdline_to_pid(struct text_object *obj, char *p, int p_max_size) {
                                for(i = 0; i < bytes_read - 1; i++) {
                                        if(buf[i] == 0) buf[i] = ' ';
                                }
-                               if(strcmp(buf, obj->data.s) == 0) {
+                               if(strstr(buf, obj->data.s) != NULL) {
                                        snprintf(p, p_max_size, "%s", entry->d_name);
                                        free(buf);
                                        closedir(dir);