merge xinit 1.0.6
This commit is contained in:
parent
7fd4ac2fb1
commit
59ec33559d
@ -64,6 +64,7 @@ MANDEFS = \
|
||||
-D__miscmansuffix__=$(MISC_MAN_SUFFIX) \
|
||||
-D__XSERVERNAME__=Xorg -D__XCONFIGFILE__=xorg.conf \
|
||||
-D__xinitdir__=$(XINITDIR) \
|
||||
-D__bindir__=$(bindir) \
|
||||
-DSHELL_CMD=$(SHELL_CMD) $(ARCHMANDEFS)
|
||||
|
||||
SUFFIXES = .$(APP_MAN_SUFFIX) .man
|
||||
@ -100,5 +101,9 @@ xinitrc_DATA = xinitrc
|
||||
CLEANFILES = xinitrc startx $(appman_DATA)
|
||||
|
||||
EXTRA_DIST = xinitrc.cpp startx.cpp $(appman_PRE) \
|
||||
startx.cmd xinitrc.cmd xinit.def
|
||||
startx.cmd xinitrc.cmd xinit.def ChangeLog autogen.sh
|
||||
|
||||
ChangeLog:
|
||||
(GIT_DIR=$(top_srcdir)/.git git-log > .changelog.tmp && mv .changelog.tmp ChangeLog; rm -f .changelog.tmp) || (touch ChangeLog; echo 'git directory not found: installing possibly empty changelog.' >&2)
|
||||
|
||||
dist-hook: ChangeLog
|
||||
|
@ -269,6 +269,7 @@ MANDEFS = \
|
||||
-D__miscmansuffix__=$(MISC_MAN_SUFFIX) \
|
||||
-D__XSERVERNAME__=Xorg -D__XCONFIGFILE__=xorg.conf \
|
||||
-D__xinitdir__=$(XINITDIR) \
|
||||
-D__bindir__=$(bindir) \
|
||||
-DSHELL_CMD=$(SHELL_CMD) $(ARCHMANDEFS)
|
||||
|
||||
SUFFIXES = .$(APP_MAN_SUFFIX) .man
|
||||
@ -292,7 +293,7 @@ SCRIPTDEFS = \
|
||||
xinitrc_DATA = xinitrc
|
||||
CLEANFILES = xinitrc startx $(appman_DATA)
|
||||
EXTRA_DIST = xinitrc.cpp startx.cpp $(appman_PRE) \
|
||||
startx.cmd xinitrc.cmd xinit.def
|
||||
startx.cmd xinitrc.cmd xinit.def ChangeLog autogen.sh
|
||||
|
||||
all: config.h
|
||||
$(MAKE) $(AM_MAKEFLAGS) all-am
|
||||
@ -543,6 +544,9 @@ distdir: $(DISTFILES)
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
$(MAKE) $(AM_MAKEFLAGS) \
|
||||
top_distdir="$(top_distdir)" distdir="$(distdir)" \
|
||||
dist-hook
|
||||
-find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
|
||||
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
|
||||
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
|
||||
@ -727,8 +731,8 @@ uninstall-am: uninstall-appmanDATA uninstall-binPROGRAMS \
|
||||
|
||||
.PHONY: CTAGS GTAGS all all-am am--refresh check check-am clean \
|
||||
clean-binPROGRAMS clean-generic ctags dist dist-all dist-bzip2 \
|
||||
dist-gzip dist-shar dist-tarZ dist-zip distcheck distclean \
|
||||
distclean-compile distclean-generic distclean-hdr \
|
||||
dist-gzip dist-hook dist-shar dist-tarZ dist-zip distcheck \
|
||||
distclean distclean-compile distclean-generic distclean-hdr \
|
||||
distclean-tags distcleancheck distdir distuninstallcheck dvi \
|
||||
dvi-am html html-am info info-am install install-am \
|
||||
install-appmanDATA install-binPROGRAMS install-binSCRIPTS \
|
||||
@ -750,6 +754,11 @@ xinitrc: xinitrc.cpp
|
||||
|
||||
startx: startx.cpp Makefile
|
||||
$(RAWCPP) $(SCRIPTDEFS) < $(srcdir)/startx.cpp | $(CPP_SED_MAGIC) > $@
|
||||
|
||||
ChangeLog:
|
||||
(GIT_DIR=$(top_srcdir)/.git git-log > .changelog.tmp && mv .changelog.tmp ChangeLog; rm -f .changelog.tmp) || (touch ChangeLog; echo 'git directory not found: installing possibly empty changelog.' >&2)
|
||||
|
||||
dist-hook: ChangeLog
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
|
@ -6,6 +6,9 @@
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
/* Define to 1 if you have the `killpg' function. */
|
||||
#undef HAVE_KILLPG
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
|
123
app/xinit/configure
vendored
123
app/xinit/configure
vendored
@ -1,6 +1,6 @@
|
||||
#! /bin/sh
|
||||
# Guess values for system-dependent variables and create Makefiles.
|
||||
# Generated by GNU Autoconf 2.59 for xinit 1.0.3.
|
||||
# Generated by GNU Autoconf 2.59 for xinit 1.0.6.
|
||||
#
|
||||
# Report bugs to <https://bugs.freedesktop.org/enter_bug.cgi?product=xorg>.
|
||||
#
|
||||
@ -269,8 +269,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
|
||||
# Identity of this package.
|
||||
PACKAGE_NAME='xinit'
|
||||
PACKAGE_TARNAME='xinit'
|
||||
PACKAGE_VERSION='1.0.3'
|
||||
PACKAGE_STRING='xinit 1.0.3'
|
||||
PACKAGE_VERSION='1.0.6'
|
||||
PACKAGE_STRING='xinit 1.0.6'
|
||||
PACKAGE_BUGREPORT='https://bugs.freedesktop.org/enter_bug.cgi?product=xorg'
|
||||
|
||||
# Factoring default headers for most tests.
|
||||
@ -791,7 +791,7 @@ if test "$ac_init_help" = "long"; then
|
||||
# Omit some internal or obsolete options to make the list less imposing.
|
||||
# This message is too long to be a string in the A/UX 3.1 sh.
|
||||
cat <<_ACEOF
|
||||
\`configure' configures xinit 1.0.3 to adapt to many kinds of systems.
|
||||
\`configure' configures xinit 1.0.6 to adapt to many kinds of systems.
|
||||
|
||||
Usage: $0 [OPTION]... [VAR=VALUE]...
|
||||
|
||||
@ -857,7 +857,7 @@ fi
|
||||
|
||||
if test -n "$ac_init_help"; then
|
||||
case $ac_init_help in
|
||||
short | recursive ) echo "Configuration of xinit 1.0.3:";;
|
||||
short | recursive ) echo "Configuration of xinit 1.0.6:";;
|
||||
esac
|
||||
cat <<\_ACEOF
|
||||
|
||||
@ -998,7 +998,7 @@ fi
|
||||
test -n "$ac_init_help" && exit 0
|
||||
if $ac_init_version; then
|
||||
cat <<\_ACEOF
|
||||
xinit configure 1.0.3
|
||||
xinit configure 1.0.6
|
||||
generated by GNU Autoconf 2.59
|
||||
|
||||
Copyright (C) 2003 Free Software Foundation, Inc.
|
||||
@ -1012,7 +1012,7 @@ cat >&5 <<_ACEOF
|
||||
This file contains any messages produced by compilers while
|
||||
running configure, to aid debugging if configure makes a mistake.
|
||||
|
||||
It was created by xinit $as_me 1.0.3, which was
|
||||
It was created by xinit $as_me 1.0.6, which was
|
||||
generated by GNU Autoconf 2.59. Invocation command line was
|
||||
|
||||
$ $0 $@
|
||||
@ -1655,7 +1655,7 @@ fi
|
||||
|
||||
# Define the identity of the package.
|
||||
PACKAGE='xinit'
|
||||
VERSION='1.0.3'
|
||||
VERSION='1.0.6'
|
||||
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
@ -4296,6 +4296,109 @@ fi
|
||||
|
||||
|
||||
|
||||
for ac_func in killpg
|
||||
do
|
||||
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||
echo "$as_me:$LINENO: checking for $ac_func" >&5
|
||||
echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
|
||||
if eval "test \"\${$as_ac_var+set}\" = set"; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
|
||||
For example, HP-UX 11i <limits.h> declares gettimeofday. */
|
||||
#define $ac_func innocuous_$ac_func
|
||||
|
||||
/* System header to define __stub macros and hopefully few prototypes,
|
||||
which can conflict with char $ac_func (); below.
|
||||
Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|
||||
<limits.h> exists even on freestanding compilers. */
|
||||
|
||||
#ifdef __STDC__
|
||||
# include <limits.h>
|
||||
#else
|
||||
# include <assert.h>
|
||||
#endif
|
||||
|
||||
#undef $ac_func
|
||||
|
||||
/* Override any gcc2 internal prototype to avoid an error. */
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
/* We use char because int might match the return type of a gcc2
|
||||
builtin and then its argument prototype would still apply. */
|
||||
char $ac_func ();
|
||||
/* The GNU C library defines this for functions which it implements
|
||||
to always fail with ENOSYS. Some functions are actually named
|
||||
something starting with __ and the normal name is an alias. */
|
||||
#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
|
||||
choke me
|
||||
#else
|
||||
char (*f) () = $ac_func;
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
return f != $ac_func;
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext conftest$ac_exeext
|
||||
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
|
||||
(eval $ac_link) 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } &&
|
||||
{ ac_try='test -z "$ac_c_werror_flag"
|
||||
|| test ! -s conftest.err'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; } &&
|
||||
{ ac_try='test -s conftest$ac_exeext'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
eval "$as_ac_var=yes"
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
eval "$as_ac_var=no"
|
||||
fi
|
||||
rm -f conftest.err conftest.$ac_objext \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
fi
|
||||
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
|
||||
echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
|
||||
if test `eval echo '${'$as_ac_var'}'` = yes; then
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
|
||||
|
||||
# Build options
|
||||
DEFAULT_XRDB=xrdb
|
||||
@ -5213,7 +5316,7 @@ _ASBOX
|
||||
} >&5
|
||||
cat >&5 <<_CSEOF
|
||||
|
||||
This file was extended by xinit $as_me 1.0.3, which was
|
||||
This file was extended by xinit $as_me 1.0.6, which was
|
||||
generated by GNU Autoconf 2.59. Invocation command line was
|
||||
|
||||
CONFIG_FILES = $CONFIG_FILES
|
||||
@ -5276,7 +5379,7 @@ _ACEOF
|
||||
|
||||
cat >>$CONFIG_STATUS <<_ACEOF
|
||||
ac_cs_version="\\
|
||||
xinit config.status 1.0.3
|
||||
xinit config.status 1.0.6
|
||||
configured by $0, generated by GNU Autoconf 2.59,
|
||||
with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
dnl Copyright 2005 Red Hat, Inc.
|
||||
dnl
|
||||
dnl Permission to use, copy, modify, distribute, and sell this software and its
|
||||
@ -22,7 +21,7 @@ dnl
|
||||
dnl Process this file with autoconf to create configure.
|
||||
|
||||
AC_PREREQ([2.57])
|
||||
AC_INIT(xinit,[1.0.3], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],xinit)
|
||||
AC_INIT(xinit,[1.0.6], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],xinit)
|
||||
AM_INIT_AUTOMAKE([dist-bzip2])
|
||||
AM_MAINTAINER_MODE
|
||||
|
||||
@ -37,6 +36,8 @@ AC_CANONICAL_HOST
|
||||
AC_TYPE_SIGNAL
|
||||
AC_FUNC_FORK
|
||||
|
||||
AC_CHECK_FUNCS([killpg])
|
||||
|
||||
m4_ifdef([AS_HELP_STRING], , [m4_define([AS_HELP_STRING], m4_defn([AC_HELP_STRING]))])
|
||||
|
||||
# Build options
|
||||
|
@ -170,7 +170,6 @@ fi
|
||||
|
||||
removelist=
|
||||
|
||||
#if defined(HAS_COOKIE_MAKER) && defined(MK_COOKIE)
|
||||
XCOMM set up default Xauth info for this machine
|
||||
case `uname` in
|
||||
Linux*)
|
||||
@ -186,7 +185,15 @@ Linux*)
|
||||
esac
|
||||
|
||||
authdisplay=${display:-:0}
|
||||
#if defined(HAS_COOKIE_MAKER) && defined(MK_COOKIE)
|
||||
mcookie=`MK_COOKIE`
|
||||
#else
|
||||
mcookie=`dd if=/dev/random bs=16 count=1 2>/dev/null | hexdump -e \\"%08x\\"`
|
||||
if test x"$mcookie" = x; then
|
||||
echo "Couldn't create cookie"
|
||||
exit 1
|
||||
fi
|
||||
#endif
|
||||
dummy=0
|
||||
|
||||
XCOMM create a file with auth information for the server. ':0' is a dummy.
|
||||
@ -216,8 +223,6 @@ EOF
|
||||
fi
|
||||
done
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(__SCO__) || defined(__UNIXWARE__)
|
||||
if [ "$REMOTE_SERVER" = "TRUE" ]; then
|
||||
exec SHELL_CMD ${client}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* $Xorg: xinit.c,v 1.5 2001/02/09 02:05:49 xorgcvs Exp $ */
|
||||
/* $XdotOrg: xc/programs/xinit/xinit.c,v 1.4 2005/10/04 01:27:34 ajax Exp $ */
|
||||
/* $OpenBSD: xinit.c,v 1.2 2006/11/26 17:17:57 matthieu Exp $ */
|
||||
/* $OpenBSD: xinit.c,v 1.3 2007/09/15 17:12:01 matthieu Exp $ */
|
||||
|
||||
/*
|
||||
|
||||
@ -35,8 +35,10 @@ in this Software without prior written authorization from The Open Group.
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xos.h>
|
||||
#include <X11/Xatom.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/param.h>
|
||||
|
||||
#ifdef X_POSIX_C_SOURCE
|
||||
@ -79,25 +81,26 @@ char **envsave; /* to circumvent an UNIXOS2 problem */
|
||||
#include <stdlib.h>
|
||||
extern char **environ;
|
||||
char **newenviron = NULL;
|
||||
char **newenvironlast = NULL;
|
||||
|
||||
#ifndef SHELL
|
||||
#define SHELL "sh"
|
||||
#endif
|
||||
|
||||
#if !defined(HAS_VFORK) /* Imake */ && !defined(HAVE_WORKING_VFORK) /* autoconf*/
|
||||
#ifndef vfork
|
||||
#define vfork() fork()
|
||||
#endif
|
||||
#ifndef HAVE_WORKING_VFORK
|
||||
# ifndef vfork
|
||||
# define vfork() fork()
|
||||
# endif
|
||||
#else
|
||||
#if (defined(sun) && !defined(SVR4)) || defined(HAVE_VFORK_H)
|
||||
#include <vfork.h>
|
||||
#endif
|
||||
# ifdef HAVE_VFORK_H
|
||||
# include <vfork.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* A/UX setpgid incorrectly removes the controlling terminal.
|
||||
Per Posix, only setsid should do that. */
|
||||
#if !defined(X_NOT_POSIX) && !defined(macII)
|
||||
#define setpgrp setpgid
|
||||
#ifdef macII
|
||||
#define setpgid setpgrp
|
||||
#endif
|
||||
|
||||
#ifdef __UNIXOS2__
|
||||
@ -110,12 +113,12 @@ char **newenviron = NULL;
|
||||
#define Execvpe(path, argv, envp) execvp(path, argv)
|
||||
#endif
|
||||
|
||||
char *bindir = BINDIR;
|
||||
char *server_names[] = {
|
||||
const char *bindir = BINDIR;
|
||||
const char * const server_names[] = {
|
||||
#if defined(ultrix) && defined(mips)
|
||||
"Xdec Digital color display on DECstation",
|
||||
#endif
|
||||
#ifdef sun /* Sun */
|
||||
#if defined(sun) && !defined(XORG) /* Sun */
|
||||
"Xsun Sun BW2, CG2, CG3, CG4, or CG6 on Sun 2, 3, 4, or 386i",
|
||||
"Xsunmono Sun BW2 on Sun 2, 3, 4, or 386i ",
|
||||
"Xsun24 Sun BW2, CG2, CG3, CG4, CG6, or CG8 on Sun 4",
|
||||
@ -133,14 +136,16 @@ char *server_names[] = {
|
||||
"XFree86 XFree86 displays",
|
||||
#endif
|
||||
#ifdef XORG
|
||||
"Xorg X.Org displays",
|
||||
"Xorg Common X server for most displays",
|
||||
#endif
|
||||
#ifdef __DARWIN__
|
||||
"XDarwin Darwin/Mac OS X IOKit displays",
|
||||
"XDarwinQuartz Mac OS X Quartz displays",
|
||||
"XDarwinStartup Auto-select between XDarwin and XDarwinQuartz",
|
||||
#endif
|
||||
|
||||
"Xvfb Virtual frame buffer",
|
||||
"Xnest X server nested in a window on another X server",
|
||||
"Xephyr kdrive-based nested X server",
|
||||
NULL};
|
||||
|
||||
#ifndef XINITRC
|
||||
@ -180,9 +185,7 @@ union wait status;
|
||||
#endif /* SYSV */
|
||||
int serverpid = -1;
|
||||
int clientpid = -1;
|
||||
#ifndef X_NOT_POSIX
|
||||
volatile int gotSignal = 0;
|
||||
#endif
|
||||
|
||||
static void Execute ( char **vec, char **envp );
|
||||
static Bool waitforserver ( void );
|
||||
@ -197,43 +200,13 @@ static void Error ( char *fmt, ... );
|
||||
|
||||
#ifdef RETSIGTYPE /* autoconf AC_TYPE_SIGNAL */
|
||||
# define SIGVAL RETSIGTYPE
|
||||
#else /* Imake */
|
||||
#ifdef SIGNALRETURNSINT
|
||||
#define SIGVAL int
|
||||
#else
|
||||
#define SIGVAL void
|
||||
#endif
|
||||
#endif /* RETSIGTYPE */
|
||||
|
||||
#ifdef X_NOT_POSIX
|
||||
/* Can't use Error() in signal handlers */
|
||||
#ifndef STDERR_FILENO
|
||||
#define WRITES(s) write(STDERR_FILENO, (s), strlen(s))
|
||||
#else
|
||||
#define WRITES(s) write(fileno(stderr), (s), strlen(s))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static SIGVAL
|
||||
sigCatch(int sig)
|
||||
{
|
||||
#ifdef X_NOT_POSIX
|
||||
char buf[1024];
|
||||
|
||||
signal(SIGTERM, SIG_IGN);
|
||||
signal(SIGQUIT, SIG_IGN);
|
||||
signal(SIGINT, SIG_IGN);
|
||||
signal(SIGHUP, SIG_IGN);
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
snprintf(buf, sizeof buf, "%s: unexpected signal %d\r\n",
|
||||
program, sig);
|
||||
WRITES(buf);
|
||||
shutdown();
|
||||
_exit(ERR_EXIT);
|
||||
#else
|
||||
/* On system with POSIX signals, just interrupt the system call */
|
||||
gotSignal = sig;
|
||||
#endif
|
||||
}
|
||||
|
||||
static SIGVAL
|
||||
@ -283,9 +256,7 @@ main(int argc, char *argv[], char *envp[])
|
||||
int client_given = 0, server_given = 0;
|
||||
int client_args_given = 0, server_args_given = 0;
|
||||
int start_of_client_args, start_of_server_args;
|
||||
#ifndef X_NOT_POSIX
|
||||
struct sigaction sa;
|
||||
#endif
|
||||
|
||||
#ifdef __UNIXOS2__
|
||||
envsave = envp; /* circumvent an EMX problem */
|
||||
@ -475,13 +446,7 @@ main(int argc, char *argv[], char *envp[])
|
||||
#ifdef SIGCHLD
|
||||
signal(SIGCHLD, SIG_DFL); /* Insurance */
|
||||
#endif
|
||||
#ifdef X_NOT_POSIX
|
||||
signal(SIGTERM, sigCatch);
|
||||
signal(SIGQUIT, sigCatch);
|
||||
signal(SIGINT, sigCatch);
|
||||
signal(SIGHUP, sigCatch);
|
||||
signal(SIGPIPE, sigCatch);
|
||||
#else
|
||||
|
||||
/* Let those signal interrupt the wait() call in the main loop */
|
||||
memset(&sa, 0, sizeof sa);
|
||||
sa.sa_handler = sigCatch;
|
||||
@ -493,16 +458,14 @@ main(int argc, char *argv[], char *envp[])
|
||||
sigaction(SIGINT, &sa, NULL);
|
||||
sigaction(SIGHUP, &sa, NULL);
|
||||
sigaction(SIGPIPE, &sa, NULL);
|
||||
#endif
|
||||
|
||||
signal(SIGALRM, sigAlarm);
|
||||
signal(SIGUSR1, sigUsr1);
|
||||
if (startServer(server) > 0
|
||||
&& startClient(client) > 0) {
|
||||
pid = -1;
|
||||
while (pid != clientpid && pid != serverpid
|
||||
#ifndef X_NOT_POSIX
|
||||
&& gotSignal == 0
|
||||
#endif
|
||||
)
|
||||
pid = wait(NULL);
|
||||
}
|
||||
@ -513,12 +476,12 @@ main(int argc, char *argv[], char *envp[])
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
|
||||
shutdown();
|
||||
#ifndef X_NOT_POSIX
|
||||
|
||||
if (gotSignal != 0) {
|
||||
Error("unexpected signal %d.\n", gotSignal);
|
||||
exit(ERR_EXIT);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (serverpid < 0 )
|
||||
Fatal("Server error.\n");
|
||||
if (clientpid < 0)
|
||||
@ -596,32 +559,21 @@ processTimeout(int timeout, char *string)
|
||||
static int
|
||||
startServer(char *server[])
|
||||
{
|
||||
#if !defined(X_NOT_POSIX)
|
||||
sigset_t mask, old;
|
||||
#else
|
||||
int old;
|
||||
#endif
|
||||
#ifdef __UNIXOS2__
|
||||
sigset_t pendings;
|
||||
#endif
|
||||
|
||||
#if !defined(X_NOT_POSIX)
|
||||
sigemptyset(&mask);
|
||||
sigaddset(&mask, SIGUSR1);
|
||||
sigprocmask(SIG_BLOCK, &mask, &old);
|
||||
#else
|
||||
old = sigblock (sigmask (SIGUSR1));
|
||||
#endif
|
||||
|
||||
serverpid = fork();
|
||||
|
||||
switch(serverpid) {
|
||||
case 0:
|
||||
/* Unblock */
|
||||
#ifndef X_NOT_POSIX
|
||||
sigprocmask(SIG_SETMASK, &old, NULL);
|
||||
#else
|
||||
sigsetmask (old);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* don't hang on read/write to control tty
|
||||
@ -643,12 +595,12 @@ startServer(char *server[])
|
||||
* if client is xterm -L
|
||||
*/
|
||||
#ifndef __UNIXOS2__
|
||||
setpgrp(0,getpid());
|
||||
setpgid(0,getpid());
|
||||
#endif
|
||||
Execute (server, environ);
|
||||
Error ("no server \"%s\" in PATH\n", server[0]);
|
||||
{
|
||||
char **cpp;
|
||||
const char * const *cpp;
|
||||
|
||||
fprintf (stderr,
|
||||
"\nUse the -- option, or make sure that %s is in your path and\n",
|
||||
@ -691,7 +643,6 @@ startServer(char *server[])
|
||||
*/
|
||||
alarm (15);
|
||||
|
||||
#ifndef X_NOT_POSIX
|
||||
#ifdef __UNIXOS2__
|
||||
/*
|
||||
* fg2003/05/06: work around a problem in EMX: sigsuspend()
|
||||
@ -706,11 +657,6 @@ startServer(char *server[])
|
||||
sigsuspend(&old);
|
||||
alarm (0);
|
||||
sigprocmask(SIG_SETMASK, &old, NULL);
|
||||
#else
|
||||
sigpause (old);
|
||||
alarm (0);
|
||||
sigsetmask (old);
|
||||
#endif
|
||||
|
||||
if (waitforserver() == 0) {
|
||||
Error("unable to connect to X server\r\n");
|
||||
@ -723,15 +669,96 @@ startServer(char *server[])
|
||||
return(serverpid);
|
||||
}
|
||||
|
||||
static void
|
||||
setWindowPath(void)
|
||||
{
|
||||
/* setting WINDOWPATH for clients */
|
||||
Atom prop;
|
||||
Atom actualtype;
|
||||
int actualformat;
|
||||
unsigned long nitems;
|
||||
unsigned long bytes_after;
|
||||
unsigned char *buf;
|
||||
const char *windowpath;
|
||||
char *newwindowpath;
|
||||
unsigned long num;
|
||||
char nums[10];
|
||||
int numn;
|
||||
prop = XInternAtom(xd, "XFree86_VT", False);
|
||||
if (prop == None) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "no XFree86_VT atom\n");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
if (XGetWindowProperty(xd, DefaultRootWindow(xd), prop, 0, 1,
|
||||
False, AnyPropertyType, &actualtype, &actualformat,
|
||||
&nitems, &bytes_after, &buf)) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "no XFree86_VT property\n");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
if (nitems != 1) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "%lu items in XFree86_VT property!\n", nitems);
|
||||
#endif
|
||||
XFree(buf);
|
||||
return;
|
||||
}
|
||||
switch (actualtype) {
|
||||
case XA_CARDINAL:
|
||||
case XA_INTEGER:
|
||||
case XA_WINDOW:
|
||||
switch (actualformat) {
|
||||
case 8:
|
||||
num = (*(uint8_t *)(void *)buf);
|
||||
break;
|
||||
case 16:
|
||||
num = (*(uint16_t *)(void *)buf);
|
||||
break;
|
||||
case 32:
|
||||
num = (*(uint32_t *)(void *)buf);
|
||||
break;
|
||||
default:
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "format %d in XFree86_VT property!\n", actualformat);
|
||||
#endif
|
||||
XFree(buf);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "type %lx in XFree86_VT property!\n", actualtype);
|
||||
#endif
|
||||
XFree(buf);
|
||||
return;
|
||||
}
|
||||
XFree(buf);
|
||||
windowpath = getenv("WINDOWPATH");
|
||||
numn = snprintf(nums, sizeof(nums), "%lu", num);
|
||||
if (!windowpath) {
|
||||
newwindowpath = malloc(10 + 1 + numn + 1);
|
||||
sprintf(newwindowpath, "WINDOWPATH=%s", nums);
|
||||
} else {
|
||||
newwindowpath = malloc(10 + 1 + strlen(windowpath) + 1 + numn + 1);
|
||||
sprintf(newwindowpath, "WINDOWPATH=%s:%s", windowpath, nums);
|
||||
}
|
||||
*newenvironlast++ = newwindowpath;
|
||||
*newenvironlast = NULL;
|
||||
}
|
||||
|
||||
static int
|
||||
startClient(char *client[])
|
||||
{
|
||||
setWindowPath();
|
||||
if ((clientpid = vfork()) == 0) {
|
||||
if (setuid(getuid()) == -1) {
|
||||
Error("cannot change uid: %s\n", strerror(errno));
|
||||
_exit(ERR_EXIT);
|
||||
}
|
||||
setpgrp(0, getpid());
|
||||
setpgid(0, getpid());
|
||||
environ = newenviron;
|
||||
#ifdef __UNIXOS2__
|
||||
#undef environ
|
||||
@ -750,7 +777,7 @@ startClient(char *client[])
|
||||
return (clientpid);
|
||||
}
|
||||
|
||||
#if !defined(X_NOT_POSIX) || defined(SYSV) || defined(__UNIXOS2__)
|
||||
#ifndef HAVE_KILLPG
|
||||
#define killpg(pgrp, sig) kill(-(pgrp), sig)
|
||||
#endif
|
||||
|
||||
@ -830,11 +857,11 @@ set_environment(void)
|
||||
for (oldPtr = environ; *oldPtr; oldPtr++) ;
|
||||
|
||||
nenvvars = (oldPtr - environ);
|
||||
newenviron = (char **) malloc ((nenvvars + 2) * sizeof(char **));
|
||||
newenviron = (char **) malloc ((nenvvars + 3) * sizeof(char **));
|
||||
if (!newenviron) {
|
||||
fprintf (stderr,
|
||||
"%s: unable to allocate %d pointers for environment\n",
|
||||
program, nenvvars + 2);
|
||||
program, nenvvars + 3);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
@ -846,11 +873,13 @@ set_environment(void)
|
||||
|
||||
/* copy pointers to other variables */
|
||||
for (oldPtr = environ; *oldPtr; oldPtr++) {
|
||||
if (strncmp (*oldPtr, "DISPLAY=", 8) != 0) {
|
||||
if (strncmp (*oldPtr, "DISPLAY=", 8) != 0
|
||||
&& strncmp (*oldPtr, "WINDOWPATH=", 11) != 0) {
|
||||
*newPtr++ = *oldPtr;
|
||||
}
|
||||
}
|
||||
*newPtr = NULL;
|
||||
newenvironlast=newPtr;
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user