*** Makefile.in.orig	Mon Oct 13 12:28:20 2003
--- Makefile.in	Mon Oct 13 12:38:21 2003
***************
*** 46,52 ****
  # -DDUMPSHADOW
  #	With shadow-pw screen would never dump core. Use this option if
  #	you still want to have a core. Use only for debugging.
! OPTIONS=
  #OPTIONS= -DDEBUG
  
  SHELL=/bin/sh
--- 46,57 ----
  # -DDUMPSHADOW
  #	With shadow-pw screen would never dump core. Use this option if
  #	you still want to have a core. Use only for debugging.
! # -DIPC_EXPORT_IMAGE
! #	Allows an other program to get the screen contetn through shared mem 
! #	 and ipc. This is used e.g. for braille and speech software.
! 
! OPTIONS=-DIPC_EXPORT_IMAGE
! #OPTIONS=
  #OPTIONS= -DDEBUG
  
  SHELL=/bin/sh
*** configure.in.orig	Mon Oct 13 12:39:07 2003
--- configure.in	Mon Oct 13 12:52:36 2003
***************
*** 1193,1209 ****
    exit(0); /* libc version works properly.  */
  }], AC_DEFINE(USEMEMCPY))
  
! AC_MSG_CHECKING(long file names)
! (echo 1 > /tmp/conftest9012345) 2>/dev/null
! (echo 2 > /tmp/conftest9012346) 2>/dev/null
! val=`cat /tmp/conftest9012345 2>/dev/null`
! if test -f /tmp/conftest9012345 && test "$val" = 1; then
! AC_MSG_RESULT(yes)
! else
! AC_MSG_RESULT(no)
! AC_DEFINE(NAME_MAX, 14)
! fi
! rm -f /tmp/conftest*
  
  AC_MSG_CHECKING(for vsprintf)
  AC_TRY_LINK(,[vsprintf(0,0,0);], AC_MSG_RESULT(yes);AC_DEFINE(USEVARARGS), AC_MSG_RESULT(no))
--- 1193,1209 ----
    exit(0); /* libc version works properly.  */
  }], AC_DEFINE(USEMEMCPY))
  
! #AC_MSG_CHECKING(long file names)
! #(echo 1 > /tmp/conftest9012345) 2>/dev/null
! #(echo 2 > /tmp/conftest9012346) 2>/dev/null
! #val=`cat /tmp/conftest9012345 2>/dev/null`
! #if test -f /tmp/conftest9012345 && test "$val" = 1; then
! #AC_MSG_RESULT(yes)
! #else
! #AC_MSG_RESULT(no)
! #AC_DEFINE(NAME_MAX, 14)
! #fi
! #rm -f /tmp/conftest*
  
  AC_MSG_CHECKING(for vsprintf)
  AC_TRY_LINK(,[vsprintf(0,0,0);], AC_MSG_RESULT(yes);AC_DEFINE(USEVARARGS), AC_MSG_RESULT(no))
*** extern.h.orig	Mon Oct 13 12:28:34 2003
--- extern.h	Mon Oct 13 12:39:19 2003
***************
*** 139,144 ****
--- 139,149 ----
  extern void  FreePseudowin __P((struct win *));
  #endif
  extern void  nwin_compose __P((struct NewWindow *, struct NewWindow *, struct NewWindow *));
+ 
+ #ifdef IPC_EXPORT_IMAGE
+ extern void  CopyWinImage __P((struct win *, char *));
+ #endif
+ 
  extern int   DoStartLog __P((struct win *, char *, int));
  extern int   ReleaseAutoWritelock __P((struct display *, struct win *));
  extern int   ObtainAutoWritelock __P((struct display *, struct win *));
*** sched.c.orig	Mon Oct 13 12:28:45 2003
--- sched.c	Mon Oct 13 12:39:42 2003
***************
*** 110,115 ****
--- 110,119 ----
    return min;
  }
  
