ftp://ftp.krokus.ru/pub/OpenBSD/distfiles/xscreensaver-4.22.tar.gz
[xscreensaver] / hacks / bsod.c
index 32877b8bccb0451f5c993894912cf09288ea4174..680475d5b8cd2233ecf5b5dbe52cc052473a827f 100644 (file)
@@ -1,4 +1,4 @@
-/* xscreensaver, Copyright (c) 1998-2003 Jamie Zawinski <jwz@jwz.org>
+/* xscreensaver, Copyright (c) 1998-2005 Jamie Zawinski <jwz@jwz.org>
  *
  * Permission to use, copy, modify, distribute, and sell this software and its
  * documentation for any purpose is hereby granted without fee, provided that
@@ -336,12 +336,42 @@ windows (Display *dpy, Window window, int delay, int which)
      "assitance.\n"
      );
 
+  /* The "RSOD" that appeared with "Windows Longhorn 5048.050401-0536_x86fre"
+     As reported by http://joi.ito.com/RedScreen.jpg
+   */
+  const char *wlha =
+    ("_Windows Boot Error\n");
+  const char *wlhb =
+    ("\n"
+     "Windows Boot Manager has experienced a problem.\n"
+     "\n"
+     "\n"
+     "    Status: 0xc000000f\n"
+     "\n"
+     "\n"
+     "\n"
+     "    Info: An error occurred transferring exectuion."  /* (sic) */
+     "\n"
+     "\n"
+     "\n"
+     "You can try to recover the system with the Microsoft Windows "
+     "System Recovery\n"
+     "Tools. (You might need to restart the system manually.)\n"
+     "\n"
+     "If the problem continues, please contact your system administrator "
+     "or computer\n"
+     "manufacturer.\n"
+     );
+  const char *wlhc =
+    (" SPACE=Continue\n"
+     );
+
   if (which < 0 || which > 2) abort();
 
   /* kludge to lump Win2K, WinME, and WinXP together; seems silly to add
      another preference/command line option just for these little ones. */
   if (which == 2 && (random() % 2))
-    which = 3 + (random() % 2);
+    which = 3 + (random() % 3);
 
   XGetWindowAttributes (dpy, window, &xgwa);
 
@@ -366,12 +396,14 @@ windows (Display *dpy, Window window, int delay, int which)
   gcv.foreground = get_pixel_resource((which == 0 ? "windows95.foreground" :
                                       which == 1 ? "windowsNT.foreground" :
                                       which == 2 ? "windows2K.foreground" :
+                                      which == 5 ? "windowsLH.foreground" :
                                                     "windowsME.foreground"),
                                      "Windows.Foreground",
                                      dpy, xgwa.colormap);
   gcv.background = get_pixel_resource((which == 0 ? "windows95.background" :
                                       which == 1 ? "windowsNT.background" :
                                       which == 2 ? "windows2K.background" :
+                                       which == 5 ? "windowsLH.background" :
                                                     "windowsME.background"),
                                      "Windows.Background",
                                      dpy, xgwa.colormap);
@@ -429,6 +461,33 @@ windows (Display *dpy, Window window, int delay, int which)
             delay--;
         }
     }
+  else if (which == 5)
+    {
+      int line_height = font->ascent + font->descent;
+      int x = 0;
+      int y = 0;
+      unsigned long p0 = gcv.background;
+      unsigned long p1 = gcv.foreground;
+      unsigned long p2 = get_pixel_resource("windowsLH.background2",
+                                            "Windows.Background",
+                                            dpy, xgwa.colormap);
+      XSetBackground (dpy, gc, p2);
+      XSetForeground (dpy, gc, p2);
+      XFillRectangle (dpy, window, gc, 0, 0, xgwa.width, line_height+2);
+      XSetForeground (dpy, gc, p0);
+      draw_string (dpy, window, gc, &gcv, font, x, y, xgwa.width, 10, wlha, 0);
+      y += line_height;
+      XSetForeground (dpy, gc, p1);
+      XSetBackground (dpy, gc, p0);
+      draw_string (dpy, window, gc, &gcv, font, x, y, 10, 10, wlhb, 0);
+
+      y = xgwa.height - (line_height+2);
+      XSetBackground (dpy, gc, p2);
+      XSetForeground (dpy, gc, p2);
+      XFillRectangle (dpy, window, gc, 0, y, xgwa.width, line_height+2);
+      XSetForeground (dpy, gc, p0);
+      draw_string (dpy, window, gc, &gcv, font, x, y, 10, 10, wlhc, 0);
+    }
   else
     abort();
 
@@ -1506,7 +1565,7 @@ blitdamage (Display *dpy, Window window, int delay)
   
   XGetWindowAttributes(dpy, window, &xwa);
 
-  load_random_image (xwa.screen, window, window, NULL);
+  load_random_image (xwa.screen, window, window, NULL, NULL);
 
   w = xwa.width;
   h = xwa.height;
@@ -1556,6 +1615,177 @@ blitdamage (Display *dpy, Window window, int delay)
   XFreeGC(dpy, gc0);
 }
 
