pdcurses/beep.c

branch
protocol5
changeset 106
7b156b764d11
parent 97
2d43f05b284c
equal deleted inserted replaced
104:a76af67a3a4b 106:7b156b764d11
1 /* Public Domain Curses */
2
3 #include <curspriv.h>
4
5 RCSID("$Id: beep.c,v 1.34 2008/07/13 16:08:17 wmcbrine Exp $")
6
7 /*man-start**************************************************************
8
9 Name: beep
10
11 Synopsis:
12 int beep(void);
13 int flash(void);
14
15 Description:
16 beep() sounds the audible bell on the terminal, if possible;
17 if not, it calls flash().
18
19 flash() "flashes" the screen, by inverting the foreground and
20 background of every cell, pausing, and then restoring the
21 original attributes.
22
23 Return Value:
24 These functions return OK.
25
26 Portability X/Open BSD SYS V
27 beep Y Y Y
28 flash Y Y Y
29
30 **man-end****************************************************************/
31
32 int beep(void)
33 {
34 PDC_LOG(("beep() - called\n"));
35
36 if (SP->audible)
37 PDC_beep();
38 else
39 flash();
40
41 return OK;
42 }
43
44 int flash(void)
45 {
46 int z, y, x;
47
48 PDC_LOG(("flash() - called\n"));
49
50 /* Reverse each cell; wait; restore the screen */
51
52 for (z = 0; z < 2; z++)
53 {
54 for (y = 0; y < LINES; y++)
55 for (x = 0; x < COLS; x++)
56 curscr->_y[y][x] ^= A_REVERSE;
57
58 wrefresh(curscr);
59
60 if (!z)
61 napms(50);
62 }
63
64 return OK;
65 }

mercurial