--- ./xanim.c.orig	Sat Nov 29 00:40:28 1997
+++ ./xanim.c	Sat Nov 29 02:14:06 1997
@@ -46,6 +46,7 @@
  *           loads and more cpu intensive frames.
  * 10Apr95 - Fixed bug where movies without sound would turn off sound
  *	     is movies listed later on the command line.
+ * 28Nov97 - jw: dumpfile option -ZF... added.
  *
  *******************************/
 
@@ -501,6 +502,12 @@
 xaULONG xa_disp_buff_size,xa_scale_buff_size;
 
 /*
+ * if dumping to file, use this name and counter  in an sprintf
+ */
+char *dumpfilepat = NULL;
+xaLONG dumpfilecount = 0;
+
+/*
  * Variables for statistics
  *
  */
@@ -708,6 +715,7 @@
  fprintf(stdout,"       Ze   Have XAnim exit after playing cmd line.\n");
  fprintf(stdout,"       Zp#  Pause at specified frame number.\n");
  fprintf(stdout,"       Zpe  Pause at end of animation.\n");
+ fprintf(stdout,"       ZFfname write each frame to file fname.\n");
  fprintf(stdout,"\n");
  fprintf(stdout,"Window commands.\n");
  fprintf(stdout,"\n");
@@ -1020,7 +1028,7 @@
 /* 
     fprintf(stdout,"XAnim Rev %2.2f.%d by Mark Podlipec (c) 1991-1997\n",DA_REV,DA_MINOR_REV);
 */
-    fprintf(stdout,"XAnim Rev %2.2f.%d.%d by Mark Podlipec (c) 1991-1997\n",DA_REV,DA_MINOR_REV,DA_BETA_REV);
+    fprintf(stdout,"XAnim Rev %2.2f.%d.%da by Mark Podlipec (c) 1991-1997\n",DA_REV,DA_MINOR_REV,DA_BETA_REV);
 
 /* quick command line check.
  */
@@ -1530,6 +1538,7 @@
 		switch(in[j])
 		{
 		  case 'e': xa_exit_flag = opt_on;	j++;	break;
+		  case 'F': j++; dumpfilepat = &in[j]; j = len;	break;
 		  case 'p':
 		    j++;
 		    if (in[j] == 'e') {xa_pause_last = opt_on; j++; }
--- ./xa_show.c.orig	Sat Nov 29 01:10:26 1997
+++ ./xa_show.c	Sat Nov 29 01:40:59 1997
@@ -113,6 +113,10 @@
 extern float xa_scalex;
 extern float xa_scaley;
 
+extern char *dumpfilepat;
+extern xaLONG dumpfilecount;
+extern int errno;
+
 /* override XPutImage call to support playing at a particular
    position in a window.  Uses #define kludge to avoid changing
    lots of code */
@@ -1100,6 +1104,56 @@
 #endif
     {
       XPutImage(theDisp,mainW,theGC,theImage,xsrc,ysrc,xdst,ydst,xsize,ysize);
+    }
+  while (dumpfilepat)
+    {
+      char buf[1024];
+      FILE *ofp;
+      char *p = theImage->data;
+      int y;
+
+      if (theImage->depth != 24)
+        {
+	  fprintf(stderr, "cannot dump image depth %d to file. Try running xanim with option +V10\n",
+	    theImage->depth);
+	  break;
+	}
+
+      sprintf(buf, dumpfilepat, dumpfilecount++);
+      if (*buf == '|')
+	ofp = popen(buf+1, "w");
+      else
+        ofp = fopen(buf, "w");
+      if (!ofp)
+	{
+	  if (*buf == '|')
+	    fprintf(stderr, "cannot popen %s: errno=%d\n", buf+1, errno);
+	  else
+	    fprintf(stderr, "cannot fopen %s: errno=%d\n", buf, errno);
+	  break;
+	}
+
+      fprintf(ofp, "P6\n%d\n%d\n255\n", theImage->width, theImage->height);
+      for (y = theImage->height; y > 0; y--)
+        {
+	  int x;
+
+	  for (x = 0; x < theImage->width; x++)
+	    {
+	      putc(p[(x<<2)+3], ofp);
+	      putc(p[(x<<2)+2], ofp);
+	      putc(p[(x<<2)+1], ofp);
+	    }
+	  p += theImage->bytes_per_line;
+	}
+
+      if (*buf == '|')
+        pclose(ofp);
+      else
+        fclose(ofp);
+      if (xa_verbose) fprintf(stdout, "'%s' written.\n", buf);
+      
+      break;
     }
 #ifdef XMBUF
     if (mbuf) {

