soc/mediatek/common: Fix wrong write API for protect_key_setting
[coreboot2.git] / payloads / libpayload / curses / PDCurses / pdcurses / delch.c
blob9c2416eefb324ffa4134700e2451f1126d69c6ec
1 /* Public Domain Curses */
3 #include <curspriv.h>
5 RCSID("$Id: delch.c,v 1.33 2008/07/13 16:08:18 wmcbrine Exp $")
7 /*man-start**************************************************************
9 Name: delch
11 Synopsis:
12 int delch(void);
13 int wdelch(WINDOW *win);
14 int mvdelch(int y, int x);
15 int mvwdelch(WINDOW *win, int y, int x);
17 Description:
18 The character under the cursor in the window is deleted. All
19 characters to the right on the same line are moved to the left
20 one position and the last character on the line is filled with
21 a blank. The cursor position does not change (after moving to
22 y, x if coordinates are specified).
24 Return Value:
25 All functions return OK on success and ERR on error.
27 Portability X/Open BSD SYS V
28 delch Y Y Y
29 wdelch Y Y Y
30 mvdelch Y Y Y
31 mvwdelch Y Y Y
33 **man-end****************************************************************/
35 #include <string.h>
37 int wdelch(WINDOW *win)
39 int y, x, maxx;
40 chtype *temp1;
42 PDC_LOG(("wdelch() - called\n"));
44 if (!win)
45 return ERR;
47 y = win->_cury;
48 x = win->_curx;
49 maxx = win->_maxx - 1;
50 temp1 = &win->_y[y][x];
52 memmove(temp1, temp1 + 1, (maxx - x) * sizeof(chtype));
54 /* wrs (4/10/93) account for window background */
56 win->_y[y][maxx] = win->_bkgd;
58 win->_lastch[y] = maxx;
60 if ((win->_firstch[y] == _NO_CHANGE) || (win->_firstch[y] > x))
61 win->_firstch[y] = x;
63 PDC_sync(win);
65 return OK;
68 int delch(void)
70 PDC_LOG(("delch() - called\n"));
72 return wdelch(stdscr);
75 int mvdelch(int y, int x)
77 PDC_LOG(("mvdelch() - called\n"));
79 if (move(y, x) == ERR)
80 return ERR;
82 return wdelch(stdscr);
85 int mvwdelch(WINDOW *win, int y, int x)
87 PDC_LOG(("mvwdelch() - called\n"));
89 if (wmove(win, y, x) == ERR)
90 return ERR;
92 return wdelch(win);