+\f
+/* nvidia, by jwz.
+ *
+ * This is what happens if an Nvidia card goes into some crazy text mode.
+ * Most often seen on the second screen of a dual-head system when the
+ * proper driver isn't loaded.
+ */
+typedef struct { int fg; int bg; int bit; Bool blink; } nvcell;
+
+static void
+nvspatter (nvcell *grid, int rows, int cols, int ncolors, int nbits,
+           Bool fill_p)
+{
+  int max = rows * cols;
+  int from = fill_p ?   0 : random() % (max - 1);
+  int len  = fill_p ? max : random() % (cols * 4);
+  int to = from + len;
+  int i;
+  Bool noisy = ((random() % 4) == 0);
+  Bool diag = (noisy || fill_p) ? 0 : ((random() % 4) == 0);
+
+  int fg = random() % ncolors;
+  int bg = random() % ncolors;
+  int blink = ((random() % 4) == 0);
+  int bit = (random() % nbits);
+
+  if (to > max) to = max;
+
+  if (diag)
+    {
+      int src = random() % (rows * cols);
+      int len2 = (cols / 2) - (random() % 5);
+      int j = src;
+      for (i = from; i < to; i++, j++)
+        {
+          if (j > src + len2 || j >= max)
+            j = src;
+          if (i >= max) abort();
+          if (j >= max) abort();
+          grid[j] = grid[i];
+        }
+    }
+  else
+    for (i = from; i < to; i++)
+      {
+        nvcell *cell = &grid[i];
+        cell->fg = fg;
+        cell->bg = bg;
+        cell->bit = bit;
+        cell->blink = blink;
+
+        if (noisy)
+          {
+            fg = random() % ncolors;
+            bg = random() % ncolors;
+            blink = ((random() % 8) == 0);
+          }
+      }
+}
+
+
+static void
+nvidia (Display *dpy, Window window, int delay)
+{
+  XGCValues gcv;
+  XWindowAttributes xgwa;
+  int cols, rows;
+  int cellw, cellh;
+  unsigned long colors[256];
+  int ncolors;
+  GC gc, gc1 = 0;
+  int x, y, i;
+  int tick = 0;
+  nvcell *grid;
+  Pixmap bits[5];
+
+  XGetWindowAttributes (dpy, window, &xgwa);
+
+  cols = 80;
+  rows = 25;
+  cellw = xgwa.width  / cols;
+  cellh = xgwa.height / rows;
+  if (cellw < 8 || cellh < 18)
+    cellw = 8, cellh = 18;
+  cols = (xgwa.width  / cellw) + 1;
+  rows = (xgwa.height / cellh) + 1;
+
+  grid = (nvcell *) calloc (sizeof(*grid), rows * cols);
+  gc = XCreateGC (dpy, window, 0, &gcv);
+
+  /* Allocate colors
+   */
+  ncolors = 16;
+  for (i = 0; i < ncolors; i++)
+    {
+      XColor c;
+      c.red   = random() & 0xFFFF;
+      c.green = random() & 0xFFFF;
+      c.blue  = random() & 0xFFFF;
+      c.flags = DoRed|DoGreen|DoBlue;
+      XAllocColor (dpy, xgwa.colormap, &c);
+      colors[i] = c.pixel;
+    }
+
+  /* Construct corrupted character bitmaps
+   */
+  for (i = 0; i < countof(bits); i++)
+    {
+      int j;
+
+      bits[i] = XCreatePixmap (dpy, window, cellw, cellh, 1);
+      if (!gc1) gc1 = XCreateGC (dpy, bits[i], 0, &gcv);
+
+      XSetForeground (dpy, gc1, 0);
+      XFillRectangle (dpy, bits[i], gc1, 0, 0, cellw, cellh);
+      XSetForeground (dpy, gc1, ~0L);
+
+      if ((random() % 40) != 0)
+        for (j = 0; j < ((cellw * cellh) / 16); j++)
+          XFillRectangle (dpy, bits[i], gc1,
+                          (random() % (cellw-2)) & ~1,
+                          (random() % (cellh-2)) & ~1,
+                          2, 2);
+    }
+
+  /* Randomize the grid
+   */
+  nvspatter (grid, rows, cols, ncolors, countof(bits), True);
+  for (i = 0; i < 20; i++)
+    nvspatter (grid, rows, cols, ncolors, countof(bits), False);
+
+
+  /* Redisplay loop: blink 4x/second
+   */
+  while (1)
+    {
+      for (y = 0; y < rows; y++)
+        for (x = 0; x < cols; x++)
+          {
+            nvcell *cell = &grid[y * cols + x];
+            unsigned long fg = colors[cell->fg];
+            unsigned long bg = colors[cell->bg];
+            Bool flip = cell->blink && (tick & 1);
+            XSetForeground (dpy, gc, flip ? fg : bg);
+            XSetBackground (dpy, gc, flip ? bg : fg);
+            XCopyPlane (dpy, bits[cell->bit], window, gc,
+                        0, 0, cellw, cellh,
+                        x * cellw, y * cellh, 1L);
+          }
+
+      if ((random() % 5) == 0)    /* change the display */
+        nvspatter (grid, rows, cols, ncolors, countof(bits), False);
+
+      XSync (dpy, False);
+      usleep (250000);
+      if (bsod_sleep(dpy, 0))
+        goto DONE;
+      if (tick / 4 >= delay)
+        goto DONE;
+      tick++;
+    }
+
+ DONE:
+  XFreeColors (dpy, xgwa.colormap, colors, ncolors, 0);
+  for (i = 0; i < countof(bits); i++)
+    XFreePixmap (dpy, bits[i]);
+  XFreeGC (dpy, gc);
+  XFreeGC (dpy, gc1);
+  free (grid);
+}
+
 \f
 /*
  * SPARC Solaris panic. Should look pretty authentic on Solaris boxes.
@@ -1640,7 +1870,7 @@ make_scrolling_window (Display *dpy, Window window,
   if (!grab_screen_p) ts->sub_height += ts->sub_y, ts->sub_y = 0;
 
   if (grab_screen_p)
-    load_random_image (xgwa.screen, window, window, NULL);
+    load_random_image (xgwa.screen, window, window, NULL, NULL);
 
   sprintf (buf1, "%.50s.background", name);
   sprintf (buf2, "%.50s.Background", name);
@@ -2189,6 +2419,208 @@ linux_fsck (Display *dpy, Window window, int delay)
   XClearWindow(dpy, window);
 }
 
+\f
+
+/*
+ * Linux (hppa) panic, by Stuart Brady <sdbrady@ntlworld.com>
+ * Output courtesy of M. Grabert
+ */
+static void
+hppa_linux (Display *dpy, Window window, int delay)
+{
+  XWindowAttributes xgwa;
+  scrolling_window *ts;
+  int i=0;
+  const char *sysname;
+  long int linedelay=0;
+
+# ifdef __GNUC__
+  __extension__   /* don't warn about "string length is greater than the
+                     length ISO C89 compilers are required to support"
+                     in the following string constant... */
+# endif
+
+  struct { long int delay; const char *string; } linux_panic[] =
+    {{ 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"
+          "\n\n\n\n\n\n\n\n\n\n\n\n\n" },
+     { 0, "Linux version 2.6.0-test11-pa2 (root@%s) "
+          "(gcc version 3.3.2 (Debian)) #2 Mon Dec 8 06:09:27 GMT 2003\n" },
+     { 4000, "FP[0] enabled: Rev 1 Model 16\n" },
+     { 10, "The 32-bit Kernel has started...\n" },
+     { -1, "Determining PDC firmware type: System Map.\n" },
+     { -1, "model 00005bb0 00000481 00000000 00000002 7778df9f 100000f0 "
+           "00000008 000000b2 000000b2\n" },
+     { -1, "vers  00000203\n" },
+     { -1, "CPUID vers 17 rev 7 (0x00000227)\n" },
+     { -1, "capabilities 0x3\n" },
+     { -1, "model 9000/785/C3000\n" },
+     { -1, "Total Memory: 1024 Mb\n" },
+     { -1, "On node 0 totalpages: 262144\n" },
+     { -1, "  DMA zone: 262144 pages, LIFO batch:16\n" },
+     { -1, "  Normal zone: 0 pages, LIFO batch:1\n" },
+     { -1, "  HighMem zone: 0 pages, LIFO batch:1\n" },
+     { -1, "LCD display at f05d0008,f05d0000 registered\n" },
+     { -1, "Building zonelist for node : 0\n" },
+     { -1, "Kernel command line: ide=nodma root=/dev/sda3 HOME=/ ip=off "
+           "console=ttyS0 TERM=vt102 palo_kernel=2/vmlinux-2.6\n" },
+     { -1, "ide_setup: ide=nodmaIDE: Prevented DMA\n" },
+     { -1, "PID hash table entries: 16 (order 4: 128 bytes)\n" },
+     {500, "Console: colour dummy device 160x64\n" },
+     { 10, "Memory: 1034036k available\n" },
+     { -1, "Calibrating delay loop... 796.67 BogoMIPS\n" },
+     { -1, "Dentry cache hash table entries: 131072 (order: 7, 524288 "
+           "bytes)\n" },
+     { -1, "Inode-cache hash table entries: 65536 (order: 6, 262144 "
+           "bytes)\n" },
+     { -1, "Mount-cache hash table entries: 512 (order: 0, 4096 bytes)\n" },
+     { -1, "POSIX conformance testing by UNIFIX\n" },
+     { -1, "NET: Registered protocol family 16\n" },
+     { 100, "Searching for devices...\n" },
+     { 25, "Found devices:\n" },
+     { 10, "1. Astro BC Runway Port at 0xfed00000 [10] "
+           "{ 12, 0x0, 0x582, 0x0000b }\n" },
+     { -1, "2. Elroy PCI Bridge at 0xfed30000 [10/0] "
+           "{ 13, 0x0, 0x782, 0x0000a }\n" },
+     { -1, "3. Elroy PCI Bridge at 0xfed32000 [10/1] "
+           "{ 13, 0x0, 0x782, 0x0000a }\n" },
+     { -1, "4. Elroy PCI Bridge at 0xfed38000 [10/4] "
+           "{ 13, 0x0, 0x782, 0x0000a }\n" },
+     { -1, "5. Elroy PCI Bridge at 0xfed3c000 [10/6] "
+           "{ 13, 0x0, 0x782, 0x0000a }\n" },
+     { -1, "6. AllegroHigh W at 0xfffa0000 [32] "
+           "{ 0, 0x0, 0x5bb, 0x00004 }\n" },
+     { -1, "7. Memory at 0xfed10200 [49] { 1, 0x0, 0x086, 0x00009 }\n" },
+     { -1, "CPU(s): 1 x PA8500 (PCX-W) at 400.000000 MHz\n" },
+     { -1, "SBA found Astro 2.1 at 0xfed00000\n" },
+     { -1, "lba version TR2.1 (0x2) found at 0xfed30000\n" },
+     { -1, "lba version TR2.1 (0x2) found at 0xfed32000\n" },
+     { -1, "lba version TR2.1 (0x2) found at 0xfed38000\n" },
+     { -1, "lba version TR2.1 (0x2) found at 0xfed3c000\n" },
+     { 100, "SCSI subsystem initialized\n" },
+     { 10, "drivers/usb/core/usb.c: registered new driver usbfs\n" },
+     { -1, "drivers/usb/core/usb.c: registered new driver hub\n" },
+     { -1, "ikconfig 0.7 with /proc/config*\n" },
+     { -1, "Initializing Cryptographic API\n" },
+     { 250, "SuperIO: probe of 0000:00:0e.0 failed with error -1\n" },
+     { 20, "SuperIO: Found NS87560 Legacy I/O device at 0000:00:0e.1 "
+           "(IRQ 64)\n" },
+     { -1, "SuperIO: Serial port 1 at 0x3f8\n" },
+     { -1, "SuperIO: Serial port 2 at 0x2f8\n" },
+     { -1, "SuperIO: Parallel port at 0x378\n" },
+     { -1, "SuperIO: Floppy controller at 0x3f0\n" },
+     { -1, "SuperIO: ACPI at 0x7e0\n" },
+     { -1, "SuperIO: USB regulator enabled\n" },
+     { -1, "SuperIO: probe of 0000:00:0e.2 failed with error -1\n" },
+     { -1, "Soft power switch enabled, polling @ 0xf0400804.\n" },
+     { -1, "pty: 256 Unix98 ptys configured\n" },
+     { -1, "Generic RTC Driver v1.07\n" },
+     { -1, "Serial: 8250/16550 driver $Revision: 1.66 $ 13 ports, "
+           "IRQ sharing disabled\n" },
+     { -1, "ttyS0 at I/O 0x3f8 (irq = 0) is a 16550A\n" },
+     { -1, "ttyS1 at I/O 0x2f8 (irq = 0) is a 16550A\n" },
+     { -1, "Linux Tulip driver version 1.1.13 (May 11, 2002)\n" },
+     { 150, "tulip0: no phy info, aborting mtable build\n" },
+     { 10, "tulip0:  MII transceiver #1 config 1000 status 782d "
+           "advertising 01e1.\n" },
+     { -1, "eth0: Digital DS21143 Tulip rev 65 at 0xf4008000, "
+           "00:10:83:F9:B4:34, IRQ 66.\n" },
+     { -1, "Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2\n" },
+     { -1, "ide: Assuming 33MHz system bus speed for PIO modes; "
+           "override with idebus=xx\n" },
+     { 100, "SiI680: IDE controller at PCI slot 0000:01:06.0\n" },
+     { 10, "SiI680: chipset revision 2\n" },
+     { -1, "SiI680: BASE CLOCK == 133\n" },
+     { -1, "SiI680: 100% native mode on irq 128\n" },
+     { -1, "    ide0: MMIO-DMA at 0xf4800000-0xf4800007 -- "
+           "Error, MMIO ports already in use.\n" },
+     { -1, "    ide1: MMIO-DMA at 0xf4800008-0xf480000f -- "
+           "Error, MMIO ports already in use.\n" },
+     { 5, "hda: TS130220A2, ATA DISK drive\n" },
+     { -1, "      _______________________________\n" },
+     { -1, "     < Your System ate a SPARC! Gah! >\n" },
+     { -1, "      -------------------------------\n" },
+     { -1, "             \\   ^__^\n" },
+     { -1, "              \\  (xx)\\_______\n" },
+     { -1, "                 (__)\\       )\\/\\\n" },
+     { -1, "                  U  ||----w |\n" },
+     { -1, "                     ||     ||\n" },
+     { -1, "swapper (pid 1): Breakpoint (code 0)\n" },
+     { -1, "\n" },
+     { -1, "     YZrvWESTHLNXBCVMcbcbcbcbOGFRQPDI\n" },
+     { -1, "PSW: 00000000000001001111111100001111 Not tainted\n" },
+     { -1, "r00-03  4d6f6f21 1032f010 10208f34 103fc2e0\n" },
+     { -1, "r04-07  103fc230 00000001 00000001 0000000f\n" },
+     { -1, "r08-11  103454f8 000f41fa 372d3980 103ee404\n" },
+     { -1, "r12-15  3ccbf700 10344810 103ee010 f0400004\n" },
+     { -1, "r16-19  f00008c4 f000017c f0000174 00000000\n" },
+     { -1, "r20-23  fed32840 fed32800 00000000 0000000a\n" },
+     { -1, "r24-27  0000ffa0 000000ff 103fc2e0 10326010\n" },
+     { -1, "r28-31  00000000 00061a80 4ff98340 10208f34\n" },
+     { -1, "sr0-3   00000000 00000000 00000000 00000000\n" },
+     { -1, "sr4-7   00000000 00000000 00000000 00000000\n" },
+     { -1, "\n" },
+     { -1, "IASQ: 00000000 00000000 IAOQ: 00000000 00000004\n" },
+     { -1, " IIR: 00000000    ISR: 00000000  IOR: 00000000\n" },
+     { -1, " CPU:        0   CR30: 4ff98000 CR31: 1037c000\n" },
+     { -1, " ORIG_R28: 55555555\n" },
+     { -1, " IAOQ[0]: 0x0\n" },
+     { -1, " IAOQ[1]: 0x4\n" },
+     { -1, " RP(r2): probe_hwif+0x218/0x44c\n" },
+     { -1, "Kernel panic: Attempted to kill init!\n" },
+     { 0, NULL }};
+
+  XGetWindowAttributes (dpy, window, &xgwa);
+  XSetWindowBackground (dpy, window, 
+                        get_pixel_resource("HPPALinux.background",
+                                           "HPPALinux.Background",
+                                           dpy, xgwa.colormap));
+  XClearWindow(dpy, window);
+
+  sysname = "hppa";
+# ifdef HAVE_UNAME
+  {
+    struct utsname uts;
+    char *s;
+    if (uname (&uts) >= 0)
+      sysname = uts.nodename;
+    s = strchr (sysname, '.');
+    if (s) *s = 0;
+  }
+# endif        /* !HAVE_UNAME */
+
+  /* Insert current host name into banner on line 2 */
+  {
+    static char ss[1024];
+    sprintf (ss, linux_panic[1].string, sysname);
+    linux_panic[1].string = ss;
+  }
+
+  ts = make_scrolling_window (dpy, window, "HPPALinux", False);
+
+  usleep (100000);
+  while (linux_panic[i].string)
+    {
+      if (linux_panic[i].delay != -1)
+        linedelay = linux_panic[i].delay * 1000;
+      usleep (linedelay);
+      scrolling_puts (ts, linux_panic[i].string, 0);
+      XSync(dpy, False);
+      if (bsod_sleep (dpy, 0))
+        goto DONE;
+      i++;
+    }
+
+  if (bsod_sleep (dpy, 4))
+    goto DONE;
+
+  XSync(dpy, False);
+  bsod_sleep(dpy, delay);
+
+ DONE:
+  free_scrolling_window (ts);
+  XClearWindow(dpy, window);
+}
+
 /* VMS by jwz (text sent by Roland Barmettler <roli@barmettler.net>)
  */
 static void
