aboutsummaryrefslogtreecommitdiff
path: root/lib/libcurses/insch.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libcurses/insch.c')
-rw-r--r--lib/libcurses/insch.c56
1 files changed, 30 insertions, 26 deletions
diff --git a/lib/libcurses/insch.c b/lib/libcurses/insch.c
index 5ec1c9a7d861..e9b389ba1ea7 100644
--- a/lib/libcurses/insch.c
+++ b/lib/libcurses/insch.c
@@ -1,6 +1,6 @@
/*
- * Copyright (c) 1981 Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1981, 1993
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,37 +32,41 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)insch.c 5.4 (Berkeley) 6/1/90";
-#endif /* not lint */
+static char sccsid[] = "@(#)insch.c 8.1 (Berkeley) 6/4/93";
+#endif /* not lint */
-# include "curses.ext"
+#include <curses.h>
+#include <string.h>
/*
- * This routine performs an insert-char on the line, leaving
- * (_cury,_curx) unchanged.
- *
+ * winsch --
+ * Do an insert-char on the line, leaving (cury, curx) unchanged.
*/
-winsch(win, c)
-reg WINDOW *win;
-char c; {
+int
+winsch(register WINDOW *win, char ch)
+{
- reg chtype *temp1, *temp2;
- reg chtype *end;
+ register __LDATA *end, *temp1, *temp2;
- end = &win->_y[win->_cury][win->_curx];
- temp1 = &win->_y[win->_cury][win->_maxx - 1];
+ end = &win->lines[win->cury]->line[win->curx];
+ temp1 = &win->lines[win->cury]->line[win->maxx - 1];
temp2 = temp1 - 1;
- while (temp1 > end)
- *temp1-- = *temp2--;
- *temp1 = (unsigned char) c;
- touchline(win, win->_cury, win->_curx, win->_maxx - 1);
- if (win->_cury == LINES - 1 && win->_y[LINES-1][COLS-1] != ' ')
- if (win->_scroll) {
+ while (temp1 > end) {
+ (void)memcpy(temp1, temp2, sizeof(__LDATA));
+ temp1--, temp2--;
+ }
+ temp1->ch = ch;
+ temp1->attr &= ~__STANDOUT;
+ __touchline(win, win->cury, win->curx, win->maxx - 1, 0);
+ if (win->cury == LINES - 1 &&
+ (win->lines[LINES - 1]->line[COLS - 1].ch != ' ' ||
+ win->lines[LINES -1]->line[COLS - 1].attr != 0))
+ if (win->flags & __SCROLLOK) {
wrefresh(win);
scroll(win);
- win->_cury--;
- }
- else
- return ERR;
- return OK;
+ win->cury--;
+
+ } else
+ return (ERR);
+ return (OK);
}