david/ipxe
Archived
1
0
This repository has been archived on 2020-12-06. You can view files and clone it, but cannot push or open issues or pull requests.
ipxe/src/hci/mucurses/clear.c
Dan Lynch ad1aca0634 - separated curses.c out into separate source files to optimise
library use later on
- some small mods to existing functions
2006-06-08 17:23:37 +00:00

52 lines
925 B
C

#include <curses.h>
#include "core.h"
#include "cursor.h"
/**
* Clear a window to the bottom from current cursor position
*
* @v *win subject window
* @ret rc return status code
*/
int wclrtobot ( WINDOW *win ) {
struct cursor_pos pos;
_store_curs_pos( win, &pos );
do {
_wputch( win, (unsigned)' ', WRAP );
} while ( win->curs_y + win->curs_x );
_restore_curs_pos( win, &pos );
return OK;
}
/**
* Clear a window to the end of the current line
*
* @v *win subject window
* @ret rc return status code
*/
int wclrtoeol ( WINDOW *win ) {
struct cursor_pos pos;
_store_curs_pos( win, &pos );
while ( ( win->curs_y - pos.y ) == 0 ) {
_wputch( win, (unsigned)' ', WRAP );
}
_restore_curs_pos( win, &pos );
return OK;
}
/**
* Completely clear a window
*
* @v *win subject window
* @ret rc return status code
*/
int werase ( WINDOW *win ) {
wmove( win, 0, 0 );
wclrtobot( win );
return OK;
}