curses and carriage returns
Dave Ciemiewicz
ciemo at bananapc.wpd.sgi.com
Wed Dec 20 12:20:22 AEST 1989
In article <JEREMY.89Dec18145619 at jeremy.prime.com>,
jeremy at 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
More information about the Comp.sys.sgi
mailing list