Subject: 9term fix for HP

From: [email-masked]
Date: Thu, 2 Jun 1994 11:15:30 -0400

This is what I had to do to get 9term to comiple on the HP.
I think it subsumes arnold's fix.
*** 9term/Make.hpux.save	Thu Jun  2 08:50:14 1994
--- 9term/Make.hpux	Thu Jun  2 08:50:26 1994
***************
*** 12,18 ****
  #	Define BSDPTYS for BSD-style pty support
  #	Define POSIXPTYS for POSIX ptys
  
! OS=-DHPUX -Aa -DPOSIXPTYS -DBSDPTYS -D_POSIX_SOURCE -DXLIB_ILLEGAL_ACCESS -D_INCLUDE_XOPEN_SOURCE -D_INCLUDE_HPUX_SOURCE
  
  #	where we'll install it
  BINDIR=.
--- 12,18 ----
  #	Define BSDPTYS for BSD-style pty support
  #	Define POSIXPTYS for POSIX ptys
  
! OS=-DHPUX -Aa -DPOSIXPTYS -DBSDPTYS -D_POSIX_SOURCE -DXLIB_ILLEGAL_ACCESS -D_INCLUDE_XOPEN_SOURCE -D_INCLUDE_HPUX_SOURCE -DUSE_SYSCONF
  
  #	where we'll install it
  BINDIR=.
*** 9term/display.c.save	Thu Jun  2 07:48:35 1994
--- 9term/display.c	Thu Jun  2 07:50:39 1994
***************
*** 37,43 ****
  extern	Display	*_dpy;
  extern	Widget	_toplevel;
  
