summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEgbert Eich <eich@suse.de>2004-10-18 14:21:46 +0000
committerEgbert Eich <eich@suse.de>2004-10-18 14:21:46 +0000
commitb38b9a7731430359f10ba74706fc6d4c786d2d36 (patch)
treeded1e07d28b054f5a138c78e3b0fa31730bf9f2d
parent7da0d180d6852916e5dca44842ee88e7d8429e6e (diff)
platforms. Compress all font encodings (Stefan Dirsch). Fixed warnings. Turn on forwarding XNSpotLocation event to XIM server in OffTheSpot and Root mode (bugzilla #1580, James Su). Added another compose key combination for the Euro symbol (Stefan Dirsch). Added support for UTF-8 in ja_JP, ko_KR and zh_TW locales (Mike Fabian). Changed default encoding for ru from KOI8-R to ISO8859-5 (Mike Fabian). This is the encoding that is also used by glibc. We may break other libcs - lets see who complains. Added explanation for DESTDIR to install to a different directory than /. Added some early bailouts to atiprobe if PCI structure pointer is NULL to prevent sig11. XV support doesn't depend on 2D acceleration any more. This patch removes this limitation from the NSC driver. This is a patch that I have committed to XFree86 a while ago but never ported over to X.Org. Matthieu Herrb contributed some build fixes. Fixing SetDPMSTimers() so that DPMS*Time == 0 disables the appropriate timer. This takes advantage of the fact that TimerSet() with a timeout argument 0 behaves like TimerCanel(). Use /dev/xconsole (named pipe) or devpts for system logger (Werner Fink). Create missing links for backward compatibility to XFree86 (Stefan Dirsch). Changed comment to mention xorg. Changed cursor for the 'kill' action from XC_draped_box to XC_Pirate. If you don't like it we can change it back (original author unkown). Added 'pic' to the man page rendering command pipeline (Werner Fink). Added missing return value (Stefan Dirsch, Roland Mainz)
-rw-r--r--xconsole.c69
1 files changed, 43 insertions, 26 deletions
diff --git a/xconsole.c b/xconsole.c
index 0257213..dc5ed8f 100644
--- a/xconsole.c
+++ b/xconsole.c
@@ -146,24 +146,36 @@ static XrmOptionDescRec options[] = {
#include <os2.h>
#endif
-#ifndef USE_FILE
-#include <sys/ioctl.h>
-#ifdef hpux
-#include <termios.h>
-#endif
-#ifdef SVR4
-#include <termios.h>
-#include <sys/stropts.h> /* for I_PUSH */
-#ifdef sun
-#include <sys/strredir.h>
-#endif
+#ifdef linux
+#define USE_FILE
+#define FILE_NAME "/dev/xconsole"
+# if defined (__GLIBC__) && ((__GLIBC__ > 2) || (__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 1))
+/*
+ * Linux distribution based on glibc 2.1 and higher should use
+ * devpts. This is the fallback if open file FILE_NAME fails.
+ * <werner@suse.de>
+ */
+# define USE_PTS
+# endif
#endif
-#if defined(TIOCCONS) || defined(SRIOCSREDIR) || defined(Lynx)
-#define USE_PTY
+#if !defined (USE_FILE) || defined (linux)
+# include <sys/ioctl.h>
+# ifdef hpux
+# include <termios.h>
+# endif
+# if defined (SVR4) || defined (USE_PTS)
+# include <termios.h>
+# include <sys/stropts.h> /* for I_PUSH */
+# ifdef sun
+# include <sys/strredir.h>
+# endif
+# endif
+# if defined(TIOCCONS) || defined(SRIOCSREDIR) || defined(Lynx)
+# define USE_PTY
static int tty_fd, pty_fd;
static char ttydev[64], ptydev[64];
-#endif
+# endif
#endif
#if (defined(SVR4) && !defined(sun)) || (defined(SYSV) && defined(i386))
@@ -200,15 +212,19 @@ OpenConsole(void)
/* must be owner and have read/write permission */
#if !defined(__NetBSD__) && !defined(__OpenBSD__) && !defined(Lynx) && !defined(__UNIXOS2__)
struct stat sbuf;
-
+# if !defined (linux)
if (!stat("/dev/console", &sbuf) &&
(sbuf.st_uid == getuid()) &&
!access("/dev/console", R_OK|W_OK))
+# endif
#endif
{
#ifdef USE_FILE
+# ifdef linux
+ if (!stat(FILE_NAME, &sbuf))
+# endif
input = fopen (FILE_NAME, "r");
-#ifdef __UNIXOS2__
+# ifdef __UNIXOS2__
if (input)
{
ULONG arg = 1,arglen;
@@ -221,17 +237,18 @@ OpenConsole(void)
input = 0;
}
}
+# endif
#endif
-#endif
+
#ifdef USE_PTY
- if (get_pty (&pty_fd, &tty_fd, ttydev, ptydev) == 0)
+ if (!input && get_pty (&pty_fd, &tty_fd, ttydev, ptydev) == 0)
{
-#ifdef TIOCCONS
+# ifdef TIOCCONS
int on = 1;
if (ioctl (tty_fd, TIOCCONS, (char *) &on) != -1)
input = fdopen (pty_fd, "r");
-#else
-#ifndef Lynx
+# else
+# ifndef Lynx
int consfd = open("/dev/console", O_RDONLY);
if (consfd >= 0)
{
@@ -239,7 +256,7 @@ OpenConsole(void)
input = fdopen (pty_fd, "r");
close(consfd);
}
-#else
+# else
if (newconsole(tty_fd) < 0)
perror("newconsole");
else
@@ -247,10 +264,10 @@ OpenConsole(void)
input = fdopen (pty_fd, "r");
atexit(RestoreConsole);
}
-#endif
-#endif
+# endif
+# endif
}
-#endif
+#endif /* USE_PTY */
}
#ifdef USE_OSM
/* Don't have to be owner of /dev/console when using /dev/osm. */
@@ -775,7 +792,7 @@ ScrollLine(Widget w)
static int
get_pty(int *pty, int *tty, char *ttydev, char *ptydev)
{
-#ifdef SVR4
+#if defined (SVR4) || defined (USE_PTS)
if ((*pty = open ("/dev/ptmx", O_RDWR)) < 0)
return 1;
grantpt(*pty);