coreboot-kgpe-d16/payloads/libpayload/curses/PDCurses-3.4/pdcurses/beep.c
Patrick Georgi 3b77b723ca libpayload: Add PDCurses and ncurses' libform/libmenu
PDCurses provides an alternative implementation of the curses library
standard in addition to tinycurses.
Where tinycurses is really tiny, PDCurses is more complete and provides
virtually unlimited windows and the full API.
The PDCurses code is brought in "vanilla", with all local changes
residing in curses/pdcurses-backend/

In addition to a curses library, this change also provides libpanel (as
part of the PDCurses code), and libform and libmenu which were derived
from ncurses-5.9.
As they rely on ncurses internals (and PDCurses is not ncurses), more
changes were required for these libraries to work.

The build system is extended to install the right set of header files
depending on the selected curses implementation.

Change-Id: I9e5b920f94b6510da01da2f656196a993170d1c5
Signed-off-by: Patrick Georgi <patrick.georgi@secunet.com>
Reviewed-on: http://review.coreboot.org/106
Tested-by: build bot (Jenkins)
Reviewed-by: Marc Jones <marcj303@gmail.com>
2011-08-04 08:10:41 +02:00

66 lines
1.4 KiB
C

/* Public Domain Curses */
#include <curspriv.h>
RCSID("$Id: beep.c,v 1.34 2008/07/13 16:08:17 wmcbrine Exp $")
/*man-start**************************************************************
Name: beep
Synopsis:
int beep(void);
int flash(void);
Description:
beep() sounds the audible bell on the terminal, if possible;
if not, it calls flash().
flash() "flashes" the screen, by inverting the foreground and
background of every cell, pausing, and then restoring the
original attributes.
Return Value:
These functions return OK.
Portability X/Open BSD SYS V
beep Y Y Y
flash Y Y Y
**man-end****************************************************************/
int beep(void)
{
PDC_LOG(("beep() - called\n"));
if (SP->audible)
PDC_beep();
else
flash();
return OK;
}
int flash(void)
{
int z, y, x;
PDC_LOG(("flash() - called\n"));
/* Reverse each cell; wait; restore the screen */
for (z = 0; z < 2; z++)
{
for (y = 0; y < LINES; y++)
for (x = 0; x < COLS; x++)
curscr->_y[y][x] ^= A_REVERSE;
wrefresh(curscr);
if (!z)
napms(50);
}
return OK;
}