1 /* xscreensaver, Copyright (c) 1998-2003 Jamie Zawinski <jwz@jwz.org>
3 * Permission to use, copy, modify, distribute, and sell this software and its
4 * documentation for any purpose is hereby granted without fee, provided that
5 * the above copyright notice appear in all copies and that both that
6 * copyright notice and this permission notice appear in supporting
7 * documentation. No representations are made about the suitability of this
8 * software for any purpose. It is provided "as is" without express or
11 * Blue Screen of Death: the finest in personal computer emulation.
12 * Concept cribbed from Stephen Martin <smartin@mks.com>;
13 * this version written by jwz, 4-Jun-98.
16 #include "screenhack.h"
17 #include "xpm-pixmap.h"
21 #include <X11/Xutil.h>
24 # include <sys/utsname.h>
25 #endif /* HAVE_UNAME */
27 #include "images/amiga.xpm"
28 #include "images/atari.xbm"
29 #include "images/mac.xbm"
30 #include "images/macbomb.xbm"
31 #include "images/hmac.xpm"
35 draw_string (Display *dpy, Window window, GC gc, XGCValues *gcv,
38 int win_width, int win_height,
39 const char *string, int delay)
42 int width = 0, height = 0, cw = 0;
43 int char_width, line_height;
45 const char *s = string;
46 const char *se = string;
48 /* This pretty much assumes fixed-width fonts */
49 char_width = (font->per_char
50 ? font->per_char['n'-font->min_char_or_byte2].width
51 : font->min_bounds.width);
52 line_height = font->ascent + font->descent + 1;
56 if (*s == '\n' || !*s)
59 if (cw > width) width = cw;
68 x = (win_width - (width * char_width)) / 2;
69 y = (win_height - (height * line_height)) / 2;
80 if (*s == '\n' || !*s)
85 if (*se == '@' || *se == '_')
87 if (*se == '@') flip = True;
89 off = (char_width * (width - (s - se))) / 2;
94 XSetForeground(dpy, gc, gcv->background);
95 XSetBackground(dpy, gc, gcv->foreground);
99 XDrawImageString(dpy, window, gc, x+off, y+font->ascent, se, s-se);
103 XSetForeground(dpy, gc, gcv->foreground);
104 XSetBackground(dpy, gc, gcv->background);
121 return width * char_width;
126 double_pixmap(Display *dpy, GC gc, Visual *visual, int depth, Pixmap pixmap,
127 int pix_w, int pix_h)
130 Pixmap p2 = XCreatePixmap(dpy, pixmap, pix_w*2, pix_h*2, depth);
131 XImage *i1 = XGetImage(dpy, pixmap, 0, 0, pix_w, pix_h, ~0L, ZPixmap);
132 XImage *i2 = XCreateImage(dpy, visual, depth, ZPixmap, 0, 0,
133 pix_w*2, pix_h*2, 8, 0);
134 i2->data = (char *) calloc(i2->height, i2->bytes_per_line);
135 for (y = 0; y < pix_h; y++)
136 for (x = 0; x < pix_w; x++)
138 unsigned long p = XGetPixel(i1, x, y);
139 XPutPixel(i2, x*2, y*2, p);
140 XPutPixel(i2, x*2+1, y*2, p);
141 XPutPixel(i2, x*2, y*2+1, p);
142 XPutPixel(i2, x*2+1, y*2+1, p);
144 free(i1->data); i1->data = 0;
146 XPutImage(dpy, p2, gc, i2, 0, 0, 0, 0, i2->width, i2->height);
147 free(i2->data); i2->data = 0;
149 XFreePixmap(dpy, pixmap);
154 /* Sleep for N seconds and return False. But if a key or mouse event is
155 seen, discard all pending key or mouse events, and return True.
158 bsod_sleep(Display *dpy, int seconds)
161 int quantum = 250000;
164 q = 1, quantum = 100000;
169 while (XPending (dpy))
172 XNextEvent (dpy, &event);
173 if (event.xany.type == ButtonPress)
175 if (event.xany.type == KeyPress)
179 XLookupString (&event.xkey, &c, 1, &keysym, 0);
180 if (c == ' ' || c == '\t' || c == '\r' || c == '\n')
183 screenhack_handle_event (dpy, &event);
199 windows (Display *dpy, Window window, int delay, int which)
202 XWindowAttributes xgwa;
204 const char *def_font = "fixed";
210 "A fatal exception 0E has occured at F0AD:42494C4C\n"
211 "the current application will be terminated.\n"
213 "* Press any key to terminate the current application.\n"
214 "* Press CTRL+ALT+DELETE again to restart your computer.\n"
215 " You will lose any unsaved information in all applications.\n"
218 "_Press any key to continue");
220 const char *wnt = /* from Jim Niemira <urmane@urmane.org> */
221 ("*** STOP: 0x0000001E (0x80000003,0x80106fc0,0x8025ea21,0xfd6829e8)\n"
222 "Unhandled Kernel exception c0000047 from fa8418b4 (8025ea21,fd6829e8)\n"
224 "Dll Base Date Stamp - Name Dll Base Date Stamp - Name\n"
225 "80100000 2be154c9 - ntoskrnl.exe 80400000 2bc153b0 - hal.dll\n"
226 "80258000 2bd49628 - ncrc710.sys 8025c000 2bd49688 - SCSIPORT.SYS \n"
227 "80267000 2bd49683 - scsidisk.sys 802a6000 2bd496b9 - Fastfat.sys\n"
228 "fa800000 2bd49666 - Floppy.SYS fa810000 2bd496db - Hpfs_Rec.SYS\n"
229 "fa820000 2bd49676 - Null.SYS fa830000 2bd4965a - Beep.SYS\n"
230 "fa840000 2bdaab00 - i8042prt.SYS fa850000 2bd5a020 - SERMOUSE.SYS\n"
231 "fa860000 2bd4966f - kbdclass.SYS fa870000 2bd49671 - MOUCLASS.SYS\n"
232 "fa880000 2bd9c0be - Videoprt.SYS fa890000 2bd49638 - NCC1701E.SYS\n"
233 "fa8a0000 2bd4a4ce - Vga.SYS fa8b0000 2bd496d0 - Msfs.SYS\n"
234 "fa8c0000 2bd496c3 - Npfs.SYS fa8e0000 2bd496c9 - Ntfs.SYS\n"
235 "fa940000 2bd496df - NDIS.SYS fa930000 2bd49707 - wdlan.sys\n"
236 "fa970000 2bd49712 - TDI.SYS fa950000 2bd5a7fb - nbf.sys\n"
237 "fa980000 2bd72406 - streams.sys fa9b0000 2bd4975f - ubnb.sys\n"
238 "fa9c0000 2bd5bfd7 - usbser.sys fa9d0000 2bd4971d - netbios.sys\n"
239 "fa9e0000 2bd49678 - Parallel.sys fa9f0000 2bd4969f - serial.SYS\n"
240 "faa00000 2bd49739 - mup.sys faa40000 2bd4971f - SMBTRSUP.SYS\n"
241 "faa10000 2bd6f2a2 - srv.sys faa50000 2bd4971a - afd.sys\n"
242 "faa60000 2bd6fd80 - rdr.sys faaa0000 2bd49735 - bowser.sys\n"
244 "Address dword dump Dll Base - Name\n"
245 "801afc20 80106fc0 80106fc0 00000000 00000000 80149905 : "
246 "fa840000 - i8042prt.SYS\n"
247 "801afc24 80149905 80149905 ff8e6b8c 80129c2c ff8e6b94 : "
248 "8025c000 - SCSIPORT.SYS\n"
249 "801afc2c 80129c2c 80129c2c ff8e6b94 00000000 ff8e6b94 : "
250 "80100000 - ntoskrnl.exe\n"
251 "801afc34 801240f2 80124f02 ff8e6df4 ff8e6f60 ff8e6c58 : "
252 "80100000 - ntoskrnl.exe\n"
253 "801afc54 80124f16 80124f16 ff8e6f60 ff8e6c3c 8015ac7e : "
254 "80100000 - ntoskrnl.exe\n"
255 "801afc64 8015ac7e 8015ac7e ff8e6df4 ff8e6f60 ff8e6c58 : "
256 "80100000 - ntoskrnl.exe\n"
257 "801afc70 80129bda 80129bda 00000000 80088000 80106fc0 : "
258 "80100000 - ntoskrnl.exe\n"
260 "Kernel Debugger Using: COM2 (Port 0x2f8, Baud Rate 19200)\n"
261 "Restart and set the recovery options in the system control panel\n"
262 "or the /CRASHDEBUG system start option. If this message reappears,\n"
263 "contact your system administrator or technical support group."
267 ("*** STOP: 0x000000D1 (0xE1D38000,0x0000001C,0x00000000,0xF09D42DA)\n"
268 "DRIVER_IRQL_NOT_LESS_OR_EQUAL \n"
270 "*** Address F09D42DA base at F09D4000, DateStamp 39f459ff - CRASHDD.SYS\n"
272 "Beginning dump of physical memory\n");
274 ("Physical memory dump complete. Contact your system administrator or\n"
275 "technical support group.\n");
278 (" Windows protection error. You need to restart your computer.");
282 if (which < 0 || which > 2) abort();
284 /* kludge to lump Win2K and WinME together; seems silly to add another
285 preference/command line option just for this little one. */
286 if (which == 2 && (random() % 2))
289 if (!get_boolean_resource((which == 0 ? "doWindows" :
290 which == 1 ? "doNT" :
291 which == 2 ? "doWin2K" :
292 "doWin2K"), /* "doWinME" ? */
296 XGetWindowAttributes (dpy, window, &xgwa);
298 fontname = get_string_resource ((xgwa.height > 600
299 ? (which == 0 ? "windows95.font2" :
300 which == 1 ? "windowsNT.font2" :
301 which == 2 ? "windows2K.font2" :
303 : (which == 0 ? "windows95.font" :
304 which == 1 ? "windowsNT.font" :
305 which == 2 ? "windows2K.font" :
308 if (!fontname || !*fontname) fontname = (char *)def_font;
309 font = XLoadQueryFont (dpy, fontname);
310 if (!font) font = XLoadQueryFont (dpy, def_font);
312 if (fontname && fontname != def_font)
315 gcv.font = font->fid;
316 gcv.foreground = get_pixel_resource((which == 0 ? "windows95.foreground" :
317 which == 1 ? "windowsNT.foreground" :
318 which == 2 ? "windows2K.foreground" :
319 "windowsME.foreground"),
320 "Windows.Foreground",
322 gcv.background = get_pixel_resource((which == 0 ? "windows95.background" :
323 which == 1 ? "windowsNT.background" :
324 which == 2 ? "windows2K.background" :
325 "windowsME.background"),
326 "Windows.Background",
328 XSetWindowBackground(dpy, window, gcv.background);
329 XClearWindow(dpy, window);
331 gc = XCreateGC(dpy, window, GCFont|GCForeground|GCBackground, &gcv);
334 draw_string(dpy, window, gc, &gcv, font,
335 0, 0, xgwa.width, xgwa.height, w95, 0);
337 draw_string(dpy, window, gc, &gcv, font, 0, 0, 10, 10, wnt, 750);
340 int line_height = font->ascent + font->descent + 1;
342 int y = (xgwa.height / 4);
344 draw_string(dpy, window, gc, &gcv, font, x, y, 10, 10, w2ka, 750);
345 y += line_height * 6;
347 draw_string(dpy, window, gc, &gcv, font, x, y, 10, 10, w2kb, 750);
351 int line_height = font->ascent + font->descent;
353 int y = (xgwa.height - line_height * 3) / 2;
354 draw_string (dpy, window, gc, &gcv, font, x, y, 10, 10, wmea, 0);
355 y += line_height * 2;
356 x = draw_string (dpy, window, gc, &gcv, font, x, y, 10, 10, wmeb, 0);
360 XDrawImageString (dpy, window, gc, x, y, "_", 1);
363 XDrawImageString (dpy, window, gc, x, y, " ", 1);
366 if (bsod_sleep(dpy, 0))
377 bsod_sleep(dpy, delay);
378 XClearWindow(dpy, window);
379 XFreeFont(dpy, font);
383 /* SCO OpenServer 5 panic, by Tom Kelly <tom@ancilla.toronto.on.ca>
386 sco (Display *dpy, Window window, int delay)
389 XWindowAttributes xgwa;
391 const char *def_font = "fixed";
394 int lines_1 = 0, lines_2 = 0, lines_3 = 0, lines_4 = 0;
397 const char *sco_panic_1 =
398 ("Unexpected trap in kernel mode:\n"
400 "cr0 0x80010013 cr2 0x00000014 cr3 0x00000000 tlb 0x00000000\n"
401 "ss 0x00071054 uesp 0x00012055 efl 0x00080888 ipl 0x00000005\n"
402 "cs 0x00092585 eip 0x00544a4b err 0x004d4a47 trap 0x0000000E\n"
403 "eax 0x0045474b ecx 0x0042544b edx 0x57687920 ebx 0x61726520\n"
404 "esp 0x796f7520 ebp 0x72656164 esi 0x696e6720 edi 0x74686973\n"
405 "ds 0x3f000000 es 0x43494c48 fs 0x43525343 gs 0x4f4d4b53\n"
407 "PANIC: k_trap - kernel mode trap type 0x0000000E\n"
408 "Trying to dump 5023 pages to dumpdev hd (1/41), 63 pages per '.'\n"
410 const char *sco_panic_2 =
411 ("...............................................................................\n"
413 const char *sco_panic_3 =
414 ("5023 pages dumped\n"
418 const char *sco_panic_4 =
419 ("** Safe to Power Off **\n"
421 "** Press Any Key to Reboot **\n"
424 if (!get_boolean_resource("doSCO", "DoSCO"))
427 for (s = sco_panic_1; *s; s++) if (*s == '\n') lines_1++;
428 for (s = sco_panic_2; *s; s++) if (*s == '\n') lines_2++;
429 for (s = sco_panic_3; *s; s++) if (*s == '\n') lines_3++;
430 for (s = sco_panic_4; *s; s++) if (*s == '\n') lines_4++;
432 XGetWindowAttributes (dpy, window, &xgwa);
434 fontname = get_string_resource ((xgwa.height > 600
438 if (!fontname || !*fontname) fontname = (char *)def_font;
439 font = XLoadQueryFont (dpy, fontname);
440 if (!font) font = XLoadQueryFont (dpy, def_font);
442 if (fontname && fontname != def_font)
445 gcv.font = font->fid;
446 gcv.foreground = get_pixel_resource(("sco.foreground"),
449 gcv.background = get_pixel_resource(("sco.background"),
452 XSetWindowBackground(dpy, window, gcv.background);
453 XClearWindow(dpy, window);
455 gc = XCreateGC(dpy, window, GCFont|GCForeground|GCBackground, &gcv);
457 draw_string(dpy, window, gc, &gcv, font,
458 10, xgwa.height - ((lines_1 + lines_2 + lines_3 + lines_4 + 1) *
459 (font->ascent + font->descent + 1)),
463 for (s = sco_panic_2; *s; s++)
465 char *ss = strdup(sco_panic_2);
466 ss[s - sco_panic_2] = 0;
467 draw_string(dpy, window, gc, &gcv, font,
468 10, xgwa.height - ((lines_2 + lines_3 + lines_4 + 1) *
469 (font->ascent + font->descent + 1)),
474 if (bsod_sleep (dpy, -1))
478 draw_string(dpy, window, gc, &gcv, font,
479 10, xgwa.height - ((lines_3 + lines_4 + 1) *
480 (font->ascent + font->descent + 1)),
484 if (bsod_sleep(dpy, 1))
486 draw_string(dpy, window, gc, &gcv, font,
487 10, xgwa.height - ((lines_4 + 1) *
488 (font->ascent + font->descent + 1)),
493 bsod_sleep(dpy, delay);
495 XClearWindow(dpy, window);
497 XFreeFont(dpy, font);
502 /* Linux (sparc) panic, by Tom Kelly <tom@ancilla.toronto.on.ca>
505 sparc_linux (Display *dpy, Window window, int delay)
508 XWindowAttributes xgwa;
510 const char *def_font = "fixed";
516 const char *linux_panic =
517 ("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
518 "Unable to handle kernel paging request at virtual address f0d4a000\n"
519 "tsk->mm->context = 00000014\n"
520 "tsk->mm->pgd = f26b0000\n"
525 "gawk(22827): Oops\n"
526 "PSR: 044010c1 PC: f001c2cc NPC: f001c2d0 Y: 00000000\n"
527 "g0: 00001000 g1: fffffff7 g2: 04401086 g3: 0001eaa0\n"
528 "g4: 000207dc g5: f0130400 g6: f0d4a018 g7: 00000001\n"
529 "o0: 00000000 o1: f0d4a298 o2: 00000040 o3: f1380718\n"
530 "o4: f1380718 o5: 00000200 sp: f1b13f08 ret_pc: f001c2a0\n"
531 "l0: efffd880 l1: 00000001 l2: f0d4a230 l3: 00000014\n"
532 "l4: 0000ffff l5: f0131550 l6: f012c000 l7: f0130400\n"
533 "i0: f1b13fb0 i1: 00000001 i2: 00000002 i3: 0007c000\n"
534 "i4: f01457c0 i5: 00000004 i6: f1b13f70 i7: f0015360\n"
535 "Instruction DUMP:\n"
538 if (!get_boolean_resource("doSparcLinux", "DoSparcLinux"))
541 for (s = linux_panic; *s; s++) if (*s == '\n') lines++;
543 XGetWindowAttributes (dpy, window, &xgwa);
545 fontname = get_string_resource ((xgwa.height > 600
547 : "sparclinux.font"),
549 if (!fontname || !*fontname) fontname = (char *)def_font;
550 font = XLoadQueryFont (dpy, fontname);
551 if (!font) font = XLoadQueryFont (dpy, def_font);
553 if (fontname && fontname != def_font)
556 gcv.font = font->fid;
557 gcv.foreground = get_pixel_resource(("sparclinux.foreground"),
558 "SparcLinux.Foreground",
560 gcv.background = get_pixel_resource(("sparclinux.background"),
561 "SparcLinux.Background",
563 XSetWindowBackground(dpy, window, gcv.background);
564 XClearWindow(dpy, window);
566 gc = XCreateGC(dpy, window, GCFont|GCForeground|GCBackground, &gcv);
568 draw_string(dpy, window, gc, &gcv, font,
569 10, xgwa.height - (lines * (font->ascent + font->descent + 1)),
574 bsod_sleep(dpy, delay);
575 XClearWindow(dpy, window);
576 XFreeFont(dpy, font);
580 /* BSD Panic by greywolf@starwolf.com - modeled after the Linux panic above.
581 By Grey Wolf <greywolf@siteROCK.com>
584 bsd (Display *dpy, Window window, int delay)
587 XWindowAttributes xgwa;
589 const char *def_font = "fixed";
594 const char *rbstr, *panicking;
595 char syncing[80], bbuf[5], *bp;
597 const char *panicstr[] =
598 {"panic: ifree: freeing free inode",
599 "panic: blkfree: freeing free block",
600 "panic: improbability coefficient below zero",
602 "panic: crazy interrupts",
604 "panic: attempted windows install",
606 "panic: free inode isn't",
607 "panic: cpu_fork: curproc",
608 "panic: malloc: out of space in kmem_map",
609 "panic: vogon starship detected",
610 "panic: teleport chamber: out of order",
611 "panic: Brain fried - core dumped"};
613 if (!get_boolean_resource("doBSD", "DoBSD"))
616 for (i = 0; i < sizeof(syncing); i++)
619 i = (random() & 0xffff) % (sizeof(panicstr) / sizeof(*panicstr));
621 panicking = panicstr[i];
622 strcpy(syncing, "Syncing disks: ");
624 b = (random() & 0xff) % 40;
625 for (n = 0; (n < 20) && (b > 0); n++)
629 i = (random() & 0x7);
630 b -= (random() & 0xff) % 20;
634 sprintf (bbuf, "%d ", b);
635 strcat (syncing, bbuf);
645 XGetWindowAttributes (dpy, window, &xgwa);
647 fontname = get_string_resource ((xgwa.height > 600
651 if (!fontname || !*fontname) fontname = (char *)def_font;
652 font = XLoadQueryFont (dpy, fontname);
653 if (!font) font = XLoadQueryFont (dpy, def_font);
655 if (fontname && fontname != def_font)
658 gcv.font = font->fid;
659 gcv.foreground = get_pixel_resource(("bsd.foreground"),
662 gcv.background = get_pixel_resource(("bsd.background"),
665 XSetWindowBackground(dpy, window, gcv.background);
666 XClearWindow(dpy, window);
668 gc = XCreateGC(dpy, window, GCFont|GCForeground|GCBackground, &gcv);
670 draw_string(dpy, window, gc, &gcv, font,
671 10, xgwa.height - (lines * (font->ascent + font->descent + 1)),
677 for (bp = syncing; *bp;)
679 char *bsd_bufs, oc = 0;
680 for (;*bp && (*bp != ' '); bp++)
687 bsd_bufs = strdup(syncing);
688 draw_string(dpy, window, gc, &gcv, font,
690 xgwa.height - (lines * (font->ascent + font->descent + 1)),
697 if (bsod_sleep(dpy, -1))
704 draw_string(dpy, window, gc, &gcv, font,
705 10, xgwa.height - (lines * (font->ascent + font->descent + 1)),
709 draw_string(dpy, window, gc, &gcv, font,
710 10, xgwa.height - (lines * (font->ascent + font->descent + 1)),
716 bsod_sleep(dpy, delay);
719 XClearWindow(dpy, window);
720 XFreeFont(dpy, font);
725 amiga (Display *dpy, Window window, int delay)
728 XWindowAttributes xgwa;
730 const char *def_font = "fixed";
734 unsigned long fg, bg, bg2;
736 int pix_w = 0, pix_h = 0;
741 ("_Software failure. Press left mouse button to continue.\n"
742 "_Guru Meditation #00000003.00C01570");
744 if (!get_boolean_resource("doAmiga", "DoAmiga"))
747 XGetWindowAttributes (dpy, window, &xgwa);
749 fontname = get_string_resource ((xgwa.height > 600
750 ? "amiga.font2" : "amiga.font"),
752 if (!fontname || !*fontname) fontname = (char *)def_font;
753 font = XLoadQueryFont (dpy, fontname);
754 if (!font) font = XLoadQueryFont (dpy, def_font);
756 if (fontname && fontname != def_font)
759 gcv.font = font->fid;
760 fg = gcv.foreground = get_pixel_resource("amiga.foreground",
763 bg = gcv.background = get_pixel_resource("amiga.background",
766 bg2 = get_pixel_resource("amiga.background2", "Amiga.Background",
768 XSetWindowBackground(dpy, window, bg2);
769 XClearWindow(dpy, window);
771 gc = XCreateGC(dpy, window, GCFont|GCForeground|GCBackground, &gcv);
772 gcv.background = fg; gcv.foreground = bg;
773 gc2 = XCreateGC(dpy, window, GCFont|GCForeground|GCBackground, &gcv);
775 height = (font->ascent + font->descent) * 6;
777 #if defined(HAVE_GDK_PIXBUF) || defined (HAVE_XPM)
778 pixmap = xpm_data_to_pixmap (dpy, window, (char **) amiga_hand,
780 #endif /* HAVE_GDK_PIXBUF || HAVE_XPM */
782 if (pixmap && xgwa.height > 600) /* scale up the bitmap */
784 pixmap = double_pixmap(dpy, gc, xgwa.visual, xgwa.depth,
785 pixmap, pix_w, pix_h);
792 int x = (xgwa.width - pix_w) / 2;
793 int y = ((xgwa.height - pix_h) / 2);
794 XCopyArea(dpy, pixmap, window, gc, 0, 0, pix_w, pix_h, x, y);
799 XCopyArea(dpy, pixmap, window, gc, 0, 0, pix_w, pix_h, x, y + height);
800 XClearArea(dpy, window, 0, 0, xgwa.width, y + height, False);
801 XFreePixmap(dpy, pixmap);
804 XFillRectangle(dpy, window, gc2, 0, 0, xgwa.width, height);
805 margin = font->ascent;
806 string_width = draw_string(dpy, window, gc, &gcv, font,
808 xgwa.width - (margin * 2), height,
815 XFillRectangle(dpy, window, gca, 0, 0, xgwa.width, margin);
816 XFillRectangle(dpy, window, gca, 0, 0, margin, height);
817 XFillRectangle(dpy, window, gca,
818 0, height - margin, xgwa.width, margin);
819 x2 = margin + string_width;
820 if (x2 < xgwa.width - margin) x2 = xgwa.width - margin;
821 XFillRectangle(dpy, window, gca, x2, 0, margin, height);
823 gca = (gca == gc ? gc2 : gc);
825 if (bsod_sleep(dpy, 1))
834 XClearWindow(dpy, window);
835 XFreeFont(dpy, font);
840 /* Atari ST, by Marcus Herbert <rhoenie@nobiscum.de>
841 Marcus had this to say:
843 Though I still have my Atari somewhere, I hardly remember
844 the meaning of the bombs. I think 9 bombs was "bus error" or
845 something like that. And you often had a few bombs displayed
846 quickly and then the next few ones coming up step by step.
847 Perhaps somebody else can tell you more about it.. its just
851 atari (Display *dpy, Window window, int delay)
855 XWindowAttributes xgwa;
856 const char *def_font = "fixed";
860 int pix_w = atari_width;
861 int pix_h = atari_height;
865 if (!get_boolean_resource("doAtari", "DoAtari"))
868 XGetWindowAttributes (dpy, window, &xgwa);
870 font = XLoadQueryFont (dpy, def_font);
873 gcv.font = font->fid;
874 gcv.foreground = get_pixel_resource("atari.foreground", "Atari.Foreground",
876 gcv.background = get_pixel_resource("atari.background", "Atari.Background",
879 XSetWindowBackground(dpy, window, gcv.background);
880 XClearWindow(dpy, window);
882 gc = XCreateGC(dpy, window, GCFont|GCForeground|GCBackground, &gcv);
884 pixmap = XCreatePixmapFromBitmapData(dpy, window, (char *) atari_bits,
886 gcv.foreground, gcv.background,
888 pixmap = double_pixmap(dpy, gc, xgwa.visual, xgwa.depth,
889 pixmap, pix_w, pix_h);
895 y = (xgwa.height - (xgwa.height / 5));
898 for (i=0 ; i<7 ; i++) {
899 XCopyArea(dpy, pixmap, window, gc, 0, 0, pix_w, pix_h,
900 (x + (i*offset)), y);
903 for (i=7 ; i<10 ; i++) {
904 if (bsod_sleep(dpy, 1))
906 XCopyArea(dpy, pixmap, window, gc, 0, 0, pix_w, pix_h,
907 (x + (i*offset)), y);
910 bsod_sleep(dpy, delay);
912 XFreePixmap(dpy, pixmap);
915 XClearWindow(dpy, window);
916 XFreeFont(dpy, font);
922 mac (Display *dpy, Window window, int delay)
925 XWindowAttributes xgwa;
927 const char *def_font = "fixed";
931 int pix_w = mac_width;
932 int pix_h = mac_height;
933 int offset = mac_height * 4;
936 const char *string = ("0 0 0 0 0 0 0 F\n"
939 if (!get_boolean_resource("doMac", "DoMac"))
942 XGetWindowAttributes (dpy, window, &xgwa);
944 fontname = get_string_resource ("mac.font", "Mac.Font");
945 if (!fontname || !*fontname) fontname = (char *)def_font;
946 font = XLoadQueryFont (dpy, fontname);
947 if (!font) font = XLoadQueryFont (dpy, def_font);
949 if (fontname && fontname != def_font)
952 gcv.font = font->fid;
953 gcv.foreground = get_pixel_resource("mac.foreground", "Mac.Foreground",
955 gcv.background = get_pixel_resource("mac.background", "Mac.Background",
957 XSetWindowBackground(dpy, window, gcv.background);
958 XClearWindow(dpy, window);
960 gc = XCreateGC(dpy, window, GCFont|GCForeground|GCBackground, &gcv);
962 pixmap = XCreatePixmapFromBitmapData(dpy, window, (char *) mac_bits,
963 mac_width, mac_height,
968 for(i = 0; i < 2; i++)
970 pixmap = double_pixmap(dpy, gc, xgwa.visual, xgwa.depth,
971 pixmap, pix_w, pix_h);
972 pix_w *= 2; pix_h *= 2;
976 int x = (xgwa.width - pix_w) / 2;
977 int y = (((xgwa.height + offset) / 2) -
979 (font->ascent + font->descent) * 2);
981 XCopyArea(dpy, pixmap, window, gc, 0, 0, pix_w, pix_h, x, y);
982 XFreePixmap(dpy, pixmap);
985 draw_string(dpy, window, gc, &gcv, font, 0, 0,
986 xgwa.width, xgwa.height + offset, string, 0);
990 bsod_sleep(dpy, delay);
991 XClearWindow(dpy, window);
992 XFreeFont(dpy, font);
997 macsbug (Display *dpy, Window window, int delay)
1000 XWindowAttributes xgwa;
1002 const char *def_font = "fixed";
1006 int char_width, line_height;
1007 int col_right, row_top, row_bottom, page_right, page_bottom, body_top;
1010 const char *left = (" SP \n"
1057 const char *bottom = (" _A09D\n"
1058 " +00884 40843714 #$0700,SR "
1060 " +00886 40843765 *+$0400 "
1062 " +00888 40843718 $0004(A7),([0,A7[)"
1063 " ; 04E8D0AE | 66B8");
1066 const char *body = ("Bus Error at 4BF6D6CC\n"
1067 "while reading word from 4BF6D6CC in User data space\n"
1068 " Unable to access that address\n"
1070 " Frame Type: B008");
1072 const char * body = ("PowerPC unmapped memory exception at 003AFDAC "
1073 "BowelsOfTheMemoryMgr+04F9C\n"
1074 " Calling chain using A6/R1 links\n"
1075 " Back chain ISA Caller\n"
1076 " 00000000 PPC 28C5353C __start+00054\n"
1077 " 24DB03C0 PPC 28B9258C main+0039C\n"
1078 " 24DB0350 PPC 28B9210C MainEvent+00494\n"
1079 " 24DB02B0 PPC 28B91B40 HandleEvent+00278\n"
1080 " 24DB0250 PPC 28B83DAC DoAppleEvent+00020\n"
1081 " 24DB0210 PPC FFD3E5D0 "
1082 "AEProcessAppleEvent+00020\n"
1083 " 24DB0132 68K 00589468\n"
1084 " 24DAFF8C 68K 00589582\n"
1085 " 24DAFF26 68K 00588F70\n"
1086 " 24DAFEB3 PPC 00307098 "
1087 "EmToNatEndMoveParams+00014\n"
1088 " 24DAFE40 PPC 28B9D0B0 DoScript+001C4\n"
1089 " 24DAFDD0 PPC 28B9C35C RunScript+00390\n"
1090 " 24DAFC60 PPC 28BA36D4 run_perl+000E0\n"
1091 " 24DAFC10 PPC 28BC2904 perl_run+002CC\n"
1092 " 24DAFA80 PPC 28C18490 Perl_runops+00068\n"
1093 " 24DAFA30 PPC 28BE6CC0 Perl_pp_backtick+000FC\n"
1094 " 24DAF9D0 PPC 28BA48B8 Perl_my_popen+00158\n"
1095 " 24DAF980 PPC 28C5395C sfclose+00378\n"
1096 " 24DAF930 PPC 28BA568C free+0000C\n"
1097 " 24DAF8F0 PPC 28BA6254 pool_free+001D0\n"
1098 " 24DAF8A0 PPC FFD48F14 DisposePtr+00028\n"
1099 " 24DAF7C9 PPC 00307098 "
1100 "EmToNatEndMoveParams+00014\n"
1101 " 24DAF780 PPC 003AA180 __DisposePtr+00010");
1107 if (!get_boolean_resource("doMacsBug", "DoMacsBug"))
1110 for (s = body; *s; s++) if (*s == '\n') body_lines++;
1112 XGetWindowAttributes (dpy, window, &xgwa);
1114 fontname = get_string_resource ((xgwa.height > 850
1116 : (xgwa.height > 700
1120 if (!fontname || !*fontname) fontname = (char *)def_font;
1121 font = XLoadQueryFont (dpy, fontname);
1122 if (!font) font = XLoadQueryFont (dpy, def_font);
1123 if (!font) exit(-1);
1124 if (fontname && fontname != def_font)
1127 gcv.font = font->fid;
1128 gcv.foreground = get_pixel_resource("macsbug.foreground",
1129 "MacsBug.Foreground",
1130 dpy, xgwa.colormap);
1131 gcv.background = get_pixel_resource("macsbug.background",
1132 "MacsBug.Background",
1133 dpy, xgwa.colormap);
1135 gc = XCreateGC(dpy, window, GCFont|GCForeground|GCBackground, &gcv);
1137 gcv.foreground = gcv.background;
1138 gc2 = XCreateGC(dpy, window, GCForeground, &gcv);
1140 XSetWindowBackground(dpy, window,
1141 get_pixel_resource("macsbug.borderColor",
1142 "MacsBug.BorderColor",
1143 dpy, xgwa.colormap));
1144 XClearWindow(dpy, window);
1146 char_width = (font->per_char
1147 ? font->per_char['n'-font->min_char_or_byte2].width
1148 : font->min_bounds.width);
1149 line_height = font->ascent + font->descent + 1;
1151 col_right = char_width * 12;
1152 page_bottom = line_height * 47;
1154 if (page_bottom > xgwa.height) page_bottom = xgwa.height;
1156 row_bottom = page_bottom - line_height;
1157 row_top = row_bottom - (line_height * 4);
1158 page_right = col_right + (char_width * 88);
1159 body_top = row_top - (line_height * body_lines);
1165 xoff = (xgwa.width - page_right) / 2;
1166 yoff = (xgwa.height - page_bottom) / 2;
1167 if (xoff < 0) xoff = 0;
1168 if (yoff < 0) yoff = 0;
1170 XFillRectangle(dpy, window, gc2, xoff, yoff, page_right, page_bottom);
1172 draw_string(dpy, window, gc, &gcv, font, xoff, yoff, 10, 10, left, 0);
1173 draw_string(dpy, window, gc, &gcv, font, xoff+col_right, yoff+row_top,
1176 XFillRectangle(dpy, window, gc, xoff + col_right, yoff, 2, page_bottom);
1177 XDrawLine(dpy, window, gc,
1178 xoff+col_right, yoff+row_top, xoff+page_right, yoff+row_top);
1179 XDrawLine(dpy, window, gc,
1180 xoff+col_right, yoff+row_bottom, xoff+page_right, yoff+row_bottom);
1181 XDrawRectangle(dpy, window, gc, xoff, yoff, page_right, page_bottom);
1186 draw_string(dpy, window, gc, &gcv, font,
1187 xoff + col_right + char_width, yoff + body_top, 10, 10, body,
1192 XDrawLine(dpy, window, gc,
1193 xoff+col_right+(char_width/2)+2, yoff+row_bottom+3,
1194 xoff+col_right+(char_width/2)+2, yoff+page_bottom-3);
1197 XDrawLine(dpy, window, gc2,
1198 xoff+col_right+(char_width/2)+2, yoff+row_bottom+3,
1199 xoff+col_right+(char_width/2)+2, yoff+page_bottom-3);
1202 if (bsod_sleep(dpy, 0))
1209 XClearWindow(dpy, window);
1210 XFreeFont(dpy, font);
1215 mac1 (Display *dpy, Window window, int delay)
1218 XWindowAttributes xgwa;
1221 int pix_w = macbomb_width;
1222 int pix_h = macbomb_height;
1224 if (!get_boolean_resource("doMac1", "DoMac1"))
1227 XGetWindowAttributes (dpy, window, &xgwa);
1229 gcv.foreground = get_pixel_resource("mac1.foreground", "Mac.Foreground",
1230 dpy, xgwa.colormap);
1231 gcv.background = get_pixel_resource("mac1.background", "Mac.Background",
1232 dpy, xgwa.colormap);
1233 XSetWindowBackground(dpy, window, gcv.background);
1234 XClearWindow(dpy, window);
1236 gc = XCreateGC(dpy, window, GCForeground|GCBackground, &gcv);
1238 pixmap = XCreatePixmapFromBitmapData(dpy, window, (char *) macbomb_bits,
1239 macbomb_width, macbomb_height,
1245 int x = (xgwa.width - pix_w) / 2;
1246 int y = (xgwa.height - pix_h) / 2;
1248 XFillRectangle (dpy, window, gc, 0, 0, xgwa.width, xgwa.height);
1250 if (bsod_sleep(dpy, 1))
1252 XCopyArea(dpy, pixmap, window, gc, 0, 0, pix_w, pix_h, x, y);
1257 XFreePixmap(dpy, pixmap);
1259 bsod_sleep(dpy, delay);
1260 XClearWindow(dpy, window);
1266 macx (Display *dpy, Window window, int delay)
1269 XWindowAttributes xgwa;
1271 const char *def_font = "fixed";
1275 const char *macx_panic =
1276 ("panic(cpu 0): Unable to find driver for this platform: "
1277 "\"PowerMac 3,5\".\n"
1279 "backtrace: 0x0008c2f4 0x0002a7a0 0x001f0204 0x001d4e4c 0x001d4c5c "
1280 "0x001a56cc 0x01d5dbc 0x001c621c 0x00037430 0x00037364\n"
1284 "No debugger configured - dumping debug information\n"
1286 "version string : Darwin Kernel Version 1.3:\n"
1287 "Thu Mar 1 06:56:40 PST 2001; root:xnu/xnu-123.5.obj~1/RELEASE_PPC\n"
1292 "DBAT0: 00000000 00000000\n"
1293 "DBAT1: 00000000 00000000\n"
1294 "DBAT2: 80001FFE 8000003A\n"
1295 "DBAT3: 90001FFE 9000003A\n"
1297 "backtrace: 0x0008c2f4 0x0002a7a0 0x001f0204 0x001d4e4c 0x001d4c5c "
1298 "0x001a56cc 0x01d5dbc 0x001c621c 0x00037430 0x00037364\n"
1300 "panic: We are hanging here...\n");
1302 if (!get_boolean_resource("doMacX", "DoMacX"))
1305 XGetWindowAttributes (dpy, window, &xgwa);
1307 gcv.background = get_pixel_resource("macX.background",
1309 dpy, xgwa.colormap);
1310 XSetWindowBackground(dpy, window, gcv.background);
1311 XClearWindow(dpy, window);
1313 fontname = get_string_resource ((xgwa.height > 900
1317 if (!fontname || !*fontname) fontname = (char *)def_font;
1318 font = XLoadQueryFont (dpy, fontname);
1319 if (!font) font = XLoadQueryFont (dpy, def_font);
1320 if (!font) exit(-1);
1321 if (fontname && fontname != def_font)
1324 gcv.font = font->fid;
1325 gcv.foreground = get_pixel_resource("macsbug.foreground",
1326 "MacsBug.Foreground",
1327 dpy, xgwa.colormap);
1328 gcv.background = get_pixel_resource("macsbug.background",
1329 "MacsBug.Background",
1330 dpy, xgwa.colormap);
1333 gcv.foreground = get_pixel_resource("macX.textForeground",
1334 "MacX.TextForeground",
1335 dpy, xgwa.colormap);
1336 gcv.background = get_pixel_resource("macX.textBackground",
1337 "MacX.TextBackground",
1338 dpy, xgwa.colormap);
1339 gc = XCreateGC(dpy, window, GCForeground|GCBackground|GCFont, &gcv);
1341 #if defined(HAVE_GDK_PIXBUF) || defined (HAVE_XPM)
1345 int x, y, pix_w, pix_h;
1346 pixmap = xpm_data_to_pixmap (dpy, window, (char **) happy_mac,
1347 &pix_w, &pix_h, &mask);
1349 x = (xgwa.width - pix_w) / 2;
1350 y = (xgwa.height - pix_h) / 2;
1354 XSetClipMask (dpy, gc, mask);
1355 XSetClipOrigin (dpy, gc, x, y);
1356 XCopyArea (dpy, pixmap, window, gc, 0, 0, pix_w, pix_h, x, y);
1357 XSetClipMask (dpy, gc, None);
1358 XFreePixmap (dpy, pixmap);
1360 #endif /* HAVE_GDK_PIXBUF || HAVE_XPM */
1367 int char_width, line_height;
1368 char_width = (font->per_char
1369 ? font->per_char['n'-font->min_char_or_byte2].width
1370 : font->min_bounds.width);
1371 line_height = font->ascent + font->descent;
1379 if (*s == '\n' || x + char_width >= xgwa.width)
1387 /* Note that to get this goofy effect, they must be actually
1388 emitting LF CR at the end of each line instead of CR LF!
1390 XDrawImageString (dpy, window, gc, ox, oy, " ", 1);
1391 XDrawImageString (dpy, window, gc, ox, y, " ", 1);
1395 XDrawImageString (dpy, window, gc, x, y, s, 1);
1404 bsod_sleep(dpy, delay);
1405 XClearWindow(dpy, window);
1415 * by Martin Pool <mbp@samba.org>, Feb 2000.
1417 * This is meant to look like the preferred failure mode of NCD
1418 * Xterms. The parameters for choosing what to copy where might not
1419 * be quite right, but it looks about ugly enough.
1422 blitdamage (Display *dpy, Window window, int delay)
1425 XWindowAttributes xwa;
1428 int delta_x = 0, delta_y = 0;
1430 int chunk_h, chunk_w;
1436 if (!get_boolean_resource("doBlitDamage", "DoBlitDamage"))
1439 XGetWindowAttributes(dpy, window, &xwa);
1441 load_random_image (xwa.screen, window, window);
1446 gc_mask = GCForeground;
1448 gcv.plane_mask = random();
1449 gc_mask |= GCPlaneMask;
1451 gc0 = XCreateGC(dpy, window, gc_mask, &gcv);
1454 chunk_w = w / (random() % 1 + 1);
1455 chunk_h = h / (random() % 1 + 1);
1456 if (random() & 0x1000)
1457 delta_y = random() % 600;
1458 if (!delta_y || (random() & 0x2000))
1459 delta_x = random() % 600;
1465 for (i = 0; i < steps; i++) {
1466 if (x + chunk_w > w)
1471 if (y + chunk_h > h)
1476 XCopyArea(dpy, window, window, gc0,
1481 if (bsod_sleep(dpy, 0))
1485 bsod_sleep(dpy, delay);
1495 * SPARC Solaris panic. Should look pretty authentic on Solaris boxes.
1496 * Anton Solovyev <solovam@earthlink.net>
1505 int sub_width; /* Text subwindow width in pixels */
1506 int sub_height; /* Text subwindow height in pixels */
1507 int sub_x; /* upper left corner of the text subwindow */
1508 int sub_y; /* upper left corner of the text subwindow */
1509 int char_width; /* Char width in pixels */
1510 int line_height; /* Line height in pixels */
1511 int columns; /* Number of columns in the text screen */
1512 int x; /* horizontal position of the cursor */
1516 static scrolling_window *
1517 make_scrolling_window (Display *dpy, Window window,
1521 const char *def_font = "fixed";
1522 scrolling_window* ts;
1523 XWindowAttributes xgwa;
1526 char buf1[100], buf2[100];
1528 ts = malloc (sizeof (*ts));
1529 ts->window = window;
1534 XGetWindowAttributes (dpy, window, &xgwa);
1538 ts->sub_width = xgwa.width * 0.8;
1539 ts->sub_height = xgwa.height * 0.8;
1543 ts->sub_width = xgwa.width - 20;
1544 ts->sub_height = xgwa.height - 20;
1545 if (ts->sub_width < 20) ts->sub_width = 20;
1546 if (ts->sub_height < 20) ts->sub_height = 20;
1549 sprintf (buf1, "%.50s.font", name);
1550 sprintf (buf2, "%.50s.Font", name);
1551 fn = get_string_resource (buf1, buf2);
1552 ts->xfs = XLoadQueryFont (dpy, fn);
1555 sprintf (buf1, "%.50s.font2", name);
1556 fn = get_string_resource(buf1, buf2);
1557 ts->xfs = XLoadQueryFont(dpy, fn);
1560 ts->xfs = XLoadQueryFont(dpy, def_font);
1563 gcv.font = ts->xfs->fid;
1564 ts->char_width = (ts->xfs->per_char
1565 ? ts->xfs->per_char['n'-ts->xfs->min_char_or_byte2].width
1566 : ts->xfs->min_bounds.width);
1567 ts->line_height = ts->xfs->ascent + ts->xfs->descent + 1;
1569 ts->columns = ts->sub_width / ts->char_width;
1571 ts->sub_x = (xgwa.width - ts->sub_width) / 2;
1572 ts->sub_y = (xgwa.height - ts->sub_height) / 2;
1574 if (!grab_screen_p) ts->sub_height += ts->sub_y, ts->sub_y = 0;
1577 load_random_image (xgwa.screen, window, window);
1579 sprintf (buf1, "%.50s.background", name);
1580 sprintf (buf2, "%.50s.Background", name);
1581 gcv.background = get_pixel_resource (buf1, buf2, dpy, xgwa.colormap);
1583 sprintf (buf1, "%.50s.foreground", name);
1584 sprintf (buf2, "%.50s.Foreground", name);
1585 gcv.foreground = get_pixel_resource (buf1, buf2, dpy, xgwa.colormap);
1587 ts->gc = XCreateGC (dpy, window,
1588 GCForeground | GCBackground | GCFont,
1590 gcv.foreground = gcv.background;
1591 ts->erase_gc = XCreateGC (dpy, window,
1592 GCForeground | GCBackground,
1594 XSetWindowBackground (dpy, window, gcv.background);
1599 free_scrolling_window (scrolling_window* ts)
1601 XFreeGC (ts->dpy, ts->gc);
1602 XFreeGC (ts->dpy, ts->erase_gc);
1603 XFreeFont (ts->dpy, ts->xfs);
1608 scrolling_putc (scrolling_window* ts, const char aChar)
1614 XCopyArea (ts->dpy, ts->window, ts->window, ts->gc,
1615 ts->sub_x, ts->sub_y + ts->line_height,
1616 ts->sub_width, ts->sub_height,
1617 ts->sub_x, ts->sub_y);
1618 XFillRectangle (ts->dpy, ts->window, ts->erase_gc,
1619 ts->sub_x, ts->sub_y + ts->sub_height - ts->line_height,
1620 ts->sub_width, ts->line_height);
1627 if (ts->x >= ts->columns)
1628 scrolling_putc (ts, '\n');
1629 XDrawImageString (ts->dpy, ts->window, ts->gc,
1631 (ts->x * ts->char_width)
1632 - ts->xfs->min_bounds.lbearing),
1633 (ts->sub_y + ts->sub_height - ts->xfs->descent),
1641 scrolling_puts (scrolling_window *ts, const char* aString, int delay)
1644 for (c = aString; *c; ++c)
1646 scrolling_putc (ts, *c);
1651 if (bsod_sleep (ts->dpy, 0))
1660 sparc_solaris (Display* dpy, Window window, int delay)
1663 "BAD TRAP: cpu=0 type=0x31 rp=0x2a10043b5e0 addr=0xf3880 mmu_fsr=0x0\n"
1664 "BAD TRAP occured in module \"unix\" due to an illegal access to a"
1666 "adb: trap type = 0x31\n"
1668 "pid=307, pc=0x100306e4, sp=0x2a10043ae81, tstate=0x4480001602,"
1670 "g1-g7: 1045b000, 32f, 10079440, 180, 300000ebde8, 0, 30000953a20\n"
1671 "Begin traceback... sp = 2a10043ae81\n"
1672 "Called from 100bd060, fp=2a10043af31, args=f3700 300008cc988 f3880 0"
1674 "Called from 101fe1bc, fp=2a10043b011, args=3000045a240 104465a0"
1675 " 300008e47d0 300008e48fa 300008ae350 300008ae410\n"
1676 "Called from 1007c520, fp=2a10043b0c1, args=300008e4878 300003596e8 0"
1677 " 3000045a320 0 3000045a220\n"
1678 "Called from 1007c498, fp=2a10043b171, args=1045a000 300007847f0 20"
1679 " 3000045a240 1 0\n"
1680 "Called from 1007972c, fp=2a10043b221, args=1 300009517c0 30000951e58 1"
1682 "Called from 10031e10, fp=2a10043b2d1, args=3000095b0c8 0 300009396a8"
1683 " 30000953a20 0 1\n"
1684 "Called from 10000bdd8, fp=ffffffff7ffff1c1, args=0 57 100131480"
1685 " 100131480 10012a6e0 0\n"
1686 "End traceback...\n"
1687 "panic[cpu0]/thread=30000953a20: trap\n"
1688 "syncing file systems...";
1691 "dumping to /dev/dsk/c0t0d0s3, offset 26935296\n";
1693 ": 2803 pages dumped, compression ratio 2.88, dump succeeded\n";
1698 scrolling_window *ts;
1702 if (!get_boolean_resource("doSolaris", "DoSolaris"))
1705 ts = make_scrolling_window (dpy, window, "Solaris", True);
1707 scrolling_puts (ts, msg1, 0);
1708 if (bsod_sleep (dpy, 3))
1711 scrolling_puts (ts, msg2, 0);
1712 if (bsod_sleep (dpy, 2))
1715 for (i = 1; i <= 100; ++i)
1717 sprintf(buf, "\b\b\b\b\b\b\b\b\b\b\b%3d%% done", i);
1718 scrolling_puts (ts, buf, 0);
1719 if (bsod_sleep (dpy, -1))
1723 scrolling_puts (ts, msg3, 0);
1724 if (bsod_sleep (dpy, 2))
1727 scrolling_puts (ts, msg4, 0);
1728 if (bsod_sleep(dpy, 3))
1731 bsod_sleep (dpy, 3);
1734 free_scrolling_window (ts);
1739 /* Linux panic and fsck, by jwz
1742 linux_fsck (Display *dpy, Window window, int delay)
1744 XWindowAttributes xgwa;
1745 scrolling_window *ts;
1747 const char *sysname;
1750 const char *linux_panic[] = {
1751 " kernel: Unable to handle kernel paging request at virtual "
1752 "address 0000f0ad\n",
1753 " kernel: printing eip:\n",
1754 " kernel: c01becd7\n",
1755 " kernel: *pde = 00000000\n",
1756 " kernel: Oops: 0000\n",
1757 " kernel: CPU: 0\n",
1758 " kernel: EIP: 0010:[<c01becd7>] Tainted: P \n",
1759 " kernel: EFLAGS: 00010286\n",
1760 " kernel: eax: 0000ff00 ebx: ca6b7e00 ecx: ce1d7a60 edx: ce1d7a60\n",
1761 " kernel: esi: ca6b7ebc edi: 00030000 ebp: d3655ca0 esp: ca6b7e5c\n",
1762 " kernel: ds: 0018 es: 0018 ss: 0018\n",
1763 " kernel: Process crond (pid: 1189, stackpage=ca6b7000)\n",
1764 " kernel: Stack: d3655ca0 ca6b7ebc 00030054 ca6b7e7c c01c1e5b "
1765 "00000287 00000020 c01c1fbf \n",
1767 " kernel: 00005a36 000000dc 000001f4 00000000 00000000 "
1768 "ce046d40 00000001 00000000 \n",
1770 " kernel: ffffffff d3655ca0 d3655b80 00030054 c01bef93 "
1771 "d3655ca0 ca6b7ebc 00030054 \n",
1773 " kernel: Call Trace: [<c01c1e5b>] [<c01c1fbf>] [<c01bef93>] "
1774 "[<c01bf02b>] [<c0134c4f>]\n",
1776 " kernel: [<c0142562>] [<c0114f8c>] [<c0134de3>] [<c010891b>]\n",
1778 " kernel: Code: 2a 00 75 08 8b 44 24 2c 85 c0 74 0c 8b 44 24 58 83 48 18 "
1783 if (!get_boolean_resource("doLinux", "DoLinux"))
1786 XGetWindowAttributes (dpy, window, &xgwa);
1787 XSetWindowBackground (dpy, window,
1788 get_pixel_resource("Linux.background",
1790 dpy, xgwa.colormap));
1791 XClearWindow(dpy, window);
1798 if (uname (&uts) >= 0)
1799 sysname = uts.nodename;
1800 s = strchr (sysname, '.');
1803 # endif /* !HAVE_UNAME */
1806 ts = make_scrolling_window (dpy, window, "Linux", False);
1808 scrolling_puts (ts, "waiting for X server to shut down ", 0);
1810 if (bsod_sleep (dpy, 0))
1813 "XIO: fatal IO error 2 (broken pipe) on X server \":0.0\"\n"
1814 " after 339471 requests (339471 known processed) "
1815 "with 0 events remaining\n",
1817 if (scrolling_puts (ts, ".........\n", 300000))
1819 if (bsod_sleep (dpy, 0))
1822 "xinit: X server slow to shut down, sending KILL signal.\n",
1824 scrolling_puts (ts, "waiting for server to die ", 0);
1825 if (scrolling_puts (ts, "...\n", 300000))
1827 if (bsod_sleep (dpy, 0))
1829 scrolling_puts (ts, "xinit: Can't kill server\n", 0);
1831 if (bsod_sleep (dpy, 2))
1834 sprintf (buf, "\n%s Login: ", sysname);
1835 scrolling_puts (ts, buf, 0);
1836 if (bsod_sleep (dpy, 1))
1840 "Parallelizing fsck version 1.22 (22-Jun-2001)\n"
1841 "e2fsck 1.22, 22-Jun-2001 for EXT2 FS 0.5b, 95/08/09\n"
1842 "Warning! /dev/hda1 is mounted.\n"
1843 "/dev/hda1 contains a file system with errors, check forced.\n",
1845 if (bsod_sleep (dpy, 1))
1848 if (0 == random() % 2)
1850 "Couldn't find ext2 superblock, trying backup blocks...\n"
1851 "The filesystem size (according to the superblock) is 3644739 blocks\n"
1852 "The physical size of the device is 3636706 blocks\n"
1853 "Either the superblock or the partition table is likely to be corrupt!\n"
1856 if (bsod_sleep (dpy, 1))
1861 scrolling_puts (ts, "Pass 1: Checking inodes, blocks, and sizes\n", 0);
1862 if (bsod_sleep (dpy, 2))
1865 i = (random() % 60) - 20;
1868 int b = random() % 0xFFFF;
1869 sprintf (buf, "Deleted inode %d has zero dtime. Fix<y>? yes\n\n", b);
1870 scrolling_puts (ts, buf, 0);
1873 i = (random() % 40) - 10;
1876 int g = random() % 0xFFFF;
1877 int b = random() % 0xFFFFFFF;
1879 if (bsod_sleep (dpy, 1))
1882 sprintf (buf, "Warning: Group %d's copy of the group descriptors "
1883 "has a bad block (%d).\n", g, b);
1884 scrolling_puts (ts, buf, 0);
1886 b = random() % 0x3FFFFF;
1889 b += random() % 0xFFFF;
1891 "Error reading block %d (Attempt to read block "
1892 "from filesystem resulted in short read) while doing "
1893 "inode scan. Ignore error<y>?",
1895 scrolling_puts (ts, buf, 0);
1897 scrolling_puts (ts, " yes\n\n", 0);
1901 if (0 == (random() % 10))
1904 if (bsod_sleep (dpy, 1))
1907 i = 3 + (random() % 10);
1909 scrolling_puts (ts, "Could not allocate 256 block(s) for inode table: "
1910 "No space left on device\n", 0);
1911 scrolling_puts (ts, "Restarting e2fsck from the beginning...\n", 0);
1913 if (bsod_sleep (dpy, 2))
1919 i = (random() % 20) - 5;
1922 if (bsod_sleep (dpy, 1))
1927 int j = 5 + (random() % 10);
1928 int w = random() % 4;
1932 int b = random() % 0xFFFFF;
1933 int g = random() % 0xFFF;
1935 if (0 == (random() % 10))
1937 else if (0 == (random() % 10))
1942 "Inode table for group %d not in group. (block %d)\n"
1943 "WARNING: SEVERE DATA LOSS POSSIBLE.\n"
1948 "Block bitmap for group %d not in group. (block %d)\n"
1953 "Inode bitmap %d for group %d not in group.\n"
1956 else /* if (w == 3) */
1958 "Bad block %d in group %d's inode table.\n"
1959 "WARNING: SEVERE DATA LOSS POSSIBLE.\n"
1963 scrolling_puts (ts, buf, 0);
1964 scrolling_puts (ts, " yes\n\n", 0);
1966 if (bsod_sleep (dpy, 0))
1972 if (0 == random() % 10) goto PANIC;
1973 scrolling_puts (ts, "Pass 2: Checking directory structure\n", 0);
1974 if (bsod_sleep (dpy, 2))
1977 i = (random() % 20) - 5;
1980 int n = random() % 0xFFFFF;
1981 int o = random() % 0xFFF;
1982 sprintf (buf, "Directory inode %d, block 0, offset %d: "
1983 "directory corrupted\n"
1986 scrolling_puts (ts, buf, 0);
1988 scrolling_puts (ts, " yes\n\n", 0);
1990 if (0 == (random() % 100))
1992 sprintf (buf, "Missing '.' in directory inode %d.\nFix<y>?", n);
1993 scrolling_puts (ts, buf, 0);
1995 scrolling_puts (ts, " yes\n\n", 0);
1998 if (bsod_sleep (dpy, 0))
2002 if (0 == random() % 10) goto PANIC;
2004 "Pass 3: Checking directory connectivity\n"
2005 "/lost+found not found. Create? yes\n",
2007 if (bsod_sleep (dpy, 2))
2010 /* Unconnected directory inode 4949 (/var/spool/squid/06/???)
2011 Connect to /lost+found<y>? yes
2013 '..' in /var/spool/squid/06/08 (20351) is <The NULL inode> (0), should be
2014 /var/spool/squid/06 (20350).
2017 Unconnected directory inode 128337 (/var/spool/squid/06/???)
2018 Connect to /lost+found<y>? yes
2022 if (0 == random() % 10) goto PANIC;
2023 scrolling_puts (ts, "Pass 4: Checking reference counts\n", 0);
2024 if (bsod_sleep (dpy, 2))
2027 /* Inode 2 ref count is 19, should be 20. Fix<y>? yes
2029 Inode 4949 ref count is 3, should be 2. Fix<y>? yes
2033 Inode 128336 ref count is 3, should be 2. Fix<y>? yes
2035 Inode 128337 ref count is 3, should be 2. Fix<y>? yes
2040 if (0 == random() % 10) goto PANIC;
2041 scrolling_puts (ts, "Pass 5: Checking group summary information\n", 0);
2042 if (bsod_sleep (dpy, 2))
2045 i = (random() % 200) - 50;
2048 scrolling_puts (ts, "Block bitmap differences: ", 0);
2051 sprintf (buf, " %d", -(random() % 0xFFF));
2052 scrolling_puts (ts, buf, 0);
2055 scrolling_puts (ts, "\nFix? yes\n\n", 0);
2059 i = (random() % 100) - 50;
2062 scrolling_puts (ts, "Inode bitmap differences: ", 0);
2065 sprintf (buf, " %d", -(random() % 0xFFF));
2066 scrolling_puts (ts, buf, 0);
2069 scrolling_puts (ts, "\nFix? yes\n\n", 0);
2072 i = (random() % 20) - 5;
2075 int g = random() % 0xFFFF;
2076 int c = random() % 0xFFFF;
2078 "Free blocks count wrong for group #0 (%d, counted=%d).\nFix? ",
2080 scrolling_puts (ts, buf, 0);
2082 scrolling_puts (ts, " yes\n\n", 0);
2083 if (bsod_sleep (dpy, 0))
2090 scrolling_puts (ts, "\n\n", 0);
2091 while (linux_panic[i])
2093 time_t t = time ((time_t *) 0);
2094 struct tm *tm = localtime (&t);
2097 if (*linux_panic[i])
2099 strftime (prefix, sizeof(prefix)-1, "%b %d %k:%M:%S ", tm);
2100 scrolling_puts (ts, prefix, 0);
2101 scrolling_puts (ts, sysname, 0);
2102 scrolling_puts (ts, linux_panic[i], 0);
2109 if (bsod_sleep (dpy, 0))
2114 if (bsod_sleep (dpy, 4))
2119 bsod_sleep(dpy, delay);
2122 free_scrolling_window (ts);
2123 XClearWindow(dpy, window);
2129 char *progclass = "BSOD";
2131 char *defaults [] = {
2143 "*doAtari: False", /* boring */
2144 "*doBSD: False", /* boring */
2146 "*doSparcLinux: False", /* boring */
2147 "*doBlitDamage: True",
2150 ".Windows.font: -*-courier-bold-r-*-*-*-120-*-*-m-*-*-*",
2151 ".Windows.font2: -*-courier-bold-r-*-*-*-180-*-*-m-*-*-*",
2152 ".Windows.foreground: White",
2153 ".Windows.background: #0000AA", /* EGA color 0x01. */
2155 ".Amiga.font: -*-courier-bold-r-*-*-*-120-*-*-m-*-*-*",
2156 ".Amiga.font2: -*-courier-bold-r-*-*-*-180-*-*-m-*-*-*",
2157 ".Amiga.foreground: Red",
2158 ".Amiga.background: Black",
2159 ".Amiga.background2: White",
2161 ".Mac.font: -*-courier-bold-r-*-*-*-120-*-*-m-*-*-*",
2162 ".Mac.foreground: PaleTurquoise1",
2163 ".Mac.background: Black",
2165 ".Atari.foreground: Black",
2166 ".Atari.background: White",
2168 ".MacsBug.font: -*-courier-medium-r-*-*-*-100-*-*-m-*-*-*",
2169 ".MacsBug.font2: -*-courier-bold-r-*-*-*-120-*-*-m-*-*-*",
2170 ".MacsBug.font3: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*",
2171 ".MacsBug.foreground: Black",
2172 ".MacsBug.background: White",
2173 ".MacsBug.borderColor: #AAAAAA",
2175 ".mac1.foreground: Black",
2176 ".mac1.background: White",
2178 ".macX.textForeground: White",
2179 ".macX.textBackground: Black",
2180 ".macX.background: #888888",
2181 ".macX.font: -*-courier-bold-r-*-*-*-120-*-*-m-*-*-*",
2182 ".macX.font2: -*-courier-bold-r-*-*-*-240-*-*-m-*-*-*",
2184 ".SCO.font: -*-courier-bold-r-*-*-*-120-*-*-m-*-*-*",
2185 ".SCO.font2: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*",
2186 ".SCO.foreground: White",
2187 ".SCO.background: Black",
2189 ".Linux.font: 9x15bold",
2190 ".Linux.font2: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*",
2191 ".Linux.foreground: White",
2192 ".Linux.background: Black",
2194 ".SparcLinux.font: -*-courier-bold-r-*-*-*-120-*-*-m-*-*-*",
2195 ".SparcLinux.font2: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*",
2196 ".SparcLinux.foreground: White",
2197 ".SparcLinux.background: Black",
2200 ".BSD.font: -*-courier-bold-r-*-*-*-120-*-*-m-*-*-*",
2201 ".BSD.font2: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*",
2202 /* ".BSD.font2: -sun-console-medium-r-*-*-22-*-*-*-m-*-*-*", */
2203 ".BSD.foreground: #c0c0c0",
2204 ".BSD.background: Black",
2206 ".Solaris.font: -sun-gallant-*-*-*-*-19-*-*-*-*-120-*-*",
2207 ".Solaris.font2: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*",
2208 ".Solaris.foreground: Black",
2209 ".Solaris.background: White",
2210 "*dontClearRoot: True",
2214 XrmOptionDescRec options [] = {
2215 { "-delay", ".delay", XrmoptionSepArg, 0 },
2216 { "-windows", ".doWindows", XrmoptionNoArg, "True" },
2217 { "-no-windows", ".doWindows", XrmoptionNoArg, "False" },
2218 { "-nt", ".doNT", XrmoptionNoArg, "True" },
2219 { "-no-nt", ".doNT", XrmoptionNoArg, "False" },
2220 { "-2k", ".doWin2K", XrmoptionNoArg, "True" },
2221 { "-no-2k", ".doWin2K", XrmoptionNoArg, "False" },
2222 { "-amiga", ".doAmiga", XrmoptionNoArg, "True" },
2223 { "-no-amiga", ".doAmiga", XrmoptionNoArg, "False" },
2224 { "-mac", ".doMac", XrmoptionNoArg, "True" },
2225 { "-no-mac", ".doMac", XrmoptionNoArg, "False" },
2226 { "-mac1", ".doMac1", XrmoptionNoArg, "True" },
2227 { "-no-mac1", ".doMac1", XrmoptionNoArg, "False" },
2228 { "-no-macx", ".doMacX", XrmoptionNoArg, "False" },
2229 { "-atari", ".doAtari", XrmoptionNoArg, "True" },
2230 { "-no-atari", ".doAtari", XrmoptionNoArg, "False" },
2231 { "-macsbug", ".doMacsBug", XrmoptionNoArg, "True" },
2232 { "-no-macsbug", ".doMacsBug", XrmoptionNoArg, "False" },
2233 { "-sco", ".doSCO", XrmoptionNoArg, "True" },
2234 { "-no-sco", ".doSCO", XrmoptionNoArg, "False" },
2235 { "-bsd", ".doBSD", XrmoptionNoArg, "True" },
2236 { "-no-bsd", ".doBSD", XrmoptionNoArg, "False" },
2237 { "-linux", ".doLinux", XrmoptionNoArg, "True" },
2238 { "-no-linux", ".doLinux", XrmoptionNoArg, "False" },
2239 { "-sparclinux", ".doSparcLinux", XrmoptionNoArg, "True" },
2240 { "-no-sparclinux", ".doSparcLinux", XrmoptionNoArg, "False" },
2241 { "-blitdamage", ".doBlitDamage", XrmoptionNoArg, "True" },
2242 { "-no-blitdamage", ".doBlitDamage", XrmoptionNoArg, "False" },
2243 { "-solaris", ".doSolaris", XrmoptionNoArg, "True" },
2244 { "-no-solaris", ".doSolaris", XrmoptionNoArg, "False" },
2250 screenhack (Display *dpy, Window window)
2255 int delay = get_integer_resource ("delay", "Integer");
2256 if (delay < 3) delay = 3;
2258 if (!get_boolean_resource ("root", "Boolean"))
2260 XWindowAttributes xgwa;
2261 XGetWindowAttributes (dpy, window, &xgwa);
2262 XSelectInput (dpy, window,
2263 xgwa.your_event_mask | KeyPressMask | ButtonPressMask);
2269 do { i = (random() & 0xFF) % 15; } while (i == j);
2272 case 0: did = windows(dpy, window, delay, 0); break;
2273 case 1: did = windows(dpy, window, delay, 1); break;
2274 case 2: did = windows(dpy, window, delay, 2); break;
2275 case 3: did = amiga(dpy, window, delay); break;
2276 case 4: did = mac(dpy, window, delay); break;
2277 case 5: did = macsbug(dpy, window, delay); break;
2278 case 6: did = mac1(dpy, window, delay); break;
2279 case 7: did = macx(dpy, window, delay); break;
2280 case 8: did = sco(dpy, window, delay); break;
2281 case 9: did = sparc_linux(dpy, window, delay); break;
2282 case 10: did = bsd(dpy, window, delay); break;
2283 case 11: did = atari(dpy, window, delay); break;
2284 case 12: did = blitdamage(dpy, window, delay); break;
2285 case 13: did = sparc_solaris(dpy, window, delay); break;
2286 case 14: did = linux_fsck(dpy, window, delay); break;
2287 default: abort(); break;
2290 if (loop > 100) j = -1;
2293 fprintf (stderr, "%s: no display modes enabled?\n", progname);