# ------------------------------------------------------------------------------
# MANIFEST | 5 -
# Tekproc.c | 1
# button.c | 11 --
# charclass.c | 2
# charproc.c | 6 -
# fontutils.c | 36 ++++++--
# main.c | 199 +++++++++++----------------------------------
# menu.c | 8 -
# os2main.c | 46 ----------
# resize.c | 238 ++++++++++++-------------------------------------------
# screen.c | 56 ------------
# xterm.h | 4
# xterm.log.html | 17 +++
# 13 files changed, 168 insertions(+), 461 deletions(-)
# ------------------------------------------------------------------------------
Index: MANIFEST
--- xterm-148a/MANIFEST Fri Aug 25 17:51:07 2000
+++ xterm-149/MANIFEST Thu Dec 7 05:04:01 2000
@@ -1,4 +1,4 @@
-MANIFEST for xterm-141, version xterm-141
+MANIFEST for xterm-149, version xterm-149
--------------------------------------------------------------------------------
MANIFEST this file
256colres.h resource-definitions for 256-color mode
@@ -78,10 +78,13 @@
wcwidth.c wide-character utility functions
wcwidth.h interface of wcwidth.c
xcharmouse.h Jason Bacon's mouse-defs, cleaned up a little
+xstrings.c a few common string functions
+xstrings.h interface of xstrings.c
xterm.dat application defaults for VMS port of 'xterm'
xterm.h common includes, definitions and prototypes for 'xterm'
xterm.man manual page for 'xterm'
xterm_axp.opt linker options file for VMS port of 'xterm'
+xterm_io.h split-out definitions of termio/termios/sgtty and winsize from main.c, os2main.c, screen.c and resize.c
xtermcfg.hin configure script: template for xtermcfg.h
tektests subdirectory
tektests/aitest.tek tek4014 demo: draw a globe
Index: Tekproc.c
--- xterm-148a/Tekproc.c Fri Mar 31 15:13:41 2000
+++ xterm-149/Tekproc.c Tue Nov 28 19:02:41 2000
@@ -58,7 +58,6 @@
#include <xterm.h>
-#include <X11/Xos.h>
#include <X11/Xatom.h>
#include <X11/Xutil.h>
#include <X11/cursorfont.h>
Index: button.c
--- xterm-148a/button.c Tue Nov 28 18:07:33 2000
+++ xterm-149/button.c Wed Nov 29 21:00:30 2000
@@ -61,14 +61,9 @@
#include <xterm.h>
-#include <X11/Xatom.h>
-
#include <stdio.h>
-#ifdef MINIX
-#include <X11/Xos.h>
-#endif
-
+#include <X11/Xatom.h>
#include <X11/Xmu/Atoms.h>
#include <X11/Xmu/StdSel.h>
@@ -989,9 +984,9 @@
}
#if OPT_TRACE && OPT_WIDE_CHARS
-static void GettingSelection(char *tag, char *line, int len)
+static void GettingSelection(char *tag, Char *line, int len)
{
- char *cp;
+ Char *cp;
Trace("Getting %s\n", tag);
for (cp = line; cp < line + len; cp++)
Index: charclass.c
--- xterm-148a/charclass.c Sat Aug 26 00:33:53 2000
+++ xterm-149/charclass.c Tue Nov 28 05:52:55 2000
@@ -27,8 +27,6 @@
#if OPT_WIDE_CHARS
-#include <stdlib.h>
-
struct classentry {
int class;
int first;
Index: charproc.c
--- xterm-148a/charproc.c Wed Nov 29 03:39:24 2000
+++ xterm-149/charproc.c Wed Nov 29 21:00:30 2000
@@ -86,11 +86,11 @@
#include <version.h>
#include <xterm.h>
-#include <X11/Xos.h>
#include <X11/Xatom.h>
#include <X11/Xutil.h>
#include <X11/cursorfont.h>
#include <X11/StringDefs.h>
+#include <X11/Shell.h>
#include <X11/Xmu/Atoms.h>
#include <X11/Xmu/CharSet.h>
#include <X11/Xmu/Converters.h>
@@ -126,10 +126,6 @@
#if OPT_ZICONBEEP || OPT_TOOLBAR
#define HANDLE_STRUCT_NOTIFY 1
#endif
-
-#if !defined(NO_ACTIVE_ICON) || defined(HANDLE_STRUCT_NOTIFY)
-#include <X11/Shell.h>
-#endif /* NO_ACTIVE_ICON */
extern char *ProgramName;
Index: fontutils.c
--- xterm-148a/fontutils.c Sun Dec 3 14:09:26 2000
+++ xterm-149/fontutils.c Wed Dec 6 04:57:34 2000
@@ -469,10 +469,23 @@
static int
is_fixed_font(XFontStruct *fs)
{
- return (fs->min_bounds.width == fs->max_bounds.width
- && fs->min_bounds.width == fs->min_bounds.width);
+ return (fs->min_bounds.width == fs->max_bounds.width);
}
+/*
+ * Check if the font looks like a double width font (i.e. contains
+ * characters of width X and 2X
+ */
+#if OPT_WIDE_CHARS
+static int
+is_double_width_font(XFontStruct *fs)
+{
+ return (2 * fs->min_bounds.width == fs->max_bounds.width);
+}
+#else
+#define is_double_width_font(fs) 0
+#endif
+
#define EmptyFont(fs) (fs != 0 \
&& ((fs)->ascent + (fs)->descent == 0 \
|| (fs)->max_bounds.width == 0))
@@ -555,22 +568,29 @@
* and 12x13ja as the corresponding fonts for 9x18 and 6x13.
*/
if_OPT_WIDE_CHARS(screen, {
- if (wfontname == 0) {
+ if (wfontname == 0 && !is_double_width_font(nfs)) {
fp = get_font_name_props(screen->display, nfs, normal);
if (fp != 0) {
wfontname = wide_font_name(fp);
TRACE(("...derived wide %s\n", wfontname));
}
}
- if (wfontname
- && (wfs = XLoadQueryFont(screen->display, wfontname)) == 0) {
+
+ if (wfontname) {
+ wfs = XLoadQueryFont(screen->display, wfontname);
+ } else {
+ wfs = nfs;
}
+
if (wbfontname) {
wbfs = XLoadQueryFont(screen->display, wbfontname);
+ } else if (is_double_width_font(bfs)) {
+ wbfs = bfs;
} else {
wbfs = wfs;
TRACE(("...cannot load wide bold font %s\n", wbfontname));
}
+
if (EmptyFont(wbfs))
goto bad; /* can't use a 0-sized font */
})
@@ -859,7 +879,11 @@
else
#endif
{
- win->f_width = (font->max_bounds.width);
+ if (is_double_width_font(font)) {
+ win->f_width = (font->min_bounds.width);
+ } else {
+ win->f_width = (font->max_bounds.width);
+ }
win->f_height = (font->ascent + font->descent);
win->f_ascent = font->ascent;
win->f_descent = font->descent;
Index: main.c
--- xterm-148a/main.c Tue Oct 31 20:12:39 2000
+++ xterm-149/main.c Wed Nov 29 20:13:32 2000
@@ -74,8 +74,6 @@
#include <X11/StringDefs.h>
#include <X11/Shell.h>
-
-#include <X11/Xos.h>
#include <X11/cursorfont.h>
#include <X11/Xlocale.h>
@@ -91,6 +89,7 @@
#include <menu.h>
#include <main.h>
#include <xstrings.h>
+#include <xterm_io.h>
#if OPT_WIDE_CHARS
#include <charclass.h>
@@ -101,12 +100,10 @@
#include <cmdreg.h>
#include <stderr.h>
#include <thread.h>
-#define _POSIX_SOURCE
#include <limits.h>
#include <module/proc.h>
#include <module/name.h>
-#define USE_TERMIOS
#define NILCAP ((capability *)NULL)
#endif
@@ -114,7 +111,6 @@
#include <sys/nbio.h>
#define setpgrp(pid, pgid) setpgid(pid, pgid)
-#define USE_TERMIOS
#define MNX_LASTLOG
#define WTMP
/* Remap or define non-existing termios flags */
@@ -137,10 +133,6 @@
#define WTMP
#endif
-#if defined(SVR4) && !defined(__sgi)
-#define USE_TERMIOS
-#endif
-
#ifdef USE_ISPTS_FLAG
static Bool IsPts = False;
#endif
@@ -155,49 +147,25 @@
#define KANJI
#endif
-#ifdef TIOCSLTC
-#define HAS_LTCHARS
-#endif
-
#ifdef linux
-#define USE_TERMIOS
#define USE_SYSV_PGRP
#define USE_SYSV_SIGNALS
#define WTMP
-#undef HAS_LTCHARS
#ifdef __GLIBC__
#if (__GLIBC__ > 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 1))
#include <pty.h>
-#include <stdlib.h> /* getpt() */
#endif
#endif
#endif
#ifdef __MVS__
-#define SVR4
-#define USE_POSIX_TERMIOS
#define USE_SYSV_PGRP
#define USE_SYSV_SIGNALS
-#undef HAS_LTCHARS
#endif
#ifdef __CYGWIN__
-#define SYSV
-#define SVR4
#define LASTLOG
#define WTMP
-#define ATT
-#endif
-
-#ifdef __QNX__
-#define USE_POSIX_TERMIOS
-#include <ioctl.h>
-#endif
-
-#ifdef Lynx
-#define USE_SYSV_TERMIO
-#undef HAS_LTCHARS
-#include <termio.h>
#endif
#ifdef SCO325
@@ -218,10 +186,6 @@
#define TTY_GROUP_NAME "tty"
#endif
-#ifndef __CYGWIN__
-#include <sys/ioctl.h>
-#endif
-
#include <sys/stat.h>
#ifdef Lynx
@@ -236,56 +200,20 @@
#endif
#endif
-#if defined(USE_POSIX_TERMIOS)
-#include <termios.h>
-#elif defined(USE_TERMIOS)
-#include <termios.h>
-/* this hacked termios support only works on SYSV */
-#define USE_SYSV_TERMIO
-#define termio termios
-#undef TCGETA
-#define TCGETA TCGETS
-#undef TCSETA
-#define TCSETA TCSETS
-#elif defined(SYSV)
-#include <sys/termio.h>
-#elif defined(sun) && !defined(SVR4)
-#include <sys/ttycom.h>
-#ifdef TIOCSWINSZ
-#undef TIOCSSIZE
-#endif
-#endif /* USE_POSIX_TERMIOS */
-
-#ifdef SVR4
-#undef HAS_LTCHARS /* defined, but not useable */
-#endif
-#define USE_TERMCAP_ENVVARS /* every one uses this except SYSV maybe */
-
-#if defined(__sgi) && (OSMAJORVERSION >= 5)
-#undef TIOCLSET /* defined, but not useable */
-#endif
-
-#if defined(__GNU__) || defined(__MVS__)
-#undef TIOCLSET
-#undef TIOCSLTC
-#endif
-
#ifdef SYSV /* { */
#ifdef USE_USG_PTYS /* AT&T SYSV has no ptyio.h */
-#include <sys/stream.h> /* get typedef used in ptem.h */
#include <sys/stropts.h> /* for I_PUSH */
-#if !defined(SVR4) || defined(SCO325)
-#include <sys/ptem.h> /* get struct winsize */
-#endif
#include <poll.h> /* for POLLIN */
#endif /* USE_USG_PTYS */
-#define USE_SYSV_TERMIO
+
#define USE_SYSV_SIGNALS
#define USE_SYSV_PGRP
+
#if !defined(TIOCSWINSZ)
#define USE_SYSV_ENVVARS /* COLUMNS/LINES vs. TERMCAP */
#endif
+
/*
* now get system-specific includes
*/
@@ -330,8 +258,6 @@
#ifdef __QNX__
-#undef TIOCSLTC /* <sgtty.h> conflicts with <termios.h> */
-#undef TIOCLSET
#ifndef __QNXNTO__
#define ttyslot() 1
#else
@@ -344,14 +270,14 @@
#ifndef linux
#ifndef VMS
#ifndef USE_POSIX_TERMIOS
-#ifndef USE_SYSV_TERMIO
+#ifndef USE_ANY_SYSV_TERMIO
#include <sgtty.h>
#endif
#endif /* USE_POSIX_TERMIOS */
-#ifndef Lynx
-#include <sys/resource.h>
-#else
+#ifdef Lynx
#include <resource.h>
+#else
+#include <sys/resource.h>
#endif
#define HAS_BSD_GROUPS
#endif /* !VMS */
@@ -376,10 +302,8 @@
#ifndef NOFILE
#define NOFILE OPEN_MAX
#endif
-#elif !defined(MINIX) && !defined(WIN32) && !defined(Lynx) && !defined(__GNU__) && !defined(__MVS__)
-#ifndef VMS
+#elif !(defined(VMS) || defined(MINIX) || defined(WIN32) || defined(Lynx) || defined(__GNU__) || defined(__MVS__))
#include <sys/param.h> /* for NOFILE */
-#endif /* !VMS */
#endif
#if defined(BSD) && (BSD >= 199103)
@@ -403,12 +327,6 @@
#define ttyslot() 1
#endif /* apollo */
-#ifdef sun
-#include <sys/filio.h>
-#endif
-
-#include <sys/types.h>
-
#if defined(USE_UTEMPTER)
#include <utempter.h>
@@ -439,17 +357,15 @@
#include <local/openpty.h>
#endif /* PUCC_PTYD */
-#ifndef UTMP_FILENAME
-#ifdef UTMP_FILE
+#if !defined(UTMP_FILENAME)
+#if defined(UTMP_FILE)
#define UTMP_FILENAME UTMP_FILE
-#else
-#ifdef _PATH_UTMP
+#elif defined(_PATH_UTMP)
#define UTMP_FILENAME _PATH_UTMP
#else
#define UTMP_FILENAME "/etc/utmp"
#endif
#endif
-#endif
#ifndef LASTLOG_FILENAME
#ifdef _PATH_LASTLOG
@@ -459,21 +375,17 @@
#endif
#endif
-#ifndef WTMP_FILENAME
-#ifdef WTMP_FILE
+#if !defined(WTMP_FILENAME)
+#if defined(WTMP_FILE)
#define WTMP_FILENAME WTMP_FILE
-#else
-#ifdef _PATH_WTMP
+#elif defined(_PATH_WTMP)
#define WTMP_FILENAME _PATH_WTMP
-#else
-#ifdef SYSV
+#elif defined(SYSV)
#define WTMP_FILENAME "/etc/wtmp"
#else
#define WTMP_FILENAME "/usr/adm/wtmp"
#endif
#endif
-#endif
-#endif
#include <signal.h>
@@ -540,15 +452,6 @@
*/
static char **command_to_exec = NULL;
-#ifdef USE_SYSV_TERMIO
-#ifndef ICRNL
-#include <sys/termio.h>
-#endif
-#if defined (__sgi) || (defined(__linux__) && defined(__sparc__))
-#undef TIOCLSET /* XXX why is this undef-ed again? */
-#endif
-#endif /* USE_SYSV_TERMIO */
-
#define TERMCAP_ERASE "kb"
#define VAL_INITIAL_ERASE A2E(127)
@@ -612,7 +515,7 @@
#endif
#ifndef VMS
-#ifdef USE_SYSV_TERMIO
+#ifdef USE_ANY_SYSV_TERMIO
/* The following structures are initialized in main() in order
** to eliminate any assumptions about the internal order of their
** contents.
@@ -628,7 +531,7 @@
#elif defined(USE_POSIX_TERMIOS)
static struct termios d_tio;
-#else /* !USE_SYSV_TERMIO && !USE_POSIX_TERMIOS */
+#else /* !USE_ANY_SYSV_TERMIO && !USE_POSIX_TERMIOS */
static struct sgttyb d_sg = {
0, 0, 0177, CKILL, EVENP|ODDP|ECHO|XTABS|CRMOD
};
@@ -648,7 +551,7 @@
'J', 'B'
};
#endif /* sony */
-#endif /* USE_SYSV_TERMIO */
+#endif /* USE_ANY_SYSV_TERMIO */
#endif /* ! VMS */
/*
@@ -1471,7 +1374,7 @@
d_tio.c_cc[VREPRINT]= TREPRINT_DEF;
d_tio.c_cc[VLNEXT]= TLNEXT_DEF;
d_tio.c_cc[VDISCARD]= TDISCARD_DEF;
-#elif defined(USE_SYSV_TERMIO) || defined(USE_POSIX_TERMIOS) /* { */
+#elif defined(USE_ANY_SYSV_TERMIO) || defined(USE_POSIX_TERMIOS) /* { */
/* Initialization is done here rather than above in order
** to prevent any assumptions about the order of the contents
** of the various terminal structures (which may change from
@@ -1961,7 +1864,7 @@
}
}
if(i >= 0) {
-#if defined(USE_SYSV_TERMIO) && !defined(SVR4) && !defined(linux)
+#if defined(USE_ANY_SYSV_TERMIO) && !defined(SVR4) && !defined(linux)
/* SYSV has another pointer which should be part of the
** FILE structure but is actually a separate array.
*/
@@ -1975,9 +1878,9 @@
stderr->_file = i;
#endif
_bufend(stderr) = old_bufend;
-#else /* USE_SYSV_TERMIO */
+#else /* USE_ANY_SYSV_TERMIO */
freopen(dbglogfile, "w", stderr);
-#endif /* USE_SYSV_TERMIO */
+#endif /* USE_ANY_SYSV_TERMIO */
/* mark this file as close on exec */
(void) fcntl(i, F_SETFD, 1);
@@ -2037,7 +1940,7 @@
if (fcntl(screen->respond, F_SETFD, mode) == -1)
Error(1);
nbio_register(screen->respond);
-#elif defined(USE_SYSV_TERMIO) || defined(__MVS__)
+#elif defined(USE_ANY_SYSV_TERMIO) || defined(__MVS__)
if (0 > (mode = fcntl(screen->respond, F_GETFL, 0)))
Error(1);
#ifdef O_NDELAY
@@ -2047,7 +1950,7 @@
#endif /* O_NDELAY */
if (fcntl(screen->respond, F_SETFL, mode))
Error(1);
-#else /* !MINIX && !USE_SYSV_TERMIO */
+#else /* !MINIX && !USE_ANY_SYSV_TERMIO */
mode = 1;
if (ioctl (screen->respond, FIONBIO, (char *)&mode) == -1) SysError (ERROR_FIONBIO);
#endif /* MINIX, etc */
@@ -2479,7 +2382,7 @@
int initial_erase = VAL_INITIAL_ERASE;
#endif
int tty = -1;
-#ifdef USE_SYSV_TERMIO
+#ifdef USE_ANY_SYSV_TERMIO
struct termio tio;
#ifdef TIOCLSET
unsigned lmode;
@@ -2489,7 +2392,7 @@
#endif /* HAS_LTCHARS */
#elif defined(USE_POSIX_TERMIOS)
struct termios tio;
-#else /* !USE_SYSV_TERMIO && !USE_POSIX_TERMIOS */
+#else /* !USE_ANY_SYSV_TERMIO && !USE_POSIX_TERMIOS */
int ldisc = 0;
int discipline;
unsigned lmode;
@@ -2500,7 +2403,7 @@
int jmode;
struct jtchars jtc;
#endif /* sony */
-#endif /* USE_SYSV_TERMIO */
+#endif /* USE_ANY_SYSV_TERMIO */
char termcap [TERMCAP_SIZE];
char newtc [TERMCAP_SIZE];
@@ -2514,7 +2417,7 @@
struct ttysize ts;
#elif defined(TIOCSWINSZ)
struct winsize ws;
-#endif
+#endif /* sun vs TIOCSWINSZ */
struct passwd *pw = NULL;
#ifdef HAVE_UTMP
#if defined(UTMPX_FOR_UTMP)
@@ -2591,9 +2494,9 @@
#ifdef TIOCLSET
lmode = d_lmode;
#endif /* TIOCLSET */
-#if defined(USE_SYSV_TERMIO) || defined(USE_POSIX_TERMIOS)
+#if defined(USE_ANY_SYSV_TERMIO) || defined(USE_POSIX_TERMIOS)
tio = d_tio;
-#else /* not USE_SYSV_TERMIO and not USE_POSIX_TERMIOS */
+#else /* not USE_ANY_SYSV_TERMIO and not USE_POSIX_TERMIOS */
sg = d_sg;
tc = d_tc;
discipline = d_disipline;
@@ -2601,7 +2504,7 @@
jmode = d_jmode;
jtc = d_jtc;
#endif /* sony */
-#endif /* USE_SYSV_TERMIO or USE_POSIX_TERMIOS */
+#endif /* USE_ANY_SYSV_TERMIO or USE_POSIX_TERMIOS */
} else {
SysError(ERROR_OPDEVTTY);
}
@@ -2621,13 +2524,13 @@
if(ioctl(tty, TIOCLGET, &lmode) == -1)
lmode = d_lmode;
#endif /* TIOCLSET */
-#ifdef USE_SYSV_TERMIO
+#ifdef USE_ANY_SYSV_TERMIO
if(ioctl(tty, TCGETA, &tio) == -1)
tio = d_tio;
#elif defined(USE_POSIX_TERMIOS)
if (tcgetattr(tty, &tio) == -1)
tio = d_tio;
-#else /* !USE_SYSV_TERMIO && !USE_POSIX_TERMIOS */
+#else /* !USE_ANY_SYSV_TERMIO && !USE_POSIX_TERMIOS */
if(ioctl(tty, TIOCGETP, (char *)&sg) == -1)
sg = d_sg;
if(ioctl(tty, TIOCGETC, (char *)&tc) == -1)
@@ -2640,17 +2543,17 @@
if(ioctl(tty, TIOCKGETC, (char *)&jtc) == -1)
jtc = d_jtc;
#endif /* sony */
-#endif /* USE_SYSV_TERMIO */
+#endif /* USE_ANY_SYSV_TERMIO */
#if OPT_INITIAL_ERASE
if (resource.ptyInitialErase) {
-#ifdef USE_SYSV_TERMIO
+#ifdef USE_ANY_SYSV_TERMIO
initial_erase = tio.c_cc[VERASE];
#elif defined(USE_POSIX_TERMIOS)
initial_erase = tio.c_cc[VERASE];
-#else /* !USE_SYSV_TERMIO && !USE_POSIX_TERMIOS */
+#else /* !USE_ANY_SYSV_TERMIO && !USE_POSIX_TERMIOS */
initial_erase = sg.sg_erase;
-#endif /* USE_SYSV_TERMIO */
+#endif /* USE_ANY_SYSV_TERMIO */
}
TRACE(("%s @%d, ptyInitialErase:%d, backarrow_is_erase:%d, initial_erase:%d (from /dev/tty)\n",
__FILE__, __LINE__,
@@ -2681,7 +2584,7 @@
#if OPT_INITIAL_ERASE
if (resource.ptyInitialErase) {
-#ifdef USE_SYSV_TERMIO
+#ifdef USE_ANY_SYSV_TERMIO
struct termio my_tio;
if(ioctl(screen->respond, TCGETA, &my_tio) == 0)
initial_erase = my_tio.c_cc[VERASE];
@@ -2689,11 +2592,11 @@
struct termios my_tio;
if (tcgetattr(screen->respond, &my_tio) == 0)
initial_erase = my_tio.c_cc[VERASE];
-#else /* !USE_SYSV_TERMIO && !USE_POSIX_TERMIOS */
+#else /* !USE_ANY_SYSV_TERMIO && !USE_POSIX_TERMIOS */
struct sgttyb my_sg;
if(ioctl(screen->respond, TIOCGETP, (char *)&my_sg) == 0)
initial_erase = my_sg.sg_erase;
-#endif /* USE_SYSV_TERMIO */
+#endif /* USE_ANY_SYSV_TERMIO */
}
if (resource.backarrow_is_erase)
if (initial_erase == 127) { /* see input.c */
@@ -3054,7 +2957,7 @@
* set up the tty modes
*/
{
-#if defined(USE_SYSV_TERMIO) || defined(USE_POSIX_TERMIOS)
+#if defined(USE_ANY_SYSV_TERMIO) || defined(USE_POSIX_TERMIOS)
#if defined(umips) || defined(CRAY) || defined(linux)
/* If the control tty had its modes screwed around with,
eg. by lineedit in the shell, or emacs, etc. then tio
@@ -3236,7 +3139,7 @@
if (tcsetattr (tty, TCSANOW, &tio) == -1)
HsSysError(cp_pipe[1], ERROR_TIOCSETP);
#endif /* USE_POSIX_TERMIOS */
-#else /* USE_SYSV_TERMIO or USE_POSIX_TERMIOS */
+#else /* USE_ANY_SYSV_TERMIO or USE_POSIX_TERMIOS */
sg.sg_flags &= ~(ALLDELAY | XTABS | CBREAK | RAW);
sg.sg_flags |= ECHO | CRMOD;
/* make sure speed is set on pty so that editors work right*/
@@ -3290,7 +3193,7 @@
if (ioctl (tty, TIOCKSETC, (char *)&jtc) == -1)
HsSysError (cp_pipe[1], ERROR_TIOCKSETC);
#endif /* sony */
-#endif /* !USE_SYSV_TERMIO */
+#endif /* !USE_ANY_SYSV_TERMIO */
#if defined(TIOCCONS) || defined(SRIOCSREDIR)
if (Console) {
#ifdef TIOCCONS
@@ -3331,7 +3234,7 @@
if (! resource.ptyInitialErase
&& !override_tty_modes
&& !ttymodelist[XTTYMODE_erase].set) {
-#ifdef USE_SYSV_TERMIO
+#ifdef USE_ANY_SYSV_TERMIO
if(ioctl(tty, TCGETA, &tio) == -1)
tio = d_tio;
tio.c_cc[VERASE] = initial_erase;
@@ -3341,12 +3244,12 @@
tio = d_tio;
tio.c_cc[VERASE] = initial_erase;
tcsetattr(tty, TCSANOW, &tio);
-#else /* !USE_SYSV_TERMIO && !USE_POSIX_TERMIOS */
+#else /* !USE_ANY_SYSV_TERMIO && !USE_POSIX_TERMIOS */
if(ioctl(tty, TIOCGETP, (char *)&sg) == -1)
sg = d_sg;
sg.sg_erase = initial_erase;
ioctl(tty, TIOCSETP, (char *)&sg);
-#endif /* USE_SYSV_TERMIO */
+#endif /* USE_ANY_SYSV_TERMIO */
}
#endif
@@ -3769,11 +3672,11 @@
shname_minus = (char *)malloc(strlen(shname) + 2);
(void) strcpy(shname_minus, "-");
(void) strcat(shname_minus, shname);
-#if !defined(USE_SYSV_TERMIO) && !defined(USE_POSIX_TERMIOS)
+#if !defined(USE_ANY_SYSV_TERMIO) && !defined(USE_POSIX_TERMIOS)
ldisc = XStrCmp("csh", shname + strlen(shname) - 3) == 0 ?
NTTYDISC : 0;
ioctl(0, TIOCSETD, (char *)&ldisc);
-#endif /* !USE_SYSV_TERMIO && !USE_POSIX_TERMIOS */
+#endif /* !USE_ANY_SYSV_TERMIO && !USE_POSIX_TERMIOS */
#ifdef USE_LOGIN_DASH_P
if (term->misc.login_shell && pw && added_utmp_entry)
@@ -4609,8 +4512,8 @@
else
return 0;
#elif defined(MINIX)
- /* The answer doesn't have to correct. Calling nbio_isinprogress is
- * much cheaper than called nbio_select.
+ /* The answer doesn't have to be correct. Calling nbio_isinprogress() is
+ * much cheaper than nbio_select().
*/
if (nbio_isinprogress(fd, ASIO_READ))
return 0;
Index: menu.c
--- xterm-148a/menu.c Tue Oct 31 20:12:40 2000
+++ xterm-149/menu.c Tue Nov 28 19:08:34 2000
@@ -49,7 +49,7 @@
*/
-#include <ptyx.h>
+#include <xterm.h>
#include <data.h>
#include <menu.h>
#include <fontutils.h>
@@ -70,12 +70,6 @@
#include <stdio.h>
#include <signal.h>
-
-#ifdef MINIX
-#include <X11/Xos.h>
-#endif
-
-#include <xterm.h>
static void do_8bit_control PROTO_XT_CALLBACK_ARGS;
static void do_allow132 PROTO_XT_CALLBACK_ARGS;
Index: os2main.c
--- xterm-148a/os2main.c Tue Oct 31 20:12:41 2000
+++ xterm-149/os2main.c Wed Nov 29 06:04:20 2000
@@ -71,8 +71,6 @@
#include <X11/StringDefs.h>
#include <X11/Shell.h>
-
-#include <X11/Xos.h>
#include <X11/cursorfont.h>
#ifdef I18N
#include <X11/Xlocale.h>
@@ -90,21 +88,16 @@
#include <menu.h>
#include <main.h>
#include <xstrings.h>
-
-#include <sys/termio.h>
+#include <xterm_io.h>
int setpgrp(pid_t pid ,gid_t pgid) {}
int chown(const char* fn, pid_t pid, gid_t gid) {}
char *ttyname(int fd) { return "/dev/tty"; }
-#include <sys/ioctl.h>
#include <sys/stat.h>
-
#include <sys/param.h> /* for NOFILE */
-
#include <stdio.h>
#include <time.h>
-
#include <signal.h>
static SIGNAL_T reapchild (int n);
@@ -713,43 +706,6 @@
Atom wm_delete_window;
#ifdef __EMX__
-
-#define XFREE86_PTY 0x76
-
-#define XTY_TIOCSETA 0x48
-#define XTY_TIOCSETAW 0x49
-#define XTY_TIOCSETAF 0x4a
-#define XTY_TIOCCONS 0x4d
-#define XTY_TIOCSWINSZ 0x53
-#define XTY_ENADUP 0x5a
-#define XTY_TRACE 0x5b
-#define XTY_TIOCGETA 0x65
-#define XTY_TIOCGWINSZ 0x66
-#define PTMS_GETPTY 0x64
-#define PTMS_BUFSZ 14
-#ifndef NCCS
-#define NCCS 11
-#endif
-
-#define TIOCSWINSZ 113
-#define TIOCGWINSZ 117
-
-struct pt_termios
-{
- unsigned short c_iflag;
- unsigned short c_oflag;
- unsigned short c_cflag;
- unsigned short c_lflag;
- unsigned char c_cc[NCCS];
- long _reserved_[4];
-};
-
-struct winsize {
- unsigned short ws_row; /* rows, in characters */
- unsigned short ws_col; /* columns, in characters */
- unsigned short ws_xpixel; /* horizontal size, pixels */
- unsigned short ws_ypixel; /* vertical size, pixels */
-};
int ptioctl(int fd, int func, void* data)
{
Index: resize.c
--- xterm-148a/resize.c Tue Oct 31 20:12:42 2000
+++ xterm-149/resize.c Thu Nov 30 19:58:27 2000
@@ -29,86 +29,30 @@
/* resize.c */
-#ifdef HAVE_CONFIG_H
-#include <xtermcfg.h>
-
-#else
-
-#if defined(__EMX__) || defined(__CYGWIN__) || defined(SCO) || defined(sco)
-#define USE_TERMCAP 1
-#endif
-
-#endif
-
-#include <X11/Xos.h>
+#include <xterm.h>
#include <stdio.h>
#include <ctype.h>
#include <xstrings.h>
-
-#if defined(att)
-#define ATT
-#endif
-
-#if defined(sgi) && defined(SVR4)
-#undef SYSV
-#undef SVR4
-#define SYSV
-#endif
-
-#ifdef SVR4
-#undef SYSV /* predefined on Solaris 2.4 */
-#define SYSV
-#define ATT
-#endif
-
-#if (defined(ATT) && !defined(__sgi)) || (defined(SYSV) && defined(i386)) || (defined (__GLIBC__) && (__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 1))
-#define USE_USG_PTYS
-#endif
+#include <xterm_io.h>
#ifdef APOLLO_SR9
#define CANT_OPEN_DEV_TTY
#endif
-#if defined(__EMX__) || defined(__CYGWIN__)
-#define USE_SYSV_TERMIO
-#endif
-
-#ifdef macII
-#define USE_SYSV_TERMIO
-#undef SYSV /* pretend to be bsd */
-#endif /* macII */
-
-#ifdef linux
-#define USE_TERMIOS
-#endif
-
-#ifdef __MVS__
-#define USE_TERMIOS
-#endif
-
-#ifdef Lynx
-#define USE_SYSV_TERMIO
-#endif
-
#ifdef __OpenBSD__
#define USE_TERMINFO
#include <term.h>
#endif
#ifndef USE_TERMINFO /* avoid conflict with configure script */
-#if defined(SCO) || defined(sco) || defined(linux)
+#if defined(__QNX__) || defined(SCO) || defined(sco) || defined(linux)
#define USE_TERMINFO
#endif
#endif
-#if defined(SYSV) || defined(__CYGWIN__)
-#define USE_SYSV_TERMIO
-#elif defined(__QNX__)
-#define USE_TERMINFO
+#if defined(__QNX__)
#include <unix.h>
-#elif !defined(USE_TERMCAP)
-#define USE_TERMCAP
-#endif /* SYSV */
+#endif
/*
* Some OS's may want to use both, like SCO for example. We catch here anyone
@@ -118,82 +62,31 @@
#define USE_TERMINFO
#endif
-#if defined(CSRG_BASED)
-#define USE_TERMIOS
-#endif
-
-#ifndef __CYGWIN__
-#include <sys/ioctl.h>
-#endif
-
-#ifdef USE_SYSV_TERMIO
-# ifndef Lynx
-# include <sys/termio.h>
-# else
-# include <termio.h>
-# endif
-#else /* else not USE_SYSV_TERMIO */
-# ifdef USE_TERMIOS
-# include <termios.h>
-# else /* not USE_TERMIOS */
-# include <sgtty.h>
-# endif /* USE_TERMIOS */
-#endif /* USE_SYSV_TERMIO */
-
-#ifdef SYSV
-#ifdef USE_USG_PTYS
-#include <sys/stream.h>
-#ifndef SVR4
-#include <sys/ptem.h>
-#endif
-#endif
-#endif
-
#include <signal.h>
#include <pwd.h>
-#ifndef X_NOT_STDC_ENV
-#include <stdlib.h>
-#else
-char *getenv();
-#endif
-
-#ifdef USE_SYSV_TERMIO
#ifdef X_NOT_POSIX
#if !defined(SYSV) && !defined(i386)
extern struct passwd *getpwuid(); /* does ANYBODY need this? */
#endif /* SYSV && i386 */
#endif /* X_NOT_POSIX */
+
+#ifndef bzero
#define bzero(s, n) memset(s, 0, n)
-#endif /* USE_SYSV_TERMIO */
+#endif
#ifdef MINIX
-#define USE_SYSV_TERMIO
-#include <sys/termios.h>
-#define termio termios
-#define TCGETA TCGETS
-#define TCSETAW TCSETSW
#ifndef IUCLC
#define IUCLC 0
#endif
#endif
-#ifndef DFT_TERMTYPE
-#define DFT_TERMTYPE "xterm"
-#endif
-
-#ifndef GCC_UNUSED
-#define GCC_UNUSED /* nothing */
-#endif
-
#ifdef __MVS__
-#define ESC(string) "\047" string
+#define ESCAPE(string) "\047" string
#else
-#define ESC(string) "\033" string
+#define ESCAPE(string) "\033" string
#endif
-#define CharOf(ch) ((unsigned char)(ch))
-
#define EMULATIONS 2
#define SUN 1
#define VT100 0
@@ -225,52 +118,49 @@
char *myname;
int shell_type = SHELL_UNKNOWN;
char *getsize[EMULATIONS] = {
- ESC("7") ESC("[r") ESC("[999;999H") ESC("[6n"),
- ESC("[18t"),
+ ESCAPE("7") ESCAPE("[r") ESCAPE("[999;999H") ESCAPE("[6n"),
+ ESCAPE("[18t"),
};
-#if !defined(sun) || defined(SVR4)
-#ifdef TIOCSWINSZ
+#if defined(TIOCSSIZE) && (defined(sun) && !defined(SVR4))
+#elif defined(TIOCSWINSZ)
char *getwsize[EMULATIONS] = { /* size in pixels */
0,
- ESC("[14t"),
+ ESCAPE("[14t"),
};
-#endif /* TIOCSWINSZ */
-#endif /* sun */
+#endif /* sun vs TIOCSWINSZ */
char *restore[EMULATIONS] = {
- ESC("8"),
+ ESCAPE("8"),
0,
};
char *setname = "";
char *setsize[EMULATIONS] = {
0,
- ESC("[8;%s;%st"),
+ ESCAPE("[8;%s;%st"),
};
-#ifdef USE_SYSV_TERMIO
+
+#ifdef USE_ANY_SYSV_TERMIO
struct termio tioorig;
-#else /* not USE_SYSV_TERMIO */
-# ifdef USE_TERMIOS
+#elif defined(USE_TERMIOS)
struct termios tioorig;
-# else /* not USE_TERMIOS */
+#else
struct sgttyb sgorig;
-# endif /* USE_TERMIOS */
-#endif /* USE_SYSV_TERMIO */
+#endif /* USE_ANY_SYSV_TERMIO/USE_TERMIOS */
+
char *size[EMULATIONS] = {
- ESC("[%d;%dR"),
- ESC("[8;%d;%dt"),
+ ESCAPE("[%d;%dR"),
+ ESCAPE("[8;%d;%dt"),
};
char sunname[] = "sunsize";
int tty;
FILE *ttyfp;
-#if !defined(sun) || defined(SVR4)
-#ifdef TIOCSWINSZ
+
+#if defined(TIOCSSIZE) && (defined(sun) && !defined(SVR4))
+#elif defined(TIOCSWINSZ)
char *wsize[EMULATIONS] = {
0,
- ESC("[4;%hd;%hdt"),
+ ESCAPE("[4;%hd;%hdt"),
};
-#endif /* TIOCSWINSZ */
-#endif /* sun */
-
-#include <proto.h>
+#endif /* sun vs TIOCSWINSZ */
static SIGNAL_T onintr (int sig);
static SIGNAL_T resize_timeout (int sig);
@@ -278,6 +168,8 @@
static void Usage (void);
static void readstring (FILE *fp, char *buf, char *str);
+#undef US /* may conflict with curses.h */
+
#ifdef USE_TERMCAP
#ifdef HAVE_TERMCAP_H
#include <termcap.h>
@@ -311,30 +203,24 @@
struct passwd *pw;
int i;
int rows, cols;
-#ifdef USE_SYSV_TERMIO
+#ifdef USE_ANY_SYSV_TERMIO
struct termio tio;
-#else /* not USE_SYSV_TERMIO */
-#ifdef USE_TERMIOS
+#elif defined(USE_TERMIOS)
struct termios tio;
-#else /* not USE_TERMIOS */
+#else
struct sgttyb sg;
-#endif /* USE_TERMIOS */
-#endif /* USE_SYSV_TERMIO */
+#endif /* USE_ANY_SYSV_TERMIO/USE_TERMIOS */
#ifdef USE_TERMCAP
int ok_tcap = 1;
char termcap [TERMCAP_SIZE];
char newtc [TERMCAP_SIZE];
#endif /* USE_TERMCAP */
char buf[BUFSIZ];
-#if defined(sun) && !defined(SVR4)
-#ifdef TIOCSSIZE
+#if defined(TIOCSSIZE) && (defined(sun) && !defined(SVR4))
struct ttysize ts;
-#endif /* TIOCSSIZE */
-#else /* sun */
-#ifdef TIOCSWINSZ
+#elif defined(TIOCSWINSZ)
struct winsize ws;
-#endif /* TIOCSWINSZ */
-#endif /* sun */
+#endif /* sun vs TIOCSWINSZ */
char *name_of_tty;
#ifdef CANT_OPEN_DEV_TTY
extern char *ttyname();
@@ -424,7 +310,7 @@
}
#endif /* USE_TERMINFO */
-#ifdef USE_SYSV_TERMIO
+#ifdef USE_ANY_SYSV_TERMIO
ioctl (tty, TCGETA, &tioorig);
tio = tioorig;
tio.c_iflag &= ~(ICRNL | IUCLC);
@@ -432,8 +318,7 @@
tio.c_cflag |= CS8;
tio.c_cc[VMIN] = 6;
tio.c_cc[VTIME] = 1;
-#else /* else not USE_SYSV_TERMIO */
-#if defined(USE_TERMIOS)
+#elif defined(USE_TERMIOS)
tcgetattr(tty, &tioorig);
tio = tioorig;
tio.c_iflag &= ~ICRNL;
@@ -446,20 +331,17 @@
sg = sgorig;
sg.sg_flags |= RAW;
sg.sg_flags &= ~ECHO;
-#endif /* USE_TERMIOS */
-#endif /* USE_SYSV_TERMIO */
+#endif /* USE_ANY_SYSV_TERMIO/USE_TERMIOS */
signal(SIGINT, onintr);
signal(SIGQUIT, onintr);
signal(SIGTERM, onintr);
-#ifdef USE_SYSV_TERMIO
+#ifdef USE_ANY_SYSV_TERMIO
ioctl (tty, TCSETAW, &tio);
-#else /* not USE_SYSV_TERMIO */
-#ifdef USE_TERMIOS
+#elif defined(USE_TERMIOS)
tcsetattr(tty, TCSADRAIN, &tio);
#else /* not USE_TERMIOS */
ioctl (tty, TIOCSETP, &sg);
-#endif /* USE_TERMIOS */
-#endif /* USE_SYSV_TERMIO */
+#endif /* USE_ANY_SYSV_TERMIO/USE_TERMIOS */
if (argc == 2) {
sprintf (buf, setsize[emu], argv[0], argv[1]);
@@ -473,17 +355,14 @@
}
if(restore[emu])
write(tty, restore[emu], strlen(restore[emu]));
-#if defined(sun) && !defined(SVR4)
-#ifdef TIOCGSIZE
+#if defined(TIOCSSIZE) && (defined(sun) && !defined(SVR4))
/* finally, set the tty's window size */
if (ioctl (tty, TIOCGSIZE, &ts) != -1) {
ts.ts_lines = rows;
ts.ts_cols = cols;
ioctl (tty, TIOCSSIZE, &ts);
}
-#endif /* TIOCGSIZE */
-#else /* sun */
-#ifdef TIOCGWINSZ
+#elif defined(TIOCSWINSZ)
/* finally, set the tty's window size */
if(getwsize[emu]) {
/* get the window size in pixels */
@@ -509,18 +388,15 @@
ws.ws_col = cols;
ioctl (tty, TIOCSWINSZ, &ws);
}
-#endif /* TIOCGWINSZ */
-#endif /* sun */
+#endif /* sun vs TIOCSWINSZ */
-#ifdef USE_SYSV_TERMIO
+#ifdef USE_ANY_SYSV_TERMIO
ioctl (tty, TCSETAW, &tioorig);
-#else /* not USE_SYSV_TERMIO */
-#ifdef USE_TERMIOS
+#elif defined(USE_TERMIOS)
tcsetattr(tty, TCSADRAIN, &tioorig);
#else /* not USE_TERMIOS */
ioctl (tty, TIOCSETP, &sgorig);
-#endif /* USE_TERMIOS */
-#endif /* USE_SYSV_TERMIO */
+#endif /* USE_ANY_SYSV_TERMIO/USE_TERMIOS */
signal(SIGINT, SIG_DFL);
signal(SIGQUIT, SIG_DFL);
signal(SIGTERM, SIG_DFL);
@@ -610,7 +486,7 @@
setitimer(ITIMER_REAL, &it, (struct itimerval *)NULL);
#endif
if ((c = getc(fp)) == 0233) { /* meta-escape, CSI */
- *buf++ = c = ESC("")[0];
+ *buf++ = c = ESCAPE("")[0];
*buf++ = '[';
} else {
*buf++ = c;
@@ -651,14 +527,12 @@
static SIGNAL_T
onintr(int sig GCC_UNUSED)
{
-#ifdef USE_SYSV_TERMIO
+#ifdef USE_ANY_SYSV_TERMIO
ioctl (tty, TCSETAW, &tioorig);
-#else /* not USE_SYSV_TERMIO */
-#ifdef USE_TERMIOS
+#elif defined(USE_TERMIOS)
tcsetattr (tty, TCSADRAIN, &tioorig);
#else /* not USE_TERMIOS */
ioctl (tty, TIOCSETP, &sgorig);
-#endif /* use TERMIOS */
-#endif /* USE_SYSV_TERMIO */
+#endif /* USE_ANY_SYSV_TERMIO/USE_TERMIOS */
exit(1);
}
Index: screen.c
--- xterm-148a/screen.c Fri Sep 22 06:42:08 2000
+++ xterm-149/screen.c Wed Nov 29 06:34:33 2000
@@ -63,63 +63,9 @@
#include <error.h>
#include <data.h>
#include <xcharmouse.h>
+#include <xterm_io.h>
#include <signal.h>
-
-#ifdef SVR4
-#include <termios.h>
-#elif !defined(__CYGWIN__)
-#include <sys/ioctl.h>
-#endif
-
-#if defined(__CYGWIN__) && !defined(TIOCSPGRP)
-#include <termios.h>
-#define TIOCSPGRP (_IOW('t', 118, pid_t))
-#endif
-
-#ifdef __hpux
-#include <sys/termio.h>
-#endif
-
-#ifdef SYSV
-#if !defined(DGUX) /* Intel DG/ux uses termios.h */
-#include <sys/termio.h>
-#endif /* DGUX */
-#ifdef USE_USG_PTYS
-#include <sys/stream.h> /* get typedef used in ptem.h */
-#include <sys/ptem.h>
-#endif
-#elif defined(sun) && !defined(SVR4)
-#include <sys/ttycom.h>
-#ifdef TIOCSWINSZ
-#undef TIOCSSIZE
-#endif
-#endif
-
-#ifdef MINIX
-#include <termios.h>
-#endif
-
-#ifdef ISC
-#ifndef SYSV
-#include <sys/termio.h>
-#endif
-#define TIOCGPGRP TCGETPGRP
-#define TIOCSPGRP TCSETPGRP
-#endif
-
-#ifdef __EMX__
-extern int ptioctl(int fd, int func, void* data);
-#define ioctl ptioctl
-#define TIOCSWINSZ 113
-#define TIOCGWINSZ 117
-struct winsize {
- unsigned short ws_row; /* rows, in characters */
- unsigned short ws_col; /* columns, in characters */
- unsigned short ws_xpixel; /* horizontal size, pixels */
- unsigned short ws_ypixel; /* vertical size, pixels */
-};
-#endif
/*
* Allocates memory for a 2-dimensional array of chars and returns a pointer
Index: xterm.h
--- xterm-148a/xterm.h Thu Dec 7 05:12:34 2000
+++ xterm-149/xterm.h Thu Dec 7 05:13:49 2000
@@ -88,6 +88,10 @@
#define HAVE_TCGETATTR 1
#endif
+#if defined(__EMX__) || defined(__CYGWIN__) || defined(SCO) || defined(sco)
+#define USE_TERMCAP 1
+#endif
+
#if defined(UTMP)
#define HAVE_UTMP 1
#endif
Index: xterm.log.html
--- xterm-148a/xterm.log.html Wed Dec 6 21:50:06 2000
+++ xterm-149/xterm.log.html Thu Dec 7 04:58:26 2000
@@ -20,7 +20,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF *
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. *
*****************************************************************************
- $XFree86: xc/programs/xterm/xterm.log.html,v 1.61 2000/12/07 02:50:06 dickey Exp $
+ $XFree86: xc/programs/xterm/xterm.log.html,v 1.60 2000/11/01 01:12:44 dawes Exp $
-->
<HTML>
<HEAD>
@@ -196,6 +196,21 @@
<H1><A NAME="xterm_149">Patch #149 - 2000/12/6 - XFree86 4.0.1h</A></H1>
<ul>
+ <li>restructured includes for <code>termios.h</code>,
+ <code>termio.h</code> and related definitions for main.c, os2main.c,
+ screen.c and resize.c so they will share equivalent definitions in a
+ new header <code>xterm_io.h</code>. This is intended to solve some
+ problems mainly for HPUX which appear to arise from inconsistent
+ definitions for SIGWINCH- and HAS_LTCHARS-related symbols (reports
+ by Bruno Betro, Jeremie Petit and Clint Olsen).
+
+ <li>improve usability of double-width fonts by allowing normal fonts
+ to be given as double-width (from a patch by Fabrice Bellard
+ <bellard@email.enst.fr>).
+
+ <li>correct a few compiler warnings in TRACE() macros for
+ signed/unsigned variable differences (reported by Clint Olsen).
+
<li>expanded description of environment variables in manual-page.
<li>modify OPT_TCAP_QUERY feature to always return the termcap or