# ------------------------------------------------------------------------------
 #  aclocal.m4     |   27 ++-
 #  button.c       |  187 +++++++--------------
 #  charproc.c     |   46 ++++-
 #  configure      |  472 ++++++++++++++++++++++++++++---------------------------
 #  configure.in   |    2 
 #  ctlseqs.ms     |    6 
 #  main.c         |   27 +--
 #  menu.c         |    2 
 #  print.c        |   70 +++++++-
 #  ptydata.c      |   37 +++-
 #  ptyx.h         |    5 
 #  version.h      |    4 
 #  xterm.h        |   11 -
 #  xterm.log.html |   47 +++++
 #  xterm.man      |    9 -
 #  15 files changed, 535 insertions, 417 deletions
 # ------------------------------------------------------------------------------
 Index: aclocal.m4
--- xterm-118/aclocal.m4        Thu Oct 14 05:57:38 1999
 +++ xterm-119/aclocal.m4        Sat Oct 16 09:49:00 1999
 @@ -476,15 +476,15 @@
  AC_DEFUN([CF_GNU_SOURCE],
 [
 AC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[
-AC_TRY_COMPILE([],[
+AC_TRY_COMPILE([#include <sys/types.h>],[
  #ifndef _XOPEN_SOURCE
 make an error
 #endif],
        [cf_cv_gnu_source=no],
        [cf_save="$CFLAGS"
         CFLAGS="$CFLAGS -D_GNU_SOURCE"
-        AC_TRY_COMPILE([],[
 -#ifndef _XOPEN_SOURCE
+        AC_TRY_COMPILE([#include <sys/types.h>],[
 +#ifdef _XOPEN_SOURCE
 make an error
 #endif],
        [cf_cv_gnu_source=no],
@@ -757,22 +757,31 @@
 ])dnl
 dnl ---------------------------------------------------------------------------
 dnl Check for the declaration of fd_set.  Some platforms declare it in
-dnl <sys/types.h>, and some in <sys/select.h>, which requires <sys/types.h>
 +dnl <sys/types.h>, and some in <sys/select.h>, which requires <sys/types.h>.
 +dnl Finally, if we are using this for an X application, Xpoll.h may include
 +dnl <sys/select.h>, so we don't want to do it twice.
  AC_DEFUN([CF_TYPE_FD_SET],
 [
-AC_MSG_CHECKING(for declaration of fd_set)
 -AC_CACHE_VAL(cf_cv_type_fd_set,[
+AC_CACHE_CHECK(for declaration of fd_set,cf_cv_type_fd_set,
 +       [echo "trying sys/types alone" 1>&AC_FD_CC
  AC_TRY_COMPILE([
 #include <sys/types.h>],
        [fd_set x],
        [cf_cv_type_fd_set=sys/types.h],
-       [AC_TRY_COMPILE([
 +       [echo "trying X11/Xpoll.h" 1>&AC_FD_CC
 +AC_TRY_COMPILE([
+#ifdef HAVE_X11_XPOLL_H
+#include <X11/Xpoll.h>
+#endif],
 +       [fd_set x],
 +       [cf_cv_type_fd_set=X11/Xpoll.h],
 +       [echo "trying sys/select.h" 1>&AC_FD_CC
 +AC_TRY_COMPILE([
 #include <sys/types.h>
 #include <sys/select.h>],
        [fd_set x],
        [cf_cv_type_fd_set=sys/select.h],
-       [cf_cv_type_fd_set=unknown])])])
 -AC_MSG_RESULT($cf_cv_type_fd_set)
+       [cf_cv_type_fd_set=unknown])])])])
  if test $cf_cv_type_fd_set = sys/select.h ; then
        AC_DEFINE(USE_SYS_SELECT_H)
 fi
Index: button.c
--- xterm-118/button.c  Mon Sep 27 16:12:18 1999
 +++ xterm-119/button.c  Wed Oct  6 21:19:22 1999
 @@ -87,6 +87,7 @@
  
 #define        Coordinate(r,c)         ((r) * (term->screen.max_col+1) + (c))
 
+static ANSI reply;
 
 /* Selection/extension variables */
 
@@ -259,11 +260,9 @@
 SendLocatorPosition(Widget w, XEvent* event)
 {
     TScreen    *screen = &((XtermWidget)w)->screen;
-    int                pty = screen->respond;
 -    Char       line[20];
      int                row, col;
     Boolean    oor;
-    int                button, count = 0;
 +    int                button;
      int                state;
 
     /* Make sure the event is an appropriate type */
@@ -294,24 +293,14 @@
     *
     * ESCAPE '[' event ; mask ; row ; column '&' 'w'
     */
-    /* Build key sequence starting with \E[ */
 -    if (screen->control_eight_bits) {
 -           line[count++] = CSI;
 -    } else {
-           line[count++] = ESC;
 -           line[count++] = '[';
 -    }
+    reply.a_type   = CSI;
  
     if( oor) {
-       /* Event - 0 = locator unavailable */
 -       line[count++] = '0';
 -
-       /* Sequence termination */
 -       line[count++] = '&';
 -       line[count++] = 'w';
 -
-       /* Transmit key sequence to process running under xterm */
 -       v_write(pty, line, count);
 +       reply.a_nparam = 1;
 +       reply.a_param[0] = 0; /* Event - 0 = locator unavailable */
 +       reply.a_inters = '&';
 +       reply.a_final  = 'w';
 +       unparseseq(&reply, screen->respond);
  
        if( screen->locator_reset ) {
            MotionOff( screen, term );
@@ -332,18 +321,18 @@
     *  8       M4 down
     *  9       M4 up
     */
+    reply.a_nparam = 4;
      switch(event->type)
     {
        case ButtonPress:
-           line[count++] = '2' + (button<<1);
 +           reply.a_param[0] = 2 + (button<<1);
             break;
        case ButtonRelease:
-           line[count++] = '3' + (button<<1);
 +           reply.a_param[0] = 3 + (button<<1);
             break;
        default:
            return( True );
     }
-    line[count++] = ';';
      /*
     * mask:
     * bit 7   bit 6   bit 5   bit 4   bit 3   bit 2       bit 1         bit 0
@@ -356,11 +345,14 @@
     state = (event->xbutton.state & (Button1Mask | Button2Mask | Button3Mask | Button4Mask)) >> 8;
     state ^= 1 << button;      /* update mask to "after" state */
     state = (state & ~(4|1)) | ((state&1)?4:0) | ((state&4)?1:0);      /* swap Button1 & Button3 */
-    sprintf( &(line[count]), "%d;%d;%d&w", state, row, col );
 -    count = strlen( line );
  
-    /* Transmit key sequence to process running under xterm */
 -    v_write(pty, line, count);
 +    reply.a_param[1] = state;
 +    reply.a_param[2] = row;
 +    reply.a_param[3] = col;
 +    reply.a_inters = '&';
 +    reply.a_final  = 'w';
 +
+    unparseseq(&reply, screen->respond);
  
     if( screen->locator_reset ) {
        MotionOff( screen, term );
@@ -405,15 +397,11 @@
     Window             root, child;
     int                        rx, ry, x, y;
     unsigned int       mask;
-    Char               line[20];
 -    int                        pty = screen->respond;
      int                        row = 0, col = 0;
     Boolean            oor = FALSE;
     Bool               ret = FALSE;
-    int                        count = 0;
      int                        state;
 
-
     /*
     * DECterm turns the Locator off if the position is requested while a filter rectangle
     * is active.  This might be a bug, but I don't know, so I'll emulate it anyways.
@@ -425,13 +413,8 @@
        MotionOff( screen, term );
     }
 
-    /* Build key sequence starting with \E[ */
 -    if (screen->control_eight_bits) {
 -       line[count++] = CSI;
 -    } else {
-       line[count++] = ESC;
 -       line[count++] = '[';
 -    }
+    reply.a_type   = CSI;
 +
     if (screen->send_mouse_pos == DEC_LOCATOR) {
        ret = XQueryPointer( screen->display, VWindow(screen), &root,
                        &child, &rx, &ry, &x, &y, &mask );
@@ -441,15 +424,11 @@
     }
     if( ret == FALSE || oor /* || (KeyModifiers != 0 && KeyModifiers != ControlMask) */ )
     {
-       /* Event - 0 = locator unavailable */
 -       line[count++] = '0';
 -
-       /* Sequence termination */
 -       line[count++] = '&';
 -       line[count++] = 'w';
 -
-       /* Transmit key sequence to process running under xterm */
 -       v_write(pty, line, count);
 +       reply.a_nparam = 1;
 +       reply.a_param[0] = 0; /* Event - 0 = locator unavailable */
 +       reply.a_inters = '&';
 +       reply.a_final  = 'w';
 +       unparseseq(&reply, screen->respond);
  
        if( screen->locator_reset ) {
            MotionOff( screen, term );
@@ -458,16 +437,16 @@
        return;
     }
 
-    /* Event - 1 = response to locator request */
 -    line[count++] = '1';
 -    line[count++] = ';';
 -
     ButtonState( state, mask );
-    sprintf( &(line[count]), "%d;%d;%d&w", state, row, col );
 -    count = strlen( line );
  
-    /* Transmit key sequence to process running under xterm */
 -    v_write(pty, line, count);
 +    reply.a_nparam = 4;
 +    reply.a_param[0] = 1; /* Event - 1 = response to locator request */
 +    reply.a_param[1] = state;
 +    reply.a_param[2] = row;
 +    reply.a_param[3] = col;
 +    reply.a_inters = '&';
 +    reply.a_final  = 'w';
 +    unparseseq(&reply, screen->respond);
  
     if( screen->locator_reset ) {
        MotionOff( screen, term );
@@ -482,15 +461,11 @@
     Window             root, child;
     int                        rx, ry, x, y;
     unsigned int       mask;
-    Char               line[20];
 -    int                        pty = screen->respond;
      int                        row, col;
     Boolean            oor;
     Bool               ret;
-    int                        count = 0;
      int                        state;
 
-
     ret = XQueryPointer( screen->display, VWindow(screen),
                            &root, &child, &rx, &ry, &x, &y, &mask );
     if (ret) {
@@ -500,31 +475,21 @@
     {
        /* Locator is unavailable */
 
-       if( screen->loc_filter_top != LOC_FILTER_POS ||
 -           screen->loc_filter_left != LOC_FILTER_POS ||
 +       if( screen->loc_filter_top    != LOC_FILTER_POS ||
 +           screen->loc_filter_left   != LOC_FILTER_POS ||
             screen->loc_filter_bottom != LOC_FILTER_POS ||
-           screen->loc_filter_right != LOC_FILTER_POS )
 +           screen->loc_filter_right  != LOC_FILTER_POS )
         {
            /*
            * If any explicit coordinates were received,
            * report immediately with no coordinates.
            */
-           /* Build key sequence starting with \E[ */
 -           if (screen->control_eight_bits) {
 -               line[count++] = CSI;
 -           } else {
 -               line[count++] = ESC;
 -               line[count++] = '[';
 -           }
 -           /* Event - 0 = locator unavailable */
 -           line[count++] = '0';
 -
-           /* Sequence termination */
 -           line[count++] = '&';
 -           line[count++] = 'w';
 -
-           /* Transmit key sequence to process running under xterm */
 -           v_write(pty, line, count);
 +           reply.a_type   = CSI;
 +           reply.a_nparam = 1;
 +           reply.a_param[0] = 0; /* Event - 0 = locator unavailable */
 +           reply.a_inters = '&';
 +           reply.a_final  = 'w';
 +           unparseseq(&reply, screen->respond);
  
            if( screen->locator_reset ) {
                MotionOff( screen, term );
@@ -583,24 +548,17 @@
        (row > screen->loc_filter_bottom) )
     {
        /* Pointer is already outside the rectangle - report immediately */
-       /* Build key sequence starting with \E[ */
 -       if (screen->control_eight_bits) {
 -           line[count++] = CSI;
 -       } else {
 -           line[count++] = ESC;
 -           line[count++] = '[';
 -       }
-       /* Event - 10 = locator outside filter */
 -       line[count++] = '1';
 -       line[count++] = '0';
 -       line[count++] = ';';
 -
        ButtonState( state, mask );
-       sprintf( &(line[count]), "%d;%d;%d&w", state, row, col );
 -       count = strlen( line );
  
-       /* Transmit key sequence to process running under xterm */
 -       v_write(pty, line, count);
 +       reply.a_type   = CSI;
 +       reply.a_nparam = 4;
 +       reply.a_param[0] = 10; /* Event - 10 = locator outside filter */
 +       reply.a_param[1] = state;
 +       reply.a_param[2] = row;
 +       reply.a_param[3] = col;
 +       reply.a_inters = '&';
 +       reply.a_final  = 'w';
 +       unparseseq(&reply, screen->respond);
  
        if( screen->locator_reset ) {
            MotionOff( screen, term );
@@ -621,11 +579,8 @@
 CheckLocatorPosition( Widget w, XEvent *event )
 {
     TScreen            *screen = &((XtermWidget)w)->screen;
-    Char               line[20];
 -    int                        pty = screen->respond;
      int                        row, col;
     Boolean            oor;
-    int                        count = 0;
      int                        state;
 
     LocatorCoords( row, col, event->xbutton.x, event->xbutton.y, oor );
@@ -636,42 +591,32 @@
     * had no coordinates and the pointer re-entered the window.
     */
     if (oor || (screen->loc_filter_top == LOC_FILTER_POS) ||
-       (col < screen->loc_filter_left) ||
 +       (col < screen->loc_filter_left)  ||
         (col > screen->loc_filter_right) ||
-       (row < screen->loc_filter_top) ||
 +       (row < screen->loc_filter_top)   ||
         (row > screen->loc_filter_bottom))
     {
        /* Filter triggered - disable it */
        screen->loc_filter = FALSE;
        MotionOff( screen, term );
 
-       /* Build key sequence starting with \E[ */
 -       if (screen->control_eight_bits) {
 -           line[count++] = CSI;
 -       } else {
 -           line[count++] = ESC;
 -           line[count++] = '[';
 -       }
-
 +       reply.a_type   = CSI;
         if (oor) {
-           /* Event - 0 = locator unavailable */
 -           line[count++] = '0';
 -
-           /* Sequence termination */
 -           line[count++] = '&';
 -           line[count++] = 'w';
 +           reply.a_nparam = 1;
 +           reply.a_param[0] = 0; /* Event - 0 = locator unavailable */
         } else {
-           /* Event - 10 = locator outside filter */
 -           line[count++] = '1';
 -           line[count++] = '0';
 -           line[count++] = ';';
 -
            ButtonState( state, event->xbutton.state );
-           sprintf( &(line[count]), "%d;%d;%d&w", state, row, col );
 -           count = strlen( line );
 +
+           reply.a_nparam = 4;
 +           reply.a_param[0] = 10; /* Event - 10 = locator outside filter */
 +           reply.a_param[1] = state;
 +           reply.a_param[2] = row;
 +           reply.a_param[3] = col;
         }
-       /* Transmit key sequence to process running under xterm */
 -       v_write(pty, line, count);
 +
+       reply.a_inters = '&';
 +       reply.a_final  = 'w';
 +       unparseseq(&reply, screen->respond);
  
        if( screen->locator_reset ) {
            MotionOff( screen, term );
Index: charproc.c
--- xterm-118/charproc.c        Thu Oct 14 05:57:38 1999
 +++ xterm-119/charproc.c        Fri Oct 15 19:12:16 1999
 @@ -749,9 +749,6 @@
  {XtNutf8, XtCUtf8, XtRInt, sizeof(int),
        XtOffsetOf(XtermWidgetRec, screen.utf8_mode),
        XtRString, "0"},
-{XtNutf8controls, XtCUtf8controls, XtRBoolean, sizeof(Boolean),
 -       XtOffsetOf(XtermWidgetRec, screen.utf8_controls),
 -       XtRBoolean, (XtPointer) &defaultFALSE},
  {XtNwideChars, XtCWideChars, XtRBoolean, sizeof(Boolean),
        XtOffsetOf(XtermWidgetRec, screen.wide_chars),
        XtRBoolean, (XtPointer) &defaultFALSE},
@@ -845,6 +842,9 @@
        register TScreen *screen = &term->screen;
        Pixel   bg;
 
+       if (screen->scroll_amt)
 +               FlushScroll(screen);
 +
        if (color >= 0) {
                term->flags |= BG_COLOR;
        } else {
@@ -1504,6 +1504,26 @@
                                reply.a_param[count++] = 8; /* user-defined-keys */
                                reply.a_param[count++] = 9; /* national replacement charsets */
                                reply.a_param[count++] = 15; /* technical characters */
+                               if_OPT_ISO_COLORS(screen,{
 +                                   reply.a_param[count++] = 22; /* ANSI color, VT525 */
 +                               })
 +#if OPT_DEC_LOCATOR
+                               reply.a_param[count++] = 29; /* ANSI text locator */
 +#endif
+#if 0                          /* not sure how this fits in */
 +                               if_OPT_ISO_COLORS(screen,{
 +                                   reply.a_param[count++] = 30 +
 +                                       (((term->flags & FG_COLOR) != 0
 +                                        && (term->cur_foreground >= 0))
 +                                           ? term->cur_foreground
 +                                           : 9);
 +                                   reply.a_param[count++] = 40 +
 +                                       (((term->flags & BG_COLOR) != 0
 +                                        && (term->cur_background >= 0))
 +                                           ? term->cur_background
 +                                           : 9);
 +                               })
 +#endif
                            }
                            reply.a_nparam = count;
                            reply.a_inters = 0;
@@ -1758,7 +1778,7 @@
                                break;
                        case 15:
                                /* printer status */
-                               reply.a_param[count++] = 13; /* FIXME: implement printer */
 +                               reply.a_param[count++] = 13; /* implement printer */
                                 break;
                        case 25:
                                /* UDK status */
@@ -1773,6 +1793,14 @@
                                        reply.a_param[count++] = 0; /* LK201 */
                                }
                                break;
+                       case 53:
 +                               /* Locator status */
 +#if OPT_DEC_LOCATOR
+                               reply.a_param[count++] = 50; /* locator ready */
 +#else
+                               reply.a_param[count++] = 53; /* no locator */
 +#endif
+                               break;
                         }
 
                        if ((reply.a_nparam = count) != 0)
@@ -2122,7 +2150,7 @@
                        break;
 
                 case CASE_DECEFR:
-                       /* DECEFR - Enable Filter Rectangle */
 +                       TRACE(("DECEFR - Enable Filter Rectangle\n"));
                         if (screen->send_mouse_pos == DEC_LOCATOR) {
                            MotionOff( screen, term );
                            if((screen->loc_filter_top = param[0]) < 1)
@@ -2139,11 +2167,12 @@
                        break;
 
                 case CASE_DECELR:
-                       /* DECELR - Enable Locator Reports */
                         MotionOff( screen, term );
                        if (param[0] <= 0 || param[0] > 2) {
                            screen->send_mouse_pos = MOUSE_OFF;
+                           TRACE(("DECELR - Disable Locator Reports\n"));
                         } else {
+                           TRACE(("DECELR - Enable Locator Reports\n"));
                             screen->send_mouse_pos = DEC_LOCATOR;
                            if (param[0] == 2) {
                                screen->locator_reset = TRUE;
@@ -2161,7 +2190,7 @@
                        break;
 
                 case CASE_DECSLE:
-                       /* DECSLE - Select Locator Events */
 +                       TRACE(("DECSLE - Select Locator Events\n"));
                         for (count=0; count<nparam; ++count) {
                            switch (param[count]) {
                                case DEFAULT:
@@ -2188,7 +2217,7 @@
                        break;
 
                 case CASE_DECRQLP:
-                       /* DECRQLP - Request Locator Position */
 +                       TRACE(("DECRQLP - Request Locator Position\n"));
                         if( param[0] < 2 ) {
                            /* Issue DECLRP Locator Position Report */
                            GetLocatorPosition( term );
@@ -4169,7 +4198,6 @@
    if (request->screen.utf8_mode) {
       wnew->screen.wide_chars = True;
       wnew->screen.utf8_mode = 2; /* disable further change */
-      wnew->screen.utf8_controls = request->screen.utf8_controls;
        TRACE(("initialized UTF-8 mode\n"));
    }
    if (wnew->screen.wide_chars != False)
Index: configure
--- xterm-118/configure Thu Oct 14 05:57:38 1999
 +++ xterm-119/configure Sat Oct 16 09:49:03 1999
 @@ -2033,70 +2033,15 @@
  
 ###    checks for structures
 
-echo $ac_n "checking for declaration of fd_set""... $ac_c" 1>&6
 -echo "configure:2038: checking for declaration of fd_set" >&5
 -if eval "test \"`echo '$''{'cf_cv_type_fd_set'+set}'`\" = set"; then
 -  echo $ac_n "(cached) $ac_c" 1>&6
 -else
-  
-cat > conftest.$ac_ext <<EOF
 -#line 2044 "configure"
-#include "confdefs.h"
 -
-#include <sys/types.h>
-int main() {
 -fd_set x
-; return 0; }
-EOF
-if { (eval echo configure:2052: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
 -  rm -rf conftest*
-  cf_cv_type_fd_set=sys/types.h
 -else
-  echo "configure: failed program was:" >&5
 -  cat conftest.$ac_ext >&5
 -  rm -rf conftest*
-  cat > conftest.$ac_ext <<EOF
 -#line 2060 "configure"
-#include "confdefs.h"
 -
-#include <sys/types.h>
-#include <sys/select.h>
 -int main() {
-fd_set x
-; return 0; }
-EOF
-if { (eval echo configure:2069: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
 -  rm -rf conftest*
-  cf_cv_type_fd_set=sys/select.h
 -else
-  echo "configure: failed program was:" >&5
 -  cat conftest.$ac_ext >&5
 -  rm -rf conftest*
-  cf_cv_type_fd_set=unknown
 -fi
-rm -f conftest*
-fi
-rm -f conftest*
-fi
-
-echo "$ac_t""$cf_cv_type_fd_set" 1>&6
 -if test $cf_cv_type_fd_set = sys/select.h ; then
 -       cat >> confdefs.h <<\EOF
 -#define USE_SYS_SELECT_H 1
-EOF
 -
-fi
-
-
 echo $ac_n "checking if POSIX VDISABLE symbol should be used""... $ac_c" 1>&6
-echo "configure:2093: checking if POSIX VDISABLE symbol should be used" >&5
 +echo "configure:2038: checking if POSIX VDISABLE symbol should be used" >&5
  if eval "test \"`echo '$''{'cf_cv_posix_vdisable'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
        if test "$cross_compiling" = yes; then
   cat > conftest.$ac_ext <<EOF
-#line 2100 "configure"
+#line 2045 "configure"
  #include "confdefs.h"
 
 #if HAVE_TERMIOS_H && HAVE_TCGETATTR
@@ -2114,7 +2059,7 @@
 #endif
 ; return 0; }
 EOF
-if { (eval echo configure:2118: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
 +if { (eval echo configure:2063: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
   cf_cv_posix_vdisable=yes
 else
@@ -2126,7 +2071,7 @@
 rm -f conftest*
 else
   cat > conftest.$ac_ext <<EOF
-#line 2130 "configure"
+#line 2075 "configure"
  #include "confdefs.h"
 
 #if HAVE_TERMIOS_H && HAVE_TCGETATTR
@@ -2139,7 +2084,7 @@
 int main() { exit(_POSIX_VDISABLE == -1); }
 #endif
 EOF
-if { (eval echo configure:2143: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 +if { (eval echo configure:2088: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
  then
   cf_cv_posix_vdisable=yes
 else
@@ -2165,13 +2110,13 @@
 
 
 echo $ac_n "checking if external errno is declared""... $ac_c" 1>&6
-echo "configure:2169: checking if external errno is declared" >&5
 +echo "configure:2114: checking if external errno is declared" >&5
  if eval "test \"`echo '$''{'cf_cv_dcl_errno'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
     cat > conftest.$ac_ext <<EOF
-#line 2175 "configure"
+#line 2120 "configure"
  #include "confdefs.h"
 
 #if HAVE_STDLIB_H
@@ -2184,7 +2129,7 @@
 long x = (long) errno
 ; return 0; }
 EOF
-if { (eval echo configure:2188: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
 +if { (eval echo configure:2133: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
   eval 'cf_cv_dcl_'errno'=yes'
 else
@@ -2215,13 +2160,13 @@
 # It's possible (for near-UNIX clones) that the data doesn't exist
 
 echo $ac_n "checking if external errno exists""... $ac_c" 1>&6
-echo "configure:2219: checking if external errno exists" >&5
 +echo "configure:2164: checking if external errno exists" >&5
  if eval "test \"`echo '$''{'cf_cv_have_errno'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
     cat > conftest.$ac_ext <<EOF
-#line 2225 "configure"
+#line 2170 "configure"
  #include "confdefs.h"
 
 #undef errno
@@ -2231,7 +2176,7 @@
 errno = 2
 ; return 0; }
 EOF
-if { (eval echo configure:2235: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
 +if { (eval echo configure:2180: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    rm -rf conftest*
   eval 'cf_cv_have_'errno'=yes'
 else
@@ -2263,7 +2208,7 @@
 
 
 echo $ac_n "checking for tty group""... $ac_c" 1>&6
-echo "configure:2267: checking for tty group" >&5
 +echo "configure:2212: checking for tty group" >&5
  if eval "test \"`echo '$''{'cf_cv_tty_group'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2272,7 +2217,7 @@
   cf_cv_tty_group=unknown
 else
   cat > conftest.$ac_ext <<EOF
-#line 2276 "configure"
+#line 2221 "configure"
  #include "confdefs.h"
 
 #include <sys/types.h>
@@ -2286,7 +2231,7 @@
 }
        
 EOF
-if { (eval echo configure:2290: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 +if { (eval echo configure:2235: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
  then
   cf_cv_tty_group=yes
 else
@@ -2311,7 +2256,7 @@
 ###    checks for compiler characteristics
 
 echo $ac_n "checking for ${CC-cc} option to accept ANSI C""... $ac_c" 1>&6
-echo "configure:2315: checking for ${CC-cc} option to accept ANSI C" >&5
 +echo "configure:2260: checking for ${CC-cc} option to accept ANSI C" >&5
  if eval "test \"`echo '$''{'cf_cv_ansi_cc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2335,7 +2280,7 @@
 do
        CFLAGS="$cf_save_CFLAGS $cf_arg"
        cat > conftest.$ac_ext <<EOF
-#line 2339 "configure"
+#line 2284 "configure"
  #include "confdefs.h"
 
 #ifndef CC_HAS_PROTOS
@@ -2351,7 +2296,7 @@
        struct s2 {int (*f) (double a);};
 ; return 0; }
 EOF
-if { (eval echo configure:2355: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
 +if { (eval echo configure:2300: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
   cf_cv_ansi_cc="$cf_arg"; break
 else
@@ -2378,12 +2323,12 @@
 fi
 
 echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:2382: checking for working const" >&5
 +echo "configure:2327: checking for working const" >&5
  if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2387 "configure"
+#line 2332 "configure"
  #include "confdefs.h"
 
 int main() {
@@ -2432,7 +2377,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2436: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
 +if { (eval echo configure:2381: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
   ac_cv_c_const=yes
 else
@@ -2456,12 +2401,12 @@
 ###    checks for system services and user specified options
 
 echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6
-echo "configure:2460: checking for sys/wait.h that is POSIX.1 compatible" >&5
 +echo "configure:2405: checking for sys/wait.h that is POSIX.1 compatible" >&5
  if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2465 "configure"
+#line 2410 "configure"
  #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/wait.h>
@@ -2477,7 +2422,7 @@
 s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
 ; return 0; }
 EOF
-if { (eval echo configure:2481: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
 +if { (eval echo configure:2426: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
   ac_cv_header_sys_wait_h=yes
 else
@@ -2500,15 +2445,15 @@
 
 
 echo $ac_n "checking if we must define _GNU_SOURCE""... $ac_c" 1>&6
-echo "configure:2504: checking if we must define _GNU_SOURCE" >&5
 +echo "configure:2449: checking if we must define _GNU_SOURCE" >&5
  if eval "test \"`echo '$''{'cf_cv_gnu_source'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 cat > conftest.$ac_ext <<EOF
-#line 2510 "configure"
+#line 2455 "configure"
  #include "confdefs.h"
-
+#include <sys/types.h>
 int main() {
 
 #ifndef _XOPEN_SOURCE
@@ -2516,7 +2461,7 @@
 #endif
 ; return 0; }
 EOF
-if { (eval echo configure:2520: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
 +if { (eval echo configure:2465: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
   cf_cv_gnu_source=no
 else
@@ -2526,17 +2471,17 @@
   cf_save="$CFLAGS"
         CFLAGS="$CFLAGS -D_GNU_SOURCE"
         cat > conftest.$ac_ext <<EOF
-#line 2530 "configure"
+#line 2475 "configure"
  #include "confdefs.h"
-
+#include <sys/types.h>
 int main() {
 
-#ifndef _XOPEN_SOURCE
+#ifdef _XOPEN_SOURCE
 make an error
 #endif
 ; return 0; }
 EOF
-if { (eval echo configure:2540: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
 +if { (eval echo configure:2485: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
   cf_cv_gnu_source=no
 else
@@ -2561,7 +2506,7 @@
 # Uses ac_ vars as temps to allow command line to override cache and checks.
 # --without-x overrides everything else, but does not touch the cache.
 echo $ac_n "checking for X""... $ac_c" 1>&6
-echo "configure:2565: checking for X" >&5
 +echo "configure:2510: checking for X" >&5
  
 
 # Check whether --with-x or --without-x was given.
@@ -2624,12 +2569,12 @@
 
   # First, try using that file with no special directory specified.
 cat > conftest.$ac_ext <<EOF
-#line 2628 "configure"
+#line 2573 "configure"
  #include "confdefs.h"
 #include <$x_direct_test_include>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2633: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 +{ (eval echo configure:2578: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
  ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2698,14 +2643,14 @@
   ac_save_LIBS="$LIBS"
   LIBS="-l$x_direct_test_library $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2702 "configure"
+#line 2647 "configure"
  #include "confdefs.h"
 
 int main() {
 ${x_direct_test_function}()
 ; return 0; }
 EOF
-if { (eval echo configure:2709: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
 +if { (eval echo configure:2654: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    rm -rf conftest*
   LIBS="$ac_save_LIBS"
 # We can link X programs with no special library path.
@@ -2805,7 +2750,7 @@
        # FIXME: modify the library lookup in autoconf to
        # allow _s.a suffix ahead of .a
        echo $ac_n "checking for open in -lc_s""... $ac_c" 1>&6
-echo "configure:2809: checking for open in -lc_s" >&5
 +echo "configure:2754: checking for open in -lc_s" >&5
  ac_lib_var=`echo c_s'_'open | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2813,7 +2758,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lc_s  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2817 "configure"
+#line 2762 "configure"
  #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2824,7 +2769,7 @@
 open()
 ; return 0; }
 EOF
-if { (eval echo configure:2828: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
 +if { (eval echo configure:2773: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2841,7 +2786,7 @@
   echo "$ac_t""yes" 1>&6
   LIBS="-lc_s $LIBS"
        echo $ac_n "checking for gethostname in -lbsd""... $ac_c" 1>&6
-echo "configure:2845: checking for gethostname in -lbsd" >&5
 +echo "configure:2790: checking for gethostname in -lbsd" >&5
  ac_lib_var=`echo bsd'_'gethostname | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2849,7 +2794,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lbsd  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2853 "configure"
+#line 2798 "configure"
  #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2860,7 +2805,7 @@
 gethostname()
 ; return 0; }
 EOF
-if { (eval echo configure:2864: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
 +if { (eval echo configure:2809: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2877,7 +2822,7 @@
   echo "$ac_t""yes" 1>&6
   LIBS="-lbsd $LIBS"
        echo $ac_n "checking for gethostname in -lnsl_s""... $ac_c" 1>&6
-echo "configure:2881: checking for gethostname in -lnsl_s" >&5
 +echo "configure:2826: checking for gethostname in -lnsl_s" >&5
  ac_lib_var=`echo nsl_s'_'gethostname | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2885,7 +2830,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lnsl_s  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2889 "configure"
+#line 2834 "configure"
  #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2896,7 +2841,7 @@
 gethostname()
 ; return 0; }
 EOF
-if { (eval echo configure:2900: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
 +if { (eval echo configure:2845: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2913,7 +2858,7 @@
   echo "$ac_t""yes" 1>&6
   LIBS="-lnsl_s $LIBS"
        echo $ac_n "checking for XOpenDisplay in -lX11_s""... $ac_c" 1>&6
-echo "configure:2917: checking for XOpenDisplay in -lX11_s" >&5
 +echo "configure:2862: checking for XOpenDisplay in -lX11_s" >&5
  ac_lib_var=`echo X11_s'_'XOpenDisplay | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2921,7 +2866,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lX11_s  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2925 "configure"
+#line 2870 "configure"
  #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2932,7 +2877,7 @@
 XOpenDisplay()
 ; return 0; }
 EOF
-if { (eval echo configure:2936: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
 +if { (eval echo configure:2881: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2949,7 +2894,7 @@
   echo "$ac_t""yes" 1>&6
   LIBS="-lX11_s $LIBS"
        echo $ac_n "checking for XtAppInitialize in -lXt_s""... $ac_c" 1>&6
-echo "configure:2953: checking for XtAppInitialize in -lXt_s" >&5
 +echo "configure:2898: checking for XtAppInitialize in -lXt_s" >&5
  ac_lib_var=`echo Xt_s'_'XtAppInitialize | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2957,7 +2902,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lXt_s  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2961 "configure"
+#line 2906 "configure"
  #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2968,7 +2913,7 @@
 XtAppInitialize()
 ; return 0; }
 EOF
-if { (eval echo configure:2972: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
 +if { (eval echo configure:2917: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3009,7 +2954,7 @@
        ;;
 *)
        echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6
-echo "configure:3013: checking for socket in -lsocket" >&5
 +echo "configure:2958: checking for socket in -lsocket" >&5
  ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3017,7 +2962,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lsocket  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3021 "configure"
+#line 2966 "configure"
  #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -3028,7 +2973,7 @@
 socket()
 ; return 0; }
 EOF
-if { (eval echo configure:3032: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
 +if { (eval echo configure:2977: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3056,7 +3001,7 @@
 fi
 
        echo $ac_n "checking for gethostname in -lnsl""... $ac_c" 1>&6
-echo "configure:3060: checking for gethostname in -lnsl" >&5
 +echo "configure:3005: checking for gethostname in -lnsl" >&5
  ac_lib_var=`echo nsl'_'gethostname | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3064,7 +3009,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lnsl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3068 "configure"
+#line 3013 "configure"
  #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -3075,7 +3020,7 @@
 gethostname()
 ; return 0; }
 EOF
-if { (eval echo configure:3079: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
 +if { (eval echo configure:3024: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3126,17 +3071,17 @@
     case "`(uname -sr) 2>/dev/null`" in
     "SunOS 5"*)
       echo $ac_n "checking whether -R must be followed by a space""... $ac_c" 1>&6
-echo "configure:3130: checking whether -R must be followed by a space" >&5
 +echo "configure:3075: checking whether -R must be followed by a space" >&5
        ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries"
       cat > conftest.$ac_ext <<EOF
-#line 3133 "configure"
+#line 3078 "configure"
  #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:3140: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
 +if { (eval echo configure:3085: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    rm -rf conftest*
   ac_R_nospace=yes
 else
@@ -3152,14 +3097,14 @@
       else
        LIBS="$ac_xsave_LIBS -R $x_libraries"
        cat > conftest.$ac_ext <<EOF
-#line 3156 "configure"
+#line 3101 "configure"
  #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:3163: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
 +if { (eval echo configure:3108: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    rm -rf conftest*
   ac_R_space=yes
 else
@@ -3191,7 +3136,7 @@
     # libraries were built with DECnet support.  And karl@cs.umb.edu says
     # the Alpha needs dnet_stub (dnet does not exist).
     echo $ac_n "checking for dnet_ntoa in -ldnet""... $ac_c" 1>&6
-echo "configure:3195: checking for dnet_ntoa in -ldnet" >&5
 +echo "configure:3140: checking for dnet_ntoa in -ldnet" >&5
  ac_lib_var=`echo dnet'_'dnet_ntoa | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3199,7 +3144,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-ldnet  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3203 "configure"
+#line 3148 "configure"
  #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -3210,7 +3155,7 @@
 dnet_ntoa()
 ; return 0; }
 EOF
-if { (eval echo configure:3214: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
 +if { (eval echo configure:3159: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3232,7 +3177,7 @@
 
     if test $ac_cv_lib_dnet_dnet_ntoa = no; then
       echo $ac_n "checking for dnet_ntoa in -ldnet_stub""... $ac_c" 1>&6
-echo "configure:3236: checking for dnet_ntoa in -ldnet_stub" >&5
 +echo "configure:3181: checking for dnet_ntoa in -ldnet_stub" >&5
  ac_lib_var=`echo dnet_stub'_'dnet_ntoa | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3240,7 +3185,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-ldnet_stub  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3244 "configure"
+#line 3189 "configure"
  #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -3251,7 +3196,7 @@
 dnet_ntoa()
 ; return 0; }
 EOF
-if { (eval echo configure:3255: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
 +if { (eval echo configure:3200: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3280,12 +3225,12 @@
     # The nsl library prevents programs from opening the X display
     # on Irix 5.2, according to dickey@clark.net.
     echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6
-echo "configure:3284: checking for gethostbyname" >&5
 +echo "configure:3229: checking for gethostbyname" >&5
  if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3289 "configure"
+#line 3234 "configure"
  #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char gethostbyname(); below.  */
@@ -3308,7 +3253,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:3312: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
 +if { (eval echo configure:3257: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    rm -rf conftest*
   eval "ac_cv_func_gethostbyname=yes"
 else
@@ -3329,7 +3274,7 @@
 
     if test $ac_cv_func_gethostbyname = no; then
       echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
-echo "configure:3333: checking for gethostbyname in -lnsl" >&5
 +echo "configure:3278: checking for gethostbyname in -lnsl" >&5
  ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3337,7 +3282,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lnsl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3341 "configure"
+#line 3286 "configure"
  #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -3348,7 +3293,7 @@
 gethostbyname()
 ; return 0; }
 EOF
-if { (eval echo configure:3352: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
 +if { (eval echo configure:3297: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3378,12 +3323,12 @@
     # -lsocket must be given before -lnsl if both are needed.
     # We assume that if connect needs -lnsl, so does gethostbyname.
     echo $ac_n "checking for connect""... $ac_c" 1>&6
-echo "configure:3382: checking for connect" >&5
 +echo "configure:3327: checking for connect" >&5
  if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3387 "configure"
+#line 3332 "configure"
  #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char connect(); below.  */
@@ -3406,7 +3351,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:3410: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
 +if { (eval echo configure:3355: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    rm -rf conftest*
   eval "ac_cv_func_connect=yes"
 else
@@ -3427,7 +3372,7 @@
 
     if test $ac_cv_func_connect = no; then
       echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6
-echo "configure:3431: checking for connect in -lsocket" >&5
 +echo "configure:3376: checking for connect in -lsocket" >&5
  ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3435,7 +3380,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lsocket $X_EXTRA_LIBS $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3439 "configure"
+#line 3384 "configure"
  #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -3446,7 +3391,7 @@
 connect()
 ; return 0; }
 EOF
-if { (eval echo configure:3450: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
 +if { (eval echo configure:3395: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3470,12 +3415,12 @@
 
     # gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX.
     echo $ac_n "checking for remove""... $ac_c" 1>&6
-echo "configure:3474: checking for remove" >&5
 +echo "configure:3419: checking for remove" >&5
  if eval "test \"`echo '$''{'ac_cv_func_remove'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3479 "configure"
+#line 3424 "configure"
  #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char remove(); below.  */
@@ -3498,7 +3443,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:3502: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
 +if { (eval echo configure:3447: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    rm -rf conftest*
   eval "ac_cv_func_remove=yes"
 else
@@ -3519,7 +3464,7 @@
 
     if test $ac_cv_func_remove = no; then
       echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6
-echo "configure:3523: checking for remove in -lposix" >&5
 +echo "configure:3468: checking for remove in -lposix" >&5
  ac_lib_var=`echo posix'_'remove | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3527,7 +3472,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lposix  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3531 "configure"
+#line 3476 "configure"
  #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -3538,7 +3483,7 @@
 remove()
 ; return 0; }
 EOF
-if { (eval echo configure:3542: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
 +if { (eval echo configure:3487: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3562,12 +3507,12 @@
 
     # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
     echo $ac_n "checking for shmat""... $ac_c" 1>&6
-echo "configure:3566: checking for shmat" >&5
 +echo "configure:3511: checking for shmat" >&5
  if eval "test \"`echo '$''{'ac_cv_func_shmat'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3571 "configure"
+#line 3516 "configure"
  #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char shmat(); below.  */
@@ -3590,7 +3535,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:3594: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
 +if { (eval echo configure:3539: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    rm -rf conftest*
   eval "ac_cv_func_shmat=yes"
 else
@@ -3611,7 +3556,7 @@
 
     if test $ac_cv_func_shmat = no; then
       echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6
-echo "configure:3615: checking for shmat in -lipc" >&5
 +echo "configure:3560: checking for shmat in -lipc" >&5
  ac_lib_var=`echo ipc'_'shmat | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3619,7 +3564,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lipc  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3623 "configure"
+#line 3568 "configure"
  #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -3630,7 +3575,7 @@
 shmat()
 ; return 0; }
 EOF
-if { (eval echo configure:3634: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
 +if { (eval echo configure:3579: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3663,7 +3608,7 @@
   # libraries we check for below, so use a different variable.
   #  --interran@uluru.Stanford.EDU, kb@cs.umb.edu.
   echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6
-echo "configure:3667: checking for IceConnectionNumber in -lICE" >&5
 +echo "configure:3612: checking for IceConnectionNumber in -lICE" >&5
  ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3671,7 +3616,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lICE $X_EXTRA_LIBS $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3675 "configure"
+#line 3620 "configure"
  #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -3682,7 +3627,7 @@
 IceConnectionNumber()
 ; return 0; }
 EOF
-if { (eval echo configure:3686: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
 +if { (eval echo configure:3631: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3709,7 +3654,7 @@
        LDFLAGS="$LDFLAGS $X_LIBS"
        CFLAGS="$CFLAGS $X_CFLAGS"
        echo $ac_n "checking for XOpenDisplay in -lX11""... $ac_c" 1>&6
-echo "configure:3713: checking for XOpenDisplay in -lX11" >&5
 +echo "configure:3658: checking for XOpenDisplay in -lX11" >&5
  ac_lib_var=`echo X11'_'XOpenDisplay | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3717,7 +3662,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lX11 $X_PRE_LIBS $LIBS $X_EXTRA_LIBS $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3721 "configure"
+#line 3666 "configure"
  #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -3728,7 +3673,7 @@
 XOpenDisplay()
 ; return 0; }
 EOF
-if { (eval echo configure:3732: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
 +if { (eval echo configure:3677: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3749,7 +3694,7 @@
 fi
 
        echo $ac_n "checking for XtAppInitialize in -lXt""... $ac_c" 1>&6
-echo "configure:3753: checking for XtAppInitialize in -lXt" >&5
 +echo "configure:3698: checking for XtAppInitialize in -lXt" >&5
  ac_lib_var=`echo Xt'_'XtAppInitialize | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3757,7 +3702,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lXt $X_PRE_LIBS $LIBS $X_EXTRA_LIBS $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3761 "configure"
+#line 3706 "configure"
  #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -3768,7 +3713,7 @@
 XtAppInitialize()
 ; return 0; }
 EOF
-if { (eval echo configure:3772: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
 +if { (eval echo configure:3717: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3824,17 +3769,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3828: checking for $ac_hdr" >&5
 +echo "configure:3773: checking for $ac_hdr" >&5
  if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3833 "configure"
+#line 3778 "configure"
  #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3838: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 +{ (eval echo configure:3783: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
  ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3882,7 +3827,7 @@
 
 
 echo $ac_n "checking for XextCreateExtension in -lXext""... $ac_c" 1>&6
-echo "configure:3886: checking for XextCreateExtension in -lXext" >&5
 +echo "configure:3831: checking for XextCreateExtension in -lXext" >&5
  ac_lib_var=`echo Xext'_'XextCreateExtension | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3890,7 +3835,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lXext  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3894 "configure"
+#line 3839 "configure"
  #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -3901,7 +3846,7 @@
 XextCreateExtension()
 ; return 0; }
 EOF
-if { (eval echo configure:3905: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
 +if { (eval echo configure:3850: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3937,13 +3882,13 @@
                if test $cf_path != default ; then
                        CFLAGS="-I$cf_path/include $cf_save"
                        echo $ac_n "checking for $cf_test in $cf_path""... $ac_c" 1>&6
-echo "configure:3941: checking for $cf_test in $cf_path" >&5
 +echo "configure:3886: checking for $cf_test in $cf_path" >&5
                 else
                        echo $ac_n "checking for $cf_test""... $ac_c" 1>&6
-echo "configure:3944: checking for $cf_test" >&5
 +echo "configure:3889: checking for $cf_test" >&5
                 fi
                cat > conftest.$ac_ext <<EOF
-#line 3947 "configure"
+#line 3892 "configure"
  #include "confdefs.h"
 
 #include <X11/Intrinsic.h>
@@ -3952,7 +3897,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:3956: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
 +if { (eval echo configure:3901: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    rm -rf conftest*
   cf_result=yes
 else
@@ -3978,21 +3923,21 @@
                        if test $cf_path != default ; then
                                LIBS="-L$cf_path/lib $cf_lib $LIBS"
                                echo $ac_n "checking for $cf_lib in $cf_path""... $ac_c" 1>&6
-echo "configure:3982: checking for $cf_lib in $cf_path" >&5
 +echo "configure:3927: checking for $cf_lib in $cf_path" >&5
                         else
                                LIBS="$cf_lib $LIBS"
                                echo $ac_n "checking for $cf_test in $cf_lib""... $ac_c" 1>&6
-echo "configure:3986: checking for $cf_test in $cf_lib" >&5
 +echo "configure:3931: checking for $cf_test in $cf_lib" >&5
                         fi
                        cat > conftest.$ac_ext <<EOF
-#line 3989 "configure"
+#line 3934 "configure"
  #include "confdefs.h"
 
 int main() {
 $cf_test()
 ; return 0; }
 EOF
-if { (eval echo configure:3996: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
 +if { (eval echo configure:3941: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    rm -rf conftest*
   cf_result=yes
 else
@@ -4029,6 +3974,83 @@
 
 
 
+echo $ac_n "checking for declaration of fd_set""... $ac_c" 1>&6
 +echo "configure:3979: checking for declaration of fd_set" >&5
 +if eval "test \"`echo '$''{'cf_cv_type_fd_set'+set}'`\" = set"; then
 +  echo $ac_n "(cached) $ac_c" 1>&6
 +else
+  echo "trying sys/types alone" 1>&5
 +cat > conftest.$ac_ext <<EOF
 +#line 3985 "configure"
+#include "confdefs.h"
 +
+#include <sys/types.h>
+int main() {
 +fd_set x
+; return 0; }
+EOF
+if { (eval echo configure:3993: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
 +  rm -rf conftest*
+  cf_cv_type_fd_set=sys/types.h
 +else
+  echo "configure: failed program was:" >&5
 +  cat conftest.$ac_ext >&5
 +  rm -rf conftest*
+  echo "trying X11/Xpoll.h" 1>&5
 +cat > conftest.$ac_ext <<EOF
 +#line 4002 "configure"
+#include "confdefs.h"
 +
+#ifdef HAVE_X11_XPOLL_H
+#include <X11/Xpoll.h>
+#endif
 +int main() {
+fd_set x
+; return 0; }
+EOF
+if { (eval echo configure:4012: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
 +  rm -rf conftest*
+  cf_cv_type_fd_set=X11/Xpoll.h
 +else
+  echo "configure: failed program was:" >&5
 +  cat conftest.$ac_ext >&5
 +  rm -rf conftest*
+  echo "trying sys/select.h" 1>&5
 +cat > conftest.$ac_ext <<EOF
 +#line 4021 "configure"
+#include "confdefs.h"
 +
+#include <sys/types.h>
+#include <sys/select.h>
 +int main() {
+fd_set x
+; return 0; }
+EOF
+if { (eval echo configure:4030: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
 +  rm -rf conftest*
+  cf_cv_type_fd_set=sys/select.h
 +else
+  echo "configure: failed program was:" >&5
 +  cat conftest.$ac_ext >&5
 +  rm -rf conftest*
+  cf_cv_type_fd_set=unknown
 +fi
+rm -f conftest*
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$cf_cv_type_fd_set" 1>&6
 +if test $cf_cv_type_fd_set = sys/select.h ; then
 +       cat >> confdefs.h <<\EOF
 +#define USE_SYS_SELECT_H 1
+EOF
 +
+fi
+
+
 CPPFLAGS="$cf_save_CPPFLAGS"
 
 LIBS="$LIBS $X_EXTRA_LIBS"
@@ -4038,12 +4060,12 @@
 for ac_func in grantpt
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4042: checking for $ac_func" >&5
 +echo "configure:4064: checking for $ac_func" >&5
  if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4047 "configure"
+#line 4069 "configure"
  #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -4066,7 +4088,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:4070: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
 +if { (eval echo configure:4092: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -4088,7 +4110,7 @@
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for openpty in -lutil""... $ac_c" 1>&6
-echo "configure:4092: checking for openpty in -lutil" >&5
 +echo "configure:4114: checking for openpty in -lutil" >&5
  ac_lib_var=`echo util'_'openpty | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4096,7 +4118,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lutil  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4100 "configure"
+#line 4122 "configure"
  #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -4107,7 +4129,7 @@
 openpty()
 ; return 0; }
 EOF
-if { (eval echo configure:4111: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
 +if { (eval echo configure:4133: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4141,7 +4163,7 @@
 # Extract the first word of "xterm", so it can be a program name with args.
 set dummy xterm; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4145: checking for $ac_word" >&5
 +echo "configure:4167: checking for $ac_word" >&5
  if eval "test \"`echo '$''{'ac_cv_path_XTERM_PATH'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4179,12 +4201,12 @@
        
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4183: checking for $ac_func" >&5
 +echo "configure:4205: checking for $ac_func" >&5
  if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4188 "configure"
+#line 4210 "configure"
  #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -4207,7 +4229,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:4211: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
 +if { (eval echo configure:4233: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -4233,7 +4255,7 @@
 
 
 echo $ac_n "checking if we should use imake to help""... $ac_c" 1>&6
-echo "configure:4237: checking if we should use imake to help" >&5
 +echo "configure:4259: checking if we should use imake to help" >&5
  
 # Check whether --enable-imake or --disable-imake was given.
 if test "${enable_imake+set}" = set; then
@@ -4258,7 +4280,7 @@
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4262: checking for $ac_word" >&5
 +echo "configure:4284: checking for $ac_word" >&5
  if eval "test \"`echo '$''{'ac_cv_path_IMAKE'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4397,7 +4419,7 @@
 
 
 echo $ac_n "checking for default terminal-id""... $ac_c" 1>&6
-echo "configure:4401: checking for default terminal-id" >&5
 +echo "configure:4423: checking for default terminal-id" >&5
  
 # Check whether --with-terminal-id or --without-terminal-id was given.
 if test "${with_terminal_id+set}" = set; then
@@ -4418,7 +4440,7 @@
 
 
 echo $ac_n "checking for default terminal-type""... $ac_c" 1>&6
-echo "configure:4422: checking for default terminal-type" >&5
 +echo "configure:4444: checking for default terminal-type" >&5
  
 # Check whether --with-terminal-type or --without-terminal-type was given.
 if test "${with_terminal_type+set}" = set; then
@@ -4435,7 +4457,7 @@
 
 
 echo $ac_n "checking for private terminfo-directory""... $ac_c" 1>&6
-echo "configure:4439: checking for private terminfo-directory" >&5
 +echo "configure:4461: checking for private terminfo-directory" >&5
  
 # Check whether --with-own-terminfo or --without-own-terminfo was given.
 if test "${with_own_terminfo+set}" = set; then
@@ -4472,7 +4494,7 @@
 
 ###    checks for optional features
 echo $ac_n "checking if you want active-icons""... $ac_c" 1>&6
-echo "configure:4476: checking if you want active-icons" >&5
 +echo "configure:4498: checking if you want active-icons" >&5
  
 # Check whether --enable-active-icon or --disable-active-icon was given.
 if test "${enable_active_icon+set}" = set; then
@@ -4498,7 +4520,7 @@
 fi
 
 echo $ac_n "checking if you want ANSI color""... $ac_c" 1>&6
-echo "configure:4502: checking if you want ANSI color" >&5
 +echo "configure:4524: checking if you want ANSI color" >&5
  
 # Check whether --enable-ansi-color or --disable-ansi-color was given.
 if test "${enable_ansi_color+set}" = set; then
@@ -4524,7 +4546,7 @@
 if test $enable_ansi_color = yes ; then
 
        echo $ac_n "checking if you want 16 colors like aixterm""... $ac_c" 1>&6
-echo "configure:4528: checking if you want 16 colors like aixterm" >&5
 +echo "configure:4550: checking if you want 16 colors like aixterm" >&5
         
 # Check whether --enable-16-color or --disable-16-color was given.
 if test "${enable_16_color+set}" = set; then
@@ -4548,7 +4570,7 @@
 
 
        echo $ac_n "checking if you want 256 colors""... $ac_c" 1>&6
-echo "configure:4552: checking if you want 256 colors" >&5
 +echo "configure:4574: checking if you want 256 colors" >&5
         
 # Check whether --enable-256-color or --disable-256-color was given.
 if test "${enable_256_color+set}" = set; then
@@ -4575,7 +4597,7 @@
 
        else
        echo $ac_n "checking if you want 88 colors""... $ac_c" 1>&6
-echo "configure:4579: checking if you want 88 colors" >&5
 +echo "configure:4601: checking if you want 88 colors" >&5
         
 # Check whether --enable-88-color or --disable-88-color was given.
 if test "${enable_88_color+set}" = set; then
@@ -4606,7 +4628,7 @@
 fi
 
 echo $ac_n "checking if you want blinking cursor""... $ac_c" 1>&6
-echo "configure:4610: checking if you want blinking cursor" >&5
 +echo "configure:4632: checking if you want blinking cursor" >&5
  
 # Check whether --enable-blink-cursor or --disable-blink-cursor was given.
 if test "${enable_blink_cursor+set}" = set; then
@@ -4632,7 +4654,7 @@
 if test $enable_ansi_color = yes ; then
 
        echo $ac_n "checking if you want bold colors mapped like IBM PC""... $ac_c" 1>&6
-echo "configure:4636: checking if you want bold colors mapped like IBM PC" >&5
 +echo "configure:4658: checking if you want bold colors mapped like IBM PC" >&5
         
 # Check whether --enable-bold-color or --disable-bold-color was given.
 if test "${enable_bold_color+set}" = set; then
@@ -4656,7 +4678,7 @@
 
 
        echo $ac_n "checking if you want color-mode enabled by default""... $ac_c" 1>&6
-echo "configure:4660: checking if you want color-mode enabled by default" >&5
 +echo "configure:4682: checking if you want color-mode enabled by default" >&5
         
 # Check whether --enable-color-mode or --disable-color-mode was given.
 if test "${enable_color_mode+set}" = set; then
@@ -4682,7 +4704,7 @@
 fi
 
 echo $ac_n "checking if you want support for color highlighting""... $ac_c" 1>&6
-echo "configure:4686: checking if you want support for color highlighting" >&5
 +echo "configure:4708: checking if you want support for color highlighting" >&5
  
 # Check whether --enable-highlighting or --disable-highlighting was given.
 if test "${enable_highlighting+set}" = set; then
@@ -4706,7 +4728,7 @@
 
 
 echo $ac_n "checking if you want support for doublesize characters""... $ac_c" 1>&6
-echo "configure:4710: checking if you want support for doublesize characters" >&5
 +echo "configure:4732: checking if you want support for doublesize characters" >&5
  
 # Check whether --enable-doublechars or --disable-doublechars was given.
 if test "${enable_doublechars+set}" = set; then
@@ -4730,7 +4752,7 @@
 
 
 echo $ac_n "checking if you want fallback-support for box characters""... $ac_c" 1>&6
-echo "configure:4734: checking if you want fallback-support for box characters" >&5
 +echo "configure:4756: checking if you want fallback-support for box characters" >&5
  
 # Check whether --enable-boxchars or --disable-boxchars was given.
 if test "${enable_boxchars+set}" = set; then
@@ -4754,7 +4776,7 @@
 
 
 echo $ac_n "checking if you want support for HP-style function keys""... $ac_c" 1>&6
-echo "configure:4758: checking if you want support for HP-style function keys" >&5
 +echo "configure:4780: checking if you want support for HP-style function keys" >&5
  
 # Check whether --enable-hp-fkeys or --disable-hp-fkeys was given.
 if test "${enable_hp_fkeys+set}" = set; then
@@ -4780,7 +4802,7 @@
 fi
 
 echo $ac_n "checking if you want support for internationalization""... $ac_c" 1>&6
-echo "configure:4784: checking if you want support for internationalization" >&5
 +echo "configure:4806: checking if you want support for internationalization" >&5
  
 # Check whether --enable-i18n or --disable-i18n was given.
 if test "${enable_i18n+set}" = set; then
@@ -4806,7 +4828,7 @@
 fi
 
 echo $ac_n "checking if you want support for initial-erase setup""... $ac_c" 1>&6
-echo "configure:4810: checking if you want support for initial-erase setup" >&5
 +echo "configure:4832: checking if you want support for initial-erase setup" >&5
  
 # Check whether --enable-initial-erase or --disable-initial-erase was given.
 if test "${enable_initial_erase+set}" = set; then
@@ -4832,7 +4854,7 @@
 fi
 
 echo $ac_n "checking if you want support for input-method""... $ac_c" 1>&6
-echo "configure:4836: checking if you want support for input-method" >&5
 +echo "configure:4858: checking if you want support for input-method" >&5
  
 # Check whether --enable-input-method or --disable-input-method was given.
 if test "${enable_input_method+set}" = set; then
@@ -4852,13 +4874,13 @@
 echo "$ac_t""$enable_ximp" 1>&6
 
 echo $ac_n "checking if X libraries support input-method""... $ac_c" 1>&6
-echo "configure:4856: checking if X libraries support input-method" >&5
 +echo "configure:4878: checking if X libraries support input-method" >&5
  if eval "test \"`echo '$''{'cf_cv_input_method'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
 cat > conftest.$ac_ext <<EOF
-#line 4862 "configure"
+#line 4884 "configure"
  #include "confdefs.h"
 
 #include <X11/IntrinsicP.h>
@@ -4885,7 +4907,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:4889: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
 +if { (eval echo configure:4911: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    rm -rf conftest*
   cf_cv_input_method=yes
 else
@@ -4908,7 +4930,7 @@
 fi
 
 echo $ac_n "checking if you want support for logging""... $ac_c" 1>&6
-echo "configure:4912: checking if you want support for logging" >&5
 +echo "configure:4934: checking if you want support for logging" >&5
  
 # Check whether --enable-logging or --disable-logging was given.
 if test "${enable_logging+set}" = set; then
@@ -4932,7 +4954,7 @@
 EOF
 
        echo $ac_n "checking if you want to allow logging via a pipe""... $ac_c" 1>&6
-echo "configure:4936: checking if you want to allow logging via a pipe" >&5
 +echo "configure:4958: checking if you want to allow logging via a pipe" >&5
         
 # Check whether --enable-logfile-exec or --disable-logfile-exec was given.
 if test "${enable_logfile_exec+set}" = set; then
@@ -4959,7 +4981,7 @@
 fi
 
 echo $ac_n "checking if you want support for iconify/maximize translations""... $ac_c" 1>&6
-echo "configure:4963: checking if you want support for iconify/maximize translations" >&5
 +echo "configure:4985: checking if you want support for iconify/maximize translations" >&5
  
 # Check whether --enable-maximize or --disable-maximize was given.
 if test "${enable_maximize+set}" = set; then
@@ -4983,7 +5005,7 @@
 
 
 echo $ac_n "checking if you want NumLock to override keyboard tables""... $ac_c" 1>&6
-echo "configure:4987: checking if you want NumLock to override keyboard tables" >&5
 +echo "configure:5009: checking if you want NumLock to override keyboard tables" >&5
  
 # Check whether --enable-num-lock or --disable-num-lock was given.
 if test "${enable_num_lock+set}" = set; then
@@ -5007,7 +5029,7 @@
 
 
 echo $ac_n "checking if you want support for right-scrollbar""... $ac_c" 1>&6
-echo "configure:5011: checking if you want support for right-scrollbar" >&5
 +echo "configure:5033: checking if you want support for right-scrollbar" >&5
  
 # Check whether --enable-rightbar or --disable-rightbar was given.
 if test "${enable_rightbar+set}" = set; then
@@ -5033,7 +5055,7 @@
 fi
 
 echo $ac_n "checking if you want check for redundant name-change""... $ac_c" 1>&6
-echo "configure:5037: checking if you want check for redundant name-change" >&5
 +echo "configure:5059: checking if you want check for redundant name-change" >&5
  
 # Check whether --enable-samename or --disable-samename was given.
 if test "${enable_samename+set}" = set; then
@@ -5057,7 +5079,7 @@
 
 
 echo $ac_n "checking if you want support for tek4014""... $ac_c" 1>&6
-echo "configure:5061: checking if you want support for tek4014" >&5
 +echo "configure:5083: checking if you want support for tek4014" >&5
  
 # Check whether --enable-tek4014 or --disable-tek4014 was given.
 if test "${enable_tek4014+set}" = set; then
@@ -5087,7 +5109,7 @@
 fi
 
 echo $ac_n "checking if you want pulldown menus with a toolbar""... $ac_c" 1>&6
-echo "configure:5091: checking if you want pulldown menus with a toolbar" >&5
 +echo "configure:5113: checking if you want pulldown menus with a toolbar" >&5
  
 # Check whether --enable-toolbar or --disable-toolbar was given.
 if test "${enable_toolbar+set}" = set; then
@@ -5111,7 +5133,7 @@
 
 
 echo $ac_n "checking if you want VT52 emulation""... $ac_c" 1>&6
-echo "configure:5115: checking if you want VT52 emulation" >&5
 +echo "configure:5137: checking if you want VT52 emulation" >&5
  
 # Check whether --enable-vt52 or --disable-vt52 was given.
 if test "${enable_vt52+set}" = set; then
@@ -5135,7 +5157,7 @@
 
 
 echo $ac_n "checking if you want wide-character support""... $ac_c" 1>&6
-echo "configure:5139: checking if you want wide-character support" >&5
 +echo "configure:5161: checking if you want wide-character support" >&5
  
 # Check whether --enable-wide-chars or --disable-wide-chars was given.
 if test "${enable_wide_chars+set}" = set; then
@@ -5164,7 +5186,7 @@
 fi
 
 echo $ac_n "checking if you want DECterm Locator support""... $ac_c" 1>&6
-echo "configure:5168: checking if you want DECterm Locator support" >&5
 +echo "configure:5190: checking if you want DECterm Locator support" >&5
  
 # Check whether --enable-dec-locator or --disable-dec-locator was given.
 if test "${enable_dec_locator+set}" = set; then
@@ -5190,7 +5212,7 @@
 fi
 
 echo $ac_n "checking if you want -ziconbeep option""... $ac_c" 1>&6
-echo "configure:5194: checking if you want -ziconbeep option" >&5
 +echo "configure:5216: checking if you want -ziconbeep option" >&5
  
 # Check whether --enable-ziconbeep or --disable-ziconbeep was given.
 if test "${enable_ziconbeep+set}" = set; then
@@ -5215,7 +5237,7 @@
 
 # development/testing aids
 echo $ac_n "checking if you want debugging traces""... $ac_c" 1>&6
-echo "configure:5219: checking if you want debugging traces" >&5
 +echo "configure:5241: checking if you want debugging traces" >&5
  
 # Check whether --enable-trace or --disable-trace was given.
 if test "${enable_trace+set}" = set; then
@@ -5244,7 +5266,7 @@
 
 
 echo $ac_n "checking if you want to see long compiling messages""... $ac_c" 1>&6
-echo "configure:5248: checking if you want to see long compiling messages" >&5
 +echo "configure:5270: checking if you want to see long compiling messages" >&5
  
 # Check whether --enable-echo or --disable-echo was given.
 if test "${enable_echo+set}" = set; then
@@ -5284,7 +5306,7 @@
 
 
 echo $ac_n "checking if you want magic cookie emulation""... $ac_c" 1>&6
-echo "configure:5288: checking if you want magic cookie emulation" >&5
 +echo "configure:5310: checking if you want magic cookie emulation" >&5
  
 # Check whether --enable-xmc-glitch or --disable-xmc-glitch was given.
 if test "${enable_xmc_glitch+set}" = set; then
@@ -5313,7 +5335,7 @@
 
 if test -n "$GCC" ; then
 echo $ac_n "checking if you want to turn on gcc warnings""... $ac_c" 1>&6
-echo "configure:5317: checking if you want to turn on gcc warnings" >&5
 +echo "configure:5339: checking if you want to turn on gcc warnings" >&5
  
 # Check whether --enable-warnings or --disable-warnings was given.
 if test "${enable_warnings+set}" = set; then
@@ -5353,9 +5375,9 @@
 if test -n "$GCC"
 then
        echo "checking for gcc __attribute__ directives" 1>&6
-echo "configure:5357: checking for gcc __attribute__ directives" >&5
 +echo "configure:5379: checking for gcc __attribute__ directives" >&5
         cat > conftest.$ac_ext <<EOF
-#line 5359 "configure"
+#line 5381 "configure"
  #include "confdefs.h"
 #include "conftest.h"
 #include "conftest.i"
@@ -5393,7 +5415,7 @@
 EOF
                        ;;
                esac
-               if { (eval echo configure:5397: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
 +               if { (eval echo configure:5419: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
                         test -n "$verbose" && echo "$ac_t""... $cf_attribute" 1>&6
                        cat conftest.h >>confdefs.h
 #              else
@@ -5410,11 +5432,11 @@
 if test -n "$GCC"
 then
                cat > conftest.$ac_ext <<EOF
-#line 5414 "configure"
+#line 5436 "configure"
  int main(int argc, char *argv[]) { return (argv[argc-1] == 0) ; }
 EOF
                echo "checking for gcc warning options" 1>&6
-echo "configure:5418: checking for gcc warning options" >&5
 +echo "configure:5440: checking for gcc warning options" >&5
         cf_save_CFLAGS="$CFLAGS"
        EXTRA_CFLAGS="-W -Wall"
        cf_warn_CONST=""
@@ -5432,7 +5454,7 @@
                Wstrict-prototypes $cf_warn_CONST
        do
                CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt"
-               if { (eval echo configure:5436: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
 +               if { (eval echo configure:5458: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
                         test -n "$verbose" && echo "$ac_t""... -$cf_opt" 1>&6
                        EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt"
                        test "$cf_opt" = Wcast-qual && EXTRA_CFLAGS="$EXTRA_CFLAGS -DXTSTRINGDEFINES"
Index: configure.in
--- xterm-118/configure.in      Thu Oct 14 05:57:38 1999
 +++ xterm-119/configure.in      Sat Oct 16 09:45:07 1999
 @@ -67,7 +67,6 @@
  CF_UTMP
 
 ###    checks for structures
-CF_TYPE_FD_SET
 CF_POSIX_VDISABLE
 
 ###    checks for external data
@@ -103,6 +102,7 @@
        )
 
 CF_X_ATHENA
+CF_TYPE_FD_SET
 
 CPPFLAGS="$cf_save_CPPFLAGS"
 
Index: ctlseqs.ms
--- xterm-118/ctlseqs.ms        Thu Oct 14 05:57:38 1999
 +++ xterm-119/ctlseqs.ms        Fri Oct 15 06:18:29 1999
 @@ -760,6 +760,8 @@
    \*(Ps = \*1 \(-> Print line containing cursor
   \*(Ps = \*4 \(-> Turn off autoprint mode
   \*(Ps = \*5 \(-> Turn on autoprint mode
+  \*(Ps = \*1 \*0 \(-> Print composed display, ignores DECPEX
 +  \*(Ps = \*1 \*1 \(-> Print all pages
  .
 .IP \\*(Cs\\*(Pm\\*s\\*l
 Reset Mode (RM)
@@ -900,6 +902,10 @@
   \*(Ps = \*2\*6 \(-> Report Keyboard status as
 .br
 \*(Cs\*?\*2\*7\*s\*;\*s\*1\*s\*;\*s\*0\*s\*;\*s\*0\*s\*n (North American)
+.br
+\*(Cs\*?\*5\*3\*s\*n Locator available, if compiled-in, or
 +.br
+\*(Cs\*?\*5\*0\*s\*n No Locator, if not.
  .
 .IP \\*(Cs\\*s\\*!\\*p
 Soft terminal reset (DECSTR)
Index: main.c
--- xterm-118/main.c    Thu Oct 14 05:57:38 1999
 +++ xterm-119/main.c    Fri Oct 15 06:19:17 1999
 @@ -2473,8 +2473,8 @@
  #endif /* PUCC_PTYD */
                {
                        /*  no ptys! */
-                       (void) fprintf(stderr, "%s: no available ptys\n",
 -                                      xterm_name);
 +                       (void) fprintf(stderr, "%s: no available ptys: %s\n",
 +                                      xterm_name, strerror(errno));
                         exit (ERROR_PTYS);
                }
 #ifdef PUCC_PTYD
@@ -3079,14 +3079,14 @@
 #ifdef TIOCCONS
                        int on = 1;
                        if (ioctl (tty, TIOCCONS, (char *)&on) == -1)
-                           fprintf(stderr, "%s: cannot open console\n",
 -                                   xterm_name);
 +                           fprintf(stderr, "%s: cannot open console: %s\n",
 +                                   xterm_name, strerror(errno));
  #endif
 #ifdef SRIOCSREDIR
                        int fd = open("/dev/console",O_RDWR);
                        if (fd == -1 || ioctl (fd, SRIOCSREDIR, tty) == -1)
-                           fprintf(stderr, "%s: cannot open console\n",
 -                                   xterm_name);
 +                           fprintf(stderr, "%s: cannot open console: %s\n",
 +                                   xterm_name, strerror(errno));
                         (void) close (fd);
 #endif
                    }
@@ -3178,7 +3178,7 @@
                    (void) close(0);
 
                    if (open ("/dev/tty", O_RDWR)) {
-                       fprintf(stderr, "cannot open /dev/tty\n");
 +                       fprintf(stderr, "cannot open /dev/tty: %s\n", strerror(errno));
                         exit(1);
                    }
                    (void) close(1);
@@ -3545,8 +3545,8 @@
                if (command_to_exec) {
                        execvp(*command_to_exec, command_to_exec);
                        /* print error message on screen */
-                       fprintf(stderr, "%s: Can't execvp %s\n", xterm_name,
 -                        *command_to_exec);
 +                       fprintf(stderr, "%s: Can't execvp %s: %s\n",
 +                               xterm_name, *command_to_exec, strerror(errno));
                 }
 
 #ifdef USE_SYSV_SIGHUP
@@ -3585,7 +3585,8 @@
                        0);
 
                /* Exec failed. */
-               fprintf (stderr, "%s: Could not exec %s!\n", xterm_name, ptr);
 +               fprintf (stderr, "%s: Could not exec %s: %s\n", xterm_name,
 +                       ptr, strerror(errno));
                 (void) sleep(5);
                exit(ERROR_EXEC);
            }                           /* end if in child after fork */
@@ -3623,9 +3624,9 @@
                        (void) close(screen->respond);
                        if (get_pty(&screen->respond)) {
                            /* no more ptys! */
-                           (void) fprintf(stderr,
 -                             "%s: child process can find no available ptys\n",
 -                             xterm_name);
 +                           fprintf(stderr,
 +                                   "%s: child process can find no available ptys: %s\n",
 +                                   xterm_name, strerror(errno));
                             handshake.status = PTY_NOMORE;
                            write(pc_pipe[1], (char *) &handshake, sizeof(handshake));
                            exit (ERROR_PTYS);
Index: menu.c
--- xterm-118/menu.c    Mon Sep 27 16:12:18 1999
 +++ xterm-119/menu.c    Thu Oct  7 20:40:30 1999
 @@ -674,7 +674,7 @@
         XtPointer closure GCC_UNUSED,
        XtPointer data GCC_UNUSED)
 {
-    xtermPrintScreen ();
+    xtermPrintScreen (TRUE);
  }
 
 
Index: print.c
--- xterm-118/print.c   Mon Sep 27 16:12:18 1999
 +++ xterm-119/print.c   Fri Oct 15 05:58:00 1999
 @@ -97,6 +97,7 @@
         Char *c = SCRN_BUF_CHARS(screen, row);
        Char *a = SCRN_BUF_ATTRS(screen, row);
        Char attr = 0;
+       unsigned ch;
         int last = screen->max_col + 1;
        int col;
 #if OPT_ISO_COLORS && OPT_PRINT_COLORS
@@ -109,9 +110,15 @@
 #endif
        int fg = -1, last_fg = -1;
        int bg = -1, last_bg = -1;
-       int cs = CSET_IN,last_cs = CSET_IN;
 +       int cs = CSET_IN;
 +       int last_cs = CSET_IN;
  
-       TRACE(("printLine(row=%d, chr=%d)\n", row, chr));
 +       TRACE(("printLine(row=%d, top=%d:%d, chr=%d):%s\n",
 +               row, screen->topline, screen->max_row, chr,
 +               visibleChars(PAIRED_CHARS(c,
 +                               screen->utf8_mode
 +                                       ? SCRN_BUF_WIDEC(screen,row)
 +                                       : 0), last)));
  
        if_OPT_EXT_COLORS(screen,{
                fbf = SCRN_BUF_FGRND(screen, row);
@@ -132,7 +139,10 @@
                        send_SGR(0,-1,-1);
                }
                for (col = 0; col < last; col++) {
-                       Char ch = c[col];
 +                       ch = c[col];
 +                       if_OPT_WIDE_CHARS(screen,{
 +                               ch = getXtermCell (screen, row, col);
 +                       })
  #if OPT_PRINT_COLORS
                        if_OPT_EXT_COLORS(screen,{
                                if (screen->print_attributes > 1) {
@@ -171,6 +181,11 @@
                        if (ch == 0)
                                ch = ' ';
 
+#if OPT_WIDE_CHARS
+                       if (screen->utf8_mode)
 +                           cs = CSET_IN;
 +                       else
 +#endif
                        cs = (ch >= ' ' && ch != 0x7f) ? CSET_IN : CSET_OUT;
                        if (last_cs != cs) {
                                if (screen->print_attributes) {
@@ -201,11 +216,12 @@
        charToPrinter(chr);
 }
 
-void xtermPrintScreen(void)
+void xtermPrintScreen(Boolean use_DECPEX)
  {
        register TScreen *screen = &term->screen;
-       int top = screen->printer_extent ? 0 : screen->top_marg;
 -       int bot = screen->printer_extent ? screen->max_row : screen->bot_marg;
 +       Boolean extent = (use_DECPEX && screen->printer_extent);
 +       int top = extent ? 0 : screen->top_marg;
 +       int bot = extent ? screen->max_row : screen->bot_marg;
         int was_open = initialized;
 
        TRACE(("xtermPrintScreen, rows %d..%d\n", top, bot))
@@ -220,6 +236,33 @@
        }
 }
 
+/*
+ * If the alternate screen is active, we'll print only that.  Otherwise, print
 + * the normal screen plus all scrolled-back lines.  The distinction is made
 + * because the normal screen's buffer is part of the overall scrollback buffer.
 + */
+static void
+xtermPrintEverything(void)
+{
+       register TScreen *screen = &term->screen;
 +       int top = 0;
 +       int bot = screen->max_row;
 +       int was_open = initialized;
 +
+       if (! screen->altbuf)
 +               top = - screen->savedlines;
 +
+       TRACE(("xtermPrintEverything, rows %d..%d\n", top, bot))
 +       while (top <= bot)
 +               printLine(top++, '\n');
 +       if (screen->printer_formfeed)
 +               charToPrinter('\f');
 +
+       if (!was_open || screen->printer_autoclose) {
 +               closePrinter();
 +       }
+}
 +
 static void send_CharSet(int row)
 {
 #if OPT_DEC_CHRSET
@@ -325,6 +368,13 @@
                initialized++;
        }
        if (Printer != 0) {
+#if OPT_WIDE_CHARS
+               if (chr > 127) {
 +                       Char temp[10];
 +                       *convertToUTF8(temp, chr) = 0;
 +                       fputs(temp, Printer);
 +               } else
 +#endif
                fputc(chr, Printer);
                if (isForm(chr))
                        fflush(Printer);
@@ -362,12 +412,18 @@
                        screen->printer_controlmode = 1;
                        TRACE(("Set autoprint mode\n"))
                        break;
+               case  10:       /* VT320 */
 +                       xtermPrintScreen(FALSE);
 +                       break;
 +               case  11:       /* VT320 */
 +                       xtermPrintEverything();
 +                       break;
                 }
        } else {
                switch (param) {
                case -1:
                case  0:
-                       xtermPrintScreen();
 +                       xtermPrintScreen(TRUE);
                         break;
                case  4:
                        screen->printer_controlmode = 0;
Index: ptydata.c
--- xterm-118/ptydata.c Mon Sep 27 16:12:18 1999
 +++ xterm-119/ptydata.c Fri Oct 15 05:39:12 1999
 @@ -51,8 +51,6 @@
  #endif
 #endif
 
-#define UTF8_CODE(code) ((code) | (screen->utf8_controls ? 0 : UCS_LIMIT))
 -
 int getPtyData(TScreen *screen, fd_set *select_mask, PtyData *data)
 {
     int i;
@@ -105,14 +103,30 @@
                    unsigned c = data->buf[i];
                    /* Combine UTF-8 into Unicode */
                    if (c < 0x80) {
+                       /* We received an ASCII character */
                         if (screen->utf_count > 0)
-                           data->buf2[j++] = UCS_REPL;
 +                           data->buf2[j++] = UCS_REPL; /* prev. sequence incomplete */
                         data->buf2[j++] = c;
                        screen->utf_count = 0;
                    } else if (c < 0xc0) {
+                       /* We received a continuation byte */
                         if (screen->utf_count < 1) {
-                           data->buf2[j++] = UCS_REPL;
 +                           data->buf2[j++] = UCS_REPL; /* ... unexpectedly */
                         } else {
+                           /* Check for overlong UTF-8 sequences for which a shorter
 +                            * encoding would exist and replace them with UCS_REPL.
 +                            * An overlong UTF-8 sequence can have any of the following
 +                            * forms:
 +                            *   1100000x 10xxxxxx
 +                            *   11100000 100xxxxx 10xxxxxx
 +                            *   11110000 1000xxxx 10xxxxxx 10xxxxxx
 +                            *   11111000 10000xxx 10xxxxxx 10xxxxxx 10xxxxxx
 +                            *   11111100 100000xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx
 +                            */
 +                           if (!screen->utf_char && !((c & 0x7f) >> (7 - screen->utf_count))) {
 +                               screen->utf_char = UCS_REPL;
 +                           }
 +                           /* characters outside UCS-2 become UCS_REPL */
                             if (screen->utf_char > 0x03ff) {
                                /* value would be >0xffff */
                                screen->utf_char = UCS_REPL;
@@ -122,14 +136,17 @@
                            }
                            screen->utf_count--;
                            if (screen->utf_count == 0)
-                               data->buf2[j++] = UTF8_CODE(c = screen->utf_char);
 +                               data->buf2[j++] = screen->utf_char;
                         }
                    } else {
+                       /* We received a sequence start byte */
                         if (screen->utf_count > 0)
-                           data->buf2[j++] = UCS_REPL;
 +                           data->buf2[j++] = UCS_REPL; /* prev. sequence incomplete */
                         if (c < 0xe0) {
                            screen->utf_count = 1;
                            screen->utf_char = (c & 0x1f);
+                           if (!(c & 0x1e))
 +                             screen->utf_char = UCS_REPL; /* overlong sequence */
                         } else if (c < 0xf0) {
                            screen->utf_count = 2;
                            screen->utf_char = (c & 0x0f);
@@ -147,7 +164,7 @@
                            screen->utf_count = 0;
                        }
                    }
-               }
 +               } /* for (i = 0; i < data->cnt; i++) */
                 TRACE(("UTF-8 count %d, char %04X input %d/%d bytes\n",
                        screen->utf_count,
                        screen->utf_char,
@@ -156,7 +173,7 @@
            } else {
                for (i = 0; i < data->cnt; i++)
                    data->ptr[i] = data->buf[i];
-           }
 +           } /* if (screen->utf8_mode) else */
  #endif
            /* read from pty was successful */
            if (!screen->output_eight_bits) {
@@ -167,9 +184,7 @@
 #if OPT_TRACE
            for (i = 0; i < data->cnt; i++) {
                if (!(i%8)) TRACE(("%s", i ? "\n    " : "READ"))
-               TRACE((" %c%04X",
 -                       (UCS_LIMIT & data->ptr[i]) ? '*' : ' ',
 -                       data->ptr[i] & ~UCS_LIMIT))
 +               TRACE((" %04X", data->ptr[i]))
             }
            TRACE(("\n"))
 #endif
Index: ptyx.h
--- xterm-118/ptyx.h    Thu Oct 14 05:57:38 1999
 +++ xterm-119/ptyx.h    Fri Oct 15 06:20:41 1999
 @@ -257,7 +257,7 @@
  #define NMENUFONTS 9                   /* font entries in fontMenu */
 
 #define        NBOX    5                       /* Number of Points in box      */
-#define        NPARAM  10                      /* Max. parameters              */
 +#define        NPARAM  30                      /* Max. parameters              */
  
 typedef struct {
        unsigned char   a_type;
@@ -265,9 +265,7 @@
        unsigned char   a_final;
        unsigned char   a_inters;
        char    a_nparam;               /* # of parameters              */
-       char    a_dflt[NPARAM];         /* Default value flags          */
         short   a_param[NPARAM];        /* Parameters                   */
-       char    a_nastyf;               /* Error flag                   */
  } ANSI;
 
 #define TEK_FONT_LARGE 0
@@ -875,7 +873,6 @@
 #endif
 #if OPT_WIDE_CHARS
        Boolean         wide_chars;     /* true when 16-bit chars       */
-       Boolean         utf8_controls;  /* UTF-8 contains control chars */
         int             utf8_mode;      /* use UTF-8 decode/encode: 0-2 */
        int             utf_count;      /* state of utf_char */
        IChar           utf_char;       /* in-progress character */
Index: version.h
--- xterm-118/version.h Thu Oct 14 05:57:38 1999
 +++ xterm-119/version.h Fri Oct 15 06:21:24 1999
 @@ -6,5 +6,5 @@
   * XFree86 to which this version of xterm has been built.  The number in
  * parentheses is my patch number (T.Dickey).
  */
-#define XTERM_PATCH   118
-#define XFREE86_VERSION "XFree86 3.9.16b"
 +#define XTERM_PATCH   119
+#define XFREE86_VERSION "XFree86 3.9.16c"
 Index: xterm.h
--- xterm-118/xterm.h   Thu Oct 14 05:57:38 1999
 +++ xterm-119/xterm.h   Fri Oct 15 06:21:03 1999
 @@ -165,8 +165,15 @@
  #endif
 
 #ifdef USE_SYS_SELECT_H
+
 #include <sys/types.h>
+
+#if defined(AIXV3) && defined(NFDBITS)
 +#undef NFDBITS /* conflict between X11/Xpoll.h and sys/select.h */
 +#endif
+
 #include <sys/select.h>
+
 #endif
 
 #include <setjmp.h>
@@ -271,7 +278,6 @@
 #define XtNtrimSelection       "trimSelection"
 #define XtNunderLine           "underLine"
 #define XtNutf8                        "utf8"
-#define XtNutf8controls                "utf8controls"
  #define XtNvisualBell          "visualBell"
 #define XtNwideChars           "wideChars"
 #define XtNxmcAttributes       "xmcAttributes"
@@ -345,7 +351,6 @@
 #define XtCTrimSelection       "TrimSelection"
 #define XtCUnderLine           "UnderLine"
 #define XtCUtf8                        "Utf8"
-#define XtCUtf8controls                "Utf8controls"
  #define XtCVisualBell          "VisualBell"
 #define XtCWideChars           "WideChars"
 #define XtCXmcAttributes       "XmcAttributes"
@@ -558,7 +563,7 @@
 extern int xtermPrinterControl (int chr);
 extern void xtermAutoPrint (int chr);
 extern void xtermMediaControl (int param, int private_seq);
-extern void xtermPrintScreen (void);
+extern void xtermPrintScreen (Boolean use_DECPEX);
  
 /* ptydata.c */
 extern int getPtyData (TScreen *screen, fd_set *select_mask, PtyData *data);
Index: xterm.log.html
--- xterm-118/xterm.log.html    Thu Oct 14 05:57:38 1999
 +++ xterm-119/xterm.log.html    Sat Oct 16 22:31:20 1999
 @@ -41,6 +41,7 @@
  xc/programs/Xserver/hw/xfree86).
 
 <UL>
+<LI><A HREF="#xterm_119">Patch #119 - 1999/10/16 - XFree86 3.9.16c</A>
  <LI><A HREF="#xterm_118">Patch #118 - 1999/10/5 - XFree86 3.9.16b</A>
 <LI><A HREF="#xterm_117">Patch #117 - 1999/9/29 - XFree86 3.9.16b</A>
 <LI><A HREF="#xterm_116">Patch #116 - 1999/9/25 - XFree86 3.9.16a</A>
@@ -162,6 +163,48 @@
 <LI><A HREF="#xterm_01">Patch #1 - 1996/1/6</A>
 </UL>
 
+<H1><A NAME="xterm_119">Patch #119 - 1999/10/16 - XFree86 3.9.16c</A></H1>
 +<ul>
+       <li>add responses (DA and DSR) for DEC locator mode
 +
+       <li>add coding for ANSI color to DA response
 +
+       <li>implement UTF-8 translation for Media Copy (print) operations.
 +
+       <li>implement vt320 control sequences for Print Composed Main Display
 +         and for Print All Pages.  The latter directs xterm to print the
 +         current screen as well as the scrollback buffer.
 +
+       <li>correct error in _GNU_SOURCE configure test, which left it always
 +         defined.
 +
+       <li>add more information, i.e., with strerror for some system calls in
 +         the main program which may fail due to insufficient permissions
 +         (prompted by a problem report for <code>-C</code> by Jeremie Petit
 +         <Jeremie.Petit@digital.com>).
 +
+       <li>add workaround for conflict between <X11/XPoll.h> and
 +         <sys/select.h> on AIX 4.3 (Richard Griswold
 +         <griswold@acm.org>).
 +
+       <li>add configure script test to resolve conflict between between
 +         <X11/XPoll.h> and <sys/select.h>
 +
+       <li>modify translation of UTF-8 sequences to reject "overly long"
 +         variations (patch by Markus Kuhn).
 +
+       <li>remove <code>utf8controls</code> resource, since Markus' change
 +         removes the corresponding logic.
 +
+       <li>correct a case where colors were not rendered properly.  This
 +         happened when an application inserted several lines, then changed
 +         colors.  If this was done all in one write, then there would be no
 +         intervening refresh, and the new color was applied to the pending
 +         scrolling operation which was awaiting the next refresh (reported
 +         by Stephane Chazelas <Stephane_Chazelas@Raytheon.com>).
 +
+</ul>
+
 <H1><A NAME="xterm_118">Patch #118 - 1999/10/5 - XFree86 3.9.16b</A></H1>
 <ul>
        <li>refine configure test for utmp versus utmpx, to build on HP-UX 10.x
@@ -274,7 +317,7 @@
            <li>Bug 2: 
              The check for the last non-empty column (while (last > 0) ... in 
              print.c/printLine) omits the rightmost column of the screen, the loop must 
-             start with last = screen->max_col+1 instead of last = screen->max_col. 
 +             start with last = screen->max_col+1 instead of last = screen->max_col. 
          
            <li>Bug 3: 
              Any attributes of the first character (and of all immediately following 
@@ -420,7 +463,7 @@
          <li>fix OSC 4 xx ?  (report ansi color) to report a string which can
            actually be used to set the color back
 
-         <li>fix OSC 4 xx yy (change ansi color) to not allow setting colors >
 +         <li>fix OSC 4 xx yy (change ansi color) to not allow setting colors >
             15 in 16 color mode
 
          <li>simplify the COLOR_ settings a bit in ptyx.h, along with setting
Index: xterm.man
--- xterm-118/xterm.man Mon Sep 27 16:12:18 1999
 +++ xterm-119/xterm.man Fri Oct 15 05:56:55 1999
 @@ -1367,15 +1367,6 @@
  The default is ``0'' (off).
 Any other value will turn on UTF-8 mode.
 .TP 8
-.B "utf8controls (\fPclass\fB Utf8controls)"
 -If \fIxterm\fP is running in UTF-8 mode, this specifies whether to
 -interpret UTF-8 forms as control characters,
 -e.g., 0xC0 0x8A (which is interpreted as U+000A) as a C0 control.
 -The Unicode standard does not cover this area, leaving it unspecified for
 -higher level protocols.
-Your application may require this interpretation.
 -The default is ``false.''
-.TP 8
  .B "visualBell (\fPclass\fB VisualBell)"
 Specifies whether or not a visible bell (i.e. flashing) should be used instead
 of an audible bell when Control-G is received.  The default is ``false.''