$NetBSD: patch-ab,v 1.4 2012/05/23 07:19:23 dholland Exp $

- use standard headers
- fix solaris build
- fd_set isn't a struct

--- main.c.orig	1998-09-30 23:58:17.000000000 +0000
+++ main.c
@@ -33,16 +33,20 @@
  */
 
 #include <sys/time.h>
+#include <err.h>
 #include <stdio.h>
 #include <unistd.h>
 #include <stdlib.h>
 #include <fcntl.h>
 #include <termios.h>
 #include <signal.h>
+#include <string.h>
 #include <X11/X.h>
 #include <X11/extensions/XTest.h>
 #include <X11/keysym.h>
 
+#include "uucplock.h"
+
 #ifdef X_DISPLAY_MISSING
 # error this program cannot be compiled without X11.
 #endif
@@ -51,6 +55,13 @@
 # define REMOTE_DEVICE	"/dev/tty02"	/*biased to VAIO505 :-P*/
 #endif
 
+#ifndef __P
+# define __P(X) X
+#endif
+#ifndef MDMBUF
+# define MDMBUF 0
+#endif
+
 static char *remote = REMOTE_DEVICE;
 static int debug = 0;
 #define dprintf(x)	{ if (debug) fprintf x; }
@@ -144,8 +155,18 @@ main(argc, argv)
 	}
 	tcgetattr(fd, &old);
 	raw = old;
+#if defined(__sun)
+	raw.c_iflag &= ~(IMAXBEL|IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON);
+	raw.c_oflag &= ~OPOST;
+	raw.c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);
+	raw.c_cflag &= ~(CSIZE|PARENB);
+	raw.c_cflag |= CS8;
+	cfsetispeed(&raw, B1200);
+	cfsetospeed(&raw, B1200);
+#else
 	cfmakeraw(&raw);
 	cfsetspeed(&raw, B1200);
+#endif
 	raw.c_cflag &= ~(CSIZE|PARENB|CSTOPB|MDMBUF);
 	raw.c_cflag |= CS8|CREAD|CLOCAL;
 	tcsetattr(fd, TCSANOW, &raw);
@@ -183,7 +204,7 @@ mainloop(fd)
 	int fd;
 {
 	struct timeval tv;
-	struct fd_set rfd;
+	fd_set rfd;
 	u_char buf[BUFSIZ];
 	int nfd;
 	int len;
