Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!wuarchive!rex!ames!lll-winken!arisia!sgi!shinobu!odin!bananapc.wpd.sgi.com!ciemo From: ciemo@bananapc.wpd.sgi.com (Dave Ciemiewicz) Newsgroups: comp.sys.sgi Subject: Re: curses and carriage returns Message-ID: <2140@odin.SGI.COM> Date: 20 Dec 89 01:20:22 GMT References: Sender: news@odin.SGI.COM Reply-To: ciemo@bananapc.wpd.sgi.com (Dave Ciemiewicz) Distribution: comp Organization: Silicon Graphics, Inc. Lines: 23 In article , jeremy@jeremy.prime.com (Jeremy Nussbaum) writes: > I just brought up a package called index on an sgi 4d running 3.2. The package > uses berkeley curses. By defining NOMACROS and a couple of other odds > and ends I have it up and running, with one problem. It ignores > carriage returns, and insists upon line feeds. The program is looking > for "\n". What do I need to tell curses to have the enter key mapped > to a \n? Characters are read in by getchar(), and the modes set > upon entry are noecho and cbreak. Adding nl doesn't seem to help. > > Any hints would be appreciated. I could change all instances of checking > for \n to check for ^m also, but there must be a better way. > The problem is that you are using stdio's getchar() instead of curses' getch(). The carriage return to newline mapping set up by nl() is not done by the tty driver, it is done by curses internals, specifically in wgetch(). Change your getchar() to getch() (which is a wrapper for wgetch(stdscr)) and I think your stuff will work for you. --- Ciemo