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....
geoff@ncr-sd.UUCP (Geoff Walton ) (03/13/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 > Looks like Bruce is worried his "battleship" game won't run under BSD. Not to worry, Bruce! There have been numerous recent postings in net.sources listing the BSD equivalents for all these functions, except beep(). What about me? My "battleship" runs fine, but I've got BOTH BSD and SYSV curses available. :r all usual disclaimers Geoff Walton NCR E&M San Diego {wherever}!ucbvax!sdcsvax!ncr-sd!geoff Even the smallest problem becomes unsolvable if enough meetings are held to discuss it.
derrell@lipman.UUCP (derrell) (03/15/86)
Bruce Holloway writes: > 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. > > -- The following functions in BSD curses are equivilent to the above: beep() { putchar(7); } crmode() is the equivalent to cbreak() savetty() is the equivalent to saveterm() resetty() is the equivalent to resetterm() nocrmode() is the equivalent to nocbreak() I hope this helps. -- ===================================================================== "The pioneers of a warless world are those young men, and women, who refuse military service." -- Albert Einstein Derrell Lipman Lipman Enterprises -- Windowing for Unix on standard ASCII terminals {ucbvax,ihnp4}!trwrb!ttidca!lipman!derrell