XFree87 3.9Ah - xterm patch #76 - 1998/5/8 - T.Dickey <dickey@clark.net>
 
A fix for the print-window function, and some minor cleanup:
 
        + modify logic that closes pipe in the print-window function to not use
          pclose, which does not work on all systems, since I did not open the
          pipe with popen (reported by Stefan Dalibor).
 
        + correct name of $(EXTRA_LOAD_FLAGS) imake variable (reported
          by Stefan Dalibor).
 
        + guard logic in ChangeGroup() function against null pointer
          (reported by Stefan Dalibor).
 
        + ensure that menu entry for toggling sunKeyboard resource is
          initialized (reported by Branden Robinson <branden@purdue.edu>).
 
        + gcc unused-variable warnings (reported by Bernd Ernesti
          <bernd@arresum.inka.de>)
 
        + rename global variable 'buffer' to 'VTbuffer'
 
# ------------------------------------------------------------------------------
 #  Tekproc.c      |    2 +-
 #  aclocal.m4     |    2 +-
 #  charproc.c     |   10 +++++-----
 #  configure      |    2 +-
 #  data.c         |    4 ++--
 #  data.h         |    2 +-
 #  main.c         |    6 ++++--
 #  menu.c         |    1 +
 #  misc.c         |    6 ++++--
 #  print.c        |   15 +++++++++++----
 #  version.h      |    2 +-
 #  xterm.log.html |   24 ++++++++++++++++++++++++
 #  12 files changed, 56 insertions, 20 deletions
 # ------------------------------------------------------------------------------
 Index: Tekproc.c
--- xterm-75+/Tekproc.c Tue Apr 28 15:01:01 1998
 +++ xterm-76/Tekproc.c  Fri May  8 20:33:15 1998
 @@ -398,7 +398,7 @@
  #ifdef ALLOWLOGGING
                        if(screen->logging) {
                                FlushLog(screen);
-                               screen->logstart = buffer;
 +                               screen->logstart = VTbuffer;
                         }
 #endif
                        return;
Index: aclocal.m4
--- xterm-75+/aclocal.m4        Wed May  6 18:58:44 1998
 +++ xterm-76/aclocal.m4 Fri May  8 18:57:39 1998
 @@ -466,7 +466,7 @@
         cat >> ./Imakefile <<'CF_EOF'
 findstddefs:
        @echo 'IMAKE_CFLAGS="${ALLDEFINES} ifelse($1,,,$1)"'
-       @echo 'IMAKE_LOADFLAGS="${EXTRA_LOADFLAGS} ifelse($2,,,$2)"'
 +       @echo 'IMAKE_LOADFLAGS="${EXTRA_LOAD_FLAGS} ifelse($2,,,$2)"'
  CF_EOF
        if ( $IMAKE $cf_imake_opts 1>/dev/null 2>&AC_FD_CC && test -f Makefile)
        then
Index: charproc.c
--- xterm-75+/charproc.c        Tue Apr 28 15:01:01 1998
 +++ xterm-76/charproc.c Fri May  8 20:33:42 1998
 @@ -2328,9 +2328,9 @@
                 FlushLog(screen);
 #endif
 #ifndef AMOEBA
-           bcnt = read(screen->respond, (char *)(bptr = buffer), BUF_SIZE);
 +           bcnt = read(screen->respond, (char *)(bptr = VTbuffer), BUF_SIZE);
  #else
