1 /* rldefs.h -- an attempt to isolate some of the system-specific defines
2 for readline. This should be included after any files that define
3 system-specific constants like _POSIX_VERSION or USG. */
5 /* Copyright (C) 1987,1989 Free Software Foundation, Inc.
7 This file contains the Readline Library (the Library), a set of
8 routines for providing Emacs style line input to programs that ask
11 The Library is free software; you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation; either version 1, or (at your option)
16 The Library is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 The GNU General Public License is often shipped with GNU software, and
22 is generally kept in a file called COPYING or LICENSE. If you do not
23 have a copy of the license, write to the Free Software Foundation,
24 675 Mass Ave, Cambridge, MA 02139, USA. */
26 #if !defined (_RLDEFS_H)
29 #if defined (HAVE_CONFIG_H)
33 #if !defined (PRAGMA_ALLOCA)
34 # include "memalloc.h"
37 #define NEW_TTY_DRIVER
38 #define HAVE_BSD_SIGNALS
39 /* #define USE_XON_XOFF */
41 #if defined (__linux__) || defined (HAVE_TERMCAP_H)
43 #endif /* __linux__ || HAVE_TERMCAP_H */
45 /* Some USG machines have BSD signal handling (sigblock, sigsetmask, etc.) */
46 #if defined (USG) && !defined (hpux)
47 # undef HAVE_BSD_SIGNALS
50 /* System V machines use termio. */
51 #if !defined (_POSIX_VERSION)
52 # if defined (USG) || defined (hpux) || defined (Xenix) || defined (sgi) || \
53 defined (DGUX) || defined (HAVE_TERMIO_H)
54 # undef NEW_TTY_DRIVER
55 # define TERMIO_TTY_DRIVER
60 # endif /* USG || hpux || Xenix || sgi || DUGX || HAVE_TERMIO_H */
61 #endif /* !_POSIX_VERSION */
63 /* Posix systems use termios and the Posix signal functions. */
64 #if defined (_POSIX_VERSION)
65 # if !defined (TERMIOS_MISSING)
66 # undef NEW_TTY_DRIVER
67 # define TERMIOS_TTY_DRIVER
69 # endif /* !TERMIOS_MISSING */
70 # define HAVE_POSIX_SIGNALS
71 # if !defined (O_NDELAY)
72 # define O_NDELAY O_NONBLOCK /* Posix-style non-blocking i/o */
73 # endif /* O_NDELAY */
74 #endif /* _POSIX_VERSION */
76 /* System V.3 machines have the old 4.1 BSD `reliable' signal interface. */
77 #if !defined (HAVE_BSD_SIGNALS) && !defined (HAVE_POSIX_SIGNALS)
78 # if defined (USGr3) && !defined (XENIX_22)
79 # if !defined (HAVE_USG_SIGHOLD)
80 # define HAVE_USG_SIGHOLD
81 # endif /* !HAVE_USG_SIGHOLD */
82 # endif /* USGr3 && !XENIX_22 */
83 #endif /* !HAVE_BSD_SIGNALS && !HAVE_POSIX_SIGNALS */
85 /* Other (BSD) machines use sgtty. */
86 #if defined (NEW_TTY_DRIVER)
90 #if !defined (SHELL) && (defined (_POSIX_VERSION) || defined (USGr3))
91 # if !defined (HAVE_DIRENT_H)
92 # define HAVE_DIRENT_H
93 # endif /* !HAVE_DIRENT_H */
94 #endif /* !SHELL && (_POSIX_VERSION || USGr3) */
96 #if defined (HAVE_DIRENT_H)
98 # define D_NAMLEN(d) strlen ((d)->d_name)
99 #else /* !HAVE_DIRENT_H */
100 # define D_NAMLEN(d) ((d)->d_namlen)
103 # include <sys/ndir.h>
104 # else /* !Xenix (but USG...) */
108 # include <sys/dir.h>
110 # if !defined (dirent)
111 # define dirent direct
112 # endif /* !dirent */
113 #endif /* !HAVE_DIRENT_H */
115 #if defined (USG) && defined (TIOCGWINSZ) && !defined (Linux)
116 # if defined (HAVE_SYS_STREAM_H)
117 # include <sys/stream.h>
118 # endif /* HAVE_SYS_STREAM_H */
119 # if defined (HAVE_SYS_PTEM_H)
120 # include <sys/ptem.h>
121 # endif /* HAVE_SYS_PTEM_H */
122 # if defined (HAVE_SYS_PTE_H)
123 # include <sys/pte.h>
124 # endif /* HAVE_SYS_PTE_H */
125 #endif /* USG && TIOCGWINSZ && !Linux */
127 /* Posix macro to check file in statbuf for directory-ness.
128 This requires that <sys/stat.h> be included before this test. */
129 #if defined (S_IFDIR) && !defined (S_ISDIR)
130 # define S_ISDIR(m) (((m)&S_IFMT) == S_IFDIR)
133 /* Decide which flavor of the header file describing the C library
134 string functions to include and include it. */
136 #if defined (USG) || defined (NeXT)
137 # if !defined (HAVE_STRING_H)
138 # define HAVE_STRING_H
139 # endif /* !HAVE_STRING_H */
140 #endif /* USG || NeXT */
142 #if defined (HAVE_STRING_H)
144 #else /* !HAVE_STRING_H */
145 # include <strings.h>
146 #endif /* !HAVE_STRING_H */
148 #if !defined (strchr) && !defined (__STDC__)
149 extern char *strchr (), *strrchr ();
150 #endif /* !strchr && !__STDC__ */
152 #if defined (HAVE_VARARGS_H)
153 # include <varargs.h>
154 #endif /* HAVE_VARARGS_H */
156 /* This is needed to include support for TIOCGWINSZ and window resizing. */
157 #if defined (OSF1) || defined (BSD386) || defined (NetBSD) || \
158 defined (__BSD_4_4__) || defined (FreeBSD) || defined (_386BSD) || \
160 # define GWINSZ_IN_SYS_IOCTL
163 /* Define _POSIX_VDISABLE if we are not using the `new' tty driver and
164 it is not already defined. It is used both to determine if a
165 special character is disabled and to disable certain special
166 characters. Posix systems should set to 0, USG systems to -1. */
167 #if !defined (NEW_TTY_DRIVER) && !defined (_POSIX_VDISABLE)
168 # if defined (_SVR4_VDISABLE)
169 # define _POSIX_VDISABLE _SVR4_VDISABLE
171 # if defined (_POSIX_VERSION)
172 # define _POSIX_VDISABLE 0
173 # else /* !_POSIX_VERSION */
174 # define _POSIX_VDISABLE -1
175 # endif /* !_POSIX_VERSION */
176 # endif /* !_SVR4_VDISABLE */
177 #endif /* !NEW_TTY_DRIVER && !_POSIX_VDISABLE */
180 #if !defined (emacs_mode)
183 # define emacs_mode 1
186 /* If you cast map[key].function to type (Keymap) on a Cray,
187 the compiler takes the value of map[key].function and
188 divides it by 4 to convert between pointer types (pointers
189 to functions and pointers to structs are different sizes).
190 This is not what is wanted. */
192 # define FUNCTION_TO_KEYMAP(map, key) (Keymap)((int)map[key].function)
193 # define KEYMAP_TO_FUNCTION(data) (Function *)((int)(data))
195 # define FUNCTION_TO_KEYMAP(map, key) (Keymap)(map[key].function)
196 # define KEYMAP_TO_FUNCTION(data) (Function *)(data)
200 extern char *xmalloc ();
201 #define savestring(x) strcpy (xmalloc (1 + strlen (x)), (x))
204 /* Possible values for _rl_bell_preference. */
206 #define AUDIBLE_BELL 1
207 #define VISIBLE_BELL 2
209 /* CONFIGURATION SECTION */
212 #endif /* !_RLDEFS_H */