[comp.unix.questions] stty 0

raanan@bc-cis.UUCP (03/20/87)

	The manual I have for the `stty` command states that the `stty 0`
command is used to hangup the telephone line. I understand that this command
should be placed in the "/.logout" file so that it will be activated whenever
a user logouts.

	My question: What does the `stty 0` command do? Does it do anything?

	Thanks,
-- 
------------------------------------------------------------------------
Raanan Herrmann  (bc-cis!raanan, raanan@bc-cis)

chris@mimsy.UUCP (Chris Torek) (03/22/87)

In article <869@bc-cis.UUCP> raanan@bc-cis.UUCP (Raanan Herrmann) writes:
>My question: What does the `stty 0` command do? Does it do anything?

Most device drivers interpret it as `turn off DTR'.  If your modems
are working and properly connected, and your multiplexor supports DTR,
this will hang up the line.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7690)
UUCP:	seismo!mimsy!chris	ARPA/CSNet:	chris@mimsy.umd.edu

dce@mips.UUCP (03/23/87)

In article <5914@mimsy.UUCP> chris@mimsy.UUCP (Chris Torek) writes:
>In article <869@bc-cis.UUCP> raanan@bc-cis.UUCP (Raanan Herrmann) writes:
>>My question: What does the `stty 0` command do? Does it do anything?
>Most device drivers interpret it as `turn off DTR'.  If your modems
>are working and properly connected, and your multiplexor supports DTR,
>this will hang up the line.

The original question is unclear. In 4.3BSD, the command "stty 0" causes
the baud rate to be set to 0. I assume that Chris is correct in saying
what the device driver does with this (if I don't, Chris will shoot me).

So, if Raanan needs to add a "hang up the line" function to a shell,
front-end, or other application, he can add code to set the baud rate
to 0 (this is for BSD systems; I'm not sure about System V derivatives).
-- 
			David Elliott

UUCP: 	{decvax,ucbvax,ihnp4}!decwrl!mips!dce, DDD:  	408-720-1700

craig@ccsi.UUCP (03/26/87)

In article <222@quacky.mips.UUCP> dce@mips.UUCP (David Elliott) writes:
>In article <5914@mimsy.UUCP> chris@mimsy.UUCP (Chris Torek) writes:
>>In article <869@bc-cis.UUCP> raanan@bc-cis.UUCP (Raanan Herrmann) writes:
>>>My question: What does the `stty 0` command do? Does it do anything?
>>Most device drivers interpret it as `turn off DTR'.  If your modems
>>are working and properly connected, and your multiplexor supports DTR,
>>this will hang up the line.
>
>The original question is unclear. In 4.3BSD, the command "stty 0" causes
>the baud rate to be set to 0. I assume that Chris is correct in saying
>what the device driver does with this (if I don't, Chris will shoot me).
>
>So, if Raanan needs to add a "hang up the line" function to a shell,
>front-end, or other application, he can add code to set the baud rate
>to 0 (this is for BSD systems; I'm not sure about System V derivatives).

It is the same for System V.  I've used many versions, and the've all
interpreted 0 baud as turning off DTR to the attached device.  All that
is with the exception of one machine, however after several
conversations with the mfr. its working there too!

-- 
----
	"Next time someone asks you if you're a god, say YES!"
				- Ghost Busters

R. Craig Peterson
KB6NFG

U.S. SNAIL:
	CCSI, 187 E. Wilbur Rd. #1, Thousand Oaks, CA  91360

{sdcsvax|hplabs}!sdcrdcf!psivax!nrcvax!ccsi!craig
ihnp4!nrcvax!ccsi!craig

ldm@homxc.UUCP (the wharf rat) (12/09/87)

	I work on a switching system that doesn't drop the line when I log 
off.  (HUPCL doesn't seem to do a thing...).  So I wrote a short one to
stty 0 :


	struct termio options ; 
	fprintf(stderr,"Bye-Bye !\n");
	ioctl(0,TCGETA,&options);
	options.c_cflag &= ~CBAUD;
	options.c_cflag |= B0&CBAUD;
	ioctl(0,TCSETAW,&options);	

and trap 0 "bye" in .profile.  Right ? Wrong.  I still (sometimes!) get
another login: .  Of course, stty 0 from the shell works every time...

What's going on ?
                                                         lou marco

andyb@dartvax.UUCP (Andy Behrens) (12/19/87)

In article <2412@homxc.UUCP> ldm@homxc.UUCP (the wharf rat) writes:
> I work on a switching system that doesn't drop the line when I log 
> off.  So I wrote a short one to stty 0:
>	[program omitted]
> and trap 0 "bye" in .profile.  Right?  Wrong.  I still (sometimes!)
> get another login: .  Of course, stty 0 from the shell works every time...
>
> What's going on ?

Your program is correctly dropping the line.  Unfortunately, as soon as it
and your shell terminate, the system starts up another copy of getty.  What's
the first thing that getty does?  It resets the line to its normal state.
That usually happens fast enough that the switching system doesn't see that
the line has dropped.

Your program could call sleep() before it exits.  You don't need to write any
C, though -- just trap 'stty 0;sleep 3' 0.   

					Andy Behrens

{astrovax,ihnp4,linus,harvard,decvax}!dartvax!burlcoat!andyb
andyb%burlcoat@dartmouth.EDU
RFD 1 Box 116, Union Village, Vt. 05043