1*0bd3a620Srin /* $NetBSD: bell.c,v 1.10 2021/09/06 07:03:49 rin Exp $ */
2586d4ce1Smrg
3d6a738e1Sjdc /*-
4d6a738e1Sjdc * Copyright (c) 1999 The NetBSD Foundation, Inc.
5586d4ce1Smrg * All rights reserved.
6586d4ce1Smrg *
7d6a738e1Sjdc * This code is derived from software contributed to The NetBSD Foundation
8d6a738e1Sjdc * by Julian Coleman.
9d6a738e1Sjdc *
10586d4ce1Smrg * Redistribution and use in source and binary forms, with or without
11586d4ce1Smrg * modification, are permitted provided that the following conditions
12586d4ce1Smrg * are met:
13586d4ce1Smrg * 1. Redistributions of source code must retain the above copyright
14586d4ce1Smrg * notice, this list of conditions and the following disclaimer.
15d6a738e1Sjdc * 2. Redistributions in binary form must reproduce the above copyright
16d6a738e1Sjdc * notice, this list of conditions and the following disclaimer in the
17d6a738e1Sjdc * documentation and/or other materials provided with the distribution.
18586d4ce1Smrg *
19d6a738e1Sjdc * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20d6a738e1Sjdc * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21d6a738e1Sjdc * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22d6a738e1Sjdc * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23d6a738e1Sjdc * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24d6a738e1Sjdc * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25d6a738e1Sjdc * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26d6a738e1Sjdc * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27d6a738e1Sjdc * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28d6a738e1Sjdc * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29d6a738e1Sjdc * POSSIBILITY OF SUCH DAMAGE.
30586d4ce1Smrg */
31586d4ce1Smrg
3266cab71cSblymn #include <sys/cdefs.h>
3366cab71cSblymn #ifndef lint
34*0bd3a620Srin __RCSID("$NetBSD: bell.c,v 1.10 2021/09/06 07:03:49 rin Exp $");
3566cab71cSblymn #endif /* not lint */
3666cab71cSblymn
37586d4ce1Smrg #include "curses.h"
388245539aSblymn #include "curses_private.h"
39586d4ce1Smrg
40586d4ce1Smrg /*
41586d4ce1Smrg * beep
42586d4ce1Smrg * Ring the terminal bell
43586d4ce1Smrg */
44586d4ce1Smrg int
beep(void)45586d4ce1Smrg beep(void)
46586d4ce1Smrg {
4798eb8895Sroy if (bell != NULL) {
481f221324Sjdc __CTRACE(__CTRACE_MISC, "beep: bl\n");
4998eb8895Sroy tputs(bell, 0, __cputchar);
5098eb8895Sroy } else if (flash_screen != NULL) {
511f221324Sjdc __CTRACE(__CTRACE_MISC, "beep: vb\n");
5298eb8895Sroy tputs(flash_screen, 0, __cputchar);
53586d4ce1Smrg }
5450a63ac8Sroy return OK;
55586d4ce1Smrg }
56586d4ce1Smrg
57586d4ce1Smrg /*
58586d4ce1Smrg * flash
59586d4ce1Smrg * Flash the terminal screen
60586d4ce1Smrg */
61586d4ce1Smrg int
flash(void)62586d4ce1Smrg flash(void)
63586d4ce1Smrg {
6498eb8895Sroy if (flash_screen != NULL) {
651f221324Sjdc __CTRACE(__CTRACE_MISC, "flash: vb\n");
6698eb8895Sroy tputs(flash_screen, 0, __cputchar);
6798eb8895Sroy } else if (bell != NULL) {
681f221324Sjdc __CTRACE(__CTRACE_MISC, "flash: bl\n");
6998eb8895Sroy tputs(bell, 0, __cputchar);
70586d4ce1Smrg }
7150a63ac8Sroy return OK;
72586d4ce1Smrg }
73