-           bptr = buffer;
 +           bptr = VTbuffer;
             if ((bcnt = cb_gets(screen->tty_outq, bptr, bcnt, BUF_SIZE)) == 0) {
                errno = EIO;
                bcnt = -1;
@@ -2477,7 +2477,6 @@
     Char       *buf;           /* start of characters to process */
     Char       *ptr;           /* end */
 {
-       register Char   *s;
         register int    len;
        register int    n;
        register int    next_col;
@@ -2486,6 +2485,7 @@
                return;
 
        if_OPT_XMC_GLITCH(screen,{
+               register Char   *s;
                 if (charset != '?')
                        for (s=buf; s<ptr; ++s)
                                if (*s == XMC_GLITCH)
@@ -3463,7 +3463,7 @@
        StartBlinking(screen);
 
        bcnt = 0;
-       bptr = buffer;
 +       bptr = VTbuffer;
  #if OPT_TEK4014
        while(Tpushb > Tpushback) {
                *bptr++ = *--Tpushb;
@@ -3472,7 +3472,7 @@
        bcnt += (i = Tbcnt);
        for( ; i > 0 ; i--)
                *bptr++ = *Tbptr++;
-       bptr = buffer;
 +       bptr = VTbuffer;
  #endif
        if(!setjmp(VTend))
                VTparse();
Index: configure
--- xterm-75+/configure Thu May  7 18:09:31 1998
 +++ xterm-76/configure  Fri May  8 18:57:39 1998
 @@ -3662,7 +3662,7 @@
         cat >> ./Imakefile <<'CF_EOF'
 findstddefs:
        @echo 'IMAKE_CFLAGS="${ALLDEFINES} $(MAIN_DEFINES)"'
-       @echo 'IMAKE_LOADFLAGS="${EXTRA_LOADFLAGS} "'
 +       @echo 'IMAKE_LOADFLAGS="${EXTRA_LOAD_FLAGS} "'
  CF_EOF
        if ( $IMAKE $cf_imake_opts 1>/dev/null 2>&5 && test -f Makefile)
        then
Index: data.c
--- xterm-75+/data.c    Tue Apr 28 15:01:01 1998
 +++ xterm-76/data.c     Fri May  8 20:26:39 1998
 @@ -77,8 +77,8 @@
  #endif
 
 int bcnt = 0;
-Char buffer[BUF_SIZE];
-Char *bptr = buffer;
+Char VTbuffer[BUF_SIZE];
 +Char *bptr = VTbuffer;
 jmp_buf VTend;
 XPoint VTbox[NBOX] = {
        {0, 0},
Index: data.h
--- xterm-75+/data.h    Tue Apr 28 15:01:01 1998
 +++ xterm-76/data.h     Fri May  8 20:32:10 1998
 @@ -79,7 +79,7 @@
  #if OPT_SUNPC_KBD
 extern Boolean sunKeyboard;
 #endif
-extern Char buffer[];
+extern Char VTbuffer[];
 extern int am_slave;
 extern int bcnt;
 #ifdef DEBUG
Index: main.c
--- xterm-75+/main.c    Thu May  7 18:09:31 1998
 +++ xterm-76/main.c     Fri May  8 20:27:45 1998
 @@ -490,7 +490,9 @@
  
 static Bool added_utmp_entry = False;
 
+#ifdef USE_SYSV_UTMP
 static Bool xterm_exiting = False;
+#endif
 
 /*
 ** Ordinarily it should be okay to omit the assignment in the following
@@ -3895,7 +3897,7 @@
            (void) setutent();
            utptr = getutid(&utmp);
            /* write it out only if it exists, and the pid's match */
-           if (utptr && (utptr->ut_pid == term->screen.pid)) {
 +           if (utptr && (utptr->ut_pid == screen->pid)) {
                     utptr->ut_type = DEAD_PROCESS;
 #if defined(SVR4) || defined(SCO325) || (defined(linux) && __GLIBC__ >= 2)
                    utmp.ut_session = getsid(0);
@@ -3954,7 +3956,7 @@
 #endif /* USE_SYSV_UTMP */
 #endif /* UTMP */
 #ifndef AMOEBA
-        close(term->screen.respond); /* close explicitly to avoid race with slave side */
 +        close(screen->respond); /* close explicitly to avoid race with slave side */
  #endif
 #ifdef ALLOWLOGGING
        if(screen->logging)
Index: menu.c
--- xterm-75+/menu.c    Tue Apr 28 15:01:01 1998
 +++ xterm-76/menu.c     Fri May  8 18:57:40 1998
 @@ -267,6 +267,7 @@
  #endif
            update_8bit_control();
            update_decbkm();
+           update_sun_kbd();
             if (screen->terminal_id < 200) {
                set_sensitivity (screen->mainMenu,
                                 mainMenuEntries[mainMenu_8bit_ctrl].widget,
Index: misc.c
--- xterm-75+/misc.c    Tue Apr 28 15:01:01 1998
 +++ xterm-76/misc.c     Fri May  8 20:34:13 1998
 @@ -742,7 +742,7 @@
         cp = CURRENT_EMU_VAL(screen, Tbptr, bptr);
        if((i = cp - screen->logstart) > 0)
                write(screen->logfd, (char *)screen->logstart, i);
-       screen->logstart = CURRENT_EMU_VAL(screen, Tbuffer, buffer);
 +       screen->logstart = CURRENT_EMU_VAL(screen, Tbuffer, VTbuffer);
  }
 
 #endif /* ALLOWLOGGING */
@@ -1013,6 +1013,7 @@
      String attribute;
      XtArgVal value;
 {
+    if (value != 0) {
         Arg args[1];
 #if OPT_SAME_NAME
        char *buf;
@@ -1029,6 +1030,7 @@
 
        XtSetArg( args[0], attribute, value );
        XtSetValues( toplevel, args, 1 );
+    }
 }
 
 void
@@ -1491,7 +1493,7 @@
 #ifdef ALLOWLOGGING
        if (screen->logging) {
            FlushLog (screen);
-           screen->logstart = buffer;
 +           screen->logstart = VTbuffer;
         }
 #endif
        longjmp(Tekend, 1);
Index: print.c
--- xterm-75+/print.c   Thu May  7 06:33:49 1998
 +++ xterm-76/print.c    Fri May  8 18:57:40 1998
 @@ -66,6 +66,7 @@
  static void stringToPrinter PROTO((char * str));
 
 static FILE *Printer;
+static int Printer_pid;
 static int initialized;
 
 static void printCursorLine()
@@ -188,9 +189,13 @@
                charToPrinter('\f');
 
        if (Printer != 0 && !was_open) {
-               pclose(Printer);
 +               fclose(Printer);
 +               TRACE(("closed printer, waiting...\n"));
 +               while (nonblocking_wait() > 0)
 +                       ;
                 Printer = 0;
                initialized = 0;
+               TRACE(("closed printer\n"));
         }
 }
 
@@ -262,16 +267,15 @@
        if (!initialized) {
                FILE    *input;
                int     my_pipe[2];
-               int     my_pid;
                 int     c;
                register TScreen *screen = &term->screen;
 
                if (pipe(my_pipe))
                        SysError (ERROR_FORK);
-               if ((my_pid = fork()) < 0)
 +               if ((Printer_pid = fork()) < 0)
                         SysError (ERROR_FORK);
 
-               if (my_pid == 0) {
 +               if (Printer_pid == 0) {
                         close(my_pipe[1]);      /* printer is silent */
                        setgid (screen->gid);
                        setuid (screen->uid);
@@ -282,10 +286,13 @@
                                if (isForm(c))
                                        fflush(Printer);
                        }
+                       pclose(Printer);
                         exit(0);
                } else {
                        close(my_pipe[0]);      /* won't read from printer */
                        Printer = fdopen(my_pipe[1], "w");
+                       TRACE(("opened printer from pid %d/%d\n",
 +                               (int)getpid(), Printer_pid))
                 }
                initialized++;
        }
Index: version.h
--- xterm-75+/version.h Thu May  7 18:09:31 1998
 +++ xterm-76/version.h  Fri May  8 19:37:00 1998
 @@ -6,4 +6,4 @@
   * version of xterm has been built.  The number in parentheses is my patch
  * number (T.Dickey).
  */
-#define XTERM_VERSION "XFree86 3.9Ag(75)"
 +#define XTERM_VERSION "XFree86 3.9Ah(76)"
 Index: xterm.log.html
--- xterm-75+/xterm.log.html    Thu May  7 18:15:05 1998
 +++ xterm-76/xterm.log.html     Fri May  8 20:58:03 1998
 @@ -41,6 +41,7 @@
  xc/programs/Xserver/hw/xfree86).
 
 <UL>
+<LI><A HREF="#xterm_76">Patch #76 - 1998/5/8 - XFree86 3.9Ah and 3.3.2</A>
  <LI><A HREF="#xterm_75">Patch #75 - 1998/5/7 - XFree86 3.9Ah and 3.3.2</A>
 <LI><A HREF="#xterm_74">Patch #74 - 1998/4/27 - XFree86 3.9Ag and 3.3.2</A>
 <LI><A HREF="#xterm_73">Patch #73 - 1998/4/25 - XFree86 3.9Ag and 3.3.2</A>
@@ -117,6 +118,29 @@
 <LI><A HREF="#xterm_02">Patch #2 - 1996/1/7</A>
 <LI><A HREF="#xterm_01">Patch #1 - 1996/1/6</A>
 </UL>
+
+<H1><A NAME="xterm_76">Patch #76 - 1998/5/8 - XFree86 3.9Ah and 3.3.2</A></H1>
 +
+A fix for the print-window function, and some minor cleanup:
 +<ul>
+       <li>modify logic that closes pipe in the print-window function to not use
 +         pclose, which does not work on all systems, since I did not open the
 +         pipe with popen (reported by Stefan Dalibor).
 +
+       <li>correct name of $(EXTRA_LOAD_FLAGS) imake variable (reported
 +         by Stefan Dalibor).
 +
+       <li>guard logic in ChangeGroup() function against null pointer
 +         (reported by Stefan Dalibor).
 +
+       <li>ensure that menu entry for toggling sunKeyboard resource is
 +         initialized (reported by Branden Robinson <branden@purdue.edu>).
 +
+       <li>gcc unused-variable warnings (reported by Bernd Ernesti
 +         <bernd@arresum.inka.de>)
 +
+       <li>rename global variable 'buffer' to 'VTbuffer'
 +</ul>
 
 <H1><A NAME="xterm_75">Patch #75 - 1998/5/7 - XFree86 3.9Ah and 3.3.2</A></H1>