+2009-06-20
+ * Use the internal process list for if_running on Linux
+
2009-06-14
* Fix XMMS2 related crash (sf.net #2806111 and #2805310, thanks Lassi)
} else {
obj->data.ifblock.s = strndup(arg, text_buffer_size);
}
+#ifdef __linux__
+ END OBJ_IF(if_running, INFO_TOP)
+ if (arg) {
+ obj->data.ifblock.s = strndup(arg, text_buffer_size);
+#else
END OBJ_IF(if_running, 0)
if (arg) {
char buf[256];
snprintf(buf, 256, "pidof %s >/dev/null", arg);
obj->data.ifblock.s = strndup(buf, text_buffer_size);
+#endif
} else {
ERR("if_running needs an argument");
obj->data.ifblock.s = 0;
}
}
OBJ(if_running) {
+#ifdef __linux__
+ if (!get_process_by_name(obj->data.ifblock.s)) {
+#else
if ((obj->data.ifblock.s) && system(obj->data.ifblock.s)) {
+#endif
DO_JUMP;
}
}
first_process = NULL;
}
+struct process *get_process_by_name(const char *name)
+{
+ struct process *p = first_process;
+
+ while (p) {
+ if (!strcmp(p->name, name))
+ return p;
+ p = p->next;
+ }
+ return 0;
+}
+
static struct process *find_process(pid_t pid)
{
struct process *p = first_process;