summaryrefslogtreecommitdiff
path: root/games/worms/worms.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2004-01-08 20:38:30 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2004-01-08 20:38:30 +0000
commit6f4afcab3d3c515cae945f03946aff85f31cc975 (patch)
tree7912f7d370af88c988e8535f68d21b7bf316608a /games/worms/worms.c
parentbc0f2ffe0e2185999b81452ed75b4a9f7504994d (diff)
Adjust delay based on terminal speed; ok tedu@
Diffstat (limited to 'games/worms/worms.c')
-rw-r--r--games/worms/worms.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/games/worms/worms.c b/games/worms/worms.c
index eece179e73e..b8b51dd6f92 100644
--- a/games/worms/worms.c
+++ b/games/worms/worms.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: worms.c,v 1.15 2003/06/03 03:01:42 millert Exp $ */
+/* $OpenBSD: worms.c,v 1.16 2004/01/08 20:38:29 millert Exp $ */
/*
* Copyright (c) 1980, 1993
@@ -39,7 +39,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)worms.c 8.1 (Berkeley) 5/31/93";
#else
-static char rcsid[] = "$OpenBSD: worms.c,v 1.15 2003/06/03 03:01:42 millert Exp $";
+static char rcsid[] = "$OpenBSD: worms.c,v 1.16 2004/01/08 20:38:29 millert Exp $";
#endif
#endif /* not lint */
@@ -67,6 +67,7 @@ static char rcsid[] = "$OpenBSD: worms.c,v 1.15 2003/06/03 03:01:42 millert Exp
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
+#include <termios.h>
#include <unistd.h>
static const struct options {
@@ -193,8 +194,15 @@ main(argc, argv)
int CO, LI, last, bottom, ch, length, number, trail;
short **ref;
const char *field;
+ struct termios term;
+ speed_t speed;
u_int delay = 0;
+ /* set default delay based on terminal baud rate */
+ if (tcgetattr(STDOUT_FILENO, &term) == 0 &&
+ (speed = cfgetospeed(&term)) > B9600)
+ delay = (speed / B9600) - 1;
+
length = 16;
number = 3;
trail = ' ';