1 /* A very minimal do-nothing termcap emulation stub. 2 3 Copyright (C) 2005-2016 Free Software Foundation, Inc. 4 5 Contributed by CodeSourcery, LLC. 6 7 This file is part of GDB. 8 9 This program is free software; you can redistribute it and/or modify 10 it under the terms of the GNU General Public License as published by 11 the Free Software Foundation; either version 3 of the License, or 12 (at your option) any later version. 13 14 This program is distributed in the hope that it will be useful, 15 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 GNU General Public License for more details. 18 19 You should have received a copy of the GNU General Public License 20 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 21 22 23 #include "defs.h" 24 25 #ifdef __cplusplus 26 extern "C" { 27 #endif 28 29 /* -Wmissing-prototypes */ 30 extern int tgetent (char *buffer, char *termtype); 31 extern int tgetnum (char *name); 32 extern int tgetflag (char *name); 33 extern char* tgetstr (char *name, char **area); 34 extern int tputs (char *string, int nlines, int (*outfun) (int)); 35 extern char *tgoto (const char *cap, int col, int row); 36 37 #ifdef __cplusplus 38 } 39 #endif 40 41 /* These globals below are global termcap variables that readline 42 references. 43 44 Actually, depending on preprocessor conditions that we don't want 45 to mirror here (as they may change depending on readline versions), 46 readline may define these globals as well, relying on the linker 47 merging them if needed (-fcommon). That doesn't work with 48 -fno-common or C++, so instead we define the symbols as weak. 49 Don't do this on Windows though, as MinGW gcc 3.4.2 doesn't support 50 weak (later versions, e.g., 4.8, do support it). Given this stub 51 file originally was Windows only, and we only needed this when we 52 made it work on other hosts, it should be OK. */ 53 #ifndef __MINGW32__ 54 char PC __attribute__((weak)); 55 char *BC __attribute__((weak)); 56 char *UP __attribute__((weak)); 57 #endif 58 59 /* Each of the files below is a minimal implementation of the standard 60 termcap function with the same name, suitable for use in a Windows 61 console window, or when a real termcap/curses library isn't 62 available. */ 63 64 int 65 tgetent (char *buffer, char *termtype) 66 { 67 return -1; 68 } 69 70 int 71 tgetnum (char *name) 72 { 73 return -1; 74 } 75 76 int 77 tgetflag (char *name) 78 { 79 return -1; 80 } 81 82 char * 83 tgetstr (char *name, char **area) 84 { 85 return NULL; 86 } 87 88 int 89 tputs (char *string, int nlines, int (*outfun) (int)) 90 { 91 while (*string) 92 outfun (*string++); 93 94 return 0; 95 } 96 97 char * 98 tgoto (const char *cap, int col, int row) 99 { 100 return NULL; 101 } 102