[comp.unix.shell] stty cbreak

kjchang@hplabsz.HPL.HP.COM (K. J. Chang) (09/27/90)

I saw "A Book On C" which says I can use "stty cbreak" (pp.25) in
UNIX so that my C program will not wait for <CR> when it reads
"stdin".

I tried "stty cbreak" in sh, csh, and ksh in HP-UX (UNIX)
and the system did not understand the command. Then, I
tried the same command in Sun 4 (Sparc) and the command
seems to work in Sun's UNIX.

What's the equivalence of "stty cbreak" in HP-UX?

K J Chang
(415)857-4604

cpcahil@virtech.uucp (Conor P. Cahill) (09/27/90)

In article <5985@hplabsz.HPL.HP.COM> kjchang@hplabsz.UUCP (K. J. Chang) writes:
>I saw "A Book On C" which says I can use "stty cbreak" (pp.25) in
>UNIX so that my C program will not wait for <CR> when it reads
>"stdin".

First off:
	If you are working with a C program you should not use the
  	stty(1) command to set the terminal characteristics.  Instead use
	the ioctl(2) system call with the appropriate parameters that are
	defined on the termio(7) manual page.  

Second:
	When you do make changes to the terminal characteristics make sure
	you do the following:

		save the current settings 
		make your changes
	
		and later, just before you exit, reset the termina to the
		original settings
	

>I tried "stty cbreak" in sh, csh, and ksh in HP-UX (UNIX)
>and the system did not understand the command. Then, I

It won't matter what shell you use since the stty command is not a "built-in"
in any of the shells listed.  

The  answer to your question is to RTFM (especially the stty(1) and termio(7)
manual pages).  stty -icanon should do what you want.



-- 
Conor P. Cahill            (703)430-9247        Virtual Technologies, Inc.,
uunet!virtech!cpcahil                           46030 Manekin Plaza, Suite 160
                                                Sterling, VA 22170 

gt0178a@prism.gatech.EDU (BURNS,JIM) (09/27/90)

in article <5985@hplabsz.HPL.HP.COM>, kjchang@hplabsz.HPL.HP.COM (K. J. Chang) says:

> What's the equivalence of "stty cbreak" in HP-UX?

Roughly speaking, 'stty raw'.
-- 
BURNS,JIM
Georgia Institute of Technology, Box 30178, Atlanta Georgia, 30332
uucp:	  ...!{decvax,hplabs,ncar,purdue,rutgers}!gatech!prism!gt0178a
Internet: gt0178a@prism.gatech.edu

dnb@meshugge.media.mit.edu (David N. Blank) (09/27/90)

> What's the equivalence of "stty cbreak" in HP-UX?

Check out the "icanon" option to stty in the man page.
              Peace,
                 dNb

guy@auspex.auspex.com (Guy Harris) (09/29/90)

>> What's the equivalence of "stty cbreak" in HP-UX?
>
>Roughly speaking, 'stty raw'.

Unnecessary roughness - 10 yards penalty.

The *exact* equivalent is "stty -icanon".  "stty raw" turns off a whole
bunch of processing that "stty cbreak", on systems that support it,
doesn't.