! static int	ninewm;
  static	Cursor	whitearrow = {
  	{0, 0},
  	{0xFF, 0xE0, 0xFF, 0xE0, 0xFF, 0xC0, 0xFF, 0x00,
--- 37,43 ----
  extern	Display	*_dpy;
  extern	Widget	_toplevel;
  
! int	ninewm;
  static	Cursor	whitearrow = {
  	{0, 0},
  	{0xFF, 0xE0, 0xFF, 0xE0, 0xFF, 0xC0, 0xFF, 0x00,
***************
*** 64,72 ****
  	{"+ut",		"*utmp",	XrmoptionNoArg,		"false"},
  	{"-9",		"*kbdMode",	XrmoptionNoArg,		"plan9"},
  	{"-unix",	"*kbdMode",	XrmoptionNoArg,		"unix"},
! 	{"-label",	"*label",	XrmoptionSepArg,        (caddr_t)NULL},
! 	{"-high",	"*highwater",	XrmoptionSepArg,        (caddr_t)NULL},
! 	{"-low",	"*lowwater",	XrmoptionSepArg,        (caddr_t)NULL},
  	{"-9wm",	"*9wm",		XrmoptionNoArg,		"true"},
  	{"-beep",	"*beep",	XrmoptionNoArg,		"plan9 unix"},
  	{"-debug",	"*debug",	XrmoptionNoArg,		"true"},
--- 64,72 ----
  	{"+ut",		"*utmp",	XrmoptionNoArg,		"false"},
  	{"-9",		"*kbdMode",	XrmoptionNoArg,		"plan9"},
  	{"-unix",	"*kbdMode",	XrmoptionNoArg,		"unix"},
! 	{"-label",	"*label",	XrmoptionSepArg,        0},
! 	{"-high",	"*highwater",	XrmoptionSepArg,        0},
! 	{"-low",	"*lowwater",	XrmoptionSepArg,        0},
  	{"-9wm",	"*9wm",		XrmoptionNoArg,		"true"},
  	{"-beep",	"*beep",	XrmoptionNoArg,		"plan9 unix"},
  	{"-debug",	"*debug",	XrmoptionNoArg,		"true"},
*** 9term/pty.c.save	Thu Jun  2 07:53:11 1994
--- 9term/pty.c	Thu Jun  2 08:50:10 1994
***************
*** 60,65 ****
--- 60,70 ----
  #	define	V_WERAS VWERASE
  #	define	V_FLUSH VFLUSH
  #endif
+ #ifdef	HPUX
+ #	define 	V_START VSTART
+ #	define 	V_STOP VSTOP
+ #	define 	V_SUSP VSUSP
+ #endif
  
  #ifdef POSIXPTYS
  #	include <sys/termios.h>
***************
*** 146,152 ****
  	{ "weras",	5, V_WERAS,	ctrl('w'),	ctrl('w') },
  	{ "lnext",	5, VLNEXT,	ctrl('v'),	ctrl('v') },
  #endif
! #ifndef IRIX
  	{ "flush",	5, V_FLUSH,	ctrl('o'),	ctrl('o') },
  #endif
  #ifdef	VQUOTE
--- 151,157 ----
  	{ "weras",	5, V_WERAS,	ctrl('w'),	ctrl('w') },
  	{ "lnext",	5, VLNEXT,	ctrl('v'),	ctrl('v') },
  #endif
! #ifdef V_FLUSH
  	{ "flush",	5, V_FLUSH,	ctrl('o'),	ctrl('o') },
  #endif
  #ifdef	VQUOTE
***************
*** 414,420 ****
--- 419,427 ----
  void
  flushstream(void)
  {
+ #ifdef I_FLUSH
  	ioctl(comm_fd, I_FLUSH, FLUSHW);
+ #endif
  }
  
  void
***************
*** 573,579 ****
   	 */
  	slot = 0;
  	while(read(fd, &utmp, sizeof(utmp)) == sizeof(utmp)) {
! 		if (!strncmp(ttyname, &utmp.ut_line, sizeof(utmp.ut_line))) {
  			lseek(fd, -sizeof(utmp), 1);
  			break;
  		}
--- 580,586 ----
   	 */
  	slot = 0;
  	while(read(fd, &utmp, sizeof(utmp)) == sizeof(utmp)) {
! 		if (!strncmp(ttyname, utmp.ut_line, sizeof(utmp.ut_line))) {
  			lseek(fd, -sizeof(utmp), 1);
  			break;
  		}
***************
*** 712,716 ****
--- 719,731 ----
  	default:
  		fprintf(stderr, "unknown %02x\n", e->data[0]);
  	}
+ }
+ #endif
+ 
+ #ifdef USE_SYSCONF
+ int
+ getdtablesize()
+ {
+     return sysconf(_SC_OPEN_MAX);
  }
  #endif

*** /dev/null	Thu Jun  2 09:19:00 1994
--- libtext/Make.hpux	Thu Jun  2 08:47:27 1994
***************
*** 0 ****
--- 1,38 ----
+ #
+ #	Prototype Sun Makefile for libtext
+ #
+ #	Additionally, -D_POSIX_SOURCE (or its equivalent) may be specified
+ #	if your compiler supports posix-compatible compilation
+ OS=-DHPUX -Aa -D_POSIX_SOURCE -DXLIB_ILLEGAL_ACCESS -D_INCLUDE_XOPEN_SOURCE -D_INCLUDE_HPUX_SOURCE
+ 
+ #	add -Iincludedir for any include directories that need to be searched
+ #	for posix header files
+ INCS=-I. -I../include
+ 
+ #	add name of library orderer - use ":" if none exists
+ RANLIB=:
+ 
+ #	add name of library
+ AR=ar
+ 
+ CFLAGS=-c $(OS) $(INCS) -D_LIBXG_EXTENSION
+ 
+ LIB=libtext.a
+ 
+ OBJ=click.o scroll.o text.o
+ 
+ all:	$(LIB)
+ 
+ $(LIB):	$(OBJ)
+ 	$(AR) rv $(LIB) $(OBJ)
+ 	$(RANLIB) $(LIB)
+ 
+ clean:
+ 	rm -f *.o
+ 
+ nuke:	clean
+ 	rm -f $(LIB)
+ 
+ install:	$(LIB)
+ 
+ $(OBJ):	../include/u.h ../include/libc.h ../include/libg.h ../include/frame.h ../include/text.h