Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

$BAUD is strange on Linux for 115200



If I am using an 'extended' speed (i.e. >38400), BAUD used to be
something like 4098, because the original logic in this code thought
that if the speed code returned by cfget?speed() is larger than
100, then it's the real baud rate, not a symbolic value.  This
is not so on Linux.  [Taking the opportunity, I added some recently
added baud rates to the list]. Anyone can see any problems with the code
below?

Janos

diff -urN zsh-2.6-beta21.orig/Src/utils.c zsh-2.6-beta21/Src/utils.c
--- zsh-2.6-beta21.orig/Src/utils.c	Wed Jun 19 22:01:40 1996
+++ zsh-2.6-beta21/Src/utils.c	Sun Jun 23 22:55:21 1996
@@ -2715,9 +2715,16 @@
 
 # if defined(HAVE_TCGETATTR) && defined(HAVE_TERMIOS_H)
     tempbaud = cfgetospeed(&shttyinfo->tio);
+#if defined CBAUDEX && CBAUDEX > 100
+    /* If we have CBAUDEX, then it's a mask of the extended
+       speeds, and the baud rates are still encoded.  At least
+       this is so on Linux, and I hope this logic is true on
+       most systems.  */
+#else
     if (tempbaud >= 100)
         return tempbaud;
     else
+#endif
         speedcode = (int) tempbaud;
 # else
     speedcode = shttyinfo->tio.c_cflag & CBAUD;
@@ -2784,6 +2791,22 @@
     case EXTB:
 	return (38400L);
 # endif
+#endif
+#ifdef B57600
+    case B57600:
+	return (57600L);
+#endif
+#ifdef B115200
+    case B115200:
+	return (115200L);
+#endif
+#ifdef B230400
+    case B230400:
+	return (230400L);
+#endif
+#ifdef B460800
+    case B460800:
+	return (460800L);
 #endif
     default:
 	break;





Messages sorted by: Reverse Date, Date, Thread, Author