summaryrefslogtreecommitdiff
path: root/src/termcap.c
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1995-02-14 07:43:44 +0000
committerRichard M. Stallman <rms@gnu.org>1995-02-14 07:43:44 +0000
commit0c0b6c79117558ce932f2c262aab686f50c306eb (patch)
tree7bda1cf43e55b96a9879ab89273cb585dfa2434b /src/termcap.c
parentb87c5d3d05ff4f1d1f5a94b5784d442a6dc9fdee (diff)
downloademacs-0c0b6c79117558ce932f2c262aab686f50c306eb.tar.gz
(speeds): Make it ints. Add some higher speeds.
(tputs) [emacs]: If speed is high, convert to smaller units. (tputs): Really use SPEED to calculate PADCOUNT.
Diffstat (limited to 'src/termcap.c')
-rw-r--r--src/termcap.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/termcap.c b/src/termcap.c
index bcd1ece8cfd..0d77ae45604 100644
--- a/src/termcap.c
+++ b/src/termcap.c
@@ -267,14 +267,14 @@ char PC;
/* Actual baud rate if positive;
- baud rate / 100 if negative. */
-static short speeds[] =
+static int speeds[] =
{
#ifdef VMS
0, 50, 75, 110, 134, 150, -3, -6, -12, -18,
-20, -24, -36, -48, -72, -96, -192
#else /* not VMS */
0, 50, 75, 110, 135, 150, -2, -3, -6, -12,
- -18, -24, -48, -96, -192, -384
+ -18, -24, -48, -96, -192, -288, -384, -576, -1152
#endif /* not VMS */
};
@@ -290,6 +290,10 @@ tputs (str, nlines, outfun)
#ifdef emacs
extern baud_rate;
speed = baud_rate;
+ /* For quite high speeds, convert to the smaller
+ units to avoid overflow. */
+ if (speed > 10000)
+ speed = - speed / 100;
#else
if (ospeed == 0)
speed = tputs_baud_rate;
@@ -318,11 +322,14 @@ tputs (str, nlines, outfun)
while (*str)
(*outfun) (*str++);
- /* padcount is now in units of tenths of msec. */
- padcount *= speeds[ospeed];
+ /* PADCOUNT is now in units of tenths of msec.
+ SPEED is mesured in characters per 10 seconds
+ or in characters per .1 seconds (if negative).
+ We use the smaller units for larger speeds to avoid overflow. */
+ padcount *= speed;
padcount += 500;
padcount /= 1000;
- if (speeds[ospeed] < 0)
+ if (speed < 0)
padcount = -padcount;
else
{