inch.c revision 1.5
11.5Sblymn/* $NetBSD: inch.c,v 1.5 2002/01/02 10:38:27 blymn Exp $ */ 21.2Sblymn 31.2Sblymn/*- 41.2Sblymn * Copyright (c) 1999 The NetBSD Foundation, Inc. 51.2Sblymn * All rights reserved. 61.2Sblymn * 71.2Sblymn * This code is derived from software contributed to The NetBSD Foundation 81.2Sblymn * by Julian Coleman. 91.2Sblymn * 101.2Sblymn * Redistribution and use in source and binary forms, with or without 111.2Sblymn * modification, are permitted provided that the following conditions 121.2Sblymn * are met: 131.2Sblymn * 1. Redistributions of source code must retain the above copyright 141.2Sblymn * notice, this list of conditions and the following disclaimer. 151.2Sblymn * 2. Redistributions in binary form must reproduce the above copyright 161.2Sblymn * notice, this list of conditions and the following disclaimer in the 171.2Sblymn * documentation and/or other materials provided with the distribution. 181.2Sblymn * 3. All advertising materials mentioning features or use of this software 191.2Sblymn * must display the following acknowledgement: 201.2Sblymn * This product includes software developed by the NetBSD 211.2Sblymn * Foundation, Inc. and its contributors. 221.2Sblymn * 4. Neither the name of The NetBSD Foundation nor the names of its 231.2Sblymn * contributors may be used to endorse or promote products derived 241.2Sblymn * from this software without specific prior written permission. 251.2Sblymn * 261.2Sblymn * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 271.2Sblymn * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 281.2Sblymn * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 291.2Sblymn * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 301.2Sblymn * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 311.2Sblymn * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 321.2Sblymn * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 331.2Sblymn * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 341.2Sblymn * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 351.2Sblymn * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 361.2Sblymn * POSSIBILITY OF SUCH DAMAGE. 371.2Sblymn */ 381.4Sblymn 391.4Sblymn#include <sys/cdefs.h> 401.4Sblymn#ifndef lint 411.5Sblymn__RCSID("$NetBSD: inch.c,v 1.5 2002/01/02 10:38:27 blymn Exp $"); 421.4Sblymn#endif /* not lint */ 431.2Sblymn 441.2Sblymn#include "curses.h" 451.2Sblymn#include "curses_private.h" 461.2Sblymn 471.3Sblymn#ifndef _CURSES_USE_MACROS 481.3Sblymn 491.3Sblymn/* 501.3Sblymn * inch -- 511.3Sblymn * Return character at cursor position from stdscr. 521.3Sblymn */ 531.3Sblymnchtype 541.3Sblymninch(void) 551.3Sblymn{ 561.3Sblymn return winch(stdscr); 571.3Sblymn} 581.3Sblymn 591.3Sblymn/* 601.3Sblymn * mvinch -- 611.3Sblymn * Return character at position (y, x) from stdscr. 621.3Sblymn */ 631.3Sblymnchtype 641.3Sblymnmvinch(int y, int x) 651.3Sblymn{ 661.3Sblymn return mvwinch(stdscr, y, x); 671.3Sblymn} 681.3Sblymn 691.3Sblymn/* 701.3Sblymn * mvwinch -- 711.3Sblymn * Return character at position (y, x) from the given window. 721.3Sblymn */ 731.3Sblymnchtype 741.3Sblymnmvwinch(WINDOW *win, int y, int x) 751.3Sblymn{ 761.3Sblymn if (wmove(win, y, x) == ERR) 771.3Sblymn return ERR; 781.5Sblymn 791.3Sblymn return winch(win); 801.3Sblymn} 811.3Sblymn 821.3Sblymn#endif 831.3Sblymn 841.2Sblymn/* 851.2Sblymn * winch -- 861.2Sblymn * Return character at cursor position. 871.2Sblymn */ 881.2Sblymnchtype 891.3Sblymnwinch(WINDOW *win) 901.2Sblymn{ 911.2Sblymn 921.2Sblymn chtype ch; 931.2Sblymn 941.2Sblymn ch = (chtype) (((win)->lines[(win)->cury]->line[(win)->curx].ch & __CHARTEXT) | 951.2Sblymn (chtype) ((win)->lines[(win)->cury]->line[(win)->curx].attr & __ATTRIBUTES)); 961.2Sblymn return (ch); 971.2Sblymn} 98