Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Jan 2000 10:17:34 -0500 (EST)
From:      Brian Dean <brdean@unx.sas.com>
To:        freebsd-current@freebsd.org
Subject:   Re: tip features (cdelay and ldelay)?
Message-ID:  <200001041517.KAA55947@dean.pc.sas.com>
In-Reply-To: <200001022240.RAA01469@vger.foo.com> from Brian Dean at "Jan 2, 2000 05:40:36 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
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 <err.h>
 #include <libutil.h>
 #include <stdio.h>
+#include <unistd.h>
 
 /*
  * 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200001041517.KAA55947>