X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fnoseguy.c;h=3a6542c8f3fcbce5a7147ab00f54af5c201a7d13;hb=ccbc9f87eb59497b23bd0424ee1ed20ad7c7db54;hp=4707d422b029b2a9d326c0e0fd62cccc8944166c;hpb=0a1527cc01e9894017614b7c36b838b2b6914ba9;p=xscreensaver diff --git a/hacks/noseguy.c b/hacks/noseguy.c index 4707d422..3a6542c8 100644 --- a/hacks/noseguy.c +++ b/hacks/noseguy.c @@ -1,4 +1,4 @@ -/* xscreensaver, Copyright (c) 1992 Jamie Zawinski +/* xscreensaver, Copyright (c) 1992 Jamie Zawinski * * 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,27 @@ get_words() (void) pclose(pp); if (! buf[0]) sprintf (buf, "\"%s\" produced no output!", orig_program); + else if (!first_time && + !strcmp (buf, "sh: fortune: not found\n")) + 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 +505,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 +543,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 +589,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) {