xref: /netbsd-src/lib/libcurses/bell.c (revision e4d7c2e329d54c97e0c0bd3016bbe74f550c3d5e)
1 /*	$NetBSD: bell.c,v 1.1 1999/04/13 14:08:17 mrg Exp $	*/
2 
3 /*
4  * Copyright (c) 1999 Julian. D. Coleman
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. The name of the author may not be used to endorse or promote products
13  *    derived from this software without specific prior written permission.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
20  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
22  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
23  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25  * SUCH DAMAGE.
26  */
27 
28 #include "curses.h"
29 
30 /*
31  * beep
32  *	Ring the terminal bell
33  */
34 int
35 beep(void)
36 {
37 	if (BL != NULL) {
38 #ifdef DEBUG
39 		__CTRACE("beep: bl\n");
40 #endif
41 		tputs(BL, 0, __cputchar);
42 	} else if (VB != NULL) {
43 #ifdef DEBUG
44 		__CTRACE("beep: vb\n");
45 #endif
46 		tputs(VB, 0, __cputchar);
47 	}
48 	return (1);
49 }
50 
51 /*
52  * flash
53  *	Flash the terminal screen
54  */
55 int
56 flash(void)
57 {
58 	if (VB != NULL) {
59 #ifdef DEBUG
60 		__CTRACE("flash: vb\n");
61 #endif
62 		tputs(VB, 0, __cputchar);
63 	} else if (BL != NULL) {
64 #ifdef DEBUG
65 		__CTRACE("flash: bl\n");
66 #endif
67 		tputs(BL, 0, __cputchar);
68 	}
69 	return (1);
70 }
71