1*3028e483Smartin /* $NetBSD: echochar.c,v 1.2 2008/04/29 06:53:01 martin Exp $ */
25eb61d5cSjdc
35eb61d5cSjdc /*-
45eb61d5cSjdc * Copyright (c) 2004 The NetBSD Foundation, Inc.
55eb61d5cSjdc * All rights reserved.
65eb61d5cSjdc *
75eb61d5cSjdc * This code is derived from software contributed to The NetBSD Foundation
85eb61d5cSjdc * by Julian Coleman.
95eb61d5cSjdc *
105eb61d5cSjdc * Redistribution and use in source and binary forms, with or without
115eb61d5cSjdc * modification, are permitted provided that the following conditions
125eb61d5cSjdc * are met:
135eb61d5cSjdc * 1. Redistributions of source code must retain the above copyright
145eb61d5cSjdc * notice, this list of conditions and the following disclaimer.
155eb61d5cSjdc * 2. Redistributions in binary form must reproduce the above copyright
165eb61d5cSjdc * notice, this list of conditions and the following disclaimer in the
175eb61d5cSjdc * documentation and/or other materials provided with the distribution.
185eb61d5cSjdc *
195eb61d5cSjdc * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
205eb61d5cSjdc * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
215eb61d5cSjdc * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
225eb61d5cSjdc * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
235eb61d5cSjdc * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
245eb61d5cSjdc * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
255eb61d5cSjdc * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
265eb61d5cSjdc * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
275eb61d5cSjdc * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
285eb61d5cSjdc * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
295eb61d5cSjdc * POSSIBILITY OF SUCH DAMAGE.
305eb61d5cSjdc */
315eb61d5cSjdc
325eb61d5cSjdc #include <sys/cdefs.h>
335eb61d5cSjdc #ifndef lint
34*3028e483Smartin __RCSID("$NetBSD: echochar.c,v 1.2 2008/04/29 06:53:01 martin Exp $");
355eb61d5cSjdc #endif /* not lint */
365eb61d5cSjdc
375eb61d5cSjdc #include "curses.h"
385eb61d5cSjdc #include "curses_private.h"
395eb61d5cSjdc
405eb61d5cSjdc #ifndef _CURSES_USE_MACROS
415eb61d5cSjdc /*
425eb61d5cSjdc * echochar --
435eb61d5cSjdc * Echo character and attributes on stdscr and refresh stdscr.
445eb61d5cSjdc */
455eb61d5cSjdc int
echochar(const chtype ch)465eb61d5cSjdc echochar(const chtype ch)
475eb61d5cSjdc {
485eb61d5cSjdc
495eb61d5cSjdc return wechochar(stdscr, ch);
505eb61d5cSjdc }
515eb61d5cSjdc #endif /* _CURSES_USE_MACROS */
525eb61d5cSjdc
535eb61d5cSjdc /*
545eb61d5cSjdc * echochar --
555eb61d5cSjdc * Echo character and attributes on "win" and refresh "win".
565eb61d5cSjdc */
575eb61d5cSjdc int
wechochar(WINDOW * win,const chtype ch)585eb61d5cSjdc wechochar(WINDOW *win, const chtype ch)
595eb61d5cSjdc {
605eb61d5cSjdc int retval;
615eb61d5cSjdc
625eb61d5cSjdc retval = waddch(win, ch);
635eb61d5cSjdc if (retval == OK)
645eb61d5cSjdc retval = wrefresh(win);
655eb61d5cSjdc return retval;
665eb61d5cSjdc }
675eb61d5cSjdc
685eb61d5cSjdc /*
695eb61d5cSjdc * pechochar --
705eb61d5cSjdc * Echo character and attributes on "pad" and refresh "pad" at
715eb61d5cSjdc * its previous position on the screen.
725eb61d5cSjdc */
735eb61d5cSjdc int
pechochar(WINDOW * pad,const chtype ch)745eb61d5cSjdc pechochar(WINDOW *pad, const chtype ch)
755eb61d5cSjdc {
765eb61d5cSjdc int retval;
775eb61d5cSjdc
785eb61d5cSjdc retval = waddch(pad, ch);
795eb61d5cSjdc if (retval == OK)
805eb61d5cSjdc retval = prefresh(pad, pad->pbegy, pad->pbegx,
815eb61d5cSjdc pad->sbegy, pad->sbegx, pad->smaxy, pad->smaxx);
825eb61d5cSjdc return retval;
835eb61d5cSjdc }
84