Bug 193525 - Let tip work in hayes mode again
Summary: Let tip work in hayes mode again
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 8.4-STABLE
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2014-09-10 15:50 UTC by longwitz
Modified: 2018-05-31 20:26 UTC (History)
1 user (show)

See Also:


Attachments
Improved patch for tip against FreeBSD 10 or newer. (1.31 KB, patch)
2018-05-31 20:16 UTC, longwitz
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description longwitz 2014-09-10 15:50:27 UTC
After updating some old Freebsd V6 systems to V8 Stable the programm tip does not work in hayes mode anymore. Same behaviour with tip from HEAD.
The reason are the lines 

       /* XXX preserve previous braindamaged behavior */
        setboolean(value(DC), TRUE);

in tip.c, these lines should be deleted, because a line like
 testcall:dv=/dev/cuau1:br#38400:pa=none:at=hayes:pn=1234567:du:
in /etc/remote can't be used with "tip testcall".

Further I propose the following patch for hayes.c. The patch allows tip to diconnect a modem connection clean and let compile hayes.c with DEBUG enabled.
Be aware that tip does not check returncodes on his read and write systemcalls.

--- hayes.c.1st 2013-01-14 15:23:47.000000000 +0100
+++ hayes.c     2014-09-07 23:32:47.000000000 +0200
@@ -146,10 +146,15 @@
 void
 hay_disconnect(void)
 {
+       struct termios cntrl;
+
        /* first hang up the modem*/
 #ifdef DEBUG
        printf("\rdisconnecting modem....\n\r");
 #endif
+       tcgetattr(FD, &cntrl);
+       cntrl.c_cflag |= CLOCAL;
+       tcsetattr(FD, TCSAFLUSH, &cntrl);
        ioctl(FD, TIOCCDTR, 0);
        sleep(1);
        ioctl(FD, TIOCSDTR, 0);
@@ -195,7 +200,7 @@
                alarm(0);
                c &= 0177;
 #ifdef DEBUG
-               printf("%c 0x%x ", c, c);
+               printf("%c 0x%x\n", c, c);
 #endif
                for (i = 0; i < strlen(match); i++)
                        if (c == match[i])
@@ -252,7 +257,11 @@
 goodbye(void)
 {
        int len;
+#ifdef DEBUG
+       int rlen;
+#else
        char c;
+#endif

        tcflush(FD, TCIOFLUSH);
        if (hay_sync()) {
Comment 1 longwitz 2018-05-31 20:16:14 UTC
Created attachment 193878 [details]
Improved patch for tip against FreeBSD 10 or newer.