/* subprocs.c --- choosing, spawning, and killing screenhacks.
- * xscreensaver, Copyright (c) 1991-2005 Jamie Zawinski <jwz@jwz.org>
+ * xscreensaver, Copyright (c) 1991-2006 Jamie Zawinski <jwz@jwz.org>
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
#endif
#include <sys/time.h> /* sys/resource.h needs this for timeval */
+#include <sys/param.h> /* for PATH_MAX */
#ifdef HAVE_SYS_WAIT_H
# include <sys/wait.h> /* for waitpid() and associated macros */
#define Widget void*
#include "xscreensaver.h"
+#include "exec.h"
#include "yarandom.h"
#include "visual.h" /* for id_to_visual() */
static struct screenhack_job *jobs = 0;
-/* for debugging -- nothing calls this, but it's useful to invoke from gdb. */
+/* for debugging -- nothing calls this, but it's useful to invoke from gdb.
+ */
+void show_job_list (void);
+
void
show_job_list (void)
{
if (!force &&
(!hack->enabled_p ||
+ !on_path_p (hack->command) ||
!select_visual_of_hack (ssi, hack)))
{
if (++retry_count > (p->screenhacks_count*4))
const char *odpy = DisplayString (si->dpy);
char *ndpy = (char *) malloc (strlen(odpy) + 20);
char *nssw = (char *) malloc (40);
- char *s;
+ char *s, *c;
strcpy (ndpy, "DISPLAY=");
s = ndpy + strlen(ndpy);
strcpy (s, odpy);
- while (*s && *s != ':') s++; /* skip to colon */
- while (*s == ':') s++; /* skip over colons */
+ /* We have to find the last colon since it is the boundary between
+ hostname & screen - IPv6 numeric format addresses may have many
+ colons before that point, and DECnet addresses always have two colons */
+ c = strrchr(s,':'); /* skip to last colon */
+ if (c != NULL) s = c+1;
while (isdigit(*s)) s++; /* skip over dpy number */
while (*s == '.') s++; /* skip over dot */
if (s[-1] != '.') *s++ = '.'; /* put on a dot */