new copyright notice
[unix-history] / usr / src / lib / libcurses / getch.c
index cff857f..304b60f 100644 (file)
@@ -1,9 +1,19 @@
+/*
+ * Copyright (c) 1981 Regents of the University of California.
+ * All rights reserved.
+ *
+ * %sccs.include.redist.c%
+ */
+
+#ifndef lint
+static char sccsid[] = "@(#)getch.c    5.6 (Berkeley) %G%";
+#endif /* not lint */
+
 # include      "curses.ext"
 
 /*
  *     This routine reads in a character from the window.
  *
 # include      "curses.ext"
 
 /*
  *     This routine reads in a character from the window.
  *
- * @(#)getch.c 1.3 (Berkeley) %G%
  */
 wgetch(win)
 reg WINDOW     *win; {
  */
 wgetch(win)
 reg WINDOW     *win; {
@@ -18,7 +28,7 @@ reg WINDOW    *win; {
        fprintf(outf, "WGETCH: _echoit = %c, _rawmode = %c\n", _echoit ? 'T' : 'F', _rawmode ? 'T' : 'F');
 # endif
        if (_echoit && !_rawmode) {
        fprintf(outf, "WGETCH: _echoit = %c, _rawmode = %c\n", _echoit ? 'T' : 'F', _rawmode ? 'T' : 'F');
 # endif
        if (_echoit && !_rawmode) {
-               raw();
+               cbreak();
                weset++;
        }
        inp = getchar();
                weset++;
        }
        inp = getchar();
@@ -26,10 +36,11 @@ reg WINDOW  *win; {
        fprintf(outf,"WGETCH got '%s'\n",unctrl(inp));
 # endif
        if (_echoit) {
        fprintf(outf,"WGETCH got '%s'\n",unctrl(inp));
 # endif
        if (_echoit) {
-               mvwaddch(curscr, win->_cury, win->_curx, inp);
+               mvwaddch(curscr, win->_cury + win->_begy,
+                       win->_curx + win->_begx, inp);
                waddch(win, inp);
        }
        if (weset)
                waddch(win, inp);
        }
        if (weset)
-               noraw();
+               nocbreak();
        return inp;
 }
        return inp;
 }