+ #ifdef IPC_EXPORT_IMAGE
+  extern struct window *windows;
+ #endif
+ 
  void
  sched()
  {
***************
*** 121,126 ****
--- 125,135 ----
  
    for (;;)
      {
+ #ifdef IPC_EXPORT_IMAGE
+       /* export image from last used window wich is on top of the list */
+       CopyWinImage( windows, shm );
+ #endif
+ 
        if (calctimeout)
  	timeoutev = calctimo();
        if (timeoutev)
*** screen.c.orig	Mon Oct 13 12:29:04 2003
--- screen.c	Mon Oct 13 12:44:10 2003
***************
*** 71,76 ****
--- 71,84 ----
  #if (defined(AUX) || defined(_AUX_SOURCE)) && defined(POSIX)
  # include <compat.h>
  #endif
+ 
+ #ifdef IPC_EXPORT_IMAGE
+ # include <sys/ipc.h>
+ # include <sys/shm.h>
+ #endif
+ 
+ 
+ 
  #if defined(USE_LOCALE) || defined(ENCODINGS)
  # include <locale.h>
  #endif
***************
*** 78,83 ****
--- 86,96 ----
  # include <langinfo.h>
  #endif
  
+ #ifdef IPC_EXPORT_IMAGE
+ # include <sys/ipc.h>
+ # include <sys/shm.h>
+ #endif
+ 
  #include "screen.h"
  #ifdef HAVE_BRAILLE
  # include "braille.h"
***************
*** 234,239 ****
--- 247,258 ----
  
  
  
+ 
+ #ifdef IPC_EXPORT_IMAGE
+ char *shm;              /* pointer to shared memory segment */
+ #endif
+ 
+ 
  /*
   * Do this last
   */
***************
*** 461,466 ****
--- 480,516 ----
    zmodem_recvcmd = SaveStr("!!! rz -vv -b -E");
  #endif
  
+ #ifdef IPC_EXPORT_IMAGE
+   {
+     key_t key = 0xBACD072F;     /* random static IPC key */
+     int shmid;
+ 
+     /* Allocation of shared mem for 18000 bytes (screen text and attributes
+      * + few coord.).  We supose no screen will be wider than 132x66.
+      * 0x1C0 = [rwx------].
+      */
+     shmid = shmget( key, 18000, IPC_CREAT | 0x1C0 );
+     if( shmid < 0 )
+       {
+         Panic( errno, "shmget" );
+         /* NOTRECHED */
+       }
+     shm = shmat( shmid, 0, 0);
+     if ( shm == (void*)-1 )
+       {
+         Panic( errno, "shmat" );
+         /* NOTRECHED */
+       }
+     /* minimal initialisation just to have valid data */
+     shm[0] = 80;   /* scrdim x */
+     shm[1] = 1;    /* scrdim y */
+     shm[2] = 0;    /* csrpos x */
+     shm[3] = 0;    /* csrpos y */
+     strcpy( shm+4, "screen is initializing..." );
+     memset( shm+4+strlen(shm+4), ' ', 80);
+   }
+ #endif
+ 
  #ifdef COPY_PASTE
    CompileKeys((char *)0, 0, mark_key_tab);
  #endif
*** screen.h.orig	Mon Oct 13 12:29:17 2003
--- screen.h	Mon Oct 13 12:45:03 2003
***************
*** 288,293 ****
--- 288,297 ----
    int sym;	/* symbol defined in ttydev.h */
  };
  
+ #ifdef IPC_EXPORT_IMAGE
+ char *shm;		  /* pointer to shared memory segment */
+ #endif
+ 
  /*
   * windowlist orders
   */
*** window.c.orig	Mon Oct 13 12:29:30 2003
--- window.c	Mon Oct 13 12:46:52 2003
***************
*** 1993,1998 ****
--- 1993,2051 ----
      }
  }
  
+ 
+ #ifdef IPC_EXPORT_IMAGE
+ 
+ void
+ CopyWinImage( p, dest )
+ struct win *p;
+ char *dest;
+ {
+   register char *s, *d = dest, *m;
+   register int x, y;
+   struct display *display = p->w_pdisplay;
+   int st = (display) ? D_status : 0;
+ 
+   if( p && p->w_mlines )
+     {
+       *d++ = p->w_width;                        /* scrdim x */
+       *d++ = p->w_height;                       /* scrdim y */
+       *d++ = (st) ? D_status_len : p->w_x;      /* csrpos x */
+       *d++ = (st) ? STATLINE : p->w_y;          /* csrpos y */
+       /* copy window image to buffer */
+       for( y = 0; y < p->w_height; y++ )
+         {
+           s = p->w_mlines[y].image;
+           x = p->w_width;
+           if( st && y == STATLINE )
+             for( m = D_status_lastmsg; *m && x; *d++ = *m++, s++, x-- );
+           for( ; x; *d++ = *s++, x-- );
+         }
+       /* copy attributes from window image to buffer */
+       for( y = 0; y < p->w_height; y++ )
+         {
+           s = p->w_mlines[y].attr;
+           x = p->w_width;
+           if( st && y == STATLINE )
+             for( ; x; *d++ = 0, s++, x-- );
+           for( ; x; *d++ = *s++, x-- );
+         }
+     }
+   else
+     {
+       /* no window pointer */
+       *d++ = 80;   /* scrdim x */
+       *d++ = 1;    /* scrdim y */
+       *d++ = 0;    /* csrpos x */
+       *d++ = 0;    /* csrpos y */
+       strcpy( d, "*** screen: no window pointer ***" );
+       memset( d+strlen(d), ' ', 80);
+     }
+ }
+ 
+ #endif	/* IPC_EXPORT_IMAGE */
+  
+ 
  #ifdef ZMODEM
  
  static int
