inch.c revision 1.3
11.3Sblymn/* $NetBSD: inch.c,v 1.3 2000/04/15 13:17:04 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.2Sblymn 391.2Sblymn#include "curses.h" 401.2Sblymn#include "curses_private.h" 411.2Sblymn 421.3Sblymn#ifndef _CURSES_USE_MACROS 431.3Sblymn 441.3Sblymn/* 451.3Sblymn * inch -- 461.3Sblymn * Return character at cursor position from stdscr. 471.3Sblymn */ 481.3Sblymnchtype 491.3Sblymninch(void) 501.3Sblymn{ 511.3Sblymn return winch(stdscr); 521.3Sblymn} 531.3Sblymn 541.3Sblymn/* 551.3Sblymn * mvinch -- 561.3Sblymn * Return character at position (y, x) from stdscr. 571.3Sblymn */ 581.3Sblymnchtype 591.3Sblymnmvinch(int y, int x) 601.3Sblymn{ 611.3Sblymn return mvwinch(stdscr, y, x); 621.3Sblymn} 631.3Sblymn 641.3Sblymn/* 651.3Sblymn * mvwinch -- 661.3Sblymn * Return character at position (y, x) from the given window. 671.3Sblymn */ 681.3Sblymnchtype 691.3Sblymnmvwinch(WINDOW *win, int y, int x) 701.3Sblymn{ 711.3Sblymn if (wmove(win, y, x) == ERR) 721.3Sblymn return ERR; 731.3Sblymn 741.3Sblymn return winch(win); 751.3Sblymn} 761.3Sblymn 771.3Sblymn#endif 781.3Sblymn 791.2Sblymn/* 801.2Sblymn * winch -- 811.2Sblymn * Return character at cursor position. 821.2Sblymn */ 831.2Sblymnchtype 841.3Sblymnwinch(WINDOW *win) 851.2Sblymn{ 861.2Sblymn 871.2Sblymn chtype ch; 881.2Sblymn 891.2Sblymn ch = (chtype) (((win)->lines[(win)->cury]->line[(win)->curx].ch & __CHARTEXT) | 901.2Sblymn (chtype) ((win)->lines[(win)->cury]->line[(win)->curx].attr & __ATTRIBUTES)); 911.2Sblymn return (ch); 921.2Sblymn} 93