Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Kitware
GitHub Repository: Kitware/CMake
Path: blob/master/Utilities/cmpdcurses/pdcurses/beep.c
3153 views
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
X/Open ncurses NetBSD
30
beep Y Y Y
31
flash Y Y Y
32
33
**man-end****************************************************************/
34
35
int beep(void)
36
{
37
PDC_LOG(("beep() - called\n"));
38
39
if (!SP)
40
return ERR;
41
42
if (SP->audible)
43
PDC_beep();
44
else
45
flash();
46
47
return OK;
48
}
49
50
int flash(void)
51
{
52
int z, y, x;
53
54
PDC_LOG(("flash() - called\n"));
55
56
if (!curscr)
57
return ERR;
58
59
/* Reverse each cell; wait; restore the screen */
60
61
for (z = 0; z < 2; z++)
62
{
63
for (y = 0; y < LINES; y++)
64
for (x = 0; x < COLS; x++)
65
curscr->_y[y][x] ^= A_REVERSE;
66
67
wrefresh(curscr);
68
69
if (!z)
70
napms(50);
71
}
72
73
return OK;
74
}
75
76