@@ -2678,6 +3110,125 @@ DONE:
 }
 
 
+\f
+
+/* Compaq Tru64 Unix panic, by jwz as described by
+   Tobias Klausmann <klausman@schwarzvogel.de>
+ */
+
+static void
+tru64 (Display* dpy, Window window, int delay)
+{
+  XWindowAttributes xgwa;
+  scrolling_window *ts;
+  const char *sysname;
+  char buf[2048];
+
+# ifdef __GNUC__
+  __extension__   /* don't warn about "string length is greater than the
+                     length ISO C89 compilers are required to support"
+                     in the following string constant... */
+# endif
+
+  const char *msg1 =
+   ("panic (cpu 0): trap: illegal instruction\n"
+    "kernel inst fault=gentrap, ps=0x5, pc=0xfffffc0000593878, inst=0xaa\n"
+    "kernel inst fault=gentrap, ps=0x5, pc=0xfffffc0000593878, inst=0xaa\n"
+    "                                                                   \n"
+    "DUMP: blocks available:  1571600\n"
+    "DUMP: blocks wanted:      100802 (partial compressed dump) [OKAY]\n"
+    "DUMP: Device     Disk Blocks Available\n"
+    "DUMP: ------     ---------------------\n"
+    "DUMP: 0x1300023  1182795 - 1571597 (of 1571598) [primary swap]\n"
+    "DUMP.prom: Open: dev 0x5100041, block 2102016: SCSI 0 11 0 2 200 0 0\n"
+    "DUMP: Writing header... [1024 bytes at dev 0x1300023, block 1571598]\n"
+    "DUMP: Writing data");
+  const char *msg2 =
+   ("DUMP: Writing header... [1024 bytes at dev 0x1300023, block 1571598]\n"
+    "DUMP: crash dump complete.\n"
+    "kernel inst fault=gentrap, ps=0x5, pc=0xfffffc0000593878, inst=0xaa\n"
+    "                                                                   \n"
+    "DUMP: second crash dump skipped: 'dump_savecnt' enforced.\n");
+  const char *msg3 =
+   ("\n"
+    "halted CPU 0\n"
+    "\n"
+    "halt code = 5\n"
+    "HALT instruction executed\n"
+    "PC = fffffc00005863b0\n");
+  const char *msg4 =
+   ("\n"   
+    "CPU 0 booting\n"
+    "\n"
+    "\n"
+    "\n");
+
+  XGetWindowAttributes (dpy, window, &xgwa);
+  ts = make_scrolling_window (dpy, window, "Tru64", False);
+  XClearWindow(dpy,window);
+  ts->columns = 10000;  /* never wrap */
+  ts->sub_x = 0;
+  ts->sub_y = 0;
+  ts->sub_width = xgwa.width;
+  ts->sub_height = xgwa.height;
+
+  sysname = "127.0.0.1";
+# ifdef HAVE_UNAME
+  {
+    struct utsname uts;
+    if (uname (&uts) >= 0)
+      sysname = uts.nodename;
+  }
+# endif        /* !HAVE_UNAME */
+
+  if (bsod_sleep (dpy, 1))
+    goto DONE;
+  
+      
+
+  sprintf (buf,
+           "Compaq Tru64 UNIX V5.1B (Rev. 2650) (%.100s) console\n"
+           "\n"
+           "login: ",
+           sysname);
+  scrolling_puts (ts, buf, 0);
+  if (bsod_sleep (dpy, 6))
+    goto DONE;
+
+  scrolling_puts (ts, msg1, 0);
+  {
+    int i;
+    int steps = 4 + (random() % 8);
+    for (i = 0; i < steps; i++)
+      {
+        scrolling_puts (ts, ".", 0);
+        XSync (dpy, False);
+        if (bsod_sleep (dpy, 1))
+          goto DONE;
+      }
+    sprintf (buf, "[%dMB]\n", steps);
+    scrolling_puts (ts, buf, 0);
+  }
+
+  scrolling_puts (ts, msg2, 0);
+  XSync(dpy, False);
+  if (bsod_sleep (dpy, 4))
+    goto DONE;
+
+  scrolling_puts (ts, msg3, 0);
+  XSync(dpy, False);
+  if (bsod_sleep (dpy, 3))
+    goto DONE;
+
+  scrolling_puts (ts, msg4, 0);
+  XSync(dpy, False);
+  bsod_sleep(dpy, delay);
+
+ DONE:
+  free_scrolling_window (ts);
+}
+
+
 \f
 /*
  * Simulate various Apple ][ crashes. The memory map encouraged many programs
@@ -2940,6 +3491,290 @@ apple2crash (Display* dpy, Window window, int delay)
   apple2 (dpy, window, delay, a2controller_crash);
 }
 
+/* MS-DOS, by jwz
+ */
+static void
+msdos (Display *dpy, Window window, int delay)
+{
+  XWindowAttributes xgwa;
+  scrolling_window *ts;
+
+  int delay1 = 10000;
+  int delay2 = 200000;
+
+# define CURSOR "_\b \b"
+# define CURSOR2 CURSOR CURSOR CURSOR
+
+  XGetWindowAttributes (dpy, window, &xgwa);
+  ts = make_scrolling_window (dpy, window, "MSDOS", False);
+
+  XClearWindow(dpy, window);
+
+  scrolling_puts (ts, "C:\\WINDOWS>", delay1);
+  if (bsod_sleep(dpy, 1)) goto DONE;
+
+  scrolling_puts (ts, CURSOR2 "dir a:", delay2);
+  if (bsod_sleep(dpy, 1)) goto DONE;
+
+  scrolling_puts (ts, "\nNot ready reading drive A\nAbort, Retry, Fail?",
+                  delay1);
+  if (bsod_sleep(dpy, 1)) goto DONE;
+
+  scrolling_puts (ts, CURSOR2 "f", delay2);
+  if (bsod_sleep(dpy, 1)) goto DONE;
+
+  scrolling_puts (ts, "\n\n\nNot ready reading drive A\nAbort, Retry, Fail?",
+                  delay1);
+  if (bsod_sleep(dpy, 1)) goto DONE;
+
+  scrolling_puts (ts, CURSOR2 "f", delay2);
+  if (bsod_sleep(dpy, 1)) goto DONE;
+
+  scrolling_puts (ts, "\nVolume in drive A has no label\n\n"
+                  "Not ready reading drive A\nAbort, Retry, Fail?",
+                  delay1);
+  if (bsod_sleep(dpy, 1)) goto DONE;
+
+  scrolling_puts (ts, CURSOR2 "a", delay2);
+  if (bsod_sleep(dpy, 1)) goto DONE;
+
+  scrolling_puts (ts, "\n\nC:\\WINDOWS>", delay1);
+
+  {
+    time_t start = time((time_t *) 0);
+    while (start + delay > time((time_t *) 0))
+      if (scrolling_puts (ts, CURSOR, delay2))
+        break;
+  }
+
+ DONE:
+  XClearWindow(dpy, window);
+
+# undef CURSOR
+# undef CURSOR2
+}
+
+
+/*
+ * OS/2 panics, by Knut St. Osmundsen <bird-xscreensaver@anduin.net>
+ *
+ * All but one messages are real ones, some are from my test machines
+ * and system dumps, others are reconstructed from google results.
+ * Please, don't be to hard if the formatting of the earlier systems
+ * aren't 100% correct.
+ */
+static void
+os2 (Display *dpy, Window window, int delay)
+{
+  XGCValues gcv;
+  XWindowAttributes xgwa;
+  XFontStruct *font;
+  GC gc;
+  char *fontname;
+  const char *def_font = "fixed";
+  const char *str;
+  const char *panic_msg;
+  time_t start;
+  int line_height;
+  int i;
+  int y;
+
+# ifdef __GNUC__
+  __extension__   /* don't warn about "string length is greater than the
+                     length ISO C89 compilers are required to support"
+                     in the following string constant... */
+# endif
+
+  static const char *os2_panics[] =
+    { /* OS/2 2.0 trap - details are bogus (CR0++). */
+      "TRAP 0002       ERRCD=0000  ERACC=****  ERLIM=********\n"
+      "EAX=7d240a58  EBX=ff202fdc  ECX=00064423  EDX=00003624\n"
+      "ESI=fff3272c  EDI=7d240004  EBP=00004a44  FLG=00003202\n"
+      "CS:EIP=0160:fff702a6  CSACC=c09d  CSLIM=ffffffff\n"
+      "SS:ESP=0030:00004a38  SSACC=1097  SSLIM=00003fff\n"
+      "DS=0158  DSACC=c0f3  DSLIM=ffffffff  CR0=fffffffb\n"
+      "ES=0158  ESACC=c0f3  ESLIM=ffffffff  CR2=1a060014\n"
+      "FS=0000  FSACC=****  FSLIM=********\n"
+      "GS=0000  GSACC=****  GSLIM=********\n"
+      "\n"
+      "The system detected an internal processing error\n"
+      "at location ##0160:fff6453f - 000d:a53f\n"
+      "60000, 9084\n"
+      "\n"
+      "038600d1\n"
+      "Internal revision 6.307, 92/03/01\n"
+      "\n",
+
+      /* warp 3 (early) */
+      "TRAP 000e       ERRCD=0000  ERACC=****  ERLIM=********\n"
+      "EAX=ff050c20  EBX=000000bb  ECX=ffff00c1  EDx=fff379b8\n"
+      "ESI=ffe55a3c  EDI=00000000  EBP=00004eb8  FLG=00013282\n"
+      "CS:EIP=0160:fff8dbb8  CSACC=c09b  CSLIM=ffffffff\n"
+      "SS:EIP=0030:00004eb4  SSACC=1097  SSLIM=00003fff\n"
+      "DS=0158  DSACC=c0f3  DSLIM=ffffffff  CR0=8001001b\n"
+      "ES=0158  DSACC=c0f3  DSLIM=ffffffff  CR2=000000c7\n"
+      "FS=0000  FSACC=****  FSLIM=********\n"
+      "GS=0000  GSACC=****  GSLIM=********\n"
+      "\n"
+      "The system detected an internal processing error\n"
+      "at location ##0160:fff66bf0 - 000d:9bf0.\n"
+      "60000, 9084\n"
+      "\n"
+      "048600b4\n"
+      "Internal revision 8.125, 94/02/16\n"
+      "\n"
+      "The system is stopped.  Record the location number of the error\n"
+      "and contact your service representative.\n",
+
+      /* warp 3 */
+      "TRAP 000e       ERRCD=0002  ERACC=****  ERLIM=********\n"
+      "EAX=00000000  EBX=fdef1e0c  ECX=00003824  EDX=0000edf9\n"
+      "ESI=fdf30e80  EDI=fc8b0000  EBP=00005658  FLG=00012246\n"
+      "CS:EIP=0160:fff8ada3  CSACC=c09b  CSLIM=ffffffff\n"
+      "SS:ESP=0030:000055d4  SSACC=1097  SSLIM=0000480f\n"
+      "DS=0158  DSACC=c093  DSLIM=ffffffff  CR0=8001001b\n"
+      "ES=0158  ESACC=c093  ESLIM=ffffffff  CR2=fc8b0000\n"
+      "FS=03b8  FSACC=0093  FSLIM=00000023\n"
+      "GS=0000  GSACC=****  GSLIM=********\n"
+      "\n"
+      "The system detected an internal processing error\n"
+      "at location ##0160:fff5c364 - 000d:a364.\n"
+      "60000, 9084\n"
+      "\n"
+      "05860526\n"
+      "Internal revision 8200,94/11/07\n"
+      "\n"
+      "The system is stopped. Record all of the above information and\n"
+      "contact your service representative.\n",
+
+      /* warp 3 (late) */
+      "TRAP 000d       ERRCD=2200  ERACC=1092  ERLIM=00010fff\n"
+      "EAX=0000802e  EBX=fff001c8  ECX=9bd80000  EDX=00000000\n"
+      "ESI=fff09bd8  EDI=fdeb001b  EBP=00000000  FLG=00012012\n"
+      "CS:EIP=0168:fff480a2  CSACC=c09b  CSLIM=ffffffff\n"
+      "SS:ESP=00e8:00001f32  SSACC=0093  SSLIM=00001fff\n"
+      "DS=0940  DSACC=0093  DSLIM=00000397  CR0=8001001b\n"
+      "ES=00e8  ESACC=0093  ESLIM=00001fff  CR2=15760008\n"
+      "FS=0000  FSACC=****  FSLIM=****\n"
+      "GS=0000  GSACC=****  GSLIM=****\n"
+      "\n"
+      "The system detected an internal processing error\n"
+      "at location ##0168:fff4b06e - 000e:c06e\n"
+      "60000, 9084\n"
+      "\n"
+      "06860652\n"
+      "Internal revision 8.259_uni,98/01/07\n"
+      "\n"
+      "The system is stopped. Record all of the above information and\n"
+      "contact your service representative.\n",
+
+      /* Warp 4.52+ - the official r0trap.exe from the debugging classes */
+      "Exception in module: OS2KRNL\n"
+      "TRAP 000e       ERRCD=0002  ERACC=****  ERLIM=********\n"
+      "EAX=00000001  EBX=80010002  ECX=ffed4638  EDX=0003f17b\n"
+      "ESI=00000001  EDI=00000002  EBP=00005408  FLG=00012202\n"
+      "CS:EIP=0168:fff3cd2e  CSACC=c09b  CSLIM=ffffffff\n"
+      "SS:ESP=0030:000053ec  SSACC=1097  SSLIM=000044ff\n"
+      "DS=0160  DSACC=c093  DSLIM=ffffffff  CR0=8001001b\n"
+      "ES=0160  ESACC=c093  ESLIM=ffffffff  CR2=00000001\n"
+      "FS=0000  FSACC=****  FSLIM=********\n"
+      "GS=0000  GSACC=****  GSLIM=********\n"
+      "\n"
+      "The system detected an internal processing error at\n"
+      "location ##0168:fff1e3f3 - 000e:c3f3.\n"
+      "60000, 9084\n"
+      "\n"
+      "068606a0\n"
+      "Internal revision 14.097_UNI\n"
+      "\n"
+      "The system is stopped. Record all of the above information and\n"
+      "contact your service representative.\n",
+
+      /* Warp 4.52+, typical JFS problem. */
+      "Exeption in module: JFS\n"
+      "TRAP 0003       ERRCD=0000  ERACC=****  ERLIM=********\n"
+      "EAX=00000000  EBX=ffffff05  ECX=00000001  EDX=f5cd8010\n"
+      "ESI=000000e6  EDI=000000e7  EBP=f9c7378e  FLG=00002296\n"
+      "CS:EIP=0168:f8df3250  CSACC=c09b  CSLIM=ffffffff\n"
+      "SS:ESP=1550:fdc73778  SSACC=c093  SSLIM=ffffffff\n"
+      "DS=0160  DSACC=c093  DSLIM=ffffffff  CR0=80010016\n"
+      "ES=0160  ESACC=c093  DSLIM=ffffffff  CR2=05318000\n"
+      "FS=03c0  FSACC=0093  DSLIM=00000023\n"
+      "GS=0160  GSACC=c093  DSLIM=ffffffff\n"
+      "\n"
+      "The system detected an internal processing error\n"
+      "at location ##0168:fff1e2ab - 000e:c2ab.\n"
+      "60000, 9084\n"
+      "\n"
+      "07860695\n"
+      "\n"
+      "Internal revision 14.100c_UNI\n"
+      "\n"
+      "The system is stopped. Record all of the above information and\n"
+      "contact your service representative.\n"
+    };
+
+  i = random() % countof(os2_panics);
+  panic_msg = os2_panics[i];
+
+  XGetWindowAttributes(dpy, window, &xgwa);
+  fontname = get_string_resource((xgwa.height > 1000 
+                                  ? "OS2.font3" : xgwa.height > 600
+                                  ? "OS2.font2" : "OS2.font"),
+                                 "OS2.Font");
+  if (!fontname || !*fontname) 
+    fontname = (char *)def_font;
+  font = XLoadQueryFont(dpy, fontname);
+  if (!font) 
+    font = XLoadQueryFont(dpy, def_font);
+  if (!font) 
+    exit(-1);
+  if (fontname && fontname != def_font)
+    free(fontname);
+
+  gcv.font = font->fid;
+  gcv.foreground = get_pixel_resource("OS2.foreground",
+                                      "OS2.Foreground",
+                                      dpy, xgwa.colormap);
+  gcv.background = get_pixel_resource("OS2.background",
+                                      "OS2.Background",
+                                      dpy, xgwa.colormap);
+  XSetWindowBackground(dpy, window, gcv.background);
+  XClearWindow(dpy, window);
+
+  gc = XCreateGC(dpy, window, GCFont|GCForeground|GCBackground, &gcv);
+
+  /* draw the text, calc the cursor location and make it blink. */
+  line_height = font->ascent + font->descent;
+  draw_string(dpy, window, gc, &gcv, font, 0, 0, 10, 10, panic_msg, 0);
+
+  y = line_height * 2;
+  str = panic_msg - 1;
+  while ((str = strchr(str + 1, '\n')) != NULL)
+    y += line_height;
+
+  start = time((time_t *) 0);
+  while (start + delay > time((time_t *) 0))
+    {
+      XDrawImageString(dpy, window, gc, 0, y, "_", 1);
+      XSync(dpy, False);
+      usleep(200000L);
+      XDrawImageString(dpy, window, gc, 0, y, "  ", 2);
+      XSync(dpy, False);
+      usleep(200000L);
+      if (bsod_sleep(dpy, 0))
+        break;
+    }
+
+  XFreeGC(dpy, gc);
+  XSync(dpy, False);
+  XClearWindow(dpy, window);
+  XFreeFont(dpy, font);
+}
+
+
+
+\f
 char *progclass = "BSOD";
 
 char *defaults [] = {
@@ -2959,18 +3794,24 @@ char *defaults [] = {
   "*doBSD:                False",      /* boring */
   "*doLinux:              True",
   "*doSparcLinux:         False",      /* boring */
+  "*doHPPALinux:          True",
   "*doBlitDamage:          True",
   "*doSolaris:             True",
   "*doHPUX:                True",
+  "*doTru64:               True",
   "*doApple2:              True",
   "*doOS390:               True",
   "*doVMS:                True",
   "*doHVX:                True",
+  "*doMSDOS:              True",
+  "*doOS2:                True",
 
   ".Windows.font:         -*-courier-bold-r-*-*-*-120-*-*-m-*-*-*",
   ".Windows.font2:        -*-courier-bold-r-*-*-*-180-*-*-m-*-*-*",
   ".Windows.foreground:           White",
   ".Windows.background:           #0000AA",    /* EGA color 0x01. */
+  ".windowsLH.background:  #AA0000",    /* EGA color 0x04. */
+  ".windowsLH.background2: #AAAAAA",    /* EGA color 0x07. */
 
   ".Amiga.font:                   -*-courier-bold-r-*-*-*-120-*-*-m-*-*-*",
   ".Amiga.font2:          -*-courier-bold-r-*-*-*-180-*-*-m-*-*-*",
@@ -3016,6 +3857,11 @@ char *defaults [] = {
   ".Linux.foreground:      White",
   ".Linux.background:      Black",
 
+  ".HPPALinux.font:       -*-courier-bold-r-*-*-*-120-*-*-m-*-*-*",
+  ".HPPALinux.font2:      -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*",
+  ".HPPALinux.foreground:  White",
+  ".HPPALinux.background:  Black",
+
   ".SparcLinux.font:      -*-courier-bold-r-*-*-*-120-*-*-m-*-*-*",
   ".SparcLinux.font2:     -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*",
   ".SparcLinux.foreground: White",
@@ -3044,6 +3890,11 @@ char *defaults [] = {
   ".OS390.background:     Black",
   ".OS390.foreground:     Red",
 
+  ".Tru64.font:                   9x15bold",
+  ".Tru64.font2:          -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*",
+  ".Tru64.foreground:     White",
+  ".Tru64.background:     #0000AA",    /* EGA color 0x01. */
+
   "*apple2TVColor:         50",
   "*apple2TVTint:          5",
   "*apple2TVBrightness:    10",
@@ -3055,6 +3906,17 @@ char *defaults [] = {
   ".VMS.foreground:       White",
   ".VMS.background:       Black",
 
+  ".MSDOS.font:                   9x15bold",
+  ".MSDOS.font2:          -*-courier-bold-r-*-*-*-140-*-*-m-*-*-*",
+  ".MSDOS.foreground:     White",
+  ".MSDOS.background:     Black",
+
+  ".OS2.font:             -*-courier-bold-r-*-*-*-120-*-*-m-*-*-*",
+  ".OS2.font2:            -*-courier-bold-r-*-*-*-180-*-*-m-*-*-*",
+  ".OS2.font3:            -*-courier-bold-r-*-*-*-240-*-*-m-*-*-*",
+  ".OS2.foreground:       White",
+  ".OS2.background:       Black",
+
   ANALOGTV_DEFAULTS
 
 #ifdef HAVE_XSHM_EXTENSION
@@ -3094,18 +3956,28 @@ XrmOptionDescRec options [] = {
   { "-no-bsd",         ".doBSD",               XrmoptionNoArg,  "False" },
   { "-linux",          ".doLinux",             XrmoptionNoArg,  "True"  },
   { "-no-linux",       ".doLinux",             XrmoptionNoArg,  "False" },
+  { "-hppalinux",      ".doHPPALinux",         XrmoptionNoArg,  "True"  },
+  { "-no-hppalinux",   ".doHPPALinux",         XrmoptionNoArg,  "False" },
   { "-sparclinux",     ".doSparcLinux",        XrmoptionNoArg,  "True"  },
   { "-no-sparclinux",  ".doSparcLinux",        XrmoptionNoArg,  "False" },
   { "-blitdamage",     ".doBlitDamage",        XrmoptionNoArg,  "True"  },
   { "-no-blitdamage",  ".doBlitDamage",        XrmoptionNoArg,  "False" },
+  { "-nvidia",         ".doNvidia",            XrmoptionNoArg,  "True"  },
+  { "-no-nvidia",      ".doNvidia",            XrmoptionNoArg,  "False" },
   { "-solaris",                ".doSolaris",           XrmoptionNoArg,  "True"  },
   { "-no-solaris",     ".doSolaris",           XrmoptionNoArg,  "False" },
   { "-hpux",           ".doHPUX",              XrmoptionNoArg,  "True"  },
   { "-no-hpux",                ".doHPUX",              XrmoptionNoArg,  "False" },
   { "-os390",          ".doOS390",             XrmoptionNoArg,  "True"  },
   { "-no-os390",       ".doOS390",             XrmoptionNoArg,  "False" },
+  { "-tru64",          ".doHPUX",              XrmoptionNoArg,  "True"  },
+  { "-no-tru64",       ".doTru64",             XrmoptionNoArg,  "False" },
   { "-vms",            ".doVMS",               XrmoptionNoArg,  "True"  },
   { "-no-vms",         ".doVMS",               XrmoptionNoArg,  "False" },
+  { "-msdos",          ".doMSDOS",             XrmoptionNoArg,  "True"  },
+  { "-no-msdos",       ".doMSDOS",             XrmoptionNoArg,  "False" },
+  { "-os2",            ".doOS2",               XrmoptionNoArg,  "True"  },
+  { "-no-os2",         ".doOS2",               XrmoptionNoArg,  "False" },
   ANALOGTV_OPTIONS
   { 0, 0, 0, 0 }
 };
@@ -3125,16 +3997,21 @@ static struct {
   { "MacX",            macx },
   { "SCO",             sco },
   { "HVX",             hvx },
+  { "HPPALinux",       hppa_linux },
   { "SparcLinux",      sparc_linux },
   { "BSD",             bsd },
   { "Atari",           atari },
   { "BlitDamage",      blitdamage },
+  { "Nvidia",          nvidia },
   { "Solaris",         sparc_solaris },
   { "Linux",           linux_fsck },
   { "HPUX",            hpux },
   { "OS390",           os390 },
+  { "Tru64",           tru64 },
   { "Apple2",          apple2crash },
   { "VMS",             vms },
+  { "OS2",             os2 },
+  { "MSDOS",           msdos },
 };
 
 
@@ -3180,7 +4057,7 @@ screenhack (Display *dpy, Window window)
       int count = countof(all_modes);
       char name[100], class[100];
 
-      if (only > 0)
+      if (only >= 0)
         i = only;
       else
         do {  i = (random() & 0xFF) % count; } while (i == j);