annotate src/terminfo.c @ 298:70ad99077275 r21-0b47

Import from CVS: tag r21-0b47
author cvs
date Mon, 13 Aug 2007 10:39:40 +0200
parents 538048ae2ab8
children 74fd4e045ea6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 /* Interface from Emacs to terminfo.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 Copyright (C) 1985, 1986, 1993 Free Software Foundation, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 This file is part of XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 XEmacs is free software; you can redistribute it and/or modify it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 under the terms of the GNU General Public License as published by the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 Free Software Foundation; either version 2, or (at your option) any
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 along with XEmacs; see the file COPYING. If not, write to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 Boston, MA 02111-1307, USA. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 /* Synched up with: FSF 19.30. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 #include <config.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 #include <string.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 /* Define these variables that serve as global parameters to termcap,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 so that we do not need to conditionalize the places in Emacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 that set them. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 char *UP, *BC, PC;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 /* Every little bit of this God-damned file has caused all manner
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 of headaches due to inconsistent and incorrect header files
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 on one system or other, and we don't currently need anything here,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 so just comment the whole damn lot out!!! */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 #ifndef HAVE_TERMIOS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 #ifdef AIX
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 #include <termio.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 #endif /* AIX */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 /* Interface to curses/terminfo library.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 Turns out that all of the terminfo-level routines look
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 like their termcap counterparts except for tparm, which replaces
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 tgoto. Not only is the calling sequence different, but the string
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 format is different too.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50
149
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 0
diff changeset
51 #include CURSES_H_PATH
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 /* Sun, in their infinite lameness, supplies (possibly) broken headers
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 even under Solaris. GCC feels it necessary to correct things by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 supplying its own headers. Unfortunately, if you build GCC under
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 one version of Solaris and then upgrade your Solaris, you may get
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 screwed because Sun in their continuing lameness changes curses.h
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 in such a way that the "fixed" GCC headers are now broken. (GCC
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 is equally lame in that it supplies "fixed" headers for curses.h
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 but not term.h.) However, it seems to work to just not include
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 term.h under Solaris, so we try that. KLUDGE! */
149
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 0
diff changeset
61 #if !(defined (__GNUC__) && defined (SOLARIS2))
538048ae2ab8 Import from CVS: tag r20-3b1
cvs
parents: 0
diff changeset
62 #include TERM_H_PATH
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 extern void *xmalloc (int size);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 #if 0 /* If this isn't declared somewhere, too bad */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 extern char * tparm (CONST char *string, int arg1, int arg2, int arg3,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 int arg4, int arg5, int arg6, int arg7, int arg8,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 int arg9);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 /* XEmacs: renamed this function because just tparam() conflicts with
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 ncurses (We don't use this function anyway!) */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 char *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 emacs_tparam (CONST char *string, char *outstring, int len, int arg1,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 int arg2, int arg3, int arg4, int arg5, int arg6, int arg7,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 int arg8, int arg9)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 char *temp;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 temp = (char *) tparm (string, arg1, arg2, arg3, arg4, arg5, arg6, arg7,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 arg8, arg9);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 if (outstring == 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 outstring = ((char *) (xmalloc ((strlen (temp)) + 1)));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 strcpy (outstring, temp);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 return outstring;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 #endif /* not HAVE_TERMIOS */