1 /* xscreensaver, Copyright (c) 1998-2004 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 if (which < 0 || which > 2) abort();
341 /* kludge to lump Win2K, WinME, and WinXP together; seems silly to add
342 another preference/command line option just for these little ones. */
343 if (which == 2 && (random() % 2))
344 which = 3 + (random() % 2);
346 XGetWindowAttributes (dpy, window, &xgwa);
348 fontname = get_string_resource ((xgwa.height > 600
349 ? (which == 0 ? "windows95.font2" :
350 which == 1 ? "windowsNT.font2" :
351 which == 2 ? "windows2K.font2" :
353 : (which == 0 ? "windows95.font" :
354 which == 1 ? "windowsNT.font" :
355 which == 2 ? "windows2K.font" :
358 if (!fontname || !*fontname) fontname = (char *)def_font;
359 font = XLoadQueryFont (dpy, fontname);
360 if (!font) font = XLoadQueryFont (dpy, def_font);
362 if (fontname && fontname != def_font)
365 gcv.font = font->fid;
366 gcv.foreground = get_pixel_resource((which == 0 ? "windows95.foreground" :
367 which == 1 ? "windowsNT.foreground" :
368 which == 2 ? "windows2K.foreground" :
369 "windowsME.foreground"),
370 "Windows.Foreground",
372 gcv.background = get_pixel_resource((which == 0 ? "windows95.background" :
373 which == 1 ? "windowsNT.background" :
374 which == 2 ? "windows2K.background" :
375 "windowsME.background"),
376 "Windows.Background",
378 XSetWindowBackground(dpy, window, gcv.background);
379 XClearWindow(dpy, window);
381 gc = XCreateGC(dpy, window, GCFont|GCForeground|GCBackground, &gcv);
384 draw_string(dpy, window, gc, &gcv, font,
385 0, 0, xgwa.width, xgwa.height, w95, 0);
387 draw_string(dpy, window, gc, &gcv, font, 0, 0, 10, 10, wnt, 750);
390 int line_height = font->ascent + font->descent + 1;
392 int y = (xgwa.height / 4);
394 draw_string(dpy, window, gc, &gcv, font, x, y, 10, 10, w2ka, 750);
395 y += line_height * 6;
397 draw_string(dpy, window, gc, &gcv, font, x, y, 10, 10, w2kb, 750);
401 int line_height = font->ascent + font->descent + 1;
404 draw_string(dpy, window, gc, &gcv, font, x, y, 10, 10, wxpa, 750);
405 y += line_height * 26;
407 draw_string(dpy, window, gc, &gcv, font, x, y, 10, 10, wxpb, 750);
411 int line_height = font->ascent + font->descent;
413 int y = (xgwa.height - line_height * 3) / 2;
414 draw_string (dpy, window, gc, &gcv, font, x, y, 10, 10, wmea, 0);
415 y += line_height * 2;
416 x = draw_string (dpy, window, gc, &gcv, font, x, y, 10, 10, wmeb, 0);
420 XDrawImageString (dpy, window, gc, x, y, "_", 1);
423 XDrawImageString (dpy, window, gc, x, y, " ", 1);
426 if (bsod_sleep(dpy, 0))
437 bsod_sleep(dpy, delay);
438 XClearWindow(dpy, window);
439 XFreeFont(dpy, font);
443 windows_31 (Display *dpy, Window window, int delay)
445 windows (dpy, window, delay, 0);
449 windows_nt (Display *dpy, Window window, int delay)
451 windows (dpy, window, delay, 1);
455 windows_2k (Display *dpy, Window window, int delay)
457 windows (dpy, window, delay, 2);
461 /* SCO OpenServer 5 panic, by Tom Kelly <tom@ancilla.toronto.on.ca>
464 sco (Display *dpy, Window window, int delay)
467 XWindowAttributes xgwa;
469 const char *def_font = "fixed";
472 int lines_1 = 0, lines_2 = 0, lines_3 = 0, lines_4 = 0;
476 __extension__ /* don't warn about "string length is greater than the
477 length ISO C89 compilers are required to support"
478 in the following string constant... */
481 const char *sco_panic_1 =
482 ("Unexpected trap in kernel mode:\n"
484 "cr0 0x80010013 cr2 0x00000014 cr3 0x00000000 tlb 0x00000000\n"
485 "ss 0x00071054 uesp 0x00012055 efl 0x00080888 ipl 0x00000005\n"
486 "cs 0x00092585 eip 0x00544a4b err 0x004d4a47 trap 0x0000000E\n"
487 "eax 0x0045474b ecx 0x0042544b edx 0x57687920 ebx 0x61726520\n"
488 "esp 0x796f7520 ebp 0x72656164 esi 0x696e6720 edi 0x74686973\n"
489 "ds 0x3f000000 es 0x43494c48 fs 0x43525343 gs 0x4f4d4b53\n"
491 "PANIC: k_trap - kernel mode trap type 0x0000000E\n"
492 "Trying to dump 5023 pages to dumpdev hd (1/41), 63 pages per '.'\n"
494 const char *sco_panic_2 =
495 ("................................................................."
498 const char *sco_panic_3 =
499 ("5023 pages dumped\n"
503 const char *sco_panic_4 =
504 ("** Safe to Power Off **\n"
506 "** Press Any Key to Reboot **\n"
509 for (s = sco_panic_1; *s; s++) if (*s == '\n') lines_1++;
510 for (s = sco_panic_2; *s; s++) if (*s == '\n') lines_2++;
511 for (s = sco_panic_3; *s; s++) if (*s == '\n') lines_3++;
512 for (s = sco_panic_4; *s; s++) if (*s == '\n') lines_4++;
514 XGetWindowAttributes (dpy, window, &xgwa);
516 fontname = get_string_resource ((xgwa.height > 600
520 if (!fontname || !*fontname) fontname = (char *)def_font;
521 font = XLoadQueryFont (dpy, fontname);
522 if (!font) font = XLoadQueryFont (dpy, def_font);
524 if (fontname && fontname != def_font)
527 gcv.font = font->fid;
528 gcv.foreground = get_pixel_resource(("sco.foreground"),
531 gcv.background = get_pixel_resource(("sco.background"),
534 XSetWindowBackground(dpy, window, gcv.background);
535 XClearWindow(dpy, window);
537 gc = XCreateGC(dpy, window, GCFont|GCForeground|GCBackground, &gcv);
539 draw_string(dpy, window, gc, &gcv, font,
540 10, xgwa.height - ((lines_1 + lines_2 + lines_3 + lines_4 + 1) *
541 (font->ascent + font->descent + 1)),
545 for (s = sco_panic_2; *s; s++)
547 char *ss = strdup(sco_panic_2);
548 ss[s - sco_panic_2] = 0;
549 draw_string(dpy, window, gc, &gcv, font,
550 10, xgwa.height - ((lines_2 + lines_3 + lines_4 + 1) *
551 (font->ascent + font->descent + 1)),
556 if (bsod_sleep (dpy, -1))
560 draw_string(dpy, window, gc, &gcv, font,
561 10, xgwa.height - ((lines_3 + lines_4 + 1) *
562 (font->ascent + font->descent + 1)),
566 if (bsod_sleep(dpy, 1))
568 draw_string(dpy, window, gc, &gcv, font,
569 10, xgwa.height - ((lines_4 + 1) *
570 (font->ascent + font->descent + 1)),
575 bsod_sleep(dpy, delay);
577 XClearWindow(dpy, window);
579 XFreeFont(dpy, font);
583 /* Linux (sparc) panic, by Tom Kelly <tom@ancilla.toronto.on.ca>
586 sparc_linux (Display *dpy, Window window, int delay)
589 XWindowAttributes xgwa;
591 const char *def_font = "fixed";
598 __extension__ /* don't warn about "string length is greater than the
599 length ISO C89 compilers are required to support"
600 in the following string constant... */
603 const char *linux_panic =
604 ("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
605 "Unable to handle kernel paging request at virtual address f0d4a000\n"
606 "tsk->mm->context = 00000014\n"
607 "tsk->mm->pgd = f26b0000\n"
612 "gawk(22827): Oops\n"
613 "PSR: 044010c1 PC: f001c2cc NPC: f001c2d0 Y: 00000000\n"
614 "g0: 00001000 g1: fffffff7 g2: 04401086 g3: 0001eaa0\n"
615 "g4: 000207dc g5: f0130400 g6: f0d4a018 g7: 00000001\n"
616 "o0: 00000000 o1: f0d4a298 o2: 00000040 o3: f1380718\n"
617 "o4: f1380718 o5: 00000200 sp: f1b13f08 ret_pc: f001c2a0\n"
618 "l0: efffd880 l1: 00000001 l2: f0d4a230 l3: 00000014\n"
619 "l4: 0000ffff l5: f0131550 l6: f012c000 l7: f0130400\n"
620 "i0: f1b13fb0 i1: 00000001 i2: 00000002 i3: 0007c000\n"
621 "i4: f01457c0 i5: 00000004 i6: f1b13f70 i7: f0015360\n"
622 "Instruction DUMP:\n"
625 for (s = linux_panic; *s; s++) if (*s == '\n') lines++;
627 XGetWindowAttributes (dpy, window, &xgwa);
629 fontname = get_string_resource ((xgwa.height > 600
631 : "sparclinux.font"),
633 if (!fontname || !*fontname) fontname = (char *)def_font;
634 font = XLoadQueryFont (dpy, fontname);
635 if (!font) font = XLoadQueryFont (dpy, def_font);
637 if (fontname && fontname != def_font)
640 gcv.font = font->fid;
641 gcv.foreground = get_pixel_resource(("sparclinux.foreground"),
642 "SparcLinux.Foreground",
644 gcv.background = get_pixel_resource(("sparclinux.background"),
645 "SparcLinux.Background",
647 XSetWindowBackground(dpy, window, gcv.background);
648 XClearWindow(dpy, window);
650 gc = XCreateGC(dpy, window, GCFont|GCForeground|GCBackground, &gcv);
652 draw_string(dpy, window, gc, &gcv, font,
653 10, xgwa.height - (lines * (font->ascent + font->descent + 1)),
658 bsod_sleep(dpy, delay);
659 XClearWindow(dpy, window);
660 XFreeFont(dpy, font);
663 /* BSD Panic by greywolf@starwolf.com - modeled after the Linux panic above.
664 By Grey Wolf <greywolf@siteROCK.com>
667 bsd (Display *dpy, Window window, int delay)
670 XWindowAttributes xgwa;
672 const char *def_font = "fixed";
677 const char *rbstr, *panicking;
678 char syncing[80], bbuf[5], *bp;
680 const char *panicstr[] =
681 {"panic: ifree: freeing free inode",
682 "panic: blkfree: freeing free block",
683 "panic: improbability coefficient below zero",
685 "panic: crazy interrupts",
687 "panic: attempted windows install",
689 "panic: free inode isn't",
690 "panic: cpu_fork: curproc",
691 "panic: malloc: out of space in kmem_map",
692 "panic: vogon starship detected",
693 "panic: teleport chamber: out of order",
694 "panic: Brain fried - core dumped"};
696 for (i = 0; i < sizeof(syncing); i++)
699 i = (random() & 0xffff) % (sizeof(panicstr) / sizeof(*panicstr));
701 panicking = panicstr[i];
702 strcpy(syncing, "Syncing disks: ");
704 b = (random() & 0xff) % 40;
705 for (n = 0; (n < 20) && (b > 0); n++)
709 i = (random() & 0x7);
710 b -= (random() & 0xff) % 20;
714 sprintf (bbuf, "%d ", b);
715 strcat (syncing, bbuf);
725 XGetWindowAttributes (dpy, window, &xgwa);
727 fontname = get_string_resource ((xgwa.height > 600
731 if (!fontname || !*fontname) fontname = (char *)def_font;
732 font = XLoadQueryFont (dpy, fontname);
733 if (!font) font = XLoadQueryFont (dpy, def_font);
735 if (fontname && fontname != def_font)
738 gcv.font = font->fid;
739 gcv.foreground = get_pixel_resource(("bsd.foreground"),
742 gcv.background = get_pixel_resource(("bsd.background"),
745 XSetWindowBackground(dpy, window, gcv.background);
746 XClearWindow(dpy, window);
748 gc = XCreateGC(dpy, window, GCFont|GCForeground|GCBackground, &gcv);
750 draw_string(dpy, window, gc, &gcv, font,
751 10, xgwa.height - (lines * (font->ascent + font->descent + 1)),
757 for (bp = syncing; *bp;)
759 char *bsd_bufs, oc = 0;
760 for (;*bp && (*bp != ' '); bp++)
767 bsd_bufs = strdup(syncing);
768 draw_string(dpy, window, gc, &gcv, font,
770 xgwa.height - (lines * (font->ascent + font->descent + 1)),
777 if (bsod_sleep(dpy, -1))
784 draw_string(dpy, window, gc, &gcv, font,
785 10, xgwa.height - (lines * (font->ascent + font->descent + 1)),
789 draw_string(dpy, window, gc, &gcv, font,
790 10, xgwa.height - (lines * (font->ascent + font->descent + 1)),
796 bsod_sleep(dpy, delay);
799 XClearWindow(dpy, window);
800 XFreeFont(dpy, font);
804 amiga (Display *dpy, Window window, int delay)
807 XWindowAttributes xgwa;
809 const char *def_font = "fixed";
813 unsigned long fg, bg, bg2;
815 int pix_w = 0, pix_h = 0;
820 ("_Software failure. Press left mouse button to continue.\n"
821 "_Guru Meditation #00000003.00C01570");
823 XGetWindowAttributes (dpy, window, &xgwa);
825 fontname = get_string_resource ((xgwa.height > 600
826 ? "amiga.font2" : "amiga.font"),
828 if (!fontname || !*fontname) fontname = (char *)def_font;
829 font = XLoadQueryFont (dpy, fontname);
830 if (!font) font = XLoadQueryFont (dpy, def_font);
832 if (fontname && fontname != def_font)
835 gcv.font = font->fid;
836 fg = gcv.foreground = get_pixel_resource("amiga.foreground",
839 bg = gcv.background = get_pixel_resource("amiga.background",
842 bg2 = get_pixel_resource("amiga.background2", "Amiga.Background",
844 XSetWindowBackground(dpy, window, bg2);
845 XClearWindow(dpy, window);
847 gc = XCreateGC(dpy, window, GCFont|GCForeground|GCBackground, &gcv);
848 gcv.background = fg; gcv.foreground = bg;
849 gc2 = XCreateGC(dpy, window, GCFont|GCForeground|GCBackground, &gcv);
851 height = (font->ascent + font->descent) * 6;
853 #if defined(HAVE_GDK_PIXBUF) || defined (HAVE_XPM)
854 pixmap = xpm_data_to_pixmap (dpy, window, (char **) amiga_hand,
856 #endif /* HAVE_GDK_PIXBUF || HAVE_XPM */
858 if (pixmap && xgwa.height > 600) /* scale up the bitmap */
860 pixmap = double_pixmap(dpy, gc, xgwa.visual, xgwa.depth,
861 pixmap, pix_w, pix_h);
868 int x = (xgwa.width - pix_w) / 2;
869 int y = ((xgwa.height - pix_h) / 2);
870 XCopyArea(dpy, pixmap, window, gc, 0, 0, pix_w, pix_h, x, y);
875 XCopyArea(dpy, pixmap, window, gc, 0, 0, pix_w, pix_h, x, y + height);
876 XClearArea(dpy, window, 0, 0, xgwa.width, y + height, False);
877 XFreePixmap(dpy, pixmap);
880 XFillRectangle(dpy, window, gc2, 0, 0, xgwa.width, height);
881 margin = font->ascent;
882 string_width = draw_string(dpy, window, gc, &gcv, font,
884 xgwa.width - (margin * 2), height,
891 XFillRectangle(dpy, window, gca, 0, 0, xgwa.width, margin);
892 XFillRectangle(dpy, window, gca, 0, 0, margin, height);
893 XFillRectangle(dpy, window, gca,
894 0, height - margin, xgwa.width, margin);
895 x2 = margin + string_width;
896 if (x2 < xgwa.width - margin) x2 = xgwa.width - margin;
897 XFillRectangle(dpy, window, gca, x2, 0, margin, height);
899 gca = (gca == gc ? gc2 : gc);
901 if (bsod_sleep(dpy, 1))
910 XClearWindow(dpy, window);
911 XFreeFont(dpy, font);
915 /* Atari ST, by Marcus Herbert <rhoenie@nobiscum.de>
916 Marcus had this to say:
918 Though I still have my Atari somewhere, I hardly remember
919 the meaning of the bombs. I think 9 bombs was "bus error" or
920 something like that. And you often had a few bombs displayed
921 quickly and then the next few ones coming up step by step.
922 Perhaps somebody else can tell you more about it.. its just
926 atari (Display *dpy, Window window, int delay)
930 XWindowAttributes xgwa;
931 const char *def_font = "fixed";
935 int pix_w = atari_width;
936 int pix_h = atari_height;
940 XGetWindowAttributes (dpy, window, &xgwa);
942 font = XLoadQueryFont (dpy, def_font);
945 gcv.font = font->fid;
946 gcv.foreground = get_pixel_resource("atari.foreground", "Atari.Foreground",
948 gcv.background = get_pixel_resource("atari.background", "Atari.Background",
951 XSetWindowBackground(dpy, window, gcv.background);
952 XClearWindow(dpy, window);
954 gc = XCreateGC(dpy, window, GCFont|GCForeground|GCBackground, &gcv);
956 pixmap = XCreatePixmapFromBitmapData(dpy, window, (char *) atari_bits,
958 gcv.foreground, gcv.background,
960 pixmap = double_pixmap(dpy, gc, xgwa.visual, xgwa.depth,
961 pixmap, pix_w, pix_h);
967 y = (xgwa.height - (xgwa.height / 5));
970 for (i=0 ; i<7 ; i++) {
971 XCopyArea(dpy, pixmap, window, gc, 0, 0, pix_w, pix_h,
972 (x + (i*offset)), y);
975 for (i=7 ; i<10 ; i++) {
976 if (bsod_sleep(dpy, 1))
978 XCopyArea(dpy, pixmap, window, gc, 0, 0, pix_w, pix_h,
979 (x + (i*offset)), y);
982 bsod_sleep(dpy, delay);
984 XFreePixmap(dpy, pixmap);
987 XClearWindow(dpy, window);
988 XFreeFont(dpy, font);
993 mac (Display *dpy, Window window, int delay)
996 XWindowAttributes xgwa;
998 const char *def_font = "fixed";
1002 int pix_w = mac_width;
1003 int pix_h = mac_height;
1004 int offset = mac_height * 4;
1007 const char *string = ("0 0 0 0 0 0 0 F\n"
1010 XGetWindowAttributes (dpy, window, &xgwa);
1012 fontname = get_string_resource ("mac.font", "Mac.Font");
1013 if (!fontname || !*fontname) fontname = (char *)def_font;
1014 font = XLoadQueryFont (dpy, fontname);
1015 if (!font) font = XLoadQueryFont (dpy, def_font);
1016 if (!font) exit(-1);
1017 if (fontname && fontname != def_font)
1020 gcv.font = font->fid;
1021 gcv.foreground = get_pixel_resource("mac.foreground", "Mac.Foreground",
1022 dpy, xgwa.colormap);
1023 gcv.background = get_pixel_resource("mac.background", "Mac.Background",
1024 dpy, xgwa.colormap);
1025 XSetWindowBackground(dpy, window, gcv.background);
1026 XClearWindow(dpy, window);
1028 gc = XCreateGC(dpy, window, GCFont|GCForeground|GCBackground, &gcv);
1030 pixmap = XCreatePixmapFromBitmapData(dpy, window, (char *) mac_bits,
1031 mac_width, mac_height,
1036 for(i = 0; i < 2; i++)
1038 pixmap = double_pixmap(dpy, gc, xgwa.visual, xgwa.depth,
1039 pixmap, pix_w, pix_h);
1040 pix_w *= 2; pix_h *= 2;
1044 int x = (xgwa.width - pix_w) / 2;
1045 int y = (((xgwa.height + offset) / 2) -
1047 (font->ascent + font->descent) * 2);
1049 XCopyArea(dpy, pixmap, window, gc, 0, 0, pix_w, pix_h, x, y);
1050 XFreePixmap(dpy, pixmap);
1053 draw_string(dpy, window, gc, &gcv, font, 0, 0,
1054 xgwa.width, xgwa.height + offset, string, 0);
1058 bsod_sleep(dpy, delay);
1059 XClearWindow(dpy, window);
1060 XFreeFont(dpy, font);
1064 macsbug (Display *dpy, Window window, int delay)
1067 XWindowAttributes xgwa;
1069 const char *def_font = "fixed";
1073 int char_width, line_height;
1074 int col_right, row_top, row_bottom, page_right, page_bottom, body_top;
1078 __extension__ /* don't warn about "string length is greater than the
1079 length ISO C89 compilers are required to support"
1080 in the following string constant... */
1083 const char *left = (" SP \n"
1130 const char *bottom = (" _A09D\n"
1131 " +00884 40843714 #$0700,SR "
1133 " +00886 40843765 *+$0400 "
1135 " +00888 40843718 $0004(A7),([0,A7[)"
1136 " ; 04E8D0AE | 66B8");
1139 const char *body = ("Bus Error at 4BF6D6CC\n"
1140 "while reading word from 4BF6D6CC in User data space\n"
1141 " Unable to access that address\n"
1143 " Frame Type: B008");
1147 __extension__ /* don't warn about "string length is greater than the
1148 length ISO C89 compilers are required to support"
1149 in the following string constant... */
1152 const char * body = ("PowerPC unmapped memory exception at 003AFDAC "
1153 "BowelsOfTheMemoryMgr+04F9C\n"
1154 " Calling chain using A6/R1 links\n"
1155 " Back chain ISA Caller\n"
1156 " 00000000 PPC 28C5353C __start+00054\n"
1157 " 24DB03C0 PPC 28B9258C main+0039C\n"
1158 " 24DB0350 PPC 28B9210C MainEvent+00494\n"
1159 " 24DB02B0 PPC 28B91B40 HandleEvent+00278\n"
1160 " 24DB0250 PPC 28B83DAC DoAppleEvent+00020\n"
1161 " 24DB0210 PPC FFD3E5D0 "
1162 "AEProcessAppleEvent+00020\n"
1163 " 24DB0132 68K 00589468\n"
1164 " 24DAFF8C 68K 00589582\n"
1165 " 24DAFF26 68K 00588F70\n"
1166 " 24DAFEB3 PPC 00307098 "
1167 "EmToNatEndMoveParams+00014\n"
1168 " 24DAFE40 PPC 28B9D0B0 DoScript+001C4\n"
1169 " 24DAFDD0 PPC 28B9C35C RunScript+00390\n"
1170 " 24DAFC60 PPC 28BA36D4 run_perl+000E0\n"
1171 " 24DAFC10 PPC 28BC2904 perl_run+002CC\n"
1172 " 24DAFA80 PPC 28C18490 Perl_runops+00068\n"
1173 " 24DAFA30 PPC 28BE6CC0 Perl_pp_backtick+000FC\n"
1174 " 24DAF9D0 PPC 28BA48B8 Perl_my_popen+00158\n"
1175 " 24DAF980 PPC 28C5395C sfclose+00378\n"
1176 " 24DAF930 PPC 28BA568C free+0000C\n"
1177 " 24DAF8F0 PPC 28BA6254 pool_free+001D0\n"
1178 " 24DAF8A0 PPC FFD48F14 DisposePtr+00028\n"
1179 " 24DAF7C9 PPC 00307098 "
1180 "EmToNatEndMoveParams+00014\n"
1181 " 24DAF780 PPC 003AA180 __DisposePtr+00010");
1187 for (s = body; *s; s++) if (*s == '\n') body_lines++;
1189 XGetWindowAttributes (dpy, window, &xgwa);
1191 fontname = get_string_resource ((xgwa.height > 850
1193 : (xgwa.height > 700
1197 if (!fontname || !*fontname) fontname = (char *)def_font;
1198 font = XLoadQueryFont (dpy, fontname);
1199 if (!font) font = XLoadQueryFont (dpy, def_font);
1200 if (!font) exit(-1);
1201 if (fontname && fontname != def_font)
1204 gcv.font = font->fid;
1205 gcv.foreground = get_pixel_resource("macsbug.foreground",
1206 "MacsBug.Foreground",
1207 dpy, xgwa.colormap);
1208 gcv.background = get_pixel_resource("macsbug.background",
1209 "MacsBug.Background",
1210 dpy, xgwa.colormap);
1212 gc = XCreateGC(dpy, window, GCFont|GCForeground|GCBackground, &gcv);
1214 gcv.foreground = gcv.background;
1215 gc2 = XCreateGC(dpy, window, GCForeground, &gcv);
1217 XSetWindowBackground(dpy, window,
1218 get_pixel_resource("macsbug.borderColor",
1219 "MacsBug.BorderColor",
1220 dpy, xgwa.colormap));
1221 XClearWindow(dpy, window);
1223 char_width = (font->per_char
1224 ? font->per_char['n'-font->min_char_or_byte2].width
1225 : font->min_bounds.width);
1226 line_height = font->ascent + font->descent + 1;
1228 col_right = char_width * 12;
1229 page_bottom = line_height * 47;
1231 if (page_bottom > xgwa.height) page_bottom = xgwa.height;
1233 row_bottom = page_bottom - line_height;
1234 row_top = row_bottom - (line_height * 4);
1235 page_right = col_right + (char_width * 88);
1236 body_top = row_top - (line_height * body_lines);
1242 xoff = (xgwa.width - page_right) / 2;
1243 yoff = (xgwa.height - page_bottom) / 2;
1244 if (xoff < 0) xoff = 0;
1245 if (yoff < 0) yoff = 0;
1247 XFillRectangle(dpy, window, gc2, xoff, yoff, page_right, page_bottom);
1249 draw_string(dpy, window, gc, &gcv, font, xoff, yoff, 10, 10, left, 0);
1250 draw_string(dpy, window, gc, &gcv, font, xoff+col_right, yoff+row_top,
1253 XFillRectangle(dpy, window, gc, xoff + col_right, yoff, 2, page_bottom);
1254 XDrawLine(dpy, window, gc,
1255 xoff+col_right, yoff+row_top, xoff+page_right, yoff+row_top);
1256 XDrawLine(dpy, window, gc,
1257 xoff+col_right, yoff+row_bottom, xoff+page_right, yoff+row_bottom);
1258 XDrawRectangle(dpy, window, gc, xoff, yoff, page_right, page_bottom);
1263 draw_string(dpy, window, gc, &gcv, font,
1264 xoff + col_right + char_width, yoff + body_top, 10, 10, body,
1269 XDrawLine(dpy, window, gc,
1270 xoff+col_right+(char_width/2)+2, yoff+row_bottom+3,
1271 xoff+col_right+(char_width/2)+2, yoff+page_bottom-3);
1274 XDrawLine(dpy, window, gc2,
1275 xoff+col_right+(char_width/2)+2, yoff+row_bottom+3,
1276 xoff+col_right+(char_width/2)+2, yoff+page_bottom-3);
1279 if (bsod_sleep(dpy, 0))
1286 XClearWindow(dpy, window);
1287 XFreeFont(dpy, font);
1291 mac1 (Display *dpy, Window window, int delay)
1294 XWindowAttributes xgwa;
1297 int pix_w = macbomb_width;
1298 int pix_h = macbomb_height;
1300 XGetWindowAttributes (dpy, window, &xgwa);
1302 gcv.foreground = get_pixel_resource("mac1.foreground", "Mac.Foreground",
1303 dpy, xgwa.colormap);
1304 gcv.background = get_pixel_resource("mac1.background", "Mac.Background",
1305 dpy, xgwa.colormap);
1306 XSetWindowBackground(dpy, window, gcv.background);
1307 XClearWindow(dpy, window);
1309 gc = XCreateGC(dpy, window, GCForeground|GCBackground, &gcv);
1311 pixmap = XCreatePixmapFromBitmapData(dpy, window, (char *) macbomb_bits,
1312 macbomb_width, macbomb_height,
1318 int x = (xgwa.width - pix_w) / 2;
1319 int y = (xgwa.height - pix_h) / 2;
1321 XFillRectangle (dpy, window, gc, 0, 0, xgwa.width, xgwa.height);
1323 if (bsod_sleep(dpy, 1))
1325 XCopyArea(dpy, pixmap, window, gc, 0, 0, pix_w, pix_h, x, y);
1330 XFreePixmap(dpy, pixmap);
1332 bsod_sleep(dpy, delay);
1333 XClearWindow(dpy, window);
1338 macx (Display *dpy, Window window, int delay)
1341 XWindowAttributes xgwa;
1343 const char *def_font = "fixed";
1348 __extension__ /* don't warn about "string length is greater than the
1349 length ISO C89 compilers are required to support"
1350 in the following string constant... */
1353 const char *macx_panic =
1354 ("panic(cpu 0): Unable to find driver for this platform: "
1355 "\"PowerMac 3,5\".\n"
1357 "backtrace: 0x0008c2f4 0x0002a7a0 0x001f0204 0x001d4e4c 0x001d4c5c "
1358 "0x001a56cc 0x01d5dbc 0x001c621c 0x00037430 0x00037364\n"
1362 "No debugger configured - dumping debug information\n"
1364 "version string : Darwin Kernel Version 1.3:\n"
1365 "Thu Mar 1 06:56:40 PST 2001; root:xnu/xnu-123.5.obj~1/RELEASE_PPC\n"
1370 "DBAT0: 00000000 00000000\n"
1371 "DBAT1: 00000000 00000000\n"
1372 "DBAT2: 80001FFE 8000003A\n"
1373 "DBAT3: 90001FFE 9000003A\n"
1375 "backtrace: 0x0008c2f4 0x0002a7a0 0x001f0204 0x001d4e4c 0x001d4c5c "
1376 "0x001a56cc 0x01d5dbc 0x001c621c 0x00037430 0x00037364\n"
1378 "panic: We are hanging here...\n");
1380 XGetWindowAttributes (dpy, window, &xgwa);
1382 gcv.background = get_pixel_resource("macX.background",
1384 dpy, xgwa.colormap);
1385 XSetWindowBackground(dpy, window, gcv.background);
1386 XClearWindow(dpy, window);
1388 fontname = get_string_resource ((xgwa.height > 900
1392 if (!fontname || !*fontname) fontname = (char *)def_font;
1393 font = XLoadQueryFont (dpy, fontname);
1394 if (!font) font = XLoadQueryFont (dpy, def_font);
1395 if (!font) exit(-1);
1396 if (fontname && fontname != def_font)
1399 gcv.font = font->fid;
1400 gcv.foreground = get_pixel_resource("macsbug.foreground",
1401 "MacsBug.Foreground",
1402 dpy, xgwa.colormap);
1403 gcv.background = get_pixel_resource("macsbug.background",
1404 "MacsBug.Background",
1405 dpy, xgwa.colormap);
1408 gcv.foreground = get_pixel_resource("macX.textForeground",
1409 "MacX.TextForeground",
1410 dpy, xgwa.colormap);
1411 gcv.background = get_pixel_resource("macX.textBackground",
1412 "MacX.TextBackground",
1413 dpy, xgwa.colormap);
1414 gc = XCreateGC(dpy, window, GCForeground|GCBackground|GCFont, &gcv);
1416 #if defined(HAVE_GDK_PIXBUF) || defined (HAVE_XPM)
1420 int x, y, pix_w, pix_h;
1421 pixmap = xpm_data_to_pixmap (dpy, window, (char **) happy_mac,
1422 &pix_w, &pix_h, &mask);
1424 x = (xgwa.width - pix_w) / 2;
1425 y = (xgwa.height - pix_h) / 2;
1429 XSetClipMask (dpy, gc, mask);
1430 XSetClipOrigin (dpy, gc, x, y);
1431 XCopyArea (dpy, pixmap, window, gc, 0, 0, pix_w, pix_h, x, y);
1432 XSetClipMask (dpy, gc, None);
1433 XFreePixmap (dpy, pixmap);
1435 #endif /* HAVE_GDK_PIXBUF || HAVE_XPM */
1442 int char_width, line_height;
1443 char_width = (font->per_char
1444 ? font->per_char['n'-font->min_char_or_byte2].width
1445 : font->min_bounds.width);
1446 line_height = font->ascent + font->descent;
1454 if (*s == '\n' || x + char_width >= xgwa.width)
1462 /* Note that to get this goofy effect, they must be actually
1463 emitting LF CR at the end of each line instead of CR LF!
1465 XDrawImageString (dpy, window, gc, ox, oy, " ", 1);
1466 XDrawImageString (dpy, window, gc, ox, y, " ", 1);
1470 XDrawImageString (dpy, window, gc, x, y, s, 1);
1479 bsod_sleep(dpy, delay);
1480 XClearWindow(dpy, window);
1486 * by Martin Pool <mbp@samba.org>, Feb 2000.
1488 * This is meant to look like the preferred failure mode of NCD
1489 * Xterms. The parameters for choosing what to copy where might not
1490 * be quite right, but it looks about ugly enough.
1493 blitdamage (Display *dpy, Window window, int delay)
1496 XWindowAttributes xwa;
1499 int delta_x = 0, delta_y = 0;
1501 int chunk_h, chunk_w;
1507 XGetWindowAttributes(dpy, window, &xwa);
1509 load_random_image (xwa.screen, window, window, NULL);
1514 gc_mask = GCForeground;
1516 gcv.plane_mask = random();
1517 gc_mask |= GCPlaneMask;
1519 gc0 = XCreateGC(dpy, window, gc_mask, &gcv);
1522 chunk_w = w / (random() % 1 + 1);
1523 chunk_h = h / (random() % 1 + 1);
1524 if (random() & 0x1000)
1525 delta_y = random() % 600;
1526 if (!delta_y || (random() & 0x2000))
1527 delta_x = random() % 600;
1533 for (i = 0; i < steps; i++) {
1534 if (x + chunk_w > w)
1539 if (y + chunk_h > h)
1544 XCopyArea(dpy, window, window, gc0,
1549 if (bsod_sleep(dpy, 0))
1553 bsod_sleep(dpy, delay);
1561 * SPARC Solaris panic. Should look pretty authentic on Solaris boxes.
1562 * Anton Solovyev <solovam@earthlink.net>
1571 int sub_width; /* Text subwindow width in pixels */
1572 int sub_height; /* Text subwindow height in pixels */
1573 int sub_x; /* upper left corner of the text subwindow */
1574 int sub_y; /* upper left corner of the text subwindow */
1575 int char_width; /* Char width in pixels */
1576 int line_height; /* Line height in pixels */
1577 int columns; /* Number of columns in the text screen */
1578 int x; /* horizontal position of the cursor */
1582 static scrolling_window *
1583 make_scrolling_window (Display *dpy, Window window,
1587 const char *def_font = "fixed";
1588 scrolling_window* ts;
1589 XWindowAttributes xgwa;
1592 char buf1[100], buf2[100];
1594 ts = malloc (sizeof (*ts));
1595 ts->window = window;
1600 XGetWindowAttributes (dpy, window, &xgwa);
1604 ts->sub_width = xgwa.width * 0.8;
1605 ts->sub_height = xgwa.height * 0.8;
1609 ts->sub_width = xgwa.width - 20;
1610 ts->sub_height = xgwa.height - 20;
1611 if (ts->sub_width < 20) ts->sub_width = 20;
1612 if (ts->sub_height < 20) ts->sub_height = 20;
1615 sprintf (buf1, "%.50s.font", name);
1616 sprintf (buf2, "%.50s.Font", name);
1617 fn = get_string_resource (buf1, buf2);
1618 ts->xfs = XLoadQueryFont (dpy, fn);
1621 sprintf (buf1, "%.50s.font2", name);
1622 fn = get_string_resource(buf1, buf2);
1623 ts->xfs = XLoadQueryFont(dpy, fn);
1626 ts->xfs = XLoadQueryFont(dpy, def_font);
1629 gcv.font = ts->xfs->fid;
1630 ts->char_width = (ts->xfs->per_char
1631 ? ts->xfs->per_char['n'-ts->xfs->min_char_or_byte2].width
1632 : ts->xfs->min_bounds.width);
1633 ts->line_height = ts->xfs->ascent + ts->xfs->descent + 1;
1635 ts->columns = ts->sub_width / ts->char_width;
1637 ts->sub_x = (xgwa.width - ts->sub_width) / 2;
1638 ts->sub_y = (xgwa.height - ts->sub_height) / 2;
1640 if (!grab_screen_p) ts->sub_height += ts->sub_y, ts->sub_y = 0;
1643 load_random_image (xgwa.screen, window, window, NULL);
1645 sprintf (buf1, "%.50s.background", name);
1646 sprintf (buf2, "%.50s.Background", name);
1647 gcv.background = get_pixel_resource (buf1, buf2, dpy, xgwa.colormap);
1649 sprintf (buf1, "%.50s.foreground", name);
1650 sprintf (buf2, "%.50s.Foreground", name);
1651 gcv.foreground = get_pixel_resource (buf1, buf2, dpy, xgwa.colormap);
1653 ts->gc = XCreateGC (dpy, window,
1654 GCForeground | GCBackground | GCFont,
1656 gcv.foreground = gcv.background;
1657 ts->erase_gc = XCreateGC (dpy, window,
1658 GCForeground | GCBackground,
1660 XSetWindowBackground (dpy, window, gcv.background);
1665 free_scrolling_window (scrolling_window* ts)
1667 XFreeGC (ts->dpy, ts->gc);
1668 XFreeGC (ts->dpy, ts->erase_gc);
1669 XFreeFont (ts->dpy, ts->xfs);
1674 scrolling_putc (scrolling_window* ts, const char aChar)
1680 XCopyArea (ts->dpy, ts->window, ts->window, ts->gc,
1681 ts->sub_x, ts->sub_y + ts->line_height,
1682 ts->sub_width, ts->sub_height,
1683 ts->sub_x, ts->sub_y);
1684 XFillRectangle (ts->dpy, ts->window, ts->erase_gc,
1685 ts->sub_x, ts->sub_y + ts->sub_height - ts->line_height,
1686 ts->sub_width, ts->line_height);
1695 if (ts->x >= ts->columns)
1696 scrolling_putc (ts, '\n');
1697 XDrawImageString (ts->dpy, ts->window, ts->gc,
1699 (ts->x * ts->char_width)
1700 - ts->xfs->min_bounds.lbearing),
1701 (ts->sub_y + ts->sub_height - ts->xfs->descent),
1709 scrolling_puts (scrolling_window *ts, const char* aString, int delay)
1712 for (c = aString; *c; ++c)
1714 scrolling_putc (ts, *c);
1719 if (bsod_sleep (ts->dpy, 0))
1728 sparc_solaris (Display* dpy, Window window, int delay)
1731 __extension__ /* don't warn about "string length is greater than the
1732 length ISO C89 compilers are required to support"
1733 in the following string constant... */
1737 "BAD TRAP: cpu=0 type=0x31 rp=0x2a10043b5e0 addr=0xf3880 mmu_fsr=0x0\n"
1738 "BAD TRAP occurred in module \"unix\" due to an illegal access to a"
1740 "adb: trap type = 0x31\n"
1742 "pid=307, pc=0x100306e4, sp=0x2a10043ae81, tstate=0x4480001602,"
1744 "g1-g7: 1045b000, 32f, 10079440, 180, 300000ebde8, 0, 30000953a20\n"
1745 "Begin traceback... sp = 2a10043ae81\n"
1746 "Called from 100bd060, fp=2a10043af31, args=f3700 300008cc988 f3880 0"
1748 "Called from 101fe1bc, fp=2a10043b011, args=3000045a240 104465a0"
1749 " 300008e47d0 300008e48fa 300008ae350 300008ae410\n"
1750 "Called from 1007c520, fp=2a10043b0c1, args=300008e4878 300003596e8 0"
1751 " 3000045a320 0 3000045a220\n"
1752 "Called from 1007c498, fp=2a10043b171, args=1045a000 300007847f0 20"
1753 " 3000045a240 1 0\n"
1754 "Called from 1007972c, fp=2a10043b221, args=1 300009517c0 30000951e58 1"
1756 "Called from 10031e10, fp=2a10043b2d1, args=3000095b0c8 0 300009396a8"
1757 " 30000953a20 0 1\n"
1758 "Called from 10000bdd8, fp=ffffffff7ffff1c1, args=0 57 100131480"
1759 " 100131480 10012a6e0 0\n"
1760 "End traceback...\n"
1761 "panic[cpu0]/thread=30000953a20: trap\n"
1762 "syncing file systems...";
1765 "dumping to /dev/dsk/c0t0d0s3, offset 26935296\n";
1767 ": 2803 pages dumped, compression ratio 2.88, dump succeeded\n";
1772 scrolling_window *ts;
1776 ts = make_scrolling_window (dpy, window, "Solaris", True);
1778 scrolling_puts (ts, msg1, 0);
1779 if (bsod_sleep (dpy, 3))
1782 scrolling_puts (ts, msg2, 0);
1783 if (bsod_sleep (dpy, 2))
1786 for (i = 1; i <= 100; ++i)
1788 sprintf(buf, "\b\b\b\b\b\b\b\b\b\b\b%3d%% done", i);
1789 scrolling_puts (ts, buf, 0);
1790 if (bsod_sleep (dpy, -1))
1794 scrolling_puts (ts, msg3, 0);
1795 if (bsod_sleep (dpy, 2))
1798 scrolling_puts (ts, msg4, 0);
1799 if (bsod_sleep(dpy, 3))
1802 bsod_sleep (dpy, 3);
1805 free_scrolling_window (ts);
1808 /* Linux panic and fsck, by jwz
1811 linux_fsck (Display *dpy, Window window, int delay)
1813 XWindowAttributes xgwa;
1814 scrolling_window *ts;
1816 const char *sysname;
1819 const char *linux_panic[] = {
1820 " kernel: Unable to handle kernel paging request at virtual "
1821 "address 0000f0ad\n",
1822 " kernel: printing eip:\n",
1823 " kernel: c01becd7\n",
1824 " kernel: *pde = 00000000\n",
1825 " kernel: Oops: 0000\n",
1826 " kernel: CPU: 0\n",
1827 " kernel: EIP: 0010:[<c01becd7>] Tainted: P \n",
1828 " kernel: EFLAGS: 00010286\n",
1829 " kernel: eax: 0000ff00 ebx: ca6b7e00 ecx: ce1d7a60 edx: ce1d7a60\n",
1830 " kernel: esi: ca6b7ebc edi: 00030000 ebp: d3655ca0 esp: ca6b7e5c\n",
1831 " kernel: ds: 0018 es: 0018 ss: 0018\n",
1832 " kernel: Process crond (pid: 1189, stackpage=ca6b7000)\n",
1833 " kernel: Stack: d3655ca0 ca6b7ebc 00030054 ca6b7e7c c01c1e5b "
1834 "00000287 00000020 c01c1fbf \n",
1836 " kernel: 00005a36 000000dc 000001f4 00000000 00000000 "
1837 "ce046d40 00000001 00000000 \n",
1839 " kernel: ffffffff d3655ca0 d3655b80 00030054 c01bef93 "
1840 "d3655ca0 ca6b7ebc 00030054 \n",
1842 " kernel: Call Trace: [<c01c1e5b>] [<c01c1fbf>] [<c01bef93>] "
1843 "[<c01bf02b>] [<c0134c4f>]\n",
1845 " kernel: [<c0142562>] [<c0114f8c>] [<c0134de3>] [<c010891b>]\n",
1847 " kernel: Code: 2a 00 75 08 8b 44 24 2c 85 c0 74 0c 8b 44 24 58 83 48 18 "
1852 XGetWindowAttributes (dpy, window, &xgwa);
1853 XSetWindowBackground (dpy, window,
1854 get_pixel_resource("Linux.background",
1856 dpy, xgwa.colormap));
1857 XClearWindow(dpy, window);
1864 if (uname (&uts) >= 0)
1865 sysname = uts.nodename;
1866 s = strchr (sysname, '.');
1869 # endif /* !HAVE_UNAME */
1872 ts = make_scrolling_window (dpy, window, "Linux", False);
1874 scrolling_puts (ts, "waiting for X server to shut down ", 0);
1876 if (bsod_sleep (dpy, 0))
1879 "XIO: fatal IO error 2 (broken pipe) on X server \":0.0\"\n"
1880 " after 339471 requests (339471 known processed) "
1881 "with 0 events remaining\n",
1883 if (scrolling_puts (ts, ".........\n", 300000))
1885 if (bsod_sleep (dpy, 0))
1888 "xinit: X server slow to shut down, sending KILL signal.\n",
1890 scrolling_puts (ts, "waiting for server to die ", 0);
1891 if (scrolling_puts (ts, "...\n", 300000))
1893 if (bsod_sleep (dpy, 0))
1895 scrolling_puts (ts, "xinit: Can't kill server\n", 0);
1897 if (bsod_sleep (dpy, 2))
1900 sprintf (buf, "\n%s Login: ", sysname);
1901 scrolling_puts (ts, buf, 0);
1902 if (bsod_sleep (dpy, 1))
1906 "Parallelizing fsck version 1.22 (22-Jun-2001)\n"
1907 "e2fsck 1.22, 22-Jun-2001 for EXT2 FS 0.5b, 95/08/09\n"
1908 "Warning! /dev/hda1 is mounted.\n"
1909 "/dev/hda1 contains a file system with errors, check forced.\n",
1911 if (bsod_sleep (dpy, 1))
1914 if (0 == random() % 2)
1916 "Couldn't find ext2 superblock, trying backup blocks...\n"
1917 "The filesystem size (according to the superblock) is 3644739 blocks\n"
1918 "The physical size of the device is 3636706 blocks\n"
1919 "Either the superblock or the partition table is likely to be corrupt!\n"
1922 if (bsod_sleep (dpy, 1))
1927 scrolling_puts (ts, "Pass 1: Checking inodes, blocks, and sizes\n", 0);
1928 if (bsod_sleep (dpy, 2))
1931 i = (random() % 60) - 20;
1934 int b = random() % 0xFFFF;
1935 sprintf (buf, "Deleted inode %d has zero dtime. Fix<y>? yes\n\n", b);
1936 scrolling_puts (ts, buf, 0);
1939 i = (random() % 40) - 10;
1942 int g = random() % 0xFFFF;
1943 int b = random() % 0xFFFFFFF;
1945 if (bsod_sleep (dpy, 1))
1948 sprintf (buf, "Warning: Group %d's copy of the group descriptors "
1949 "has a bad block (%d).\n", g, b);
1950 scrolling_puts (ts, buf, 0);
1952 b = random() % 0x3FFFFF;
1955 b += random() % 0xFFFF;
1957 "Error reading block %d (Attempt to read block "
1958 "from filesystem resulted in short read) while doing "
1959 "inode scan. Ignore error<y>?",
1961 scrolling_puts (ts, buf, 0);
1963 scrolling_puts (ts, " yes\n\n", 0);
1967 if (0 == (random() % 10))
1970 if (bsod_sleep (dpy, 1))
1973 i = 3 + (random() % 10);
1975 scrolling_puts (ts, "Could not allocate 256 block(s) for inode table: "
1976 "No space left on device\n", 0);
1977 scrolling_puts (ts, "Restarting e2fsck from the beginning...\n", 0);
1979 if (bsod_sleep (dpy, 2))
1985 i = (random() % 20) - 5;
1988 if (bsod_sleep (dpy, 1))
1993 int j = 5 + (random() % 10);
1994 int w = random() % 4;
1998 int b = random() % 0xFFFFF;
1999 int g = random() % 0xFFF;
2001 if (0 == (random() % 10))
2003 else if (0 == (random() % 10))
2008 "Inode table for group %d not in group. (block %d)\n"
2009 "WARNING: SEVERE DATA LOSS POSSIBLE.\n"
2014 "Block bitmap for group %d not in group. (block %d)\n"
2019 "Inode bitmap %d for group %d not in group.\n"
2022 else /* if (w == 3) */
2024 "Bad block %d in group %d's inode table.\n"
2025 "WARNING: SEVERE DATA LOSS POSSIBLE.\n"
2029 scrolling_puts (ts, buf, 0);
2030 scrolling_puts (ts, " yes\n\n", 0);
2032 if (bsod_sleep (dpy, 0))
2038 if (0 == random() % 10) goto PANIC;
2039 scrolling_puts (ts, "Pass 2: Checking directory structure\n", 0);
2040 if (bsod_sleep (dpy, 2))
2043 i = (random() % 20) - 5;
2046 int n = random() % 0xFFFFF;
2047 int o = random() % 0xFFF;
2048 sprintf (buf, "Directory inode %d, block 0, offset %d: "
2049 "directory corrupted\n"
2052 scrolling_puts (ts, buf, 0);
2054 scrolling_puts (ts, " yes\n\n", 0);
2056 if (0 == (random() % 100))
2058 sprintf (buf, "Missing '.' in directory inode %d.\nFix<y>?", n);
2059 scrolling_puts (ts, buf, 0);
2061 scrolling_puts (ts, " yes\n\n", 0);
2064 if (bsod_sleep (dpy, 0))
2068 if (0 == random() % 10) goto PANIC;
2070 "Pass 3: Checking directory connectivity\n"
2071 "/lost+found not found. Create? yes\n",
2073 if (bsod_sleep (dpy, 2))
2076 /* Unconnected directory inode 4949 (/var/spool/squid/06/???)
2077 Connect to /lost+found<y>? yes
2079 '..' in /var/spool/squid/06/08 (20351) is <The NULL inode> (0), should be
2080 /var/spool/squid/06 (20350).
2083 Unconnected directory inode 128337 (/var/spool/squid/06/???)
2084 Connect to /lost+found<y>? yes
2088 if (0 == random() % 10) goto PANIC;
2089 scrolling_puts (ts, "Pass 4: Checking reference counts\n", 0);
2090 if (bsod_sleep (dpy, 2))
2093 /* Inode 2 ref count is 19, should be 20. Fix<y>? yes
2095 Inode 4949 ref count is 3, should be 2. Fix<y>? yes
2099 Inode 128336 ref count is 3, should be 2. Fix<y>? yes
2101 Inode 128337 ref count is 3, should be 2. Fix<y>? yes
2106 if (0 == random() % 10) goto PANIC;
2107 scrolling_puts (ts, "Pass 5: Checking group summary information\n", 0);
2108 if (bsod_sleep (dpy, 2))
2111 i = (random() % 200) - 50;
2114 scrolling_puts (ts, "Block bitmap differences: ", 0);
2117 sprintf (buf, " %d", -(random() % 0xFFF));
2118 scrolling_puts (ts, buf, 0);
2121 scrolling_puts (ts, "\nFix? yes\n\n", 0);
2125 i = (random() % 100) - 50;
2128 scrolling_puts (ts, "Inode bitmap differences: ", 0);
2131 sprintf (buf, " %d", -(random() % 0xFFF));
2132 scrolling_puts (ts, buf, 0);
2135 scrolling_puts (ts, "\nFix? yes\n\n", 0);
2138 i = (random() % 20) - 5;
2141 int g = random() % 0xFFFF;
2142 int c = random() % 0xFFFF;
2144 "Free blocks count wrong for group #0 (%d, counted=%d).\nFix? ",
2146 scrolling_puts (ts, buf, 0);
2148 scrolling_puts (ts, " yes\n\n", 0);
2149 if (bsod_sleep (dpy, 0))
2156 scrolling_puts (ts, "\n\n", 0);
2157 while (linux_panic[i])
2159 time_t t = time ((time_t *) 0);
2160 struct tm *tm = localtime (&t);
2163 if (*linux_panic[i])
2165 strftime (prefix, sizeof(prefix)-1, "%b %d %H:%M:%S ", tm);
2166 scrolling_puts (ts, prefix, 0);
2167 scrolling_puts (ts, sysname, 0);
2168 scrolling_puts (ts, linux_panic[i], 0);
2175 if (bsod_sleep (dpy, 0))
2180 if (bsod_sleep (dpy, 4))
2185 bsod_sleep(dpy, delay);
2188 free_scrolling_window (ts);
2189 XClearWindow(dpy, window);
2192 /* VMS by jwz (text sent by Roland Barmettler <roli@barmettler.net>)
2195 vms (Display *dpy, Window window, int delay)
2197 XWindowAttributes xgwa;
2198 scrolling_window *ts;
2199 const char *sysname;
2201 int dot_delay = 40000;
2202 int chunk_delay = 500000;
2208 __extension__ /* don't warn about "string length is greater than the
2209 length ISO C89 compilers are required to support"
2210 in the following string constant... */
2213 const char *lines[] = {
2214 "%CNXMAN, Lost connection to system #\n"
2215 "%SHADOW-I-VOLPROC, DSA0: shadow master has changed. "
2216 "Dump file WILL be written if system crashes.\n"
2220 "%CNXMAN, Quorum lost, blocking activity\n"
2221 "%CNXMAN, Timed-out lost connection to system #\n"
2222 "%CNXMAN, Timed-out lost connection to system #\n"
2223 "%CNXMAN, Timed-out lost connection to system #\n"
2224 "%CNXMAN, Proposing reconfiguration of the VMScluster\n",
2227 "%CNXMAN, Removed from VMScluster system #\n"
2228 "%CNXMAN, Removed from VMScluster system #\n"
2229 "%CNXMAN, Removed from VMScluster system #\n"
2230 "%CNXMAN, Completing VMScluster state transition\n",
2233 "**** OpenVMS (TM) Alpha Operating system V7.3-1 - BUGCHECK ****\n"
2235 "** Bugcheck code = 000005DC: CLUEXIT, Node voluntarily exiting "
2237 "** Crash CPU: 00 Primary CPU: 00 Active CPUs: 00000001\n"
2238 "** Current Process = NULL\n"
2239 "** Current PSB ID = 00000001\n"
2242 "** Dumping error log buffers to HBVS unit 0\n"
2243 "**** Unable to dump error log buffers to remaining shadow set members\n"
2244 "** Error log buffers not dumped to HBVS unit 200\n"
2246 "** Dumping memory to HBVS unit 0\n"
2247 "**** Starting compressed selective memory dump at #...\n",
2252 "**** Memory dump complete - not all processes or global pages saved\n",
2260 "HALT instruction executed\n"
2261 "PC = ffffffff800c3884\n",
2267 "resetting all I/O buses\n"
2274 XGetWindowAttributes (dpy, window, &xgwa);
2275 ts = make_scrolling_window (dpy, window, "VMS", False);
2276 XClearWindow(dpy,window);
2279 ts->sub_width = xgwa.width;
2280 ts->sub_height = xgwa.height;
2286 if (uname (&uts) >= 0)
2287 sysname = uts.nodename;
2288 s = strchr (sysname, '.');
2291 # endif /* !HAVE_UNAME */
2293 args[0] = malloc (strlen(sysname) + 7);
2294 strcpy (args[0], sysname);
2297 /* Pick three numbers, 1-9, no overlaps. */
2298 ids[0] = 1 + (random() % 9);
2299 do { ids[1] = 1 + (random() % 9); } while (ids[1]==ids[0]);
2300 do { ids[2] = 1 + (random() % 9); } while (ids[2]==ids[0] || ids[2]==ids[1]);
2302 i = strlen(args[0])-1;
2304 args[0][i] = '0' + ids[0];
2307 for (s = args[0]; *s; s++)
2308 if (isalpha(*s)) *s = toupper (*s);
2310 args[1] = strdup (args[0]);
2311 args[2] = strdup (args[0]); args[2][i] = '0' + ids[1];
2312 args[3] = strdup (args[0]); args[3][i] = '0' + ids[2];
2314 args[4] = strdup (args[1]);
2315 args[5] = strdup (args[2]);
2316 args[6] = strdup (args[3]);
2319 time_t t = time ((time_t *) 0);
2320 struct tm *tm = localtime (&t);
2321 args[7] = malloc (30);
2322 strftime (args[7], 29, "%d-%b-%Y %H:%M", tm);
2323 for (s = args[7]; *s; s++)
2324 if (isalpha(*s)) *s = toupper (*s);
2328 for (i = 0; i < countof(lines); i++)
2330 const char *fmt = lines[i];
2331 if (! strcmp (fmt, "..."))
2333 int steps = 180 + (random() % 60);
2334 while (--steps >= 0)
2336 scrolling_puts (ts, ".", 0);
2339 if (bsod_sleep (dpy, 0))
2345 char *fmt2 = malloc (strlen (fmt) * 2 + 1);
2346 for (s = (char *) fmt, s1 = fmt2; *s; s++)
2350 strcpy (s1, args[arg_count++]);
2357 scrolling_puts (ts, fmt2, char_delay);
2359 usleep (chunk_delay);
2360 if (bsod_sleep (dpy, 0))
2366 bsod_sleep(dpy, delay);
2369 free_scrolling_window (ts);
2370 for (i = 0; i < countof (args); i++)
2375 /* HVX (formerly GCOS6) and TPS6 crash
2376 by Brian Garratt <brian-m.garratt@bull.co.uk>
2378 GCOS6 is a Unix-like operating system developed by Honeywell in the
2379 1970s in collaboration with MIT and AT&T (who called their version
2380 UNIX). Both are very much like MULTICS which Honeywell got from GE.
2382 HVX ("High-performance Virtual System on Unix") is an AIX application
2383 which emulates GCOS6 hardware on RS6000-like machines.
2386 hvx (Display *dpy, Window window, int delay)
2388 XWindowAttributes xgwa;
2389 scrolling_window *ts;
2392 int delay2 = 100000;
2393 const char *hvx_panic_1 =
2394 ("(TP) Trap no E Effective address 00000000 Instruction D7DE\n"
2395 "(TP) Registers :\n"
2396 "(TP) B1 -> B7 03801B02 00000000 03880D45 038BABDB 0388AFFD"
2397 " 0389B3F8 03972317\n"
2398 "(TP) R1 -> R7 0001 0007 F10F 090F 0020 0106 0272\n"
2399 "(TP) P I Z M1 0388A18B 3232 0000 FF00\n"
2400 "(TP) Program counter is at offset 0028 from string YTPAD\n"
2401 "(TP) User id of task which trapped is LT 626\n"
2404 const char *hvx_panic_2 =
2407 "Core dumps initiated for selected HVX processes ...\n"
2408 "Core dumps complete.\n"
2409 "Fri Jul 19 15:53:09 2002\n"
2410 "Live registers for cp 0:\n"
2411 " P = 7de3 IW=0000 I=32 CI=30000000 S=80006013"
2412 " IV=aa0 Level=13\n"
2413 " R1-7 = 1f 913 13 4 8 0 0\n"
2414 " B1-7 = 64e71b a93 50e 64e73c 6c2c 7000 b54\n"
2415 "Memory dump starting to file /var/hvx/dp01/diag/Level2 ...\n"
2416 "Memory dump complete.\n"
2419 XGetWindowAttributes (dpy, window, &xgwa);
2420 ts = make_scrolling_window (dpy, window, "HVX", False);
2421 XClearWindow(dpy, window);
2423 scrolling_puts (ts, hvx_panic_1, delay1);
2424 if (bsod_sleep(dpy, 1)) goto DONE;
2425 scrolling_puts (ts, " TP CLOSE ALL", delay2);
2426 scrolling_puts (ts, "\n(TP)?\n", delay1);
2427 if (bsod_sleep(dpy, 1)) goto DONE;
2428 scrolling_puts (ts, " TP ABORT -LT ALL", delay2);
2429 scrolling_puts (ts, "\n(TP)?\n", delay1);
2430 if (bsod_sleep(dpy, 1)) goto DONE;
2431 scrolling_puts (ts, " TP STOP KILL", delay2);
2432 scrolling_puts (ts, hvx_panic_2, delay1);
2434 bsod_sleep(dpy, delay);
2436 XClearWindow(dpy, window);
2442 /* HPUX panic, by Tobias Klausmann <klausman@schwarzvogel.de>
2446 hpux (Display* dpy, Window window, int delay)
2448 XWindowAttributes xgwa;
2449 scrolling_window *ts;
2450 const char *sysname;
2454 __extension__ /* don't warn about "string length is greater than the
2455 length ISO C89 compilers are required to support"
2456 in the following string constant... */
2462 " ******* Unexpected HPMC/TOC. Processor HPA FFFFFFFF'"
2463 "FFFA0000 *******\n"
2464 " GENERAL REGISTERS:\n"
2465 "r00/03 00000000'00000000 00000000'00000000 00000000'00000000 00000000'"
2467 "r04/07 00000000'00000001 00000000'0126E328 00000000'00000000 00000000'"
2469 "r08/11 00000000'00000000 00000000'0198CFC0 00000000'000476FE 00000000'"
2471 "r12/15 00000000'40013EE8 00000000'08000080 00000000'4002530C 00000000'"
2473 "r16/19 00000000'7F7F2A00 00000000'00000001 00000000'00000000 00000000'"
2475 "r20/23 00000000'006C8048 00000000'00000001 00000000'00000000 00000000'"
2477 "r24/27 00000000'00000000 00000000'00000000 00000000'00000000 00000000'"
2479 "r28/31 00000000'00000000 00000000'007DD628 00000000'0199F2B0 00000000'"
2481 " CONTROL REGISTERS:\n"
2482 "sr0/3 00000000'0F3B4000 00000000'0C2A2000 00000000'016FF800 00000000'"
2484 "sr4/7 00000000'00000000 00000000'016FF800 00000000'0DBF1400 00000000'"
2486 "pcq = 00000000'00000000.00000000'00104950 00000000'00000000.00000000'"
2488 "isr = 00000000'10240006 ior = 00000000'67D9E220 iir = 08000240 rctr = "
2491 "pid reg cr8/cr9 00007700'0000B3A9 00000000'0000C5D8\n"
2492 "pid reg cr12/cr13 00000000'00000000 00000000'00000000\n"
2493 "ipsw = 000000FF'080CFF1F iva = 00000000'0002C000 sar = 3A ccr = C0\n"
2494 "tr0/3 00000000'006C76C0 00000000'00000001 00000000'00000000 00000000'"
2496 "tr4/7 00000000'03790000 0000000C'4FB68340 00000000'C07EE13F 00000000'"
2498 "eiem = FFFFFFF0'FFFFFFFF eirr = 80000000'00000000 itmr = 0000000C'"
2500 "cr1/4 00000000'00000000 00000000'00000000 00000000'00000000 00000000'"
2502 "cr5/7 00000000'00000000 00000000'00000000 00000000'"
2504 " MACHINE CHECK PARAMETERS:\n"
2505 "Check Type = 00000000 CPU STATE = 9E000001 Cache Check = 00000000\n"
2506 "TLB Check = 00000000 Bus Check = 00000000 PIM State = ? SIU "
2507 "Status = ????????\n"
2508 "Assists = 00000000 Processor = 00000000\n"
2509 "Slave Addr = 00000000'00000000 Master Addr = 00000000'00000000\n"
2512 "TOC, pcsq.pcoq = 0'0.0'104950 , isr.ior = 0'10240006.0'67d9e220\n"
2513 "@(#)B2352B/9245XB HP-UX (B.11.00) #1: Wed Nov 5 22:38:19 PST 1997\n"
2514 "Transfer of control: (display==0xd904, flags==0x0)\n"
2518 "*** A system crash has occurred. (See the above messages for details.)\n"
2519 "*** The system is now preparing to dump physical memory to disk, for use\n"
2520 "*** in debugging the crash.\n"
2522 "*** The dump will be a SELECTIVE dump: 40 of 256 megabytes.\n"
2523 "*** To change this dump type, press any key within 10 seconds.\n"
2524 "*** Proceeding with selective dump.\n"
2526 "*** The dump may be aborted at any time by pressing ESC.\n";
2528 "\n*** System rebooting.\n";
2530 XGetWindowAttributes (dpy, window, &xgwa);
2531 ts = make_scrolling_window (dpy, window, "HPUX", False);
2532 XClearWindow(dpy,window);
2533 ts->columns = 10000; /* never wrap */
2536 ts->sub_width = xgwa.width;
2537 ts->sub_height = xgwa.height;
2544 if (uname (&uts) >= 0)
2545 sysname = uts.nodename;
2546 s = strchr (sysname, '.');
2549 # endif /* !HAVE_UNAME */
2551 if (bsod_sleep (dpy, 1))
2559 sprintf (buf, "%.100s [HP Release B.11.00] (see /etc/issue)\n", sysname);
2560 scrolling_puts (ts, buf, 0);
2561 if (bsod_sleep (dpy, 1))
2563 scrolling_puts (ts, msg1, 0);
2568 for (i = 0; i <= steps; i++)
2570 if (i > steps) i = steps;
2572 "*** Dumping: %3d%% complete (%d of 40 MB) (device 64:0x2)\r",
2575 scrolling_puts (ts, buf, 0);
2578 if (bsod_sleep (dpy, 0))
2583 scrolling_puts (ts, msg2, 0);
2586 bsod_sleep(dpy, delay);
2589 free_scrolling_window (ts);
2594 /* IBM OS/390 aka MVS aka z/OS.
2595 Text from Dan Espen <dane@mk.telcordia.com>.
2596 Apparently this isn't actually a crash, just a random session...
2601 os390 (Display* dpy, Window window, int delay)
2605 XWindowAttributes xgwa;
2606 scrolling_window *ts;
2609 const char *msg[] = {
2610 "* ISPF Subtask abend *\n",
2611 "SPF ENDED DUE TO ERROR+\n",
2614 "IEA995I SYMPTOM DUMP OUTPUT\n",
2615 " USER COMPLETION CODE=0222\n",
2616 " TIME=23.00.51 SEQ=03210 CPU=0000 ASID=00AE\n",
2617 " PSW AT TIME OF ERROR 078D1000 859DAF18 ILC 2 INTC 0D\n",
2618 " NO ACTIVE MODULE FOUND\n",
2620 " DATA AT PSW 059DAF12 - 00181610 0A0D9180 70644710\n",
2621 " AR/GR 0: 00000000/80000000 1: 00000000/800000DE\n",
2622 " 2: 00000000/196504DC 3: 00000000/00037A78\n",
2623 " 4: 00000000/00037B78 5: 00000000/0003351C\n",
2624 " 6: 00000000/0000F0AD 7: 00000000/00012000\n",
2625 " 8: 00000000/059DAF10 9: 00000000/0002D098\n",
2626 " A: 00000000/059D9F10 B: 00000000/059D8F10\n",
2627 " C: 00000000/859D7F10 D: 00000000/00032D60\n",
2628 " E: 00000000/00033005 F: 01000002/00000041\n",
2629 " END OF SYMPTOM DUMP\n",
2630 "ISPS014 - ** Logical screen request failed - abend 0000DE **\n",
2631 "ISPS015 - ** Contact your system programmer or dialog developer.**\n",
2632 "*** ISPF Main task abend ***\n",
2633 "IEA995I SYMPTOM DUMP OUTPUT\n",
2634 " USER COMPLETION CODE=0222\n",
2635 " TIME=23.00.52 SEQ=03211 CPU=0000 ASID=00AE\n",
2636 " PSW AT TIME OF ERROR 078D1000 8585713C ILC 2 INTC 0D\n",
2637 " ACTIVE LOAD MODULE ADDRESS=05855000 OFFSET=0000213C\n",
2639 " DATA AT PSW 05857136 - 00181610 0A0D9180 D3304770\n",
2640 " GR 0: 80000000 1: 800000DE\n",
2641 " 2: 00015260 3: 00000038\n",
2642 " 4: 00012508 5: 00000000\n",
2643 " 6: 000173AC 7: FFFFFFF8\n",
2644 " 8: 05858000 9: 00012CA0\n",
2645 " A: 05857000 B: 05856000\n",
2646 " C: 85855000 D: 00017020\n",
2647 " E: 85857104 F: 00000000\n",
2648 " END OF SYMPTOM DUMP\n",
2653 XGetWindowAttributes (dpy, window, &xgwa);
2654 ts = make_scrolling_window (dpy, window, "OS390", False);
2655 ts->columns = 10000; /* never wrap */
2658 ts->sub_width = xgwa.width;
2659 ts->sub_height = xgwa.height;
2661 gcv.foreground = get_pixel_resource ("390.background", "390.Background",
2662 dpy, xgwa.colormap);
2663 gc = XCreateGC (dpy, window, GCForeground, &gcv);
2664 XFillRectangle (dpy, window, gc, 0, 0, xgwa.width, xgwa.height);
2667 for (i = 0; i < countof (msg); i++)
2669 scrolling_puts (ts, msg[i], 0);
2671 if (bsod_sleep(dpy, 0)) goto DONE;
2675 bsod_sleep(dpy, delay);
2677 free_scrolling_window (ts);
2683 * Simulate various Apple ][ crashes. The memory map encouraged many programs
2684 * to use the primary hi-res video page for various storage, and the secondary
2685 * hi-res page for active display. When it crashed into Applesoft or the
2686 * monitor, it would revert to the primary page and you'd see memory garbage on
2687 * the screen. Also, it was common for copy-protected games to use the primary
2688 * text page for important code, because that made it really hard to
2689 * reverse-engineer them. The result often looked like what this generates.
2691 * The Apple ][ logic and video hardware is in apple2.c. The TV is emulated by
2692 * analogtv.c for maximum realism
2694 * Trevor Blackwell <tlb@tlb.org>
2697 static char * apple2_basic_errors[]={
2701 "RETURN WITHOUT GOSUB",
2705 "BAD SUBSCRIPT ERROR",
2708 "FORMULA TOO COMPLEX",
2713 "DEFAULT ARGUMENTS ARE NOT ALLOWED IN DECLARATION OF FRIEND "
2714 "TEMPLATE SPECIALIZATION"
2718 static char * apple2_dos_errors[]={
2722 "NO BUFFERS AVAILABLE",
2723 "PROGRAM TOO LARGE",
2726 void a2controller_crash(apple2_sim_t *sim, int *stepno,
2727 double *next_actiontime)
2729 apple2_state_t *st=sim->st;
2738 if (!sim->controller_data)
2739 sim->controller_data = calloc(sizeof(struct mydata),1);
2740 mine=(struct mydata *) sim->controller_data;
2745 a2_init_memory_active(sim);
2746 sim->dec->powerup = 1000.0;
2748 if (random()%3==0) {
2750 *next_actiontime+=0.4;
2753 else if (random()%4==0) {
2754 st->gr_mode=A2_GR_LORES;
2755 if (random()%3==0) st->gr_mode |= A2_GR_FULL;
2756 *next_actiontime+=0.4;
2759 else if (random()%2==0) {
2760 st->gr_mode=A2_GR_HIRES;
2764 st->gr_mode=A2_GR_HIRES;
2765 *next_actiontime+=0.4;
2771 /* An illegal instruction or a reset caused it to drop into the
2772 assembly language monitor, where you could disassemble code & view
2774 if (random()%3==0) {
2777 int addr=0xd000+random()%0x3000;
2779 "%02X",random()%0xff);
2782 sprintf(sim->printing_buf,
2785 " A=%02X X=%02X Y=%02X S=%02X F=%02X\n"
2788 random()%0xff, random()%0xff,
2789 random()%0xff, random()%0xff,
2791 sim->printing=sim->printing_buf;
2799 *next_actiontime += 2.0 + (random()%1000)*0.0002;
2802 /* Lots of programs had at least their main functionality in
2803 Applesoft Basic, which had a lot of limits (memory, string
2804 length, etc) and would sometimes crash unexpectedly. */
2805 sprintf(sim->printing_buf,
2811 apple2_basic_errors[random() %
2812 (sizeof(apple2_basic_errors)
2814 (1000*(random()%(random()%59+1)) +
2815 100*(random()%(random()%9+1)) +
2816 5*(random()%(random()%199+1)) +
2817 1*(random()%(random()%(random()%2+1)+1))));
2818 sim->printing=sim->printing_buf;
2822 *next_actiontime += 2.0 + (random()%1000)*0.0002;
2827 if (random()%3==0) {
2828 /* This was how you reset the Basic interpreter. The sort of
2829 incantation you'd have on a little piece of paper taped to the
2830 side of your machine */
2831 sim->typing="CALL -1370";
2834 else if (random()%2==0) {
2835 sim->typing="CATALOG\n";
2839 *next_actiontime+=1.0;
2846 *next_actiontime += 0.5;
2853 for (s="APPLE ]["; *s; s++) a2_printc(st,*s);
2856 *next_actiontime+=1.0;
2861 if (random()%50==0) {
2862 sprintf(sim->printing_buf,
2863 "\nDISK VOLUME 254\n\n"
2867 sim->printing=sim->printing_buf;
2870 sprintf(sim->printing_buf,"\n?%s\n]",
2871 apple2_dos_errors[random()%
2872 (sizeof(apple2_dos_errors) /
2874 sim->printing=sim->printing_buf;
2877 *next_actiontime+=1.0;
2881 if (random()%2==0) {
2882 /* This was how you went back to text mode in the monitor */
2883 sim->typing="FB4BG";
2886 *next_actiontime+=1.0;
2897 *next_actiontime+=2.0;
2901 /* This reset things into Basic */
2902 if (random()%2==0) {
2903 sim->typing="FAA6G";
2908 *next_actiontime+=sim->delay;
2913 for (i=0; i<1500; i++) {
2914 a2_poke(st, mine->fillptr, mine->fillbyte);
2916 mine->fillbyte = (mine->fillbyte+1)&0xff;
2918 *next_actiontime += 0.08;
2919 /* When you hit c000, it changed video settings */
2920 if (mine->fillptr>=0xc000) {
2924 /* And it seemed to reset around here, I dunno why */
2925 if (mine->fillptr>=0xcf00) *stepno=130;
2931 case A2CONTROLLER_FREE:
2938 apple2crash (Display* dpy, Window window, int delay)
2940 apple2 (dpy, window, delay, a2controller_crash);
2946 msdos (Display *dpy, Window window, int delay)
2948 XWindowAttributes xgwa;
2949 scrolling_window *ts;
2952 int delay2 = 200000;
2954 # define CURSOR "_\b \b"
2955 # define CURSOR2 CURSOR CURSOR CURSOR
2957 XGetWindowAttributes (dpy, window, &xgwa);
2958 ts = make_scrolling_window (dpy, window, "MSDOS", False);
2960 XClearWindow(dpy, window);
2962 scrolling_puts (ts, "C:\\WINDOWS>", delay1);
2963 if (bsod_sleep(dpy, 1)) goto DONE;
2965 scrolling_puts (ts, CURSOR2 "dir a:", delay2);
2966 if (bsod_sleep(dpy, 1)) goto DONE;
2968 scrolling_puts (ts, "\nNot ready reading drive A\nAbort, Retry, Fail?",
2970 if (bsod_sleep(dpy, 1)) goto DONE;
2972 scrolling_puts (ts, CURSOR2 "f", delay2);
2973 if (bsod_sleep(dpy, 1)) goto DONE;
2975 scrolling_puts (ts, "\n\n\nNot ready reading drive A\nAbort, Retry, Fail?",
2977 if (bsod_sleep(dpy, 1)) goto DONE;
2979 scrolling_puts (ts, CURSOR2 "f", delay2);
2980 if (bsod_sleep(dpy, 1)) goto DONE;
2982 scrolling_puts (ts, "\nVolume in drive A has no label\n\n"
2983 "Not ready reading drive A\nAbort, Retry, Fail?",
2985 if (bsod_sleep(dpy, 1)) goto DONE;
2987 scrolling_puts (ts, CURSOR2 "a", delay2);
2988 if (bsod_sleep(dpy, 1)) goto DONE;
2990 scrolling_puts (ts, "\n\nC:\\WINDOWS>", delay1);
2993 time_t start = time((time_t *) 0);
2994 while (start + delay > time((time_t *) 0))
2995 if (scrolling_puts (ts, CURSOR, delay2))
3000 XClearWindow(dpy, window);
3009 char *progclass = "BSOD";
3011 char *defaults [] = {
3024 "*doAtari: False", /* boring */
3025 "*doBSD: False", /* boring */
3027 "*doSparcLinux: False", /* boring */
3028 "*doBlitDamage: True",
3037 ".Windows.font: -*-courier-bold-r-*-*-*-120-*-*-m-*-*-*",
3038 ".Windows.font2: -*-courier-bold-r-*-*-*-180-*-*-m-*-*-*",
3039 ".Windows.foreground: White",
3040 ".Windows.background: #0000AA", /* EGA color 0x01. */
3042 ".Amiga.font: -*-courier-bold-r-*-*-*-120-*-*-m-*-*-*",
3043 ".Amiga.font2: -*-courier-bold-r-*-*-*-180-*-*-m-*-*-*",
3044 ".Amiga.foreground: Red",
3045 ".Amiga.background: Black",
3046 ".Amiga.background2: White",
3048 ".Mac.font: -*-courier-bold-r-*-*-*-120-*-*-m-*-*-*",
3049 ".Mac.foreground: PaleTurquoise1",
3050 ".Mac.background: Black",
3052 ".Atari.foreground: Black",
3053 ".Atari.background: White",
3055 ".MacsBug.font: -*-courier-medium-r-*-*-*-100-*-*-m-*-*-*",
3056 ".MacsBug.font2: -*-courier-bold-r-*-*-*-120-*-*-m-*-*-*",
3057 ".MacsBug.font3: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*",
3058 ".MacsBug.foreground: Black",
3059 ".MacsBug.background: White",
3060 ".MacsBug.borderColor: #AAAAAA",
3062 ".mac1.foreground: Black",
3063 ".mac1.background: White",
3065 ".macX.textForeground: White",
3066 ".macX.textBackground: Black",
3067 ".macX.background: #888888",
3068 ".macX.font: -*-courier-bold-r-*-*-*-120-*-*-m-*-*-*",
3069 ".macX.font2: -*-courier-bold-r-*-*-*-240-*-*-m-*-*-*",
3071 ".SCO.font: -*-courier-bold-r-*-*-*-120-*-*-m-*-*-*",
3072 ".SCO.font2: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*",
3073 ".SCO.foreground: White",
3074 ".SCO.background: Black",
3076 ".HVX.font: -*-courier-bold-r-*-*-*-120-*-*-m-*-*-*",
3077 ".HVX.font2: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*",
3078 ".HVX.foreground: White",
3079 ".HVX.background: Black",
3081 ".Linux.font: 9x15bold",
3082 ".Linux.font2: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*",
3083 ".Linux.foreground: White",
3084 ".Linux.background: Black",
3086 ".SparcLinux.font: -*-courier-bold-r-*-*-*-120-*-*-m-*-*-*",
3087 ".SparcLinux.font2: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*",
3088 ".SparcLinux.foreground: White",
3089 ".SparcLinux.background: Black",
3092 ".BSD.font: -*-courier-bold-r-*-*-*-120-*-*-m-*-*-*",
3093 ".BSD.font2: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*",
3094 /* ".BSD.font2: -sun-console-medium-r-*-*-22-*-*-*-m-*-*-*", */
3095 ".BSD.foreground: #c0c0c0",
3096 ".BSD.background: Black",
3098 ".Solaris.font: -sun-gallant-*-*-*-*-19-*-*-*-*-120-*-*",
3099 ".Solaris.font2: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*",
3100 ".Solaris.foreground: Black",
3101 ".Solaris.background: White",
3102 "*dontClearRoot: True",
3104 ".HPUX.font: 9x15bold",
3105 ".HPUX.font2: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*",
3106 ".HPUX.foreground: White",
3107 ".HPUX.background: Black",
3109 ".OS390.font: 9x15bold",
3110 ".OS390.font2: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*",
3111 ".OS390.background: Black",
3112 ".OS390.foreground: Red",
3114 "*apple2TVColor: 50",
3116 "*apple2TVBrightness: 10",
3117 "*apple2TVContrast: 90",
3118 "*apple2SimulateUser: True",
3120 ".VMS.font: 9x15bold",
3121 ".VMS.font2: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*",
3122 ".VMS.foreground: White",
3123 ".VMS.background: Black",
3125 ".MSDOS.font: 9x15bold",
3126 ".MSDOS.font2: -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*",
3127 ".MSDOS.foreground: White",
3128 ".MSDOS.background: Black",
3132 #ifdef HAVE_XSHM_EXTENSION
3138 XrmOptionDescRec options [] = {
3139 { "-delay", ".delay", XrmoptionSepArg, 0 },
3140 { "-only", ".doOnly", XrmoptionSepArg, 0 },
3141 { "-windows", ".doWindows", XrmoptionNoArg, "True" },
3142 { "-no-windows", ".doWindows", XrmoptionNoArg, "False" },
3143 { "-nt", ".doNT", XrmoptionNoArg, "True" },
3144 { "-no-nt", ".doNT", XrmoptionNoArg, "False" },
3145 { "-2k", ".doWin2K", XrmoptionNoArg, "True" },
3146 { "-no-2k", ".doWin2K", XrmoptionNoArg, "False" },
3147 { "-amiga", ".doAmiga", XrmoptionNoArg, "True" },
3148 { "-no-amiga", ".doAmiga", XrmoptionNoArg, "False" },
3149 { "-mac", ".doMac", XrmoptionNoArg, "True" },
3150 { "-no-mac", ".doMac", XrmoptionNoArg, "False" },
3151 { "-mac1", ".doMac1", XrmoptionNoArg, "True" },
3152 { "-no-mac1", ".doMac1", XrmoptionNoArg, "False" },
3153 { "-macx", ".doMacX", XrmoptionNoArg, "True" },
3154 { "-no-macx", ".doMacX", XrmoptionNoArg, "False" },
3155 { "-atari", ".doAtari", XrmoptionNoArg, "True" },
3156 { "-no-atari", ".doAtari", XrmoptionNoArg, "False" },
3157 { "-macsbug", ".doMacsBug", XrmoptionNoArg, "True" },
3158 { "-no-macsbug", ".doMacsBug", XrmoptionNoArg, "False" },
3159 { "-apple2", ".doApple2", XrmoptionNoArg, "True" },
3160 { "-no-apple2", ".doApple2", XrmoptionNoArg, "False" },
3161 { "-sco", ".doSCO", XrmoptionNoArg, "True" },
3162 { "-no-sco", ".doSCO", XrmoptionNoArg, "False" },
3163 { "-hvx", ".doHVX", XrmoptionNoArg, "True" },
3164 { "-no-hvx", ".doHVX", XrmoptionNoArg, "False" },
3165 { "-bsd", ".doBSD", XrmoptionNoArg, "True" },
3166 { "-no-bsd", ".doBSD", XrmoptionNoArg, "False" },
3167 { "-linux", ".doLinux", XrmoptionNoArg, "True" },
3168 { "-no-linux", ".doLinux", XrmoptionNoArg, "False" },
3169 { "-sparclinux", ".doSparcLinux", XrmoptionNoArg, "True" },
3170 { "-no-sparclinux", ".doSparcLinux", XrmoptionNoArg, "False" },
3171 { "-blitdamage", ".doBlitDamage", XrmoptionNoArg, "True" },
3172 { "-no-blitdamage", ".doBlitDamage", XrmoptionNoArg, "False" },
3173 { "-solaris", ".doSolaris", XrmoptionNoArg, "True" },
3174 { "-no-solaris", ".doSolaris", XrmoptionNoArg, "False" },
3175 { "-hpux", ".doHPUX", XrmoptionNoArg, "True" },
3176 { "-no-hpux", ".doHPUX", XrmoptionNoArg, "False" },
3177 { "-os390", ".doOS390", XrmoptionNoArg, "True" },
3178 { "-no-os390", ".doOS390", XrmoptionNoArg, "False" },
3179 { "-vms", ".doVMS", XrmoptionNoArg, "True" },
3180 { "-no-vms", ".doVMS", XrmoptionNoArg, "False" },
3181 { "-msdos", ".doMSDOS", XrmoptionNoArg, "True" },
3182 { "-no-msdos", ".doMSDOS", XrmoptionNoArg, "False" },
3190 void (*fn) (Display *, Window, int delay);
3192 { "Windows", windows_31 },
3193 { "NT", windows_nt },
3194 { "Win2K", windows_2k },
3197 { "MacsBug", macsbug },
3202 { "SparcLinux", sparc_linux },
3205 { "BlitDamage", blitdamage },
3206 { "Solaris", sparc_solaris },
3207 { "Linux", linux_fsck },
3210 { "Apple2", apple2crash },
3217 screenhack (Display *dpy, Window window)
3223 int delay = get_integer_resource ("delay", "Integer");
3224 if (delay < 3) delay = 3;
3227 char *s = get_string_resource("doOnly", "DoOnly");
3230 int count = countof(all_modes);
3231 for (only = 0; only < count; only++)
3232 if (!strcasecmp (s, all_modes[only].name))
3236 fprintf (stderr, "%s: unknown -only mode: \"%s\"\n", progname, s);
3243 if (!get_boolean_resource ("root", "Boolean"))
3245 XWindowAttributes xgwa;
3246 XGetWindowAttributes (dpy, window, &xgwa);
3247 XSelectInput (dpy, window,
3248 xgwa.your_event_mask |
3249 KeyPressMask | ButtonPressMask | ExposureMask);
3255 int count = countof(all_modes);
3256 char name[100], class[100];
3261 do { i = (random() & 0xFF) % count; } while (i == j);
3263 sprintf (name, "do%s", all_modes[i].name);
3264 sprintf (class, "Do%s", all_modes[i].name);
3267 if (only > 0 || get_boolean_resource(name, class))
3269 all_modes[i].fn (dpy, window, delay);
3274 if (loop > 100) j = -1;
3277 fprintf (stderr, "%s: no display modes enabled?\n", progname);