[net.sources.d] BSD equivalents to System V curses functionality

holloway@drivax.UUCP (Bruce Holloway) (03/11/86)

Our System V curses library has the following functions, but BSD curses
doesn't. We're just about to go from System V to BSD, and I'd like to
port some programs over that use these functions. Could anyone tell
me the equivalent BSD curses functions, or post the source to some
equivalents?

	Routine			Function
	===================	=========================================
	beep()			Beeps the terminal
	cbreak()		Put the terminal into cbreak mode
	saveterm()		Save the current terminal characteristics
	resetterm()		Restore previously saved TTY chars
	nocbreak()		Remove cbreak mode

Also, how do you tell when a character is ready on stdin in cbreak mode?
The only method that comes to mind is to test "feof(stdin)" frequently,
but that comes back "TRUE" in every case.

-- 

+----------------------------------------------------------------------------+
|Whatever I write are not the opinions or policies of Digital Research, Inc.,|
|and probably won't be in the foreseeable future.                            |
+----------------------------------------------------------------------------+

Bruce Holloway

....!ucbvax!hplabs!amdahl!drivax!holloway
(I'm not THAT Bruce Holloway, I'm the other one.)

stevo@ucrmath.UUCP (Steve Groom) (03/13/86)

> Our System V curses library has the following functions, but BSD curses
> doesn't. ...

I posted the same things recently in reference to the Battleship program in 
net.sources that used those System V calls. The (4.2)bsd equivalents are:
Sys. V:		bsd:
cbreak()	crmode()
saveterm()	savetty()
resetterm()	resetty()
nocbreak()	nocrmode()

As far as I know, beep() has no equivalent in bsd, but you can get away with
writing a ^G to the screen like this (instead of using bell() ):

wprintw(stdscr,"%c",7);

because ^G is ASCII char 7....

As for the eof problem, I really don't know, but I hope this helps....