diff options
Diffstat (limited to 'scripts/kconfig/libcurses/beep.c')
| -rw-r--r-- | scripts/kconfig/libcurses/beep.c | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/scripts/kconfig/libcurses/beep.c b/scripts/kconfig/libcurses/beep.c new file mode 100644 index 000000000..b679eed3c --- /dev/null +++ b/scripts/kconfig/libcurses/beep.c | |||
| @@ -0,0 +1,76 @@ | |||
| 1 | /* PDCurses */ | ||
| 2 | |||
| 3 | #include "curspriv.h" | ||
| 4 | |||
| 5 | /*man-start************************************************************** | ||
| 6 | |||
| 7 | beep | ||
| 8 | ---- | ||
| 9 | |||
| 10 | ### Synopsis | ||
| 11 | |||
| 12 | int beep(void); | ||
| 13 | int flash(void); | ||
| 14 | |||
| 15 | ### Description | ||
| 16 | |||
| 17 | beep() sounds the audible bell on the terminal, if possible; if not, | ||
| 18 | it calls flash(). | ||
| 19 | |||
| 20 | flash() "flashes" the screen, by inverting the foreground and | ||
| 21 | background of every cell, pausing, and then restoring the original | ||
| 22 | attributes. | ||
| 23 | |||
| 24 | ### Return Value | ||
| 25 | |||
| 26 | These functions return ERR if called before initscr(), otherwise OK. | ||
| 27 | |||
| 28 | ### Portability | ||
| 29 | |||
| 30 | Function | X/Open | ncurses | NetBSD | ||
| 31 | :---------------------|:------:|:-------:|:------: | ||
| 32 | beep | Y | Y | Y | ||
| 33 | flash | Y | Y | Y | ||
| 34 | |||
| 35 | **man-end****************************************************************/ | ||
| 36 | |||
| 37 | int beep(void) | ||
| 38 | { | ||
| 39 | PDC_LOG(("beep() - called\n")); | ||
| 40 | |||
| 41 | if (!SP) | ||
| 42 | return ERR; | ||
| 43 | |||
| 44 | if (SP->audible) | ||
| 45 | PDC_beep(); | ||
| 46 | else | ||
| 47 | flash(); | ||
| 48 | |||
| 49 | return OK; | ||
| 50 | } | ||
| 51 | |||
| 52 | int flash(void) | ||
| 53 | { | ||
| 54 | int z, y, x; | ||
| 55 | |||
| 56 | PDC_LOG(("flash() - called\n")); | ||
| 57 | |||
| 58 | if (!curscr) | ||
| 59 | return ERR; | ||
| 60 | |||
| 61 | /* Reverse each cell; wait; restore the screen */ | ||
| 62 | |||
| 63 | for (z = 0; z < 2; z++) | ||
| 64 | { | ||
| 65 | for (y = 0; y < LINES; y++) | ||
| 66 | for (x = 0; x < COLS; x++) | ||
| 67 | curscr->_y[y][x] ^= A_REVERSE; | ||
| 68 | |||
| 69 | wrefresh(curscr); | ||
| 70 | |||
| 71 | if (!z) | ||
| 72 | napms(50); | ||
| 73 | } | ||
| 74 | |||
| 75 | return OK; | ||
| 76 | } | ||
