From owner-freebsd-current Tue Jan 4 7:18:10 2000 Delivered-To: freebsd-current@freebsd.org Received: from lamb.sas.com (lamb.sas.com [192.35.83.8]) by hub.freebsd.org (Postfix) with ESMTP id 3897E15223 for ; Tue, 4 Jan 2000 07:18:06 -0800 (PST) (envelope-from brdean@unx.sas.com) Received: from mozart (mozart.unx.sas.com [192.58.184.28]) by lamb.sas.com (8.9.3/8.9.1) with SMTP id KAA08795; Tue, 4 Jan 2000 10:18:04 -0500 (EST) Received: from dean.pc.sas.com by mozart (5.65c/SAS/Domains/5-6-90) id AA25078; Tue, 4 Jan 2000 10:17:34 -0500 Received: (from brdean@localhost) by dean.pc.sas.com (8.9.3/8.9.3) id KAA55947; Tue, 4 Jan 2000 10:17:34 -0500 (EST) (envelope-from brdean) From: Brian Dean Message-Id: <200001041517.KAA55947@dean.pc.sas.com> Subject: Re: tip features (cdelay and ldelay)? In-Reply-To: <200001022240.RAA01469@vger.foo.com> from Brian Dean at "Jan 2, 2000 05:40:36 pm" To: freebsd-current@freebsd.org Date: Tue, 4 Jan 2000 10:17:34 -0500 (EST) X-Mailer: ELM [version 2.4ME+ PL54 (25)] Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Hi, (replying to myself) Since no one seems to recall why these features were removed, and I don't see any reference to them in the CVS log, would someone please consider applying the included patch to re-enable them? This patch also includes a fix I made to correct PR bin/15847 that I opened. If you wish to submit these separately so that it makes backing out easier, just edit out the stuff related to eofchars in this included patch. I included a patch in the PR that fixes the core dump and can be applied on its own. Thanks, -Brian -- Brian Dean brdean@unx.sas.com Brian Dean wrote: > Subject: tip features (cdelay and ldelay)? > To: freebsd-current@FreeBSD.ORG > Date: Sun, 2 Jan 2000 17:40:36 -0500 (EST) > I have a couple of really dumb devices that I use 'tip' to talk to. > One is a Motorola 6811 microcontroller and the other is an old EEPROM > burner. I find that 'tip' overflows these devices when I'm sending > Motorola s-record and Intel Hex formatted files. > > It looks like tip's 'cdelay' and 'ldelay' features do just the trick. > However, they are disabled, surrounded by '#ifdef notdef' sequences. > Just to make sure, I re-enabled them locally, and re-implemented the > apparently lost 'nap()' function to make sure that these features work > for my application, and they do. > > My question is: does anyone remember why these were disabled in the > first place? Is there an equivalent replacement feature that I can > use instead to pace the outgoing characters so that I don't overrun > dumb devices with no flow control? Here's the patch: ---------------------------------------------------------------------- Index: cmds.c =================================================================== RCS file: /usr02/mirror/ncvs/src/usr.bin/tip/tip/cmds.c,v retrieving revision 1.10 diff -u -r1.10 cmds.c --- cmds.c 1999/08/28 01:06:32 1.10 +++ cmds.c 2000/01/04 15:04:31 @@ -48,6 +48,7 @@ #include #include #include +#include /* * tip @@ -513,7 +514,7 @@ out: if (lastc != '\n' && !boolean(value(RAWFTP))) send('\r'); - for (pc = eofchars; *pc; pc++) + for (pc = eofchars; pc && *pc; pc++) send(*pc); stop_t = time(0); fclose(fd); @@ -560,6 +561,24 @@ transmit(fd, "\04", line); } + +static int +nap ( int microsec ) +{ + int rc; + + rc = usleep ( microsec ); + if (rc != 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 +592,11 @@ 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: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message