openbsd-ports/emulators/x48/patches/patch-src_serial_c
pascal 33eca7a3e0 Update to 0.6.4, from Brad.
ok edd@ and sthen@ on a previous version. Maintainer timed out.
2011-11-23 19:36:44 +00:00

46 lines
1.2 KiB
Plaintext

$OpenBSD: patch-src_serial_c,v 1.2 2011/11/23 19:36:44 pascal Exp $
Adjust the serial code for *BSD
--- src/serial.c.orig Mon Nov 14 22:03:40 2011
+++ src/serial.c Tue Nov 15 11:45:59 2011
@@ -134,7 +134,19 @@ serial_init()
ttyp = -1;
if (useTerminal)
{
-#if defined(IRIX)
+#if defined(CSRG_BASED)
+ int tty_m, tty_s;
+ if (openpty(&tty_m, &tty_s, tty_dev_name, NULL, NULL) == 0)
+ {
+ if (verbose)
+ printf("%s: wire connection on %s\n", progname, tty_dev_name);
+ wire_fd = tty_m;
+ ttyp = tty_s;
+ wire_name = strdup(tty_dev_name);
+ }
+ else
+ perror("openpty");
+#elif defined(IRIX)
if ((p = _getpty(&wire_fd, O_RDWR | O_EXCL | O_NDELAY, 0666, 0)) == NULL)
{
wire_fd = -1;
@@ -416,6 +428,8 @@ int baud;
fprintf(stderr, "%s: can\'t set baud rate, using 9600\n", progname);
ttybuf.c_cflag |= B9600;
}
+#elif defined(CSRG_BASED)
+ cfsetspeed(&ttybuf, baud);
#else
ttybuf.c_cflag &= ~CBAUD;
@@ -497,6 +511,8 @@ int baud;
}
#if defined(__APPLE__)
+#elif defined(CSRG_BASED)
+ cfsetspeed(&ttybuf, baud);
#else
ttybuf.c_cflag &= ~CBAUD;