jeremy@jeremy.prime.com (Jeremy Nussbaum) (12/19/89)
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. -- Jeremy Nussbaum jeremy@jeremy.prime.com, ...!harvard!prmcad!jeremy Prime Computer 2 Crosby Drive MS 16-2 Bedford, Ma. 01730 (617)275-1800 x6745
ciemo@bananapc.wpd.sgi.com (Dave Ciemiewicz) (12/20/89)
In article <JEREMY.89Dec18145619@jeremy.prime.com>, 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