1 /* xscreensaver, Copyright (c) 1998-2005 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.
17 #include "screenhack.h"
18 #include "xpm-pixmap.h"
24 #include <X11/Xutil.h>
26 #ifdef HAVE_XSHM_EXTENSION
31 # include <sys/utsname.h>
32 #endif /* HAVE_UNAME */
34 #include "images/amiga.xpm"
35 #include "images/atari.xbm"
36 #include "images/mac.xbm"
37 #include "images/macbomb.xbm"
38 #include "images/hmac.xpm"
41 #define countof(x) (sizeof((x))/sizeof((*x)))
44 draw_string (Display *dpy, Window window, GC gc, XGCValues *gcv,
47 int win_width, int win_height,
48 const char *string, int delay)
51 int width = 0, height = 0, cw = 0;
52 int char_width, line_height;
54 const char *s = string;
55 const char *se = string;
57 /* This pretty much assumes fixed-width fonts */
58 char_width = (font->per_char
59 ? font->per_char['n'-font->min_char_or_byte2].width
60 : font->min_bounds.width);
61 line_height = font->ascent + font->descent + 1;
65 if (*s == '\n' || !*s)
68 if (cw > width) width = cw;
77 x = (win_width - (width * char_width)) / 2;
78 y = (win_height - (height * line_height)) / 2;
89 if (*s == '\n' || !*s)
94 if (*se == '@' || *se == '_')
96 if (*se == '@') flip = True;
98 off = (char_width * (width - (s - se))) / 2;
103 XSetForeground(dpy, gc, gcv->background);
104 XSetBackground(dpy, gc, gcv->foreground);
108 XDrawImageString(dpy, window, gc, x+off, y+font->ascent, se, s-se);
112 XSetForeground(dpy, gc, gcv->foreground);
113 XSetBackground(dpy, gc, gcv->background);
130 return width * char_width;
135 double_pixmap(Display *dpy, GC gc, Visual *visual, int depth, Pixmap pixmap,
136 int pix_w, int pix_h)
139 Pixmap p2 = XCreatePixmap(dpy, pixmap, pix_w*2, pix_h*2, depth);
140 XImage *i1 = XGetImage(dpy, pixmap, 0, 0, pix_w, pix_h, ~0L, ZPixmap);
141 XImage *i2 = XCreateImage(dpy, visual, depth, ZPixmap, 0, 0,
142 pix_w*2, pix_h*2, 8, 0);
143 i2->data = (char *) calloc(i2->height, i2->bytes_per_line);
144 for (y = 0; y < pix_h; y++)
145 for (x = 0; x < pix_w; x++)
147 unsigned long p = XGetPixel(i1, x, y);
148 XPutPixel(i2, x*2, y*2, p);
149 XPutPixel(i2, x*2+1, y*2, p);
150 XPutPixel(i2, x*2, y*2+1, p);
151 XPutPixel(i2, x*2+1, y*2+1, p);
153 free(i1->data); i1->data = 0;
155 XPutImage(dpy, p2, gc, i2, 0, 0, 0, 0, i2->width, i2->height);
156 free(i2->data); i2->data = 0;
158 XFreePixmap(dpy, pixmap);
163 /* Sleep for N seconds and return False. But if a key or mouse event is
164 seen, discard all pending key or mouse events, and return True.
167 bsod_sleep(Display *dpy, int seconds)
170 int quantum = 250000;
173 q = 1, quantum = 100000;
178 while (XPending (dpy))
181 XNextEvent (dpy, &event);
182 if (event.xany.type == ButtonPress)
184 if (event.xany.type == KeyPress)
188 XLookupString (&event.xkey, &c, 1, &keysym, 0);
189 if (c == ' ' || c == '\t' || c == '\r' || c == '\n')
192 screenhack_handle_event (dpy, &event);
208 windows (Display *dpy, Window window, int delay, int which)
211 XWindowAttributes xgwa;
213 const char *def_font = "fixed";
219 "A fatal exception 0E has occured at F0AD:42494C4C\n"
220 "the current application will be terminated.\n"
222 "* Press any key to terminate the current application.\n"
223 "* Press CTRL+ALT+DELETE again to restart your computer.\n"
224 " You will lose any unsaved information in all applications.\n"
227 "_Press any key to continue");
230 __extension__ /* don't warn about "string length is greater than the
231 length ISO C89 compilers are required to support"
232 in the following string constant... */
235 const char *wnt = /* from Jim Niemira <urmane@urmane.org> */
236 ("*** STOP: 0x0000001E (0x80000003,0x80106fc0,0x8025ea21,0xfd6829e8)\n"
237 "Unhandled Kernel exception c0000047 from fa8418b4 (8025ea21,fd6829e8)\n"
239 "Dll Base Date Stamp - Name Dll Base Date Stamp - Name\n"
240 "80100000 2be154c9 - ntoskrnl.exe 80400000 2bc153b0 - hal.dll\n"
241 "80258000 2bd49628 - ncrc710.sys 8025c000 2bd49688 - SCSIPORT.SYS \n"
242 "80267000 2bd49683 - scsidisk.sys 802a6000 2bd496b9 - Fastfat.sys\n"
243 "fa800000 2bd49666 - Floppy.SYS fa810000 2bd496db - Hpfs_Rec.SYS\n"
244 "fa820000 2bd49676 - Null.SYS fa830000 2bd4965a - Beep.SYS\n"
245 "fa840000 2bdaab00 - i8042prt.SYS fa850000 2bd5a020 - SERMOUSE.SYS\n"
246 "fa860000 2bd4966f - kbdclass.SYS fa870000 2bd49671 - MOUCLASS.SYS\n"
247 "fa880000 2bd9c0be - Videoprt.SYS fa890000 2bd49638 - NCC1701E.SYS\n"
248 "fa8a0000 2bd4a4ce - Vga.SYS fa8b0000 2bd496d0 - Msfs.SYS\n"
249 "fa8c0000 2bd496c3 - Npfs.SYS fa8e0000 2bd496c9 - Ntfs.SYS\n"
250 "fa940000 2bd496df - NDIS.SYS fa930000 2bd49707 - wdlan.sys\n"
251 "fa970000 2bd49712 - TDI.SYS fa950000 2bd5a7fb - nbf.sys\n"
252 "fa980000 2bd72406 - streams.sys fa9b0000 2bd4975f - ubnb.sys\n"
253 "fa9c0000 2bd5bfd7 - usbser.sys fa9d0000 2bd4971d - netbios.sys\n"
254 "fa9e0000 2bd49678 - Parallel.sys fa9f0000 2bd4969f - serial.SYS\n"
255 "faa00000 2bd49739 - mup.sys faa40000 2bd4971f - SMBTRSUP.SYS\n"
256 "faa10000 2bd6f2a2 - srv.sys faa50000 2bd4971a - afd.sys\n"
257 "faa60000 2bd6fd80 - rdr.sys faaa0000 2bd49735 - bowser.sys\n"
259 "Address dword dump Dll Base - Name\n"
260 "801afc20 80106fc0 80106fc0 00000000 00000000 80149905 : "
261 "fa840000 - i8042prt.SYS\n"
262 "801afc24 80149905 80149905 ff8e6b8c 80129c2c ff8e6b94 : "
263 "8025c000 - SCSIPORT.SYS\n"
264 "801afc2c 80129c2c 80129c2c ff8e6b94 00000000 ff8e6b94 : "
265 "80100000 - ntoskrnl.exe\n"
266 "801afc34 801240f2 80124f02 ff8e6df4 ff8e6f60 ff8e6c58 : "
267 "80100000 - ntoskrnl.exe\n"
268 "801afc54 80124f16 80124f16 ff8e6f60 ff8e6c3c 8015ac7e : "
269 "80100000 - ntoskrnl.exe\n"
270 "801afc64 8015ac7e 8015ac7e ff8e6df4 ff8e6f60 ff8e6c58 : "
271 "80100000 - ntoskrnl.exe\n"
272 "801afc70 80129bda 80129bda 00000000 80088000 80106fc0 : "
273 "80100000 - ntoskrnl.exe\n"
275 "Kernel Debugger Using: COM2 (Port 0x2f8, Baud Rate 19200)\n"
276 "Restart and set the recovery options in the system control panel\n"
277 "or the /CRASHDEBUG system start option. If this message reappears,\n"
278 "contact your system administrator or technical support group."
282 ("*** STOP: 0x000000D1 (0xE1D38000,0x0000001C,0x00000000,0xF09D42DA)\n"
283 "DRIVER_IRQL_NOT_LESS_OR_EQUAL \n"
285 "*** Address F09D42DA base at F09D4000, DateStamp 39f459ff - CRASHDD.SYS\n"
287 "Beginning dump of physical memory\n");
289 ("Physical memory dump complete. Contact your system administrator or\n"
290 "technical support group.\n");
293 (" Windows protection error. You need to restart your computer.");
298 __extension__ /* don't warn about "string length is greater than the
299 length ISO C89 compilers are required to support"
300 in the following string constant... */
303 const char *wxpa = /* From Wm. Rhodes <xscreensaver@27.org> */
304 ("A problem has been detected and windows has been shut down to prevent "
306 "to your computer.\n"
308 "If this is the first time you've seen this Stop error screen,\n"
309 "restart your computer. If this screen appears again, follow\n"
312 "Check to be sure you have adequate disk space. If a driver is\n"
313 "identified in the Stop message, disable the driver or check\n"
314 "with the manufacturer for driver updates. Try changing video\n"
317 "Check with your hardware vendor for any BIOS updates. Disable\n"
318 "BIOS memory options such as caching or shadowing. If you need\n"
319 "to use Safe Mode to remove or disable components, restart your\n"
320 "computer, press F8 to select Advanced Startup Options, and then\n"
321 "select Safe Mode.\n"
323 "Technical information:\n"
325 "*** STOP: 0x0000007E (0xC0000005,0xF88FF190,0x0xF8975BA0,0xF89758A0)\n"
328 "*** EPUSBDSK.sys - Address F88FF190 base at FF88FE000, datestamp "
331 "Beginning dump of physical memory\n");
333 ("Physical memory dump complete.\n"
334 "Contact your system administrator or technical support group for "
339 /* The "RSOD" that appeared with "Windows Longhorn 5048.050401-0536_x86fre"
340 As reported by http://joi.ito.com/RedScreen.jpg
343 ("_Windows Boot Error\n");
346 "Windows Boot Manager has experienced a problem.\n"
349 " Status: 0xc000000f\n"
353 " Info: An error occurred transferring exectuion." /* (sic) */
357 "You can try to recover the system with the Microsoft Windows "
359 "Tools. (You might need to restart the system manually.)\n"
361 "If the problem continues, please contact your system administrator "
369 if (which < 0 || which > 2) abort();
371 /* kludge to lump Win2K, WinME, and WinXP together; seems silly to add
372 another preference/command line option just for these little ones. */
373 if (which == 2 && (random() % 2))
374 which = 3 + (random() % 3);
376 XGetWindowAttributes (dpy, window, &xgwa);
378 fontname = get_string_resource ((xgwa.height > 600
379 ? (which == 0 ? "windows95.font2" :
380 which == 1 ? "windowsNT.font2" :
381 which == 2 ? "windows2K.font2" :
383 : (which == 0 ? "windows95.font" :
384 which == 1 ? "windowsNT.font" :
385 which == 2 ? "windows2K.font" :
388 if (!fontname || !*fontname) fontname = (char *)def_font;
389 font = XLoadQueryFont (dpy, fontname);
390 if (!font) font = XLoadQueryFont (dpy, def_font);
392 if (fontname && fontname != def_font)
395 gcv.font = font->fid;
396 gcv.foreground = get_pixel_resource((which == 0 ? "windows95.foreground" :
397 which == 1 ? "windowsNT.foreground" :
398 which == 2 ? "windows2K.foreground" :
399 which == 5 ? "windowsLH.foreground" :
400 "windowsME.foreground"),
401 "Windows.Foreground",
403 gcv.background = get_pixel_resource((which == 0 ? "windows95.background" :
404 which == 1 ? "windowsNT.background" :
405 which == 2 ? "windows2K.background" :
406 which == 5 ? "windowsLH.background" :
407 "windowsME.background"),
408 "Windows.Background",
410 XSetWindowBackground(dpy, window, gcv.background);
411 XClearWindow(dpy, window);
413 gc = XCreateGC(dpy, window, GCFont|GCForeground|GCBackground, &gcv);
416 draw_string(dpy, window, gc, &gcv, font,
417 0, 0, xgwa.width, xgwa.height, w95, 0);
419 draw_string(dpy, window, gc, &gcv, font, 0, 0, 10, 10, wnt, 750);
422 int line_height = font->ascent + font->descent + 1;
424 int y = (xgwa.height / 4);
426 draw_string(dpy, window, gc, &gcv, font, x, y, 10, 10, w2ka, 750);
427 y += line_height * 6;
429 draw_string(dpy, window, gc, &gcv, font, x, y, 10, 10, w2kb, 750);
433 int line_height = font->ascent + font->descent + 1;
436 draw_string(dpy, window, gc, &gcv, font, x, y, 10, 10, wxpa, 750);
437 y += line_height * 26;
439 draw_string(dpy, window, gc, &gcv, font, x, y, 10, 10, wxpb, 750);
443 int line_height = font->ascent + font->descent;
445 int y = (xgwa.height - line_height * 3) / 2;
446 draw_string (dpy, window, gc, &gcv, font, x, y, 10, 10, wmea, 0);
447 y += line_height * 2;
448 x = draw_string (dpy, window, gc, &gcv, font, x, y, 10, 10, wmeb, 0);
452 XDrawImageString (dpy, window, gc, x, y, "_", 1);
455 XDrawImageString (dpy, window, gc, x, y, " ", 1);
458 if (bsod_sleep(dpy, 0))
466 int line_height = font->ascent + font->descent;
469 unsigned long p0 = gcv.background;
470 unsigned long p1 = gcv.foreground;
471 unsigned long p2 = get_pixel_resource("windowsLH.background2",
472 "Windows.Background",
474 XSetBackground (dpy, gc, p2);
475 XSetForeground (dpy, gc, p2);
476 XFillRectangle (dpy, window, gc, 0, 0, xgwa.width, line_height+2);
477 XSetForeground (dpy, gc, p0);
478 draw_string (dpy, window, gc, &gcv, font, x, y, xgwa.width, 10, wlha, 0);
480 XSetForeground (dpy, gc, p1);
481 XSetBackground (dpy, gc, p0);
482 draw_string (dpy, window, gc, &gcv, font, x, y, 10, 10, wlhb, 0);
484 y = xgwa.height - (line_height+2);
485 XSetBackground (dpy, gc, p2);
486 XSetForeground (dpy, gc, p2);
487 XFillRectangle (dpy, window, gc, 0, y, xgwa.width, line_height+2);
488 XSetForeground (dpy, gc, p0);
489 draw_string (dpy, window, gc, &gcv, font, x, y, 10, 10, wlhc, 0);
496 bsod_sleep(dpy, delay);
497 XClearWindow(dpy, window);
498 XFreeFont(dpy, font);
502 windows_31 (Display *dpy, Window window, int delay)
504 windows (dpy, window, delay, 0);
508 windows_nt (Display *dpy, Window window, int delay)
510 windows (dpy, window, delay, 1);
514 windows_2k (Display *dpy, Window window, int delay)
516 windows (dpy, window, delay, 2);
520 /* SCO OpenServer 5 panic, by Tom Kelly <tom@ancilla.toronto.on.ca>
523 sco (Display *dpy, Window window, int delay)
526 XWindowAttributes xgwa;
528 const char *def_font = "fixed";
531 int lines_1 = 0, lines_2 = 0, lines_3 = 0, lines_4 = 0;
535 __extension__ /* don't warn about "string length is greater than the
536 length ISO C89 compilers are required to support"
537 in the following string constant... */
540 const char *sco_panic_1 =
541 ("Unexpected trap in kernel mode:\n"
543 "cr0 0x80010013 cr2 0x00000014 cr3 0x00000000 tlb 0x00000000\n"
544 "ss 0x00071054 uesp 0x00012055 efl 0x00080888 ipl 0x00000005\n"
545 "cs 0x00092585 eip 0x00544a4b err 0x004d4a47 trap 0x0000000E\n"
546 "eax 0x0045474b ecx 0x0042544b edx 0x57687920 ebx 0x61726520\n"
547 "esp 0x796f7520 ebp 0x72656164 esi 0x696e6720 edi 0x74686973\n"
548 "ds 0x3f000000 es 0x43494c48 fs 0x43525343 gs 0x4f4d4b53\n"
550 "PANIC: k_trap - kernel mode trap type 0x0000000E\n"
551 "Trying to dump 5023 pages to dumpdev hd (1/41), 63 pages per '.'\n"
553 const char *sco_panic_2 =
554 ("................................................................."
557 const char *sco_panic_3 =
558 ("5023 pages dumped\n"
562 const char *sco_panic_4 =
563 ("** Safe to Power Off **\n"
565 "** Press Any Key to Reboot **\n"
568 for (s = sco_panic_1; *s; s++) if (*s == '\n') lines_1++;
569 for (s = sco_panic_2; *s; s++) if (*s == '\n') lines_2++;
570 for (s = sco_panic_3; *s; s++) if (*s == '\n') lines_3++;
571 for (s = sco_panic_4; *s; s++) if (*s == '\n') lines_4++;
573 XGetWindowAttributes (dpy, window, &xgwa);
575 fontname = get_string_resource ((xgwa.height > 600
579 if (!fontname || !*fontname) fontname = (char *)def_font;
580 font = XLoadQueryFont (dpy, fontname);
581 if (!font) font = XLoadQueryFont (dpy, def_font);
583 if (fontname && fontname != def_font)
586 gcv.font = font->fid;
587 gcv.foreground = get_pixel_resource(("sco.foreground"),
590 gcv.background = get_pixel_resource(("sco.background"),
593 XSetWindowBackground(dpy, window, gcv.background);
594 XClearWindow(dpy, window);
596 gc = XCreateGC(dpy, window, GCFont|GCForeground|GCBackground, &gcv);
598 draw_string(dpy, window, gc, &gcv, font,
599 10, xgwa.height - ((lines_1 + lines_2 + lines_3 + lines_4 + 1) *
600 (font->ascent + font->descent + 1)),
604 for (s = sco_panic_2; *s; s++)
606 char *ss = strdup(sco_panic_2);
607 ss[s - sco_panic_2] = 0;
608 draw_string(dpy, window, gc, &gcv, font,
609 10, xgwa.height - ((lines_2 + lines_3 + lines_4 + 1) *
610 (font->ascent + font->descent + 1)),
615 if (bsod_sleep (dpy, -1))
619 draw_string(dpy, window, gc, &gcv, font,
620 10, xgwa.height - ((lines_3 + lines_4 + 1) *
621 (font->ascent + font->descent + 1)),
625 if (bsod_sleep(dpy, 1))
627 draw_string(dpy, window, gc, &gcv, font,
628 10, xgwa.height - ((lines_4 + 1) *
629 (font->ascent + font->descent + 1)),
634 bsod_sleep(dpy, delay);
636 XClearWindow(dpy, window);
638 XFreeFont(dpy, font);
642 /* Linux (sparc) panic, by Tom Kelly <tom@ancilla.toronto.on.ca>
645 sparc_linux (Display *dpy, Window window, int delay)
648 XWindowAttributes xgwa;
650 const char *def_font = "fixed";
657 __extension__ /* don't warn about "string length is greater than the
658 length ISO C89 compilers are required to support"
659 in the following string constant... */
662 const char *linux_panic =
663 ("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
664 "Unable to handle kernel paging request at virtual address f0d4a000\n"
665 "tsk->mm->context = 00000014\n"
666 "tsk->mm->pgd = f26b0000\n"
671 "gawk(22827): Oops\n"
672 "PSR: 044010c1 PC: f001c2cc NPC: f001c2d0 Y: 00000000\n"
673 "g0: 00001000 g1: fffffff7 g2: 04401086 g3: 0001eaa0\n"
674 "g4: 000207dc g5: f0130400 g6: f0d4a018 g7: 00000001\n"
675 "o0: 00000000 o1: f0d4a298 o2: 00000040 o3: f1380718\n"
676 "o4: f1380718 o5: 00000200 sp: f1b13f08 ret_pc: f001c2a0\n"
677 "l0: efffd880 l1: 00000001 l2: f0d4a230 l3: 00000014\n"
678 "l4: 0000ffff l5: f0131550 l6: f012c000 l7: f0130400\n"
679 "i0: f1b13fb0 i1: 00000001 i2: 00000002 i3: 0007c000\n"
680 "i4: f01457c0 i5: 00000004 i6: f1b13f70 i7: f0015360\n"
681 "Instruction DUMP:\n"
684 for (s = linux_panic; *s; s++) if (*s == '\n') lines++;
686 XGetWindowAttributes (dpy, window, &xgwa);
688 fontname = get_string_resource ((xgwa.height > 600
690 : "sparclinux.font"),
692 if (!fontname || !*fontname) fontname = (char *)def_font;
693 font = XLoadQueryFont (dpy, fontname);
694 if (!font) font = XLoadQueryFont (dpy, def_font);
696 if (fontname && fontname != def_font)
699 gcv.font = font->fid;
700 gcv.foreground = get_pixel_resource(("sparclinux.foreground"),
701 "SparcLinux.Foreground",
703 gcv.background = get_pixel_resource(("sparclinux.background"),
704 "SparcLinux.Background",
706 XSetWindowBackground(dpy, window, gcv.background);
707 XClearWindow(dpy, window);
709 gc = XCreateGC(dpy, window, GCFont|GCForeground|GCBackground, &gcv);
711 draw_string(dpy, window, gc, &gcv, font,
712 10, xgwa.height - (lines * (font->ascent + font->descent + 1)),
717 bsod_sleep(dpy, delay);
718 XClearWindow(dpy, window);
719 XFreeFont(dpy, font);
722 /* BSD Panic by greywolf@starwolf.com - modeled after the Linux panic above.
723 By Grey Wolf <greywolf@siteROCK.com>
726 bsd (Display *dpy, Window window, int delay)
729 XWindowAttributes xgwa;
731 const char *def_font = "fixed";
736 const char *rbstr, *panicking;
737 char syncing[80], bbuf[5], *bp;
739 const char *panicstr[] =
740 {"panic: ifree: freeing free inode",
741 "panic: blkfree: freeing free block",
742 "panic: improbability coefficient below zero",
744 "panic: crazy interrupts",
746 "panic: attempted windows install",
748 "panic: free inode isn't",
749 "panic: cpu_fork: curproc",
750 "panic: malloc: out of space in kmem_map",
751 "panic: vogon starship detected",
752 "panic: teleport chamber: out of order",
753 "panic: Brain fried - core dumped"};
755 for (i = 0; i < sizeof(syncing); i++)
758 i = (random() & 0xffff) % (sizeof(panicstr) / sizeof(*panicstr));
760 panicking = panicstr[i];
761 strcpy(syncing, "Syncing disks: ");
763 b = (random() & 0xff) % 40;
764 for (n = 0; (n < 20) && (b > 0); n++)
768 i = (random() & 0x7);
769 b -= (random() & 0xff) % 20;
773 sprintf (bbuf, "%d ", b);
774 strcat (syncing, bbuf);
784 XGetWindowAttributes (dpy, window, &xgwa);
786 fontname = get_string_resource ((xgwa.height > 600
790 if (!fontname || !*fontname) fontname = (char *)def_font;
791 font = XLoadQueryFont (dpy, fontname);
792 if (!font) font = XLoadQueryFont (dpy, def_font);
794 if (fontname && fontname != def_font)
797 gcv.font = font->fid;
798 gcv.foreground = get_pixel_resource(("bsd.foreground"),
801 gcv.background = get_pixel_resource(("bsd.background"),
804 XSetWindowBackground(dpy, window, gcv.background);
805 XClearWindow(dpy, window);
807 gc = XCreateGC(dpy, window, GCFont|GCForeground|GCBackground, &gcv);
809 draw_string(dpy, window, gc, &gcv, font,
810 10, xgwa.height - (lines * (font->ascent + font->descent + 1)),
816 for (bp = syncing; *bp;)
818 char *bsd_bufs, oc = 0;
819 for (;*bp && (*bp != ' '); bp++)
826 bsd_bufs = strdup(syncing);
827 draw_string(dpy, window, gc, &gcv, font,
829 xgwa.height - (lines * (font->ascent + font->descent + 1)),
836 if (bsod_sleep(dpy, -1))
843 draw_string(dpy, window, gc, &gcv, font,
844 10, xgwa.height - (lines * (font->ascent + font->descent + 1)),
848 draw_string(dpy, window, gc, &gcv, font,
849 10, xgwa.height - (lines * (font->ascent + font->descent + 1)),
855 bsod_sleep(dpy, delay);
858 XClearWindow(dpy, window);
859 XFreeFont(dpy, font);
863 amiga (Display *dpy, Window window, int delay)
866 XWindowAttributes xgwa;
868 const char *def_font = "fixed";
872 unsigned long fg, bg, bg2;
874 int pix_w = 0, pix_h = 0;
879 ("_Software failure. Press left mouse button to continue.\n"
880 "_Guru Meditation #00000003.00C01570");
882 XGetWindowAttributes (dpy, window, &xgwa);
884 fontname = get_string_resource ((xgwa.height > 600
885 ? "amiga.font2" : "amiga.font"),
887 if (!fontname || !*fontname) fontname = (char *)def_font;
888 font = XLoadQueryFont (dpy, fontname);
889 if (!font) font = XLoadQueryFont (dpy, def_font);
891 if (fontname && fontname != def_font)
894 gcv.font = font->fid;
895 fg = gcv.foreground = get_pixel_resource("amiga.foreground",
898 bg = gcv.background = get_pixel_resource("amiga.background",
901 bg2 = get_pixel_resource("amiga.background2", "Amiga.Background",
903 XSetWindowBackground(dpy, window, bg2);
904 XClearWindow(dpy, window);
906 gc = XCreateGC(dpy, window, GCFont|GCForeground|GCBackground, &gcv);
907 gcv.background = fg; gcv.foreground = bg;
908 gc2 = XCreateGC(dpy, window, GCFont|GCForeground|GCBackground, &gcv);
910 height = (font->ascent + font->descent) * 6;
912 #if defined(HAVE_GDK_PIXBUF) || defined (HAVE_XPM)
913 pixmap = xpm_data_to_pixmap (dpy, window, (char **) amiga_hand,
915 #endif /* HAVE_GDK_PIXBUF || HAVE_XPM */
917 if (pixmap && xgwa.height > 600) /* scale up the bitmap */
919 pixmap = double_pixmap(dpy, gc, xgwa.visual, xgwa.depth,
920 pixmap, pix_w, pix_h);
927 int x = (xgwa.width - pix_w) / 2;
928 int y = ((xgwa.height - pix_h) / 2);
929 XCopyArea(dpy, pixmap, window, gc, 0, 0, pix_w, pix_h, x, y);
934 XCopyArea(dpy, pixmap, window, gc, 0, 0, pix_w, pix_h, x, y + height);
935 XClearArea(dpy, window, 0, 0, xgwa.width, y + height, False);
936 XFreePixmap(dpy, pixmap);
939 XFillRectangle(dpy, window, gc2, 0, 0, xgwa.width, height);
940 margin = font->ascent;
941 string_width = draw_string(dpy, window, gc, &gcv, font,
943 xgwa.width - (margin * 2), height,
950 XFillRectangle(dpy, window, gca, 0, 0, xgwa.width, margin);
951 XFillRectangle(dpy, window, gca, 0, 0, margin, height);
952 XFillRectangle(dpy, window, gca,
953 0, height - margin, xgwa.width, margin);
954 x2 = margin + string_width;
955 if (x2 < xgwa.width - margin) x2 = xgwa.width - margin;
956 XFillRectangle(dpy, window, gca, x2, 0, margin, height);
958 gca = (gca == gc ? gc2 : gc);
960 if (bsod_sleep(dpy, 1))
969 XClearWindow(dpy, window);
970 XFreeFont(dpy, font);
974 /* Atari ST, by Marcus Herbert <rhoenie@nobiscum.de>
975 Marcus had this to say:
977 Though I still have my Atari somewhere, I hardly remember
978 the meaning of the bombs. I think 9 bombs was "bus error" or
979 something like that. And you often had a few bombs displayed
980 quickly and then the next few ones coming up step by step.
981 Perhaps somebody else can tell you more about it.. its just
985 atari (Display *dpy, Window window, int delay)
989 XWindowAttributes xgwa;
990 const char *def_font = "fixed";
994 int pix_w = atari_width;
995 int pix_h = atari_height;
999 XGetWindowAttributes (dpy, window, &xgwa);
1001 font = XLoadQueryFont (dpy, def_font);
1002 if (!font) exit(-1);
1004 gcv.font = font->fid;
1005 gcv.foreground = get_pixel_resource("atari.foreground", "Atari.Foreground",
1006 dpy, xgwa.colormap);
1007 gcv.background = get_pixel_resource("atari.background", "Atari.Background",
1008 dpy, xgwa.colormap);
1010 XSetWindowBackground(dpy, window, gcv.background);
1011 XClearWindow(dpy, window);
1013 gc = XCreateGC(dpy, window, GCFont|GCForeground|GCBackground, &gcv);
1015 pixmap = XCreatePixmapFromBitmapData(dpy, window, (char *) atari_bits,
1017 gcv.foreground, gcv.background,
1019 pixmap = double_pixmap(dpy, gc, xgwa.visual, xgwa.depth,
1020 pixmap, pix_w, pix_h);
1026 y = (xgwa.height - (xgwa.height / 5));
1029 for (i=0 ; i<7 ; i++) {
1030 XCopyArea(dpy, pixmap, window, gc, 0, 0, pix_w, pix_h,
1031 (x + (i*offset)), y);
1034 for (i=7 ; i<10 ; i++) {
1035 if (bsod_sleep(dpy, 1))
1037 XCopyArea(dpy, pixmap, window, gc, 0, 0, pix_w, pix_h,
1038 (x + (i*offset)), y);
1041 bsod_sleep(dpy, delay);
1043 XFreePixmap(dpy, pixmap);
1046 XClearWindow(dpy, window);
1047 XFreeFont(dpy, font);
1052 mac (Display *dpy, Window window, int delay)
1055 XWindowAttributes xgwa;
1057 const char *def_font = "fixed";
1061 int pix_w = mac_width;
1062 int pix_h = mac_height;
1063 int offset = mac_height * 4;
1066 const char *string = ("0 0 0 0 0 0 0 F\n"
1069 XGetWindowAttributes (dpy, window, &xgwa);
1071 fontname = get_string_resource ("mac.font", "Mac.Font");
1072 if (!fontname || !*fontname) fontname = (char *)def_font;
1073 font = XLoadQueryFont (dpy, fontname);
1074 if (!font) font = XLoadQueryFont (dpy, def_font);
1075 if (!font) exit(-1);
1076 if (fontname && fontname != def_font)
1079 gcv.font = font->fid;
1080 gcv.foreground = get_pixel_resource("mac.foreground", "Mac.Foreground",
1081 dpy, xgwa.colormap);
1082 gcv.background = get_pixel_resource("mac.background", "Mac.Background",
1083 dpy, xgwa.colormap);
1084 XSetWindowBackground(dpy, window, gcv.background);
1085 XClearWindow(dpy, window);
1087 gc = XCreateGC(dpy, window, GCFont|GCForeground|GCBackground, &gcv);
1089 pixmap = XCreatePixmapFromBitmapData(dpy, window, (char *) mac_bits,
1090 mac_width, mac_height,
1095 for(i = 0; i < 2; i++)
1097 pixmap = double_pixmap(dpy, gc, xgwa.visual, xgwa.depth,
1098 pixmap, pix_w, pix_h);
1099 pix_w *= 2; pix_h *= 2;
1103 int x = (xgwa.width - pix_w) / 2;
1104 int y = (((xgwa.height + offset) / 2) -
1106 (font->ascent + font->descent) * 2);
1108 XCopyArea(dpy, pixmap, window, gc, 0, 0, pix_w, pix_h, x, y);
1109 XFreePixmap(dpy, pixmap);
1112 draw_string(dpy, window, gc, &gcv, font, 0, 0,
1113 xgwa.width, xgwa.height + offset, string, 0);
1117 bsod_sleep(dpy, delay);
1118 XClearWindow(dpy, window);
1119 XFreeFont(dpy, font);
1123 macsbug (Display *dpy, Window window, int delay)
1126 XWindowAttributes xgwa;
1128 const char *def_font = "fixed";
1132 int char_width, line_height;
1133 int col_right, row_top, row_bottom, page_right, page_bottom, body_top;
1137 __extension__ /* don't warn about "string length is greater than the
1138 length ISO C89 compilers are required to support"
1139 in the following string constant... */
1142 const char *left = (" SP \n"
1189 const char *bottom = (" _A09D\n"
1190 " +00884 40843714 #$0700,SR "
1192 " +00886 40843765 *+$0400 "
1194 " +00888 40843718 $0004(A7),([0,A7[)"
1195 " ; 04E8D0AE | 66B8");
1198 const char *body = ("Bus Error at 4BF6D6CC\n"
1199 "while reading word from 4BF6D6CC in User data space\n"
1200 " Unable to access that address\n"
1202 " Frame Type: B008");
1206 __extension__ /* don't warn about "string length is greater than the
1207 length ISO C89 compilers are required to support"
1208 in the following string constant... */
1211 const char * body = ("PowerPC unmapped memory exception at 003AFDAC "
1212 "BowelsOfTheMemoryMgr+04F9C\n"
1213 " Calling chain using A6/R1 links\n"
1214 " Back chain ISA Caller\n"
1215 " 00000000 PPC 28C5353C __start+00054\n"
1216 " 24DB03C0 PPC 28B9258C main+0039C\n"
1217 " 24DB0350 PPC 28B9210C MainEvent+00494\n"
1218 " 24DB02B0 PPC 28B91B40 HandleEvent+00278\n"
1219 " 24DB0250 PPC 28B83DAC DoAppleEvent+00020\n"
1220 " 24DB0210 PPC FFD3E5D0 "
1221 "AEProcessAppleEvent+00020\n"
1222 " 24DB0132 68K 00589468\n"
1223 " 24DAFF8C 68K 00589582\n"
1224 " 24DAFF26 68K 00588F70\n"
1225 " 24DAFEB3 PPC 00307098 "
1226 "EmToNatEndMoveParams+00014\n"
1227 " 24DAFE40 PPC 28B9D0B0 DoScript+001C4\n"
1228 " 24DAFDD0 PPC 28B9C35C RunScript+00390\n"
1229 " 24DAFC60 PPC 28BA36D4 run_perl+000E0\n"
1230 " 24DAFC10 PPC 28BC2904 perl_run+002CC\n"
1231 " 24DAFA80 PPC 28C18490 Perl_runops+00068\n"
1232 " 24DAFA30 PPC 28BE6CC0 Perl_pp_backtick+000FC\n"
1233 " 24DAF9D0 PPC 28BA48B8 Perl_my_popen+00158\n"
1234 " 24DAF980 PPC 28C5395C sfclose+00378\n"
1235 " 24DAF930 PPC 28BA568C free+0000C\n"
1236 " 24DAF8F0 PPC 28BA6254 pool_free+001D0\n"
1237 " 24DAF8A0 PPC FFD48F14 DisposePtr+00028\n"
1238 " 24DAF7C9 PPC 00307098 "
1239 "EmToNatEndMoveParams+00014\n"
1240 " 24DAF780 PPC 003AA180 __DisposePtr+00010");
1246 for (s = body; *s; s++) if (*s == '\n') body_lines++;
1248 XGetWindowAttributes (dpy, window, &xgwa);
1250 fontname = get_string_resource ((xgwa.height > 850
1252 : (xgwa.height > 700
1256 if (!fontname || !*fontname) fontname = (char *)def_font;
1257 font = XLoadQueryFont (dpy, fontname);
1258 if (!font) font = XLoadQueryFont (dpy, def_font);
1259 if (!font) exit(-1);
1260 if (fontname && fontname != def_font)
1263 gcv.font = font->fid;
1264 gcv.foreground = get_pixel_resource("macsbug.foreground",
1265 "MacsBug.Foreground",
1266 dpy, xgwa.colormap);
1267 gcv.background = get_pixel_resource("macsbug.background",
1268 "MacsBug.Background",
1269 dpy, xgwa.colormap);
1271 gc = XCreateGC(dpy, window, GCFont|GCForeground|GCBackground, &gcv);
1273 gcv.foreground = gcv.background;
1274 gc2 = XCreateGC(dpy, window, GCForeground, &gcv);
1276 XSetWindowBackground(dpy, window,
1277 get_pixel_resource("macsbug.borderColor",
1278 "MacsBug.BorderColor",
1279 dpy, xgwa.colormap));
1280 XClearWindow(dpy, window);
1282 char_width = (font->per_char
1283 ? font->per_char['n'-font->min_char_or_byte2].width
1284 : font->min_bounds.width);
1285 line_height = font->ascent + font->descent + 1;
1287 col_right = char_width * 12;
1288 page_bottom = line_height * 47;
1290 if (page_bottom > xgwa.height) page_bottom = xgwa.height;
1292 row_bottom = page_bottom - line_height;
1293 row_top = row_bottom - (line_height * 4);
1294 page_right = col_right + (char_width * 88);
1295 body_top = row_top - (line_height * body_lines);
1301 xoff = (xgwa.width - page_right) / 2;
1302 yoff = (xgwa.height - page_bottom) / 2;
1303 if (xoff < 0) xoff = 0;
1304 if (yoff < 0) yoff = 0;
1306 XFillRectangle(dpy, window, gc2, xoff, yoff, page_right, page_bottom);
1308 draw_string(dpy, window, gc, &gcv, font, xoff, yoff, 10, 10, left, 0);
1309 draw_string(dpy, window, gc, &gcv, font, xoff+col_right, yoff+row_top,
1312 XFillRectangle(dpy, window, gc, xoff + col_right, yoff, 2, page_bottom);
1313 XDrawLine(dpy, window, gc,
1314 xoff+col_right, yoff+row_top, xoff+page_right, yoff+row_top);
1315 XDrawLine(dpy, window, gc,
1316 xoff+col_right, yoff+row_bottom, xoff+page_right, yoff+row_bottom);
1317 XDrawRectangle(dpy, window, gc, xoff, yoff, page_right, page_bottom);
1322 draw_string(dpy, window, gc, &gcv, font,
1323 xoff + col_right + char_width, yoff + body_top, 10, 10, body,
1328 XDrawLine(dpy, window, gc,
1329 xoff+col_right+(char_width/2)+2, yoff+row_bottom+3,
1330 xoff+col_right+(char_width/2)+2, yoff+page_bottom-3);
1333 XDrawLine(dpy, window, gc2,
1334 xoff+col_right+(char_width/2)+2, yoff+row_bottom+3,
1335 xoff+col_right+(char_width/2)+2, yoff+page_bottom-3);
1338 if (bsod_sleep(dpy, 0))
1345 XClearWindow(dpy, window);
1346 XFreeFont(dpy, font);
1350 mac1 (Display *dpy, Window window, int delay)
1353 XWindowAttributes xgwa;
1356 int pix_w = macbomb_width;
1357 int pix_h = macbomb_height;
1359 XGetWindowAttributes (dpy, window, &xgwa);
1361 gcv.foreground = get_pixel_resource("mac1.foreground", "Mac.Foreground",
1362 dpy, xgwa.colormap);
1363 gcv.background = get_pixel_resource("mac1.background", "Mac.Background",
1364 dpy, xgwa.colormap);
1365 XSetWindowBackground(dpy, window, gcv.background);
1366 XClearWindow(dpy, window);
1368 gc = XCreateGC(dpy, window, GCForeground|GCBackground, &gcv);
1370 pixmap = XCreatePixmapFromBitmapData(dpy, window, (char *) macbomb_bits,
1371 macbomb_width, macbomb_height,
1377 int x = (xgwa.width - pix_w) / 2;
1378 int y = (xgwa.height - pix_h) / 2;
1380 XFillRectangle (dpy, window, gc, 0, 0, xgwa.width, xgwa.height);
1382 if (bsod_sleep(dpy, 1))
1384 XCopyArea(dpy, pixmap, window, gc, 0, 0, pix_w, pix_h, x, y);
1389 XFreePixmap(dpy, pixmap);
1391 bsod_sleep(dpy, delay);
1392 XClearWindow(dpy, window);
1397 macx (Display *dpy, Window window, int delay)
1400 XWindowAttributes xgwa;
1402 const char *def_font = "fixed";
1407 __extension__ /* don't warn about "string length is greater than the
1408 length ISO C89 compilers are required to support"
1409 in the following string constant... */
1412 const char *macx_panic =
1413 ("panic(cpu 0): Unable to find driver for this platform: "
1414 "\"PowerMac 3,5\".\n"
1416 "backtrace: 0x0008c2f4 0x0002a7a0 0x001f0204 0x001d4e4c 0x001d4c5c "
1417 "0x001a56cc 0x01d5dbc 0x001c621c 0x00037430 0x00037364\n"
1421 "No debugger configured - dumping debug information\n"
1423 "version string : Darwin Kernel Version 1.3:\n"
1424 "Thu Mar 1 06:56:40 PST 2001; root:xnu/xnu-123.5.obj~1/RELEASE_PPC\n"
1429 "DBAT0: 00000000 00000000\n"
1430 "DBAT1: 00000000 00000000\n"
1431 "DBAT2: 80001FFE 8000003A\n"
1432 "DBAT3: 90001FFE 9000003A\n"
1434 "backtrace: 0x0008c2f4 0x0002a7a0 0x001f0204 0x001d4e4c 0x001d4c5c "
1435 "0x001a56cc 0x01d5dbc 0x001c621c 0x00037430 0x00037364\n"
1437 "panic: We are hanging here...\n");
1439 XGetWindowAttributes (dpy, window, &xgwa);
1441 gcv.background = get_pixel_resource("macX.background",
1443 dpy, xgwa.colormap);
1444 XSetWindowBackground(dpy, window, gcv.background);
1445 XClearWindow(dpy, window);
1447 fontname = get_string_resource ((xgwa.height > 900
1451 if (!fontname || !*fontname) fontname = (char *)def_font;
1452 font = XLoadQueryFont (dpy, fontname);
1453 if (!font) font = XLoadQueryFont (dpy, def_font);
1454 if (!font) exit(-1);
1455 if (fontname && fontname != def_font)
1458 gcv.font = font->fid;
1459 gcv.foreground = get_pixel_resource("macsbug.foreground",
1460 "MacsBug.Foreground",
1461 dpy, xgwa.colormap);
1462 gcv.background = get_pixel_resource("macsbug.background",
1463 "MacsBug.Background",
1464 dpy, xgwa.colormap);
1467 gcv.foreground = get_pixel_resource("macX.textForeground",
1468 "MacX.TextForeground",
1469 dpy, xgwa.colormap);
1470 gcv.background = get_pixel_resource("macX.textBackground",
1471 "MacX.TextBackground",
1472 dpy, xgwa.colormap);
1473 gc = XCreateGC(dpy, window, GCForeground|GCBackground|GCFont, &gcv);
1475 #if defined(HAVE_GDK_PIXBUF) || defined (HAVE_XPM)
1479 int x, y, pix_w, pix_h;
1480 pixmap = xpm_data_to_pixmap (dpy, window, (char **) happy_mac,
1481 &pix_w, &pix_h, &mask);
1483 x = (xgwa.width - pix_w) / 2;
1484 y = (xgwa.height - pix_h) / 2;
1488 XSetClipMask (dpy, gc, mask);
1489 XSetClipOrigin (dpy, gc, x, y);
1490 XCopyArea (dpy, pixmap, window, gc, 0, 0, pix_w, pix_h, x, y);
1491 XSetClipMask (dpy, gc, None);
1492 XFreePixmap (dpy, pixmap);
1494 #endif /* HAVE_GDK_PIXBUF || HAVE_XPM */
1501 int char_width, line_height;
1502 char_width = (font->per_char
1503 ? font->per_char['n'-font->min_char_or_byte2].width
1504 : font->min_bounds.width);
1505 line_height = font->ascent + font->descent;
1513 if (*s == '\n' || x + char_width >= xgwa.width)
1521 /* Note that to get this goofy effect, they must be actually
1522 emitting LF CR at the end of each line instead of CR LF!
1524 XDrawImageString (dpy, window, gc, ox, oy, " ", 1);
1525 XDrawImageString (dpy, window, gc, ox, y, " ", 1);
1529 XDrawImageString (dpy, window, gc, x, y, s, 1);
1538 bsod_sleep(dpy, delay);
1539 XClearWindow(dpy, window);
1545 * by Martin Pool <mbp@samba.org>, Feb 2000.
1547 * This is meant to look like the preferred failure mode of NCD
1548 * Xterms. The parameters for choosing what to copy where might not
1549 * be quite right, but it looks about ugly enough.
1552 blitdamage (Display *dpy, Window window, int delay)
1555 XWindowAttributes xwa;
1558 int delta_x = 0, delta_y = 0;
1560 int chunk_h, chunk_w;
1566 XGetWindowAttributes(dpy, window, &xwa);
1568 load_random_image (xwa.screen, window, window, NULL, NULL);
1573 gc_mask = GCForeground;
1575 gcv.plane_mask = random();
1576 gc_mask |= GCPlaneMask;
1578 gc0 = XCreateGC(dpy, window, gc_mask, &gcv);
1581 chunk_w = w / (random() % 1 + 1);
1582 chunk_h = h / (random() % 1 + 1);
1583 if (random() & 0x1000)
1584 delta_y = random() % 600;
1585 if (!delta_y || (random() & 0x2000))
1586 delta_x = random() % 600;
1592 for (i = 0; i < steps; i++) {
1593 if (x + chunk_w > w)
1598 if (y + chunk_h > h)
1603 XCopyArea(dpy, window, window, gc0,
1608 if (bsod_sleep(dpy, 0))
1612 bsod_sleep(dpy, delay);
1621 * This is what happens if an Nvidia card goes into some crazy text mode.
1622 * Most often seen on the second screen of a dual-head system when the
1623 * proper driver isn't loaded.
1625 typedef struct { int fg; int bg; int bit; Bool blink; } nvcell;
1628 nvspatter (nvcell *grid, int rows, int cols, int ncolors, int nbits,
1631 int max = rows * cols;
1632 int from = fill_p ? 0 : random() % (max - 1);
1633 int len = fill_p ? max : random() % (cols * 4);
1634 int to = from + len;
1636 Bool noisy = ((random() % 4) == 0);
1637 Bool diag = (noisy || fill_p) ? 0 : ((random() % 4) == 0);
1639 int fg = random() % ncolors;
1640 int bg = random() % ncolors;
1641 int blink = ((random() % 4) == 0);
1642 int bit = (random() % nbits);
1644 if (to > max) to = max;
1648 int src = random() % (rows * cols);
1649 int len2 = (cols / 2) - (random() % 5);
1651 for (i = from; i < to; i++, j++)
1653 if (j > src + len2 || j >= max)
1655 if (i >= max) abort();
1656 if (j >= max) abort();
1661 for (i = from; i < to; i++)
1663 nvcell *cell = &grid[i];
1667 cell->blink = blink;
1671 fg = random() % ncolors;
1672 bg = random() % ncolors;
1673 blink = ((random() % 8) == 0);
1680 nvidia (Display *dpy, Window window, int delay)
1683 XWindowAttributes xgwa;
1686 unsigned long colors[256];
1694 XGetWindowAttributes (dpy, window, &xgwa);
1698 cellw = xgwa.width / cols;
1699 cellh = xgwa.height / rows;
1700 if (cellw < 8 || cellh < 18)
1701 cellw = 8, cellh = 18;
1702 cols = (xgwa.width / cellw) + 1;
1703 rows = (xgwa.height / cellh) + 1;
1705 grid = (nvcell *) calloc (sizeof(*grid), rows * cols);
1706 gc = XCreateGC (dpy, window, 0, &gcv);
1711 for (i = 0; i < ncolors; i++)
1714 c.red = random() & 0xFFFF;
1715 c.green = random() & 0xFFFF;
1716 c.blue = random() & 0xFFFF;
1717 c.flags = DoRed|DoGreen|DoBlue;
1718 XAllocColor (dpy, xgwa.colormap, &c);
1719 colors[i] = c.pixel;
1722 /* Construct corrupted character bitmaps
1724 for (i = 0; i < countof(bits); i++)
1728 bits[i] = XCreatePixmap (dpy, window, cellw, cellh, 1);
1729 if (!gc1) gc1 = XCreateGC (dpy, bits[i], 0, &gcv);
1731 XSetForeground (dpy, gc1, 0);
1732 XFillRectangle (dpy, bits[i], gc1, 0, 0, cellw, cellh);
1733 XSetForeground (dpy, gc1, ~0L);
1735 if ((random() % 40) != 0)
1736 for (j = 0; j < ((cellw * cellh) / 16); j++)
1737 XFillRectangle (dpy, bits[i], gc1,
1738 (random() % (cellw-2)) & ~1,
1739 (random() % (cellh-2)) & ~1,
1743 /* Randomize the grid
1745 nvspatter (grid, rows, cols, ncolors, countof(bits), True);
1746 for (i = 0; i < 20; i++)
1747 nvspatter (grid, rows, cols, ncolors, countof(bits), False);
1750 /* Redisplay loop: blink 4x/second
1754 for (y = 0; y < rows; y++)
1755 for (x = 0; x < cols; x++)
1757 nvcell *cell = &grid[y * cols + x];
1758 unsigned long fg = colors[cell->fg];
1759 unsigned long bg = colors[cell->bg];
1760 Bool flip = cell->blink && (tick & 1);
1761 XSetForeground (dpy, gc, flip ? fg : bg);
1762 XSetBackground (dpy, gc, flip ? bg : fg);
1763 XCopyPlane (dpy, bits[cell->bit], window, gc,
1765 x * cellw, y * cellh, 1L);
1768 if ((random() % 5) == 0) /* change the display */
1769 nvspatter (grid, rows, cols, ncolors, countof(bits), False);
1773 if (bsod_sleep(dpy, 0))
1775 if (tick / 4 >= delay)
1781 XFreeColors (dpy, xgwa.colormap, colors, ncolors, 0);
1782 for (i = 0; i < countof(bits); i++)
1783 XFreePixmap (dpy, bits[i]);
1791 * SPARC Solaris panic. Should look pretty authentic on Solaris boxes.
1792 * Anton Solovyev <solovam@earthlink.net>
1801 int sub_width; /* Text subwindow width in pixels */
1802 int sub_height; /* Text subwindow height in pixels */
1803 int sub_x; /* upper left corner of the text subwindow */
1804 int sub_y; /* upper left corner of the text subwindow */
1805 int char_width; /* Char width in pixels */
1806 int line_height; /* Line height in pixels */
1807 int columns; /* Number of columns in the text screen */
1808 int x; /* horizontal position of the cursor */
1812 static scrolling_window *
1813 make_scrolling_window (Display *dpy, Window window,
1817 const char *def_font = "fixed";
1818 scrolling_window* ts;
1819 XWindowAttributes xgwa;
1822 char buf1[100], buf2[100];
1824 ts = malloc (sizeof (*ts));
1825 ts->window = window;
1830 XGetWindowAttributes (dpy, window, &xgwa);
1834 ts->sub_width = xgwa.width * 0.8;
1835 ts->sub_height = xgwa.height * 0.8;
1839 ts->sub_width = xgwa.width - 20;
1840 ts->sub_height = xgwa.height - 20;
1841 if (ts->sub_width < 20) ts->sub_width = 20;
1842 if (ts->sub_height < 20) ts->sub_height = 20;
1845 sprintf (buf1, "%.50s.font", name);
1846 sprintf (buf2, "%.50s.Font", name);
1847 fn = get_string_resource (buf1, buf2);
1848 ts->xfs = XLoadQueryFont (dpy, fn);
1851 sprintf (buf1, "%.50s.font2", name);
1852 fn = get_string_resource(buf1, buf2);
1853 ts->xfs = XLoadQueryFont(dpy, fn);
1856 ts->xfs = XLoadQueryFont(dpy, def_font);
1859 gcv.font = ts->xfs->fid;
1860 ts->char_width = (ts->xfs->per_char
1861 ? ts->xfs->per_char['n'-ts->xfs->min_char_or_byte2].width
1862 : ts->xfs->min_bounds.width);
1863 ts->line_height = ts->xfs->ascent + ts->xfs->descent + 1;
1865 ts->columns = ts->sub_width / ts->char_width;
1867 ts->sub_x = (xgwa.width - ts->sub_width) / 2;
1868 ts->sub_y = (xgwa.height - ts->sub_height) / 2;
1870 if (!grab_screen_p) ts->sub_height += ts->sub_y, ts->sub_y = 0;
1873 load_random_image (xgwa.screen, window, window, NULL, NULL);
1875 sprintf (buf1, "%.50s.background", name);
1876 sprintf (buf2, "%.50s.Background", name);
1877 gcv.background = get_pixel_resource (buf1, buf2, dpy, xgwa.colormap);
1879 sprintf (buf1, "%.50s.foreground", name);
1880 sprintf (buf2, "%.50s.Foreground", name);
1881 gcv.foreground = get_pixel_resource (buf1, buf2, dpy, xgwa.colormap);
1883 ts->gc = XCreateGC (dpy, window,
1884 GCForeground | GCBackground | GCFont,
1886 gcv.foreground = gcv.background;
1887 ts->erase_gc = XCreateGC (dpy, window,
1888 GCForeground | GCBackground,
1890 XSetWindowBackground (dpy, window, gcv.background);
1895 free_scrolling_window (scrolling_window* ts)
1897 XFreeGC (ts->dpy, ts->gc);
1898 XFreeGC (ts->dpy, ts->erase_gc);
1899 XFreeFont (ts->dpy, ts->xfs);
1904 scrolling_putc (scrolling_window* ts, const char aChar)
1910 XCopyArea (ts->dpy, ts->window, ts->window, ts->gc,
1911 ts->sub_x, ts->sub_y + ts->line_height,
1912 ts->sub_width, ts->sub_height,
1913 ts->sub_x, ts->sub_y);
1914 XFillRectangle (ts->dpy, ts->window, ts->erase_gc,
1915 ts->sub_x, ts->sub_y + ts->sub_height - ts->line_height,
1916 ts->sub_width, ts->line_height);
1925 if (ts->x >= ts->columns)
1926 scrolling_putc (ts, '\n');
1927 XDrawImageString (ts->dpy, ts->window, ts->gc,
1929 (ts->x * ts->char_width)
1930 - ts->xfs->min_bounds.lbearing),
1931 (ts->sub_y + ts->sub_height - ts->xfs->descent),
1939 scrolling_puts (scrolling_window *ts, const char* aString, int delay)
1942 for (c = aString; *c; ++c)
1944 scrolling_putc (ts, *c);
1949 if (bsod_sleep (ts->dpy, 0))
1958 sparc_solaris (Display* dpy, Window window, int delay)
1961 __extension__ /* don't warn about "string length is greater than the
1962 length ISO C89 compilers are required to support"
1963 in the following string constant... */
1967 "BAD TRAP: cpu=0 type=0x31 rp=0x2a10043b5e0 addr=0xf3880 mmu_fsr=0x0\n"
1968 "BAD TRAP occurred in module \"unix\" due to an illegal access to a"
1970 "adb: trap type = 0x31\n"
1972 "pid=307, pc=0x100306e4, sp=0x2a10043ae81, tstate=0x4480001602,"
1974 "g1-g7: 1045b000, 32f, 10079440, 180, 300000ebde8, 0, 30000953a20\n"
1975 "Begin traceback... sp = 2a10043ae81\n"
1976 "Called from 100bd060, fp=2a10043af31, args=f3700 300008cc988 f3880 0"
1978 "Called from 101fe1bc, fp=2a10043b011, args=3000045a240 104465a0"
1979 " 300008e47d0 300008e48fa 300008ae350 300008ae410\n"
1980 "Called from 1007c520, fp=2a10043b0c1, args=300008e4878 300003596e8 0"
1981 " 3000045a320 0 3000045a220\n"
1982 "Called from 1007c498, fp=2a10043b171, args=1045a000 300007847f0 20"
1983 " 3000045a240 1 0\n"
1984 "Called from 1007972c, fp=2a10043b221, args=1 300009517c0 30000951e58 1"
1986 "Called from 10031e10, fp=2a10043b2d1, args=3000095b0c8 0 300009396a8"
1987 " 30000953a20 0 1\n"
1988 "Called from 10000bdd8, fp=ffffffff7ffff1c1, args=0 57 100131480"
1989 " 100131480 10012a6e0 0\n"
1990 "End traceback...\n"
1991 "panic[cpu0]/thread=30000953a20: trap\n"
1992 "syncing file systems...";
1995 "dumping to /dev/dsk/c0t0d0s3, offset 26935296\n";
1997 ": 2803 pages dumped, compression ratio 2.88, dump succeeded\n";
2002 scrolling_window *ts;
2006 ts = make_scrolling_window (dpy, window, "Solaris", True);
2008 scrolling_puts (ts, msg1, 0);
2009 if (bsod_sleep (dpy, 3))
2012 scrolling_puts (ts, msg2, 0);
2013 if (bsod_sleep (dpy, 2))
2016 for (i = 1; i <= 100; ++i)
2018 sprintf(buf, "\b\b\b\b\b\b\b\b\b\b\b%3d%% done", i);
2019 scrolling_puts (ts, buf, 0);
2020 if (bsod_sleep (dpy, -1))
2024 scrolling_puts (ts, msg3, 0);
2025 if (bsod_sleep (dpy, 2))
2028 scrolling_puts (ts, msg4, 0);
2029 if (bsod_sleep(dpy, 3))
2032 bsod_sleep (dpy, 3);
2035 free_scrolling_window (ts);
2038 /* Linux panic and fsck, by jwz
2041 linux_fsck (Display *dpy, Window window, int delay)
2043 XWindowAttributes xgwa;
2044 scrolling_window *ts;
2046 const char *sysname;
2049 const char *linux_panic[] = {
2050 " kernel: Unable to handle kernel paging request at virtual "
2051 "address 0000f0ad\n",
2052 " kernel: printing eip:\n",
2053 " kernel: c01becd7\n",
2054 " kernel: *pde = 00000000\n",
2055 " kernel: Oops: 0000\n",
2056 " kernel: CPU: 0\n",
2057 " kernel: EIP: 0010:[<c01becd7>] Tainted: P \n",
2058 " kernel: EFLAGS: 00010286\n",
2059 " kernel: eax: 0000ff00 ebx: ca6b7e00 ecx: ce1d7a60 edx: ce1d7a60\n",
2060 " kernel: esi: ca6b7ebc edi: 00030000 ebp: d3655ca0 esp: ca6b7e5c\n",
2061 " kernel: ds: 0018 es: 0018 ss: 0018\n",
2062 " kernel: Process crond (pid: 1189, stackpage=ca6b7000)\n",
2063 " kernel: Stack: d3655ca0 ca6b7ebc 00030054 ca6b7e7c c01c1e5b "
2064 "00000287 00000020 c01c1fbf \n",
2066 " kernel: 00005a36 000000dc 000001f4 00000000 00000000 "
2067 "ce046d40 00000001 00000000 \n",
2069 " kernel: ffffffff d3655ca0 d3655b80 00030054 c01bef93 "
2070 "d3655ca0 ca6b7ebc 00030054 \n",
2072 " kernel: Call Trace: [<c01c1e5b>] [<c01c1fbf>] [<c01bef93>] "
2073 "[<c01bf02b>] [<c0134c4f>]\n",
2075 " kernel: [<c0142562>] [<c0114f8c>] [<c0134de3>] [<c010891b>]\n",
2077 " kernel: Code: 2a 00 75 08 8b 44 24 2c 85 c0 74 0c 8b 44 24 58 83 48 18 "
2082 XGetWindowAttributes (dpy, window, &xgwa);
2083 XSetWindowBackground (dpy, window,
2084 get_pixel_resource("Linux.background",
2086 dpy, xgwa.colormap));
2087 XClearWindow(dpy, window);
2094 if (uname (&uts) >= 0)
2095 sysname = uts.nodename;
2096 s = strchr (sysname, '.');
2099 # endif /* !HAVE_UNAME */
2102 ts = make_scrolling_window (dpy, window, "Linux", False);
2104 scrolling_puts (ts, "waiting for X server to shut down ", 0);
2106 if (bsod_sleep (dpy, 0))
2109 "XIO: fatal IO error 2 (broken pipe) on X server \":0.0\"\n"
2110 " after 339471 requests (339471 known processed) "
2111 "with 0 events remaining\n",
2113 if (scrolling_puts (ts, ".........\n", 300000))
2115 if (bsod_sleep (dpy, 0))
2118 "xinit: X server slow to shut down, sending KILL signal.\n",
2120 scrolling_puts (ts, "waiting for server to die ", 0);
2121 if (scrolling_puts (ts, "...\n", 300000))
2123 if (bsod_sleep (dpy, 0))
2125 scrolling_puts (ts, "xinit: Can't kill server\n", 0);
2127 if (bsod_sleep (dpy, 2))
2130 sprintf (buf, "\n%s Login: ", sysname);
2131 scrolling_puts (ts, buf, 0);
2132 if (bsod_sleep (dpy, 1))
2136 "Parallelizing fsck version 1.22 (22-Jun-2001)\n"
2137 "e2fsck 1.22, 22-Jun-2001 for EXT2 FS 0.5b, 95/08/09\n"
2138 "Warning! /dev/hda1 is mounted.\n"
2139 "/dev/hda1 contains a file system with errors, check forced.\n",
2141 if (bsod_sleep (dpy, 1))
2144 if (0 == random() % 2)
2146 "Couldn't find ext2 superblock, trying backup blocks...\n"
2147 "The filesystem size (according to the superblock) is 3644739 blocks\n"
2148 "The physical size of the device is 3636706 blocks\n"
2149 "Either the superblock or the partition table is likely to be corrupt!\n"
2152 if (bsod_sleep (dpy, 1))
2157 scrolling_puts (ts, "Pass 1: Checking inodes, blocks, and sizes\n", 0);
2158 if (bsod_sleep (dpy, 2))
2161 i = (random() % 60) - 20;
2164 int b = random() % 0xFFFF;
2165 sprintf (buf, "Deleted inode %d has zero dtime. Fix<y>? yes\n\n", b);
2166 scrolling_puts (ts, buf, 0);
2169 i = (random() % 40) - 10;
2172 int g = random() % 0xFFFF;
2173 int b = random() % 0xFFFFFFF;
2175 if (bsod_sleep (dpy, 1))
2178 sprintf (buf, "Warning: Group %d's copy of the group descriptors "
2179 "has a bad block (%d).\n", g, b);
2180 scrolling_puts (ts, buf, 0);
2182 b = random() % 0x3FFFFF;
2185 b += random() % 0xFFFF;
2187 "Error reading block %d (Attempt to read block "
2188 "from filesystem resulted in short read) while doing "
2189 "inode scan. Ignore error<y>?",
2191 scrolling_puts (ts, buf, 0);
2193 scrolling_puts (ts, " yes\n\n", 0);
2197 if (0 == (random() % 10))
2200 if (bsod_sleep (dpy, 1))
2203 i = 3 + (random() % 10);
2205 scrolling_puts (ts, "Could not allocate 256 block(s) for inode table: "
2206 "No space left on device\n", 0);
2207 scrolling_puts (ts, "Restarting e2fsck from the beginning...\n", 0);
2209 if (bsod_sleep (dpy, 2))
2215 i = (random() % 20) - 5;
2218 if (bsod_sleep (dpy, 1))
2223 int j = 5 + (random() % 10);
2224 int w = random() % 4;
2228 int b = random() % 0xFFFFF;
2229 int g = random() % 0xFFF;
2231 if (0 == (random() % 10))
2233 else if (0 == (random() % 10))
2238 "Inode table for group %d not in group. (block %d)\n"
2239 "WARNING: SEVERE DATA LOSS POSSIBLE.\n"
2244 "Block bitmap for group %d not in group. (block %d)\n"
2249 "Inode bitmap %d for group %d not in group.\n"
2252 else /* if (w == 3) */
2254 "Bad block %d in group %d's inode table.\n"
2255 "WARNING: SEVERE DATA LOSS POSSIBLE.\n"
2259 scrolling_puts (ts, buf, 0);
2260 scrolling_puts (ts, " yes\n\n", 0);
2262 if (bsod_sleep (dpy, 0))
2268 if (0 == random() % 10) goto PANIC;
2269 scrolling_puts (ts, "Pass 2: Checking directory structure\n", 0);
2270 if (bsod_sleep (dpy, 2))
2273 i = (random() % 20) - 5;
2276 int n = random() % 0xFFFFF;
2277 int o = random() % 0xFFF;
2278 sprintf (buf, "Directory inode %d, block 0, offset %d: "
2279 "directory corrupted\n"
2282 scrolling_puts (ts, buf, 0);
2284 scrolling_puts (ts, " yes\n\n", 0);
2286 if (0 == (random() % 100))
2288 sprintf (buf, "Missing '.' in directory inode %d.\nFix<y>?", n);
2289 scrolling_puts (ts, buf, 0);
2291 scrolling_puts (ts, " yes\n\n", 0);
2294 if (bsod_sleep (dpy, 0))
2298 if (0 == random() % 10) goto PANIC;
2300 "Pass 3: Checking directory connectivity\n"
2301 "/lost+found not found. Create? yes\n",
2303 if (bsod_sleep (dpy, 2))
2306 /* Unconnected directory inode 4949 (/var/spool/squid/06/???)
2307 Connect to /lost+found<y>? yes
2309 '..' in /var/spool/squid/06/08 (20351) is <The NULL inode> (0), should be
2310 /var/spool/squid/06 (20350).
2313 Unconnected directory inode 128337 (/var/spool/squid/06/???)
2314 Connect to /lost+found<y>? yes
2318 if (0 == random() % 10) goto PANIC;
2319 scrolling_puts (ts, "Pass 4: Checking reference counts\n", 0);
2320 if (bsod_sleep (dpy, 2))
2323 /* Inode 2 ref count is 19, should be 20. Fix<y>? yes
2325 Inode 4949 ref count is 3, should be 2. Fix<y>? yes
2329 Inode 128336 ref count is 3, should be 2. Fix<y>? yes
2331 Inode 128337 ref count is 3, should be 2. Fix<y>? yes
2336 if (0 == random() % 10) goto PANIC;
2337 scrolling_puts (ts, "Pass 5: Checking group summary information\n", 0);
2338 if (bsod_sleep (dpy, 2))
2341 i = (random() % 200) - 50;
2344 scrolling_puts (ts, "Block bitmap differences: ", 0);
2347 sprintf (buf, " %d", -(random() % 0xFFF));
2348 scrolling_puts (ts, buf, 0);
2351 scrolling_puts (ts, "\nFix? yes\n\n", 0);
2355 i = (random() % 100) - 50;
2358 scrolling_puts (ts, "Inode bitmap differences: ", 0);
2361 sprintf (buf, " %d", -(random() % 0xFFF));
2362 scrolling_puts (ts, buf, 0);
2365 scrolling_puts (ts, "\nFix? yes\n\n", 0);
2368 i = (random() % 20) - 5;
2371 int g = random() % 0xFFFF;
2372 int c = random() % 0xFFFF;
2374 "Free blocks count wrong for group #0 (%d, counted=%d).\nFix? ",
2376 scrolling_puts (ts, buf, 0);
2378 scrolling_puts (ts, " yes\n\n", 0);
2379 if (bsod_sleep (dpy, 0))
2386 scrolling_puts (ts, "\n\n", 0);
2387 while (linux_panic[i])
2389 time_t t = time ((time_t *) 0);
2390 struct tm *tm = localtime (&t);
2393 if (*linux_panic[i])
2395 strftime (prefix, sizeof(prefix)-1, "%b %d %H:%M:%S ", tm);
2396 scrolling_puts (ts, prefix, 0);
2397 scrolling_puts (ts, sysname, 0);
2398 scrolling_puts (ts, linux_panic[i], 0);
2405 if (bsod_sleep (dpy, 0))
2410 if (bsod_sleep (dpy, 4))
2415 bsod_sleep(dpy, delay);
2418 free_scrolling_window (ts);
2419 XClearWindow(dpy, window);
2425 * Linux (hppa) panic, by Stuart Brady <sdbrady@ntlworld.com>
2426 * Output courtesy of M. Grabert
2429 hppa_linux (Display *dpy, Window window, int delay)
2431 XWindowAttributes xgwa;
2432 scrolling_window *ts;
2434 const char *sysname;
2435 long int linedelay=0;
2438 __extension__ /* don't warn about "string length is greater than the
2439 length ISO C89 compilers are required to support"
2440 in the following string constant... */
2443 struct { long int delay; const char *string; } linux_panic[] =
2444 {{ 0, "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
2445 "\n\n\n\n\n\n\n\n\n\n\n\n\n" },
2446 { 0, "Linux version 2.6.0-test11-pa2 (root@%s) "
2447 "(gcc version 3.3.2 (Debian)) #2 Mon Dec 8 06:09:27 GMT 2003\n" },
2448 { 4000, "FP[0] enabled: Rev 1 Model 16\n" },
2449 { 10, "The 32-bit Kernel has started...\n" },
2450 { -1, "Determining PDC firmware type: System Map.\n" },
2451 { -1, "model 00005bb0 00000481 00000000 00000002 7778df9f 100000f0 "
2452 "00000008 000000b2 000000b2\n" },
2453 { -1, "vers 00000203\n" },
2454 { -1, "CPUID vers 17 rev 7 (0x00000227)\n" },
2455 { -1, "capabilities 0x3\n" },
2456 { -1, "model 9000/785/C3000\n" },
2457 { -1, "Total Memory: 1024 Mb\n" },
2458 { -1, "On node 0 totalpages: 262144\n" },
2459 { -1, " DMA zone: 262144 pages, LIFO batch:16\n" },
2460 { -1, " Normal zone: 0 pages, LIFO batch:1\n" },
2461 { -1, " HighMem zone: 0 pages, LIFO batch:1\n" },
2462 { -1, "LCD display at f05d0008,f05d0000 registered\n" },
2463 { -1, "Building zonelist for node : 0\n" },
2464 { -1, "Kernel command line: ide=nodma root=/dev/sda3 HOME=/ ip=off "
2465 "console=ttyS0 TERM=vt102 palo_kernel=2/vmlinux-2.6\n" },
2466 { -1, "ide_setup: ide=nodmaIDE: Prevented DMA\n" },
2467 { -1, "PID hash table entries: 16 (order 4: 128 bytes)\n" },
2468 {500, "Console: colour dummy device 160x64\n" },
2469 { 10, "Memory: 1034036k available\n" },
2470 { -1, "Calibrating delay loop... 796.67 BogoMIPS\n" },
2471 { -1, "Dentry cache hash table entries: 131072 (order: 7, 524288 "
2473 { -1, "Inode-cache hash table entries: 65536 (order: 6, 262144 "
2475 { -1, "Mount-cache hash table entries: 512 (order: 0, 4096 bytes)\n" },
2476 { -1, "POSIX conformance testing by UNIFIX\n" },
2477 { -1, "NET: Registered protocol family 16\n" },
2478 { 100, "Searching for devices...\n" },
2479 { 25, "Found devices:\n" },
2480 { 10, "1. Astro BC Runway Port at 0xfed00000 [10] "
2481 "{ 12, 0x0, 0x582, 0x0000b }\n" },
2482 { -1, "2. Elroy PCI Bridge at 0xfed30000 [10/0] "
2483 "{ 13, 0x0, 0x782, 0x0000a }\n" },
2484 { -1, "3. Elroy PCI Bridge at 0xfed32000 [10/1] "
2485 "{ 13, 0x0, 0x782, 0x0000a }\n" },
2486 { -1, "4. Elroy PCI Bridge at 0xfed38000 [10/4] "
2487 "{ 13, 0x0, 0x782, 0x0000a }\n" },
2488 { -1, "5. Elroy PCI Bridge at 0xfed3c000 [10/6] "
2489 "{ 13, 0x0, 0x782, 0x0000a }\n" },
2490 { -1, "6. AllegroHigh W at 0xfffa0000 [32] "
2491 "{ 0, 0x0, 0x5bb, 0x00004 }\n" },
2492 { -1, "7. Memory at 0xfed10200 [49] { 1, 0x0, 0x086, 0x00009 }\n" },
2493 { -1, "CPU(s): 1 x PA8500 (PCX-W) at 400.000000 MHz\n" },
2494 { -1, "SBA found Astro 2.1 at 0xfed00000\n" },
2495 { -1, "lba version TR2.1 (0x2) found at 0xfed30000\n" },
2496 { -1, "lba version TR2.1 (0x2) found at 0xfed32000\n" },
2497 { -1, "lba version TR2.1 (0x2) found at 0xfed38000\n" },
2498 { -1, "lba version TR2.1 (0x2) found at 0xfed3c000\n" },
2499 { 100, "SCSI subsystem initialized\n" },
2500 { 10, "drivers/usb/core/usb.c: registered new driver usbfs\n" },
2501 { -1, "drivers/usb/core/usb.c: registered new driver hub\n" },
2502 { -1, "ikconfig 0.7 with /proc/config*\n" },
2503 { -1, "Initializing Cryptographic API\n" },
2504 { 250, "SuperIO: probe of 0000:00:0e.0 failed with error -1\n" },
2505 { 20, "SuperIO: Found NS87560 Legacy I/O device at 0000:00:0e.1 "
2507 { -1, "SuperIO: Serial port 1 at 0x3f8\n" },
2508 { -1, "SuperIO: Serial port 2 at 0x2f8\n" },
2509 { -1, "SuperIO: Parallel port at 0x378\n" },
2510 { -1, "SuperIO: Floppy controller at 0x3f0\n" },
2511 { -1, "SuperIO: ACPI at 0x7e0\n" },
2512 { -1, "SuperIO: USB regulator enabled\n" },
2513 { -1, "SuperIO: probe of 0000:00:0e.2 failed with error -1\n" },
2514 { -1, "Soft power switch enabled, polling @ 0xf0400804.\n" },
2515 { -1, "pty: 256 Unix98 ptys configured\n" },
2516 { -1, "Generic RTC Driver v1.07\n" },
2517 { -1, "Serial: 8250/16550 driver $Revision: 1.66 $ 13 ports, "
2518 "IRQ sharing disabled\n" },
2519 { -1, "ttyS0 at I/O 0x3f8 (irq = 0) is a 16550A\n" },
2520 { -1, "ttyS1 at I/O 0x2f8 (irq = 0) is a 16550A\n" },
2521 { -1, "Linux Tulip driver version 1.1.13 (May 11, 2002)\n" },
2522 { 150, "tulip0: no phy info, aborting mtable build\n" },
2523 { 10, "tulip0: MII transceiver #1 config 1000 status 782d "
2524 "advertising 01e1.\n" },
2525 { -1, "eth0: Digital DS21143 Tulip rev 65 at 0xf4008000, "
2526 "00:10:83:F9:B4:34, IRQ 66.\n" },
2527 { -1, "Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2\n" },
2528 { -1, "ide: Assuming 33MHz system bus speed for PIO modes; "
2529 "override with idebus=xx\n" },
2530 { 100, "SiI680: IDE controller at PCI slot 0000:01:06.0\n" },
2531 { 10, "SiI680: chipset revision 2\n" },
2532 { -1, "SiI680: BASE CLOCK == 133\n" },
2533 { -1, "SiI680: 100% native mode on irq 128\n" },
2534 { -1, " ide0: MMIO-DMA at 0xf4800000-0xf4800007 -- "
2535 "Error, MMIO ports already in use.\n" },
2536 { -1, " ide1: MMIO-DMA at 0xf4800008-0xf480000f -- "
2537 "Error, MMIO ports already in use.\n" },
2538 { 5, "hda: TS130220A2, ATA DISK drive\n" },
2539 { -1, " _______________________________\n" },
2540 { -1, " < Your System ate a SPARC! Gah! >\n" },
2541 { -1, " -------------------------------\n" },
2542 { -1, " \\ ^__^\n" },
2543 { -1, " \\ (xx)\\_______\n" },
2544 { -1, " (__)\\ )\\/\\\n" },
2545 { -1, " U ||----w |\n" },
2547 { -1, "swapper (pid 1): Breakpoint (code 0)\n" },
2549 { -1, " YZrvWESTHLNXBCVMcbcbcbcbOGFRQPDI\n" },
2550 { -1, "PSW: 00000000000001001111111100001111 Not tainted\n" },
2551 { -1, "r00-03 4d6f6f21 1032f010 10208f34 103fc2e0\n" },
2552 { -1, "r04-07 103fc230 00000001 00000001 0000000f\n" },
2553 { -1, "r08-11 103454f8 000f41fa 372d3980 103ee404\n" },
2554 { -1, "r12-15 3ccbf700 10344810 103ee010 f0400004\n" },
2555 { -1, "r16-19 f00008c4 f000017c f0000174 00000000\n" },
2556 { -1, "r20-23 fed32840 fed32800 00000000 0000000a\n" },
2557 { -1, "r24-27 0000ffa0 000000ff 103fc2e0 10326010\n" },
2558 { -1, "r28-31 00000000 00061a80 4ff98340 10208f34\n" },
2559 { -1, "sr0-3 00000000 00000000 00000000 00000000\n" },
2560 { -1, "sr4-7 00000000 00000000 00000000 00000000\n" },
2562 { -1, "IASQ: 00000000 00000000 IAOQ: 00000000 00000004\n" },
2563 { -1, " IIR: 00000000 ISR: 00000000 IOR: 00000000\n" },
2564 { -1, " CPU: 0 CR30: 4ff98000 CR31: 1037c000\n" },
2565 { -1, " ORIG_R28: 55555555\n" },
2566 { -1, " IAOQ[0]: 0x0\n" },
2567 { -1, " IAOQ[1]: 0x4\n" },
2568 { -1, " RP(r2): probe_hwif+0x218/0x44c\n" },
2569 { -1, "Kernel panic: Attempted to kill init!\n" },
2572 XGetWindowAttributes (dpy, window, &xgwa);
2573 XSetWindowBackground (dpy, window,
2574 get_pixel_resource("HPPALinux.background",
2575 "HPPALinux.Background",
2576 dpy, xgwa.colormap));
2577 XClearWindow(dpy, window);
2584 if (uname (&uts) >= 0)
2585 sysname = uts.nodename;
2586 s = strchr (sysname, '.');
2589 # endif /* !HAVE_UNAME */
2591 /* Insert current host name into banner on line 2 */
2593 static char ss[1024];
2594 sprintf (ss, linux_panic[1].string, sysname);
2595 linux_panic[1].string = ss;
2598 ts = make_scrolling_window (dpy, window, "HPPALinux", False);
2601 while (linux_panic[i].string)
2603 if (linux_panic[i].delay != -1)
2604 linedelay = linux_panic[i].delay * 1000;
2606 scrolling_puts (ts, linux_panic[i].string, 0);
2608 if (bsod_sleep (dpy, 0))
2613 if (bsod_sleep (dpy, 4))
2617 bsod_sleep(dpy, delay);
2620 free_scrolling_window (ts);
2621 XClearWindow(dpy, window);
2624 /* VMS by jwz (text sent by Roland Barmettler <roli@barmettler.net>)
2627 vms (Display *dpy, Window window, int delay)
2629 XWindowAttributes xgwa;
2630 scrolling_window *ts;
2631 const char *sysname;
2633 int dot_delay = 40000;
2634 int chunk_delay = 500000;
2640 __extension__ /* don't warn about "string length is greater than the
2641 length ISO C89 compilers are required to support"
2642 in the following string constant... */
2645 const char *lines[] = {
2646 "%CNXMAN, Lost connection to system #\n"
2647 "%SHADOW-I-VOLPROC, DSA0: shadow master has changed. "
2648 "Dump file WILL be written if system crashes.\n"
2652 "%CNXMAN, Quorum lost, blocking activity\n"
2653 "%CNXMAN, Timed-out lost connection to system #\n"
2654 "%CNXMAN, Timed-out lost connection to system #\n"
2655 "%CNXMAN, Timed-out lost connection to system #\n"
2656 "%CNXMAN, Proposing reconfiguration of the VMScluster\n",
2659 "%CNXMAN, Removed from VMScluster system #\n"
2660 "%CNXMAN, Removed from VMScluster system #\n"
2661 "%CNXMAN, Removed from VMScluster system #\n"
2662 "%CNXMAN, Completing VMScluster state transition\n",
2665 "**** OpenVMS (TM) Alpha Operating system V7.3-1 - BUGCHECK ****\n"
2667 "** Bugcheck code = 000005DC: CLUEXIT, Node voluntarily exiting "
2669 "** Crash CPU: 00 Primary CPU: 00 Active CPUs: 00000001\n"
2670 "** Current Process = NULL\n"
2671 "** Current PSB ID = 00000001\n"
2674 "** Dumping error log buffers to HBVS unit 0\n"
2675 "**** Unable to dump error log buffers to remaining shadow set members\n"
2676 "** Error log buffers not dumped to HBVS unit 200\n"
2678 "** Dumping memory to HBVS unit 0\n"
2679 "**** Starting compressed selective memory dump at #...\n",
2684 "**** Memory dump complete - not all processes or global pages saved\n",
2692 "HALT instruction executed\n"
2693 "PC = ffffffff800c3884\n",
2699 "resetting all I/O buses\n"
2706 XGetWindowAttributes (dpy, window, &xgwa);
2707 ts = make_scrolling_window (dpy, window, "VMS", False);
2708 XClearWindow(dpy,window);
2711 ts->sub_width = xgwa.width;
2712 ts->sub_height = xgwa.height;
2718 if (uname (&uts) >= 0)
2719 sysname = uts.nodename;
2720 s = strchr (sysname, '.');
2723 # endif /* !HAVE_UNAME */
2725 args[0] = malloc (strlen(sysname) + 7);
2726 strcpy (args[0], sysname);
2729 /* Pick three numbers, 1-9, no overlaps. */
2730 ids[0] = 1 + (random() % 9);
2731 do { ids[1] = 1 + (random() % 9); } while (ids[1]==ids[0]);
2732 do { ids[2] = 1 + (random() % 9); } while (ids[2]==ids[0] || ids[2]==ids[1]);
2734 i = strlen(args[0])-1;
2736 args[0][i] = '0' + ids[0];
2739 for (s = args[0]; *s; s++)
2740 if (isalpha(*s)) *s = toupper (*s);
2742 args[1] = strdup (args[0]);
2743 args[2] = strdup (args[0]); args[2][i] = '0' + ids[1];
2744 args[3] = strdup (args[0]); args[3][i] = '0' + ids[2];
2746 args[4] = strdup (args[1]);
2747 args[5] = strdup (args[2]);
2748 args[6] = strdup (args[3]);
2751 time_t t = time ((time_t *) 0);
2752 struct tm *tm = localtime (&t);
2753 args[7] = malloc (30);
2754 strftime (args[7], 29, "%d-%b-%Y %H:%M", tm);
2755 for (s = args[7]; *s; s++)
2756 if (isalpha(*s)) *s = toupper (*s);
2760 for (i = 0; i < countof(lines); i++)
2762 const char *fmt = lines[i];
2763 if (! strcmp (fmt, "..."))
2765 int steps = 180 + (random() % 60);
2766 while (--steps >= 0)
2768 scrolling_puts (ts, ".", 0);
2771 if (bsod_sleep (dpy, 0))
2777 char *fmt2 = malloc (strlen (fmt) * 2 + 1);
2778 for (s = (char *) fmt, s1 = fmt2; *s; s++)
2782 strcpy (s1, args[arg_count++]);
2789 scrolling_puts (ts, fmt2, char_delay);
2791 usleep (chunk_delay);
2792 if (bsod_sleep (dpy, 0))
2798 bsod_sleep(dpy, delay);
2801 free_scrolling_window (ts);
2802 for (i = 0; i < countof (args); i++)
2807 /* HVX (formerly GCOS6) and TPS6 crash
2808 by Brian Garratt <brian-m.garratt@bull.co.uk>
2810 GCOS6 is a Unix-like operating system developed by Honeywell in the
2811 1970s in collaboration with MIT and AT&T (who called their version
2812 UNIX). Both are very much like MULTICS which Honeywell got from GE.
2814 HVX ("High-performance Virtual System on Unix") is an AIX application
2815 which emulates GCOS6 hardware on RS6000-like machines.
2818 hvx (Display *dpy, Window window, int delay)
2820 XWindowAttributes xgwa;
2821 scrolling_window *ts;
2824 int delay2 = 100000;
2825 const char *hvx_panic_1 =
2826 ("(TP) Trap no E Effective address 00000000 Instruction D7DE\n"
2827 "(TP) Registers :\n"
2828 "(TP) B1 -> B7 03801B02 00000000 03880D45 038BABDB 0388AFFD"
2829 " 0389B3F8 03972317\n"
2830 "(TP) R1 -> R7 0001 0007 F10F 090F 0020 0106 0272\n"
2831 "(TP) P I Z M1 0388A18B 3232 0000 FF00\n"
2832 "(TP) Program counter is at offset 0028 from string YTPAD\n"
2833 "(TP) User id of task which trapped is LT 626\n"
2836 const char *hvx_panic_2 =
2839 "Core dumps initiated for selected HVX processes ...\n"
2840 "Core dumps complete.\n"
2841 "Fri Jul 19 15:53:09 2002\n"
2842 "Live registers for cp 0:\n"
2843 " P = 7de3 IW=0000 I=32 CI=30000000 S=80006013"
2844 " IV=aa0 Level=13\n"
2845 " R1-7 = 1f 913 13 4 8 0 0\n"
2846 " B1-7 = 64e71b a93 50e 64e73c 6c2c 7000 b54\n"
2847 "Memory dump starting to file /var/hvx/dp01/diag/Level2 ...\n"
2848 "Memory dump complete.\n"
2851 XGetWindowAttributes (dpy, window, &xgwa);
2852 ts = make_scrolling_window (dpy, window, "HVX", False);
2853 XClearWindow(dpy, window);
2855 scrolling_puts (ts, hvx_panic_1, delay1);
2856 if (bsod_sleep(dpy, 1)) goto DONE;
2857 scrolling_puts (ts, " TP CLOSE ALL", delay2);
2858 scrolling_puts (ts, "\n(TP)?\n", delay1);
2859 if (bsod_sleep(dpy, 1)) goto DONE;
2860 scrolling_puts (ts, " TP ABORT -LT ALL", delay2);
2861 scrolling_puts (ts, "\n(TP)?\n", delay1);
2862 if (bsod_sleep(dpy, 1)) goto DONE;
2863 scrolling_puts (ts, " TP STOP KILL", delay2);
2864 scrolling_puts (ts, hvx_panic_2, delay1);
2866 bsod_sleep(dpy, delay);
2868 XClearWindow(dpy, window);
2874 /* HPUX panic, by Tobias Klausmann <klausman@schwarzvogel.de>
2878 hpux (Display* dpy, Window window, int delay)
2880 XWindowAttributes xgwa;
2881 scrolling_window *ts;
2882 const char *sysname;
2886 __extension__ /* don't warn about "string length is greater than the
2887 length ISO C89 compilers are required to support"
2888 in the following string constant... */
2894 " ******* Unexpected HPMC/TOC. Processor HPA FFFFFFFF'"
2895 "FFFA0000 *******\n"
2896 " GENERAL REGISTERS:\n"
2897 "r00/03 00000000'00000000 00000000'00000000 00000000'00000000 00000000'"
2899 "r04/07 00000000'00000001 00000000'0126E328 00000000'00000000 00000000'"
2901 "r08/11 00000000'00000000 00000000'0198CFC0 00000000'000476FE 00000000'"
2903 "r12/15 00000000'40013EE8 00000000'08000080 00000000'4002530C 00000000'"
2905 "r16/19 00000000'7F7F2A00 00000000'00000001 00000000'00000000 00000000'"
2907 "r20/23 00000000'006C8048 00000000'00000001 00000000'00000000 00000000'"
2909 "r24/27 00000000'00000000 00000000'00000000 00000000'00000000 00000000'"
2911 "r28/31 00000000'00000000 00000000'007DD628 00000000'0199F2B0 00000000'"
2913 " CONTROL REGISTERS:\n"
2914 "sr0/3 00000000'0F3B4000 00000000'0C2A2000 00000000'016FF800 00000000'"
2916 "sr4/7 00000000'00000000 00000000'016FF800 00000000'0DBF1400 00000000'"
2918 "pcq = 00000000'00000000.00000000'00104950 00000000'00000000.00000000'"
2920 "isr = 00000000'10240006 ior = 00000000'67D9E220 iir = 08000240 rctr = "
2923 "pid reg cr8/cr9 00007700'0000B3A9 00000000'0000C5D8\n"
2924 "pid reg cr12/cr13 00000000'00000000 00000000'00000000\n"
2925 "ipsw = 000000FF'080CFF1F iva = 00000000'0002C000 sar = 3A ccr = C0\n"
2926 "tr0/3 00000000'006C76C0 00000000'00000001 00000000'00000000 00000000'"
2928 "tr4/7 00000000'03790000 0000000C'4FB68340 00000000'C07EE13F 00000000'"
2930 "eiem = FFFFFFF0'FFFFFFFF eirr = 80000000'00000000 itmr = 0000000C'"
2932 "cr1/4 00000000'00000000 00000000'00000000 00000000'00000000 00000000'"
2934 "cr5/7 00000000'00000000 00000000'00000000 00000000'"
2936 " MACHINE CHECK PARAMETERS:\n"
2937 "Check Type = 00000000 CPU STATE = 9E000001 Cache Check = 00000000\n"
2938 "TLB Check = 00000000 Bus Check = 00000000 PIM State = ? SIU "
2939 "Status = ????????\n"
2940 "Assists = 00000000 Processor = 00000000\n"
2941 "Slave Addr = 00000000'00000000 Master Addr = 00000000'00000000\n"
2944 "TOC, pcsq.pcoq = 0'0.0'104950 , isr.ior = 0'10240006.0'67d9e220\n"
2945 "@(#)B2352B/9245XB HP-UX (B.11.00) #1: Wed Nov 5 22:38:19 PST 1997\n"
2946 "Transfer of control: (display==0xd904, flags==0x0)\n"
2950 "*** A system crash has occurred. (See the above messages for details.)\n"
2951 "*** The system is now preparing to dump physical memory to disk, for use\n"
2952 "*** in debugging the crash.\n"
2954 "*** The dump will be a SELECTIVE dump: 40 of 256 megabytes.\n"
2955 "*** To change this dump type, press any key within 10 seconds.\n"
2956 "*** Proceeding with selective dump.\n"
2958 "*** The dump may be aborted at any time by pressing ESC.\n";
2960 "\n*** System rebooting.\n";
2962 XGetWindowAttributes (dpy, window, &xgwa);
2963 ts = make_scrolling_window (dpy, window, "HPUX", False);
2964 XClearWindow(dpy,window);
2965 ts->columns = 10000; /* never wrap */
2968 ts->sub_width = xgwa.width;
2969 ts->sub_height = xgwa.height;
2976 if (uname (&uts) >= 0)
2977 sysname = uts.nodename;
2978 s = strchr (sysname, '.');
2981 # endif /* !HAVE_UNAME */
2983 if (bsod_sleep (dpy, 1))
2991 sprintf (buf, "%.100s [HP Release B.11.00] (see /etc/issue)\n", sysname);
2992 scrolling_puts (ts, buf, 0);
2993 if (bsod_sleep (dpy, 1))
2995 scrolling_puts (ts, msg1, 0);
3000 for (i = 0; i <= steps; i++)
3002 if (i > steps) i = steps;
3004 "*** Dumping: %3d%% complete (%d of 40 MB) (device 64:0x2)\r",
3007 scrolling_puts (ts, buf, 0);
3010 if (bsod_sleep (dpy, 0))
3015 scrolling_puts (ts, msg2, 0);
3018 bsod_sleep(dpy, delay);
3021 free_scrolling_window (ts);
3026 /* IBM OS/390 aka MVS aka z/OS.
3027 Text from Dan Espen <dane@mk.telcordia.com>.
3028 Apparently this isn't actually a crash, just a random session...
3033 os390 (Display* dpy, Window window, int delay)
3037 XWindowAttributes xgwa;
3038 scrolling_window *ts;
3041 const char *msg[] = {
3042 "* ISPF Subtask abend *\n",
3043 "SPF ENDED DUE TO ERROR+\n",
3046 "IEA995I SYMPTOM DUMP OUTPUT\n",
3047 " USER COMPLETION CODE=0222\n",
3048 " TIME=23.00.51 SEQ=03210 CPU=0000 ASID=00AE\n",
3049 " PSW AT TIME OF ERROR 078D1000 859DAF18 ILC 2 INTC 0D\n",
3050 " NO ACTIVE MODULE FOUND\n",
3052 " DATA AT PSW 059DAF12 - 00181610 0A0D9180 70644710\n",
3053 " AR/GR 0: 00000000/80000000 1: 00000000/800000DE\n",
3054 " 2: 00000000/196504DC 3: 00000000/00037A78\n",
3055 " 4: 00000000/00037B78 5: 00000000/0003351C\n",
3056 " 6: 00000000/0000F0AD 7: 00000000/00012000\n",
3057 " 8: 00000000/059DAF10 9: 00000000/0002D098\n",
3058 " A: 00000000/059D9F10 B: 00000000/059D8F10\n",
3059 " C: 00000000/859D7F10 D: 00000000/00032D60\n",
3060 " E: 00000000/00033005 F: 01000002/00000041\n",
3061 " END OF SYMPTOM DUMP\n",
3062 "ISPS014 - ** Logical screen request failed - abend 0000DE **\n",
3063 "ISPS015 - ** Contact your system programmer or dialog developer.**\n",
3064 "*** ISPF Main task abend ***\n",
3065 "IEA995I SYMPTOM DUMP OUTPUT\n",
3066 " USER COMPLETION CODE=0222\n",
3067 " TIME=23.00.52 SEQ=03211 CPU=0000 ASID=00AE\n",
3068 " PSW AT TIME OF ERROR 078D1000 8585713C ILC 2 INTC 0D\n",
3069 " ACTIVE LOAD MODULE ADDRESS=05855000 OFFSET=0000213C\n",
3071 " DATA AT PSW 05857136 - 00181610 0A0D9180 D3304770\n",
3072 " GR 0: 80000000 1: 800000DE\n",
3073 " 2: 00015260 3: 00000038\n",
3074 " 4: 00012508 5: 00000000\n",
3075 " 6: 000173AC 7: FFFFFFF8\n",
3076 " 8: 05858000 9: 00012CA0\n",
3077 " A: 05857000 B: 05856000\n",
3078 " C: 85855000 D: 00017020\n",
3079 " E: 85857104 F: 00000000\n",
3080 " END OF SYMPTOM DUMP\n",
3085 XGetWindowAttributes (dpy, window, &xgwa);
3086 ts = make_scrolling_window (dpy, window, "OS390", False);
3087 ts->columns = 10000; /* never wrap */
3090 ts->sub_width = xgwa.width;
3091 ts->sub_height = xgwa.height;
3093 gcv.foreground = get_pixel_resource ("390.background", "390.Background",
3094 dpy, xgwa.colormap);
3095 gc = XCreateGC (dpy, window, GCForeground, &gcv);
3096 XFillRectangle (dpy, window, gc, 0, 0, xgwa.width, xgwa.height);
3099 for (i = 0; i < countof (msg); i++)
3101 scrolling_puts (ts, msg[i], 0);
3103 if (bsod_sleep(dpy, 0)) goto DONE;
3107 bsod_sleep(dpy, delay);
3109 free_scrolling_window (ts);
3115 /* Compaq Tru64 Unix panic, by jwz as described by
3116 Tobias Klausmann <klausman@schwarzvogel.de>
3120 tru64 (Display* dpy, Window window, int delay)
3122 XWindowAttributes xgwa;
3123 scrolling_window *ts;
3124 const char *sysname;
3128 __extension__ /* don't warn about "string length is greater than the
3129 length ISO C89 compilers are required to support"
3130 in the following string constant... */
3134 ("panic (cpu 0): trap: illegal instruction\n"
3135 "kernel inst fault=gentrap, ps=0x5, pc=0xfffffc0000593878, inst=0xaa\n"
3136 "kernel inst fault=gentrap, ps=0x5, pc=0xfffffc0000593878, inst=0xaa\n"
3138 "DUMP: blocks available: 1571600\n"
3139 "DUMP: blocks wanted: 100802 (partial compressed dump) [OKAY]\n"
3140 "DUMP: Device Disk Blocks Available\n"
3141 "DUMP: ------ ---------------------\n"
3142 "DUMP: 0x1300023 1182795 - 1571597 (of 1571598) [primary swap]\n"
3143 "DUMP.prom: Open: dev 0x5100041, block 2102016: SCSI 0 11 0 2 200 0 0\n"
3144 "DUMP: Writing header... [1024 bytes at dev 0x1300023, block 1571598]\n"
3145 "DUMP: Writing data");
3147 ("DUMP: Writing header... [1024 bytes at dev 0x1300023, block 1571598]\n"
3148 "DUMP: crash dump complete.\n"
3149 "kernel inst fault=gentrap, ps=0x5, pc=0xfffffc0000593878, inst=0xaa\n"
3151 "DUMP: second crash dump skipped: 'dump_savecnt' enforced.\n");
3157 "HALT instruction executed\n"
3158 "PC = fffffc00005863b0\n");
3166 XGetWindowAttributes (dpy, window, &xgwa);
3167 ts = make_scrolling_window (dpy, window, "Tru64", False);
3168 XClearWindow(dpy,window);
3169 ts->columns = 10000; /* never wrap */
3172 ts->sub_width = xgwa.width;
3173 ts->sub_height = xgwa.height;
3175 sysname = "127.0.0.1";
3179 if (uname (&uts) >= 0)
3180 sysname = uts.nodename;
3182 # endif /* !HAVE_UNAME */
3184 if (bsod_sleep (dpy, 1))
3190 "Compaq Tru64 UNIX V5.1B (Rev. 2650) (%.100s) console\n"
3194 scrolling_puts (ts, buf, 0);
3195 if (bsod_sleep (dpy, 6))
3198 scrolling_puts (ts, msg1, 0);
3201 int steps = 4 + (random() % 8);
3202 for (i = 0; i < steps; i++)
3204 scrolling_puts (ts, ".", 0);
3206 if (bsod_sleep (dpy, 1))
3209 sprintf (buf, "[%dMB]\n", steps);
3210 scrolling_puts (ts, buf, 0);
3213 scrolling_puts (ts, msg2, 0);
3215 if (bsod_sleep (dpy, 4))
3218 scrolling_puts (ts, msg3, 0);
3220 if (bsod_sleep (dpy, 3))
3223 scrolling_puts (ts, msg4, 0);
3225 bsod_sleep(dpy, delay);
3228 free_scrolling_window (ts);
3234 * Simulate various Apple ][ crashes. The memory map encouraged many programs
3235 * to use the primary hi-res video page for various storage, and the secondary
3236 * hi-res page for active display. When it crashed into Applesoft or the
3237 * monitor, it would revert to the primary page and you'd see memory garbage on
3238 * the screen. Also, it was common for copy-protected games to use the primary
3239 * text page for important code, because that made it really hard to
3240 * reverse-engineer them. The result often looked like what this generates.
3242 * The Apple ][ logic and video hardware is in apple2.c. The TV is emulated by
3243 * analogtv.c for maximum realism
3245 * Trevor Blackwell <tlb@tlb.org>
3248 static char * apple2_basic_errors[]={
3252 "RETURN WITHOUT GOSUB",
3256 "BAD SUBSCRIPT ERROR",
3259 "FORMULA TOO COMPLEX",
3264 "DEFAULT ARGUMENTS ARE NOT ALLOWED IN DECLARATION OF FRIEND "
3265 "TEMPLATE SPECIALIZATION"
3269 static char * apple2_dos_errors[]={
3273 "NO BUFFERS AVAILABLE",
3274 "PROGRAM TOO LARGE",
3277 void a2controller_crash(apple2_sim_t *sim, int *stepno,
3278 double *next_actiontime)
3280 apple2_state_t *st=sim->st;
3289 if (!sim->controller_data)
3290 sim->controller_data = calloc(sizeof(struct mydata),1);
3291 mine=(struct mydata *) sim->controller_data;
3296 a2_init_memory_active(sim);
3297 sim->dec->powerup = 1000.0;
3299 if (random()%3==0) {
3301 *next_actiontime+=0.4;
3304 else if (random()%4==0) {
3305 st->gr_mode=A2_GR_LORES;
3306 if (random()%3==0) st->gr_mode |= A2_GR_FULL;
3307 *next_actiontime+=0.4;
3310 else if (random()%2==0) {
3311 st->gr_mode=A2_GR_HIRES;
3315 st->gr_mode=A2_GR_HIRES;
3316 *next_actiontime+=0.4;
3322 /* An illegal instruction or a reset caused it to drop into the
3323 assembly language monitor, where you could disassemble code & view
3325 if (random()%3==0) {
3328 int addr=0xd000+random()%0x3000;
3330 "%02X",random()%0xff);
3333 sprintf(sim->printing_buf,
3336 " A=%02X X=%02X Y=%02X S=%02X F=%02X\n"
3339 random()%0xff, random()%0xff,
3340 random()%0xff, random()%0xff,
3342 sim->printing=sim->printing_buf;
3350 *next_actiontime += 2.0 + (random()%1000)*0.0002;
3353 /* Lots of programs had at least their main functionality in
3354 Applesoft Basic, which had a lot of limits (memory, string
3355 length, etc) and would sometimes crash unexpectedly. */
3356 sprintf(sim->printing_buf,
3362 apple2_basic_errors[random() %
3363 (sizeof(apple2_basic_errors)
3365 (1000*(random()%(random()%59+1)) +
3366 100*(random()%(random()%9+1)) +
3367 5*(random()%(random()%199+1)) +
3368 1*(random()%(random()%(random()%2+1)+1))));
3369 sim->printing=sim->printing_buf;
3373 *next_actiontime += 2.0 + (random()%1000)*0.0002;
3378 if (random()%3==0) {
3379 /* This was how you reset the Basic interpreter. The sort of
3380 incantation you'd have on a little piece of paper taped to the
3381 side of your machine */
3382 sim->typing="CALL -1370";
3385 else if (random()%2==0) {
3386 sim->typing="CATALOG\n";
3390 *next_actiontime+=1.0;
3397 *next_actiontime += 0.5;
3404 for (s="APPLE ]["; *s; s++) a2_printc(st,*s);
3407 *next_actiontime+=1.0;
3412 if (random()%50==0) {
3413 sprintf(sim->printing_buf,
3414 "\nDISK VOLUME 254\n\n"
3418 sim->printing=sim->printing_buf;
3421 sprintf(sim->printing_buf,"\n?%s\n]",
3422 apple2_dos_errors[random()%
3423 (sizeof(apple2_dos_errors) /
3425 sim->printing=sim->printing_buf;
3428 *next_actiontime+=1.0;
3432 if (random()%2==0) {
3433 /* This was how you went back to text mode in the monitor */
3434 sim->typing="FB4BG";
3437 *next_actiontime+=1.0;
3448 *next_actiontime+=2.0;
3452 /* This reset things into Basic */
3453 if (random()%2==0) {
3454 sim->typing="FAA6G";
3459 *next_actiontime+=sim->delay;
3464 for (i=0; i<1500; i++) {
3465 a2_poke(st, mine->fillptr, mine->fillbyte);
3467 mine->fillbyte = (mine->fillbyte+1)&0xff;
3469 *next_actiontime += 0.08;
3470 /* When you hit c000, it changed video settings */
3471 if (mine->fillptr>=0xc000) {
3475 /* And it seemed to reset around here, I dunno why */
3476 if (mine->fillptr>=0xcf00) *stepno=130;
3482 case A2CONTROLLER_FREE:
3489 apple2crash (Display* dpy, Window window, int delay)
3491 apple2 (dpy, window, delay, a2controller_crash);
3497 msdos (Display *dpy, Window window, int delay)
3499 XWindowAttributes xgwa;
3500 scrolling_window *ts;
3503 int delay2 = 200000;
3505 # define CURSOR "_\b \b"
3506 # define CURSOR2 CURSOR CURSOR CURSOR
3508 XGetWindowAttributes (dpy, window, &xgwa);
3509 ts = make_scrolling_window (dpy, window, "MSDOS", False);
3511 XClearWindow(dpy, window);
3513 scrolling_puts (ts, "C:\\WINDOWS>", delay1);
3514 if (bsod_sleep(dpy, 1)) goto DONE;
3516 scrolling_puts (ts, CURSOR2 "dir a:", delay2);
3517 if (bsod_sleep(dpy, 1)) goto DONE;
3519 scrolling_puts (ts, "\nNot ready reading drive A\nAbort, Retry, Fail?",
3521 if (bsod_sleep(dpy, 1)) goto DONE;
3523 scrolling_puts (ts, CURSOR2 "f", delay2);
3524 if (bsod_sleep(dpy, 1)) goto DONE;
3526 scrolling_puts (ts, "\n\n\nNot ready reading drive A\nAbort, Retry, Fail?",
3528 if (bsod_sleep(dpy, 1)) goto DONE;
3530 scrolling_puts (ts, CURSOR2 "f", delay2);
3531 if (bsod_sleep(dpy, 1)) goto DONE;
3533 scrolling_puts (ts, "\nVolume in drive A has no label\n\n"
3534 "Not ready reading drive A\nAbort, Retry, Fail?",
3536 if (bsod_sleep(dpy, 1)) goto DONE;
3538 scrolling_puts (ts, CURSOR2 "a", delay2);
3539 if (bsod_sleep(dpy, 1)) goto DONE;
3541 scrolling_puts (ts, "\n\nC:\\WINDOWS>", delay1);
3544 time_t start = time((time_t *) 0);
3545 while (start + delay > time((time_t *) 0))
3546 if (scrolling_puts (ts, CURSOR, delay2))
3551 XClearWindow(dpy, window);
3559 * OS/2 panics, by Knut St. Osmundsen <bird-xscreensaver@anduin.net>
3561 * All but one messages are real ones, some are from my test machines
3562 * and system dumps, others are reconstructed from google results.
3563 * Please, don't be to hard if the formatting of the earlier systems
3564 * aren't 100% correct.
3567 os2 (Display *dpy, Window window, int delay)
3570 XWindowAttributes xgwa;
3574 const char *def_font = "fixed";
3576 const char *panic_msg;
3583 __extension__ /* don't warn about "string length is greater than the
3584 length ISO C89 compilers are required to support"
3585 in the following string constant... */
3588 static const char *os2_panics[] =
3589 { /* OS/2 2.0 trap - details are bogus (CR0++). */
3590 "TRAP 0002 ERRCD=0000 ERACC=**** ERLIM=********\n"
3591 "EAX=7d240a58 EBX=ff202fdc ECX=00064423 EDX=00003624\n"
3592 "ESI=fff3272c EDI=7d240004 EBP=00004a44 FLG=00003202\n"
3593 "CS:EIP=0160:fff702a6 CSACC=c09d CSLIM=ffffffff\n"
3594 "SS:ESP=0030:00004a38 SSACC=1097 SSLIM=00003fff\n"
3595 "DS=0158 DSACC=c0f3 DSLIM=ffffffff CR0=fffffffb\n"
3596 "ES=0158 ESACC=c0f3 ESLIM=ffffffff CR2=1a060014\n"
3597 "FS=0000 FSACC=**** FSLIM=********\n"
3598 "GS=0000 GSACC=**** GSLIM=********\n"
3600 "The system detected an internal processing error\n"
3601 "at location ##0160:fff6453f - 000d:a53f\n"
3605 "Internal revision 6.307, 92/03/01\n"
3608 /* warp 3 (early) */
3609 "TRAP 000e ERRCD=0000 ERACC=**** ERLIM=********\n"
3610 "EAX=ff050c20 EBX=000000bb ECX=ffff00c1 EDx=fff379b8\n"
3611 "ESI=ffe55a3c EDI=00000000 EBP=00004eb8 FLG=00013282\n"
3612 "CS:EIP=0160:fff8dbb8 CSACC=c09b CSLIM=ffffffff\n"
3613 "SS:EIP=0030:00004eb4 SSACC=1097 SSLIM=00003fff\n"
3614 "DS=0158 DSACC=c0f3 DSLIM=ffffffff CR0=8001001b\n"
3615 "ES=0158 DSACC=c0f3 DSLIM=ffffffff CR2=000000c7\n"
3616 "FS=0000 FSACC=**** FSLIM=********\n"
3617 "GS=0000 GSACC=**** GSLIM=********\n"
3619 "The system detected an internal processing error\n"
3620 "at location ##0160:fff66bf0 - 000d:9bf0.\n"
3624 "Internal revision 8.125, 94/02/16\n"
3626 "The system is stopped. Record the location number of the error\n"
3627 "and contact your service representative.\n",
3630 "TRAP 000e ERRCD=0002 ERACC=**** ERLIM=********\n"
3631 "EAX=00000000 EBX=fdef1e0c ECX=00003824 EDX=0000edf9\n"
3632 "ESI=fdf30e80 EDI=fc8b0000 EBP=00005658 FLG=00012246\n"
3633 "CS:EIP=0160:fff8ada3 CSACC=c09b CSLIM=ffffffff\n"
3634 "SS:ESP=0030:000055d4 SSACC=1097 SSLIM=0000480f\n"
3635 "DS=0158 DSACC=c093 DSLIM=ffffffff CR0=8001001b\n"
3636 "ES=0158 ESACC=c093 ESLIM=ffffffff CR2=fc8b0000\n"
3637 "FS=03b8 FSACC=0093 FSLIM=00000023\n"
3638 "GS=0000 GSACC=**** GSLIM=********\n"
3640 "The system detected an internal processing error\n"
3641 "at location ##0160:fff5c364 - 000d:a364.\n"
3645 "Internal revision 8200,94/11/07\n"
3647 "The system is stopped. Record all of the above information and\n"
3648 "contact your service representative.\n",
3651 "TRAP 000d ERRCD=2200 ERACC=1092 ERLIM=00010fff\n"
3652 "EAX=0000802e EBX=fff001c8 ECX=9bd80000 EDX=00000000\n"
3653 "ESI=fff09bd8 EDI=fdeb001b EBP=00000000 FLG=00012012\n"
3654 "CS:EIP=0168:fff480a2 CSACC=c09b CSLIM=ffffffff\n"
3655 "SS:ESP=00e8:00001f32 SSACC=0093 SSLIM=00001fff\n"
3656 "DS=0940 DSACC=0093 DSLIM=00000397 CR0=8001001b\n"
3657 "ES=00e8 ESACC=0093 ESLIM=00001fff CR2=15760008\n"
3658 "FS=0000 FSACC=**** FSLIM=****\n"
3659 "GS=0000 GSACC=**** GSLIM=****\n"
3661 "The system detected an internal processing error\n"
3662 "at location ##0168:fff4b06e - 000e:c06e\n"
3666 "Internal revision 8.259_uni,98/01/07\n"
3668 "The system is stopped. Record all of the above information and\n"
3669 "contact your service representative.\n",
3671 /* Warp 4.52+ - the official r0trap.exe from the debugging classes */
3672 "Exception in module: OS2KRNL\n"
3673 "TRAP 000e ERRCD=0002 ERACC=**** ERLIM=********\n"
3674 "EAX=00000001 EBX=80010002 ECX=ffed4638 EDX=0003f17b\n"
3675 "ESI=00000001 EDI=00000002 EBP=00005408 FLG=00012202\n"
3676 "CS:EIP=0168:fff3cd2e CSACC=c09b CSLIM=ffffffff\n"
3677 "SS:ESP=0030:000053ec SSACC=1097 SSLIM=000044ff\n"
3678 "DS=0160 DSACC=c093 DSLIM=ffffffff CR0=8001001b\n"
3679 "ES=0160 ESACC=c093 ESLIM=ffffffff CR2=00000001\n"
3680 "FS=0000 FSACC=**** FSLIM=********\n"
3681 "GS=0000 GSACC=**** GSLIM=********\n"
3683 "The system detected an internal processing error at\n"
3684 "location ##0168:fff1e3f3 - 000e:c3f3.\n"
3688 "Internal revision 14.097_UNI\n"
3690 "The system is stopped. Record all of the above information and\n"
3691 "contact your service representative.\n",
3693 /* Warp 4.52+, typical JFS problem. */
3694 "Exeption in module: JFS\n"
3695 "TRAP 0003 ERRCD=0000 ERACC=**** ERLIM=********\n"
3696 "EAX=00000000 EBX=ffffff05 ECX=00000001 EDX=f5cd8010\n"
3697 "ESI=000000e6 EDI=000000e7 EBP=f9c7378e FLG=00002296\n"
3698 "CS:EIP=0168:f8df3250 CSACC=c09b CSLIM=ffffffff\n"
3699 "SS:ESP=1550:fdc73778 SSACC=c093 SSLIM=ffffffff\n"
3700 "DS=0160 DSACC=c093 DSLIM=ffffffff CR0=80010016\n"
3701 "ES=0160 ESACC=c093 DSLIM=ffffffff CR2=05318000\n"
3702 "FS=03c0 FSACC=0093 DSLIM=00000023\n"
3703 "GS=0160 GSACC=c093 DSLIM=ffffffff\n"
3705 "The system detected an internal processing error\n"
3706 "at location ##0168:fff1e2ab - 000e:c2ab.\n"
3711 "Internal revision 14.100c_UNI\n"
3713 "The system is stopped. Record all of the above information and\n"
3714 "contact your service representative.\n"
3717 i = random() % countof(os2_panics);
3718 panic_msg = os2_panics[i];
3720 XGetWindowAttributes(dpy, window, &xgwa);
3721 fontname = get_string_resource((xgwa.height > 1000
3722 ? "OS2.font3" : xgwa.height > 600
3723 ? "OS2.font2" : "OS2.font"),
3725 if (!fontname || !*fontname)
3726 fontname = (char *)def_font;
3727 font = XLoadQueryFont(dpy, fontname);
3729 font = XLoadQueryFont(dpy, def_font);
3732 if (fontname && fontname != def_font)
3735 gcv.font = font->fid;
3736 gcv.foreground = get_pixel_resource("OS2.foreground",
3738 dpy, xgwa.colormap);
3739 gcv.background = get_pixel_resource("OS2.background",
3741 dpy, xgwa.colormap);
3742 XSetWindowBackground(dpy, window, gcv.background);
3743 XClearWindow(dpy, window);
3745 gc = XCreateGC(dpy, window, GCFont|GCForeground|GCBackground, &gcv);
3747 /* draw the text, calc the cursor location and make it blink. */
3748 line_height = font->ascent + font->descent;
3749 draw_string(dpy, window, gc, &gcv, font, 0, 0, 10, 10, panic_msg, 0);
3751 y = line_height * 2;
3752 str = panic_msg - 1;
3753 while ((str = strchr(str + 1, '\n')) != NULL)
3756 start = time((time_t *) 0);
3757 while (start + delay > time((time_t *) 0))
3759 XDrawImageString(dpy, window, gc, 0, y, "_", 1);
3762 XDrawImageString(dpy, window, gc, 0, y, " ", 2);
3765 if (bsod_sleep(dpy, 0))
3771 XClearWindow(dpy, window);
3772 XFreeFont(dpy, font);
3778 char *progclass = "BSOD";
3780 char *defaults [] = {
3793 "*doAtari: False", /* boring */
3794 "*doBSD: False", /* boring */
3796 "*doSparcLinux: False", /* boring */
3797 "*doHPPALinux: True",
3798 "*doBlitDamage: True",
3809 ".Windows.font: -*-courier-bold-r-*-*-*-120-*-*-m-*-*-*",
3810 ".Windows.font2: -*-courier-bold-r-*-*-*-180-*-*-m-*-*-*",
3811 ".Windows.foreground: White",
3812 ".Windows.background: #0000AA", /* EGA color 0x01. */
3813 ".windowsLH.background: #AA0000", /* EGA color 0x04. */
3814 ".windowsLH.background2: #AAAAAA", /* EGA color 0x07. */
3816 ".Amiga.font: -*-courier-bold-r-*-*-*-120-*-*-m-*-*-*",
3817 ".Amiga.font2: -*-courier-bold-r-*-*-*-180-*-*-m-*-*-*",
3818 ".Amiga.foreground: Red",
3819 ".Amiga.background: Black",
3820 ".Amiga.background2: White",
3822 ".Mac.font: -*-courier-bold-r-*-*-*-120-*-*-m-*-*-*",
3823 ".Mac.foreground: PaleTurquoise1",
3824 ".Mac.background: Black",
3826 ".Atari.foreground: Black",
3827 ".Atari.background: White",
3829 ".MacsBug.font: -*-courier-medium-r-*-*-*-100-*-*-m-*-*-*",
3830 ".MacsBug.font2: -*-courier-bold-r-*-*-*-120-*-*-m-*-*-*",
3831 ".MacsBug.font3: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*",
3832 ".MacsBug.foreground: Black",
3833 ".MacsBug.background: White",
3834 ".MacsBug.borderColor: #AAAAAA",
3836 ".mac1.foreground: Black",
3837 ".mac1.background: White",
3839 ".macX.textForeground: White",
3840 ".macX.textBackground: Black",
3841 ".macX.background: #888888",
3842 ".macX.font: -*-courier-bold-r-*-*-*-120-*-*-m-*-*-*",
3843 ".macX.font2: -*-courier-bold-r-*-*-*-240-*-*-m-*-*-*",
3845 ".SCO.font: -*-courier-bold-r-*-*-*-120-*-*-m-*-*-*",
3846 ".SCO.font2: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*",
3847 ".SCO.foreground: White",
3848 ".SCO.background: Black",
3850 ".HVX.font: -*-courier-bold-r-*-*-*-120-*-*-m-*-*-*",
3851 ".HVX.font2: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*",
3852 ".HVX.foreground: White",
3853 ".HVX.background: Black",
3855 ".Linux.font: 9x15bold",
3856 ".Linux.font2: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*",
3857 ".Linux.foreground: White",
3858 ".Linux.background: Black",
3860 ".HPPALinux.font: -*-courier-bold-r-*-*-*-120-*-*-m-*-*-*",
3861 ".HPPALinux.font2: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*",
3862 ".HPPALinux.foreground: White",
3863 ".HPPALinux.background: Black",
3865 ".SparcLinux.font: -*-courier-bold-r-*-*-*-120-*-*-m-*-*-*",
3866 ".SparcLinux.font2: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*",
3867 ".SparcLinux.foreground: White",
3868 ".SparcLinux.background: Black",
3871 ".BSD.font: -*-courier-bold-r-*-*-*-120-*-*-m-*-*-*",
3872 ".BSD.font2: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*",
3873 /* ".BSD.font2: -sun-console-medium-r-*-*-22-*-*-*-m-*-*-*", */
3874 ".BSD.foreground: #c0c0c0",
3875 ".BSD.background: Black",
3877 ".Solaris.font: -sun-gallant-*-*-*-*-19-*-*-*-*-120-*-*",
3878 ".Solaris.font2: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*",
3879 ".Solaris.foreground: Black",
3880 ".Solaris.background: White",
3881 "*dontClearRoot: True",
3883 ".HPUX.font: 9x15bold",
3884 ".HPUX.font2: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*",
3885 ".HPUX.foreground: White",
3886 ".HPUX.background: Black",
3888 ".OS390.font: 9x15bold",
3889 ".OS390.font2: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*",
3890 ".OS390.background: Black",
3891 ".OS390.foreground: Red",
3893 ".Tru64.font: 9x15bold",
3894 ".Tru64.font2: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*",
3895 ".Tru64.foreground: White",
3896 ".Tru64.background: #0000AA", /* EGA color 0x01. */
3898 "*apple2TVColor: 50",
3900 "*apple2TVBrightness: 10",
3901 "*apple2TVContrast: 90",
3902 "*apple2SimulateUser: True",
3904 ".VMS.font: 9x15bold",
3905 ".VMS.font2: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*",
3906 ".VMS.foreground: White",
3907 ".VMS.background: Black",
3909 ".MSDOS.font: 9x15bold",
3910 ".MSDOS.font2: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*",
3911 ".MSDOS.foreground: White",
3912 ".MSDOS.background: Black",
3914 ".OS2.font: -*-courier-bold-r-*-*-*-120-*-*-m-*-*-*",
3915 ".OS2.font2: -*-courier-bold-r-*-*-*-180-*-*-m-*-*-*",
3916 ".OS2.font3: -*-courier-bold-r-*-*-*-240-*-*-m-*-*-*",
3917 ".OS2.foreground: White",
3918 ".OS2.background: Black",
3922 #ifdef HAVE_XSHM_EXTENSION
3928 XrmOptionDescRec options [] = {
3929 { "-delay", ".delay", XrmoptionSepArg, 0 },
3930 { "-only", ".doOnly", XrmoptionSepArg, 0 },
3931 { "-windows", ".doWindows", XrmoptionNoArg, "True" },
3932 { "-no-windows", ".doWindows", XrmoptionNoArg, "False" },
3933 { "-nt", ".doNT", XrmoptionNoArg, "True" },
3934 { "-no-nt", ".doNT", XrmoptionNoArg, "False" },
3935 { "-2k", ".doWin2K", XrmoptionNoArg, "True" },
3936 { "-no-2k", ".doWin2K", XrmoptionNoArg, "False" },
3937 { "-amiga", ".doAmiga", XrmoptionNoArg, "True" },
3938 { "-no-amiga", ".doAmiga", XrmoptionNoArg, "False" },
3939 { "-mac", ".doMac", XrmoptionNoArg, "True" },
3940 { "-no-mac", ".doMac", XrmoptionNoArg, "False" },
3941 { "-mac1", ".doMac1", XrmoptionNoArg, "True" },
3942 { "-no-mac1", ".doMac1", XrmoptionNoArg, "False" },
3943 { "-macx", ".doMacX", XrmoptionNoArg, "True" },
3944 { "-no-macx", ".doMacX", XrmoptionNoArg, "False" },
3945 { "-atari", ".doAtari", XrmoptionNoArg, "True" },
3946 { "-no-atari", ".doAtari", XrmoptionNoArg, "False" },
3947 { "-macsbug", ".doMacsBug", XrmoptionNoArg, "True" },
3948 { "-no-macsbug", ".doMacsBug", XrmoptionNoArg, "False" },
3949 { "-apple2", ".doApple2", XrmoptionNoArg, "True" },
3950 { "-no-apple2", ".doApple2", XrmoptionNoArg, "False" },
3951 { "-sco", ".doSCO", XrmoptionNoArg, "True" },
3952 { "-no-sco", ".doSCO", XrmoptionNoArg, "False" },
3953 { "-hvx", ".doHVX", XrmoptionNoArg, "True" },
3954 { "-no-hvx", ".doHVX", XrmoptionNoArg, "False" },
3955 { "-bsd", ".doBSD", XrmoptionNoArg, "True" },
3956 { "-no-bsd", ".doBSD", XrmoptionNoArg, "False" },
3957 { "-linux", ".doLinux", XrmoptionNoArg, "True" },
3958 { "-no-linux", ".doLinux", XrmoptionNoArg, "False" },
3959 { "-hppalinux", ".doHPPALinux", XrmoptionNoArg, "True" },
3960 { "-no-hppalinux", ".doHPPALinux", XrmoptionNoArg, "False" },
3961 { "-sparclinux", ".doSparcLinux", XrmoptionNoArg, "True" },
3962 { "-no-sparclinux", ".doSparcLinux", XrmoptionNoArg, "False" },
3963 { "-blitdamage", ".doBlitDamage", XrmoptionNoArg, "True" },
3964 { "-no-blitdamage", ".doBlitDamage", XrmoptionNoArg, "False" },
3965 { "-nvidia", ".doNvidia", XrmoptionNoArg, "True" },
3966 { "-no-nvidia", ".doNvidia", XrmoptionNoArg, "False" },
3967 { "-solaris", ".doSolaris", XrmoptionNoArg, "True" },
3968 { "-no-solaris", ".doSolaris", XrmoptionNoArg, "False" },
3969 { "-hpux", ".doHPUX", XrmoptionNoArg, "True" },
3970 { "-no-hpux", ".doHPUX", XrmoptionNoArg, "False" },
3971 { "-os390", ".doOS390", XrmoptionNoArg, "True" },
3972 { "-no-os390", ".doOS390", XrmoptionNoArg, "False" },
3973 { "-tru64", ".doHPUX", XrmoptionNoArg, "True" },
3974 { "-no-tru64", ".doTru64", XrmoptionNoArg, "False" },
3975 { "-vms", ".doVMS", XrmoptionNoArg, "True" },
3976 { "-no-vms", ".doVMS", XrmoptionNoArg, "False" },
3977 { "-msdos", ".doMSDOS", XrmoptionNoArg, "True" },
3978 { "-no-msdos", ".doMSDOS", XrmoptionNoArg, "False" },
3979 { "-os2", ".doOS2", XrmoptionNoArg, "True" },
3980 { "-no-os2", ".doOS2", XrmoptionNoArg, "False" },
3988 void (*fn) (Display *, Window, int delay);
3990 { "Windows", windows_31 },
3991 { "NT", windows_nt },
3992 { "Win2K", windows_2k },
3995 { "MacsBug", macsbug },
4000 { "HPPALinux", hppa_linux },
4001 { "SparcLinux", sparc_linux },
4004 { "BlitDamage", blitdamage },
4005 { "Nvidia", nvidia },
4006 { "Solaris", sparc_solaris },
4007 { "Linux", linux_fsck },
4011 { "Apple2", apple2crash },
4019 screenhack (Display *dpy, Window window)
4025 int delay = get_integer_resource ("delay", "Integer");
4026 if (delay < 3) delay = 3;
4029 char *s = get_string_resource("doOnly", "DoOnly");
4032 int count = countof(all_modes);
4033 for (only = 0; only < count; only++)
4034 if (!strcasecmp (s, all_modes[only].name))
4038 fprintf (stderr, "%s: unknown -only mode: \"%s\"\n", progname, s);
4045 if (!get_boolean_resource ("root", "Boolean"))
4047 XWindowAttributes xgwa;
4048 XGetWindowAttributes (dpy, window, &xgwa);
4049 XSelectInput (dpy, window,
4050 xgwa.your_event_mask |
4051 KeyPressMask | ButtonPressMask | ExposureMask);
4057 int count = countof(all_modes);
4058 char name[100], class[100];
4063 do { i = (random() & 0xFF) % count; } while (i == j);
4065 sprintf (name, "do%s", all_modes[i].name);
4066 sprintf (class, "Do%s", all_modes[i].name);
4069 if (only > 0 || get_boolean_resource(name, class))
4071 all_modes[i].fn (dpy, window, delay);
4076 if (loop > 100) j = -1;
4079 fprintf (stderr, "%s: no display modes enabled?\n", progname);