ftp://ftp.uni-heidelberg.de/pub/X11/contrib/applications/xscreensaver-1.27.tar.Z
[xscreensaver] / hacks / noseguy.c
index 4707d422b029b2a9d326c0e0fd62cccc8944166c..713ee23821c2db2e52996d436f9a557a65514d80 100644 (file)
@@ -1,4 +1,4 @@
-/* xscreensaver, Copyright (c) 1992 Jamie Zawinski <jwz@lucid.com>
+/* xscreensaver, Copyright (c) 1992 Jamie Zawinski <jwz@netscape.com>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
@@ -449,6 +449,8 @@ init_words()
   words = get_words(); 
 }
 
+static int first_time = 1;
+
 static char *
 get_words()
 {
@@ -461,7 +463,7 @@ get_words()
     switch (getwordsfrom)
     {
     case FROM_PROGRAM:
-       if (pp = popen(program, "r"))
+       if ((pp = popen(program, "r")))
        {
            while (fgets(p, sizeof(buf) - strlen(buf), pp))
            {
@@ -473,6 +475,28 @@ get_words()
            (void) pclose(pp);
            if (! buf[0])
              sprintf (buf, "\"%s\" produced no output!", orig_program);
+           else if (!first_time &&
+                    (strstr (buf, ": not found") ||
+                     strstr (buf, ": Not found")))
+             switch (random () % 20)
+               {
+               case 1: strcat (buf, "( Get with the program, bub. )\n");
+                 break;
+               case 2: strcat (buf,
+                 "( I blow my nose at you, you silly person! ) \n"); break;
+               case 3: strcat (buf,
+                 "\nThe resource you want to\nset is `noseguy.program'\n");
+                 break;
+               case 4:
+                 strcat(buf,"\nHelp!!  Help!!\nAAAAAAGGGGHHH!!  \n\n"); break;
+               case 5: strcpy (buf, "You have new mail.\n"); break;
+               case 6:
+                 strcat(buf,"( Hello?  Are you paying attention? )\n");break;
+               case 7:
+                 strcat (buf, "sh: what kind of fool do you take me for? \n");
+                 break;
+               }
+           first_time = 0;
            p = buf;
        }
        else
@@ -482,7 +506,7 @@ get_words()
        }
        break;
     case FROM_FILE:
-       if (pp = fopen(filename, "r"))
+       if ((pp = fopen(filename, "r")))
        {
            while (fgets(p, sizeof(buf) - strlen(buf), pp))
            {
@@ -520,8 +544,8 @@ get_words()
 char *progclass = "Noseguy";
 
 char *defaults [] = {
-  "*background:                black",
-  "*foreground:                white",
+  "Noseguy.background: black",         /* to placate SGI */
+  "Noseguy.foreground: white",
   "*mode:              program",
   "*program:           fortune -s",
   "noseguy.font:       -*-new century schoolbook-*-r-*-*-*-180-*-*-*-*-*-*",
@@ -566,7 +590,7 @@ noseguy_init (d, w)
     {
        list = XListFonts(dpy, FONT_NAME, 32767, &foo);
        for (i = 0; i < foo; i++)
-           if (font = XLoadQueryFont(dpy, list[i]))
+           if ((font = XLoadQueryFont(dpy, list[i])))
                break;
        if (!font)
          {