From dcb3b3ca6b54ff7fdd44b141b1060a4ebbf29f18 Mon Sep 17 00:00:00 2001 From: "Brian S. Dean" Date: Wed, 15 Mar 2000 15:01:04 +0000 Subject: [PATCH] Resurrect the 'cdelay' and 'ldelay' features of /usr/bin/tip. --- usr.bin/tip/tip/cmds.c | 20 ++++++++++++++++---- usr.bin/tip/tip/tip.1 | 10 ++++++++++ 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/usr.bin/tip/tip/cmds.c b/usr.bin/tip/tip/cmds.c index 5e827e6d8511..ec57346b5906 100644 --- a/usr.bin/tip/tip/cmds.c +++ b/usr.bin/tip/tip/cmds.c @@ -48,6 +48,7 @@ static const char rcsid[] = #include #include #include +#include /* * tip @@ -560,6 +561,21 @@ cu_put(cc) transmit(fd, "\04", line); } + +static int +nap(msec) + int msec; /* milliseconds */ +{ + if (usleep(msec*1000) != 0) { + fprintf ( stderr, "warning: ldelay or cdelay interrupted, " + "delay time cut short: %s\n", + strerror(errno) ); + } + + return 0; +} + + /* * FTP - send single character * wait for echo & handle timeout @@ -573,15 +589,11 @@ send(c) cc = c; xpwrite(FD, &cc, 1); -#ifdef notdef if (number(value(CDELAY)) > 0 && c != '\r') nap(number(value(CDELAY))); -#endif if (!boolean(value(ECHOCHECK))) { -#ifdef notdef if (number(value(LDELAY)) > 0 && c == '\r') nap(number(value(LDELAY))); -#endif return; } tryagain: diff --git a/usr.bin/tip/tip/tip.1 b/usr.bin/tip/tip/tip.1 index a9c083d6a0da..8699cc076541 100644 --- a/usr.bin/tip/tip/tip.1 +++ b/usr.bin/tip/tip/tip.1 @@ -269,6 +269,11 @@ abbreviated (num) The baud rate at which the connection was established; abbreviated .Ar ba . +.It Ar chardelay +(num) Number of milliseconds to delay after the transmission of +each character; +abbreviated +.Ar cdelay . .It Ar dialtimeout (num) When dialing a phone number, the time (in seconds) to wait for a connection to be established; abbreviated @@ -310,6 +315,11 @@ writes when receiving files; abbreviated .It Ar host (str) The name of the host to which you are connected; abbreviated .Ar ho . +.It Ar linedelay +(num) Number of milliseconds to delay after the transmission of +each line; +abbreviated +.Ar ldelay . .It Ar login (str) Pathname of a login shell script to run once connected; standard input and output are redirected to the remote host.