display.c (117238) | display.c (178642) |
---|---|
1/* 2 * Copyright (c) 1983, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 19 unchanged lines hidden (view full) --- 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 */ 33 34#include <sys/cdefs.h> 35 | 1/* 2 * Copyright (c) 1983, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 19 unchanged lines hidden (view full) --- 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 */ 33 34#include <sys/cdefs.h> 35 |
36__FBSDID("$FreeBSD: head/usr.bin/talk/display.c 117238 2003-07-04 20:44:25Z luigi $"); | 36__FBSDID("$FreeBSD: head/usr.bin/talk/display.c 178642 2008-04-28 21:08:42Z delphij $"); |
37 38#ifndef lint 39static const char sccsid[] = "@(#)display.c 8.1 (Berkeley) 6/6/93"; 40#endif 41 42/* 43 * The window 'manager', initializes curses and handles the actual 44 * displaying of text --- 8 unchanged lines hidden (view full) --- 53 54int curses_initialized = 0; 55 56/* 57 * max HAS to be a function, it is called with 58 * an argument of the form --foo at least once. 59 */ 60int | 37 38#ifndef lint 39static const char sccsid[] = "@(#)display.c 8.1 (Berkeley) 6/6/93"; 40#endif 41 42/* 43 * The window 'manager', initializes curses and handles the actual 44 * displaying of text --- 8 unchanged lines hidden (view full) --- 53 54int curses_initialized = 0; 55 56/* 57 * max HAS to be a function, it is called with 58 * an argument of the form --foo at least once. 59 */ 60int |
61max(a,b) 62 int a, b; | 61max(int a, int b) |
63{ 64 65 return (a > b ? a : b); 66} 67 68/* 69 * Display some text on somebody's window, processing some control 70 * characters while we are at it. 71 */ 72void | 62{ 63 64 return (a > b ? a : b); 65} 66 67/* 68 * Display some text on somebody's window, processing some control 69 * characters while we are at it. 70 */ 71void |
73display(win, text, size) 74 xwin_t *win; 75 char *text; 76 int size; | 72display(xwin_t *win, char *text, int size) |
77{ 78 int i; 79 char cch; 80 81 for (i = 0; i < size; i++) { 82 if (*text == '\n' || *text == '\r') { 83 waddch(win->x_win, '\n'); 84 getyx(win->x_win, win->x_line, win->x_col); --- 90 unchanged lines hidden (view full) --- 175 } 176 wrefresh(win->x_win); 177} 178 179/* 180 * Read the character at the indicated position in win 181 */ 182int | 73{ 74 int i; 75 char cch; 76 77 for (i = 0; i < size; i++) { 78 if (*text == '\n' || *text == '\r') { 79 waddch(win->x_win, '\n'); 80 getyx(win->x_win, win->x_line, win->x_col); --- 90 unchanged lines hidden (view full) --- 171 } 172 wrefresh(win->x_win); 173} 174 175/* 176 * Read the character at the indicated position in win 177 */ 178int |
183readwin(win, line, col) 184 WINDOW *win; 185 int line; 186 int col; | 179readwin(WINDOW *win, int line, int col) |
187{ 188 int oldline, oldcol; 189 int c; 190 191 getyx(win, oldline, oldcol); 192 wmove(win, line, col); 193 c = winch(win); 194 wmove(win, oldline, oldcol); 195 return (c); 196} | 180{ 181 int oldline, oldcol; 182 int c; 183 184 getyx(win, oldline, oldcol); 185 wmove(win, line, col); 186 c = winch(win); 187 wmove(win, oldline, oldcol); 188 return (c); 189} |