🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.bugs.sys5
Article #572

Re: CLOCAL, or catch-22

#572
From: Brandon Allbery
Date: Thu, 13 Aug 1987 01:01
38 lines
2126 bytes
As quoted from <325@nsta.UUCP> by amos@nsta.UUCP (Amos Shapir):
+---------------
| One of the optional flags of the c_cflag field of termio is CLOCAL. (see
| <termio.h>)  It is  supposed  to  cause the  tty  driver  to ignore  the
| 'carrier detect' bit  in the RS232 interface, and open  the line anyway.
| This is needed for  ports that do not have the DC  wired; trying to open
| such a port without setting the CLOCAL bit first, will cause the open to
| hang forever waiting for a carrier signal.
| 
| However, the  only way to set  this flag is  by a ioctl call;  the ioctl
| call needs  a file-descriptor  argument; a  file-descriptor can  only be
| obtained by a successfull open call...
+---------------

#include <termio.h>
#include <fcntl.h>
#include <sys/ioctl.h>

...

	struct termio t;
	int fd;
	
	if ((fd = open("/dev/tty22", O_RDWR|O_NDELAY)) == -1) {
		perror("/dev/tty22");
		exit(1);
	}
	ioctl(fd, TCGETA, &t);
	t.c_cflag |= CLOCAL;
	ioctl(fd, TCSETAW, &t);

-- 
 Brandon S. Allbery, moderator of comp.sources.misc and comp.binaries.ibm.pc
  {{harvard,mit-eddie}!necntc,well!hoptoad,sun!mandrill!hal}!ncoast!allbery
ARPA: necntc!ncoast!allbery@harvard.harvard.edu  Fido: 157/502  MCI: BALLBERY
   <<ncoast Public Access UNIX: +1 216 781 6201 24hrs. 300/1200/2400 baud>>
** Site "cwruecmp" is changing its name to "mandrill".  Please re-address **
*** all mail to ncoast to pass through "mandrill" instead of "cwruecmp". ***
Technical Details
Message-ID: <4127@ncoast.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!seismo!rutgers!sri-spam!mordor!lll-tis!ptsfa!ihnp4!cbosgd!cwruecmp!hal!ncoast!allbery
References: <325@nsta.UUCP>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!seismo!rutgers!sri-spam!mordor!lll-tis!ptsfa!ihnp4!cbosgd!cwruecmp!hal!ncoast!allbery
From: allbery@ncoast.UUCP (Brandon Allbery)
Newsgroups: comp.bugs.sys5
Subject: Re: CLOCAL, or catch-22
Message-ID: <4127@ncoast.UUCP>
Date: Wed, 12-Aug-87 21:01:25 EDT
Article-I.D.: ncoast.4127
Posted: Wed Aug 12 21:01:25 1987
Date-Received: Sat, 15-Aug-87 08:25:33 EDT
References: <325@nsta.UUCP>
Reply-To: allbery@ncoast.UUCP (Brandon Allbery)
Followup-To: comp.bugs.sys5
Distribution: world
Organization: Cleveland Public Access UN*X, Cleveland, Oh
Lines: 38