From ec1e6908ba9a3f29f718f9e2f84015893dc60e8d Mon Sep 17 00:00:00 2001 From: HyungKyu Song Date: Sat, 16 Feb 2013 01:47:21 +0900 Subject: Tizen 2.0 Release --- AUTHORS | 1 + COPYING | 22 ++ ChangeLog | 38 ++ Makefile.am | 31 ++ Makefile.in | 697 ++++++++++++++++++++++++++++++++++ NEWS | 0 README | 10 + autogen.sh | 12 + config.h.in | 68 ++++ configure.ac | 48 +++ debian/changelog | 110 ++++++ debian/compat | 1 + debian/control | 53 +++ debian/copyright | 19 + debian/libxtrap-dev.install | 4 + debian/libxtrap6.install | 1 + debian/rules | 96 +++++ debian/watch | 2 + debian/xsfbs/xsfbs.mk | 310 +++++++++++++++ debian/xsfbs/xsfbs.sh | 900 ++++++++++++++++++++++++++++++++++++++++++++ depcomp | 589 +++++++++++++++++++++++++++++ install-sh | 519 +++++++++++++++++++++++++ missing | 367 ++++++++++++++++++ mkinstalldirs | 161 ++++++++ packaging/libXTrap.manifest | 5 + packaging/libXTrap.spec | 71 ++++ src/Makefile.am | 17 + src/Makefile.in | 489 ++++++++++++++++++++++++ src/XECallBcks.c | 175 +++++++++ src/XEConTxt.c | 589 +++++++++++++++++++++++++++++ src/XEDsptch.c | 111 ++++++ src/XEPrInfo.c | 274 ++++++++++++++ src/XERqsts.c | 412 ++++++++++++++++++++ src/XEStrMap.c | 284 ++++++++++++++ src/XETrapInit.c | 218 +++++++++++ src/XEWrappers.c | 325 ++++++++++++++++ xtrap.pc.in | 12 + 37 files changed, 7041 insertions(+) create mode 100644 AUTHORS create mode 100644 COPYING create mode 100644 ChangeLog create mode 100644 Makefile.am create mode 100644 Makefile.in create mode 100644 NEWS create mode 100644 README create mode 100755 autogen.sh create mode 100644 config.h.in create mode 100644 configure.ac create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100644 debian/control create mode 100644 debian/copyright create mode 100644 debian/libxtrap-dev.install create mode 100644 debian/libxtrap6.install create mode 100755 debian/rules create mode 100644 debian/watch create mode 100644 debian/xsfbs/xsfbs.mk create mode 100644 debian/xsfbs/xsfbs.sh create mode 100755 depcomp create mode 100755 install-sh create mode 100755 missing create mode 100755 mkinstalldirs create mode 100644 packaging/libXTrap.manifest create mode 100644 packaging/libXTrap.spec create mode 100644 src/Makefile.am create mode 100644 src/Makefile.in create mode 100644 src/XECallBcks.c create mode 100644 src/XEConTxt.c create mode 100644 src/XEDsptch.c create mode 100644 src/XEPrInfo.c create mode 100644 src/XERqsts.c create mode 100644 src/XEStrMap.c create mode 100644 src/XETrapInit.c create mode 100644 src/XEWrappers.c create mode 100644 xtrap.pc.in diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..ab0e01b --- /dev/null +++ b/AUTHORS @@ -0,0 +1 @@ +Keith Packard, HP and XFree86. diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..4ee13ed --- /dev/null +++ b/COPYING @@ -0,0 +1,22 @@ +$Id$ + +Copyright © 2001,2003 Keith Packard + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation, and that the name of Keith Packard not be used in +advertising or publicity pertaining to distribution of the software without +specific, written prior permission. Keith Packard makes no +representations about the suitability of this software for any purpose. It +is provided "as is" without express or implied warranty. + +KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR +CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. + diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..c46cf07 --- /dev/null +++ b/ChangeLog @@ -0,0 +1,38 @@ +2005-12-14 Kevin E. Martin + + * configure.ac: + Update package version number for final X11R7 release candidate. + +2005-12-03 Kevin E. Martin + + * configure.ac: + Update package version number for X11R7 RC3 release. + +2005-11-19 Kevin E. Martin + + * xtrap.pc.in: + Update pkgconfig files to separate library build-time dependencies + from application build-time dependencies. + +2005-10-18 Kevin E. Martin + + * configure.ac: + Update package version number for RC1 release. + +2005-07-08 Keith Packard + + * .cvsignore: + * src/.cvsignore: + * src/Makefile.am: + Add .cvsignore files + Switch _la_CFLAGS for AM_CFLAGS to clean up directory + +2005-05-17 + + * configure.ac: Remove rest of half-removed if statement + + * ChangeLog: remove irrelevant entries + +2005-04-16 Josh Triplett + + * Makefile.am: Tell automake about the manpage. diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..9b2eab4 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,31 @@ +# +# $Id$ +# +# Copyright © 2003 Keith Packard, Noah Levitt +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of Keith Packard not be used in +# advertising or publicity pertaining to distribution of the software without +# specific, written prior permission. Keith Packard makes no +# representations about the suitability of this software for any purpose. It +# is provided "as is" without express or implied warranty. +# +# KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +# EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR +# CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +# DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +# PERFORMANCE OF THIS SOFTWARE. + +AM_CFLAGS = $(XTRAP_CFLAGS) + +SUBDIRS = src + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = xtrap.pc + +EXTRA_DIST = xtrap.pc.in autogen.sh diff --git a/Makefile.in b/Makefile.in new file mode 100644 index 0000000..81c4aec --- /dev/null +++ b/Makefile.in @@ -0,0 +1,697 @@ +# Makefile.in generated by automake 1.10.2 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# +# $Id$ +# +# Copyright © 2003 Keith Packard, Noah Levitt +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of Keith Packard not be used in +# advertising or publicity pertaining to distribution of the software without +# specific, written prior permission. Keith Packard makes no +# representations about the suitability of this software for any purpose. It +# is provided "as is" without express or implied warranty. +# +# KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +# EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR +# CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +# DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +# PERFORMANCE OF THIS SOFTWARE. + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = . +DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(srcdir)/config.h.in \ + $(srcdir)/xtrap.pc.in $(top_srcdir)/configure AUTHORS COPYING \ + ChangeLog INSTALL NEWS config.guess config.sub depcomp \ + install-sh ltmain.sh missing mkinstalldirs +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno config.status.lineno +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = config.h +CONFIG_CLEAN_FILES = xtrap.pc +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(pkgconfigdir)" +pkgconfigDATA_INSTALL = $(INSTALL_DATA) +DATA = $(pkgconfig_DATA) +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) +am__remove_distdir = \ + { test ! -d $(distdir) \ + || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -fr $(distdir); }; } +DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.bz2 +GZIP_ENV = --best +distuninstallcheck_listfiles = find . -type f -print +distcleancheck_listfiles = find . -type f -print +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +XTRAP_CFLAGS = @XTRAP_CFLAGS@ +XTRAP_LIBS = @XTRAP_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AM_CFLAGS = $(XTRAP_CFLAGS) +SUBDIRS = src +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = xtrap.pc +EXTRA_DIST = xtrap.pc.in autogen.sh +all: config.h + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +.SUFFIXES: +am--refresh: + @: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \ + cd $(srcdir) && $(AUTOMAKE) --gnu \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + echo ' $(SHELL) ./config.status'; \ + $(SHELL) ./config.status;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(srcdir) && $(AUTOCONF) +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) + +config.h: stamp-h1 + @if test ! -f $@; then \ + rm -f stamp-h1; \ + $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \ + else :; fi + +stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status + @rm -f stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status config.h +$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_srcdir) && $(AUTOHEADER) + rm -f stamp-h1 + touch $@ + +distclean-hdr: + -rm -f config.h stamp-h1 +xtrap.pc: $(top_builddir)/config.status $(srcdir)/xtrap.pc.in + cd $(top_builddir) && $(SHELL) ./config.status $@ + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool config.lt +install-pkgconfigDATA: $(pkgconfig_DATA) + @$(NORMAL_INSTALL) + test -z "$(pkgconfigdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" + @list='$(pkgconfig_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(pkgconfigDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgconfigdir)/$$f'"; \ + $(pkgconfigDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgconfigdir)/$$f"; \ + done + +uninstall-pkgconfigDATA: + @$(NORMAL_UNINSTALL) + @list='$(pkgconfig_DATA)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(pkgconfigdir)/$$f'"; \ + rm -f "$(DESTDIR)$(pkgconfigdir)/$$f"; \ + done + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +$(RECURSIVE_CLEAN_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + $(am__remove_distdir) + test -d $(distdir) || mkdir $(distdir) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + distdir) \ + || exit 1; \ + fi; \ + done + -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 \ + ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ + || chmod -R a+r $(distdir) +dist-gzip: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) +dist-bzip2: distdir + tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 + $(am__remove_distdir) + +dist-lzma: distdir + tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma + $(am__remove_distdir) + +dist-tarZ: distdir + tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z + $(am__remove_distdir) + +dist-shar: distdir + shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz + $(am__remove_distdir) + +dist-zip: distdir + -rm -f $(distdir).zip + zip -rq $(distdir).zip $(distdir) + $(am__remove_distdir) + +dist dist-all: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 + $(am__remove_distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + case '$(DIST_ARCHIVES)' in \ + *.tar.gz*) \ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ + *.tar.bz2*) \ + bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.lzma*) \ + unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\ + *.tar.Z*) \ + uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ + *.shar.gz*) \ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ + *.zip*) \ + unzip $(distdir).zip ;;\ + esac + chmod -R a-w $(distdir); chmod a+w $(distdir) + mkdir $(distdir)/_build + mkdir $(distdir)/_inst + chmod a-w $(distdir) + dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ + && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ + && cd $(distdir)/_build \ + && ../configure --srcdir=.. --prefix="$$dc_install_base" \ + $(DISTCHECK_CONFIGURE_FLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ + distuninstallcheck \ + && chmod -R a-w "$$dc_install_base" \ + && ({ \ + (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ + distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ + } || { rm -rf "$$dc_destdir"; exit 1; }) \ + && rm -rf "$$dc_destdir" \ + && $(MAKE) $(AM_MAKEFLAGS) dist \ + && rm -rf $(DIST_ARCHIVES) \ + && $(MAKE) $(AM_MAKEFLAGS) distcleancheck + $(am__remove_distdir) + @(echo "$(distdir) archives ready for distribution: "; \ + list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ + sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' +distuninstallcheck: + @cd $(distuninstallcheck_dir) \ + && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ + || { echo "ERROR: files left after uninstall:" ; \ + if test -n "$(DESTDIR)"; then \ + echo " (check DESTDIR support)"; \ + fi ; \ + $(distuninstallcheck_listfiles) ; \ + exit 1; } >&2 +distcleancheck: distclean + @if test '$(srcdir)' = . ; then \ + echo "ERROR: distcleancheck can only run from a VPATH build" ; \ + exit 1 ; \ + fi + @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left in build directory after distclean:" ; \ + $(distcleancheck_listfiles) ; \ + exit 1; } >&2 +check-am: all-am +check: check-recursive +all-am: Makefile $(DATA) config.h +installdirs: installdirs-recursive +installdirs-am: + for dir in "$(DESTDIR)$(pkgconfigdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-hdr \ + distclean-libtool distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: install-pkgconfigDATA + +install-dvi: install-dvi-recursive + +install-exec-am: + +install-html: install-html-recursive + +install-info: install-info-recursive + +install-man: + +install-pdf: install-pdf-recursive + +install-ps: install-ps-recursive + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf $(top_srcdir)/autom4te.cache + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-pkgconfigDATA + +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \ + install-strip + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am am--refresh check check-am clean clean-generic \ + clean-libtool ctags ctags-recursive dist dist-all dist-bzip2 \ + dist-gzip dist-lzma dist-shar dist-tarZ dist-zip distcheck \ + distclean distclean-generic distclean-hdr distclean-libtool \ + distclean-tags distcleancheck distdir distuninstallcheck dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-pkgconfigDATA install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ + ps ps-am tags tags-recursive uninstall uninstall-am \ + uninstall-pkgconfigDATA + +# 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: diff --git a/NEWS b/NEWS new file mode 100644 index 0000000..e69de29 diff --git a/README b/README new file mode 100644 index 0000000..67cf1d8 --- /dev/null +++ b/README @@ -0,0 +1,10 @@ + Xfixes + XFIXES Extension + Version 2.0.1 + 2002-10-4 + +This package contains header files and documentation for the XFIXES +extension. Library and server implementations are separate. + +Keith Packard +keithp@keithp.com diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..218197d --- /dev/null +++ b/autogen.sh @@ -0,0 +1,12 @@ +#! /bin/sh + +srcdir=`dirname $0` +test -z "$srcdir" && srcdir=. + +ORIGDIR=`pwd` +cd $srcdir + +autoreconf -v --install || exit 1 +cd $ORIGDIR || exit $? + +#$srcdir/configure --enable-maintainer-mode "$@" diff --git a/config.h.in b/config.h.in new file mode 100644 index 0000000..bc7ae38 --- /dev/null +++ b/config.h.in @@ -0,0 +1,68 @@ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#undef LT_OBJDIR + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Major version of this package */ +#undef PACKAGE_VERSION_MAJOR + +/* Minor version of this package */ +#undef PACKAGE_VERSION_MINOR + +/* Patch version of this package */ +#undef PACKAGE_VERSION_PATCHLEVEL + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Version number of package */ +#undef VERSION diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..2bf95a0 --- /dev/null +++ b/configure.ac @@ -0,0 +1,48 @@ +dnl +dnl $Id$ +dnl +dnl Copyright © 2003 Keith Packard, Noah Levitt +dnl +dnl Permission to use, copy, modify, distribute, and sell this software and its +dnl documentation for any purpose is hereby granted without fee, provided that +dnl the above copyright notice appear in all copies and that both that +dnl copyright notice and this permission notice appear in supporting +dnl documentation, and that the name of Keith Packard not be used in +dnl advertising or publicity pertaining to distribution of the software without +dnl specific, written prior permission. Keith Packard makes no +dnl representations about the suitability of this software for any purpose. It +dnl is provided "as is" without express or implied warranty. +dnl +dnl KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +dnl INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +dnl EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR +dnl CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +dnl DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +dnl TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +dnl PERFORMANCE OF THIS SOFTWARE. +dnl +dnl Process this file with autoconf to create configure. + +AC_PREREQ([2.57]) + +AC_INIT(libXTrap, 1.0.0, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], libXTrap) +AM_INIT_AUTOMAKE([dist-bzip2]) +AM_MAINTAINER_MODE + +AM_CONFIG_HEADER(config.h) + +# Check for progs +AC_PROG_CC +AC_PROG_LIBTOOL + +# Check for dependencies +PKG_CHECK_MODULES(XTRAP, x11 xt trapproto xext xextproto) +AC_SUBST(XTRAP_CFLAGS) +AC_SUBST(XTRAP_LIBS) + +XORG_RELEASE_VERSION + +AC_OUTPUT([Makefile + src/Makefile + xtrap.pc]) + diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..b62f53a --- /dev/null +++ b/debian/changelog @@ -0,0 +1,110 @@ +libxtrap (2:1.0.0-10slp2) unstable; urgency=low + + * change the rules + * Git: 165.213.180.234:slp/pkgs/xorg/lib/libxtrap + * Tag: libxtrap_1.0.0-10slp2 + + -- SooChan Lim Fri, 03 Dec 2010 18:07:08 +0900 + +libxtrap (2:1.0.0-9slp2) unstable; urgency=low + + * Add --as-needed + * Git: 165.213.180.234:/git/slp/pkgs/xorg/lib/libxtrap + * Tag: libxtrap_1.0.0-9slp2 + + -- SooChan Lim Sat, 20 Nov 2010 16:06:59 +0900 + +libxtrap (2:1.0.0-8slp2) unstable; urgency=low + + * Update maintainer + * Git: 165.213.180.234:/git/slp2.0/slp2.0-pkgs/X11 + * Tag: libxtrap_1.0.0-8slp2 + + -- Sung-Jin Park Wed, 21 Apr 2010 14:11:33 +0900 + +libxtrap (2:1.0.0-7slp2) unstable; urgency=low + + * modify the package name + + -- SooChan Lim Thu, 25 Mar 2010 18:02:08 +0900 + +libxtrap (2:1.0.0-6) unstable; urgency=low + + * Import debian package + + -- Sung-Jin Park Tue, 08 Dec 2009 14:44:30 +0900 + +libxtrap (2:1.0.0-5) unstable; urgency=low + + [ Julien Cristau ] + * Add Vcs-* and drop outdated CVS info from the descriptions. + * Remove Branden and Fabio from Uploaders with their permission. + * Add myself to Uploaders. + * Bump Standards-Version to 3.7.3. + * Add a correct Section control field for each binary package. + * libxtrap6{,-dbg} don't need to depend on x11-common. + * Use ${binary:Version} instead of the obsolete ${Source-Version}. + * autoreconf with current autotools to get updated config.{guess,sub}. + + [ Timo Aaltonen ] + * Bump the epoch so that this can be synced to Ubuntu in the future. + + [ Drew Parsons ] + * dbg package has priority extra. + + -- Julien Cristau Sun, 11 May 2008 16:26:42 +0200 + +libxtrap (1:1.0.0-4) unstable; urgency=low + + * Test for obj-$(DEB_BUILD_GNU_TYPE) before creating it during build; + idempotency fix. + * Run dh_install w/ --list-missing. + * Drop duplicate x11-common dep in -dev package. + * Bump standards version to 3.7.2.0. + * Version x11-common pre-dep in -dev package to 1:7.0.0 to match + the rest of Debian. + * Bump debhelper compat to 5. + * Fix dh_strip call to skip the -dbg package. + * Don't attempt to install (non-existent) usr/include/X11/* stuff. + * Autoreconf w/ an updated xutils-dev so that manpages have the 'x' + extension dropped. + + -- Andres Salomon Sat, 29 Jul 2006 02:45:44 -0400 + +libxtrap (1:1.0.0-3) unstable; urgency=low + + * Reorder makeshlib command in rules file so that ldconfig is run + properly. Thanks Drew Parsons and Steve Langasek. + + -- David Nusinow Tue, 18 Apr 2006 21:49:56 -0400 + +libxtrap (1:1.0.0-2) unstable; urgency=low + + * Upload to unstable + + -- David Nusinow Thu, 23 Mar 2006 22:45:20 -0500 + +libxtrap (1:1.0.0-1) experimental; urgency=low + + * First modular upload to Debian + + -- David Nusinow Thu, 29 Dec 2005 20:55:34 -0500 + +libxtrap (1:3.0.0-3) breezy; urgency=low + + * Bump libxt-dev build-dep yet again, good riddance to _XOPEN_SOURCE. + + -- Adam Conrad Sun, 24 Jul 2005 10:49:32 +0000 + +libxtrap (1:3.0.0-2) breezy; urgency=low + + * Bump Build-Deps on libx11-dev, libxt-dev and libxext-dev to avoid + _XOPEN_SOURCE. + + -- Daniel Stone Sat, 23 Jul 2005 00:45:55 +1000 + +libxtrap (1:3.0.0-1) breezy; urgency=low + + * First libxtrap release. + + -- Daniel Stone Mon, 16 May 2005 22:10:17 +1000 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..7ed6ff8 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +5 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..4a96ca6 --- /dev/null +++ b/debian/control @@ -0,0 +1,53 @@ +Source: libxtrap +Section: x11 +Priority: optional +Maintainer: Sung-Jin Park , Debian X Strike Force +Uploaders: Sung-Jin Park , David Nusinow , Andres Salomon , Julien Cristau , SooChan Lim +Build-Depends: debhelper (>= 5.0.0), libx11-dev (>= 1:0.99.2), libxt-dev (>= 1:0.99.1), libxext-dev (>= 1:1.0.0), x11proto-trap-dev, pkg-config +Standards-Version: 3.7.3 +Vcs-Git: git://git.debian.org/git/pkg-xorg/lib/libxtrap +Vcs-Browser: http://git.debian.org/?p=pkg-xorg/lib/libtrap.git + +Package: libxtrap6 +Section: libs +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: X11 event trapping extension library + libXTrap provides an interface to the DEC-XTRAP extension, which allows + for capture and synthesis of core input events. + . + More information about X.Org can be found at: + + + +Package: libxtrap6-dbg +Section: libdevel +Priority: extra +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, libxtrap6 (= ${binary:Version}) +Description: X11 event trapping extension library (debug package) + libXTrap provides an interface to the DEC-XTRAP extension, which allows + for capture and synthesis of core input events. + . + This package contains the debug versions of the library found in libxtrap6. + Non-developers likely have little use for this package. + . + More information about X.Org can be found at: + + + +Package: libxtrap-dev +Section: libdevel +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, libxtrap6 (= ${binary:Version}), libx11-dev, x11proto-trap-dev +Pre-Depends: x11-common (>= 1:7.0.0) +Description: X11 event trapping extension library (development headers) + libXTrap provides an interface to the DEC-XTRAP extension, which allows + for capture and synthesis of core input events. + . + This package contains the development headers for the library found in + libxtrap6. Non-developers likely have little use for this package. + . + More information about X.Org can be found at: + + diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..7052a58 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,19 @@ +Copyright 1987, 1988, 1989, 1990, 1991, 1994 by Digital Equipment Corp., +Maynard, MA +X11R6 Changes Copyright (c) 1994 by Robert Chesler of Absol-Puter, Hudson, NH. + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL AND ABSOL-PUTER DISCLAIM ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS, IN NO EVENT SHALL DIGITAL OR ABSOL-PUTER BE LIABLE FOR ANY +SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER +RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF +CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN +CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/debian/libxtrap-dev.install b/debian/libxtrap-dev.install new file mode 100644 index 0000000..3d1dafe --- /dev/null +++ b/debian/libxtrap-dev.install @@ -0,0 +1,4 @@ +usr/lib/libXTrap.a +usr/lib/libXTrap.so +usr/lib/libXTrap.la +usr/lib/pkgconfig/xtrap.pc diff --git a/debian/libxtrap6.install b/debian/libxtrap6.install new file mode 100644 index 0000000..14071fb --- /dev/null +++ b/debian/libxtrap6.install @@ -0,0 +1 @@ +usr/lib/libXTrap.so.6* diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..1f8f533 --- /dev/null +++ b/debian/rules @@ -0,0 +1,96 @@ +#!/usr/bin/make -f +# debian/rules for the Debian libxtrap package. +# Copyright © 2004 Scott James Remnant +# Copyright © 2005 Daniel Stone +# Copyright © 2005 David Nusinow + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +# set this to the name of the main shlib's binary package +PACKAGE = libxtrap6 + +include debian/xsfbs/xsfbs.mk + +CFLAGS = -Wall -g +LDFLAGS += -Wl,--hash-style=both -Wl,--as-needed +ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) + CFLAGS += -O0 +else + CFLAGS += -O2 +endif +ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) + INSTALL_PROGRAM += -s +endif + +DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH) +DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) +DEB_BUILD_GNU_TYPE = $(DEB_HOST_GNU_TYPE) +ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE)) + confflags += --build=$(DEB_HOST_GNU_TYPE) +else + confflags += --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE) +endif + + +build: build-stamp +build-stamp: + dh_testdir + autoreconf -vfi + mkdir -p obj-$(DEB_BUILD_GNU_TYPE) + cd obj-$(DEB_BUILD_GNU_TYPE) && \ + ../configure --prefix=/usr --mandir=\$${prefix}/share/man \ + --infodir=\$${prefix}/share/info $(confflags) \ + CFLAGS="$(CFLAGS)" \ + LDFLAGS="$(LDFLAGS)" + cd obj-$(DEB_BUILD_GNU_TYPE) && $(MAKE) + >$@ + +# touch build-stamp + +clean: + dh_testdir + dh_testroot + rm -f build-stamp + + rm -f config.cache config.log config.status + rm -f */config.cache */config.log */config.status + rm -f conftest* */conftest* + rm -rf autom4te.cache */autom4te.cache + rm -rf obj-* + + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + cd obj-$(DEB_BUILD_GNU_TYPE) && $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot + + dh_installdocs + dh_install --sourcedir=debian/tmp --list-missing + dh_installchangelogs + dh_link + dh_strip --dbg-package=$(PACKAGE)-dbg + dh_compress + dh_fixperms + dh_makeshlibs + dh_shlibdeps + dh_installdeb + dh_gencontrol + dh_md5sums + dh_builddeb + +# Build architecture-independent files here. +binary-indep: build install +# Nothing to do + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install diff --git a/debian/watch b/debian/watch new file mode 100644 index 0000000..6f09f77 --- /dev/null +++ b/debian/watch @@ -0,0 +1,2 @@ +version=3 +http://xorg.freedesktop.org/releases/individual/lib/ libXTrap-(.*)\.tar\.gz diff --git a/debian/xsfbs/xsfbs.mk b/debian/xsfbs/xsfbs.mk new file mode 100644 index 0000000..6582a42 --- /dev/null +++ b/debian/xsfbs/xsfbs.mk @@ -0,0 +1,310 @@ +#!/usr/bin/make -f + +# Debian X Strike Force Build System (XSFBS): Make portion + +# Copyright 1996 Stephen Early +# Copyright 1997 Mark Eichin +# Copyright 1998-2005, 2007 Branden Robinson +# Copyright 2005 David Nusinow +# +# Licensed under the GNU General Public License, version 2. See the file +# /usr/share/common-licenses/GPL or . + +# Originally by Stephen Early +# Modified by Mark W. Eichin +# Modified by Adam Heath +# Modified by Branden Robinson +# Modified by Fabio Massimo Di Nitto +# Modified by David Nusinow +# Acknowledgements to Manoj Srivastava. + +# Pass $(DH_OPTIONS) into the environment for debhelper's benefit. +export DH_OPTIONS + +# force quilt to not use ~/.quiltrc +QUILT = quilt --quiltrc /dev/null +# force QUILT_PATCHES to the default in case it is exported in the environment +QUILT_PATCHES = patches/ + +# Set up parameters for the upstream build environment. + +# Determine (source) package name from Debian changelog. +SOURCE_NAME:=$(shell dpkg-parsechangelog -ldebian/changelog \ + | grep '^Source:' | awk '{print $$2}') + +# Determine package version from Debian changelog. +SOURCE_VERSION:=$(shell dpkg-parsechangelog -ldebian/changelog \ + | grep '^Version:' | awk '{print $$2}') + +# Determine upstream version number. +UPSTREAM_VERSION:=$(shell echo $(SOURCE_VERSION) | sed 's/-.*//') + +# Determine the source version without the epoch for make-orig-tar-gz +NO_EPOCH_VER:=$(shell echo $(UPSTREAM_VERSION) | sed 's/^.://') + +# Figure out who's building this package. +BUILDER:=$(shell echo $${DEBEMAIL:-$${EMAIL:-$$(echo $$LOGNAME@$$(cat /etc/mailname 2>/dev/null))}}) + +# Find out if this is an official build; an official build has nothing but +# digits, dots, and/or the strings "woody" or "sarge" in the Debian part of the +# version number. Anything else indicates an unofficial build. +OFFICIAL_BUILD:=$(shell VERSION=$(SOURCE_VERSION); if ! expr "$$(echo $${VERSION\#\#*-} | sed 's/\(woody\|sarge\)//g')" : ".*[^0-9.].*" >/dev/null 2>&1; then echo yes; fi) + +# Set up parameters for the Debian build environment. + +# Determine our architecture. +BUILD_ARCH:=$(shell dpkg-architecture -qDEB_BUILD_ARCH) +# Work around some old-time dpkg braindamage. +BUILD_ARCH:=$(subst i486,i386,$(BUILD_ARCH)) +# The DEB_HOST_ARCH variable may be set per the Debian cross-compilation policy. +ifdef DEB_HOST_ARCH + ARCH:=$(DEB_HOST_ARCH) +else + # dpkg-cross sets the ARCH environment variable; if set, use it. + ifdef ARCH + ARCH:=$(ARCH) + else + ARCH:=$(BUILD_ARCH) + endif +endif + +# $(STAMP_DIR) houses stamp files for complex targets. +STAMP_DIR:=stampdir + +# $(SOURCE_DIR) houses one or more source trees. +SOURCE_DIR:=build-tree + +# $(SOURCE_TREE) is the location of the source tree to be compiled. If there +# is more than one, others are found using this name plus a suffix to indicate +# the purpose of the additional tree (e.g., $(SOURCE_TREE)-custom). The +# "setup" target is responsible for creating such trees. +#SOURCE_TREE:=$(SOURCE_DIR)/xc +#FIXME We need to define this in our debian/rules file + +# $(DEBTREEDIR) is where all install rules are told (via $(DESTDIR)) to place +# their files. +DEBTREEDIR:=$(CURDIR)/debian/tmp + +# All "important" targets have four lines: +# 1) A target name that is invoked by a package-building tool or the user. +# This consists of a dependency on a "$(STAMP_DIR)/"-prefixed counterpart. +# 2) A line delcaring 1) as a phony target (".PHONY:"). +# 3) A "$(STAMP_DIR)/"-prefixed target which does the actual work, and may +# depend on other targets. +# 4) A line declaring 3) as a member of the $(stampdir_targets) variable; the +# "$(STAMP_DIR)/" prefix is omitted. +# +# This indirection is needed so that the "stamp" files that signify when a rule +# is done can be located in a separate "stampdir". Recall that make has no way +# to know when a goal has been met for a phony target (like "build" or +# "install"). +# +# At the end of each "$(STAMP_DIR)/" target, be sure to run the command ">$@" +# so that the target will not be run again. Removing the file will make Make +# run the target over. + +# All phony targets should be declared as dependencies of .PHONY, even if they +# do not have "($STAMP_DIR)/"-prefixed counterparts. + +# Define a harmless default rule to keep things from going nuts by accident. +.PHONY: default +default: + +# Set up the $(STAMP_DIR) directory. +.PHONY: stampdir +stampdir_targets+=stampdir +stampdir: $(STAMP_DIR)/stampdir +$(STAMP_DIR)/stampdir: + mkdir $(STAMP_DIR) + >$@ + +# Set up the package build directory as quilt expects to find it. +.PHONY: prepare +stampdir_targets+=prepare +prepare: $(STAMP_DIR)/genscripts $(STAMP_DIR)/prepare $(STAMP_DIR)/patches $(STAMP_DIR)/log +$(STAMP_DIR)/prepare: $(STAMP_DIR)/stampdir + if [ ! -e $(STAMP_DIR)/patches ]; then \ + mkdir $(STAMP_DIR)/patches; \ + ln -s $(STAMP_DIR)/patches .pc; \ + echo 2 >$(STAMP_DIR)/patches/.version; \ + fi; \ + if [ ! -e $(STAMP_DIR)/log ]; then \ + mkdir $(STAMP_DIR)/log; \ + fi; \ + if [ -e debian/patches ] && [ ! -e patches ]; then \ + ln -s debian/patches patches; \ + fi; \ + >$@ + +# Apply all patches to the upstream source. +.PHONY: patch +stampdir_targets+=patch +patch: $(STAMP_DIR)/patch +$(STAMP_DIR)/patch: $(STAMP_DIR)/prepare + if ! [ `which quilt` ]; then \ + echo "Couldn't find quilt. Please install it or add it to the build-depends for this package."; \ + exit 1; \ + fi; \ + if $(QUILT) next >/dev/null 2>&1; then \ + echo -n "Applying patches..."; \ + if $(QUILT) push -a -v >$(STAMP_DIR)/log/patch 2>&1; then \ + cat $(STAMP_DIR)/log/patch; \ + echo "successful."; \ + else \ + cat $(STAMP_DIR)/log/patch; \ + echo "failed! (check $(STAMP_DIR)/log/patch for details)"; \ + exit 1; \ + fi; \ + else \ + echo "No patches to apply"; \ + fi; \ + >$@ + +# Revert all patches to the upstream source. +.PHONY: unpatch +unpatch: + rm -f $(STAMP_DIR)/patch + @echo -n "Unapplying patches..."; \ + if [ -e $(STAMP_DIR)/patches/applied-patches ]; then \ + if $(QUILT) pop -a -v >$(STAMP_DIR)/log/unpatch 2>&1; then \ + cat $(STAMP_DIR)/log/unpatch; \ + echo "successful."; \ + else \ + cat $(STAMP_DIR)/log/unpatch; \ + echo "failed! (check $(STAMP_DIR)/log/unpatch for details)"; \ + exit 1; \ + fi; \ + else \ + echo "nothing to do."; \ + fi + +# Clean the generated maintainer scripts. +.PHONY: cleanscripts +cleanscripts: + rm -f $(STAMP_DIR)/genscripts + rm -f debian/*.config \ + debian/*.postinst \ + debian/*.postrm \ + debian/*.preinst \ + debian/*.prerm + +# Clean the package build tree. +.PHONY: xsfclean +xsfclean: cleanscripts unpatch + dh_testdir + rm -f .pc patches + rm -rf $(STAMP_DIR) $(SOURCE_DIR) + rm -rf imports + dh_clean debian/shlibs.local \ + debian/po/pothead + +# Generate the debconf templates POT file header. +debian/po/pothead: debian/po/pothead.in + sed -e 's/SOURCE_VERSION/$(SOURCE_VERSION)/' \ + -e 's/DATE/$(shell date "+%F %X%z"/)' <$< >$@ + +# Update POT and PO files. +.PHONY: updatepo +updatepo: debian/po/pothead + debian/scripts/debconf-updatepo --pot-header=pothead --verbose + +# Remove files from the upstream source tree that we don't need, or which have +# licensing problems. It must be run before creating the .orig.tar.gz. +# +# Note: This rule is for Debian package maintainers' convenience, and is not +# needed for conventional build scenarios. +.PHONY: prune-upstream-tree +prune-upstream-tree: + # Ensure we're in the correct directory. + dh_testdir + grep -rvh '^#' debian/prune/ | xargs --no-run-if-empty rm -rf + +# Verify that there are no offsets or fuzz in the patches we apply. +# +# Note: This rule is for Debian package maintainers' convenience, and is not +# needed for conventional build scenarios. +.PHONY: patch-audit +patch-audit: prepare unpatch + @echo -n "Auditing patches..."; \ + >$(STAMP_DIR)/log/patch; \ + FUZZY=; \ + while [ -n "$$($(QUILT) next)" ]; do \ + RESULT=$$($(QUILT) push -v | tee -a $(STAMP_DIR)/log/patch | grep ^Hunk | sed 's/^Hunk.*\(succeeded\|FAILED\).*/\1/');\ + case "$$RESULT" in \ + succeeded) \ + echo "fuzzy patch: $$($(QUILT) top)" \ + | tee -a $(STAMP_DIR)/log/$$($(QUILT) top); \ + FUZZY=yes; \ + ;; \ + FAILED) \ + echo "broken patch: $$($(QUILT) next)" \ + | tee -a $(STAMP_DIR)/log/$$($(QUILT) next); \ + exit 1; \ + ;; \ + esac; \ + done; \ + if [ -n "$$FUZZY" ]; then \ + echo "there were fuzzy patches; please fix."; \ + exit 1; \ + else \ + echo "done."; \ + fi + +# Generate the maintainer scripts. +.PHONY: genscripts +stampdir_targets+=genscripts +genscripts: $(STAMP_DIR)/genscripts +$(STAMP_DIR)/genscripts: $(STAMP_DIR)/stampdir + for FILE in debian/*.config.in \ + debian/*.postinst.in \ + debian/*.postrm.in \ + debian/*.preinst.in \ + debian/*.prerm.in; do \ + if [ -e "$$FILE" ]; then \ + MAINTSCRIPT=$$(echo $$FILE | sed 's/.in$$//'); \ + sed -n '1,/^#INCLUDE_SHELL_LIB#$$/p' <$$FILE \ + | sed -e '/^#INCLUDE_SHELL_LIB#$$/d' >$$MAINTSCRIPT.tmp; \ + cat debian/xsfbs/xsfbs.sh >>$$MAINTSCRIPT.tmp; \ + sed -n '/^#INCLUDE_SHELL_LIB#$$/,$$p' <$$FILE \ + | sed -e '/^#INCLUDE_SHELL_LIB#$$/d' >>$$MAINTSCRIPT.tmp; \ + sed -e 's/@SOURCE_VERSION@/$(SOURCE_VERSION)/' \ + -e 's/@OFFICIAL_BUILD@/$(OFFICIAL_BUILD)/' \ + -e 's/@DEFAULT_DCRESOLUTIONS@/$(DEFAULT_DCRESOLUTIONS)/' \ + <$$MAINTSCRIPT.tmp >$$MAINTSCRIPT; \ + rm $$MAINTSCRIPT.tmp; \ + fi; \ + done + # Validate syntax of generated shell scripts. + #sh debian/scripts/validate-posix-sh debian/*.config \ + # debian/*.postinst \ + # debian/*.postrm \ + # debian/*.preinst \ + # debian/*.prerm + >$@ + +# Generate the shlibs.local file. +debian/shlibs.local: + cat debian/*.shlibs >$@ + +SERVERMINVERS = $(shell cat /usr/share/xserver-xorg/serverminver 2>/dev/null) +VIDEOABI = $(shell cat /usr/share/xserver-xorg/videoabiver 2>/dev/null) +INPUTABI = $(shell cat /usr/share/xserver-xorg/inputabiver 2>/dev/null) +SERVER_DEPENDS = xserver-xorg-core (>= $(SERVERMINVERS)) +VIDDRIVER_PROVIDES = xserver-xorg-video-$(VIDEOABI) +INPDRIVER_PROVIDES = xserver-xorg-input-$(INPUTABI) +ifeq ($(PACKAGE),) +PACKAGE=$(shell awk '/^Package:/ { print $$2; exit }' < debian/control) +endif + +.PHONY: serverabi +serverabi: install +ifeq ($(SERVERMINVERS),) + @echo error: xserver-xorg-dev needs to be installed + @exit 1 +else + echo "xserver:Depends=$(SERVER_DEPENDS)" >> debian/$(PACKAGE).substvars + echo "xviddriver:Provides=$(VIDDRIVER_PROVIDES)" >> debian/$(PACKAGE).substvars + echo "xinpdriver:Provides=$(INPDRIVER_PROVIDES)" >> debian/$(PACKAGE).substvars +endif + +# vim:set noet ai sts=8 sw=8 tw=0: diff --git a/debian/xsfbs/xsfbs.sh b/debian/xsfbs/xsfbs.sh new file mode 100644 index 0000000..a90ff7d --- /dev/null +++ b/debian/xsfbs/xsfbs.sh @@ -0,0 +1,900 @@ +# $Id$ + +# This is the X Strike Force shell library for X Window System package +# maintainer scripts. It serves to define shell functions commonly used by +# such packages, and performs some error checking necessary for proper operation +# of those functions. By itself, it does not "do" much; the maintainer scripts +# invoke the functions defined here to accomplish package installation and +# removal tasks. + +# If you are reading this within a Debian package maintainer script (e.g., +# /var/lib/dpkg)info/PACKAGE.{config,preinst,postinst,prerm,postrm}), you can +# skip past this library by scanning forward in this file to the string +# "GOBSTOPPER". + +SOURCE_VERSION=@SOURCE_VERSION@ +OFFICIAL_BUILD=@OFFICIAL_BUILD@ + +# Use special abnormal exit codes so that problems with this library are more +# easily tracked down. +SHELL_LIB_INTERNAL_ERROR=86 +SHELL_LIB_THROWN_ERROR=74 +SHELL_LIB_USAGE_ERROR=99 + +# old -> new variable names +if [ -z "$DEBUG_XORG_PACKAGE" ] && [ -n "$DEBUG_XFREE86_PACKAGE" ]; then + DEBUG_XORG_PACKAGE="$DEBUG_XFREE86_PACKAGE" +fi +if [ -z "$DEBUG_XORG_DEBCONF" ] && [ -n "$DEBUG_XFREE86_DEBCONF" ]; then + DEBUG_XORG_DEBCONF="$DEBUG_XFREE86_DEBCONF" +fi + +# initial sanity checks +if [ -z "$THIS_PACKAGE" ]; then + cat >&2 < on the World Wide Web for +instructions, read the file /usr/share/doc/debian/bug-reporting.txt from the +"doc-debian" package, or install the "reportbug" package and use the command of +the same name to file a report against version $SOURCE_VERSION of this package. +EOF + exit $SHELL_LIB_USAGE_ERROR +fi + +if [ -z "$THIS_SCRIPT" ]; then + cat >&2 < on the World Wide Web for +instructions, read the file /usr/share/doc/debian/bug-reporting.txt from the +"doc-debian" package, or install the "reportbug" package and use the command of +the same name to file a report against version $SOURCE_VERSION of the +"$THIS_PACKAGE" package. +EOF + exit $SHELL_LIB_USAGE_ERROR +fi + +ARCHITECTURE="$(dpkg --print-installation-architecture)" + +if [ "$1" = "reconfigure" ] || [ -n "$DEBCONF_RECONFIGURE" ]; then + RECONFIGURE="true" +else + RECONFIGURE= +fi + +if ([ "$1" = "install" ] || [ "$1" = "configure" ]) && [ -z "$2" ]; then + FIRSTINST="yes" +fi + +if [ -z "$RECONFIGURE" ] && [ -z "$FIRSTINST" ]; then + UPGRADE="yes" +fi + +trap "message;\ + message \"Received signal. Aborting $THIS_PACKAGE package $THIS_SCRIPT script.\";\ + message;\ + exit 1" HUP INT QUIT TERM + +reject_nondigits () { + # syntax: reject_nondigits [ operand ... ] + # + # scan operands (typically shell variables whose values cannot be trusted) for + # characters other than decimal digits and barf if any are found + while [ -n "$1" ]; do + # does the operand contain anything but digits? + if ! expr "$1" : "[[:digit:]]\+$" > /dev/null 2>&1; then + # can't use die(), because it wraps message() which wraps this function + echo "$THIS_PACKAGE $THIS_SCRIPT error: reject_nondigits() encountered" \ + "possibly malicious garbage \"$1\"" >&2 + exit $SHELL_LIB_THROWN_ERROR + fi + shift + done +} + +reject_whitespace () { + # syntax: reject_whitespace [ operand ] + # + # scan operand (typically a shell variable whose value cannot be trusted) for + # whitespace characters and barf if any are found + if [ -n "$1" ]; then + # does the operand contain any whitespace? + if expr "$1" : "[[:space:]]" > /dev/null 2>&1; then + # can't use die(), because I want to avoid forward references + echo "$THIS_PACKAGE $THIS_SCRIPT error: reject_whitespace() encountered" \ + "possibly malicious garbage \"$1\"" >&2 + exit $SHELL_LIB_THROWN_ERROR + fi + fi +} + +reject_unlikely_path_chars () { + # syntax: reject_unlikely_path_chars [ operand ... ] + # + # scan operands (typically shell variables whose values cannot be trusted) for + # characters unlikely to be seen in a path and which the shell might + # interpret and barf if any are found + while [ -n "$1" ]; do + # does the operand contain any funny characters? + if expr "$1" : '.*[!$&()*;<>?|].*' > /dev/null 2>&1; then + # can't use die(), because I want to avoid forward references + echo "$THIS_PACKAGE $THIS_SCRIPT error: reject_unlikely_path_chars()" \ + "encountered possibly malicious garbage \"$1\"" >&2 + exit $SHELL_LIB_THROWN_ERROR + fi + shift + done +} + +# Query the terminal to establish a default number of columns to use for +# displaying messages to the user. This is used only as a fallback in the +# event the COLUMNS variable is not set. ($COLUMNS can react to SIGWINCH while +# the script is running, and this cannot, only being calculated once.) +DEFCOLUMNS=$(stty size 2> /dev/null | awk '{print $2}') || true +if ! expr "$DEFCOLUMNS" : "[[:digit:]]\+$" > /dev/null 2>&1; then + DEFCOLUMNS=80 +fi + +message () { + # pretty-print messages of arbitrary length + reject_nondigits "$COLUMNS" + echo "$*" | fmt -t -w ${COLUMNS:-$DEFCOLUMNS} >&2 +} + +observe () { + # syntax: observe message ... + # + # issue observational message suitable for logging someday when support for + # it exists in dpkg + if [ -n "$DEBUG_XORG_PACKAGE" ]; then + message "$THIS_PACKAGE $THIS_SCRIPT note: $*" + fi +} + +warn () { + # syntax: warn message ... + # + # issue warning message suitable for logging someday when support for + # it exists in dpkg; also send to standard error + message "$THIS_PACKAGE $THIS_SCRIPT warning: $*" +} + +die () { + # syntax: die message ... + # + # exit script with error message + message "$THIS_PACKAGE $THIS_SCRIPT error: $*" + exit $SHELL_LIB_THROWN_ERROR +} + +internal_error () { + # exit script with error; essentially a "THIS SHOULD NEVER HAPPEN" message + message "internal error: $*" + if [ -n "$OFFICIAL_BUILD" ]; then + message "Please report a bug in the $THIS_SCRIPT script of the" \ + "$THIS_PACKAGE package, version $SOURCE_VERSION to the Debian Bug" \ + "Tracking System. Include all messages above that mention the" \ + "$THIS_PACKAGE package. Visit " \ + " on the World Wide Web for" \ + "instructions, read the file" \ + "/usr/share/doc/debian/bug-reporting.txt from the doc-debian" \ + "package, or install the reportbug package and use the command of" \ + "the same name to file a report." + fi + exit $SHELL_LIB_INTERNAL_ERROR +} + +usage_error () { + message "usage error: $*" + message "Please report a bug in the $THIS_SCRIPT script of the" \ + "$THIS_PACKAGE package, version $SOURCE_VERSION to the Debian Bug" \ + "Tracking System. Include all messages above that mention the" \ + "$THIS_PACKAGE package. Visit " \ + " on the World Wide Web for" \ + "instructions, read the file" \ + "/usr/share/doc/debian/bug-reporting.txt from the doc-debian" \ + "package, or install the reportbug package and use the command of" \ + "the same name to file a report." + exit $SHELL_LIB_USAGE_ERROR +} + + +maplink () { + # returns what symlink should point to; i.e., what the "sane" answer is + # Keep this in sync with the debian/*.links files. + # This is only needed for symlinks to directories. + # + # XXX: Most of these look wrong in the X11R7 world and need to be fixed. + # If we've stopped using this function, fixing it might enable us to re-enable + # it again and catch more errors. + case "$1" in + /etc/X11/xkb/compiled) echo /var/lib/xkb ;; + /etc/X11/xkb/xkbcomp) echo /usr/X11R6/bin/xkbcomp ;; + /usr/X11R6/lib/X11/app-defaults) echo /etc/X11/app-defaults ;; + /usr/X11R6/lib/X11/fs) echo /etc/X11/fs ;; + /usr/X11R6/lib/X11/lbxproxy) echo /etc/X11/lbxproxy ;; + /usr/X11R6/lib/X11/proxymngr) echo /etc/X11/proxymngr ;; + /usr/X11R6/lib/X11/rstart) echo /etc/X11/rstart ;; + /usr/X11R6/lib/X11/twm) echo /etc/X11/twm ;; + /usr/X11R6/lib/X11/xdm) echo /etc/X11/xdm ;; + /usr/X11R6/lib/X11/xinit) echo /etc/X11/xinit ;; + /usr/X11R6/lib/X11/xkb) echo /etc/X11/xkb ;; + /usr/X11R6/lib/X11/xserver) echo /etc/X11/xserver ;; + /usr/X11R6/lib/X11/xsm) echo /etc/X11/xsm ;; + /usr/bin/X11) echo ../X11R6/bin ;; + /usr/bin/rstartd) echo ../X11R6/bin/rstartd ;; + /usr/include/X11) echo ../X11R6/include/X11 ;; + /usr/lib/X11) echo ../X11R6/lib/X11 ;; + *) internal_error "maplink() called with unknown path \"$1\"" ;; + esac +} + +analyze_path () { + # given a supplied set of pathnames, break each one up by directory and do an + # ls -dl on each component, cumulatively; i.e. + # analyze_path /usr/X11R6/bin -> ls -dl /usr /usr/X11R6 /usr/X11R6/bin + # Thanks to Randolph Chung for this clever hack. + + #local f g + + while [ -n "$1" ]; do + reject_whitespace "$1" + _g= + message "Analyzing $1:" + for _f in $(echo "$1" | tr / \ ); do + if [ -e /$_g$_f ]; then + ls -dl /$_g$_f /$_g$_f.dpkg-* 2> /dev/null || true + _g=$_g$_f/ + else + message "/$_g$_f: nonexistent; directory contents of /$_g:" + ls -l /$_g + break + fi + done + shift + done +} + +find_culprits () { + #local f p dpkg_info_dir possible_culprits smoking_guns bad_packages package \ + # msg + + reject_whitespace "$1" + message "Searching for overlapping packages..." + _dpkg_info_dir=/var/lib/dpkg/info + if [ -d $_dpkg_info_dir ]; then + if [ "$(echo $_dpkg_info_dir/*.list)" != "$_dpkg_info_dir/*.list" ]; then + _possible_culprits=$(ls -1 $_dpkg_info_dir/*.list | egrep -v \ + "(xbase-clients|x11-common|xfs|xlibs)") + if [ -n "$_possible_culprits" ]; then + _smoking_guns=$(grep -l "$1" $_possible_culprits || true) + if [ -n "$_smoking_guns" ]; then + _bad_packages=$(printf "\\n") + for f in $_smoking_guns; do + # too bad you can't nest parameter expansion voodoo + p=${f%*.list} # strip off the trailing ".list" + _package=${p##*/} # strip off the directories + _bad_packages=$(printf "%s\n%s" "$_bad_packages" "$_package") + done + _msg=$(cat < /dev/null 2>&1; then + message "The readlink command was not found. Please install version" \ + "1.13.1 or later of the debianutils package." + readlink () { + # returns what symlink in $1 actually points to + perl -e '$l = shift; exit 1 unless -l $l; $r = readlink $l; exit 1 unless $r; print "$r\n"' "$1" + } +fi + +check_symlink () { + # syntax: check_symlink symlink + # + # See if specified symlink points where it is supposed to. Return 0 if it + # does, and 1 if it does not. + # + # Primarily used by check_symlinks_and_warn() and check_symlinks_and_bomb(). + + #local symlink + + # validate arguments + if [ $# -ne 1 ]; then + usage_error "check_symlink() called with wrong number of arguments;" \ + "expected 1, got $#" + exit $SHELL_LIB_USAGE_ERROR + fi + + _symlink="$1" + + if [ "$(maplink "$_symlink")" = "$(readlink "$_symlink")" ]; then + return 0 + else + return 1 + fi +} + +check_symlinks_and_warn () { + # syntax: check_symlinks_and_warn symlink ... + # + # For each argument, check for symlink sanity, and warn if it isn't sane. + # + # Call this function from a preinst script in the event $1 is "upgrade" or + # "install". + + #local errmsg symlink + + # validate arguments + if [ $# -lt 1 ]; then + usage_error "check_symlinks_and_warn() called with wrong number of" \ + "arguments; expected at least 1, got $#" + exit $SHELL_LIB_USAGE_ERROR + fi + + while [ -n "$1" ]; do + _symlink="$1" + if [ -L "$_symlink" ]; then + if ! check_symlink "$_symlink"; then + observe "$_symlink symbolic link points to wrong location" \ + "$(readlink "$_symlink"); removing" + rm "$_symlink" + fi + elif [ -e "$_symlink" ]; then + _errmsg="$_symlink exists and is not a symbolic link; this package cannot" + _errmsg="$_errmsg be installed until this" + if [ -f "$_symlink" ]; then + _errmsg="$_errmsg file" + elif [ -d "$_symlink" ]; then + _errmsg="$_errmsg directory" + else + _errmsg="$_errmsg thing" + fi + _errmsg="$_errmsg is removed" + die "$_errmsg" + fi + shift + done +} + +check_symlinks_and_bomb () { + # syntax: check_symlinks_and_bomb symlink ... + # + # For each argument, check for symlink sanity, and bomb if it isn't sane. + # + # Call this function from a postinst script. + + #local problem symlink + + # validate arguments + if [ $# -lt 1 ]; then + usage_error "check_symlinks_and_bomb() called with wrong number of" + "arguments; expected at least 1, got $#" + exit $SHELL_LIB_USAGE_ERROR + fi + + while [ -n "$1" ]; do + _problem= + _symlink="$1" + if [ -L "$_symlink" ]; then + if ! check_symlink "$_symlink"; then + _problem=yes + warn "$_symlink symbolic link points to wrong location" \ + "$(readlink "$_symlink")" + fi + elif [ -e "$_symlink" ]; then + _problem=yes + warn "$_symlink is not a symbolic link" + else + _problem=yes + warn "$_symlink symbolic link does not exist" + fi + if [ -n "$_problem" ]; then + analyze_path "$_symlink" "$(readlink "$_symlink")" + find_culprits "$_symlink" + die "bad symbolic links on system" + fi + shift + done +} + +font_update () { + # run $UPDATECMDS in $FONTDIRS + + #local dir cmd shortcmd x_font_dir_prefix + + _x_font_dir_prefix="/usr/share/fonts/X11" + + if [ -z "$UPDATECMDS" ]; then + usage_error "font_update() called but \$UPDATECMDS not set" + fi + if [ -z "$FONTDIRS" ]; then + usage_error "font_update() called but \$FONTDIRS not set" + fi + + reject_unlikely_path_chars "$UPDATECMDS" + reject_unlikely_path_chars "$FONTDIRS" + + for _dir in $FONTDIRS; do + if [ -d "$_x_font_dir_prefix/$_dir" ]; then + for _cmd in $UPDATECMDS; do + if which "$_cmd" > /dev/null 2>&1; then + _shortcmd=${_cmd##*/} + observe "running $_shortcmd in $_dir font directory" + _cmd_opts= + if [ "$_shortcmd" = "update-fonts-alias" ]; then + _cmd_opts=--x11r7-layout + fi + if [ "$_shortcmd" = "update-fonts-dir" ]; then + _cmd_opts=--x11r7-layout + fi + if [ "$_shortcmd" = "update-fonts-scale" ]; then + _cmd_opts=--x11r7-layout + fi + $_cmd $_cmd_opts $_dir || warn "$_cmd $_cmd_opts $_dir" \ + "failed; font directory data may not" \ + "be up to date" + else + warn "$_cmd not found; not updating corresponding $_dir font" \ + "directory data" + fi + done + else + warn "$_dir is not a directory; not updating font directory data" + fi + done +} + +remove_conffile_prepare () { + # syntax: remove_conffile_prepare filename official_md5sum ... + # + # Check a conffile "filename" against a list of canonical MD5 checksums. + # If the file's current MD5 checksum matches one of the "official_md5sum" + # operands provided, then prepare the conffile for removal from the system. + # We defer actual deletion until the package is configured so that we can + # roll this operation back if package installation fails. + # + # Call this function from a preinst script in the event $1 is "upgrade" or + # "install" and verify $2 to ensure the package is being upgraded from a + # version (or installed over a version removed-but-not-purged) prior to the + # one in which the conffile was obsoleted. + + #local conffile current_checksum + + # validate arguments + if [ $# -lt 2 ]; then + usage_error "remove_conffile_prepare() called with wrong number of" \ + "arguments; expected at least 2, got $#" + exit $SHELL_LIB_USAGE_ERROR + fi + + _conffile="$1" + shift + + # does the _conffile even exist? + if [ -e "$_conffile" ]; then + # calculate its checksum + _current_checksum=$(md5sum < "$_conffile" | sed 's/[[:space:]].*//') + # compare it to each supplied checksum + while [ -n "$1" ]; do + if [ "$_current_checksum" = "$1" ]; then + # we found a match; move the confffile and stop looking + observe "preparing obsolete conffile $_conffile for removal" + mv "$_conffile" "$_conffile.$THIS_PACKAGE-tmp" + break + fi + shift + done + fi +} + +remove_conffile_commit () { + # syntax: remove_conffile_commit filename + # + # Complete the removal of a conffile "filename" that has become obsolete. + # + # Call this function from a postinst script after having used + # remove_conffile_prepare() in the preinst. + + #local conffile + + # validate arguments + if [ $# -ne 1 ]; then + usage_error "remove_conffile_commit() called with wrong number of" \ + "arguments; expected 1, got $#" + exit $SHELL_LIB_USAGE_ERROR + fi + + _conffile="$1" + + # if the temporary file created by remove_conffile_prepare() exists, remove it + if [ -e "$_conffile.$THIS_PACKAGE-tmp" ]; then + observe "committing removal of obsolete conffile $_conffile" + rm "$_conffile.$THIS_PACKAGE-tmp" + fi +} + +remove_conffile_rollback () { + # syntax: remove_conffile_rollback filename + # + # Roll back the removal of a conffile "filename". + # + # Call this function from a postrm script in the event $1 is "abort-upgrade" + # or "abort-install" is after having used remove_conffile_prepare() in the + # preinst. + + #local conffile + + # validate arguments + if [ $# -ne 1 ]; then + usage_error "remove_conffile_rollback() called with wrong number of" \ + "arguments; expected 1, got $#" + exit $SHELL_LIB_USAGE_ERROR + fi + + _conffile="$1" + + # if the temporary file created by remove_conffile_prepare() exists, move it + # back + if [ -e "$_conffile.$THIS_PACKAGE-tmp" ]; then + observe "rolling back removal of obsolete conffile $_conffile" + mv "$_conffile.$THIS_PACKAGE-tmp" "$_conffile" + fi +} + +replace_conffile_with_symlink_prepare () { + # syntax: replace_conffile_with_symlink_prepare oldfilename newfilename \ + # official_md5sum ... + # + # Check a conffile "oldfilename" against a list of canonical MD5 checksums. + # If the file's current MD5 checksum matches one of the "official_md5sum" + # operands provided, then prepare the conffile for removal from the system. + # We defer actual deletion until the package is configured so that we can + # roll this operation back if package installation fails. Otherwise copy it + # to newfilename and let dpkg handle it through conffiles mechanism. + # + # Call this function from a preinst script in the event $1 is "upgrade" or + # "install" and verify $2 to ensure the package is being upgraded from a + # version (or installed over a version removed-but-not-purged) prior to the + # one in which the conffile was obsoleted. + + #local conffile current_checksum + + # validate arguments + if [ $# -lt 3 ]; then + usage_error "replace_conffile_with_symlink_prepare() called with wrong" \ + " number of arguments; expected at least 3, got $#" + exit $SHELL_LIB_USAGE_ERROR + fi + + _oldconffile="$1" + shift + _newconffile="$1" + shift + + remove_conffile_prepare "$_oldconffile" "$@" + # If $_oldconffile still exists, then md5sums didn't match. + # Copy it to new one. + if [ -f "$_oldconffile" ]; then + cp "$_oldconffile" "$_newconffile" + fi + +} + +replace_conffile_with_symlink_commit () { + # syntax: replace_conffile_with_symlink_commit oldfilename + # + # Complete the removal of a conffile "oldfilename" that has been + # replaced by a symlink. + # + # Call this function from a postinst script after having used + # replace_conffile_with_symlink_prepare() in the preinst. + + #local conffile + + # validate arguments + if [ $# -ne 1 ]; then + usage_error "replace_conffile_with_symlink_commit() called with wrong" \ + "number of arguments; expected 1, got $#" + exit $SHELL_LIB_USAGE_ERROR + fi + + _conffile="$1" + + remove_conffile_commit "$_conffile" +} + +replace_conffile_with_symlink_rollback () { + # syntax: replace_conffile_with_symlink_rollback oldfilename newfilename + # + # Roll back the replacing of a conffile "oldfilename" with symlink to + # "newfilename". + # + # Call this function from a postrm script in the event $1 is "abort-upgrade" + # or "abort-install" and verify $2 to ensure the package failed to upgrade + # from a version (or install over a version removed-but-not-purged) prior + # to the one in which the conffile was obsoleted. + # You should have used replace_conffile_with_symlink_prepare() in the + # preinst. + + #local conffile + + # validate arguments + if [ $# -ne 2 ]; then + usage_error "replace_conffile_with_symlink_rollback() called with wrong" \ + "number of arguments; expected 2, got $#" + exit $SHELL_LIB_USAGE_ERROR + fi + + _oldconffile="$1" + _newconffile="$2" + + remove_conffile_rollback "$_oldconffile" + if [ -f "$_newconffile" ]; then + rm "$_newconffile" + fi +} + +run () { + # syntax: run command [ argument ... ] + # + # Run specified command with optional arguments and report its exit status. + # Useful for commands whose exit status may be nonzero, but still acceptable, + # or commands whose failure is not fatal to us. + # + # NOTE: Do *not* use this function with db_get or db_metaget commands; in + # those cases the return value of the debconf command *must* be checked + # before the string returned by debconf is used for anything. + + #local retval + + # validate arguments + if [ $# -lt 1 ]; then + usage_error "run() called with wrong number of arguments; expected at" \ + "least 1, got $#" + exit $SHELL_LIB_USAGE_ERROR + fi + + "$@" || _retval=$? + + if [ ${_retval:-0} -ne 0 ]; then + observe "command \"$*\" exited with status $_retval" + fi +} + +register_x_lib_dir_with_ld_so () { + # syntax: register_x_lib_dir_with_ld_so + # + # Configure the dynamic loader ld.so to search /usr/X11R6/lib for shared + # libraries. + # + # Call this function from the postinst script of a package that places a + # shared library in /usr/X11R6/lib, before invoking ldconfig. + + #local dir ldsoconf + + _dir="/usr/X11R6/lib" + _ldsoconf="/etc/ld.so.conf" + + # is the line not already present? + if ! fgrep -qsx "$_dir" "$_ldsoconf"; then + observe "adding $_dir directory to $_ldsoconf" + echo "$_dir" >> "$_ldsoconf" + fi +} + +deregister_x_lib_dir_with_ld_so () { + # syntax: deregister_x_lib_dir_with_ld_so + # + # Configure dynamic loader ld.so to not search /usr/X11R6/lib for shared + # libraries, if and only if no shared libaries remain there. + # + # Call this function from the postrm script of a package that places a shared + # library in /usr/X11R6/lib, in the event "$1" is "remove", and before + # invoking ldconfig. + + #local dir ldsoconf fgrep_status cmp_status + + _dir="/usr/X11R6/lib" + _ldsoconf="/etc/ld.so.conf" + + # is the line present? + if fgrep -qsx "$_dir" "$_ldsoconf"; then + # are there any shared objects in the directory? + if [ "$(echo "$_dir"/lib*.so.*.*)" = "$_dir/lib*.so.*.*" ]; then + # glob expansion produced nothing, so no shared libraries are present + observe "removing $_dir directory from $_ldsoconf" + # rewrite the file (very carefully) + set +e + fgrep -svx "$_dir" "$_ldsoconf" > "$_ldsoconf.dpkg-tmp" + _fgrep_status=$? + set -e + case $_fgrep_status in + 0|1) ;; # we don't actually care if any lines matched or not + *) die "error reading \"$_ldsoconf\"; fgrep exited with status" \ + "$_fgrep_status" ;; + esac + set +e + cmp -s "$_ldsoconf.dpkg-tmp" "$_ldsoconf" + _cmp_status=$? + set -e + case $_cmp_status in + 0) rm "$_ldsoconf.dpkg-tmp" ;; # files are identical + 1) mv "$_ldsoconf.dpkg-tmp" "$_ldsoconf" ;; # files differ + *) die "error comparing \"$_ldsoconf.dpkg-tmp\" to \"$_ldsoconf\";" \ + "cmp exited with status $_cmp_status" ;; + esac + fi + fi +} + +make_symlink_sane () { + # syntax: make_symlink_sane symlink target + # + # Ensure that the symbolic link symlink exists, and points to target. + # + # If symlink does not exist, create it and point it at target. + # + # If symlink exists but is not a symbolic link, back it up. + # + # If symlink exists, is a symbolic link, but points to the wrong location, fix + # it. + # + # If symlink exists, is a symbolic link, and already points to target, do + # nothing. + # + # This function wouldn't be needed if ln had an -I, --idempotent option. + + # Validate arguments. + if [ $# -ne 2 ]; then + usage_error "make_symlink_sane() called with wrong number of arguments;" \ + "expected 2, got $#" + exit $SHELL_LIB_USAGE_ERROR + fi + + # We could just use the positional parameters as-is, but that makes things + # harder to follow. + #local symlink target + + _symlink="$1" + _target="$2" + + if [ -L "$_symlink" ] && [ "$(readlink "$_symlink")" = "$_target" ]; then + observe "link from $_symlink to $_target already exists" + else + observe "creating symbolic link from $_symlink to $_target" + mkdir -p "${_target%/*}" "${_symlink%/*}" + ln -s -b -S ".dpkg-old" "$_target" "$_symlink" + fi +} + +migrate_dir_to_symlink () { + # syntax: migrate_dir_to_symlink old_location new_location + # + # Per Debian Policy section 6.5.4, "A directory will never be replaced by a + # symbolic link to a directory or vice versa; instead, the existing state + # (symlink or not) will be left alone and dpkg will follow the symlink if + # there is one." + # + # We have to do it ourselves. + # + # This function moves the contents of old_location, a directory, into + # new_location, a directory, then makes old_location a symbolic link to + # new_location. + # + # old_location need not exist, but if it does, it must be a directory (or a + # symlink to a directory). If it is not, it is backed up. If new_location + # exists already and is not a directory, it is backed up. + # + # This function should be called from a package's preinst so that other + # packages unpacked after this one --- but before this package's postinst runs + # --- are unpacked into new_location even if their payloads contain + # old_location filespecs. + + # Validate arguments. + if [ $# -ne 2 ]; then + usage_error "migrate_dir_to_symlink() called with wrong number of" + "arguments; expected 2, got $#" + exit $SHELL_LIB_USAGE_ERROR + fi + + # We could just use the positional parameters as-is, but that makes things + # harder to follow. + local _new _old + + _old="$1" + _new="$2" + + # Is old location a symlink? + if [ -L "$_old" ]; then + # Does it already point to new location? + if [ "$(readlink "$_old")" = "$_new" ]; then + # Nothing to do; migration has already been done. + observe "migration of $_old to $_new already done" + return 0 + else + # Back it up. + warn "backing up symbolic link $_old as $_old.dpkg-old" + mv -b "$_old" "$_old.dpkg-old" + fi + fi + + # Does old location exist, but is not a directory? + if [ -e "$_old" ] && ! [ -d "$_old" ]; then + # Back it up. + warn "backing up non-directory $_old as $_old.dpkg-old" + mv -b "$_old" "$_old.dpkg-old" + fi + + observe "migrating $_old to $_new" + + # Is new location a symlink? + if [ -L "$_new" ]; then + # Does it point the wrong way, i.e., back to where we're migrating from? + if [ "$(readlink "$_new")" = "$_old" ]; then + # Get rid of it. + observe "removing symbolic link $_new which points to $_old" + rm "$_new" + else + # Back it up. + warn "backing up symbolic link $_new as $_new.dpkg-old" + mv -b "$_new" "$_new.dpkg-old" + fi + fi + + # Does new location exist, but is not a directory? + if [ -e "$_new" ] && ! [ -d "$_new" ]; then + warn "backing up non-directory $_new as $_new.dpkg-old" + mv -b "$_new" "$_new.dpkg-old" + fi + + # Create new directory if it does not yet exist. + if ! [ -e "$_new" ]; then + observe "creating $_new" + mkdir -p "$_new" + fi + + # Copy files in old location to new location. Back up any filenames that + # already exist in the new location with the extension ".dpkg-old". + observe "copying files from $_old to $_new" + if ! (cd "$_old" && cp -a -b -S ".dpkg-old" . "$_new"); then + die "error(s) encountered while copying files from $_old to $_new" + fi + + # Remove files at old location. + observe "removing $_old" + rm -r "$_old" + + # Create symlink from old location to new location. + make_symlink_sane "$_old" "$_new" +} + +# vim:set ai et sw=2 ts=2 tw=80: + +# GOBSTOPPER: The X Strike Force shell library ends here. diff --git a/depcomp b/depcomp new file mode 100755 index 0000000..e5f9736 --- /dev/null +++ b/depcomp @@ -0,0 +1,589 @@ +#! /bin/sh +# depcomp - compile a program generating dependencies as side-effects + +scriptversion=2007-03-29.01 + +# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007 Free Software +# Foundation, Inc. + +# 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, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. + +# 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. + +# Originally written by Alexandre Oliva . + +case $1 in + '') + echo "$0: No command. Try \`$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: depcomp [--help] [--version] PROGRAM [ARGS] + +Run PROGRAMS ARGS to compile a file, generating dependencies +as side-effects. + +Environment variables: + depmode Dependency tracking mode. + source Source file read by `PROGRAMS ARGS'. + object Object file output by `PROGRAMS ARGS'. + DEPDIR directory where to store dependencies. + depfile Dependency file to output. + tmpdepfile Temporary file to use when outputing dependencies. + libtool Whether libtool is used (yes/no). + +Report bugs to . +EOF + exit $? + ;; + -v | --v*) + echo "depcomp $scriptversion" + exit $? + ;; +esac + +if test -z "$depmode" || test -z "$source" || test -z "$object"; then + echo "depcomp: Variables source, object and depmode must be set" 1>&2 + exit 1 +fi + +# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. +depfile=${depfile-`echo "$object" | + sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} +tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} + +rm -f "$tmpdepfile" + +# Some modes work just like other modes, but use different flags. We +# parameterize here, but still list the modes in the big case below, +# to make depend.m4 easier to write. Note that we *cannot* use a case +# here, because this file can only contain one case statement. +if test "$depmode" = hp; then + # HP compiler uses -M and no extra arg. + gccflag=-M + depmode=gcc +fi + +if test "$depmode" = dashXmstdout; then + # This is just like dashmstdout with a different argument. + dashmflag=-xM + depmode=dashmstdout +fi + +case "$depmode" in +gcc3) +## gcc 3 implements dependency tracking that does exactly what +## we want. Yay! Note: for some reason libtool 1.4 doesn't like +## it if -MD -MP comes after the -MF stuff. Hmm. +## Unfortunately, FreeBSD c89 acceptance of flags depends upon +## the command line argument order; so add the flags where they +## appear in depend2.am. Note that the slowdown incurred here +## affects only configure: in makefiles, %FASTDEP% shortcuts this. + for arg + do + case $arg in + -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; + *) set fnord "$@" "$arg" ;; + esac + shift # fnord + shift # $arg + done + "$@" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + mv "$tmpdepfile" "$depfile" + ;; + +gcc) +## There are various ways to get dependency output from gcc. Here's +## why we pick this rather obscure method: +## - Don't want to use -MD because we'd like the dependencies to end +## up in a subdir. Having to rename by hand is ugly. +## (We might end up doing this anyway to support other compilers.) +## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like +## -MM, not -M (despite what the docs say). +## - Using -M directly means running the compiler twice (even worse +## than renaming). + if test -z "$gccflag"; then + gccflag=-MD, + fi + "$@" -Wp,"$gccflag$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz +## The second -e expression handles DOS-style file names with drive letters. + sed -e 's/^[^:]*: / /' \ + -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" +## This next piece of magic avoids the `deleted header file' problem. +## The problem is that when a header file which appears in a .P file +## is deleted, the dependency causes make to die (because there is +## typically no way to rebuild the header). We avoid this by adding +## dummy dependencies for each header file. Too bad gcc doesn't do +## this for us directly. + tr ' ' ' +' < "$tmpdepfile" | +## Some versions of gcc put a space before the `:'. On the theory +## that the space means something, we add a space to the output as +## well. +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +sgi) + if test "$libtool" = yes; then + "$@" "-Wp,-MDupdate,$tmpdepfile" + else + "$@" -MDupdate "$tmpdepfile" + fi + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + + if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files + echo "$object : \\" > "$depfile" + + # Clip off the initial element (the dependent). Don't try to be + # clever and replace this with sed code, as IRIX sed won't handle + # lines with more than a fixed number of characters (4096 in + # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; + # the IRIX cc adds comments like `#:fec' to the end of the + # dependency line. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ + tr ' +' ' ' >> $depfile + echo >> $depfile + + # The second pass generates a dummy entry for each header file. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ + >> $depfile + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +aix) + # The C for AIX Compiler uses -M and outputs the dependencies + # in a .u file. In older versions, this file always lives in the + # current directory. Also, the AIX compiler puts `$object:' at the + # start of each line; $object doesn't have directory information. + # Version 6 uses the directory in both cases. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + if test "$libtool" = yes; then + tmpdepfile1=$dir$base.u + tmpdepfile2=$base.u + tmpdepfile3=$dir.libs/$base.u + "$@" -Wc,-M + else + tmpdepfile1=$dir$base.u + tmpdepfile2=$dir$base.u + tmpdepfile3=$dir$base.u + "$@" -M + fi + stat=$? + + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + # Each line is of the form `foo.o: dependent.h'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + # That's a tab and a space in the []. + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +icc) + # Intel's C compiler understands `-MD -MF file'. However on + # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c + # ICC 7.0 will fill foo.d with something like + # foo.o: sub/foo.c + # foo.o: sub/foo.h + # which is wrong. We want: + # sub/foo.o: sub/foo.c + # sub/foo.o: sub/foo.h + # sub/foo.c: + # sub/foo.h: + # ICC 7.1 will output + # foo.o: sub/foo.c sub/foo.h + # and will wrap long lines using \ : + # foo.o: sub/foo.c ... \ + # sub/foo.h ... \ + # ... + + "$@" -MD -MF "$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + # Each line is of the form `foo.o: dependent.h', + # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" + # Some versions of the HPUX 10.20 sed can't process this invocation + # correctly. Breaking it into two sed invocations is a workaround. + sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | + sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp2) + # The "hp" stanza above does not work with aCC (C++) and HP's ia64 + # compilers, which have integrated preprocessors. The correct option + # to use with these is +Maked; it writes dependencies to a file named + # 'foo.d', which lands next to the object file, wherever that + # happens to be. + # Much of this is similar to the tru64 case; see comments there. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + if test "$libtool" = yes; then + tmpdepfile1=$dir$base.d + tmpdepfile2=$dir.libs/$base.d + "$@" -Wc,+Maked + else + tmpdepfile1=$dir$base.d + tmpdepfile2=$dir$base.d + "$@" +Maked + fi + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" + # Add `dependent.h:' lines. + sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile" + else + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" "$tmpdepfile2" + ;; + +tru64) + # The Tru64 compiler uses -MD to generate dependencies as a side + # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. + # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put + # dependencies in `foo.d' instead, so we check for that too. + # Subdirectories are respected. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + + if test "$libtool" = yes; then + # With Tru64 cc, shared objects can also be used to make a + # static library. This mechanism is used in libtool 1.4 series to + # handle both shared and static libraries in a single compilation. + # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. + # + # With libtool 1.5 this exception was removed, and libtool now + # generates 2 separate objects for the 2 libraries. These two + # compilations output dependencies in $dir.libs/$base.o.d and + # in $dir$base.o.d. We have to check for both files, because + # one of the two compilations can be disabled. We should prefer + # $dir$base.o.d over $dir.libs/$base.o.d because the latter is + # automatically cleaned when .libs/ is deleted, while ignoring + # the former would cause a distcleancheck panic. + tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 + tmpdepfile2=$dir$base.o.d # libtool 1.5 + tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 + tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 + "$@" -Wc,-MD + else + tmpdepfile1=$dir$base.o.d + tmpdepfile2=$dir$base.d + tmpdepfile3=$dir$base.d + tmpdepfile4=$dir$base.d + "$@" -MD + fi + + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + # That's a tab and a space in the []. + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + else + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +#nosideeffect) + # This comment above is used by automake to tell side-effect + # dependency tracking mechanisms from slower ones. + +dashmstdout) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout, regardless of -o. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + test -z "$dashmflag" && dashmflag=-M + # Require at least two characters before searching for `:' + # in the target name. This is to cope with DOS-style filenames: + # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. + "$@" $dashmflag | + sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + tr ' ' ' +' < "$tmpdepfile" | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +dashXmstdout) + # This case only exists to satisfy depend.m4. It is never actually + # run, as this mode is specially recognized in the preamble. + exit 1 + ;; + +makedepend) + "$@" || exit $? + # Remove any Libtool call + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + # X makedepend + shift + cleared=no + for arg in "$@"; do + case $cleared in + no) + set ""; shift + cleared=yes ;; + esac + case "$arg" in + -D*|-I*) + set fnord "$@" "$arg"; shift ;; + # Strip any option that makedepend may not understand. Remove + # the object too, otherwise makedepend will parse it as a source file. + -*|$object) + ;; + *) + set fnord "$@" "$arg"; shift ;; + esac + done + obj_suffix="`echo $object | sed 's/^.*\././'`" + touch "$tmpdepfile" + ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + sed '1,2d' "$tmpdepfile" | tr ' ' ' +' | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" "$tmpdepfile".bak + ;; + +cpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + "$@" -E | + sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ + -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | + sed '$ s: \\$::' > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + cat < "$tmpdepfile" >> "$depfile" + sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvisualcpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout, regardless of -o, + # because we must use -o when running libtool. + "$@" || exit $? + IFS=" " + for arg + do + case "$arg" in + "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") + set fnord "$@" + shift + shift + ;; + *) + set fnord "$@" "$arg" + shift + shift + ;; + esac + done + "$@" -E | + sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" + echo " " >> "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +none) + exec "$@" + ;; + +*) + echo "Unknown depmode $depmode" 1>&2 + exit 1 + ;; +esac + +exit 0 + +# 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-end: "$" +# End: diff --git a/install-sh b/install-sh new file mode 100755 index 0000000..a5897de --- /dev/null +++ b/install-sh @@ -0,0 +1,519 @@ +#!/bin/sh +# install - install a program, script, or datafile + +scriptversion=2006-12-25.00 + +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. +# +# Copyright (C) 1994 X Consortium +# +# 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 +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. + +nl=' +' +IFS=" "" $nl" + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit=${DOITPROG-} +if test -z "$doit"; then + doit_exec=exec +else + doit_exec=$doit +fi + +# Put in absolute file names if you don't have them in your path; +# or use environment vars. + +chgrpprog=${CHGRPPROG-chgrp} +chmodprog=${CHMODPROG-chmod} +chownprog=${CHOWNPROG-chown} +cmpprog=${CMPPROG-cmp} +cpprog=${CPPROG-cp} +mkdirprog=${MKDIRPROG-mkdir} +mvprog=${MVPROG-mv} +rmprog=${RMPROG-rm} +stripprog=${STRIPPROG-strip} + +posix_glob='?' +initialize_posix_glob=' + test "$posix_glob" != "?" || { + if (set -f) 2>/dev/null; then + posix_glob= + else + posix_glob=: + fi + } +' + +posix_mkdir= + +# Desired mode of installed file. +mode=0755 + +chgrpcmd= +chmodcmd=$chmodprog +chowncmd= +mvcmd=$mvprog +rmcmd="$rmprog -f" +stripcmd= + +src= +dst= +dir_arg= +dst_arg= + +copy_on_change=false +no_target_directory= + +usage="\ +Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE + or: $0 [OPTION]... SRCFILES... DIRECTORY + or: $0 [OPTION]... -t DIRECTORY SRCFILES... + or: $0 [OPTION]... -d DIRECTORIES... + +In the 1st form, copy SRCFILE to DSTFILE. +In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. +In the 4th, create DIRECTORIES. + +Options: + --help display this help and exit. + --version display version info and exit. + + -c (ignored) + -C install only if different (preserve the last data modification time) + -d create directories instead of installing files. + -g GROUP $chgrpprog installed files to GROUP. + -m MODE $chmodprog installed files to MODE. + -o USER $chownprog installed files to USER. + -s $stripprog installed files. + -t DIRECTORY install into DIRECTORY. + -T report an error if DSTFILE is a directory. + +Environment variables override the default commands: + CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG + RMPROG STRIPPROG +" + +while test $# -ne 0; do + case $1 in + -c) ;; + + -C) copy_on_change=true;; + + -d) dir_arg=true;; + + -g) chgrpcmd="$chgrpprog $2" + shift;; + + --help) echo "$usage"; exit $?;; + + -m) mode=$2 + case $mode in + *' '* | *' '* | *' +'* | *'*'* | *'?'* | *'['*) + echo "$0: invalid mode: $mode" >&2 + exit 1;; + esac + shift;; + + -o) chowncmd="$chownprog $2" + shift;; + + -s) stripcmd=$stripprog;; + + -t) dst_arg=$2 + shift;; + + -T) no_target_directory=true;; + + --version) echo "$0 $scriptversion"; exit $?;; + + --) shift + break;; + + -*) echo "$0: invalid option: $1" >&2 + exit 1;; + + *) break;; + esac + shift +done + +if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then + # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dst_arg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dst_arg" + shift # fnord + fi + shift # arg + dst_arg=$arg + done +fi + +if test $# -eq 0; then + if test -z "$dir_arg"; then + echo "$0: no input file specified." >&2 + exit 1 + fi + # It's OK to call `install-sh -d' without argument. + # This can happen when creating conditional directories. + exit 0 +fi + +if test -z "$dir_arg"; then + trap '(exit $?); exit' 1 2 13 15 + + # Set umask so as not to create temps with too-generous modes. + # However, 'strip' requires both read and write access to temps. + case $mode in + # Optimize common cases. + *644) cp_umask=133;; + *755) cp_umask=22;; + + *[0-7]) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw='% 200' + fi + cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; + *) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw=,u+rw + fi + cp_umask=$mode$u_plus_rw;; + esac +fi + +for src +do + # Protect names starting with `-'. + case $src in + -*) src=./$src;; + esac + + if test -n "$dir_arg"; then + dst=$src + dstdir=$dst + test -d "$dstdir" + dstdir_status=$? + else + + # Waiting for this to be detected by the "$cpprog $src $dsttmp" command + # might cause directories to be created, which would be especially bad + # if $src (and thus $dsttmp) contains '*'. + if test ! -f "$src" && test ! -d "$src"; then + echo "$0: $src does not exist." >&2 + exit 1 + fi + + if test -z "$dst_arg"; then + echo "$0: no destination specified." >&2 + exit 1 + fi + + dst=$dst_arg + # Protect names starting with `-'. + case $dst in + -*) dst=./$dst;; + esac + + # If destination is a directory, append the input filename; won't work + # if double slashes aren't ignored. + if test -d "$dst"; then + if test -n "$no_target_directory"; then + echo "$0: $dst_arg: Is a directory" >&2 + exit 1 + fi + dstdir=$dst + dst=$dstdir/`basename "$src"` + dstdir_status=0 + else + # Prefer dirname, but fall back on a substitute if dirname fails. + dstdir=` + (dirname "$dst") 2>/dev/null || + expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$dst" : 'X\(//\)[^/]' \| \ + X"$dst" : 'X\(//\)$' \| \ + X"$dst" : 'X\(/\)' \| . 2>/dev/null || + echo X"$dst" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q' + ` + + test -d "$dstdir" + dstdir_status=$? + fi + fi + + obsolete_mkdir_used=false + + if test $dstdir_status != 0; then + case $posix_mkdir in + '') + # Create intermediate dirs using mode 755 as modified by the umask. + # This is like FreeBSD 'install' as of 1997-10-28. + umask=`umask` + case $stripcmd.$umask in + # Optimize common cases. + *[2367][2367]) mkdir_umask=$umask;; + .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; + + *[0-7]) + mkdir_umask=`expr $umask + 22 \ + - $umask % 100 % 40 + $umask % 20 \ + - $umask % 10 % 4 + $umask % 2 + `;; + *) mkdir_umask=$umask,go-w;; + esac + + # With -d, create the new directory with the user-specified mode. + # Otherwise, rely on $mkdir_umask. + if test -n "$dir_arg"; then + mkdir_mode=-m$mode + else + mkdir_mode= + fi + + posix_mkdir=false + case $umask in + *[123567][0-7][0-7]) + # POSIX mkdir -p sets u+wx bits regardless of umask, which + # is incompatible with FreeBSD 'install' when (umask & 300) != 0. + ;; + *) + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 + + if (umask $mkdir_umask && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 + then + if test -z "$dir_arg" || { + # Check for POSIX incompatibilities with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writeable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. + ls_ld_tmpdir=`ls -ld "$tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/d" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null + fi + trap '' 0;; + esac;; + esac + + if + $posix_mkdir && ( + umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" + ) + then : + else + + # The umask is ridiculous, or mkdir does not conform to POSIX, + # or it failed possibly due to a race condition. Create the + # directory the slow way, step by step, checking for races as we go. + + case $dstdir in + /*) prefix='/';; + -*) prefix='./';; + *) prefix='';; + esac + + eval "$initialize_posix_glob" + + oIFS=$IFS + IFS=/ + $posix_glob set -f + set fnord $dstdir + shift + $posix_glob set +f + IFS=$oIFS + + prefixes= + + for d + do + test -z "$d" && continue + + prefix=$prefix$d + if test -d "$prefix"; then + prefixes= + else + if $posix_mkdir; then + (umask=$mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break + # Don't fail if two instances are running concurrently. + test -d "$prefix" || exit 1 + else + case $prefix in + *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; + *) qprefix=$prefix;; + esac + prefixes="$prefixes '$qprefix'" + fi + fi + prefix=$prefix/ + done + + if test -n "$prefixes"; then + # Don't fail if two instances are running concurrently. + (umask $mkdir_umask && + eval "\$doit_exec \$mkdirprog $prefixes") || + test -d "$dstdir" || exit 1 + obsolete_mkdir_used=true + fi + fi + fi + + if test -n "$dir_arg"; then + { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && + { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || + test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 + else + + # Make a couple of temp file names in the proper directory. + dsttmp=$dstdir/_inst.$$_ + rmtmp=$dstdir/_rm.$$_ + + # Trap to clean up those temp files at exit. + trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 + + # Copy the file name to the temp name. + (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && + + # and set any options; do chmod last to preserve setuid bits. + # + # If any of these fail, we abort the whole thing. If we want to + # ignore errors from any of these, just make sure not to ignore + # errors from the above "$doit $cpprog $src $dsttmp" command. + # + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && + { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && + { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && + + # If -C, don't bother to copy if it wouldn't change the file. + if $copy_on_change && + old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && + new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && + + eval "$initialize_posix_glob" && + $posix_glob set -f && + set X $old && old=:$2:$4:$5:$6 && + set X $new && new=:$2:$4:$5:$6 && + $posix_glob set +f && + + test "$old" = "$new" && + $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 + then + rm -f "$dsttmp" + else + # Rename the file to the real destination. + $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || + + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + { + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + test ! -f "$dst" || + $doit $rmcmd -f "$dst" 2>/dev/null || + { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && + { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } + } || + { echo "$0: cannot unlink or rename $dst" >&2 + (exit 1); exit 1 + } + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dst" + } + fi || exit 1 + + trap '' 0 + fi +done + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/missing b/missing new file mode 100755 index 0000000..1c8ff70 --- /dev/null +++ b/missing @@ -0,0 +1,367 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. + +scriptversion=2006-05-10.23 + +# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006 +# Free Software Foundation, Inc. +# Originally by Fran,cois Pinard , 1996. + +# 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, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301, USA. + +# 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. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +run=: +sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' +sed_minuso='s/.* -o \([^ ]*\).*/\1/p' + +# In the cases where this matters, `missing' is being run in the +# srcdir already. +if test -f configure.ac; then + configure_ac=configure.ac +else + configure_ac=configure.in +fi + +msg="missing on your system" + +case $1 in +--run) + # Try to run requested program, and just exit if it succeeds. + run= + shift + "$@" && exit 0 + # Exit code 63 means version mismatch. This often happens + # when the user try to use an ancient version of a tool on + # a file that requires a minimum version. In this case we + # we should proceed has if the program had been absent, or + # if --run hadn't been passed. + if test $? = 63; then + run=: + msg="probably too old" + fi + ;; + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + --run try to run the given command, and emulate it if it fails + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + autom4te touch the output file, or create a stub one + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + help2man touch the output file + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + tar try tar, gnutar, gtar, then tar without non-portable flags + yacc create \`y.tab.[ch]', if possible, from existing .[ch] + +Send bug reports to ." + exit $? + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing $scriptversion (GNU Automake)" + exit $? + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + +esac + +# Now exit if we have it, but it failed. Also exit now if we +# don't have it and --version was passed (most likely to detect +# the program). +case $1 in + lex|yacc) + # Not GNU programs, they don't have --version. + ;; + + tar) + if test -n "$run"; then + echo 1>&2 "ERROR: \`tar' requires --run" + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + exit 1 + fi + ;; + + *) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + # Could not run --version or --help. This is probably someone + # running `$TOOL --version' or `$TOOL --help' to check whether + # $TOOL exists and not knowing $TOOL uses missing. + exit 1 + fi + ;; +esac + +# If it does not exist, or fails to run (possibly an outdated version), +# try to emulate it. +case $1 in + aclocal*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acinclude.m4' or \`${configure_ac}'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`${configure_ac}'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acconfig.h' or \`${configure_ac}'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` + test -z "$files" && files="config.h" + touch_files= + for f in $files; do + case $f in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + automake*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print | + sed 's/\.am$/.in/' | + while read f; do touch "$f"; done + ;; + + autom4te) + echo 1>&2 "\ +WARNING: \`$1' is needed, but is $msg. + You might have modified some files without having the + proper tools for further handling them. + You can get \`$1' as part of \`Autoconf' from any GNU + archive site." + + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo "#! /bin/sh" + echo "# Created by GNU Automake missing as a replacement of" + echo "# $ $@" + echo "exit 0" + chmod +x $file + exit 1 + fi + ;; + + bison|yacc) + echo 1>&2 "\ +WARNING: \`$1' $msg. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if test $# -ne 1; then + eval LASTARG="\${$#}" + case $LASTARG in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if test -f "$SRCFILE"; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if test -f "$SRCFILE"; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if test ! -f y.tab.h; then + echo >y.tab.h + fi + if test ! -f y.tab.c; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex|flex) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if test $# -ne 1; then + eval LASTARG="\${$#}" + case $LASTARG in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if test -f "$SRCFILE"; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if test ! -f lex.yy.c; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + help2man) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a dependency of a manual page. You may need the + \`Help2man' package in order for those modifications to take + effect. You can get \`Help2man' from any GNU archive site." + + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo ".ab help2man is required to generate this page" + exit 1 + fi + ;; + + makeinfo) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + # The file to touch is that specified with -o ... + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -z "$file"; then + # ... or it is the one specified with @setfilename ... + infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n ' + /^@setfilename/{ + s/.* \([^ ]*\) *$/\1/ + p + q + }' $infile` + # ... or it is derived from the source name (dir/f.texi becomes f.info) + test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info + fi + # If the file does not exist, the user really needs makeinfo; + # let's fail without touching anything. + test -f $file || exit 1 + touch $file + ;; + + tar) + shift + + # We have already tried tar in the generic part. + # Look for gnutar/gtar before invocation to avoid ugly error + # messages. + if (gnutar --version > /dev/null 2>&1); then + gnutar "$@" && exit 0 + fi + if (gtar --version > /dev/null 2>&1); then + gtar "$@" && exit 0 + fi + firstarg="$1" + if shift; then + case $firstarg in + *o*) + firstarg=`echo "$firstarg" | sed s/o//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + case $firstarg in + *h*) + firstarg=`echo "$firstarg" | sed s/h//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + fi + + echo 1>&2 "\ +WARNING: I can't seem to be able to run \`tar' with the given arguments. + You may want to install GNU tar or Free paxutils, or check the + command line arguments." + exit 1 + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and is $msg. + You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequisites for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/mkinstalldirs b/mkinstalldirs new file mode 100755 index 0000000..ef7e16f --- /dev/null +++ b/mkinstalldirs @@ -0,0 +1,161 @@ +#! /bin/sh +# mkinstalldirs --- make directory hierarchy + +scriptversion=2006-05-11.19 + +# Original author: Noah Friedman +# Created: 1993-05-16 +# Public domain. +# +# This file is maintained in Automake, please report +# bugs to or send patches to +# . + +nl=' +' +IFS=" "" $nl" +errstatus=0 +dirmode= + +usage="\ +Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ... + +Create each directory DIR (with mode MODE, if specified), including all +leading file name components. + +Report bugs to ." + +# process command line arguments +while test $# -gt 0 ; do + case $1 in + -h | --help | --h*) # -h for help + echo "$usage" + exit $? + ;; + -m) # -m PERM arg + shift + test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } + dirmode=$1 + shift + ;; + --version) + echo "$0 $scriptversion" + exit $? + ;; + --) # stop option processing + shift + break + ;; + -*) # unknown option + echo "$usage" 1>&2 + exit 1 + ;; + *) # first non-opt arg + break + ;; + esac +done + +for file +do + if test -d "$file"; then + shift + else + break + fi +done + +case $# in + 0) exit 0 ;; +esac + +# Solaris 8's mkdir -p isn't thread-safe. If you mkdir -p a/b and +# mkdir -p a/c at the same time, both will detect that a is missing, +# one will create a, then the other will try to create a and die with +# a "File exists" error. This is a problem when calling mkinstalldirs +# from a parallel make. We use --version in the probe to restrict +# ourselves to GNU mkdir, which is thread-safe. +case $dirmode in + '') + if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then + echo "mkdir -p -- $*" + exec mkdir -p -- "$@" + else + # On NextStep and OpenStep, the `mkdir' command does not + # recognize any option. It will interpret all options as + # directories to create, and then abort because `.' already + # exists. + test -d ./-p && rmdir ./-p + test -d ./--version && rmdir ./--version + fi + ;; + *) + if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 && + test ! -d ./--version; then + echo "mkdir -m $dirmode -p -- $*" + exec mkdir -m "$dirmode" -p -- "$@" + else + # Clean up after NextStep and OpenStep mkdir. + for d in ./-m ./-p ./--version "./$dirmode"; + do + test -d $d && rmdir $d + done + fi + ;; +esac + +for file +do + case $file in + /*) pathcomp=/ ;; + *) pathcomp= ;; + esac + oIFS=$IFS + IFS=/ + set fnord $file + shift + IFS=$oIFS + + for d + do + test "x$d" = x && continue + + pathcomp=$pathcomp$d + case $pathcomp in + -*) pathcomp=./$pathcomp ;; + esac + + if test ! -d "$pathcomp"; then + echo "mkdir $pathcomp" + + mkdir "$pathcomp" || lasterr=$? + + if test ! -d "$pathcomp"; then + errstatus=$lasterr + else + if test ! -z "$dirmode"; then + echo "chmod $dirmode $pathcomp" + lasterr= + chmod "$dirmode" "$pathcomp" || lasterr=$? + + if test ! -z "$lasterr"; then + errstatus=$lasterr + fi + fi + fi + fi + + pathcomp=$pathcomp/ + done +done + +exit $errstatus + +# 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-end: "$" +# End: diff --git a/packaging/libXTrap.manifest b/packaging/libXTrap.manifest new file mode 100644 index 0000000..017d22d --- /dev/null +++ b/packaging/libXTrap.manifest @@ -0,0 +1,5 @@ + + + + + diff --git a/packaging/libXTrap.spec b/packaging/libXTrap.spec new file mode 100644 index 0000000..fa049d1 --- /dev/null +++ b/packaging/libXTrap.spec @@ -0,0 +1,71 @@ +Name: libXTrap +Summary: X.Org X11 libXTrap runtime library +Version: 1.0.0 +Release: 11.6 +Group: Graphics/X Window System +License: MIT +URL: http://www.x.org/ +Source0: ftp://ftp.x.org/pub/individual/lib/%{name}-%{version}.tar.gz +Source1001: packaging/libXTrap.manifest +Requires(post): /sbin/ldconfig +Requires(postun): /sbin/ldconfig +BuildRequires: pkgconfig(xproto) +BuildRequires: pkgconfig(xextproto) +BuildRequires: pkgconfig(x11) +BuildRequires: pkgconfig(xext) +BuildRequires: pkgconfig(xt) +BuildRequires: pkgconfig(trapproto) +BuildRequires: pkgconfig(xorg-macros) + +%description +Description: %{summary} + + +%package devel +Summary: Development components for the libXTrap library +Group: Development/Libraries +Requires: %{name} = %{version}-%{release} + +%description devel +Description: %{summary} + + +%prep +%setup -q -n %{name}-%{version} + +%build +cp %{SOURCE1001} . +export LDFLAGS+=" -Wl,--hash-style=both -Wl,--as-needed" +%reconfigure --disable-static +make %{?jobs:-j%jobs} + +%install +rm -rf %{buildroot} +%make_install + + +%clean +rm -rf %{buildroot} + + + +%post -p /sbin/ldconfig + +%postun -p /sbin/ldconfig + + + +%files +%manifest libXTrap.manifest +%defattr(-,root,root,-) +%doc COPYING +%{_libdir}/libXTrap.so.6 +%{_libdir}/libXTrap.so.6.4.0 + + +%files devel +%manifest libXTrap.manifest +%defattr(-,root,root,-) +%doc AUTHORS README ChangeLog +%{_libdir}/libXTrap.so +%{_libdir}/pkgconfig/xtrap.pc diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 0000000..99f47aa --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,17 @@ +lib_LTLIBRARIES = libXTrap.la + +libXTrap_la_SOURCES = \ + XECallBcks.c \ + XEConTxt.c \ + XEDsptch.c \ + XEPrInfo.c \ + XERqsts.c \ + XEStrMap.c \ + XETrapInit.c \ + XEWrappers.c + +AM_CFLAGS = @XTRAP_CFLAGS@ + +libXTrap_la_LIBADD = @XTRAP_LIBS@ + +libXTrap_la_LDFLAGS = -version-number 6:4:0 -no-undefined diff --git a/src/Makefile.in b/src/Makefile.in new file mode 100644 index 0000000..6db1980 --- /dev/null +++ b/src/Makefile.in @@ -0,0 +1,489 @@ +# Makefile.in generated by automake 1.10.2 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(libdir)" +libLTLIBRARIES_INSTALL = $(INSTALL) +LTLIBRARIES = $(lib_LTLIBRARIES) +libXTrap_la_DEPENDENCIES = +am_libXTrap_la_OBJECTS = XECallBcks.lo XEConTxt.lo XEDsptch.lo \ + XEPrInfo.lo XERqsts.lo XEStrMap.lo XETrapInit.lo XEWrappers.lo +libXTrap_la_OBJECTS = $(am_libXTrap_la_OBJECTS) +libXTrap_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(libXTrap_la_LDFLAGS) $(LDFLAGS) -o $@ +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(libXTrap_la_SOURCES) +DIST_SOURCES = $(libXTrap_la_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +XTRAP_CFLAGS = @XTRAP_CFLAGS@ +XTRAP_LIBS = @XTRAP_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +lib_LTLIBRARIES = libXTrap.la +libXTrap_la_SOURCES = \ + XECallBcks.c \ + XEConTxt.c \ + XEDsptch.c \ + XEPrInfo.c \ + XERqsts.c \ + XEStrMap.c \ + XETrapInit.c \ + XEWrappers.c + +AM_CFLAGS = @XTRAP_CFLAGS@ +libXTrap_la_LIBADD = @XTRAP_LIBS@ +libXTrap_la_LDFLAGS = -version-number 6:4:0 -no-undefined +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f=$(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ + else :; fi; \ + done + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + p=$(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libXTrap.la: $(libXTrap_la_OBJECTS) $(libXTrap_la_DEPENDENCIES) + $(libXTrap_la_LINK) -rpath $(libdir) $(libXTrap_la_OBJECTS) $(libXTrap_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XECallBcks.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XEConTxt.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XEDsptch.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XEPrInfo.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XERqsts.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XEStrMap.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XETrapInit.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XEWrappers.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: + for dir in "$(DESTDIR)$(libdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-exec-am: install-libLTLIBRARIES + +install-html: install-html-am + +install-info: install-info-am + +install-man: + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-libLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am \ + install-libLTLIBRARIES install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-libLTLIBRARIES + +# 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: diff --git a/src/XECallBcks.c b/src/XECallBcks.c new file mode 100644 index 0000000..fb1e089 --- /dev/null +++ b/src/XECallBcks.c @@ -0,0 +1,175 @@ +/* $XFree86$ */ +/***************************************************************************** +Copyright 1987, 1988, 1989, 1990, 1991 by Digital Equipment Corp., Maynard, MA + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +*****************************************************************************/ +/* + * + * CONTRIBUTORS: + * + * Dick Annicchiarico + * Robert Chesler + * Dan Coutu + * Gene Durso + * Marc Evans + * Alan Jamison + * Mark Henry + * Ken Miller + * + */ +/* + * This file contains XETrap Callback initilization routines. + * The callback data hang off of the TC and are freed as part of the + * XEFreeTC routine. + */ + +#include +#include +#include + +int XEAddRequestCB(XETC *tc, CARD8 req, void_function func, BYTE *data) +{ + if (!tc->values.req_cb) + { /* This is the first time for this particular TC, need to malloc */ + if ((tc->values.req_cb = + (XETrapCB *)XtCalloc(256L,sizeof(XETrapCB))) == NULL) + { + /* XtCalloc already reported the error */ + return(False); + } + } + tc->values.req_cb[req].func = func; + tc->values.req_cb[req].data = data; + + return(True); +} + +int XEAddRequestCBs(XETC *tc, ReqFlags req_flags, void_function func, + BYTE *data) +{ + int i; + int status = True; + + for (i=0; i<=255L; i++) + { + if (BitIsTrue(req_flags, i)) + { + status = XEAddRequestCB(tc, (CARD8)i, func, data); + } + } + return(status); +} + +int XEAddEventCB(XETC *tc, CARD8 evt, void_function func, BYTE *data) +{ + if (!tc->values.evt_cb) + { /* This is the first time for this particular TC, need to malloc */ + if ((tc->values.evt_cb = + (XETrapCB *)XtCalloc(XETrapCoreEvents,sizeof(XETrapCB))) == NULL) + { + /* XtCalloc already reported the error */ + return(False); + } + } + tc->values.evt_cb[evt].func = func; + tc->values.evt_cb[evt].data = data; + + return(True); +} + +int XEAddEventCBs(XETC *tc, EventFlags evt_flags, void_function func, + BYTE *data) +{ + int i; + int status = True; + + for (i=KeyPress; i<=MotionNotify; i++) + { + if (BitIsTrue(evt_flags, i)) + { + status = XEAddEventCB(tc, (CARD8)i, func, data); + } + } + return(status); +} + +void XERemoveRequestCB(XETC *tc, CARD8 req) +{ + if (!tc->values.req_cb) + { /* We gotta problem! CB struct not allocated! */ + return; + } + tc->values.req_cb[req].func = (void_function)NULL; + tc->values.req_cb[req].data = (BYTE *)NULL; + return; +} +void XERemoveRequestCBs(XETC *tc, ReqFlags req_flags) +{ + int i; + + for (i=0; i<=255L; i++) + { + if (BitIsTrue(req_flags, i)) + { + XERemoveRequestCB(tc, (CARD8)i); + } + } +} + +void XERemoveAllRequestCBs(XETC *tc) +{ + if (!tc->values.req_cb) + { /* We gotta problem! CB struct not allocated! */ + return; + } + XtFree((XtPointer)tc->values.req_cb); +} + +void XERemoveEventCB(XETC *tc, CARD8 evt) +{ + if (!tc->values.evt_cb) + { /* We gotta problem! CB struct not allocated! */ + return; + } + tc->values.evt_cb[evt].func = (void_function)NULL; + tc->values.evt_cb[evt].data = (BYTE *)NULL; + return; +} + +void XERemoveEventCBs(XETC *tc, EventFlags evt_flags) +{ + int i; + + for (i=KeyPress; i<=MotionNotify; i++) + { + if (BitIsTrue(evt_flags, i)) + { + XERemoveEventCB(tc, (CARD8)i); + } + } +} + +void XERemoveAllEventCBs(XETC *tc) +{ + if (!tc->values.evt_cb) + { /* We gotta problem! CB struct not allocated! */ + return; + } + XtFree((XtPointer)tc->values.evt_cb); +} diff --git a/src/XEConTxt.c b/src/XEConTxt.c new file mode 100644 index 0000000..7da9689 --- /dev/null +++ b/src/XEConTxt.c @@ -0,0 +1,589 @@ +/* $XFree86: xc/lib/XTrap/XEConTxt.c,v 1.1 2001/11/02 23:29:27 dawes Exp $ */ +/***************************************************************************** +Copyright 1987, 1988, 1989, 1990, 1991, 1994 by Digital Equipment Corp., +Maynard, MA + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +*****************************************************************************/ +/* + * + * CONTRIBUTORS: + * + * Dick Annicchiarico + * Robert Chesler + * Dan Coutu + * Gene Durso + * Marc Evans + * Alan Jamison + * Mark Henry + * Ken Miller + * + */ + +#define NEED_REPLIES +#define NEED_EVENTS + + +#include +#include + +#ifndef TRUE +# define TRUE 1L +#endif +#ifndef FALSE +# define FALSE 0L +#endif + +extern char *extensionData; + +static XETC TC; + +/* + * This function is used to create a new XTrap context structure. The new + * context is initialized to a hard coded default, then modified by the + * valuemask and values passed in by the caller. + */ + +XETC *XECreateTC(Display *dpy, CARD32 valuemask, XETCValues *value) +{ + static Bool firsttime = True; + register XETC *tc = &TC; + register XETC *last_tc; + XETrapGetAvailRep rep; + + /* If this is the first time here, then initialize the default TC */ + if (firsttime == True) + { + firsttime = False; + /* The first Trap Context is the Template (default) TC */ + (void)memset(tc,0L,sizeof(tc)); + tc->eventBase = 0x7FFFFFFFL; + tc->errorBase = 0x7FFFFFFFL; + tc->values.v.max_pkt_size = 0x7FFFL; + } + + /* Position to the end of the list */ + for (;tc->next != NULL; tc = tc->next); + + /* Allocate memory for the new context */ + last_tc = tc; /* save the address of the last on the list */ + if ((tc = (tc->next = (XETC *)XtMalloc(sizeof(*tc)))) == NULL) + { /* No memory to build TC, XtMalloc has already reported the error */ + return(NULL); + } + + /* Use the original TC as the template to start from */ + (void)memcpy(tc,&TC,sizeof(TC)); + tc->next = NULL; + tc->dpy = dpy; + tc->xmax_size = XMaxRequestSize(tc->dpy); + + /* Initialize Extension */ + if (!XETrapQueryExtension(dpy,&(tc->eventBase),&(tc->errorBase), + &(tc->extOpcode))) + { + char *params = XTrapExtName; + unsigned int num_params = 1L; + XtWarningMsg("CantLoadExt", "XECreateTC", "XTrapToolkitError", + "Can't load %s extension", ¶ms, &num_params); + (void)XtFree((XtPointer)tc); + last_tc->next = NULL; /* Clear now nonexistant forward pointer */ + return(NULL); + } + + /* Allocate memory for the XLIB transport */ + if ((tc->xbuff = (BYTE *)XtMalloc(tc->xmax_size * sizeof(CARD32) + + SIZEOF(XETrapHeader))) == NULL) + { /* No memory to build TC, XtMalloc has already reported the error */ + (void)XtFree((XtPointer)tc); /* free the allocated TC */ + last_tc->next = NULL; /* Clear now nonexistant forward pointer */ + return(NULL); + } + + /* Decide on a protocol version to communicate with */ + /* would *like* to use XEGetVersionRequest() but it's broken in V3.1 */ + if (XEGetAvailableRequest(tc,&rep) == True) + { + /* stow the protocol number */ + switch (rep.xtrap_protocol) + { + /* known acceptable protocols */ + case 31: + case XETrapProtocol: + tc->protocol = rep.xtrap_protocol; + break; + /* all else */ + default: /* stay backwards compatible */ + tc->protocol = 31; + break; + } + /* TC to contain *oldest* release/version/revision */ + if (XETrapGetAvailRelease(&rep) <= XETrapRelease) + { + tc->release = XETrapGetAvailRelease(&rep); + if (XETrapGetAvailVersion(&rep) <= XETrapVersion) + { + tc->version = XETrapGetAvailVersion(&rep); + tc->revision = (XETrapGetAvailRevision(&rep) <= XETrapRevision ? + XETrapGetAvailRevision(&rep) : XETrapRevision); + } + else + { + tc->version = XETrapVersion; + tc->revision = XETrapRevision; + } + } + else + { + tc->release = XETrapRelease; + tc->version = XETrapVersion; + tc->revision = XETrapRevision; + } + } + else + { /* We can't seem to communicate with the extension! */ + char *params = XTrapExtName; + unsigned int num_params = 1L; + XtWarningMsg("CantComm", "XECreateTC", "XTrapToolkitError", + "Can't communicate with extension %s", ¶ms, &num_params); + (void)XtFree((XtPointer)tc->xbuff);/* de-allocate memory just alloc'd */ + (void)XtFree((XtPointer)tc); /* free the allocated TC */ + last_tc->next = NULL; /* Clear now nonexistant forward pointer */ + return(NULL); + } + + /* Assign the context values the caller provided */ + (void)XEChangeTC(tc, valuemask, value); + + return (tc); +} + + +static int CheckChangeBits(XETrapFlags *dest, XETrapFlags *src, INT32 bit) +{ + int chg_flag = False; + + if (!(BitIsFalse(dest->valid,bit) && BitIsFalse(src->valid,bit)) || + !(BitIsTrue(dest->valid,bit) && BitIsTrue(src->valid,bit))) + { + BitCopy(dest->valid, src->valid, bit); + chg_flag = True; + } + if (!(BitIsFalse(dest->data,bit) && BitIsFalse(src->data,bit)) || + !(BitIsTrue(dest->data,bit) && BitIsTrue(src->data,bit))) + { + BitCopy(dest->data, src->data, bit); + chg_flag = True; + } + return(chg_flag); +} + +/* + * This function is called to change one or more parameters used to define + * a context in which XTrap is or will be running. + */ +int XEChangeTC(XETC *tc, CARD32 mask, XETCValues *values) +{ + int status = True; + register XETCValues *tval = &(tc->values); + register int i; + + if (mask & TCStatistics) + { /* Statistics need changing */ + if(CheckChangeBits(&(tval->v.flags), &(values->v.flags), + XETrapStatistics)) + { + tc->dirty |= TCStatistics; + } + } + if (mask & TCRequests) + { /* Requests need changing */ + CheckChangeBits(&(tval->v.flags), &(values->v.flags), XETrapRequest); + for (i=0; i<256L; i++) + { + XETrapSetCfgFlagReq(tval, i, BitValue(values->v.flags.req,i)); + } + tc->dirty |= TCRequests; + } + if (mask & TCEvents) + { /* Events need changing */ + CheckChangeBits(&(tval->v.flags), &(values->v.flags), XETrapEvent); + for (i=KeyPress; i<=MotionNotify; i++) + { + XETrapSetCfgFlagEvt(tval, i, BitValue(values->v.flags.event,i)); + } + tc->dirty |= TCEvents; + } + if (mask & TCMaxPacket) + { /* MaxPacket needs changing */ + CheckChangeBits(&(tval->v.flags), &(values->v.flags), XETrapMaxPacket); + XETrapSetCfgMaxPktSize(tval, values->v.max_pkt_size); + tc->dirty |= TCMaxPacket; + } + if (mask & TCCmdKey) + { /* CmdKey needs changing */ + CheckChangeBits(&(tval->v.flags), &(values->v.flags), XETrapCmd); + tval->v.cmd_key = values->v.cmd_key; + CheckChangeBits(&(tval->v.flags), &(values->v.flags), XETrapCmdKeyMod); + tc->dirty |= TCCmdKey; + } + if (mask & TCTimeStamps) + { /* TimeStamps needs changing */ + if (CheckChangeBits(&(tval->v.flags), &(values->v.flags), XETrapTimestamp)) + { + tc->dirty |= TCTimeStamps; + } + BitCopy(tval->tc_flags, values->tc_flags, XETCDeltaTimes); + } + if (mask & TCWinXY) + { /* Window XY's need changing */ + if (CheckChangeBits(&(tval->v.flags), &(values->v.flags), XETrapWinXY)) + { + tc->dirty |= TCWinXY; + } + } + if (mask & TCCursor) + { /* Window XY's need changing */ + if (CheckChangeBits(&(tval->v.flags), &(values->v.flags),XETrapCursor)) + { + tc->dirty |= TCCursor; + } + } + if (mask & TCXInput) + { /* XInput flag needs changing */ + if (CheckChangeBits(&(tval->v.flags), &(values->v.flags),XETrapXInput)) + { + tc->dirty |= TCXInput; + } + } + if (mask & TCColorReplies) + { /* ColorReplies flag needs changing */ + if (CheckChangeBits(&(tval->v.flags), &(values->v.flags), + XETrapColorReplies)) + { + tc->dirty |= TCColorReplies; + } + } + if (mask & TCGrabServer ) + { /* GrabServer flag needs changing */ + if (CheckChangeBits(&(tval->v.flags), &(values->v.flags), + XETrapGrabServer )) + { + tc->dirty |= TCGrabServer; + } + } + if (XETrapGetTCFlagTrapActive(tc)) + { + status = XEFlushConfig(tc); + } +#ifdef VMS + sys$setast(True); /* Make sure AST's are enabled */ +#endif /* VMS */ + return(status); +} + + +void XEFreeTC(XETC *tc) +{ + register XETC *list = &TC; + + if (tc) + { + while(list->next != NULL) + { + if (list->next == tc) + list->next = list->next->next; /* Got it, remove from list */ + else + list = list->next; /* Update the list pointer */ + } + if (tc->values.req_cb) + { + XtFree((XtPointer)tc->values.req_cb); + } + if (tc->values.evt_cb) + { + XtFree((XtPointer)tc->values.evt_cb); + } + if (tc->xbuff != NULL) + { + XtFree((XtPointer)tc->xbuff); + } + + XtFree((XtPointer)tc); + if (extensionData) + { + XtFree(extensionData); + } + } + return; +} + +/* The following are Convenience routines for setting values within + * the Trap Context. These are analogous to the GC's Convenience + * Functions such as XSetState & XSetForeground + */ +int XETrapSetMaxPacket(XETC *tc, Bool set_flag, CARD16 size) +{ + XETCValues tcv; + int status = True; + + (void)memset((char *)&tcv,0L,sizeof(tcv)); + XETrapSetCfgFlagMaxPacket(&tcv, valid, True); + XETrapSetCfgFlagMaxPacket(&tcv, data, set_flag); + XETrapSetCfgMaxPktSize(&tcv, size); + status = XEChangeTC(tc, TCMaxPacket, &tcv); + return(status); +} +int XETrapSetCommandKey(XETC *tc, Bool set_flag, KeySym cmd_key, Bool mod_flag) +{ + XETCValues tcv; + int status = True; + KeyCode cmd_keycode; + + (void)memset((char *)&tcv,0L,sizeof(tcv)); + XETrapSetCfgFlagCmd(&tcv, valid, True); + XETrapSetCfgFlagCmd(&tcv, data, set_flag); + if (set_flag == True) + { + XETrapSetCfgFlagCmdKeyMod(&tcv, valid, True); + XETrapSetCfgFlagCmdKeyMod(&tcv, data, mod_flag); + if (!(cmd_keycode = XKeysymToKeycode(XETrapGetDpy(tc), cmd_key))) + { + status = False; + } + else + { + XETrapSetCfgCmdKey(&tcv, cmd_keycode); + } + } + else + { /* Clear command key */ + XETrapSetCfgFlagCmdKeyMod(&tcv, valid, True); + XETrapSetCfgFlagCmdKeyMod(&tcv, data, False); + XETrapSetCfgCmdKey(&tcv, 0); + } + if (status == True) + { + status = XEChangeTC(tc, TCCmdKey, &tcv); + } + return(status); +} + +int XETrapSetTimestamps(XETC *tc, Bool set_flag, Bool delta_flag) +{ + XETCValues tcv; + int status = True; + + (void)memset((char *)&tcv,0L,sizeof(tcv)); + XETrapSetCfgFlagTimestamp(&tcv, valid, True); + XETrapSetCfgFlagTimestamp(&tcv, data, set_flag); + XETrapSetValFlagDeltaTimes(&tcv, delta_flag); + status = XEChangeTC(tc, TCTimeStamps, &tcv); + return(status); +} + +int XETrapSetWinXY(XETC *tc, Bool set_flag) +{ + XETCValues tcv; + int status = True; + + (void)memset((char *)&tcv,0L,sizeof(tcv)); + XETrapSetCfgFlagWinXY(&tcv, valid, True); + XETrapSetCfgFlagWinXY(&tcv, data, set_flag); + status = XEChangeTC(tc, TCWinXY, &tcv); + return(status); +} + +int XETrapSetCursor(XETC *tc, Bool set_flag) +{ + XETCValues tcv; + int status = True; + + (void)memset((char *)&tcv,0L,sizeof(tcv)); + XETrapSetCfgFlagCursor(&tcv, valid, True); + XETrapSetCfgFlagCursor(&tcv, data, set_flag); + status = XEChangeTC(tc, TCCursor, &tcv); + return(status); +} + +int XETrapSetXInput(XETC *tc, Bool set_flag) +{ + XETCValues tcv; + int status = True; + + (void)memset((char *)&tcv,0L,sizeof(tcv)); + XETrapSetCfgFlagXInput(&tcv, valid, True); + XETrapSetCfgFlagXInput(&tcv, data, set_flag); + status = XEChangeTC(tc, TCXInput, &tcv); + return(status); +} + +int XETrapSetColorReplies(XETC *tc, Bool set_flag) +{ + XETCValues tcv; + int status = True; + + (void)memset((char *)&tcv,0L,sizeof(tcv)); + XETrapSetCfgFlagColorReplies(&tcv, valid, True); + XETrapSetCfgFlagColorReplies(&tcv, data, set_flag); + status = XEChangeTC(tc, TCColorReplies, &tcv); + return(status); +} + +int XETrapSetGrabServer(XETC *tc, Bool set_flag) +{ + XETCValues tcv; + int status = True; + + (void)memset((char *)&tcv,0L,sizeof(tcv)); + XETrapSetCfgFlagGrabServer(&tcv, valid, True); + XETrapSetCfgFlagGrabServer(&tcv, data, set_flag); + status = XEChangeTC(tc, TCGrabServer, &tcv); + return(status); +} + +int XETrapSetStatistics(XETC *tc, Bool set_flag) +{ + XETCValues tcv; + int status = True; + + (void)memset((char *)&tcv,0L,sizeof(tcv)); + XETrapSetCfgFlagStatistics(&tcv, valid, True); + XETrapSetCfgFlagStatistics(&tcv, data, set_flag); + status = XEChangeTC(tc, TCStatistics, &tcv); + return(status); +} + +int XETrapSetRequests(XETC *tc, Bool set_flag, ReqFlags requests) +{ + XETCValues tcv; + int status = True; + int i; + + (void)memset((char *)&tcv,0L,sizeof(tcv)); + XETrapSetCfgFlagRequest(&tcv, valid, True); + XETrapSetCfgFlagRequest(&tcv, data, set_flag); + for (i=0; i<256L; i++) + { + XETrapSetCfgFlagReq(&tcv, i, BitValue(requests, i)); + } + status = XEChangeTC(tc, TCRequests, &tcv); + return(status); +} + +int XETrapSetEvents(XETC *tc, Bool set_flag, EventFlags events) +{ + XETCValues tcv; + int status = True; + int i; + + (void)memset((char *)&tcv,0L,sizeof(tcv)); + XETrapSetCfgFlagEvent(&tcv, valid, True); + XETrapSetCfgFlagEvent(&tcv, data, set_flag); + for (i=KeyPress; i<=MotionNotify; i++) + { + XETrapSetCfgFlagEvt(&tcv, i, BitValue(events, i)); + } + status = XEChangeTC(tc, (CARD32)TCEvents, &tcv); + return(status); +} + +Bool XESetCmdGateState(XETC *tc, CARD8 type, Bool *gate_closed, + CARD8 *next_key, Bool *key_ignore) +{ + + *key_ignore = False; + if (XETrapGetTCFlagCmdKeyMod(tc,data) == True) + { + switch (type) + { + case KeyPress: + if (*next_key == XEKeyIsEcho) + { + break; + } + *gate_closed = True; + *next_key = XEKeyIsClear; + break; + + case KeyRelease: + if (*next_key == XEKeyIsEcho) + { + *next_key = XEKeyIsClear; + break; + } + if (*next_key == XEKeyIsClear) + { + *next_key = XEKeyIsEcho; + } + else + { /* it's XEKeyIsOther, so Clear it */ + *next_key = XEKeyIsClear; + } + *gate_closed = False; + *key_ignore = True; + break; + + default: break; + } + } + else + { + switch (type) + { + case KeyPress: + if (*next_key == XEKeyIsEcho) + { + *gate_closed = False; + break; + } + /* Open gate on cmd key release */ + if ((*next_key == XEKeyIsOther) && + *gate_closed == True) + { + break; + } + *gate_closed = True; + *next_key = XEKeyIsClear; + break; + + case KeyRelease: + if (*next_key == XEKeyIsClear) + { + *next_key = XEKeyIsEcho; + break; + } + + if (*next_key == XEKeyIsEcho) + { + *next_key = XEKeyIsClear; + break; + } + + *gate_closed = False; + *key_ignore = True; + *next_key = XEKeyIsClear; + break; + + default: + break; + } + } + + return(*gate_closed); +} diff --git a/src/XEDsptch.c b/src/XEDsptch.c new file mode 100644 index 0000000..b503926 --- /dev/null +++ b/src/XEDsptch.c @@ -0,0 +1,111 @@ +/* $XFree86$ */ +/***************************************************************************** +Copyright 1987, 1988, 1989, 1990, 1991 by Digital Equipment Corp., Maynard, MA + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +*****************************************************************************/ +/* + * + * CONTRIBUTORS: + * + * Dick Annicchiarico + * Robert Chesler + * Dan Coutu + * Gene Durso + * Marc Evans + * Alan Jamison + * Mark Henry + * Ken Miller + * + */ + +#include +#include +#include +#include + +static void XETrapDispatchCB(XETC *tc, XETrapDatum *pdatum) +{ + void_function pfunc = NULL; + BYTE *userp = NULL; + + /* Need to deal with Delta Timestamps here before calling client CB */ + if (XETrapGetTCFlagDeltaTimes(tc)) + { + CARD32 last_time = XETrapGetTCTime(tc); + if (XETrapHeaderIsEvent(&pdatum->hdr)) + { /* then we can play with the timestamps */ + pdatum->hdr.timestamp = + pdatum->u.event.u.keyButtonPointer.time; + } + else + { /* + * the current one from GetTimeInMillis is worthless + * as it's only updated during event instances (e.g. not + * wall clock). + */ + pdatum->hdr.timestamp = last_time; + } + if (!pdatum->hdr.timestamp) + { /* for dual monitor bug */ + pdatum->hdr.timestamp = last_time; + } + if (!last_time) + { /* first one! Prime it! */ + last_time = pdatum->hdr.timestamp; + } + tc->values.last_time = pdatum->hdr.timestamp; /* no macro! */ + if (pdatum->hdr.timestamp < last_time) + { /* for clock rollover */ + pdatum->hdr.timestamp = 0; + } + else + { /* the real delta */ + pdatum->hdr.timestamp = pdatum->hdr.timestamp - last_time; + } + } + /* Get the user supplied callback function */ + if (XETrapHeaderIsEvent(&pdatum->hdr)) + { + pfunc = tc->values.evt_cb[pdatum->u.event.u.u.type].func; + userp = tc->values.evt_cb[pdatum->u.event.u.u.type].data; + } + else if (XETrapHeaderIsRequest(&pdatum->hdr) || + XETrapHeaderIsReply(&pdatum->hdr)) + { + pfunc = tc->values.req_cb[pdatum->u.req.reqType].func; + userp = tc->values.req_cb[pdatum->u.req.reqType].data; + } + + /* If there is a callback then call it with the data */ + if (pfunc != NULL) + { + (*pfunc)(tc,pdatum,userp); + } +} + +Boolean XETrapDispatchXLib(XETrapDataEvent *event, XETC *tc) +{ + memcpy(&tc->xbuff[event->idx*sz_EventData], event->data, sz_EventData); + + if (event->detail == XETrapDataLast) + { + XETrapDispatchCB(tc, (XETrapDatum *)tc->xbuff); + } + return True; +} diff --git a/src/XEPrInfo.c b/src/XEPrInfo.c new file mode 100644 index 0000000..908ca3a --- /dev/null +++ b/src/XEPrInfo.c @@ -0,0 +1,274 @@ +/* $XFree86$ */ +/***************************************************************************** +Copyright 1987, 1988, 1989, 1990, 1991, 1994 by Digital Equipment Corp., +Maynard, MA + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +*****************************************************************************/ +#include +#include +#include +#include + +#ifndef TRUE +# define TRUE 1L +#endif +#ifndef FALSE +# define FALSE 0L +#endif + +void XEPrintRelease( FILE *ofp, XETrapGetAvailRep *pavail) +{ + + fprintf(ofp,"\tRelease: %d.%d-%d\n", XETrapGetAvailRelease(pavail), + XETrapGetAvailVersion(pavail), XETrapGetAvailRevision(pavail)); +} +void XEPrintTkRelease( FILE *ofp, XETC *tc) +{ + fprintf(ofp,"\tRelease: %d.%d-%d\n", XEGetRelease(tc), XEGetVersion(tc), + XEGetRevision(tc)); +} + +void XEPrintPlatform( FILE *ofp, XETrapGetAvailRep *pavail) +{ + fprintf(ofp,"\tPlatform: %s (0x%02x)\n", + XEPlatformIDToString(XETrapGetAvailPFIdent(pavail)), + (int)XETrapGetAvailPFIdent(pavail)); +} + +void XEPrintAvailFlags( FILE *ofp, XETrapGetAvailRep *pavail) +{ + + CARD8 f[4L]; + + XETrapGetAvailFlags(pavail,f); + fprintf(ofp,"\tFlags: "); + if (XETrapGetAvailFlagTimestamp(pavail)) fputs("Timestamps ", ofp); + if (XETrapGetAvailFlagCmd(pavail)) fputs("CmdKey ", ofp); + if (XETrapGetAvailFlagCmdKeyMod(pavail)) fputs("CmdKeyMod ", ofp); + if (XETrapGetAvailFlagRequest(pavail)) fputs("Requests ", ofp); + if (XETrapGetAvailFlagEvent(pavail)) fputs("Events ", ofp); + if (XETrapGetAvailFlagMaxPacket(pavail)) fputs("MaxPkt ", ofp); + if (XETrapGetAvailFlagStatistics(pavail)) fputs("Statistics ", ofp); + if (XETrapGetAvailFlagWinXY(pavail)) fputs("WinXY ", ofp); + if (XETrapGetAvailFlagCursor(pavail)) fputs("Cursor ", ofp); + if (XETrapGetAvailFlagXInput(pavail)) fputs("XInput ", ofp); + if (XETrapGetAvailFlagVecEvt(pavail)) fputs("Vect_Evnts ", ofp); + if (XETrapGetAvailFlagColorReplies(pavail)) fputs("ColorRep ", ofp); + if (XETrapGetAvailFlagGrabServer(pavail)) fputs("GrabServer ", ofp); + fprintf(ofp," (0x%02x%02x%02x%02x)\n", f[0], f[1], f[2], f[3]); +} + +void XEPrintAvailPktSz( FILE *ofp, XETrapGetAvailRep *pavail) +{ + + fprintf(ofp,"\tMax Packet Size: %d\n", XETrapGetAvailMaxPktSize(pavail)); +} +void XEPrintStateFlags( FILE *ofp, XETrapGetCurRep *pcur) +{ + + CARD8 f[2]; + XETrapGetCurSFlags(pcur, f); + fputs("\tFlags: ",ofp); + if (BitIsTrue(f,XETrapTrapActive)) fputs("I/O Active ", ofp); + fprintf(ofp," (0x%02x%02x)\n", f[0], f[1]); +} + +void XEPrintMajOpcode( FILE *ofp, XETrapGetAvailRep *pavail) +{ + + fprintf(ofp,"\tMajor Opcode: %d\n", (int)XETrapGetAvailOpCode(pavail)); +} +void XEPrintCurXY( FILE *ofp, XETrapGetAvailRep *pavail) +{ + + fprintf(ofp,"\tCurrent (x,y): (%d,%d)\n", XETrapGetCurX(pavail), + XETrapGetCurY(pavail)); +} + +void XEPrintTkFlags( FILE *ofp, XETC *tc) +{ + + CARD8 f[2]; + XETrapGetTCLFlags(tc, f); + fputs("\tFlags: ",ofp); + if (XETrapGetTCFlagDeltaTimes(tc)) fputs("Delta Times ", ofp); + if (XETrapGetTCFlagTrapActive(tc)) fputs("Trap Active ", ofp); + fprintf(ofp," (0x%02x%02x)\n", f[0], f[1]); +} + +void XEPrintLastTime( FILE *ofp, XETC *tc) +{ + + fprintf(ofp,"\tLast Relative Time: %d\n", (int)XETrapGetTCTime(tc)); +} + +void XEPrintCfgFlags( FILE *ofp, XETrapGetCurRep *pcur) +{ + + CARD8 f[4L]; + + XETrapGetCurCFlags(pcur,data,f); + fprintf(ofp,"\tFlags: "); + if (XETrapGetCurFlagTimestamp(pcur,data)) fputs("Timestamps ", ofp); + if (XETrapGetCurFlagCmd(pcur,data)) fputs("CmdKey ", ofp); + if (XETrapGetCurFlagCmdKeyMod(pcur,data)) fputs("CmdKeyMod ", ofp); + if (XETrapGetCurFlagRequest(pcur,data)) fputs("Requests ", ofp); + if (XETrapGetCurFlagEvent(pcur,data)) fputs("Events ", ofp); + if (XETrapGetCurFlagMaxPacket(pcur,data)) fputs("MaxPkt ", ofp); + if (XETrapGetCurFlagStatistics(pcur,data)) fputs("Statistics ", ofp); + if (XETrapGetCurFlagWinXY(pcur,data)) fputs("WinXY ", ofp); + if (XETrapGetCurFlagCursor(pcur,data)) fputs("Cursor ", ofp); + if (XETrapGetCurFlagXInput(pcur,data)) fputs("XInput ", ofp); + if (XETrapGetCurFlagColorReplies(pcur,data)) fputs("ColorReplies ", ofp); + if (XETrapGetCurFlagGrabServer(pcur,data)) fputs("GrabServer ", ofp); + fprintf(ofp," (0x%02x%02x%02x%02x)\n", f[0], f[1], f[2], f[3]); +} + +void XEPrintRequests( FILE *ofp, XETrapGetCurRep *pcur) +{ + + long i; + fprintf(ofp,"\tX Requests: "); + for (i=0L; i<=XETrapMaxRequest-1; i++) + { /* Not using the macro cause we're doing things + * a byte at a time rather than a bit. + */ + fprintf(ofp,"%02x ", pcur->config.flags.req[i]); + if ((i+1L)%4L == 0L) + { + fprintf(ofp," "); + } + if ((i+1L)%16L == 0L) + { + fprintf(ofp,"\n\t\t "); + } + } + fprintf(ofp,"\n"); +} + +void XEPrintEvents( FILE *ofp, XETrapGetCurRep *pcur) +{ + + int i; + fprintf(ofp,"\tX Events: "); + for (i=0L; iconfig.flags.event[i]); + if ((i+1L)%4L == 0L) + { + fprintf(ofp," "); + } + if ((i+1L)%16L == 0L) + { + fprintf(ofp,"\n\t\t "); + } + } + fprintf(ofp,"\n"); +} + +void XEPrintCurPktSz( FILE *ofp, XETrapGetCurRep *pcur) +{ + + fprintf(ofp,"\tMax Packet Size: %d\n", XETrapGetCurMaxPktSize(pcur)); +} + +void XEPrintCmdKey( FILE *ofp, XETrapGetCurRep *pcur) +{ + + fprintf(ofp,"\tcmd_key: 0x%02x\n", XETrapGetCurCmdKey(pcur)); +} + +void XEPrintEvtStats( FILE *ofp, XETrapGetStatsRep *pstats, XETC *tc) +{ + + int i; + fprintf(ofp,"\tX Events:\n"); + for (i=0; i +#define NEED_REPLIES +#define NEED_EVENTS +#include +#else /* NO_DEC_BUG_FIX */ +#include +#define NEED_REPLIES +#define NEED_EVENTS +#include +#endif /* NO_DEC_BUG_FIX */ +/* the following's a hack to support V3.1 protocol */ +#if defined(__STDC__) && !defined(UNIXCPP) +#define GetOldReq(name, req, old_length) \ + WORD64ALIGN\ + if ((dpy->bufptr + SIZEOF(x##name##Req)) > dpy->bufmax)\ + _XFlush(dpy);\ + req = (x##name##Req *)(dpy->last_req = dpy->bufptr);\ + req->reqType = X_##name;\ + req->length = old_length>>2;\ + dpy->bufptr += old_length;\ + dpy->request++ + +#else /* non-ANSI C uses empty comment instead of "##" for token concat */ +#define GetOldReq(name, req, old_length) \ + WORD64ALIGN\ + if ((dpy->bufptr + SIZEOF(x/**/name/**/Req)) > dpy->bufmax)\ + _XFlush(dpy);\ + req = (x/**/name/**/Req *)(dpy->last_req = dpy->bufptr);\ + req->reqType = X_/**/name;\ + req->length = old_length>>2;\ + dpy->bufptr += old_length;\ + dpy->request++ +#endif + +#ifndef vms +#include +#else /* vms */ +#define SyncHandle() \ + if (dpy->synchandler) (*dpy->synchandler)(dpy) +/* + * LockDisplay uses an undocumented feature in V5 of VMS that allows + * disabling ASTs without calling $SETAST. A bit is set in P1 space + * that disables a user mode AST from being delivered to this process. + * + */ +#define LockDisplay(dis) \ +{ globalref char ctl$gb_soft_ast_disable; \ + globalref char ctl$gb_lib_lock; \ + globalref short ctl$gw_soft_ast_lock_depth; \ + if ( ctl$gb_soft_ast_disable == 0 ) { \ + ctl$gb_soft_ast_disable = 1; \ + ctl$gb_lib_lock = 1; \ + ctl$gw_soft_ast_lock_depth = 1; \ + } \ + else ctl$gw_soft_ast_lock_depth++; \ +} + +/* + * UnlockDisplay clears the AST disable bit, then checks to see if an + * AST delivery attempt was made during the critical section. If so, + * reenable_ASTs is set, and $SETAST must be called to turn AST delivery + * back on. + * + * Note that it assumed that LockDisplay and UnlockDisplay appear in + * matched sets within a single routine. + */ +#define UnlockDisplay(dis) \ +{ globalref char ctl$gb_reenable_asts; \ + globalref char ctl$gb_soft_ast_disable; \ + globalref char ctl$gb_lib_lock; \ + globalref short ctl$gw_soft_ast_lock_depth; \ + if (!--ctl$gw_soft_ast_lock_depth) \ + if ( ctl$gb_lib_lock ) { \ + ctl$gb_lib_lock = 0; \ + ctl$gb_soft_ast_disable = 0; \ + if (ctl$gb_reenable_asts != 0) \ + sys$setast(1); \ + } \ +} + +#define WORD64ALIGN +#if defined(__STDC__) && !defined(UNIXCPP) +#define GetReq(name, req) \ + WORD64ALIGN\ + if ((dpy->bufptr + SIZEOF(x##name##Req)) > dpy->bufmax)\ + _XFlush(dpy);\ + req = (x##name##Req *)(dpy->last_req = dpy->bufptr);\ + req->reqType = X_##name;\ + req->length = (SIZEOF(x##name##Req))>>2;\ + dpy->bufptr += SIZEOF(x##name##Req);\ + dpy->request++ + +#else /* non-ANSI C uses empty comment instead of "##" for token concat */ +#define GetReq(name, req) \ + WORD64ALIGN\ + if ((dpy->bufptr + SIZEOF(x/**/name/**/Req)) > dpy->bufmax)\ + _XFlush(dpy);\ + req = (x/**/name/**/Req *)(dpy->last_req = dpy->bufptr);\ + req->reqType = X_/**/name;\ + req->length = (SIZEOF(x/**/name/**/Req))>>2;\ + dpy->bufptr += SIZEOF(x/**/name/**/Req);\ + dpy->request++ +#endif +#endif /* vms */ + +#include +#include + +/* Returns the all important protocol number to be used. + * The only request guaranteed to be of the same request/reply + * size is XEGetVersionRequest. All others need the protocol + * number to determine how to communicate. + * Unfortunately, this was broken for V3.1 so GetAvailable will + * have to be used to determine the protocol version. + */ +int XEGetVersionRequest(XETC *tc, XETrapGetVersRep *ret) +{ + int status = True; + Display *dpy = tc->dpy; + CARD32 X_XTrapGet = tc->extOpcode; + xXTrapGetReq *reqptr; + xXTrapGetVersReply rep; + int numlongs = (SIZEOF(xXTrapGetVersReply) - + SIZEOF(xReply) + SIZEOF(CARD32) -1 ) / SIZEOF(CARD32); + LockDisplay(dpy); + GetReq(XTrapGet,reqptr); + reqptr->minor_opcode = XETrap_GetVersion; + reqptr->protocol = XETrapProtocol; + status = _XReply(dpy,(xReply *)&rep,numlongs,xTrue); + SyncHandle(); + UnlockDisplay(dpy); + memcpy((char *)ret,&(rep.data),sizeof(XETrapGetVersRep)); + return(status); +} + +int XEGetAvailableRequest(XETC *tc, XETrapGetAvailRep *ret) +{ + int status = True; + Display *dpy = tc->dpy; + CARD32 X_XTrapGet = tc->extOpcode; + xXTrapGetReq *reqptr; + xXTrapGetAvailReply rep; + int numlongs = (SIZEOF(xXTrapGetAvailReply) - + SIZEOF(xReply) + SIZEOF(CARD32) -1 ) / SIZEOF(CARD32); + LockDisplay(dpy); + GetReq(XTrapGet,reqptr); + reqptr->minor_opcode = XETrap_GetAvailable; + reqptr->protocol = XETrapProtocol; + status = _XReply(dpy,(xReply *)&rep,numlongs,xTrue); + SyncHandle(); + UnlockDisplay(dpy); + memcpy((char *)ret,&(rep.data),sizeof(XETrapGetAvailRep)); + return(status); +} + +/* should not be called directly by clients */ +static int XEConfigRequest(XETC *tc) +{ /* protocol changed between V3.1 and V3.2! */ + int status = True; + Display *dpy = tc->dpy; + CARD32 X_XTrapConfig = tc->extOpcode; + xXTrapConfigReq *reqptr; + if (tc->protocol == 31) + { /* hack to allocate the old request length */ + GetOldReq(XTrapConfig,reqptr,276); + } + else + { + GetReq(XTrapConfig,reqptr); + } + reqptr->minor_opcode = XETrap_Config; + + memcpy((char *)reqptr->config_flags_valid, + (char *)tc->values.v.flags.valid,4); + memcpy((char *)reqptr->config_flags_data, + (char *)tc->values.v.flags.data,4); + memcpy((char *)reqptr->config_flags_req, + (char *)tc->values.v.flags.req,XETrapMaxRequest); + memcpy((char *)reqptr->config_flags_event, + (char *)tc->values.v.flags.event,XETrapMaxEvent); + reqptr->config_max_pkt_size=tc->values.v.max_pkt_size; + reqptr->config_cmd_key=tc->values.v.cmd_key; + + XFlush(dpy); + SyncHandle(); + tc->dirty = 0L; /* Configuration is no longer dirty */ + return(status); +} + +/* Flush out any pending configuration */ +int XEFlushConfig(XETC *tc) +{ + return((tc->dirty) ? XEConfigRequest(tc) : True); +} +int XEResetRequest(XETC *tc) +{ + int status = True; + Display *dpy = tc->dpy; + CARD32 X_XTrap = tc->extOpcode; + xXTrapReq *reqptr; + status = XEFlushConfig(tc); /* Flushout any pending configuration first */ + if (status == True) + { + GetReq(XTrap,reqptr); + reqptr->minor_opcode = XETrap_Reset; + XFlush(dpy); + SyncHandle(); + } + return(status); +} + + +int XEGetLastInpTimeRequest(XETC *tc, XETrapGetLastInpTimeRep *ret) +{ /* this was broken in V3.1! */ + int status = True; + Display *dpy = tc->dpy; + CARD32 X_XTrap = tc->extOpcode; + xXTrapReq *reqptr; + xXTrapGetLITimReply rep; + int numlongs = (SIZEOF(xXTrapGetLITimReply) - + SIZEOF(xReply) + SIZEOF(CARD32) - 1) / SIZEOF(CARD32); + LockDisplay(dpy); + GetReq(XTrap,reqptr); + reqptr->minor_opcode = XETrap_GetLastInpTime; + status = _XReply(dpy,(xReply *)&rep,numlongs,xTrue); + SyncHandle(); + UnlockDisplay(dpy); + + ret->last_time=rep.data_last_time; + + return(status); +} + +int XEStartTrapRequest(XETC *tc) +{ + int status = True; + Display *dpy = tc->dpy; + CARD32 X_XTrap = tc->extOpcode; + xXTrapReq *reqptr; + status = XEFlushConfig(tc); /* Flushout any pending configuration first */ + if (status == True) + { + /* Add our event handler for the XLib transport */ + XETrapSetEventHandler(tc, XETrapData, XETrapDispatchXLib); + GetReq(XTrap,reqptr); + reqptr->minor_opcode = XETrap_StartTrap; + XFlush(dpy); + SyncHandle(); + BitTrue(tc->values.tc_flags, XETCTrapActive); + } + return(status); +} +int XEStopTrapRequest(XETC *tc) +{ + int status = True; + Display *dpy = tc->dpy; + CARD32 X_XTrap = tc->extOpcode; + xXTrapReq *reqptr; + status = XEFlushConfig(tc); /* Flushout any pending configuration first */ + if (status == True) + { + GetReq(XTrap,reqptr); + reqptr->minor_opcode = XETrap_StopTrap; + XFlush(dpy); + SyncHandle(); + BitFalse(tc->values.tc_flags, XETCTrapActive); + /* Remove our event handler for the XLib transport */ + XETrapSetEventHandler(tc, XETrapData, NULL); + } + + return(status); +} + +#ifndef _XINPUT +int XESimulateXEventRequest(XETC *tc, CARD8 type, CARD8 detail, + CARD16 x, CARD16 y, CARD8 screen) +{ + int status = True; + Display *dpy = tc->dpy; + CARD32 X_XTrapInput = tc->extOpcode; + xXTrapInputReq *reqptr; + status = XEFlushConfig(tc); /* Flushout any pending configuration first */ + if (status == True) + { /* write out the input event */ + GetReq(XTrapInput,reqptr); + reqptr->minor_opcode = XETrap_SimulateXEvent; + reqptr->input.type = type; + reqptr->input.detail = detail; + reqptr->input.x = x; + reqptr->input.y = y; + reqptr->input.screen = screen; + XFlush(dpy); + } + return(status); +} +#endif +int XEGetCurrentRequest(XETC *tc, XETrapGetCurRep *ret) +{ + int status = True; + Display *dpy = tc->dpy; + CARD32 X_XTrap = tc->extOpcode; + xXTrapReq *reqptr; + xXTrapGetCurReply rep; + int numlongs = (SIZEOF(xXTrapGetCurReply) - + SIZEOF(xReply) + SIZEOF(CARD32) -1 ) / SIZEOF(CARD32); + status = XEFlushConfig(tc); /* Flushout any pending configuration first */ + if (status == True) + { + LockDisplay(dpy); + GetReq(XTrap,reqptr); + reqptr->minor_opcode = XETrap_GetCurrent; + /* to support comm. w/ V3.1 extensions */ + if (tc->protocol == 31) + { + char tmp[284]; /* need space for the big *old* reply */ + numlongs = (284-sizeof(xReply)+sizeof(long)-1)/sizeof(long); + status = _XReply(dpy,(xReply *)tmp,numlongs,xTrue); + memcpy(&rep,tmp,sizeof(rep)); /* move just what's needed */ + } + else + { + status = _XReply(dpy,(xReply *)&rep,numlongs,xTrue); + } + SyncHandle(); + UnlockDisplay(dpy); + + memcpy((char *)ret->state_flags,rep.data_state_flags,2); + memcpy((char *)ret->config.flags.valid,rep.data_config_flags_valid,4); + memcpy((char *)ret->config.flags.data,rep.data_config_flags_data,4); + memcpy((char *)ret->config.flags.req,rep.data_config_flags_req, + XETrapMaxRequest); + memcpy((char *)ret->config.flags.event,rep.data_config_flags_event, + XETrapMaxEvent); + ret->config.max_pkt_size=rep.data_config_max_pkt_size; + ret->config.cmd_key=rep.data_config_cmd_key; + + } + return(status); +} + +int XEGetStatisticsRequest(XETC *tc, XETrapGetStatsRep *ret) +{ + int status = True; + Display *dpy = tc->dpy; + CARD32 X_XTrap = tc->extOpcode; + xXTrapReq *reqptr; + xXTrapGetStatsReply rep; + status = XEFlushConfig(tc); /* Flushout any pending configuration first */ + if (status == True) + { + LockDisplay(dpy); + GetReq(XTrap,reqptr); + reqptr->minor_opcode = XETrap_GetStatistics; + /* to support comm. w/ V3.1 extensions */ +#ifndef CRAY + if (tc->protocol == 31) + { /* this is the way we used to do it which breaks Cray's */ +#ifndef VECTORED_EVENTS + int numlongs = (1060-sizeof(xReply)+sizeof(long)-1)/sizeof(long); +#else + int numlongs = (1544-sizeof(xReply)+sizeof(long)-1)/sizeof(long); +#endif + status = _XReply(dpy,(xReply *)&rep,numlongs,xTrue); + if (status == True) + { /* need to shift it back into the data struct */ + xXTrapGetStatsReply tmp; + tmp = rep; + memcpy(&(rep.data),&(tmp.pad0), sizeof(rep.data)); + } + } + else +#endif /* CRAY */ + { /* this is the way we do it for V3.2 */ + int numbytes = SIZEOF(xXTrapGetStatsReply) - SIZEOF(xReply); + status = _XReply(dpy, (xReply *)&rep, 0, xFalse); + if (status == True) + { + status = _XRead(dpy, (char *)&rep.data, numbytes); + } + } + SyncHandle(); + UnlockDisplay(dpy); + memcpy(ret,&(rep.data),sizeof(XETrapGetStatsRep)); + } + return(status); +} diff --git a/src/XEStrMap.c b/src/XEStrMap.c new file mode 100644 index 0000000..2a97f13 --- /dev/null +++ b/src/XEStrMap.c @@ -0,0 +1,284 @@ +/* $XFree86: xc/lib/XTrap/XEStrMap.c,v 1.1 2001/11/02 23:29:27 dawes Exp $ */ +/***************************************************************************** +Copyright 1987, 1988, 1989, 1990, 1991, 1992, 1994 by Digital Equipment Corp., +Maynard, MA + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +*****************************************************************************/ +#include +#include +#include +#include + +static char *eventName[] = { + "", "", + "KeyPress", "KeyRelease", "ButtonPress", + "ButtonRelease", "MotionNotify", "EnterNotify", + "LeaveNotify", "FocusIn", "FocusOut", + "KeymapNotify", "Expose", "GraphicsExpose", + "NoExpose", "VisibilityNotify", "CreateNotify", + "DestroyNotify", "UnmapNotify", "MapNotify", + "MapRequest", "ReparentNotify", "ConfigureNotify", + "ConfigureRequest", "GravityNotify", "ResizeRequest", + "CirculateNotify", "CirculateRequest", "PropertyNotify", + "SelectionClear", "SelectionRequest", "SelectionNotify", + "ColormapNotify", "ClientMessage", "MappingNotify", + "LASTEvent", +}; + +static char *requestName[] = { + "Invalid", + "X_CreateWindow", "X_ChangeWindowAttributes", + "X_GetWindowAttributes", "X_DestroyWindow", + "X_DestroySubwindows", "X_ChangeSaveSet", + "X_ReparentWindow", "X_MapWindow", + "X_MapSubwindows", "X_UnmapWindow", + "X_UnmapSubwindows", "X_ConfigureWindow", + "X_CirculateWindow", "X_GetGeometry", + "X_QueryTree", "X_InternAtom", + "X_GetAtomName", "X_ChangeProperty", + "X_DeleteProperty", "X_GetProperty", + "X_ListProperties", "X_SetSelectionOwner", + "X_GetSelectionOwner", "X_ConvertSelection", + "X_SendEvent", "X_GrabPointer", + "X_UngrabPointer", "X_GrabButton", + "X_UngrabButton", "X_ChangeActivePointerGrab", + "X_GrabKeyboard", "X_UngrabKeyboard", + "X_GrabKey", "X_UngrabKey", + "X_AllowEvents", "X_GrabServer", + "X_UngrabServer", "X_QueryPointer", + "X_GetMotionEvents", "X_TranslateCoords", + "X_WarpPointer", "X_SetInputFocus", + "X_GetInputFocus", "X_QueryKeymap", + "X_OpenFont", "X_CloseFont", + "X_QueryFont", "X_QueryTextExtents", + "X_ListFonts", "X_ListFontsWithInfo", + "X_SetFontPath", "X_GetFontPath", + "X_CreatePixmap", "X_FreePixmap", + "X_CreateGC", "X_ChangeGC", + "X_CopyGC", "X_SetDashes", + "X_SetClipRectangles", "X_FreeGC", + "X_ClearArea", "X_CopyArea", + "X_CopyPlane", "X_PolyPoint", + "X_PolyLine", "X_PolySegment", + "X_PolyRectangle", "X_PolyArc", + "X_FillPoly", "X_PolyFillRectangle", + "X_PolyFillArc", "X_PutImage", + "X_GetImage", "X_PolyText8", + "X_PolyText16", "X_ImageText8", + "X_ImageText16", "X_CreateColormap", + "X_FreeColormap", "X_CopyColormapAndFree", + "X_InstallColormap", "X_UninstallColormap", + "X_ListInstalledColormaps", "X_AllocColor", + "X_AllocNamedColor", "X_AllocColorCells", + "X_AllocColorPlanes", "X_FreeColors", + "X_StoreColors", "X_StoreNamedColor", + "X_QueryColors", "X_LookupColor", + "X_CreateCursor", "X_CreateGlyphCursor", + "X_FreeCursor", "X_RecolorCursorSize", + "X_QueryBestSize", "X_QueryExtension", + "X_ListExtensions", "X_ChangeKeyboardMapping", + "X_GetKeyboardMapping", "X_ChangeKeyboardControl", + "X_GetKeyboardControl", "X_Bell", + "X_ChangePointerControl", "X_GetPointerControl", + "X_SetScreenSaver", "X_GetScreenSaver", + "X_ChangeHosts", "X_ListHosts", + "X_SetAccessControl", "X_SetCloseDownMode", + "X_KillClient", "X_RotateProperties", + "X_ForceScreenSaver", "X_SetPointerMapping", + "X_GetPointerMapping", "X_SetModifierMapping", + "X_GetModifierMapping", "Invalid", + "Invalid", "Invalid", + "Invalid", "Invalid", + "Invalid", "Invalid", + "X_NoOperation", +}; + +typedef struct +{ + char *extName; + int extEvent; +} _extensionData; +_extensionData *extensionData; +int numExtension = -1; + +static struct _pf_tbl {CARD32 id; char *str;} pf_tbl[] = +{ + {PF_Apollo, "Apollo"}, + {PF_ATT, "ATT"}, + {PF_Cray1, "Cray1"}, + {PF_Cray2, "Cray2"}, + {PF_DECUltrix, "DECUltrix"}, + {PF_DECVMS, "DECVMS"}, + {PF_DECELN, "DECELN"}, + {PF_DECOSF1, "DECOSF1"}, + {PF_DECVT1000, "DECVT1000"}, + {PF_DECXTerm, "DECXTerm"}, + {PF_HP9000s800, "HP9000s800"}, + {PF_HP9000s300, "HP9000s300"}, + {PF_IBMAT, "IBMAT"}, + {PF_IBMRT, "IBMRT"}, + {PF_IBMPS2, "IBMPS2"}, + {PF_IBMRS, "IBMRS"}, + {PF_MacII, "MacII"}, + {PF_Pegasus, "Pegasus"}, + {PF_SGI, "SGI"}, + {PF_Sony, "Sony"}, + {PF_Sun3, "Sun3"}, + {PF_Sun386i, "Sun386i"}, + {PF_SunSparc, "SunSparc"}, + {PF_Other, "Other"} /* always the last one! */ +}; + +static char unknown[] = "unknown"; + +#define ASize(array) (sizeof(array)/sizeof((array)[0])) + +static INT16 _StringToID(register char *match, register char **strings, + INT16 nstrings) +{ + register INT16 id = nstrings; + + if (match && *match) + { while ((--id >= 0L) && (strcmp(match,strings[id]) != 0L)); } + else + { id = -1L; } + + return(id); +} +static void loadExtStrings(XETC *tc) +{ + char **extensionName=XListExtensions(tc->dpy,&numExtension); + if (numExtension) + { + int i; + extensionData = (_extensionData *)XtCalloc(numExtension, + sizeof(_extensionData)); + for (i = 0; i < numExtension; i++) + { /* Arrange extensions in opcode order */ + int opcode,event,error; + if (XQueryExtension(tc->dpy,extensionName[i],&opcode,&event, + &error)) + { + extensionData[opcode-128].extName = extensionName[i]; + extensionData[opcode-128].extEvent = event; + } + else + { /* This extension didn't load! Error! */ + extensionData[opcode-128].extName = "Invalid_Extension"; + } + } + XFreeExtensionList(extensionName); + } +} + +INT16 XEEventStringToID(register char *string) +{ + return(_StringToID(string,eventName,ASize(eventName))); +} + +INT16 XERequestStringToID(register char *string) +{ + return(_StringToID(string,requestName,ASize(requestName))); +} + +CARD32 XEPlatformStringToID(register char *string) +{ + struct _pf_tbl *ptr = &(pf_tbl[0]); + while(ptr->id != PF_Other) + { + if (!strncmp(ptr->str, string, strlen(ptr->str))) + { + return(ptr->id); + } + ptr++; + } + return((!strncmp(ptr->str,string,strlen(ptr->str))) ? ptr->id : -1L); +} + +char *XEEventIDToString(register CARD8 id, XETC *tc) +{ + int i; + if (id < ASize(eventName)) + return(eventName[id]); + /* either erroneous or an extension event */ + if (numExtension < 0) + { /* + * This is unfortunate, but necessary. The client + * program has requested the string identifier for + * an extension request/event. Since there's no Xlib + * equivalent for this, we have to query *all* the + * extensions looking for a match. Chances are + * if a client wants one, it'll want them all, + * so just go through and initialize the extension + * list once. + */ + loadExtStrings(tc); + } + /* Find id within extensionData */ + for (i=0; i=0 && extid < numExtension) ? + extensionData[extid].extName : unknown); +} + + +char *XERequestIDToString(register CARD8 id, XETC *tc) +{ + return((id < ASize(requestName)) ? requestName[id] : + XERequestIDToExtString(id,tc)); +} + +char *XEPlatformIDToString(register CARD32 id) +{ + struct _pf_tbl *ptr = &(pf_tbl[0]); + while((ptr->id != PF_Other) || (id == ptr->id)) + { + if (id == ptr->id) + { + return(ptr->str); + } + ptr++; + } + return(unknown); +} diff --git a/src/XETrapInit.c b/src/XETrapInit.c new file mode 100644 index 0000000..a4a0431 --- /dev/null +++ b/src/XETrapInit.c @@ -0,0 +1,218 @@ +/* $XFree86: xc/lib/XTrap/XETrapInit.c,v 1.2 2001/11/08 04:00:12 tsi Exp $ */ +/***************************************************************************** +Copyright 1987, 1988, 1989, 1990, 1991, 1992 by Digital Equipment Corp., +Maynard, MA + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +*****************************************************************************/ +#define NEED_EVENTS +#define NEED_REPLIES + +#include +#include +#include +#include +#include + +#ifndef XETrapNumberErrors +#define XETrapNumberErrors 0 +#endif + +#ifdef UWS40 +#define _XSetLastRequestRead _SetLastRequestRead +#endif +#ifndef vms +extern unsigned long _XSetLastRequestRead(Display *dpy, xGenericReply *rep); +#else +static unsigned long _XSetLastRequestRead(Display *dpy, xGenericReply *rep); +#endif + +static XExtensionInfo *xtrap_info = NULL; +static /* const */ char *xtrap_extension_name = XTrapExtName; + +#define XTrapCheckExtension(dpy,i,val) \ + XextCheckExtension(dpy, i, xtrap_extension_name, val) +#define XTrapSimpleCheckExtension(dpy,i) \ + XextSimpleCheckExtension(dpy, i, xtrap_extension_name) + +static XEXT_CLOSE_DISPLAY_PROTO(close_display); +static Bool wire_to_event(Display *dpy, XEvent *event, xEvent *wire_ev); +static Status event_to_wire(Display *dpy, XEvent *event, xEvent *wire_ev); + +#ifdef X11R3 +static int error_string(); +#else +static XEXT_ERROR_STRING_PROTO(error_string); +#endif +static /* const */ XExtensionHooks xtrap_extension_hooks = { + NULL, /* create_gc */ + NULL, /* copy_gc */ + NULL, /* flush_gc */ + NULL, /* free_gc */ + NULL, /* create_font */ + NULL, /* free_font */ + close_display, /* close_display */ + wire_to_event, /* wire_to_event */ + event_to_wire, /* event_to_wire */ + NULL, /* error */ + error_string /* error_string */ +}; + +static /* const */ char *xtrap_error_list[] = { + "BadTransport (I/O transport not available)", + "BadMailbox (Cannot connect/disconnect to mailbox)", + "BadIO (I/O error while reading/writing in extension)", + "BadHostname (Cannot locate requested host)", + "BadStatistics (Statistics not configured/available)", + "BadDevices (Devices not properly vectored)", + "BadSocket (Cannot connect to INTERNET socket)", + "BadScreen (Cannot send event to given screen)", + "BadSwapReq (Cannot trap extension requests for swapped client)", +}; + +static XEXT_GENERATE_FIND_DISPLAY (find_display, xtrap_info, + xtrap_extension_name, + &xtrap_extension_hooks, + XETrapNumberEvents, NULL) + +static XEXT_GENERATE_CLOSE_DISPLAY (close_display, xtrap_info) + +static XEXT_GENERATE_ERROR_STRING (error_string, xtrap_extension_name, + XETrapNumErrors, xtrap_error_list) + +static Bool event_to_wire(Display *dpy, XEvent *libevent, xEvent *netevent) +{ + Bool status = False; + XExtDisplayInfo *info = find_display(dpy); + + XTrapCheckExtension(dpy,info,False); + + /* If we had more then one event */ +#if XETrapNumberErrors > 1 + switch((netevent->u.u.type & 0x7f) - info->codes->first_event) + { case XETrapData: +#endif + { + XETrapDataEvent *ev = (XETrapDataEvent *) libevent; + xETrapDataEvent *event = (xETrapDataEvent *) netevent; + + event->type = ev->type; + event->detail = ev->detail; + event->sequenceNumber = (ev->serial & 0xFFFF); + event->idx = ev->idx; + (void)memcpy(event->data,ev->data,sizeof(event->data)); + status = True; + } +#if XETrapNumberErrors > 1 + } +#endif + return(status); +} + +static Bool wire_to_event(Display *dpy, XEvent *libevent, xEvent *netevent) +{ + Bool status = False; + XExtDisplayInfo *info = find_display(dpy); + + XTrapCheckExtension(dpy,info,False); + + /* If we had more then one event */ +#if XETrapNumberErrors > 1 + switch((netevent->u.u.type & 0x7f) - info->codes->first_event) + { case XETrapData: +#endif + { + XETrapDataEvent *ev = (XETrapDataEvent *) libevent; + xETrapDataEvent *event = (xETrapDataEvent *) netevent; + + ev->type = event->type & 0x7F; + ev->detail = event->detail; + ev->serial = _XSetLastRequestRead(dpy,(xGenericReply *)netevent); + ev->synthetic = ((event->type & 0x80) != 0); + ev->display = dpy; + ev->idx = event->idx; + (void)memcpy(ev->data,event->data,sizeof(ev->data)); + status = True; + } +#if XETrapNumberErrors > 1 + } +#endif + return(status); +} + +/* + * XETrapQueryExtension - + * Returns True if the DEC-XTRAP extension is available + * on the given display. If the extension exists, the value of the + * first event code is stored into event_base and the value of the first + * error code is stored into error_base. + */ +Bool XETrapQueryExtension(Display *dpy,INT32 *event_base_return, + INT32 *error_base_return, INT32 *opcode_return) +{ + Bool status = True; + XExtDisplayInfo *info = find_display (dpy); + + if (XextHasExtension (info)) + { + *event_base_return = (INT32)(info->codes->first_event); + *error_base_return = (INT32)(info->codes->first_error); + *opcode_return = (INT32)(info->codes->major_opcode); + } + else + { + status = False; + } + return(status); +} + +#ifdef vms +/* Hard-coded since this didn't make it into XLibShr's xfer vector */ +/* From [.XLIBEL.SRC]XLibInt.c in VMS Source Pool */ +unsigned long _XSetLastRequestRead(Display *dpy, xGenericReply *rep) +{ + register unsigned long newseq, lastseq; + + /* + * KeymapNotify has no sequence number, but is always guaranteed + * to immediately follow another event, except when generated via + * SendEvent (hmmm). + */ + if ((rep->type & 0x7f) == KeymapNotify) + return(dpy->last_request_read); + + newseq = (dpy->last_request_read & ~((unsigned long)0xffff)) | + rep->sequenceNumber; + lastseq = dpy->last_request_read; + while (newseq < lastseq) { + newseq += 0x10000; + if (newseq > dpy->request) { + (void) fprintf (stderr, + "Xlib: sequence lost (0x%lx > 0x%lx) in reply type 0x%x!\n", + newseq, dpy->request, + (unsigned int) rep->type); + newseq -= 0x10000; + break; + } + } + + dpy->last_request_read = newseq; + return(newseq); +} +#endif + diff --git a/src/XEWrappers.c b/src/XEWrappers.c new file mode 100644 index 0000000..40b7e21 --- /dev/null +++ b/src/XEWrappers.c @@ -0,0 +1,325 @@ +/* $XFree86$ */ +/***************************************************************************** +Copyright 1987, 1988, 1989, 1990, 1991, 1994 by Digital Equipment Corp., +Maynard, MA +X11R6 Changes Copyright (c) 1994 by Robert Chesler of Absol-Puter, Hudson, NH. + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL AND ABSOL-PUTER DISCLAIM ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS, IN NO EVENT SHALL DIGITAL OR ABSOL-PUTER BE LIABLE FOR ANY +SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER +RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF +CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN +CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +*****************************************************************************/ +#include +#include +#include +#ifdef vms +#define IS_AT_OR_AFTER(t1, t2) (((t2).high > (t1).high) \ + || (((t2).high == (t1).high)&& ((t2).low >= (t1).low))) +typedef struct _vms_time { + unsigned long low; + unsigned long high; +}vms_time; /* from IntrinsicP.h */ +#ifdef VMSDW_V3 +typedef struct _ModToKeysymTable { + Modifiers mask; + int count; + int index; +} ModToKeysymTable; /* from TranslateI.h */ +typedef struct _ConverterRec **ConverterTable; /* from ConvertI.h */ +#include "libdef.h" +typedef struct _CallbackRec *CallbackList; /* from CallbackI.h */ +typedef struct _XtGrabRec *XtGrabList; /* from EventI.h */ +#include +#include +#else /* VMSDW_V3 */ +typedef struct _ModToKeysymTable { + Modifiers mask; + int count; + int index; +} ModToKeysymTable; /* from TranslateI.h */ +typedef struct _ConverterRec **ConverterTable; /* from ConvertI.h */ +#include "libdef.h" +#define NFDBITS (sizeof(fd_mask) * 8) +typedef long fd_mask; +#ifndef howmany +#define howmany(x, y) (((x)+((y)-1))/(y)) +#endif /* howmany */ +typedef struct Fd_set { + fd_mask fds_bits[howmany(256, NFDBITS)]; +} Fd_set; /* from fd.h */ +#include +#endif /* VMSDW_V3 */ +#else /* !vms */ +#include +#define IS_AT_OR_AFTER(t1, t2) (((t2).tv_sec > (t1).tv_sec) \ + || (((t2).tv_sec == (t1).tv_sec)&& ((t2).tv_usec >= (t1).tv_usec))) +#endif /* vms */ + +/* The following has been lifted from NextEvent.c in X11R4 */ + +#ifndef NEEDS_NTPD_FIXUP +# ifdef sun +# define NEEDS_NTPD_FIXUP 1 +# else +# define NEEDS_NTPD_FIXUP 0 +# endif +#endif + +#if NEEDS_NTPD_FIXUP +#define FIXUP_TIMEVAL(t) { \ + while ((t).tv_usec >= 1000000) { \ + (t).tv_usec -= 1000000; \ + (t).tv_sec++; \ + } \ + while ((t).tv_usec < 0) { \ + if ((t).tv_sec > 0) { \ + (t).tv_usec += 1000000; \ + (t).tv_sec--; \ + } else { \ + (t).tv_usec = 0; \ + break; \ + } \ + }} +#else +#define FIXUP_TIMEVAL(t) +#endif /*NEEDS_NTPD_FIXUP*/ + + +/* The following code is required for the use of the XLIB transport of XTrap + * events. This is in line with what MIT wants to see proper extension + * implementations do, as compared to using one of the core input event masks. + */ + +Boolean (*XETrapGetEventHandler(XETC *tc, CARD32 id))(XETrapDataEvent *event, XETC *tc) +{ + return((id < XETrapNumberEvents) ? tc->eventFunc[id] : NULL); +} + +Boolean (*XETrapSetEventHandler(XETC *tc, CARD32 id, + Boolean (*pfunc)(XETrapDataEvent *event, XETC *tc)))(XETrapDataEvent *event, XETC *tc) +{ + register Boolean (*rfunc)(XETrapDataEvent *event, XETC *tc) = NULL; + + if (id < XETrapNumberEvents) + { + rfunc = XETrapGetEventHandler(tc,id); + tc->eventFunc[id] = pfunc; + } + return(rfunc); +} + +Boolean XETrapDispatchEvent(XEvent *pevent, XETC *tc) +{ + Boolean status = False; + register CARD32 id = pevent->type; + register CARD32 firstEvent = tc->eventBase; + register CARD32 lastEvent = tc->eventBase + XETrapNumberEvents - 1L; + + /* If it is our extension event, handle it specially, otherwise, pass + * it off to Xt. + */ + if (firstEvent != 0 && id >= firstEvent && id <= lastEvent) + { + /* We may be ignoring the event */ + if (tc->eventFunc[id - firstEvent] != NULL) + { + status = (*tc->eventFunc[id - firstEvent])((XETrapDataEvent*)pevent,tc); + } + } + else + { + status = XtDispatchEvent(pevent); + } + return(status); +} + +XtInputMask XETrapAppPending(XtAppContext app) +{ + TimerEventRec *te_ptr; +#ifndef VMS + struct timeval cur_time; +#else /* vms */ + vms_time cur_time; + long efnMask = 0L; + int status; +#endif /* vms */ + XtInputMask retmask = XtAppPending(app); /* Prime XtIMEvent */ + + retmask &= ~(XtIMTimer | XtIMAlternateInput); /* clear timer & input */ + /* Now test for timer */ + te_ptr = app->timerQueue; + while (te_ptr != NULL) + { +#ifndef vms + (void)gettimeofday(&cur_time, NULL); + FIXUP_TIMEVAL(cur_time); +#else + sys$gettim(&cur_time); +#endif /* vms */ + if (IS_AT_OR_AFTER(te_ptr->te_timer_value, cur_time)) + { /* this timer is due to fire */ + retmask |= XtIMTimer; + break; + } + te_ptr = te_ptr->te_next; + } + + /* Now test for alternate input */ +#ifndef vms + if (app->outstandingQueue != NULL) + { + retmask |= XtIMAlternateInput; + } +#else /* vms */ + if ((app->Input_EF_Mask != 0L) && ((status=SYS$READEF(1,&efnMask)) == 1)) + { /* we have input configured & retrieved the efn cluster 0 */ + efnMask &= app->Input_EF_Mask; /* mask out non-input */ + if (efnMask) /* any left? */ + { /* yes, an alt-input efn is set */ + retmask |= XtIMAlternateInput; + } + } +#endif /* vms */ + return(retmask); +} + +void XETrapAppMainLoop(XtAppContext app, XETC *tc) +{ + XEvent event; + XtInputMask imask; + + while (1) + { + imask = XETrapAppPending(app); + /* Check to see what's going on so that we don't block + * in either NextEvent or ProcessEvent since neither + * of these routines can correctly deal with XTrap Events + */ + if (imask & XtIMXEvent) + { + (void)XtAppNextEvent(app,&event); + (void)XETrapDispatchEvent(&event,tc); + } + else if (imask & (XtIMTimer | XtIMAlternateInput)) + { + XtAppProcessEvent(app, (XtIMTimer | XtIMAlternateInput)); + } + else + { /* Nothing going on, so we need to block */ + (void)XETrapWaitForSomething(app); + } + } +} + +int XETrapAppWhileLoop(XtAppContext app, XETC *tc, Bool *done) +{ + XEvent event; + XtInputMask imask; + int status = True; + + if(done) + { + while (!(*done)) + { + imask = XETrapAppPending(app); + /* Check to see what's going on so that we don't block + * in either NextEvent or ProcessEvent since neither + * of these routines can correctly deal with XTrap Events + */ + if (imask & XtIMXEvent) + { + (void)XtAppNextEvent(app, &event); + (void)XETrapDispatchEvent(&event,tc); + } + else if (imask & (XtIMTimer | XtIMAlternateInput)) + { + XtAppProcessEvent(app, (XtIMTimer | XtIMAlternateInput)); + } + else + { /* Nothing going on, so we need to block */ + (void)XETrapWaitForSomething(app); + } + } + } + else + { + status = False; + } + return(status); +} + +/* Wait for either Timer, Alternate Input, or an X Event to arrive */ +int XETrapWaitForSomething(XtAppContext app) +{ +#ifndef vms + return(_XtWaitForSomething(app, FALSE, FALSE, FALSE, FALSE, TRUE +#ifdef XTHREADS + , FALSE +#endif /* XTHREADS */ + , 0L)); +#else /* vms */ +#define IS_AFTER(t1,t2) (((t2).high > (t1).high) \ + ||(((t2).high == (t1).high)&& ((t2).low > (t1).low))) + long retval = 0L; + TimerEventRec *te_ptr; + vms_time cur_time,result_time; + int status = 0; + long quotient, remainder = 0; + int d; + + if (app->timerQueue!= NULL) + { /* check timeout queue */ + cur_time.low = cur_time.high = result_time.low = result_time.high = 0; + te_ptr = app->timerQueue; + sys$gettim(&cur_time); + if ((IS_AFTER(app->timerQueue->te_timer_value, cur_time)) && + (app->timerQueue->te_proc != 0)) + { /* it's fired! return! */ + return(0); + } + /* Jump through hoops to get the time specified in the queue into + * milliseconds + */ + status = lib$sub_times (&(te_ptr->te_timer_value.low), &cur_time, + &result_time); + /* + * See if this timer has expired. A timer is considered expired + * if it's value in the past (the NEGTIM case) or if there is + * less than one integral milli second before it would go off. + */ + + if (status == LIB$_NEGTIM || + (result_time.high == -1 && result_time.low > -10000)) + { /* We've got a timer and it's ready to fire! */ + return(0); + } + else if ((status & 1) == 1) + { + lib$ediv (&(10000), &result_time, "ient, &remainder); + quotient *= -1; /* flip the sign bit */ + + return(XMultiplexInput(app->count, &(app->list[0L]), + app->Input_EF_Mask, quotient, 0L, &retval)); + } + else + { + status = -1; + } + } + + return((status == -1 ? -1 : XMultiplexInput(app->count, &(app->list[0L]), + app->Input_EF_Mask, 0L, 0L, &retval))); +#endif /* vms */ +} diff --git a/xtrap.pc.in b/xtrap.pc.in new file mode 100644 index 0000000..83e579e --- /dev/null +++ b/xtrap.pc.in @@ -0,0 +1,12 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: XTrap +Description: X Trap Library +Version: @PACKAGE_VERSION@ +Requires: trapproto +Requires.private: x11 xext xt +Cflags: -I${includedir} +Libs: -L${libdir} -lXTrap -- cgit v1.2.3