Update to xinit 1.3.3

This commit is contained in:
matthieu 2013-09-14 09:16:23 +00:00
parent 6a7a1261dc
commit c38ca59e7b
22 changed files with 1120 additions and 364 deletions

View File

@ -19,3 +19,30 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright (c) 2008-2012 Apple Inc.
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation files
(the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT
HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name(s) of the above
copyright holders shall not be used in advertising or otherwise to
promote the sale, use or other dealings in this Software without
prior written authorization.

View File

@ -1,3 +1,209 @@
commit cdc39fd28649ea906dea8f58981d15d4b04a0a47
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Sun Sep 8 09:35:35 2013 -0700
xinit 1.3.3
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit 2363f7ed1c7f838107c1209a97d103f72d980f99
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Sun Sep 8 09:35:27 2013 -0700
Add Apple copyright/license notice from launchd files to COPYING
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit 5250190bd436b5b762ebb57452d15dff5ae6a24a
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Sat Aug 24 14:46:33 2013 -0700
Use pid_t instead of int for type of pids
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit 14ea26b8dc0c601e445331e09a4cc9ca082a1345
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Sat Aug 3 00:15:34 2013 -0700
Check for openssl as mkcookie fallback on all platforms, not just OpenBSD
Configure will notify the builder which cookie maker it chooses,
so that packagers can add a dependency on the program needed.
(Matthieu says the -hex flag to the openssl command was originally
OpenBSD-specific but has since been added in upstream OpenSSL.)
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Thomas Klausner <wiz@NetBSD.org>
Reviewed-by: Matthieu Herrb <matthieu.herrb@laas.fr>
commit 09ab37f816d2fe9482574c825132d9b516b8e0bf
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Thu Jul 18 22:58:10 2013 -0700
Declare processTimeout() as taking a const string arg
Fixes gcc const warnings on every call to it
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit 1dd71b4eae433896e41f8366f23b8269712b4cf3
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Thu Jul 18 22:51:56 2013 -0700
If we have to forcibly kill the Xserver on Solaris, reset kbd_mode
If the Xserver hangs when xinit is waiting for it to die, and xinit
sends a kill -9 to it, then it will leave the keyboard in a state that
can't be used on the text console, so fix it up ourselves.
Upstreaming from Solaris, where it was originally implemented to fix
Sun bug 4221128 “If Xserver is slow to exit, xinit does "kill -9" and
kbd_mode -a is required”
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit 79fd43329e15432bab4f9f8856af385ac2ac0417
Author: Thomas Klausner <wiz@NetBSD.org>
Date: Thu Apr 4 14:58:30 2013 +0200
Use xinitrc.d/?*.sh as the matching pattern instead of needing a fragile sed substitution XSLASHGLOB to produce xinitrc.d/*.sh. (If that were used literally the slash-star would confuse cpp.)
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit ef3d1d64958c51d7716445574bb7e5653aab714d
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Sat Feb 23 11:23:25 2013 -0800
Add printf attributes suggested by gcc
Also moves existing noreturn attributes up to function prototypes for
functions with forward declarations.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit 4e85bce64acef1fa0ddff04d59737444e942ff12
Author: Egbert Eich <eich@freedesktop.org>
Date: Thu May 19 09:27:13 2011 +0200
install: Use sysconfdir instead of libdir for config files.
Most X packages today install their config files in sysconfigdir,
only a few are left which still put their configuration in libdir.
Signed-off-by: Egbert Eich <eich@freedesktop.org>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit 7c2f87264db950dfecb1a5467d06b3d9d621e32c
Author: Egbert Eich <eich@freedesktop.org>
Date: Thu May 19 09:26:24 2011 +0200
man: Set correct config file location in man page
Change the config file location from a hard coded path to what is
set during build.
Signed-off-by: Egbert Eich <eich@freedesktop.org>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit fb4d46c9a85755910a222dcc7167df3b5a5c8d94
Author: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Date: Thu Sep 20 22:31:44 2012 -0700
privileged_startx: use root:wheel instead of 0:0
http://xquartz.macosforge.org/trac/ticket/637
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
commit bfed997da5f083e3ddfbda440e114d1261d18b14
Author: Jeremy Huddleston <jeremyhu@apple.com>
Date: Tue Jul 24 08:47:29 2012 -0700
XQuartz: Fix an issue where -dpi was not being passed to the server despite being set
For some reason 'defaults' sometimes shows dpi in quotes and sometimes
doesn't.
Regression-from: 335937217a51e5e159a14463e0b1e3aedf35c6be
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
commit 8156aad786754499f4636104aa5bd8a27a281448
Author: Jeremy Huddleston <jeremyhu@apple.com>
Date: Sat May 19 04:34:32 2012 -0700
Annotate Fatal and Fatalx as _X_NORETURN
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
commit 641588afe92c803a1231ecf6281115f55b20e62a
Author: Jeremy Huddleston <jeremyhu@apple.com>
Date: Sat May 19 04:30:49 2012 -0700
laucnhd: Silence some syslog spam
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
commit 335937217a51e5e159a14463e0b1e3aedf35c6be
Author: Jeremy Huddleston <jeremyhu@apple.com>
Date: Sat May 19 04:22:14 2012 -0700
darwin: Silence a syslog message from defaults
Unfortunately defaults has no way to check if a preference exists, and it
prints a message to syslog if we read one that doesn't exist. dpi is one
that commonly doesn't exist and results in user confusion when they read
syslog.
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
commit eda973a32552c916e7e7cce8877674106cbda0cb
Author: Jeremy Huddleston <jeremyhu@apple.com>
Date: Wed Apr 18 10:02:07 2012 -0700
launchd: Fix the destination of moved-aside directories in privileged_startx
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
commit c781653f956043e0ee476d4e95e0ae93b27aff96
Author: Jeremy Huddleston <jeremyhu@apple.com>
Date: Wed Apr 18 09:52:18 2012 -0700
launchd: Load privileged_startx properly on Tiger
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
commit 4cd122efcfa47afbe8c2ebeee6d8fd48914839a7
Author: Jeremy Huddleston <jeremyhu@apple.com>
Date: Wed Apr 18 09:47:33 2012 -0700
launchd: Provide more verbose error reporting for launchd checkin failures
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
commit 2d9bdc819adbe45ec3ffdc72429fd92b7f613601
Author: Jeremy Huddleston <jeremyhu@apple.com>
Date: Wed Apr 18 09:20:37 2012 -0700
launchd: Don't provide the LaunchAgent on Tiger
Tiger's launchd doesn't support all the features we need from it.
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
commit 49cfa8b7253096d24b2ef6a8d0ba32c4bae9ac23
Author: Jeremy Huddleston <jeremyhu@apple.com>
Date: Fri Feb 17 17:35:26 2012 -0800
launchd/privileged_startx: Improved error resolution
Rather than just failing to do anything when directories aren't what we
want them to be, we now try our best to fix the situation.
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
commit f5ef7a3f8c1e8ac3f715e4059bf3b9a03aafd5a7
Author: Jeremy Huddleston <jeremyhu@apple.com>
Date: Fri Jan 27 23:13:48 2012 -0800

View File

@ -1,5 +1,3 @@
# $OpenBSD: Makefile.bsd-wrapper,v 1.4 2010/05/31 20:23:19 matthieu Exp $
CONFIGURE_ARGS= --with-xinitdir=/etc/X11/xinit
# $OpenBSD: Makefile.bsd-wrapper,v 1.5 2013/09/14 09:16:23 matthieu Exp $
.include <bsd.xorg.mk>

View File

@ -84,8 +84,8 @@ host_triplet = @host@
bin_PROGRAMS = xinit$(EXEEXT)
DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(srcdir)/config.h.in \
$(top_srcdir)/configure $(top_srcdir)/cpprules.in AUTHORS \
COPYING ChangeLog INSTALL NEWS config.guess config.sub depcomp \
$(top_srcdir)/configure $(top_srcdir)/cpprules.in COPYING \
ChangeLog INSTALL NEWS compile config.guess config.sub depcomp \
install-sh missing
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@ -280,6 +280,7 @@ MISC_MAN_DIR = @MISC_MAN_DIR@
MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
MKDIR_P = @MKDIR_P@
OBJEXT = @OBJEXT@
OPENSSL = @OPENSSL@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
@ -289,6 +290,8 @@ PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SCOMAN = @SCOMAN@
@ -384,7 +387,6 @@ CPP_SED_MAGIC = $(SED) -e '/^\# *[0-9][0-9]* *.*$$/d' \
-e '/^[ ]*XCOMM$$/s/XCOMM/\#/' \
-e '/^[ ]*XCOMM[^a-zA-Z0-9_]/s/XCOMM/\#/' \
-e '/^[ ]*XHASH/s/XHASH/\#/' \
-e '/XSLASHGLOB/s/XSLASHGLOB/\/\*/' \
-e '/\@\@$$/s/\@\@$$/\\/'
SUFFIXES = .cpp

110
app/xinit/aclocal.m4 vendored
View File

@ -20,6 +20,7 @@ If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically 'autoreconf'.])])
# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
# serial 1 (pkg-config-0.24)
#
# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
#
@ -46,8 +47,12 @@ To do so, use the procedure documented by the package, typically 'autoreconf'.])
# ----------------------------------
AC_DEFUN([PKG_PROG_PKG_CONFIG],
[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
fi
@ -60,7 +65,6 @@ if test -n "$PKG_CONFIG"; then
AC_MSG_RESULT([no])
PKG_CONFIG=""
fi
fi[]dnl
])# PKG_PROG_PKG_CONFIG
@ -69,34 +73,32 @@ fi[]dnl
# Check to see whether a particular set of modules exists. Similar
# to PKG_CHECK_MODULES(), but does not set variables or print errors.
#
#
# Similar to PKG_CHECK_MODULES, make sure that the first instance of
# this or PKG_CHECK_MODULES is called, or make sure to call
# PKG_CHECK_EXISTS manually
# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
# only at the first occurence in configure.ac, so if the first place
# it's called might be skipped (such as if it is within an "if", you
# have to call PKG_CHECK_EXISTS manually
# --------------------------------------------------------------
AC_DEFUN([PKG_CHECK_EXISTS],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
if test -n "$PKG_CONFIG" && \
AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
m4_ifval([$2], [$2], [:])
m4_default([$2], [:])
m4_ifvaln([$3], [else
$3])dnl
fi])
# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
# ---------------------------------------------
m4_define([_PKG_CONFIG],
[if test -n "$PKG_CONFIG"; then
if test -n "$$1"; then
pkg_cv_[]$1="$$1"
else
PKG_CHECK_EXISTS([$3],
[pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
[pkg_failed=yes])
fi
else
pkg_failed=untried
[if test -n "$$1"; then
pkg_cv_[]$1="$$1"
elif test -n "$PKG_CONFIG"; then
PKG_CHECK_EXISTS([$3],
[pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes ],
[pkg_failed=yes])
else
pkg_failed=untried
fi[]dnl
])# _PKG_CONFIG
@ -138,16 +140,17 @@ and $1[]_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.])
if test $pkg_failed = yes; then
AC_MSG_RESULT([no])
_PKG_SHORT_ERRORS_SUPPORTED
if test $_pkg_short_errors_supported = yes; then
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"`
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
else
$1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
$1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
ifelse([$4], , [AC_MSG_ERROR(dnl
m4_default([$4], [AC_MSG_ERROR(
[Package requirements ($2) were not met:
$$1_PKG_ERRORS
@ -155,28 +158,67 @@ $$1_PKG_ERRORS
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
_PKG_TEXT
])],
[AC_MSG_RESULT([no])
$4])
_PKG_TEXT])[]dnl
])
elif test $pkg_failed = untried; then
ifelse([$4], , [AC_MSG_FAILURE(dnl
AC_MSG_RESULT([no])
m4_default([$4], [AC_MSG_FAILURE(
[The pkg-config script could not be found or is too old. Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config.
_PKG_TEXT
To get pkg-config, see <http://www.freedesktop.org/software/pkgconfig>.])],
[$4])
To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
])
else
$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
AC_MSG_RESULT([yes])
ifelse([$3], , :, [$3])
$3
fi[]dnl
])# PKG_CHECK_MODULES
# PKG_INSTALLDIR(DIRECTORY)
# -------------------------
# Substitutes the variable pkgconfigdir as the location where a module
# should install pkg-config .pc files. By default the directory is
# $libdir/pkgconfig, but the default can be changed by passing
# DIRECTORY. The user can override through the --with-pkgconfigdir
# parameter.
AC_DEFUN([PKG_INSTALLDIR],
[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
m4_pushdef([pkg_description],
[pkg-config installation directory @<:@]pkg_default[@:>@])
AC_ARG_WITH([pkgconfigdir],
[AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
[with_pkgconfigdir=]pkg_default)
AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
m4_popdef([pkg_default])
m4_popdef([pkg_description])
]) dnl PKG_INSTALLDIR
# PKG_NOARCH_INSTALLDIR(DIRECTORY)
# -------------------------
# Substitutes the variable noarch_pkgconfigdir as the location where a
# module should install arch-independent pkg-config .pc files. By
# default the directory is $datadir/pkgconfig, but the default can be
# changed by passing DIRECTORY. The user can override through the
# --with-noarch-pkgconfigdir parameter.
AC_DEFUN([PKG_NOARCH_INSTALLDIR],
[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
m4_pushdef([pkg_description],
[pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
AC_ARG_WITH([noarch-pkgconfigdir],
[AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
[with_noarch_pkgconfigdir=]pkg_default)
AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
m4_popdef([pkg_default])
m4_popdef([pkg_description])
]) dnl PKG_NOARCH_INSTALLDIR
# Copyright (C) 2002-2012 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
@ -1237,7 +1279,7 @@ dnl DEALINGS IN THE SOFTWARE.
# See the "minimum version" comment for each macro you use to see what
# version you require.
m4_defun([XORG_MACROS_VERSION],[
m4_define([vers_have], [1.16.2])
m4_define([vers_have], [1.17.1])
m4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
m4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
m4_if(m4_cmp(maj_have, maj_needed), 0,,
@ -2743,18 +2785,18 @@ fi
found="no"
m4_foreach([flag], m4_cdr($@), [
if test $found = "no" ; then
if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
fi
if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then
if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
fi
PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
AC_MSG_CHECKING([if ]COMPILER[ supports]flag[])
AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
AC_CACHE_VAL($cacheid,
[AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],

347
app/xinit/compile Normal file
View File

@ -0,0 +1,347 @@
#! /bin/sh
# Wrapper for compilers which do not understand '-c -o'.
scriptversion=2012-10-14.11; # UTC
# Copyright (C) 1999-2013 Free Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
nl='
'
# We need space, tab and new line, in precisely that order. Quoting is
# there to prevent tools from complaining about whitespace usage.
IFS=" "" $nl"
file_conv=
# func_file_conv build_file lazy
# Convert a $build file to $host form and store it in $file
# Currently only supports Windows hosts. If the determined conversion
# type is listed in (the comma separated) LAZY, no conversion will
# take place.
func_file_conv ()
{
file=$1
case $file in
/ | /[!/]*) # absolute file, and not a UNC file
if test -z "$file_conv"; then
# lazily determine how to convert abs files
case `uname -s` in
MINGW*)
file_conv=mingw
;;
CYGWIN*)
file_conv=cygwin
;;
*)
file_conv=wine
;;
esac
fi
case $file_conv/,$2, in
*,$file_conv,*)
;;
mingw/*)
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
;;
cygwin/*)
file=`cygpath -m "$file" || echo "$file"`
;;
wine/*)
file=`winepath -w "$file" || echo "$file"`
;;
esac
;;
esac
}
# func_cl_dashL linkdir
# Make cl look for libraries in LINKDIR
func_cl_dashL ()
{
func_file_conv "$1"
if test -z "$lib_path"; then
lib_path=$file
else
lib_path="$lib_path;$file"
fi
linker_opts="$linker_opts -LIBPATH:$file"
}
# func_cl_dashl library
# Do a library search-path lookup for cl
func_cl_dashl ()
{
lib=$1
found=no
save_IFS=$IFS
IFS=';'
for dir in $lib_path $LIB
do
IFS=$save_IFS
if $shared && test -f "$dir/$lib.dll.lib"; then
found=yes
lib=$dir/$lib.dll.lib
break
fi
if test -f "$dir/$lib.lib"; then
found=yes
lib=$dir/$lib.lib
break
fi
if test -f "$dir/lib$lib.a"; then
found=yes
lib=$dir/lib$lib.a
break
fi
done
IFS=$save_IFS
if test "$found" != yes; then
lib=$lib.lib
fi
}
# func_cl_wrapper cl arg...
# Adjust compile command to suit cl
func_cl_wrapper ()
{
# Assume a capable shell
lib_path=
shared=:
linker_opts=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as 'compile cc -o foo foo.c'.
eat=1
case $2 in
*.o | *.[oO][bB][jJ])
func_file_conv "$2"
set x "$@" -Fo"$file"
shift
;;
*)
func_file_conv "$2"
set x "$@" -Fe"$file"
shift
;;
esac
;;
-I)
eat=1
func_file_conv "$2" mingw
set x "$@" -I"$file"
shift
;;
-I*)
func_file_conv "${1#-I}" mingw
set x "$@" -I"$file"
shift
;;
-l)
eat=1
func_cl_dashl "$2"
set x "$@" "$lib"
shift
;;
-l*)
func_cl_dashl "${1#-l}"
set x "$@" "$lib"
shift
;;
-L)
eat=1
func_cl_dashL "$2"
;;
-L*)
func_cl_dashL "${1#-L}"
;;
-static)
shared=false
;;
-Wl,*)
arg=${1#-Wl,}
save_ifs="$IFS"; IFS=','
for flag in $arg; do
IFS="$save_ifs"
linker_opts="$linker_opts $flag"
done
IFS="$save_ifs"
;;
-Xlinker)
eat=1
linker_opts="$linker_opts $2"
;;
-*)
set x "$@" "$1"
shift
;;
*.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
func_file_conv "$1"
set x "$@" -Tp"$file"
shift
;;
*.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
func_file_conv "$1" mingw
set x "$@" "$file"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -n "$linker_opts"; then
linker_opts="-link$linker_opts"
fi
exec "$@" $linker_opts
exit 1
}
eat=
case $1 in
'')
echo "$0: No command. Try '$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: compile [--help] [--version] PROGRAM [ARGS]
Wrapper for compilers which do not understand '-c -o'.
Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
arguments, and rename the output as expected.
If you are trying to build a whole package this is not the
right script to run: please start by reading the file 'INSTALL'.
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "compile $scriptversion"
exit $?
;;
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe )
func_cl_wrapper "$@" # Doesn't return...
;;
esac
ofile=
cfile=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as 'compile cc -o foo foo.c'.
# So we strip '-o arg' only if arg is an object.
eat=1
case $2 in
*.o | *.obj)
ofile=$2
;;
*)
set x "$@" -o "$2"
shift
;;
esac
;;
*.c)
cfile=$1
set x "$@" "$1"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -z "$ofile" || test -z "$cfile"; then
# If no '-o' option was seen then we might have been invoked from a
# pattern rule where we don't need one. That is ok -- this is a
# normal compilation that the losing compiler can handle. If no
# '.c' file was seen then we are probably linking. That is also
# ok.
exec "$@"
fi
# Name of file we expect compiler to create.
cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
# Create the lock directory.
# Note: use '[/\\:.-]' here to ensure that we don't use the same name
# that we are using for the .o file. Also, base the name on the expected
# object file name, since that is what matters with a parallel build.
lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
while true; do
if mkdir "$lockdir" >/dev/null 2>&1; then
break
fi
sleep 1
done
# FIXME: race condition here if user kills between mkdir and trap.
trap "rmdir '$lockdir'; exit 1" 1 2 15
# Run the compile.
"$@"
ret=$?
if test -f "$cofile"; then
test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
elif test -f "${cofile}bj"; then
test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
fi
rmdir "$lockdir"
exit $ret
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

567
app/xinit/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -22,7 +22,7 @@ dnl Process this file with autoconf to create configure.
# Initialize Autoconf
AC_PREREQ([2.60])
AC_INIT([xinit], [1.3.2],
AC_INIT([xinit], [1.3.3],
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [xinit])
AC_CONFIG_SRCDIR([Makefile.am])
AC_CONFIG_HEADERS([config.h])
@ -51,7 +51,7 @@ DEFAULT_XSERVER=${bindir}/X
DEFAULT_XAUTH=xauth
DEFAULT_XINIT=xinit
DEFAULT_WM=fvwm
DEFAULT_XINITDIR=${libdir}/X11/xinit
DEFAULT_XINITDIR=${sysconfdir}/X11/xinit
DEFAULT_XCONSOLE=xconsole
AC_ARG_WITH(xrdb,
@ -153,7 +153,7 @@ AM_CONDITIONAL(TIGER_LAUNCHD, [test "x$TIGER_LAUNCHD" = "xyes"])
AM_CONDITIONAL(LAUNCHAGENT_XSERVER, [test "x$launchagentxserver" != "xno"])
# Checks for pkg-config packages
PKG_CHECK_MODULES(XINIT, x11)
PKG_CHECK_MODULES(XINIT, x11 xproto >= 7.0.17)
case $host_os in
*bsd*)
@ -165,17 +165,26 @@ esac
AC_PATH_PROGS(MCOOKIE, [mcookie], [$MCOOKIE],
[$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/local/bin])
case $host_os in
*openbsd*)
MCOOKIE='/usr/sbin/openssl rand -hex 16'
;;
*solaris*)
MCOOKIE="/usr/bin/od -X -A n -N 16 /dev/urandom | /usr/bin/tr -d ' '"
;;
esac
# If mcookie not found, try openssl, else per-system fallbacks
if test "x$MCOOKIE" = x ; then
AC_PATH_PROGS(OPENSSL, [openssl], [$OPENSSL],
[$PATH:/bin:/usr/bin:/usr/sbin:/usr/lib:/usr/libexec:/usr/local/bin])
if test "x$OPENSSL" != x ; then
MCOOKIE="$OPENSSL rand -hex 16"
else
case $host_os in
*openbsd*)
MCOOKIE='/usr/sbin/openssl rand -hex 16'
;;
*solaris*)
MCOOKIE="/usr/bin/od -X -A n -N 16 /dev/urandom | /usr/bin/tr -d ' '"
;;
esac
fi
fi
if test "x$MCOOKIE" != x ; then
STARTX_COOKIE_FLAGS='-DHAS_COOKIE_MAKER -DMK_COOKIE="$(MCOOKIE)"'
AC_MSG_NOTICE([startx will depend on "$MCOOKIE" to generate xauth cookies])
fi
AC_SUBST(STARTX_COOKIE_FLAGS)

View File

@ -10,7 +10,6 @@ CPP_SED_MAGIC = $(SED) -e '/^\# *[0-9][0-9]* *.*$$/d' \
-e '/^[ ]*XCOMM$$/s/XCOMM/\#/' \
-e '/^[ ]*XCOMM[^a-zA-Z0-9_]/s/XCOMM/\#/' \
-e '/^[ ]*XHASH/s/XHASH/\#/' \
-e '/XSLASHGLOB/s/XSLASHGLOB/\/\*/' \
-e '/\@\@$$/s/\@\@$$/\\/'
SUFFIXES = .cpp

View File

@ -1,3 +1,8 @@
SUBDIRS = privileged_startx user_startx
DIST_SUBDIRS = privileged_startx user_startx
SUBDIRS = privileged_startx
if !TIGER_LAUNCHD
SUBDIRS += user_startx
endif
EXTRA_DIST = console_redirect.h

View File

@ -49,6 +49,7 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
@TIGER_LAUNCHD_FALSE@am__append_1 = user_startx
subdir = launchd
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@ -92,7 +93,6 @@ AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
distdir
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = $(SUBDIRS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
am__relativize = \
dir0=`pwd`; \
@ -172,6 +172,7 @@ MISC_MAN_DIR = @MISC_MAN_DIR@
MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
MKDIR_P = @MKDIR_P@
OBJEXT = @OBJEXT@
OPENSSL = @OPENSSL@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
@ -181,6 +182,8 @@ PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SCOMAN = @SCOMAN@
@ -263,7 +266,8 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
SUBDIRS = privileged_startx user_startx
DIST_SUBDIRS = privileged_startx user_startx
SUBDIRS = privileged_startx $(am__append_1)
EXTRA_DIST = console_redirect.h
all: all-recursive

View File

@ -1,5 +1,5 @@
XCOMM!/bin/sh
XCOMM Copyright (c) 2008 Apple Inc.
XCOMM Copyright (c) 2008-2012 Apple Inc.
XCOMM
XCOMM Permission is hereby granted, free of charge, to any person
XCOMM obtaining a copy of this software and associated documentation files
@ -36,11 +36,33 @@ else
MKTEMP=mktemp
fi
STAT=/usr/bin/stat
for dir in /tmp/.ICE-unix /tmp/.X11-unix /tmp/.font-unix ; do
XCOMM Use mktemp rather than mkdir to avoid possible security issue
XCOMM if $dir exists and is a symlink
if ${MKTEMP} -d ${dir} >& /dev/null ; then
chmod 1777 $dir
chown root:wheel $dir
success=0
for attempt in 1 2 3 4 5 ; do
check=`${STAT} -f '%#p %u %g' ${dir} 2> /dev/null`
if [ "${check}" = "041777 0 0" ] ; then
success=1
break
elif [ -n "${check}" ] ; then
saved=$(${MKTEMP} -d ${dir}-XXXXXXXX)
mv ${dir} ${saved}
echo "${dir} exists but is insecure. It has been moved into ${saved}" >&2
fi
# Use mktemp rather than mkdir to avoid possible security issue
# if $dir exists and is a symlink (ie protect against a race
# against the above check)
if ${MKTEMP} -d ${dir} >& /dev/null ; then
chmod 1777 $dir
chown root:wheel $dir
success=1
break
fi
done
if [ "${success}" -eq 0 ] ; then
echo "Could not successfully create ${dir}" >&2
fi
done

View File

@ -234,6 +234,7 @@ MISC_MAN_DIR = @MISC_MAN_DIR@
MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
MKDIR_P = @MKDIR_P@
OBJEXT = @OBJEXT@
OPENSSL = @OPENSSL@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
@ -243,6 +244,8 @@ PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SCOMAN = @SCOMAN@
@ -330,7 +333,6 @@ CPP_SED_MAGIC = $(SED) -e '/^\# *[0-9][0-9]* *.*$$/d' \
-e '/^[ ]*XCOMM$$/s/XCOMM/\#/' \
-e '/^[ ]*XCOMM[^a-zA-Z0-9_]/s/XCOMM/\#/' \
-e '/^[ ]*XHASH/s/XHASH/\#/' \
-e '/XSLASHGLOB/s/XSLASHGLOB/\/\*/' \
-e '/\@\@$$/s/\@\@$$/\\/'
SUFFIXES = .cpp

View File

@ -11,8 +11,12 @@
<string>SCRIPTDIR</string>
</array>
#ifdef TIGER_LAUNCHD
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>ServiceIPC</key>
<true/>
#else
<key>MachServices</key>
<dict>

View File

@ -125,9 +125,19 @@ int server_main(const char *dir) {
aslclient aslc;
checkin = launch_data_new_string(LAUNCH_KEY_CHECKIN);
if (!checkin) {
asl_log(NULL, NULL, ASL_LEVEL_ERR, "unable to create launchd checkin string");
exit(EXIT_FAILURE);
}
config = launch_msg(checkin);
if (!config || launch_data_get_type(config) == LAUNCH_DATA_ERRNO) {
asl_log(NULL, NULL, ASL_LEVEL_ERR, "launchd checkin failed");
if (!config) {
asl_log(NULL, NULL, ASL_LEVEL_ERR, "could not send a message to launchd");
exit(EXIT_FAILURE);
}
if (launch_data_get_type(config) == LAUNCH_DATA_ERRNO) {
asl_log(NULL, NULL, ASL_LEVEL_ERR, "launchd checkin failed eith error: %d %s", launch_data_get_errno(config), strerror(launch_data_get_errno(config)));
exit(EXIT_FAILURE);
}

View File

@ -222,6 +222,7 @@ MISC_MAN_DIR = @MISC_MAN_DIR@
MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
MKDIR_P = @MKDIR_P@
OBJEXT = @OBJEXT@
OPENSSL = @OPENSSL@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
@ -231,6 +232,8 @@ PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SCOMAN = @SCOMAN@
@ -318,7 +321,6 @@ CPP_SED_MAGIC = $(SED) -e '/^\# *[0-9][0-9]* *.*$$/d' \
-e '/^[ ]*XCOMM$$/s/XCOMM/\#/' \
-e '/^[ ]*XCOMM[^a-zA-Z0-9_]/s/XCOMM/\#/' \
-e '/^[ ]*XHASH/s/XHASH/\#/' \
-e '/XSLASHGLOB/s/XSLASHGLOB/\/\*/' \
-e '/\@\@$$/s/\@\@$$/\\/'
SUFFIXES = .cpp

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2011 Apple Inc.
/* Copyright (c) 2011-2012 Apple Inc.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation files
@ -37,15 +37,7 @@
#include <sys/wait.h>
#include <string.h>
#include <stdlib.h>
/* Using MIN_REQUIRED instead of MAX_ALLOWED logic due to posix_spawn not
* being marked with availability macros until 10.7
*/
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
#include <spawn.h>
#else
#include <errno.h>
#endif
#include "console_redirect.h"
@ -64,20 +56,7 @@ int main(int argc, char **argv, char **envp) {
xi_asl_capture_fd(aslc, NULL, ASL_LEVEL_INFO, STDOUT_FILENO);
xi_asl_capture_fd(aslc, NULL, ASL_LEVEL_NOTICE, STDERR_FILENO);
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
assert(posix_spawnp(&child, argv[1], NULL, NULL, &argv[1], envp) == 0);
#else
switch(child = fork()) {
case -1:
perror("fork");
return errno;
case 0:
return execvp(argv[1], &argv[1]);
default:
break;
}
#endif
wait4(child, &pstat, 0, (struct rusage *)0);
return pstat;

View File

@ -13,7 +13,9 @@ MAN_SUBSTS+= -e 's|__XSERVERNAME__|$(XSERVERNAME)|g' \
-e 's|__xinitdir__|$(XINITDIR)|g' \
-e 's|__bindir__|$(bindir)|g' \
-e 's|__libdir__|$(libdir)|g' \
-e 's|__SCOMAN__|$(SCOMAN)|g'
-e 's|__SCOMAN__|$(SCOMAN)|g' \
-e 's|__configdir__|$(XINITDIR)|g'
# String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure
.man.$(APP_MAN_SUFFIX):

View File

@ -160,12 +160,14 @@ MAN_SUBSTS = @MAN_SUBSTS@ -e 's|__XSERVERNAME__|$(XSERVERNAME)|g' -e \
's|__XCONFIGFILE__|$(XCONFIGFILE)|g' -e \
's|__XCONFIGFILEMAN__|$(XCONFIGFILEMAN)|g' -e \
's|__xinitdir__|$(XINITDIR)|g' -e 's|__bindir__|$(bindir)|g' \
-e 's|__libdir__|$(libdir)|g' -e 's|__SCOMAN__|$(SCOMAN)|g'
-e 's|__libdir__|$(libdir)|g' -e 's|__SCOMAN__|$(SCOMAN)|g' -e \
's|__configdir__|$(XINITDIR)|g'
MCOOKIE = @MCOOKIE@
MISC_MAN_DIR = @MISC_MAN_DIR@
MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
MKDIR_P = @MKDIR_P@
OBJEXT = @OBJEXT@
OPENSSL = @OPENSSL@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
@ -175,6 +177,8 @@ PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
RAWCPP = @RAWCPP@
RAWCPPFLAGS = @RAWCPPFLAGS@
SCOMAN = @SCOMAN@

View File

@ -109,7 +109,7 @@ used.
This will start up a server named \fIX\fP and run the user's \fI\.xinitrc\fP,
if it exists, or else start an \fIxterm\fP.
.TP 8
.B "xinit \-\^\- /usr/local/bin/Xvnc :1"
.B "xinit \-\^\- __bindir__/Xvnc :1"
This is how one could start a specific type of server on an alternate display.
.TP 8
.B "xinit \-geometry =80x65+10+10 \-fn 8x13 \-j \-fg white \-bg navy"
@ -149,7 +149,7 @@ a default \fI\.xinitrc\fP that references a site-wide startup file:
.in +8
.nf
\&#!/bin/sh
\&. /usr/local/lib/site.xinitrc
\&. __configdir__/site.xinitrc
.fi
.in -8
.sp
@ -161,7 +161,7 @@ novice users:
.in +8
.nf
\&#!/bin/sh
xinit /usr/local/lib/site.xinitrc \-\^\- __bindir__/X -br
xinit __configdir__/site.xinitrc \-\^\- __bindir__/X -br
.fi
.in -8
.sp

View File

@ -126,7 +126,9 @@ if [ x`defaults read $X11_PREFS_DOMAIN nolisten_tcp` = x1 ] ; then
defaultserverargs="$defaultserverargs -nolisten tcp"
fi
if defaults read $X11_PREFS_DOMAIN dpi > /dev/null 2>&1 ; then
XCOMM The second check is the real one. The first is to hopefully avoid
XCOMM needless syslog spamming.
if defaults read $X11_PREFS_DOMAIN 2> /dev/null | grep -q 'dpi' && defaults read $X11_PREFS_DOMAIN dpi > /dev/null 2>&1 ; then
defaultserverargs="$defaultserverargs -dpi `defaults read $X11_PREFS_DOMAIN dpi`"
fi

View File

@ -101,23 +101,23 @@ static char *displayNum = NULL;
static char *program = NULL;
static Display *xd = NULL; /* server connection */
int status;
int serverpid = -1;
int clientpid = -1;
pid_t serverpid = -1;
pid_t clientpid = -1;
volatile int gotSignal = 0;
static void Execute(char **vec);
static Bool waitforserver(void);
static Bool processTimeout(int timeout, char *string);
static int startServer(char *server[]);
static int startClient(char *client[]);
static Bool processTimeout(int timeout, const char *string);
static pid_t startServer(char *server[]);
static pid_t startClient(char *client[]);
static int ignorexio(Display *dpy);
static void shutdown(void);
static void set_environment(void);
static void Fatal(const char *fmt, ...);
static void Error(const char *fmt, ...);
static void Fatalx(const char *fmt, ...);
static void Errorx(const char *fmt, ...);
static void Fatal(const char *fmt, ...) _X_ATTRIBUTE_PRINTF(1,2) _X_NORETURN;
static void Error(const char *fmt, ...) _X_ATTRIBUTE_PRINTF(1,2);
static void Fatalx(const char *fmt, ...) _X_ATTRIBUTE_PRINTF(1,2) _X_NORETURN;
static void Errorx(const char *fmt, ...) _X_ATTRIBUTE_PRINTF(1,2);
static void
sigCatch(int sig)
@ -149,7 +149,7 @@ main(int argc, char *argv[])
register char **sptr = server;
register char **cptr = client;
register char **ptr;
int pid;
pid_t pid;
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;
@ -364,10 +364,11 @@ waitforserver(void)
* return TRUE if we timeout waiting for pid to exit, FALSE otherwise.
*/
static Bool
processTimeout(int timeout, char *string)
processTimeout(int timeout, const char *string)
{
int i = 0, pidfound = -1;
static char *laststring;
int i = 0;
pid_t pidfound = -1;
static const char *laststring;
for (;;) {
if ((pidfound = waitpid(serverpid, &status, WNOHANG)) == serverpid)
@ -388,7 +389,7 @@ processTimeout(int timeout, char *string)
return (serverpid != pidfound);
}
static int
static pid_t
startServer(char *server[])
{
sigset_t mask, old;
@ -554,7 +555,7 @@ setWindowPath(void)
free(newwindowpath);
}
static int
static pid_t
startClient(char *client[])
{
clientpid = fork();
@ -627,6 +628,26 @@ shutdown(void)
if (processTimeout(3, "server to die"))
Fatalx("X server refuses to die");
#ifdef __sun
else {
/* Restore keyboard mode. */
serverpid = fork();
switch (serverpid) {
case 0:
execlp ("kbd_mode", "kbd_mode", "-a", NULL);
Fatal("Unable to run program \"%s\"", "kbd_mode");
break;
case 1:
Error("fork failed");
break;
default:
fprintf (stderr, "\r\nRestoring keyboard mode\r\n");
processTimeout(1, "kbd_mode");
}
}
#endif
}
static void
@ -636,7 +657,7 @@ set_environment(void)
Fatal("unable to set DISPLAY");
}
static void
static void _X_ATTRIBUTE_PRINTF(1,0)
verror(const char *fmt, va_list ap)
{
fprintf(stderr, "%s: ", program);
@ -644,7 +665,7 @@ verror(const char *fmt, va_list ap)
fprintf(stderr, ": %s\n", strerror(errno));
}
static void
static void _X_ATTRIBUTE_PRINTF(1,0)
verrorx(const char *fmt, va_list ap)
{
fprintf(stderr, "%s: ", program);