summaryrefslogtreecommitdiff
path: root/emulators/x48/files/patch-src+serial.c
diff options
context:
space:
mode:
Diffstat (limited to 'emulators/x48/files/patch-src+serial.c')
-rw-r--r--emulators/x48/files/patch-src+serial.c49
1 files changed, 39 insertions, 10 deletions
diff --git a/emulators/x48/files/patch-src+serial.c b/emulators/x48/files/patch-src+serial.c
index bcc52d4d5c65..9a4ebf77dee9 100644
--- a/emulators/x48/files/patch-src+serial.c
+++ b/emulators/x48/files/patch-src+serial.c
@@ -18,7 +18,36 @@
#include <sys/termios.h>
#endif
-@@ -238,7 +240,7 @@
+@@ -135,8 +137,23 @@
+
+ wire_fd = -1;
+ ttyp = -1;
++#ifdef FREEBSD
++ int tty_m, tty_s;
++#endif
+ if (useTerminal)
+ {
++#ifdef FREEBSD
++ 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");
++#else /* FREEBSD */
+ #ifdef IRIX
+ if ((p = _getpty(&wire_fd, O_RDWR | O_EXCL | O_NDELAY, 0666, 0)) == NULL)
+ {
+@@ -234,11 +251,12 @@
+ #endif /* LINUX */
+ #endif /* SOLARIS */
+ #endif /* IRIX */
++#endif /* FREEBSD */
+ }
if (ttyp >= 0)
{
@@ -27,7 +56,7 @@
if (tcgetattr(ttyp, &ttybuf) < 0)
#else
if (ioctl(ttyp, TCGETS, (char *)&ttybuf) < 0)
-@@ -263,7 +265,7 @@
+@@ -263,7 +281,7 @@
if (ttyp >= 0)
{
@@ -36,7 +65,7 @@
if (tcsetattr(ttyp, TCSANOW, &ttybuf) < 0)
#else
if (ioctl(ttyp, TCSETS, (char *)&ttybuf) < 0)
-@@ -291,7 +293,7 @@
+@@ -291,7 +309,7 @@
if (ir_fd >= 0)
{
@@ -45,7 +74,7 @@
if (tcgetattr(ir_fd, &ttybuf) < 0)
#else
if (ioctl(ir_fd, TCGETS, (char *)&ttybuf) < 0)
-@@ -315,7 +317,7 @@
+@@ -315,7 +333,7 @@
if (ir_fd >= 0)
{
@@ -54,7 +83,7 @@
if (tcsetattr(ir_fd, TCSANOW, &ttybuf) < 0)
#else
if (ioctl(ir_fd, TCSETS, (char *)&ttybuf) < 0)
-@@ -344,7 +346,7 @@
+@@ -344,7 +362,7 @@
if (ir_fd >= 0)
{
@@ -63,7 +92,7 @@
if (tcgetattr(ir_fd, &ttybuf) < 0)
#else
if (ioctl(ir_fd, TCGETS, (char *)&ttybuf) < 0)
-@@ -358,6 +360,10 @@
+@@ -358,6 +376,10 @@
}
}
@@ -74,7 +103,7 @@
ttybuf.c_cflag &= ~CBAUD;
baud &= 0x7;
-@@ -404,9 +410,11 @@
+@@ -404,9 +426,11 @@
ttybuf.c_cflag |= B9600;
}
@@ -87,7 +116,7 @@
if (tcsetattr(ir_fd, TCSANOW, &ttybuf) < 0)
#else
if (ioctl(ir_fd, TCSETS, (char *)&ttybuf) < 0)
-@@ -422,7 +430,7 @@
+@@ -422,7 +446,7 @@
if (ttyp >= 0)
{
@@ -96,7 +125,7 @@
if (tcgetattr(ttyp, &ttybuf) < 0)
#else
if (ioctl(ttyp, TCGETS, (char *)&ttybuf) < 0)
-@@ -437,6 +445,9 @@
+@@ -437,6 +461,9 @@
}
}
@@ -106,7 +135,7 @@
ttybuf.c_cflag &= ~CBAUD;
baud &= 0x7;
-@@ -482,10 +493,11 @@
+@@ -482,10 +509,11 @@
fprintf(stderr, "%s: can\'t set baud rate, using 9600\n", progname);
ttybuf.c_cflag |= B9600;
}