X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fglx%2Fstarwars.c;h=5e41af2a7c8ab386ad8dfba8919fcf026b7258c0;hb=96a411663168b0ba5432b407a83be55f3df0c802;hp=5772d1ebf150c7492097bdf0a009a95d18ab5953;hpb=a94197e76a5dea5cb60542840809d6c20d0abbf3;p=xscreensaver diff --git a/hacks/glx/starwars.c b/hacks/glx/starwars.c index 5772d1eb..5e41af2a 100644 --- a/hacks/glx/starwars.c +++ b/hacks/glx/starwars.c @@ -285,13 +285,33 @@ launch_text_generator (sws_configuration *sc) sprintf (cmd, "cat /usr/src/linux-%s/README", uts.release); if (!stat (cmd+4, &st)) oprogram = cmd; + else + { + /* kernel source not installed? try X... */ + strcpy (cmd, "cat /usr/X11R6/lib/X11/doc/README"); + if (!stat (cmd+4, &st)) + oprogram = cmd; + } } } } #endif /* __linux__ */ + +#ifdef __APPLE__ /* MacOS X + XDarwin */ + { + static int done_once = 0; + if (!done_once) + { + struct stat st; + static char *cmd = "cat /usr/X11R6/README"; + if (!stat (cmd+4, &st)) + oprogram = cmd; + } + } +#endif /* __APPLE__ */ } - program = (char *) malloc (strlen (oprogram) + 10); + program = (char *) malloc (strlen (oprogram) + 10); strcpy (program, "( "); strcat (program, oprogram); strcat (program, " ) 2>&1"); @@ -423,7 +443,7 @@ get_more_lines (sws_configuration *sc) if (sc->buf_tail > (s - sc->buf)) { int i = sc->buf_tail - (s - sc->buf); - memcpy (sc->buf, s, i); + memmove (sc->buf, s, i); sc->buf_tail = i; sc->buf[sc->buf_tail] = 0; } @@ -885,7 +905,9 @@ draw_sws (ModeInfo *mi) } if (alignment >= 0) - xoff = 1.0 - (glutStrokeLength(GLUT_FONT, line) * sc->font_scale); + xoff = 1.0 - (glutStrokeLength(GLUT_FONT, + (unsigned char *) line) + * sc->font_scale); if (alignment == 0) xoff /= 2;