dxpc-3.9.2/0000755000175000017530000000000011245652455012063 5ustar kvigorkvigordxpc-3.9.2/TODO0000644000175000017530000000012510560644754012553 0ustar kvigorkvigorI currently have no plans for dxpc beyond 3.8.0. Suggestions will be considered... dxpc-3.9.2/ServerReadBuffer.C0000644000175000017530000000151610560644754015370 0ustar kvigorkvigor#include "ServerReadBuffer.H" #include "ServerChannel.H" #include "util.H" int ServerReadBuffer::locateMessage(const unsigned char *start, const unsigned char *end, unsigned int &headerLength, unsigned int &dataLength, unsigned int &trailerLength) { unsigned int size = end - start; if (size < 8) return 0; if (firstMessage_) dataLength = 8 + (GetUINT(start + 6, bigEndian_) << 2); else { if (*start == 1) dataLength = 32 + (GetULONG(start + 4, bigEndian_) << 2); else dataLength = 32; } if (size < dataLength) return 0; firstMessage_ = 0; headerLength = 0; trailerLength = 0; return 1; } dxpc-3.9.2/ServerReadBuffer.H0000644000175000017530000000146010560644754015373 0ustar kvigorkvigor#ifndef ServerReadBuffer_H # define ServerReadBuffer_H # include "ReadBuffer.H" class ServerChannel; class ServerReadBuffer:public ReadBuffer { public: ServerReadBuffer(int fd, ServerChannel * channel):ReadBuffer(fd, 256), firstMessage_(1), channel_(channel) { } virtual ~ ServerReadBuffer() { } void setBigEndian(int flag) { bigEndian_ = flag; } protected: virtual int locateMessage(const unsigned char *start, const unsigned char *end, unsigned int &headerLength, unsigned int &dataLength, unsigned int &trailerLength); int firstMessage_; int bigEndian_; ServerChannel *channel_; }; #endif /* ServerReadBuffer_H */ dxpc-3.9.2/Decompresser.C0000644000175000017530000000201310560644754014620 0ustar kvigorkvigor#include "dxpcconf.h" #include #include "X-headers.H" #include "ClientChannel.H" #include "EncodeBuffer.H" #include "DecodeBuffer.H" #include "util.H" #include "assert.h" #include "Compresser.H" #include "Decompresser.H" Decompresser::Decompresser(int compressionLevel) { decompressionFnc = Compresser::getDecompresser(compressionLevel); } Decompresser::~Decompresser() { } void Decompresser::decompressBuffer(CompressionType compressionType, unsigned char *outBuffer, DecodeBuffer & decodeBuffer) { lzo_uint size; unsigned compressedSize, value; if (!decompressionFnc || compressionType != LZO_COMPRESSION) { return; } decodeBuffer.decodeValue(compressedSize, sizeof(unsigned) * 8); decodeBuffer.decodeValue(value, sizeof(unsigned) * 8); size = (lzo_uint)value; decompressionFnc(decodeBuffer.decodeRawMem(compressedSize), (lzo_uint)compressedSize, outBuffer, &size, NULL); } dxpc-3.9.2/Decompresser.H0000644000175000017530000000076210560644754014636 0ustar kvigorkvigor#ifndef DECOMPRESSER_H_ # define DECOMPRESSER_H_ # ifdef LZO2 # include "lzo/lzo1c.h" # else # include "lzo1c.h" # endif class DecodeBuffer; # include "Compresser.H" class Decompresser { public: Decompresser(int compressionLevel); ~Decompresser(); void decompressBuffer(CompressionType compressionType, unsigned char *outBuffer, DecodeBuffer & decodeBuffer); private: lzo_decompress_t decompressionFnc; }; #endif dxpc-3.9.2/TextCompressor.C0000644000175000017530000000312310560644754015171 0ustar kvigorkvigor#include "TextCompressor.H" #include "EncodeBuffer.H" #include "DecodeBuffer.H" #include "util.H" void TextCompressor::encodeChar(unsigned char ch, EncodeBuffer & encodeBuffer) { // encode each successive character of text using // a predictive model where most of the last 3 characters // (low order 7 bits of the previous character, plus the // low order 5 bits of the character before that, plus // the low order 3 bits of the character before that) // are used to find the right cache... CharCache & cache = cache_[key_ % cacheSize_]; if ((key_ >= 128) && (cache.getSize() == 0)) { // 3rd-order model doesn't have any statistics yet, // so use the 1st-order one instead CharCache & cache2 = cache_[(key_ & 0x7f) % cacheSize_]; encodeBuffer.encodeCachedValue((unsigned int) ch, 8, cache2); cache.insert(ch); } else { encodeBuffer.encodeCachedValue((unsigned int) ch, 8, cache); } key_ = (((key_ & 0x1f) << 7) | ((key_ & 0x380) << 5) | (ch & 0x7f)); } unsigned char TextCompressor::decodeChar(DecodeBuffer & decodeBuffer) { unsigned char nextChar; CharCache & cache = cache_[key_ % cacheSize_]; if ((key_ >= 128) && (cache.getSize() == 0)) { CharCache & cache2 = cache_[(key_ & 0x7f) % cacheSize_]; decodeBuffer.decodeCachedValue(nextChar, 8, cache2); cache.insert(nextChar); } else { decodeBuffer.decodeCachedValue(nextChar, 8, cache); } key_ = (((key_ & 0x1f) << 7) | ((key_ & 0x380) << 5) | (nextChar & 0x7f)); return nextChar; } dxpc-3.9.2/TextCompressor.H0000644000175000017530000000110210560644754015171 0ustar kvigorkvigor#ifndef TextCompressor_H # define TextCompressor_H # include "CharCache.H" class EncodeBuffer; class DecodeBuffer; class TextCompressor { public: TextCompressor(CharCache * cache, unsigned int cacheSize):cache_(cache), cacheSize_(cacheSize), key_(0) { } void encodeChar(unsigned char ch, EncodeBuffer &); unsigned char decodeChar(DecodeBuffer &); void reset(unsigned int newKey = 0) { key_ = newKey; } private: CharCache * cache_; unsigned int cacheSize_; unsigned int key_; }; #endif /* TextCompressor_H */ dxpc-3.9.2/LastPixels.C0000644000175000017530000000113210560644754014256 0ustar kvigorkvigor#include "LastPixels.H" LastPixels::LastPixels(unsigned int num): size_(num), index_(0), buffer_(new unsigned int[num]) { for (unsigned int i = 0; i < num; i++) buffer_[i] = 0; } unsigned int LastPixels::getValue() const { unsigned int sum = 0; unsigned int i; for (i = index_; i < size_; i++) { sum <<= 1; sum += buffer_[i]; } for (i = 0; i < index_; i++) { sum <<= 1; sum += buffer_[i]; } return sum; } void LastPixels::reset() { for (unsigned int i = 0; i < size_; i++) buffer_[i] = 0; } dxpc-3.9.2/LastPixels.H0000644000175000017530000000072410560644754014271 0ustar kvigorkvigor#ifndef LastPixels_H # define LastPixels_H class LastPixels { public: LastPixels(unsigned int num); ~LastPixels() { delete[]buffer_; } void add(unsigned int value) { buffer_[index_++] = value; if (index_ == size_) index_ = 0; } unsigned int getValue() const; void reset(); private: unsigned int size_; unsigned int index_; unsigned int *buffer_; }; #endif /* LastPixels_H */ dxpc-3.9.2/ServerCache.C0000644000175000017530000000563110560644754014370 0ustar kvigorkvigor#include "ServerCache.H" // Some global caches used to store information common to all X connections... BlockCache ServerCache::lastInitReply; BlockCache ServerCache::lastKeymap; unsigned char ServerCache::getKeyboardMappingLastKeysymsPerKeycode = 0; BlockCache ServerCache::getKeyboardMappingLastMap; BlockCache ServerCache::getModifierMappingLastMap; BlockCache ServerCache::xResources; BlockCacheSet ServerCache::queryFontFontCache(16); ServerCache::ServerCache(): lastSequenceNum(0), replySequenceNumCache(6), eventSequenceNumCache(6), lastTimestamp(0), visualCache(8), colormapCache(8), lastOpcode(0), errorMinorCache(8), colormapNotifyWindowCache(8), colormapNotifyColormapCache(8), createNotifyWindowCache(8), createNotifyLastWindow(0), exposeWindowCache(12), focusInWindowCache(8), keyPressLastKey(0), mapNotifyEventCache(8), mapNotifyWindowCache(8), motionNotifyTimestampCache(8), motionNotifyLastRootX(0), motionNotifyLastRootY(0), motionNotifyRootXCache(8), motionNotifyRootYCache(8), motionNotifyEventXCache(8), motionNotifyEventYCache(8), motionNotifyStateCache(8), noExposeDrawableCache(8), noExposeMinorCache(8), propertyNotifyWindowCache(8), propertyNotifyAtomCache(8), reparentNotifyWindowCache(8), selectionClearWindowCache(8), selectionClearAtomCache(8), visibilityNotifyWindowCache(8), getGeometryRootCache(8), getInputFocusWindowCache(8), getKeyboardMappingKeysymCache(8), getPropertyTypeCache(8), getPropertyTextCompressor(textCache, SERVER_TEXT_CACHE_SIZE), getSelectionOwnerCache(8), getWindowAttributesClassCache(8), getWindowAttributesPlanesCache(8), getWindowAttributesPixelCache(8), getWindowAttributesAllEventsCache(8), getWindowAttributesYourEventsCache(8), getWindowAttributesDontPropagateCache(8), queryPointerRootCache(8), queryPointerChildCache(8), translateCoordsChildCache(8), translateCoordsXCache(8), translateCoordsYCache(8) { unsigned int i; for (i = 0; i < 3; i++) configureNotifyWindowCache[i] = new IntCache(8); for (i = 0; i < 5; i++) configureNotifyGeomCache[i] = new IntCache(8); for (i = 0; i < 5; i++) exposeGeomCache[i] = new IntCache(8); for (i = 0; i < 3; i++) motionNotifyWindowCache[i] = new IntCache(8); for (i = 0; i < 5; i++) getGeometryGeomCache[i] = new IntCache(8); for (i = 0; i < 23; i++) keyPressCache[i] = 0; for (i = 0; i < 6; i++) { queryFontCharInfoCache[i] = new IntCache(8); queryFontLastCharInfo[i] = 0; } } ServerCache::~ServerCache() { unsigned int i; for (i = 0; i < 3; i++) delete configureNotifyWindowCache[i]; for (i = 0; i < 5; i++) delete configureNotifyGeomCache[i]; for (i = 0; i < 5; i++) delete exposeGeomCache[i]; for (i = 0; i < 3; i++) delete motionNotifyWindowCache[i]; for (i = 0; i < 5; i++) delete getGeometryGeomCache[i]; for (i = 0; i < 6; i++) delete queryFontCharInfoCache[i]; } dxpc-3.9.2/ServerCache.H0000644000175000017530000001050110560644754014365 0ustar kvigorkvigor#ifndef ServerCache_H # define ServerCache_H # include "IntCache.H" # include "CharCache.H" # include "TextCompressor.H" # include "BlockCache.H" # include "BlockCacheSet.H" static const unsigned int SERVER_TEXT_CACHE_SIZE = 9999; class ServerCache { public: ServerCache(); ~ServerCache(); // General-purpose caches: CharCache textCache[SERVER_TEXT_CACHE_SIZE]; unsigned int lastSequenceNum; IntCache replySequenceNumCache; IntCache eventSequenceNumCache; unsigned int lastTimestamp; CharCache depthCache; IntCache visualCache; IntCache colormapCache; // Opcode prediction caches (predict next opcode based on previous one) CharCache opcodeCache[256]; unsigned char lastOpcode; // X connection startup static BlockCache lastInitReply; // X errors CharCache errorCodeCache; IntCache errorMinorCache; CharCache errorMajorCache; // ButtonPress and ButtonRelease events CharCache buttonCache; // ColormapNotify event IntCache colormapNotifyWindowCache; IntCache colormapNotifyColormapCache; // ConfigureNotify event IntCache *configureNotifyWindowCache[3]; IntCache *configureNotifyGeomCache[5]; // CreateNotify event IntCache createNotifyWindowCache; unsigned int createNotifyLastWindow; // Expose event IntCache exposeWindowCache; IntCache *exposeGeomCache[5]; // FocusIn event // (also used for FocusOut) IntCache focusInWindowCache; // KeymapNotify event static BlockCache lastKeymap; // KeyPress event unsigned char keyPressLastKey; unsigned char keyPressCache[23]; // MapNotify event // (also used for UnmapNotify) IntCache mapNotifyEventCache; IntCache mapNotifyWindowCache; // MotionNotify event // (also used for KeyPress, KeyRelease, ButtonPress, ButtonRelease, // EnterNotify, and LeaveNotify events and QueryPointer reply) IntCache motionNotifyTimestampCache; unsigned int motionNotifyLastRootX; unsigned int motionNotifyLastRootY; IntCache motionNotifyRootXCache; IntCache motionNotifyRootYCache; IntCache motionNotifyEventXCache; IntCache motionNotifyEventYCache; IntCache motionNotifyStateCache; IntCache *motionNotifyWindowCache[3]; // NoExpose event IntCache noExposeDrawableCache; IntCache noExposeMinorCache; CharCache noExposeMajorCache; // PropertyNotify event IntCache propertyNotifyWindowCache; IntCache propertyNotifyAtomCache; // ReparentNotify event IntCache reparentNotifyWindowCache; // SelectionClear event IntCache selectionClearWindowCache; IntCache selectionClearAtomCache; // VisibilityNotify event IntCache visibilityNotifyWindowCache; // GetGeometry reply IntCache getGeometryRootCache; IntCache *getGeometryGeomCache[5]; // GetInputFocus reply IntCache getInputFocusWindowCache; // GetKeyboardMapping reply static unsigned char getKeyboardMappingLastKeysymsPerKeycode; static BlockCache getKeyboardMappingLastMap; IntCache getKeyboardMappingKeysymCache; CharCache getKeyboardMappingLastByteCache; // GetModifierMapping reply static BlockCache getModifierMappingLastMap; // GetProperty reply CharCache getPropertyFormatCache; IntCache getPropertyTypeCache; TextCompressor getPropertyTextCompressor; static BlockCache xResources; // GetSelection reply IntCache getSelectionOwnerCache; // GetWindowAttributes reply IntCache getWindowAttributesClassCache; CharCache getWindowAttributesBitGravityCache; CharCache getWindowAttributesWinGravityCache; IntCache getWindowAttributesPlanesCache; IntCache getWindowAttributesPixelCache; IntCache getWindowAttributesAllEventsCache; IntCache getWindowAttributesYourEventsCache; IntCache getWindowAttributesDontPropagateCache; // QueryColors reply BlockCache queryColorsLastReply; // QueryFont reply static BlockCacheSet queryFontFontCache; IntCache *queryFontCharInfoCache[6]; unsigned int queryFontLastCharInfo[6]; // QueryPointer reply IntCache queryPointerRootCache; IntCache queryPointerChildCache; // TranslateCoords reply IntCache translateCoordsChildCache; IntCache translateCoordsXCache; IntCache translateCoordsYCache; }; #endif /* ServerCache_H */ dxpc-3.9.2/configure0000755000175000017530000053622610560644754014012 0ustar kvigorkvigor#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59. # # Copyright (C) 2003 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` exec 6>&1 # # Initializations. # ac_default_prefix=/usr/local ac_config_libobj_dir=. cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. # This variable seems obsolete. It should probably be removed, and # only ac_max_sed_lines should be used. : ${ac_max_here_lines=38} # Identity of this package. PACKAGE_NAME= PACKAGE_TARNAME= PACKAGE_VERSION= PACKAGE_STRING= PACKAGE_BUGREPORT= ac_unique_file="main.C" # Factoring default headers for most tests. ac_includes_default="\ #include #if HAVE_SYS_TYPES_H # include #endif #if HAVE_SYS_STAT_H # include #endif #if STDC_HEADERS # include # include #else # if HAVE_STDLIB_H # include # endif #endif #if HAVE_STRING_H # if !STDC_HEADERS && HAVE_MEMORY_H # include # endif # include #endif #if HAVE_STRINGS_H # include #endif #if HAVE_INTTYPES_H # include #else # if HAVE_STDINT_H # include # endif #endif #if HAVE_UNISTD_H # include #endif" ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CXX CXXFLAGS LDFLAGS CPPFLAGS ac_ct_CXX EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA build build_cpu build_vendor build_os host host_cpu host_vendor host_os MINGW32 CXXCPP X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS EGREP LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. ac_init_help= ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datadir='${prefix}/share' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' infodir='${prefix}/info' mandir='${prefix}/man' ac_prev= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval "$ac_prev=\$ac_option" ac_prev= continue fi ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_option in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) datadir=$ac_optarg ;; -disable-* | --disable-*) ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` eval "enable_$ac_feature=no" ;; -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "enable_$ac_feature='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ | --locals | --local | --loca | --loc | --lo) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package| sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "with_$ac_package='$ac_optarg'" ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/-/_/g'` eval "with_$ac_package=no" ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) { echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` eval "$ac_envvar='$ac_optarg'" export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` { echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi # Be sure to have absolute paths. for ac_var in exec_prefix prefix do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* | NONE | '' ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # Be sure to have absolute paths. for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ localstatedir libdir includedir oldincludedir infodir mandir do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. ac_confdir=`(dirname "$0") 2>/dev/null || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$0" : 'X\(//\)[^/]' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` srcdir=$ac_confdir if test ! -r $srcdir/$ac_unique_file; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 { (exit 1); exit 1; }; } else { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi fi (cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 { (exit 1); exit 1; }; } srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` ac_env_build_alias_set=${build_alias+set} ac_env_build_alias_value=$build_alias ac_cv_env_build_alias_set=${build_alias+set} ac_cv_env_build_alias_value=$build_alias ac_env_host_alias_set=${host_alias+set} ac_env_host_alias_value=$host_alias ac_cv_env_host_alias_set=${host_alias+set} ac_cv_env_host_alias_value=$host_alias ac_env_target_alias_set=${target_alias+set} ac_env_target_alias_value=$target_alias ac_cv_env_target_alias_set=${target_alias+set} ac_cv_env_target_alias_value=$target_alias ac_env_CXX_set=${CXX+set} ac_env_CXX_value=$CXX ac_cv_env_CXX_set=${CXX+set} ac_cv_env_CXX_value=$CXX ac_env_CXXFLAGS_set=${CXXFLAGS+set} ac_env_CXXFLAGS_value=$CXXFLAGS ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set} ac_cv_env_CXXFLAGS_value=$CXXFLAGS ac_env_LDFLAGS_set=${LDFLAGS+set} ac_env_LDFLAGS_value=$LDFLAGS ac_cv_env_LDFLAGS_set=${LDFLAGS+set} ac_cv_env_LDFLAGS_value=$LDFLAGS ac_env_CPPFLAGS_set=${CPPFLAGS+set} ac_env_CPPFLAGS_value=$CPPFLAGS ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} ac_cv_env_CPPFLAGS_value=$CPPFLAGS ac_env_CXXCPP_set=${CXXCPP+set} ac_env_CXXCPP_value=$CXXCPP ac_cv_env_CXXCPP_set=${CXXCPP+set} ac_cv_env_CXXCPP_value=$CXXCPP # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures this package to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] _ACEOF cat <<_ACEOF Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --datadir=DIR read-only architecture-independent data [PREFIX/share] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --infodir=DIR info documentation [PREFIX/info] --mandir=DIR man documentation [PREFIX/man] _ACEOF cat <<\_ACEOF X features: --x-includes=DIR X include files are in DIR --x-libraries=DIR X library files are in DIR System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then cat <<\_ACEOF Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-lzo-lib=DIR specify location of LZO library --with-x use the X Window System Some influential environment variables: CXX C++ compiler command CXXFLAGS C++ compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CXXCPP C++ preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. _ACEOF fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. ac_popdir=`pwd` for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d $ac_dir || continue ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac cd $ac_dir # Check for guested configure; otherwise get Cygnus style configure. if test -f $ac_srcdir/configure.gnu; then echo $SHELL $ac_srcdir/configure.gnu --help=recursive elif test -f $ac_srcdir/configure; then echo $SHELL $ac_srcdir/configure --help=recursive elif test -f $ac_srcdir/configure.ac || test -f $ac_srcdir/configure.in; then echo $ac_configure --help else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi cd $ac_popdir done fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF Copyright (C) 2003 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit 0 fi exec 5>config.log cat >&5 <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ _ACEOF { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` hostinfo = `(hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_sep= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" # Get rid of the leading space. ac_sep=" " ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Be sure not to use single quotes in there, as some shells, # such as our DU 5.0 friend, will then `close' the trap. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, { (set) 2>&1 | case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in *ac_space=\ *) sed -n \ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" ;; *) sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------- ## ## Output files. ## ## ------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo sed "/^$/d" confdefs.h | sort echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core *.core && rm -rf conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h # AIX cpp loses on an empty file, so make sure it contains at least a newline. echo >confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" else CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { echo "$as_me:$LINENO: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . $cache_file;; *) . ./$cache_file;; esac fi else { echo "$as_me:$LINENO: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in `(set) 2>&1 | sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val="\$ac_cv_env_${ac_var}_value" eval ac_new_val="\$ac_env_${ac_var}_value" case $ac_old_set,$ac_new_set in set,) { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_config_headers="$ac_config_headers dxpcconf.h" ac_config_files="$ac_config_files Makefile" # Check whether --with-lzo-lib or --without-lzo-lib was given. if test "${with_lzo_lib+set}" = set; then withval="$with_lzo_lib" CXXFLAGS="$CXXFLAGS -I$withval/include" CPPFLAGS="$CPPFLAGS -I$withval/include" LDFLAGS="$LDFLAGS -L$withval/lib -R$withval/lib" fi; ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test -n "$ac_tool_prefix"; then for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then echo "$as_me:$LINENO: result: $CXX" >&5 echo "${ECHO_T}$CXX" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CXX" && break done fi if test -z "$CXX"; then ac_ct_CXX=$CXX for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CXX"; then ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CXX="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 echo "${ECHO_T}$ac_ct_CXX" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_CXX" && break done test -n "$ac_ct_CXX" || ac_ct_CXX="g++" CXX=$ac_ct_CXX fi # Provide some information about the compiler. echo "$as_me:$LINENO:" \ "checking for C++ compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. echo "$as_me:$LINENO: checking for C++ compiler default output file name" >&5 echo $ECHO_N "checking for C++ compiler default output file name... $ECHO_C" >&6 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 (eval $ac_link_default) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Find the output, starting from the most likely. This scheme is # not robust to junk in `.', hence go to wildcards (a.*) only as a last # resort. # Be careful to initialize this variable, since it used to be cached. # Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. ac_cv_exeext= # b.out is created by i960 compilers. for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; conftest.$ac_ext ) # This is the source file. ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` # FIXME: I believe we export ac_cv_exeext for Libtool, # but it would be cool to find out if it's true. Does anybody # maintain Libtool? --akim. export ac_cv_exeext break;; * ) break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: C++ compiler cannot create executables See \`config.log' for more details." >&5 echo "$as_me: error: C++ compiler cannot create executables See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6 # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether the C++ compiler works" >&5 echo $ECHO_N "checking whether the C++ compiler works... $ECHO_C" >&6 # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { echo "$as_me:$LINENO: error: cannot run C++ compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 echo "$as_me: error: cannot run C++ compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi fi fi echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 rm -f a.out a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 echo "$as_me:$LINENO: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6 echo "$as_me:$LINENO: checking for suffix of executables" >&5 echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` export ac_cv_exeext break;; * ) break;; esac done else { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6 rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT echo "$as_me:$LINENO: checking for suffix of object files" >&5 echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6 OBJEXT=$ac_cv_objext ac_objext=$OBJEXT echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6 if test "${ac_cv_cxx_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6 GXX=`test $ac_compiler_gnu = yes && echo yes` ac_test_CXXFLAGS=${CXXFLAGS+set} ac_save_CXXFLAGS=$CXXFLAGS CXXFLAGS="-g" echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cxx_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cxx_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_cxx_g=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6 if test "$ac_test_CXXFLAGS" = set; then CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then CXXFLAGS="-g -O2" else CXXFLAGS="-g" fi else if test "$GXX" = yes; then CXXFLAGS="-O2" else CXXFLAGS= fi fi for ac_declaration in \ '' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration #include int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 continue fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then echo '#ifdef __cplusplus' >>confdefs.h echo $ac_declaration >>confdefs.h echo '#endif' >>confdefs.h fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f $ac_dir/install-sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f $ac_dir/install.sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f $ac_dir/shtool; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} { (exit 1); exit 1; }; } fi ac_config_guess="$SHELL $ac_aux_dir/config.guess" ac_config_sub="$SHELL $ac_aux_dir/config.sub" ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi done done ;; esac done fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. INSTALL=$ac_install_sh fi fi echo "$as_me:$LINENO: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' # Make sure we can run config.sub. $ac_config_sub sun4 >/dev/null 2>&1 || { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 echo "$as_me: error: cannot run $ac_config_sub" >&2;} { (exit 1); exit 1; }; } echo "$as_me:$LINENO: checking build system type" >&5 echo $ECHO_N "checking build system type... $ECHO_C" >&6 if test "${ac_cv_build+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_build_alias=$build_alias test -z "$ac_cv_build_alias" && ac_cv_build_alias=`$ac_config_guess` test -z "$ac_cv_build_alias" && { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 echo "$as_me: error: cannot guess build type; you must specify one" >&2;} { (exit 1); exit 1; }; } ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5 echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: result: $ac_cv_build" >&5 echo "${ECHO_T}$ac_cv_build" >&6 build=$ac_cv_build build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$as_me:$LINENO: checking host system type" >&5 echo $ECHO_N "checking host system type... $ECHO_C" >&6 if test "${ac_cv_host+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_host_alias=$host_alias test -z "$ac_cv_host_alias" && ac_cv_host_alias=$ac_cv_build_alias ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5 echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: result: $ac_cv_host" >&5 echo "${ECHO_T}$ac_cv_host" >&6 host=$ac_cv_host host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` HOST=$host_os $CC -v 2>&1 | grep -q -e mingw-special if test "$?" -eq "0"; then HOST=mingw fi case $HOST in *mingw* ) LIBS="$LIBS -lwsock32";CXXFLAGS="$CXXFLAGS -O2";MINGW32="true";; * ) MINGW32="false";; esac ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu echo "$as_me:$LINENO: checking how to run the C++ preprocessor" >&5 echo $ECHO_N "checking how to run the C++ preprocessor... $ECHO_C" >&6 if test -z "$CXXCPP"; then if test "${ac_cv_prog_CXXCPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CXXCPP needs to be expanded for CXXCPP in "$CXX -E" "/lib/cpp" do ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CXXCPP=$CXXCPP fi CXXCPP=$ac_cv_prog_CXXCPP else ac_cv_prog_CXXCPP=$CXXCPP fi echo "$as_me:$LINENO: result: $CXXCPP" >&5 echo "${ECHO_T}$CXXCPP" >&6 ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { echo "$as_me:$LINENO: error: C++ preprocessor \"$CXXCPP\" fails sanity check See \`config.log' for more details." >&5 echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu echo "$as_me:$LINENO: checking for X" >&5 echo $ECHO_N "checking for X... $ECHO_C" >&6 # Check whether --with-x or --without-x was given. if test "${with_x+set}" = set; then withval="$with_x" fi; # $have_x is `yes', `no', `disabled', or empty when we do not yet know. if test "x$with_x" = xno; then # The user explicitly disabled X. have_x=disabled else if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then # Both variables are already set. have_x=yes else if test "${ac_cv_have_x+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # One or both of the vars are not set, and there is no cached value. ac_x_includes=no ac_x_libraries=no rm -fr conftest.dir if mkdir conftest.dir; then cd conftest.dir # Make sure to not put "make" in the Imakefile rules, since we grep it out. cat >Imakefile <<'_ACEOF' acfindx: @echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"' _ACEOF if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then # GNU make sometimes prints "make[1]: Entering...", which would confuse us. eval `${MAKE-make} acfindx 2>/dev/null | grep -v make` # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR. for ac_extension in a so sl; do if test ! -f $ac_im_usrlibdir/libX11.$ac_extension && test -f $ac_im_libdir/libX11.$ac_extension; then ac_im_usrlibdir=$ac_im_libdir; break fi done # Screen out bogus values from the imake configuration. They are # bogus both because they are the default anyway, and because # using them would break gcc on systems where it needs fixed includes. case $ac_im_incroot in /usr/include) ;; *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;; esac case $ac_im_usrlibdir in /usr/lib | /lib) ;; *) test -d "$ac_im_usrlibdir" && ac_x_libraries=$ac_im_usrlibdir ;; esac fi cd .. rm -fr conftest.dir fi # Standard set of common directories for X headers. # Check X11 before X11Rn because it is often a symlink to the current release. ac_x_header_dirs=' /usr/X11/include /usr/X11R6/include /usr/X11R5/include /usr/X11R4/include /usr/include/X11 /usr/include/X11R6 /usr/include/X11R5 /usr/include/X11R4 /usr/local/X11/include /usr/local/X11R6/include /usr/local/X11R5/include /usr/local/X11R4/include /usr/local/include/X11 /usr/local/include/X11R6 /usr/local/include/X11R5 /usr/local/include/X11R4 /usr/X386/include /usr/x386/include /usr/XFree86/include/X11 /usr/include /usr/local/include /usr/unsupported/include /usr/athena/include /usr/local/x11r5/include /usr/lpp/Xamples/include /usr/openwin/include /usr/openwin/share/include' if test "$ac_x_includes" = no; then # Guess where to find include files, by looking for Intrinsic.h. # First, try using that file with no special directory specified. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # We can compile using X headers with no special include directory. ac_x_includes= else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 for ac_dir in $ac_x_header_dirs; do if test -r "$ac_dir/X11/Intrinsic.h"; then ac_x_includes=$ac_dir break fi done fi rm -f conftest.err conftest.$ac_ext fi # $ac_x_includes = no if test "$ac_x_libraries" = no; then # Check for the libraries. # See if we find them without any special options. # Don't add to $LIBS permanently. ac_save_LIBS=$LIBS LIBS="-lXt $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { XtMalloc (0) ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then LIBS=$ac_save_LIBS # We can link X programs with no special library path. ac_x_libraries= else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 LIBS=$ac_save_LIBS for ac_dir in `echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g` do # Don't even attempt the hair of trying to link an X program! for ac_extension in a so sl; do if test -r $ac_dir/libXt.$ac_extension; then ac_x_libraries=$ac_dir break 2 fi done done fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi # $ac_x_libraries = no if test "$ac_x_includes" = no || test "$ac_x_libraries" = no; then # Didn't find X anywhere. Cache the known absence of X. ac_cv_have_x="have_x=no" else # Record where we found X for the cache. ac_cv_have_x="have_x=yes \ ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries" fi fi fi eval "$ac_cv_have_x" fi # $with_x != no if test "$have_x" != yes; then echo "$as_me:$LINENO: result: $have_x" >&5 echo "${ECHO_T}$have_x" >&6 no_x=yes else # If each of the values was on the command line, it overrides each guess. test "x$x_includes" = xNONE && x_includes=$ac_x_includes test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries # Update the cache value to reflect the command line values. ac_cv_have_x="have_x=yes \ ac_x_includes=$x_includes ac_x_libraries=$x_libraries" echo "$as_me:$LINENO: result: libraries $x_libraries, headers $x_includes" >&5 echo "${ECHO_T}libraries $x_libraries, headers $x_includes" >&6 fi if test "$no_x" = yes; then # Not all programs may use this symbol, but it does not hurt to define it. cat >>confdefs.h <<\_ACEOF #define X_DISPLAY_MISSING 1 _ACEOF X_CFLAGS= X_PRE_LIBS= X_LIBS= X_EXTRA_LIBS= else if test -n "$x_includes"; then X_CFLAGS="$X_CFLAGS -I$x_includes" fi # It would also be nice to do this for all -L options, not just this one. if test -n "$x_libraries"; then X_LIBS="$X_LIBS -L$x_libraries" # For Solaris; some versions of Sun CC require a space after -R and # others require no space. Words are not sufficient . . . . case `(uname -sr) 2>/dev/null` in "SunOS 5"*) echo "$as_me:$LINENO: checking whether -R must be followed by a space" >&5 echo $ECHO_N "checking whether -R must be followed by a space... $ECHO_C" >&6 ac_xsave_LIBS=$LIBS; LIBS="$LIBS -R$x_libraries" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_R_nospace=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_R_nospace=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test $ac_R_nospace = yes; then echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 X_LIBS="$X_LIBS -R$x_libraries" else LIBS="$ac_xsave_LIBS -R $x_libraries" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_R_space=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_R_space=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test $ac_R_space = yes; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 X_LIBS="$X_LIBS -R $x_libraries" else echo "$as_me:$LINENO: result: neither works" >&5 echo "${ECHO_T}neither works" >&6 fi fi LIBS=$ac_xsave_LIBS esac fi # Check for system-dependent libraries X programs must link with. # Do this before checking for the system-independent R6 libraries # (-lICE), since we may need -lsocket or whatever for X linking. if test "$ISC" = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl_s -linet" else # Martyn Johnson says this is needed for Ultrix, if the X # libraries were built with DECnet support. And Karl Berry says # the Alpha needs dnet_stub (dnet does not exist). ac_xsave_LIBS="$LIBS"; LIBS="$LIBS $X_LIBS -lX11" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char XOpenDisplay (); int main () { XOpenDisplay (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "$as_me:$LINENO: checking for dnet_ntoa in -ldnet" >&5 echo $ECHO_N "checking for dnet_ntoa in -ldnet... $ECHO_C" >&6 if test "${ac_cv_lib_dnet_dnet_ntoa+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldnet $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dnet_ntoa (); int main () { dnet_ntoa (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dnet_dnet_ntoa=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dnet_dnet_ntoa=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dnet_dnet_ntoa" >&5 echo "${ECHO_T}$ac_cv_lib_dnet_dnet_ntoa" >&6 if test $ac_cv_lib_dnet_dnet_ntoa = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet" fi if test $ac_cv_lib_dnet_dnet_ntoa = no; then echo "$as_me:$LINENO: checking for dnet_ntoa in -ldnet_stub" >&5 echo $ECHO_N "checking for dnet_ntoa in -ldnet_stub... $ECHO_C" >&6 if test "${ac_cv_lib_dnet_stub_dnet_ntoa+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldnet_stub $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dnet_ntoa (); int main () { dnet_ntoa (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dnet_stub_dnet_ntoa=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dnet_stub_dnet_ntoa=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_dnet_stub_dnet_ntoa" >&5 echo "${ECHO_T}$ac_cv_lib_dnet_stub_dnet_ntoa" >&6 if test $ac_cv_lib_dnet_stub_dnet_ntoa = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub" fi fi fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS="$ac_xsave_LIBS" # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT, # to get the SysV transport functions. # Chad R. Larson says the Pyramis MIS-ES running DC/OSx (SVR4) # needs -lnsl. # The nsl library prevents programs from opening the X display # on Irix 5.2, according to T.E. Dickey. # The functions gethostbyname, getservbyname, and inet_addr are # in -lbsd on LynxOS 3.0.1/i386, according to Lars Hecking. echo "$as_me:$LINENO: checking for gethostbyname" >&5 echo $ECHO_N "checking for gethostbyname... $ECHO_C" >&6 if test "${ac_cv_func_gethostbyname+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define gethostbyname to an innocuous variant, in case declares gethostbyname. For example, HP-UX 11i declares gettimeofday. */ #define gethostbyname innocuous_gethostbyname /* System header to define __stub macros and hopefully few prototypes, which can conflict with char gethostbyname (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef gethostbyname /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char gethostbyname (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_gethostbyname) || defined (__stub___gethostbyname) choke me #else char (*f) () = gethostbyname; #endif #ifdef __cplusplus } #endif int main () { return f != gethostbyname; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_gethostbyname=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_gethostbyname=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_gethostbyname" >&5 echo "${ECHO_T}$ac_cv_func_gethostbyname" >&6 if test $ac_cv_func_gethostbyname = no; then echo "$as_me:$LINENO: checking for gethostbyname in -lnsl" >&5 echo $ECHO_N "checking for gethostbyname in -lnsl... $ECHO_C" >&6 if test "${ac_cv_lib_nsl_gethostbyname+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lnsl $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char gethostbyname (); int main () { gethostbyname (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_nsl_gethostbyname=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_nsl_gethostbyname=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_gethostbyname" >&5 echo "${ECHO_T}$ac_cv_lib_nsl_gethostbyname" >&6 if test $ac_cv_lib_nsl_gethostbyname = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl" fi if test $ac_cv_lib_nsl_gethostbyname = no; then echo "$as_me:$LINENO: checking for gethostbyname in -lbsd" >&5 echo $ECHO_N "checking for gethostbyname in -lbsd... $ECHO_C" >&6 if test "${ac_cv_lib_bsd_gethostbyname+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lbsd $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char gethostbyname (); int main () { gethostbyname (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_bsd_gethostbyname=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_bsd_gethostbyname=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_bsd_gethostbyname" >&5 echo "${ECHO_T}$ac_cv_lib_bsd_gethostbyname" >&6 if test $ac_cv_lib_bsd_gethostbyname = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -lbsd" fi fi fi # lieder@skyler.mavd.honeywell.com says without -lsocket, # socket/setsockopt and other routines are undefined under SCO ODT # 2.0. But -lsocket is broken on IRIX 5.2 (and is not necessary # on later versions), says Simon Leinen: it contains gethostby* # variants that don't use the name server (or something). -lsocket # must be given before -lnsl if both are needed. We assume that # if connect needs -lnsl, so does gethostbyname. echo "$as_me:$LINENO: checking for connect" >&5 echo $ECHO_N "checking for connect... $ECHO_C" >&6 if test "${ac_cv_func_connect+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define connect to an innocuous variant, in case declares connect. For example, HP-UX 11i declares gettimeofday. */ #define connect innocuous_connect /* System header to define __stub macros and hopefully few prototypes, which can conflict with char connect (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef connect /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char connect (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_connect) || defined (__stub___connect) choke me #else char (*f) () = connect; #endif #ifdef __cplusplus } #endif int main () { return f != connect; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_connect=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_connect=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_connect" >&5 echo "${ECHO_T}$ac_cv_func_connect" >&6 if test $ac_cv_func_connect = no; then echo "$as_me:$LINENO: checking for connect in -lsocket" >&5 echo $ECHO_N "checking for connect in -lsocket... $ECHO_C" >&6 if test "${ac_cv_lib_socket_connect+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsocket $X_EXTRA_LIBS $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char connect (); int main () { connect (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_socket_connect=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_socket_connect=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_socket_connect" >&5 echo "${ECHO_T}$ac_cv_lib_socket_connect" >&6 if test $ac_cv_lib_socket_connect = yes; then X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS" fi fi # Guillermo Gomez says -lposix is necessary on A/UX. echo "$as_me:$LINENO: checking for remove" >&5 echo $ECHO_N "checking for remove... $ECHO_C" >&6 if test "${ac_cv_func_remove+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define remove to an innocuous variant, in case declares remove. For example, HP-UX 11i declares gettimeofday. */ #define remove innocuous_remove /* System header to define __stub macros and hopefully few prototypes, which can conflict with char remove (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef remove /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char remove (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_remove) || defined (__stub___remove) choke me #else char (*f) () = remove; #endif #ifdef __cplusplus } #endif int main () { return f != remove; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_remove=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_remove=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_remove" >&5 echo "${ECHO_T}$ac_cv_func_remove" >&6 if test $ac_cv_func_remove = no; then echo "$as_me:$LINENO: checking for remove in -lposix" >&5 echo $ECHO_N "checking for remove in -lposix... $ECHO_C" >&6 if test "${ac_cv_lib_posix_remove+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lposix $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char remove (); int main () { remove (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_posix_remove=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_posix_remove=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_posix_remove" >&5 echo "${ECHO_T}$ac_cv_lib_posix_remove" >&6 if test $ac_cv_lib_posix_remove = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix" fi fi # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. echo "$as_me:$LINENO: checking for shmat" >&5 echo $ECHO_N "checking for shmat... $ECHO_C" >&6 if test "${ac_cv_func_shmat+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define shmat to an innocuous variant, in case declares shmat. For example, HP-UX 11i declares gettimeofday. */ #define shmat innocuous_shmat /* System header to define __stub macros and hopefully few prototypes, which can conflict with char shmat (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef shmat /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" { #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char shmat (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_shmat) || defined (__stub___shmat) choke me #else char (*f) () = shmat; #endif #ifdef __cplusplus } #endif int main () { return f != shmat; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_shmat=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_shmat=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_func_shmat" >&5 echo "${ECHO_T}$ac_cv_func_shmat" >&6 if test $ac_cv_func_shmat = no; then echo "$as_me:$LINENO: checking for shmat in -lipc" >&5 echo $ECHO_N "checking for shmat in -lipc... $ECHO_C" >&6 if test "${ac_cv_lib_ipc_shmat+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lipc $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char shmat (); int main () { shmat (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_ipc_shmat=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_ipc_shmat=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_ipc_shmat" >&5 echo "${ECHO_T}$ac_cv_lib_ipc_shmat" >&6 if test $ac_cv_lib_ipc_shmat = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc" fi fi fi # Check for libraries that X11R6 Xt/Xaw programs need. ac_save_LDFLAGS=$LDFLAGS test -n "$x_libraries" && LDFLAGS="$LDFLAGS -L$x_libraries" # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to # check for ICE first), but we must link in the order -lSM -lICE or # we get undefined symbols. So assume we have SM if we have ICE. # These have to be linked with before -lX11, unlike the other # libraries we check for below, so use a different variable. # John Interrante, Karl Berry echo "$as_me:$LINENO: checking for IceConnectionNumber in -lICE" >&5 echo $ECHO_N "checking for IceConnectionNumber in -lICE... $ECHO_C" >&6 if test "${ac_cv_lib_ICE_IceConnectionNumber+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lICE $X_EXTRA_LIBS $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char IceConnectionNumber (); int main () { IceConnectionNumber (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_ICE_IceConnectionNumber=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_ICE_IceConnectionNumber=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_ICE_IceConnectionNumber" >&5 echo "${ECHO_T}$ac_cv_lib_ICE_IceConnectionNumber" >&6 if test $ac_cv_lib_ICE_IceConnectionNumber = yes; then X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE" fi LDFLAGS=$ac_save_LDFLAGS fi echo "$as_me:$LINENO: checking for lzo_version in -llzo2" >&5 echo $ECHO_N "checking for lzo_version in -llzo2... $ECHO_C" >&6 if test "${ac_cv_lib_lzo2_lzo_version+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-llzo2 $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char lzo_version (); int main () { lzo_version (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_lzo2_lzo_version=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_lzo2_lzo_version=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_lzo2_lzo_version" >&5 echo "${ECHO_T}$ac_cv_lib_lzo2_lzo_version" >&6 if test $ac_cv_lib_lzo2_lzo_version = yes; then LIBS="$LIBS -llzo2"; LZO_INCLUDE_PREFIX="lzo/"; CXXFLAGS="$CXXFLAGS -DLZO2" else echo "$as_me:$LINENO: checking for lzo_version in -llzo" >&5 echo $ECHO_N "checking for lzo_version in -llzo... $ECHO_C" >&6 if test "${ac_cv_lib_lzo_lzo_version+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-llzo $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char lzo_version (); int main () { lzo_version (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_lzo_lzo_version=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_lzo_lzo_version=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_lzo_lzo_version" >&5 echo "${ECHO_T}$ac_cv_lib_lzo_lzo_version" >&6 if test $ac_cv_lib_lzo_lzo_version = yes; then LIBS="$LIBS -llzo"; LZO_INCLUDE_PREFIX="" else { { echo "$as_me:$LINENO: error: lzo library required: you may need to use the --with-lzo-lib option to specify path to LZO if it is installed in a non-standard directory." >&5 echo "$as_me: error: lzo library required: you may need to use the --with-lzo-lib option to specify path to LZO if it is installed in a non-standard directory." >&2;} { (exit 1); exit 1; }; } fi fi # The LZO installer likes to put headers in /usr/local/include, even on # systems where that is not searched. Try to be nice and detect this case... echo "$as_me:$LINENO: checking for egrep" >&5 echo $ECHO_N "checking for egrep... $ECHO_C" >&6 if test "${ac_cv_prog_egrep+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if echo a | (grep -E '(a|b)') >/dev/null 2>&1 then ac_cv_prog_egrep='grep -E' else ac_cv_prog_egrep='egrep' fi fi echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 echo "${ECHO_T}$ac_cv_prog_egrep" >&6 EGREP=$ac_cv_prog_egrep echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6 if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 _ACEOF fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done as_ac_Header=`echo "ac_cv_header_${LZO_INCLUDE_PREFIX}lzoconf.h" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for ${LZO_INCLUDE_PREFIX}lzoconf.h" >&5 echo $ECHO_N "checking for ${LZO_INCLUDE_PREFIX}lzoconf.h... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking ${LZO_INCLUDE_PREFIX}lzoconf.h usability" >&5 echo $ECHO_N "checking ${LZO_INCLUDE_PREFIX}lzoconf.h usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <${LZO_INCLUDE_PREFIX}lzoconf.h> _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking ${LZO_INCLUDE_PREFIX}lzoconf.h presence" >&5 echo $ECHO_N "checking ${LZO_INCLUDE_PREFIX}lzoconf.h presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include <${LZO_INCLUDE_PREFIX}lzoconf.h> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: ${LZO_INCLUDE_PREFIX}lzoconf.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: ${LZO_INCLUDE_PREFIX}lzoconf.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: ${LZO_INCLUDE_PREFIX}lzoconf.h: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: ${LZO_INCLUDE_PREFIX}lzoconf.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: ${LZO_INCLUDE_PREFIX}lzoconf.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: ${LZO_INCLUDE_PREFIX}lzoconf.h: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: ${LZO_INCLUDE_PREFIX}lzoconf.h: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: ${LZO_INCLUDE_PREFIX}lzoconf.h: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: ${LZO_INCLUDE_PREFIX}lzoconf.h: see the Autoconf documentation" >&5 echo "$as_me: WARNING: ${LZO_INCLUDE_PREFIX}lzoconf.h: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: ${LZO_INCLUDE_PREFIX}lzoconf.h: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: ${LZO_INCLUDE_PREFIX}lzoconf.h: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: ${LZO_INCLUDE_PREFIX}lzoconf.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: ${LZO_INCLUDE_PREFIX}lzoconf.h: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: ${LZO_INCLUDE_PREFIX}lzoconf.h: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: ${LZO_INCLUDE_PREFIX}lzoconf.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------------------ ## ## Report this to the AC_PACKAGE_NAME lists. ## ## ------------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for ${LZO_INCLUDE_PREFIX}lzoconf.h" >&5 echo $ECHO_N "checking for ${LZO_INCLUDE_PREFIX}lzoconf.h... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then : else as_ac_Header=`echo "ac_cv_header_/usr/local/include/${LZO_INCLUDE_PREFIX}lzoconf.h" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then echo "$as_me:$LINENO: checking for /usr/local/include/${LZO_INCLUDE_PREFIX}lzoconf.h" >&5 echo $ECHO_N "checking for /usr/local/include/${LZO_INCLUDE_PREFIX}lzoconf.h... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking /usr/local/include/${LZO_INCLUDE_PREFIX}lzoconf.h usability" >&5 echo $ECHO_N "checking /usr/local/include/${LZO_INCLUDE_PREFIX}lzoconf.h usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking /usr/local/include/${LZO_INCLUDE_PREFIX}lzoconf.h presence" >&5 echo $ECHO_N "checking /usr/local/include/${LZO_INCLUDE_PREFIX}lzoconf.h presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: /usr/local/include/${LZO_INCLUDE_PREFIX}lzoconf.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: /usr/local/include/${LZO_INCLUDE_PREFIX}lzoconf.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: /usr/local/include/${LZO_INCLUDE_PREFIX}lzoconf.h: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: /usr/local/include/${LZO_INCLUDE_PREFIX}lzoconf.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: /usr/local/include/${LZO_INCLUDE_PREFIX}lzoconf.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: /usr/local/include/${LZO_INCLUDE_PREFIX}lzoconf.h: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: /usr/local/include/${LZO_INCLUDE_PREFIX}lzoconf.h: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: /usr/local/include/${LZO_INCLUDE_PREFIX}lzoconf.h: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: /usr/local/include/${LZO_INCLUDE_PREFIX}lzoconf.h: see the Autoconf documentation" >&5 echo "$as_me: WARNING: /usr/local/include/${LZO_INCLUDE_PREFIX}lzoconf.h: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: /usr/local/include/${LZO_INCLUDE_PREFIX}lzoconf.h: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: /usr/local/include/${LZO_INCLUDE_PREFIX}lzoconf.h: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: /usr/local/include/${LZO_INCLUDE_PREFIX}lzoconf.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: /usr/local/include/${LZO_INCLUDE_PREFIX}lzoconf.h: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: /usr/local/include/${LZO_INCLUDE_PREFIX}lzoconf.h: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: /usr/local/include/${LZO_INCLUDE_PREFIX}lzoconf.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------------------ ## ## Report this to the AC_PACKAGE_NAME lists. ## ## ------------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for /usr/local/include/${LZO_INCLUDE_PREFIX}lzoconf.h" >&5 echo $ECHO_N "checking for /usr/local/include/${LZO_INCLUDE_PREFIX}lzoconf.h... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 fi if test `eval echo '${'$as_ac_Header'}'` = yes; then CXXFLAGS="$CXXFLAGS -I/usr/local/include" else { { echo "$as_me:$LINENO: error: lzoconf.h required (part of LZO library)" >&5 echo "$as_me: error: lzoconf.h required (part of LZO library)" >&2;} { (exit 1); exit 1; }; } fi fi echo "$as_me:$LINENO: checking for type of accept's length pointer parameter" >&5 echo $ECHO_N "checking for type of accept's length pointer parameter... $ECHO_C" >&6 if test "${dxpc_cv_accept_length_type+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else dxpc_cv_accept_length_type=no for ac_val in int size_t socklen_t; do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include int main () { struct sockaddr a; $ac_val len; accept (0, &a, &len); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then dxpc_cv_accept_length_type=$ac_val; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done fi echo "$as_me:$LINENO: result: $dxpc_cv_accept_length_type" >&5 echo "${ECHO_T}$dxpc_cv_accept_length_type" >&6 if test $dxpc_cv_accept_length_type != no; then cat >>confdefs.h <<_ACEOF #define ACCEPT_SOCKLEN_T $dxpc_cv_accept_length_type _ACEOF fi # Check to see if we have or . We'd better have one # or the other. if test "${ac_cv_header_iostream+set}" = set; then echo "$as_me:$LINENO: checking for iostream" >&5 echo $ECHO_N "checking for iostream... $ECHO_C" >&6 if test "${ac_cv_header_iostream+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: $ac_cv_header_iostream" >&5 echo "${ECHO_T}$ac_cv_header_iostream" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking iostream usability" >&5 echo $ECHO_N "checking iostream usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking iostream presence" >&5 echo $ECHO_N "checking iostream presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: iostream: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: iostream: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: iostream: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: iostream: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: iostream: present but cannot be compiled" >&5 echo "$as_me: WARNING: iostream: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: iostream: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: iostream: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: iostream: see the Autoconf documentation" >&5 echo "$as_me: WARNING: iostream: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: iostream: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: iostream: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: iostream: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: iostream: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: iostream: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: iostream: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------------------ ## ## Report this to the AC_PACKAGE_NAME lists. ## ## ------------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for iostream" >&5 echo $ECHO_N "checking for iostream... $ECHO_C" >&6 if test "${ac_cv_header_iostream+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_iostream=$ac_header_preproc fi echo "$as_me:$LINENO: result: $ac_cv_header_iostream" >&5 echo "${ECHO_T}$ac_cv_header_iostream" >&6 fi if test $ac_cv_header_iostream = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_IOSTREAM 1 _ACEOF else if test "${ac_cv_header_iostream_h+set}" = set; then echo "$as_me:$LINENO: checking for iostream.h" >&5 echo $ECHO_N "checking for iostream.h... $ECHO_C" >&6 if test "${ac_cv_header_iostream_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi echo "$as_me:$LINENO: result: $ac_cv_header_iostream_h" >&5 echo "${ECHO_T}$ac_cv_header_iostream_h" >&6 else # Is the header compilable? echo "$as_me:$LINENO: checking iostream.h usability" >&5 echo $ECHO_N "checking iostream.h usability... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6 # Is the header present? echo "$as_me:$LINENO: checking iostream.h presence" >&5 echo $ECHO_N "checking iostream.h presence... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6 # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: iostream.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: iostream.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: iostream.h: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: iostream.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: iostream.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: iostream.h: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: iostream.h: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: iostream.h: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: iostream.h: see the Autoconf documentation" >&5 echo "$as_me: WARNING: iostream.h: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: iostream.h: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: iostream.h: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: iostream.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: iostream.h: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: iostream.h: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: iostream.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ------------------------------------------ ## ## Report this to the AC_PACKAGE_NAME lists. ## ## ------------------------------------------ ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac echo "$as_me:$LINENO: checking for iostream.h" >&5 echo $ECHO_N "checking for iostream.h... $ECHO_C" >&6 if test "${ac_cv_header_iostream_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_iostream_h=$ac_header_preproc fi echo "$as_me:$LINENO: result: $ac_cv_header_iostream_h" >&5 echo "${ECHO_T}$ac_cv_header_iostream_h" >&6 fi if test $ac_cv_header_iostream_h = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_IOSTREAM_H 1 _ACEOF else { { echo "$as_me:$LINENO: error: Cannot find iostream or iostream.h" >&5 echo "$as_me: error: Cannot find iostream or iostream.h" >&2;} { (exit 1); exit 1; }; } fi fi cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. { (set) 2>&1 | case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } | sed ' t clear : clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ : end' >>confcache if diff $cache_file confcache >/dev/null 2>&1; then :; else if test -w $cache_file; then test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" cat confcache >$cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/; s/:*\${srcdir}:*/:/; s/:*@srcdir@:*/:/; s/^\([^=]*=[ ]*\):*/\1/; s/:*$//; s/^[^=]*=[ ]*$//; }' fi DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_i=`echo "$ac_i" | sed 's/\$U\././;s/\.o$//;s/\.obj$//'` # 2. Add them. ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH exec 6>&1 # Open the log real soon, to keep \$[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. Logging --version etc. is OK. exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX } >&5 cat >&5 <<_CSEOF This file was extended by $as_me, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ _CSEOF echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 echo >&5 _ACEOF # Files that config.status was made for. if test -n "$ac_config_files"; then echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS fi if test -n "$ac_config_headers"; then echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS fi if test -n "$ac_config_links"; then echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS fi if test -n "$ac_config_commands"; then echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS fi cat >>$CONFIG_STATUS <<\_ACEOF ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ config.status configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2003 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." srcdir=$srcdir INSTALL="$INSTALL" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If no file are specified by the user, then we need to provide default # value. By we need to know if files were specified by the user. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "x$1" : 'x\([^=]*\)='` ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` ac_shift=: ;; -*) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; *) # This is not an option, so the user has probably given explicit # arguments. ac_option=$1 ac_need_defaults=false;; esac case $ac_option in # Handling of the options. _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --vers* | -V ) echo "$ac_cs_version"; exit 0 ;; --he | --h) # Conflict between --help and --header { { echo "$as_me:$LINENO: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; };; --help | --hel | -h ) echo "$ac_cs_usage"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" ac_need_defaults=false;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_config_target in $ac_config_targets do case "$ac_config_target" in # Handling of arguments. "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; "dxpcconf.h" ) CONFIG_HEADERS="$CONFIG_HEADERS dxpcconf.h" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason to put it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Create a temporary directory, and hook for its removal unless debugging. $debug || { trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./confstat$$-$RANDOM (umask 077 && mkdir $tmp) } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # CONFIG_FILES section. # # No need to generate the scripts if there are no CONFIG_FILES. # This happens for instance when ./config.status config.h if test -n "\$CONFIG_FILES"; then # Protect against being on the right side of a sed subst in config.status. sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF s,@SHELL@,$SHELL,;t t s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t s,@exec_prefix@,$exec_prefix,;t t s,@prefix@,$prefix,;t t s,@program_transform_name@,$program_transform_name,;t t s,@bindir@,$bindir,;t t s,@sbindir@,$sbindir,;t t s,@libexecdir@,$libexecdir,;t t s,@datadir@,$datadir,;t t s,@sysconfdir@,$sysconfdir,;t t s,@sharedstatedir@,$sharedstatedir,;t t s,@localstatedir@,$localstatedir,;t t s,@libdir@,$libdir,;t t s,@includedir@,$includedir,;t t s,@oldincludedir@,$oldincludedir,;t t s,@infodir@,$infodir,;t t s,@mandir@,$mandir,;t t s,@build_alias@,$build_alias,;t t s,@host_alias@,$host_alias,;t t s,@target_alias@,$target_alias,;t t s,@DEFS@,$DEFS,;t t s,@ECHO_C@,$ECHO_C,;t t s,@ECHO_N@,$ECHO_N,;t t s,@ECHO_T@,$ECHO_T,;t t s,@LIBS@,$LIBS,;t t s,@CXX@,$CXX,;t t s,@CXXFLAGS@,$CXXFLAGS,;t t s,@LDFLAGS@,$LDFLAGS,;t t s,@CPPFLAGS@,$CPPFLAGS,;t t s,@ac_ct_CXX@,$ac_ct_CXX,;t t s,@EXEEXT@,$EXEEXT,;t t s,@OBJEXT@,$OBJEXT,;t t s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t s,@INSTALL_DATA@,$INSTALL_DATA,;t t s,@build@,$build,;t t s,@build_cpu@,$build_cpu,;t t s,@build_vendor@,$build_vendor,;t t s,@build_os@,$build_os,;t t s,@host@,$host,;t t s,@host_cpu@,$host_cpu,;t t s,@host_vendor@,$host_vendor,;t t s,@host_os@,$host_os,;t t s,@MINGW32@,$MINGW32,;t t s,@CXXCPP@,$CXXCPP,;t t s,@X_CFLAGS@,$X_CFLAGS,;t t s,@X_PRE_LIBS@,$X_PRE_LIBS,;t t s,@X_LIBS@,$X_LIBS,;t t s,@X_EXTRA_LIBS@,$X_EXTRA_LIBS,;t t s,@EGREP@,$EGREP,;t t s,@LIBOBJS@,$LIBOBJS,;t t s,@LTLIBOBJS@,$LTLIBOBJS,;t t CEOF _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Split the substitutions into bite-sized pieces for seds with # small command number limits, like on Digital OSF/1 and HP-UX. ac_max_sed_lines=48 ac_sed_frag=1 # Number of current file. ac_beg=1 # First line for current file. ac_end=$ac_max_sed_lines # Line after last line for current file. ac_more_lines=: ac_sed_cmds= while $ac_more_lines; do if test $ac_beg -gt 1; then sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag else sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag fi if test ! -s $tmp/subs.frag; then ac_more_lines=false else # The purpose of the label and of the branching condition is to # speed up the sed processing (if there are no `@' at all, there # is no need to browse any of the substitutions). # These are the two extra sed commands mentioned above. (echo ':t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed if test -z "$ac_sed_cmds"; then ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" else ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" fi ac_sed_frag=`expr $ac_sed_frag + 1` ac_beg=$ac_end ac_end=`expr $ac_end + $ac_max_sed_lines` fi done if test -z "$ac_sed_cmds"; then ac_sed_cmds=cat fi fi # test -n "$CONFIG_FILES" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_builddir$INSTALL ;; esac if test x"$ac_file" != x-; then { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" fi # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ if test x"$ac_file" = x-; then configure_input= else configure_input="$ac_file. " fi configure_input=$configure_input"Generated from `echo $ac_file_in | sed 's,.*/,,'` by configure." # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo "$f";; *) # Relative if test -f "$f"; then # Build tree echo "$f" elif test -f "$srcdir/$f"; then # Source tree echo "$srcdir/$f" else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF sed "$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s,@configure_input@,$configure_input,;t t s,@srcdir@,$ac_srcdir,;t t s,@abs_srcdir@,$ac_abs_srcdir,;t t s,@top_srcdir@,$ac_top_srcdir,;t t s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t s,@builddir@,$ac_builddir,;t t s,@abs_builddir@,$ac_abs_builddir,;t t s,@top_builddir@,$ac_top_builddir,;t t s,@abs_top_builddir@,$ac_abs_top_builddir,;t t s,@INSTALL@,$ac_INSTALL,;t t " $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out rm -f $tmp/stdin if test x"$ac_file" != x-; then mv $tmp/out $ac_file else cat $tmp/out rm -f $tmp/out fi done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # # CONFIG_HEADER section. # # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where # NAME is the cpp macro being defined and VALUE is the value it is being given. # # ac_d sets the value in "#define NAME VALUE" lines. ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' ac_dB='[ ].*$,\1#\2' ac_dC=' ' ac_dD=',;t' # ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_uB='$,\1#\2define\3' ac_uC=' ' ac_uD=',;t' for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } # Do quote $f, to prevent DOS paths from being IFS'd. echo "$f";; *) # Relative if test -f "$f"; then # Build tree echo "$f" elif test -f "$srcdir/$f"; then # Source tree echo "$srcdir/$f" else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } # Remove the trailing spaces. sed 's/[ ]*$//' $ac_file_inputs >$tmp/in _ACEOF # Transform confdefs.h into two sed scripts, `conftest.defines' and # `conftest.undefs', that substitutes the proper values into # config.h.in to produce config.h. The first handles `#define' # templates, and the second `#undef' templates. # And first: Protect against being on the right side of a sed subst in # config.status. Protect against being in an unquoted here document # in config.status. rm -f conftest.defines conftest.undefs # Using a here document instead of a string reduces the quoting nightmare. # Putting comments in sed scripts is not portable. # # `end' is used to avoid that the second main sed command (meant for # 0-ary CPP macros) applies to n-ary macro definitions. # See the Autoconf documentation for `clear'. cat >confdef2sed.sed <<\_ACEOF s/[\\&,]/\\&/g s,[\\$`],\\&,g t clear : clear s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp t end s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp : end _ACEOF # If some macros were called several times there might be several times # the same #defines, which is useless. Nevertheless, we may not want to # sort them, since we want the *last* AC-DEFINE to be honored. uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs rm -f confdef2sed.sed # This sed command replaces #undef with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. cat >>conftest.undefs <<\_ACEOF s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, _ACEOF # Break up conftest.defines because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS echo ' :' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.defines >/dev/null do # Write a limited-size here document to $tmp/defines.sed. echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#define' lines. echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/defines.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail rm -f conftest.defines mv conftest.tail conftest.defines done rm -f conftest.defines echo ' fi # grep' >>$CONFIG_STATUS echo >>$CONFIG_STATUS # Break up conftest.undefs because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #undef templates' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.undefs >/dev/null do # Write a limited-size here document to $tmp/undefs.sed. echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#undef' echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/undefs.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail rm -f conftest.undefs mv conftest.tail conftest.undefs done rm -f conftest.undefs cat >>$CONFIG_STATUS <<\_ACEOF # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ if test x"$ac_file" = x-; then echo "/* Generated by configure. */" >$tmp/config.h else echo "/* $ac_file. Generated by configure. */" >$tmp/config.h fi cat $tmp/in >>$tmp/config.h rm -f $tmp/in if test x"$ac_file" != x-; then if diff $ac_file $tmp/config.h >/dev/null 2>&1; then { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } rm -f $ac_file mv $tmp/config.h $ac_file fi else cat $tmp/config.h rm -f $tmp/config.h fi done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF { (exit 0); exit 0; } _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi dxpc-3.9.2/ClientMultiplexer.C0000644000175000017530000000300210560644754015635 0ustar kvigorkvigor#include "dxpcconf.h" #include "ClientMultiplexer.H" #include "ClientChannel.H" #include "util.H" ClientMultiplexer::ClientMultiplexer(int proxyFD, int statisticsLevel): Multiplexer(proxyFD), statisticsLevel_(statisticsLevel) { for (unsigned i = 0; i < MAX_CONNECTIONS; i++) { _channelMap[i] = -1; } } void ClientMultiplexer::createNewConnection(int clientFD) { int channelNum = -1; for (unsigned i = 0; i < MAX_CONNECTIONS; i++) { if (_channelMap[i] == -1) { _channelMap[i] = clientFD; channelNum = i; break; } } channels_[channelNum] = new ClientChannel(clientFD, statisticsLevel_); unsigned char message[3]; message[0] = 0; message[1] = (unsigned char) CTRL_NEW_CONNECTION; message[2] = channelNum; WriteAll(proxyFD_, message, 3); } int ClientMultiplexer::createNewConnectionFromProxy(int) { CERR << "Internal error: in ClientMultiplexer::createNewConnectionFromProxy" << ENDL; return 0; } int ClientMultiplexer::channelIDToFD(int channelID) const { return _channelMap[channelID]; } int ClientMultiplexer::fdToChannelID(int fd) const { for (unsigned i = 0; i < MAX_CONNECTIONS; i++) { if (_channelMap[i] == fd) { return i; } } return -1; } void ClientMultiplexer::cleanupChannelFDMapping(int channelNum) { _channelMap[channelNum] = -1; } dxpc-3.9.2/ClientMultiplexer.H0000644000175000017530000000117410560644754015652 0ustar kvigorkvigor#ifndef ClientMultiplexer_H # define ClientMultiplexer_H # include "Multiplexer.H" class ClientMultiplexer:public Multiplexer { public: ClientMultiplexer(int proxyFD, int statisticsLevel); virtual ~ ClientMultiplexer() { } protected: virtual void createNewConnection(int fd); virtual int createNewConnectionFromProxy(int channelID); virtual int channelIDToFD(int channelID) const; virtual int fdToChannelID(int fd) const; virtual void cleanupChannelFDMapping(int channelFD); unsigned int statisticsLevel_; int _channelMap[MAX_CONNECTIONS]; }; #endif /* ClientMultiplexer_H */ dxpc-3.9.2/SequenceNumQueue.C0000644000175000017530000000504210560644754015427 0ustar kvigorkvigor#include "SequenceNumQueue.H" static const unsigned int INITIALSIZE_ = 16; static const unsigned int GROWTH_INCREMENT = 16; SequenceNumQueue::SequenceNumQueue(): queue_(new RequestSequenceNum[INITIALSIZE_]), size_(INITIALSIZE_), length_(0), startIndex_(0), endIndex_(0) { } SequenceNumQueue::~SequenceNumQueue() { delete[]queue_; } void SequenceNumQueue::push(unsigned short int sequenceNum, unsigned char opcode, unsigned int data1, unsigned int data2, unsigned int data3) { if (length_ == 0) { startIndex_ = endIndex_ = 0; queue_[0].sequenceNum = sequenceNum; queue_[0].requestOpcode = opcode; queue_[0].data1 = data1; queue_[0].data2 = data2; queue_[0].data3 = data3; length_ = 1; return; } if (length_ == size_) { size_ += GROWTH_INCREMENT; RequestSequenceNum *newQueue = new RequestSequenceNum[size_]; for (int i = startIndex_; (unsigned int) i < length_; i++) newQueue[i - startIndex_] = queue_[i]; for (int i1 = 0; (unsigned int) i1 < startIndex_; i1++) newQueue[i1 + length_ - startIndex_] = queue_[i1]; delete[]queue_; queue_ = newQueue; startIndex_ = 0; endIndex_ = length_ - 1; } endIndex_++; if (endIndex_ == size_) endIndex_ = 0; queue_[endIndex_].sequenceNum = sequenceNum; queue_[endIndex_].requestOpcode = opcode; queue_[endIndex_].data1 = data1; queue_[endIndex_].data2 = data2; queue_[endIndex_].data3 = data3; length_++; } int SequenceNumQueue::peek(unsigned short int &sequenceNum, unsigned char &requestOpcode) { if (length_ == 0) return 0; else { sequenceNum = queue_[startIndex_].sequenceNum; requestOpcode = queue_[startIndex_].requestOpcode; return 1; } } int SequenceNumQueue::pop(unsigned short int &sequenceNum, unsigned char &requestOpcode, unsigned int &data1, unsigned int &data2, unsigned int &data3) { if (length_ == 0) return 0; else { sequenceNum = queue_[startIndex_].sequenceNum; requestOpcode = queue_[startIndex_].requestOpcode; data1 = queue_[startIndex_].data1; data2 = queue_[startIndex_].data2; data3 = queue_[startIndex_].data3; startIndex_++; if (startIndex_ == size_) startIndex_ = 0; length_--; return 1; } } dxpc-3.9.2/SequenceNumQueue.H0000644000175000017530000000230010560644754015426 0ustar kvigorkvigor#ifndef SequenceNumQueue_H # define SequenceNumQueue_H // List of outstanding request messages, used to correlate request // sequence numbers to their message types class SequenceNumQueue { public: SequenceNumQueue(); virtual ~ SequenceNumQueue(); void push(unsigned short int sequenceNum, unsigned char requestOpcode, unsigned int data1 = 0, unsigned int data2 = 0, unsigned int data3 = 0); int peek(unsigned short int &sequenceNum, unsigned char &requestOpcode); int pop(unsigned short int &sequenceNum, unsigned char &requestOpcode, unsigned int &data1, unsigned int &data2, unsigned int &data3); int pop(unsigned short int &sequenceNum, unsigned char &requestOpcode) { unsigned int data1, data2, data3; return pop(sequenceNum, requestOpcode, data1, data2, data3); } private: struct RequestSequenceNum { unsigned short int sequenceNum; unsigned char requestOpcode; unsigned int data1, data2, data3; }; RequestSequenceNum *queue_; unsigned int size_; unsigned int length_; unsigned int startIndex_; unsigned int endIndex_; }; #endif /* SequenceNumQueue_H */ dxpc-3.9.2/dxpcssh0000755000175000017530000000563610560644754013501 0ustar kvigorkvigor#!/bin/bash # # dxpcssh - dxpc over SSH2 # Wicher Minnaard # August 23 '05 # # Sets up an xclient <--> dxpc <--> sshtunnel <--> dxpc <--> xserver (you!) # construction. Assumes you have set up passwordless SSH logins. Does not # require the OpenSSH X11 forwarding option. # Sets up _new_ ~/.Xauthority files on server and client, so backup the old ones # if you really like 'em. # Also, it requires you to have a script called xauthcp in $PATH on the remote # host. xauthcp was written by Bruce Mah and modified for # sh-shells by Dirk Eddelbüttel . # Thanks for the hints! # xauth is listed below. If anyone thinks of a way to do the xauthcp-stuff # from inside this script, please implement it (and drop me a line). if [ $# -ne 3 ] then echo "Usage: $0 remote-host remote-SSHD-port (buildup | teardown)" exit -1 fi REMOTEHOST=$1 REMOTESSHDPORT=$2 DISPLAYNUMBER=$((`ssh -p $REMOTESSHDPORT $REMOTEHOST id -u` - 1000)) DXPCPORT=$((4000+$DISPLAYNUMBER)) rm ~/.Xauthority &>/dev/null ssh -p $REMOTESSHDPORT $REMOTEHOST rm ~/.Xauthority &>/dev/null mcookie | sed -e 's/^/add :0 . /' | xauth -q &>/dev/null LOCALDISPLAY=`xauth list | cut -d " " -f 1` if [ $3 = buildup ] then xauth nextract - $LOCALDISPLAY | ssh -p $REMOTESSHDPORT $REMOTEHOST /usr/bin/X11/xauth nmerge - &>/dev/null ssh -p $REMOTESSHDPORT $REMOTEHOST xauthcp $LOCALDISPLAY $REMOTEHOST:/unix:$DISPLAYNUMBER ssh -p $REMOTESSHDPORT $REMOTEHOST xauthcp $LOCALDISPLAY $REMOTEHOST:$DISPLAYNUMBER ssh -p $REMOTESSHDPORT $REMOTEHOST dxpc -k &>/dev/null ssh -f -p $REMOTESSHDPORT $REMOTEHOST DISPLAY="$LOCALDISPLAY" dxpc -p $DXPCPORT -f -d $DISPLAYNUMBER sleep 5 ssh -N -f -p $REMOTESSHDPORT -g -L $DXPCPORT:$REMOTEHOST:$DXPCPORT $REMOTEHOST dxpc -k &>/dev/null dxpc -p $DXPCPORT -f -ba localhost echo "Done. Start programs by issuing:" echo "ssh -f -p $REMOTESSHDPORT $REMOTEHOST DISPLAY=\"$REMOTEHOST:$DISPLAYNUMBER\" _your_program_" fi if [ $3 = teardown ] then fuser -k $DXPCPORT/tcp &>/dev/null ssh -p $REMOTESSHDPORT $REMOTEHOST dxpc -k &>/dev/null ssh -p $REMOTESSHDPORT $REMOTEHOST killall dxpc &>/dev/null dxpc -k &>/dev/null killall dxpc &>/dev/null echo "Teared down the tunnel." fi ##!/bin/sh ## ## xauthcp ## Bruce A. Mah ## ## 12 Jul 96edd@qed.econ.queensu.ca Rewritten as a (ba)sh script ## ## Copy xauth keys used to access one display to another. This ability ## is primarily useful when using a proxy X server. In such a situation, ## client processes need to access the proxy using the xauth keys of the ## real server (assuming the proxy takes no explicit actions to deal ## with xauth keys). # #if [ $# -ne 2 ] #then #echo $0 source-display dest-display #exit -1 #fi # #src=$1 #dst=$2 #tmpfile=/tmp/xauthcp.$$ # #rm -f $tmpfile #xauth list $src | \ #awk -v dst=$dst '{ print "xauth add", dst, $2, $3, "; "}' > $tmpfile #source $tmpfile #rm -f $tmpfile dxpc-3.9.2/configure.in0000644000175000017530000000546310560644754014406 0ustar kvigorkvigordnl Process this file with autoconf to produce a configure script. dnl Prolog AC_INIT(main.C) AC_PREREQ(2.54) AC_CONFIG_HEADERS(dxpcconf.h) AC_CONFIG_FILES(Makefile) dnl Allow user to specify the location of the LZO library AC_ARG_WITH(lzo-lib, [ --with-lzo-lib=DIR specify location of LZO library ], [CXXFLAGS="$CXXFLAGS -I$withval/include" CPPFLAGS="$CPPFLAGS -I$withval/include" LDFLAGS="$LDFLAGS -L$withval/lib -R$withval/lib"]) dnl Checks for programs. AC_PROG_CXX AC_LANG_CPLUSPLUS AC_PROG_INSTALL dnl MingW hackery: we need the winsock library, and dnl for some reason the compiler detection macro of doom dnl doesn't set -O2 on MingW. AC_CANONICAL_HOST HOST=$host_os dnl hack: if we are using a Mingw cross-compiler, we pretend the host is dnl mingw. $CC -v 2>&1 | grep -q -e mingw-special if test "$?" -eq "0"; then HOST=mingw fi case $HOST in *mingw* ) LIBS="$LIBS -lwsock32";CXXFLAGS="$CXXFLAGS -O2";MINGW32="true";; * ) MINGW32="false";; esac AC_SUBST(MINGW32) dnl Checks for header files. AC_PATH_XTRA dnl The version 2 LZO library puts its include files in a path prefixed with dnl lzo/ just for added convienience. AC_CHECK_LIB(lzo2, lzo_version, [LIBS="$LIBS -llzo2"; LZO_INCLUDE_PREFIX="lzo/"; CXXFLAGS="$CXXFLAGS -DLZO2"], [AC_CHECK_LIB(lzo, lzo_version, [LIBS="$LIBS -llzo"; LZO_INCLUDE_PREFIX=""], AC_MSG_ERROR( [lzo library required: you may need to use the --with-lzo-lib option to specify path to LZO if it is installed in a non-standard directory.]))]) # The LZO installer likes to put headers in /usr/local/include, even on # systems where that is not searched. Try to be nice and detect this case... AC_CHECK_HEADER(${LZO_INCLUDE_PREFIX}lzoconf.h, , [AC_CHECK_HEADER(/usr/local/include/${LZO_INCLUDE_PREFIX}lzoconf.h, [CXXFLAGS="$CXXFLAGS -I/usr/local/include"], AC_MSG_ERROR([lzoconf.h required (part of LZO library)]))]) AC_DEFUN(dxpc_ACCEPT_LENGTH_T, [AC_CACHE_CHECK([for type of accept's length pointer parameter], dxpc_cv_accept_length_type, [dxpc_cv_accept_length_type=no for ac_val in int size_t socklen_t; do AC_TRY_COMPILE([#include #include ], [struct sockaddr a; $ac_val len; accept (0, &a, &len);], [dxpc_cv_accept_length_type=$ac_val; break]) done]) if test $dxpc_cv_accept_length_type != no; then AC_DEFINE_UNQUOTED(ACCEPT_SOCKLEN_T, $dxpc_cv_accept_length_type, [Define to be the type of accept's length parameter (without the \*').]) fi ] ) dxpc_ACCEPT_LENGTH_T # Check to see if we have or . We'd better have one # or the other. AC_CHECK_HEADER(iostream, AC_DEFINE(HAVE_IOSTREAM), [AC_CHECK_HEADER(iostream.h, AC_DEFINE(HAVE_IOSTREAM_H), AC_MSG_ERROR([Cannot find iostream or iostream.h]))]) AC_OUTPUT dxpc-3.9.2/ServerChannel.C0000644000175000017530000047530210560644754014743 0ustar kvigorkvigor#include "dxpcconf.h" #include #include "X-headers.H" #include "ServerChannel.H" #include "EncodeBuffer.H" #include "DecodeBuffer.H" #include "util.H" ServerChannel::ServerChannel(int xServerFD, unsigned int statisticsLevel) : readBuffer_(xServerFD, this), fd_(xServerFD), firstRequest_(1), firstReply_(1), statisticsLevel_(statisticsLevel) { if (compressImages) { decompresser = new Decompresser(compressImages); } else { decompresser = 0; } } ServerChannel::~ServerChannel() { if (statisticsLevel_ > 0) { *logofs << "\n*** dxpc Server-side Compression Statistics ***\n"; unsigned int replyBitsIn, replyBitsOut; if (statisticsLevel_ >= 2) { *logofs << "\nCompression of replies by request message type:\n"; } replyStats_.summarize(replyBitsIn, replyBitsOut, (statisticsLevel_ >= 2)); if (statisticsLevel_ >= 2) { *logofs << "\nCompression of events and errors by message type:\n"; } unsigned int bitsIn, bitsOut; stats_.summarize(bitsIn, bitsOut, (statisticsLevel_ >= 2)); if (statisticsLevel_ >= 2) { *logofs << '\n' << framingBitsOut_ << " bits used for dxpc message framing and multiplexing\n"; } unsigned int totalBitsIn = bitsIn + replyBitsIn; unsigned int totalBitsOut = bitsOut + replyBitsOut + framingBitsOut_; *logofs << "\nOverall compression:" << ENDL << " " << totalBitsIn << " bits compressed to " << totalBitsOut << ENDL; if (totalBitsOut > 0) { *logofs << " (" << (float) totalBitsIn / (float) totalBitsOut << ":1 compression ratio)" << ENDL << ENDL; } } if (decompresser) { delete decompresser; decompresser = 0; } } int ServerChannel::doRead(EncodeBuffer & encodeBuffer) { if (!readBuffer_.doRead()) return 0; const unsigned char *buffer; unsigned int size; while ((buffer = readBuffer_.getMessage(size)) != 0) { if (firstReply_) { imageByteOrder_ = buffer[30]; bitmapBitOrder_ = buffer[31]; scanlineUnit_ = buffer[32]; scanlinePad_ = buffer[33]; firstReply_ = 0; encodeBuffer.encodeValue((unsigned int) buffer[0], 8); encodeBuffer.encodeValue((unsigned int) buffer[1], 8); encodeBuffer.encodeValue(GetUINT(buffer + 2, bigEndian_), 16); encodeBuffer.encodeValue(GetUINT(buffer + 4, bigEndian_), 16); encodeBuffer.encodeValue(GetUINT(buffer + 6, bigEndian_), 16); if (ServerCache::lastInitReply.compare(size - 8, buffer + 8)) encodeBuffer.encodeValue(1, 1); else { encodeBuffer.encodeValue(0, 1); for (unsigned int i = 8; i < size; i++) encodeBuffer.encodeValue((unsigned int) buffer[i], 8); } } else { if (buffer[0] == 1) { // reply unsigned int sequenceNum = GetUINT(buffer + 2, bigEndian_); unsigned int sequenceNumDiff = sequenceNum - serverCache_.lastSequenceNum; serverCache_.lastSequenceNum = sequenceNum; unsigned char opcode = *buffer; encodeBuffer.encodeCachedValue(opcode, 8, serverCache_. opcodeCache[serverCache_. lastOpcode]); serverCache_.lastOpcode = opcode; encodeBuffer.encodeCachedValue(sequenceNumDiff, 16, serverCache_. replySequenceNumCache, 7); unsigned short int nextSequenceNum; unsigned int requestOpcode = 256; unsigned char nextOpcode; if (sequenceNumQueue_.peek(nextSequenceNum, nextOpcode) && (nextSequenceNum == sequenceNum)) { // we've found the request that generated this reply, so it's // possible to compress the reply based on the request type unsigned int requestData[3]; sequenceNumQueue_.pop(nextSequenceNum, nextOpcode, requestData[0], requestData[1], requestData[2]); requestOpcode = nextOpcode; switch (nextOpcode) { case X_AllocColor: { const unsigned char *nextSrc = buffer + 8; for (unsigned int i = 0; i < 3; i++) { unsigned int colorValue = GetUINT(nextSrc, bigEndian_); nextSrc += 2; if (colorValue == requestData[i]) encodeBuffer.encodeValue(1, 1); else { encodeBuffer.encodeValue(0, 1); encodeBuffer.encodeValue(colorValue - colorValue, 16, 6); } } unsigned int pixel = GetULONG(buffer + 16, bigEndian_); encodeBuffer.encodeValue(pixel, 32, 9); } break; case X_GetAtomName: { unsigned int nameLength = GetUINT(buffer + 8, bigEndian_); encodeBuffer.encodeValue(nameLength, 16, 6); const unsigned char *nextSrc = buffer + 32; clientCache_.internAtomTextCompressor.reset(); for (unsigned int i = 0; i < nameLength; i++) clientCache_.internAtomTextCompressor. encodeChar(*nextSrc++, encodeBuffer); } break; case X_GetGeometry: { encodeBuffer.encodeCachedValue(buffer[1], 8, serverCache_. depthCache); encodeBuffer. encodeCachedValue(GetULONG (buffer + 8, bigEndian_), 29, serverCache_. getGeometryRootCache, 9); const unsigned char *nextSrc = buffer + 12; for (unsigned int i = 0; i < 5; i++) { encodeBuffer. encodeCachedValue(GetUINT (nextSrc, bigEndian_), 16, *serverCache_. getGeometryGeomCache[i], 8); nextSrc += 2; } } break; case X_GetInputFocus: { encodeBuffer.encodeValue((unsigned int) buffer[1], 2); encodeBuffer. encodeCachedValue(GetULONG (buffer + 8, bigEndian_), 29, serverCache_. getInputFocusWindowCache, 9); } break; case X_GetKeyboardMapping: { unsigned int keysymsPerKeycode = (unsigned int) buffer[1]; if (ServerCache::getKeyboardMappingLastMap. compare(size - 32, buffer + 32) && (keysymsPerKeycode == ServerCache:: getKeyboardMappingLastKeysymsPerKeycode)) { encodeBuffer.encodeValue(1, 1); break; } ServerCache:: getKeyboardMappingLastKeysymsPerKeycode = keysymsPerKeycode; encodeBuffer.encodeValue(0, 1); unsigned int numKeycodes = (((size - 32) / keysymsPerKeycode) >> 2); encodeBuffer.encodeValue(numKeycodes, 8); encodeBuffer.encodeValue(keysymsPerKeycode, 8, 4); const unsigned char *nextSrc = buffer + 32; unsigned char previous = 0; for (unsigned int count = numKeycodes * keysymsPerKeycode; count; --count) { unsigned int keysym = GetULONG(nextSrc, bigEndian_); nextSrc += 4; if (keysym == NoSymbol) encodeBuffer.encodeValue(1, 1); else { encodeBuffer.encodeValue(0, 1); unsigned int first3Bytes = (keysym >> 8); encodeBuffer. encodeCachedValue(first3Bytes, 24, serverCache_. getKeyboardMappingKeysymCache, 9); unsigned char lastByte = (unsigned char) (keysym & 0xff); encodeBuffer.encodeCachedValue(lastByte - previous, 8, serverCache_. getKeyboardMappingLastByteCache, 5); previous = lastByte; } } } break; case X_GetModifierMapping: { encodeBuffer.encodeValue((unsigned int) buffer[1], 8); const unsigned char *nextDest = buffer + 32; if (ServerCache::getModifierMappingLastMap. compare(size - 32, nextDest)) { encodeBuffer.encodeValue(1, 1); break; } encodeBuffer.encodeValue(0, 1); for (unsigned int count = size - 32; count; count--) { unsigned char next = *nextDest++; if (next == 0) encodeBuffer.encodeValue(1, 1); else { encodeBuffer.encodeValue(0, 1); encodeBuffer.encodeValue(next, 8); } } } break; case X_GetProperty: { unsigned char format = (unsigned int) buffer[1]; encodeBuffer.encodeCachedValue(format, 8, serverCache_. getPropertyFormatCache); unsigned int numBytes = GetULONG(buffer + 16, bigEndian_); encodeBuffer.encodeValue(numBytes, 32, 9); if (format == 16) numBytes <<= 1; else if (format == 32) numBytes <<= 2; encodeBuffer. encodeCachedValue(GetULONG (buffer + 8, bigEndian_), 29, serverCache_. getPropertyTypeCache, 9); encodeBuffer. encodeValue(GetULONG(buffer + 12, bigEndian_), 32, 9); const unsigned char *nextSrc = buffer + 32; if (format == 8) { if (requestData[0] == XA_RESOURCE_MANAGER) { if (ServerCache::xResources. compare(numBytes, buffer + 32)) { encodeBuffer.encodeValue(1, 1); break; } encodeBuffer.encodeValue(0, 1); } serverCache_.getPropertyTextCompressor. reset(); for (unsigned int i = 0; i < numBytes; i++) { unsigned char nextChar; serverCache_.getPropertyTextCompressor. encodeChar(nextChar = *nextSrc++, encodeBuffer); if (nextChar == 10) { serverCache_. getPropertyTextCompressor. reset(nextChar); } } } else { for (unsigned int i = 0; i < numBytes; i++) encodeBuffer. encodeValue((unsigned int) *nextSrc++, 8); } } break; case X_GetSelectionOwner: { encodeBuffer. encodeCachedValue(GetULONG (buffer + 8, bigEndian_), 29, serverCache_. getSelectionOwnerCache, 9); } break; case X_GetWindowAttributes: { encodeBuffer.encodeValue((unsigned int) buffer[1], 2); encodeBuffer. encodeCachedValue(GetULONG (buffer + 8, bigEndian_), 29, serverCache_.visualCache, 9); encodeBuffer. encodeCachedValue(GetUINT (buffer + 12, bigEndian_), 16, serverCache_. getWindowAttributesClassCache, 3); encodeBuffer.encodeCachedValue(buffer[14], 8, serverCache_. getWindowAttributesBitGravityCache); encodeBuffer.encodeCachedValue(buffer[15], 8, serverCache_. getWindowAttributesWinGravityCache); encodeBuffer. encodeCachedValue(GetULONG (buffer + 16, bigEndian_), 32, serverCache_. getWindowAttributesPlanesCache, 9); encodeBuffer. encodeCachedValue(GetULONG (buffer + 20, bigEndian_), 32, serverCache_. getWindowAttributesPixelCache, 9); encodeBuffer. encodeValue((unsigned int) buffer[24], 1); encodeBuffer. encodeValue((unsigned int) buffer[25], 1); encodeBuffer. encodeValue((unsigned int) buffer[26], 2); encodeBuffer. encodeValue((unsigned int) buffer[27], 1); encodeBuffer. encodeCachedValue(GetULONG (buffer + 28, bigEndian_), 29, serverCache_.colormapCache, 9); encodeBuffer. encodeCachedValue(GetULONG (buffer + 32, bigEndian_), 32, serverCache_. getWindowAttributesAllEventsCache); encodeBuffer. encodeCachedValue(GetULONG (buffer + 36, bigEndian_), 32, serverCache_. getWindowAttributesYourEventsCache); encodeBuffer. encodeCachedValue(GetUINT (buffer + 40, bigEndian_), 16, serverCache_. getWindowAttributesDontPropagateCache); } break; case X_GrabKeyboard: case X_GrabPointer: { encodeBuffer.encodeValue((unsigned int) buffer[1], 3); } break; case X_InternAtom: { encodeBuffer. encodeValue(GetULONG(buffer + 8, bigEndian_), 29, 9); } break; case X_ListExtensions: { encodeBuffer. encodeValue(GetULONG(buffer + 4, bigEndian_), 32, 8); unsigned int numExtensions = (unsigned int) buffer[1]; encodeBuffer.encodeValue(numExtensions, 8); const unsigned char *nextSrc = buffer + 32; for (; numExtensions; numExtensions--) { unsigned int length = (unsigned int) (*nextSrc++); encodeBuffer.encodeValue(length, 8); if (!strncmp((char *) nextSrc, "MIT-SHM", 7)) memcpy((unsigned char *) nextSrc, "NOT-SHM", 7); for (; length; length--) encodeBuffer. encodeValue((unsigned int) (*nextSrc++), 8); } } break; case X_ListFonts: { encodeBuffer. encodeValue(GetULONG(buffer + 4, bigEndian_), 32, 8); unsigned int numFonts = GetUINT(buffer + 8, bigEndian_); encodeBuffer.encodeValue(numFonts, 16, 6); const unsigned char *nextSrc = buffer + 32; for (; numFonts; numFonts--) { unsigned int length = (unsigned int) (*nextSrc++); encodeBuffer.encodeValue(length, 8); serverCache_.getPropertyTextCompressor. reset(); for (; length; length--) serverCache_.getPropertyTextCompressor. encodeChar(*nextSrc++, encodeBuffer); } } break; case X_LookupColor: case X_AllocNamedColor: { const unsigned char *nextSrc = buffer + 8; if (nextOpcode == X_AllocNamedColor) { encodeBuffer. encodeValue(GetULONG(nextSrc, bigEndian_), 32, 9); nextSrc += 4; } unsigned int count = 3; do { unsigned int exactColor = GetUINT(nextSrc, bigEndian_); encodeBuffer.encodeValue(exactColor, 16, 9); unsigned int visualColor = GetUINT(nextSrc + 6, bigEndian_) - exactColor; encodeBuffer.encodeValue(visualColor, 16, 5); nextSrc += 2; } while (--count); } break; case X_QueryBestSize: { encodeBuffer. encodeValue(GetUINT(buffer + 8, bigEndian_), 16, 8); encodeBuffer. encodeValue(GetUINT(buffer + 10, bigEndian_), 16, 8); } break; case X_QueryColors: { unsigned int numColors = ((size - 32) >> 3); const unsigned char *nextSrc = buffer + 40; unsigned char *nextDest = (unsigned char *) buffer + 38; for (unsigned int c = 1; c < numColors; c++) { for (unsigned int i = 0; i < 6; i++) *nextDest++ = *nextSrc++; nextSrc += 2; } unsigned int colorsLength = numColors * 6; if (serverCache_.queryColorsLastReply. compare(colorsLength, buffer + 32)) encodeBuffer.encodeValue(1, 1); else { const unsigned char *nextSrc = buffer + 32; encodeBuffer.encodeValue(0, 1); encodeBuffer.encodeValue(numColors, 16, 5); for (numColors *= 3; numColors; numColors--) { encodeBuffer. encodeValue(GetUINT (nextSrc, bigEndian_), 16); nextSrc += 2; } } } break; case X_QueryExtension: { // requestData[0] will be nonzero if the request is for // an extension that dxpc should hide, like MIT-SHM if (requestData[0]) { encodeBuffer.encodeValue(0, 1); encodeBuffer.encodeValue(0, 8); } else { encodeBuffer. encodeValue((unsigned int) buffer[8], 1); encodeBuffer. encodeValue((unsigned int) buffer[9], 8); } encodeBuffer. encodeValue((unsigned int) buffer[10], 8); encodeBuffer. encodeValue((unsigned int) buffer[11], 8); } break; case X_QueryFont: { unsigned int numProperties = GetUINT(buffer + 46, bigEndian_); unsigned int numCharInfos = GetULONG(buffer + 56, bigEndian_); encodeBuffer.encodeValue(numProperties, 16, 8); encodeBuffer.encodeValue(numCharInfos, 32, 10); encodeCharInfo_(buffer + 8, encodeBuffer); encodeCharInfo_(buffer + 24, encodeBuffer); encodeBuffer. encodeValue(GetUINT(buffer + 40, bigEndian_), 16, 9); encodeBuffer. encodeValue(GetUINT(buffer + 42, bigEndian_), 16, 9); encodeBuffer. encodeValue(GetUINT(buffer + 44, bigEndian_), 16, 9); encodeBuffer. encodeValue((unsigned int) buffer[48], 1); encodeBuffer. encodeValue((unsigned int) buffer[49], 8); encodeBuffer. encodeValue((unsigned int) buffer[50], 8); encodeBuffer. encodeValue((unsigned int) buffer[51], 1); encodeBuffer. encodeValue(GetUINT(buffer + 52, bigEndian_), 16, 9); encodeBuffer. encodeValue(GetUINT(buffer + 54, bigEndian_), 16, 9); const unsigned char *nextSrc = buffer + 60; unsigned int index; if (ServerCache::queryFontFontCache. lookup(numProperties * 8 + numCharInfos * 12, nextSrc, index)) { encodeBuffer.encodeValue(1, 1); encodeBuffer.encodeValue(index, 4); break; } encodeBuffer.encodeValue(0, 1); for (; numProperties; numProperties--) { encodeBuffer. encodeValue(GetULONG(nextSrc, bigEndian_), 32, 9); encodeBuffer. encodeValue(GetULONG (nextSrc + 4, bigEndian_), 32, 9); nextSrc += 8; } for (; numCharInfos; numCharInfos--) { encodeCharInfo_(nextSrc, encodeBuffer); nextSrc += 12; } } break; case X_QueryPointer: { encodeBuffer.encodeValue((unsigned int) buffer[1], 1); encodeBuffer. encodeCachedValue(GetULONG (buffer + 8, bigEndian_), 29, serverCache_. queryPointerRootCache, 9); encodeBuffer. encodeCachedValue(GetULONG (buffer + 12, bigEndian_), 29, serverCache_. queryPointerChildCache, 9); unsigned int rootX = GetUINT(buffer + 16, bigEndian_); unsigned int rootY = GetUINT(buffer + 18, bigEndian_); unsigned int eventX = GetUINT(buffer + 20, bigEndian_); unsigned int eventY = GetUINT(buffer + 22, bigEndian_); eventX -= rootX; eventY -= rootY; encodeBuffer.encodeCachedValue(rootX - serverCache_. motionNotifyLastRootX, 16, serverCache_. motionNotifyRootXCache, 8); serverCache_.motionNotifyLastRootX = rootX; encodeBuffer.encodeCachedValue(rootY - serverCache_. motionNotifyLastRootY, 16, serverCache_. motionNotifyRootYCache, 8); serverCache_.motionNotifyLastRootY = rootY; encodeBuffer.encodeCachedValue(eventX, 16, serverCache_. motionNotifyEventXCache, 8); encodeBuffer.encodeCachedValue(eventY, 16, serverCache_. motionNotifyEventYCache, 8); encodeBuffer. encodeCachedValue(GetUINT (buffer + 24, bigEndian_), 16, serverCache_. motionNotifyStateCache); } break; case X_QueryTree: { encodeBuffer.encodeValue(buffer[1], 8); encodeBuffer. encodeValue(GetULONG(buffer + 4, bigEndian_), 32); for (unsigned int i = 8; i < size; i++) encodeBuffer. encodeValue((unsigned int) buffer[i], 8); } break; case X_TranslateCoords: { encodeBuffer.encodeValue((unsigned int) buffer[1], 1); encodeBuffer. encodeCachedValue(GetULONG (buffer + 8, bigEndian_), 29, serverCache_. translateCoordsChildCache, 9); encodeBuffer. encodeCachedValue(GetUINT (buffer + 12, bigEndian_), 16, serverCache_. translateCoordsXCache, 8); encodeBuffer. encodeCachedValue(GetUINT (buffer + 14, bigEndian_), 16, serverCache_. translateCoordsYCache, 8); } break; default: { CERR << "assertion failed in ServerXReader::processMessage():\n" << " no matching request for reply with sequence number " << sequenceNum << ENDL; } } } else { encodeBuffer.encodeValue(buffer[1], 8); encodeBuffer.encodeValue(GetULONG(buffer + 4, bigEndian_), 32); for (unsigned int i = 8; i < size; i++) encodeBuffer.encodeValue((unsigned int) buffer[i], 8); } replyStats_.add(requestOpcode, size << 3, encodeBuffer.getCumulativeBitsWritten()); } else { // event or error unsigned int sequenceNum = GetUINT(buffer + 2, bigEndian_); unsigned int sequenceNumDiff = sequenceNum - serverCache_.lastSequenceNum; serverCache_.lastSequenceNum = sequenceNum; unsigned int opcode = (unsigned int) *buffer; encodeBuffer.encodeCachedValue(opcode, 8, serverCache_. opcodeCache[serverCache_. lastOpcode]); serverCache_.lastOpcode = opcode; encodeBuffer.encodeCachedValue(sequenceNumDiff, 16, serverCache_. eventSequenceNumCache, 7); // check if this is an error that matches a sequence number for // which we were expecting a reply unsigned short int dummySequenceNum; unsigned char dummyOpcode; if (sequenceNumQueue_.peek(dummySequenceNum, dummyOpcode) && ((unsigned int) dummySequenceNum == sequenceNum)) sequenceNumQueue_.pop(dummySequenceNum, dummyOpcode); switch (*buffer) { case 0: { unsigned char code = buffer[1]; encodeBuffer.encodeCachedValue(code, 8, serverCache_. errorCodeCache); if ((code != 11) && (code != 8) && (code != 15) && (code != 1)) encodeBuffer. encodeValue(GetULONG(buffer + 4, bigEndian_), 32, 16); if (code >= 18) encodeBuffer. encodeCachedValue(GetUINT (buffer + 8, bigEndian_), 16, serverCache_. errorMinorCache); encodeBuffer.encodeCachedValue(buffer[10], 8, serverCache_. errorMajorCache); if (code >= 18) { const unsigned char *nextSrc = buffer + 11; for (unsigned int i = 11; i < 32; i++) encodeBuffer.encodeValue(*nextSrc++, 8); } } break; case ButtonPress: case ButtonRelease: case KeyPress: case KeyRelease: case MotionNotify: case EnterNotify: case LeaveNotify: { unsigned char detail = buffer[1]; if (*buffer == MotionNotify) encodeBuffer.encodeValue((unsigned int) detail, 1); else if ((*buffer == EnterNotify) || (*buffer == LeaveNotify)) encodeBuffer.encodeValue((unsigned int) detail, 3); else if (*buffer == KeyRelease) { if (detail == serverCache_.keyPressLastKey) encodeBuffer.encodeValue(1, 1); else { encodeBuffer.encodeValue(0, 1); encodeBuffer. encodeValue((unsigned int) detail, 8); } } else if ((*buffer == ButtonPress) || (*buffer == ButtonRelease)) encodeBuffer.encodeCachedValue(detail, 8, serverCache_. buttonCache); else encodeBuffer.encodeValue((unsigned int) detail, 8); unsigned int timestamp = GetULONG(buffer + 4, bigEndian_); unsigned int timestampDiff = timestamp - serverCache_.lastTimestamp; serverCache_.lastTimestamp = timestamp; encodeBuffer.encodeCachedValue(timestampDiff, 32, serverCache_. motionNotifyTimestampCache, 9); int skipRest = 0; if (*buffer == KeyRelease) { skipRest = 1; for (unsigned int i = 8; i < 31; i++) { if (buffer[i] != serverCache_.keyPressCache[i - 8]) { skipRest = 0; break; } } encodeBuffer.encodeValue(skipRest, 1); } if (!skipRest) { const unsigned char *nextSrc = buffer + 8; for (unsigned int i = 0; i < 3; i++) { encodeBuffer. encodeCachedValue(GetULONG (nextSrc, bigEndian_), 29, *serverCache_. motionNotifyWindowCache [i], 6); nextSrc += 4; } unsigned int rootX = GetUINT(buffer + 20, bigEndian_); unsigned int rootY = GetUINT(buffer + 22, bigEndian_); unsigned int eventX = GetUINT(buffer + 24, bigEndian_); unsigned int eventY = GetUINT(buffer + 26, bigEndian_); eventX -= rootX; eventY -= rootY; encodeBuffer.encodeCachedValue(rootX - serverCache_. motionNotifyLastRootX, 16, serverCache_. motionNotifyRootXCache, 6); serverCache_.motionNotifyLastRootX = rootX; encodeBuffer.encodeCachedValue(rootY - serverCache_. motionNotifyLastRootY, 16, serverCache_. motionNotifyRootYCache, 6); serverCache_.motionNotifyLastRootY = rootY; encodeBuffer.encodeCachedValue(eventX, 16, serverCache_. motionNotifyEventXCache, 6); encodeBuffer.encodeCachedValue(eventY, 16, serverCache_. motionNotifyEventYCache, 6); encodeBuffer. encodeCachedValue(GetUINT (buffer + 28, bigEndian_), 16, serverCache_. motionNotifyStateCache); if ((*buffer == EnterNotify) || (*buffer == LeaveNotify)) encodeBuffer. encodeValue((unsigned int) buffer[30], 2); else encodeBuffer. encodeValue((unsigned int) buffer[30], 1); if ((*buffer == EnterNotify) || (*buffer == LeaveNotify)) encodeBuffer. encodeValue((unsigned int) buffer[31], 2); else if (*buffer == KeyPress) { serverCache_.keyPressLastKey = detail; for (unsigned int i = 8; i < 31; i++) { serverCache_.keyPressCache[i - 8] = buffer[i]; } } } } break; case ColormapNotify: { encodeBuffer. encodeCachedValue(GetULONG (buffer + 4, bigEndian_), 29, serverCache_. colormapNotifyWindowCache, 8); encodeBuffer. encodeCachedValue(GetULONG (buffer + 8, bigEndian_), 29, serverCache_. colormapNotifyColormapCache, 8); encodeBuffer.encodeValue((unsigned int) buffer[12], 1); encodeBuffer.encodeValue((unsigned int) buffer[13], 1); } break; case ConfigureNotify: { const unsigned char *nextSrc = buffer + 4; for (unsigned int i = 0; i < 3; i++) { encodeBuffer. encodeCachedValue(GetULONG (nextSrc, bigEndian_), 29, *serverCache_. configureNotifyWindowCache [i], 9); nextSrc += 4; } for (unsigned int j = 0; j < 5; j++) { encodeBuffer. encodeCachedValue(GetUINT (nextSrc, bigEndian_), 16, *serverCache_. configureNotifyGeomCache[j], 8); nextSrc += 2; } encodeBuffer.encodeValue(*nextSrc, 1); } break; case CreateNotify: { encodeBuffer. encodeCachedValue(GetULONG (buffer + 4, bigEndian_), 29, serverCache_. createNotifyWindowCache, 9); unsigned int window = GetULONG(buffer + 8, bigEndian_); encodeBuffer.encodeValue(window - serverCache_. createNotifyLastWindow, 29, 5); serverCache_.createNotifyLastWindow = window; const unsigned char *nextSrc = buffer + 12; for (unsigned int i = 0; i < 5; i++) { encodeBuffer. encodeValue(GetUINT(nextSrc, bigEndian_), 16, 9); nextSrc += 2; } encodeBuffer.encodeValue((unsigned int) *nextSrc, 1); } break; case Expose: { encodeBuffer. encodeCachedValue(GetULONG (buffer + 4, bigEndian_), 29, serverCache_.exposeWindowCache, 9); const unsigned char *nextSrc = buffer + 8; for (unsigned int i = 0; i < 5; i++) { encodeBuffer. encodeCachedValue(GetUINT (nextSrc, bigEndian_), 16, *serverCache_. exposeGeomCache[i], 6); nextSrc += 2; } } break; case FocusIn: case FocusOut: { encodeBuffer.encodeValue((unsigned int) buffer[1], 3); encodeBuffer. encodeCachedValue(GetULONG (buffer + 4, bigEndian_), 29, serverCache_.focusInWindowCache, 9); encodeBuffer.encodeValue((unsigned int) buffer[8], 2); } break; case KeymapNotify: { if (ServerCache::lastKeymap.compare(31, buffer + 1)) encodeBuffer.encodeValue(1, 1); else { encodeBuffer.encodeValue(0, 1); const unsigned char *nextSrc = buffer + 1; for (unsigned int i = 1; i < 32; i++) encodeBuffer. encodeValue((unsigned int) *nextSrc++, 8); } } break; case MapNotify: case UnmapNotify: case DestroyNotify: { encodeBuffer. encodeCachedValue(GetULONG (buffer + 4, bigEndian_), 29, serverCache_. mapNotifyEventCache, 9); encodeBuffer. encodeCachedValue(GetULONG (buffer + 8, bigEndian_), 29, serverCache_. mapNotifyWindowCache, 9); if ((*buffer == MapNotify) || (*buffer == UnmapNotify)) encodeBuffer. encodeValue((unsigned int) buffer[12], 1); } break; case NoExpose: { encodeBuffer. encodeCachedValue(GetULONG (buffer + 4, bigEndian_), 29, serverCache_. noExposeDrawableCache, 9); encodeBuffer. encodeCachedValue(GetUINT(buffer + 8, bigEndian_), 16, serverCache_. noExposeMinorCache); encodeBuffer.encodeCachedValue(buffer[10], 8, serverCache_. noExposeMajorCache); } break; case PropertyNotify: { encodeBuffer. encodeCachedValue(GetULONG (buffer + 4, bigEndian_), 29, serverCache_. propertyNotifyWindowCache, 9); encodeBuffer. encodeCachedValue(GetULONG (buffer + 8, bigEndian_), 29, serverCache_. propertyNotifyAtomCache, 9); unsigned int timestamp = GetULONG(buffer + 12, bigEndian_); unsigned int timestampDiff = timestamp - serverCache_.lastTimestamp; serverCache_.lastTimestamp = timestamp; encodeBuffer.encodeValue(timestampDiff, 32, 9); encodeBuffer.encodeValue((unsigned int) buffer[16], 1); } break; case ReparentNotify: { const unsigned char *nextSrc = buffer + 4; for (unsigned int i = 0; i < 3; i++) { encodeBuffer. encodeCachedValue(GetULONG (nextSrc, bigEndian_), 29, serverCache_. reparentNotifyWindowCache, 9); nextSrc += 4; } encodeBuffer.encodeValue(GetUINT(nextSrc, bigEndian_), 16, 6); encodeBuffer. encodeValue(GetUINT(nextSrc + 2, bigEndian_), 16, 6); encodeBuffer.encodeValue((unsigned int) buffer[20], 1); } break; case SelectionClear: { unsigned int timestamp = GetULONG(buffer + 4, bigEndian_); unsigned int timestampDiff = timestamp - serverCache_.lastTimestamp; serverCache_.lastTimestamp = timestamp; encodeBuffer.encodeValue(timestampDiff, 32, 9); encodeBuffer. encodeCachedValue(GetULONG (buffer + 8, bigEndian_), 29, serverCache_. selectionClearWindowCache, 9); encodeBuffer. encodeCachedValue(GetULONG (buffer + 12, bigEndian_), 29, serverCache_. selectionClearAtomCache, 9); } break; case SelectionRequest: { unsigned int timestamp = GetULONG(buffer + 4, bigEndian_); unsigned int timestampDiff = timestamp - serverCache_.lastTimestamp; serverCache_.lastTimestamp = timestamp; encodeBuffer.encodeValue(timestampDiff, 32, 9); encodeBuffer. encodeCachedValue(GetULONG (buffer + 8, bigEndian_), 29, serverCache_. selectionClearWindowCache, 9); encodeBuffer. encodeCachedValue(GetULONG (buffer + 12, bigEndian_), 29, serverCache_. selectionClearWindowCache, 9); encodeBuffer. encodeCachedValue(GetULONG (buffer + 16, bigEndian_), 29, serverCache_. selectionClearAtomCache, 9); encodeBuffer. encodeCachedValue(GetULONG (buffer + 20, bigEndian_), 29, serverCache_. selectionClearAtomCache, 9); encodeBuffer. encodeCachedValue(GetULONG (buffer + 24, bigEndian_), 29, serverCache_. selectionClearAtomCache, 9); } break; case VisibilityNotify: { encodeBuffer. encodeCachedValue(GetULONG (buffer + 4, bigEndian_), 29, serverCache_. visibilityNotifyWindowCache, 9); encodeBuffer.encodeValue((unsigned int) buffer[8], 2); } break; default: { encodeBuffer.encodeValue(buffer[1], 8); for (unsigned int i = 4; i < size; i++) encodeBuffer.encodeValue((unsigned int) buffer[i], 8); } } stats_.add(*buffer, size << 3, encodeBuffer.getCumulativeBitsWritten()); } } } return 1; } int ServerChannel::doWrite(const unsigned char *message, unsigned int length) { writeBuffer_.reset(); // uncompress messages DecodeBuffer decodeBuffer(message, length); if (firstRequest_) { unsigned char *outputMessage = writeBuffer_.addMessage(length); unsigned char *nextDest = outputMessage; for (unsigned int i = 0; i < length; i++) { unsigned int nextByte; decodeBuffer.decodeValue(nextByte, 8); *nextDest++ = (unsigned char) nextByte; } if (*outputMessage == 0x42) setBigEndian(1); else setBigEndian(0); firstRequest_ = 0; } else { unsigned char opcode; while (decodeBuffer.decodeCachedValue(opcode, 8, clientCache_. opcodeCache[clientCache_. lastOpcode], 8, 1)) { clientCache_.lastOpcode = opcode; clientCache_.lastRequestSequenceNum++; unsigned char *outputMessage; unsigned int outputLength; unsigned int value; // general-purpose temp variable for decoding ints unsigned char cValue; // general-purpose temp variable for decoding chars switch (opcode) { case X_AllocColor: { outputLength = 16; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeCachedValue(value, 29, clientCache_.colormapCache, 9); PutULONG(value, outputMessage + 4, bigEndian_); unsigned char *nextDest = outputMessage + 8; unsigned int colorData[3]; for (unsigned int i = 0; i < 3; i++) { decodeBuffer.decodeCachedValue(value, 16, *(clientCache_. allocColorRGBCache [i]), 4); PutUINT(value, nextDest, bigEndian_); colorData[i] = value; nextDest += 2; } sequenceNumQueue_.push(clientCache_. lastRequestSequenceNum, opcode, colorData[0], colorData[1], colorData[2]); } break; case X_ChangeProperty: { unsigned char format; decodeBuffer.decodeCachedValue(format, 8, clientCache_. changePropertyFormatCache); unsigned int dataLength; decodeBuffer.decodeValue(dataLength, 32, 6); outputLength = 24 + RoundUp4(dataLength * (format >> 3)); outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeValue(value, 2); outputMessage[1] = (unsigned char) value; decodeBuffer.decodeCachedValue(value, 29, clientCache_.windowCache, 9); PutULONG(value, outputMessage + 4, bigEndian_); decodeBuffer.decodeCachedValue(value, 29, clientCache_. changePropertyPropertyCache, 9); PutULONG(value, outputMessage + 8, bigEndian_); decodeBuffer.decodeCachedValue(value, 29, clientCache_. changePropertyTypeCache, 9); PutULONG(value, outputMessage + 12, bigEndian_); outputMessage[16] = format; PutULONG(dataLength, outputMessage + 20, bigEndian_); unsigned char *nextDest = outputMessage + 24; if (format == 8) { clientCache_.changePropertyTextCompressor.reset(); for (unsigned int i = 0; i < dataLength; i++) *nextDest++ = clientCache_.changePropertyTextCompressor. decodeChar(decodeBuffer); } else if (format == 32) { for (unsigned int i = 0; i < dataLength; i++) { decodeBuffer.decodeCachedValue(value, 32, clientCache_. changePropertyData32Cache); PutULONG(value, nextDest, bigEndian_); nextDest += 4; } } else { for (unsigned int i = 0; i < dataLength; i++) { decodeBuffer.decodeValue(value, 16); PutUINT(value, nextDest, bigEndian_); nextDest += 2; } } } break; case X_ChangeWindowAttributes: { unsigned int numAttrs; decodeBuffer.decodeValue(numAttrs, 4); outputLength = 12 + (numAttrs << 2); outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeCachedValue(value, 29, clientCache_.windowCache, 9); PutULONG(value, outputMessage + 4, bigEndian_); unsigned int bitmask; decodeBuffer.decodeCachedValue(bitmask, 15, clientCache_. createWindowBitmaskCache); PutULONG(bitmask, outputMessage + 8, bigEndian_); unsigned char *nextDest = outputMessage + 12; unsigned int mask = 0x1; for (unsigned int i = 0; i < 15; i++) { if (bitmask & mask) { decodeBuffer.decodeCachedValue(value, 32, *clientCache_. createWindowAttrCache [i]); PutULONG(value, nextDest, bigEndian_); nextDest += 4; } mask <<= 1; } } break; case X_ClearArea: { outputLength = 16; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeValue(value, 1); outputMessage[1] = (unsigned char) value; decodeBuffer.decodeCachedValue(value, 29, clientCache_.windowCache, 9); PutULONG(value, outputMessage + 4, bigEndian_); unsigned char *nextDest = outputMessage + 8; for (unsigned int i = 0; i < 4; i++) { decodeBuffer.decodeCachedValue(value, 16, *clientCache_. clearAreaGeomCache[i], 8); PutUINT(value, nextDest, bigEndian_); nextDest += 2; } } break; case X_CloseFont: { outputLength = 8; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeValue(value, 29, 5); clientCache_.lastFont += value; clientCache_.lastFont &= 0x1fffffff; PutULONG(clientCache_.lastFont, outputMessage + 4, bigEndian_); } break; case X_ConfigureWindow: { outputLength = 12; outputMessage = writeBuffer_.addMessage(outputLength); writeBuffer_.registerPointer(&outputMessage); decodeBuffer.decodeCachedValue(value, 29, clientCache_.windowCache, 9); PutULONG(value, outputMessage + 4, bigEndian_); unsigned int bitmask; decodeBuffer.decodeCachedValue(bitmask, 7, clientCache_. configureWindowBitmaskCache); PutUINT(bitmask, outputMessage + 8, bigEndian_); unsigned int mask = 0x1; for (unsigned int i = 0; i < 7; i++) { if (bitmask & mask) { unsigned char *nextDest = writeBuffer_.addMessage(4); outputLength += 4; decodeBuffer.decodeCachedValue(value, CONFIGUREWINDOW_FIELD_WIDTH [i], *clientCache_. configureWindowAttrCache [i], 8); PutULONG(value, nextDest, bigEndian_); nextDest += 4; } mask <<= 1; } writeBuffer_.unregisterPointer(); } break; case X_ConvertSelection: { outputLength = 24; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeCachedValue(value, 29, clientCache_. convertSelectionRequestorCache, 9); PutULONG(value, outputMessage + 4, bigEndian_); unsigned char *nextDest = outputMessage + 8; for (unsigned int i = 0; i < 3; i++) { decodeBuffer.decodeCachedValue(value, 29, *(clientCache_. convertSelectionAtomCache [i]), 9); PutULONG(value, nextDest, bigEndian_); nextDest += 4; } decodeBuffer.decodeValue(value, 32, 4); clientCache_.convertSelectionLastTimestamp += value; PutULONG(clientCache_.convertSelectionLastTimestamp, nextDest, bigEndian_); } break; case X_CopyArea: { outputLength = 28; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeCachedValue(value, 29, clientCache_.drawableCache, 9); PutULONG(value, outputMessage + 4, bigEndian_); decodeBuffer.decodeCachedValue(value, 29, clientCache_.drawableCache, 9); PutULONG(value, outputMessage + 8, bigEndian_); decodeBuffer.decodeCachedValue(value, 29, clientCache_.gcCache, 9); PutULONG(value, outputMessage + 12, bigEndian_); unsigned char *nextDest = outputMessage + 16; for (unsigned int i = 0; i < 6; i++) { decodeBuffer.decodeCachedValue(value, 16, *clientCache_. copyAreaGeomCache[i], 8); PutUINT(value, nextDest, bigEndian_); nextDest += 2; } } break; case X_CopyGC: { outputLength = 16; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeCachedValue(value, 29, clientCache_.gcCache, 9); PutULONG(value, outputMessage + 4, bigEndian_); decodeBuffer.decodeCachedValue(value, 29, clientCache_.gcCache, 9); PutULONG(value, outputMessage + 8, bigEndian_); decodeBuffer.decodeCachedValue(value, 23, clientCache_. createGCBitmaskCache); PutULONG(value, outputMessage + 12, bigEndian_); } break; case X_CopyPlane: { outputLength = 32; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeCachedValue(value, 29, clientCache_.drawableCache, 9); PutULONG(value, outputMessage + 4, bigEndian_); decodeBuffer.decodeCachedValue(value, 29, clientCache_.drawableCache, 9); PutULONG(value, outputMessage + 8, bigEndian_); decodeBuffer.decodeCachedValue(value, 29, clientCache_.gcCache, 9); PutULONG(value, outputMessage + 12, bigEndian_); unsigned char *nextDest = outputMessage + 16; for (unsigned int i = 0; i < 6; i++) { decodeBuffer.decodeCachedValue(value, 16, *clientCache_. copyPlaneGeomCache[i], 8); PutUINT(value, nextDest, bigEndian_); nextDest += 2; } decodeBuffer.decodeCachedValue(value, 32, clientCache_. copyPlaneBitPlaneCache, 10); PutULONG(value, outputMessage + 28, bigEndian_); } break; case X_CreateGC: case X_ChangeGC: { outputLength = 12; if (opcode == X_CreateGC) outputLength += 4; outputMessage = writeBuffer_.addMessage(outputLength); writeBuffer_.registerPointer(&outputMessage); decodeBuffer.decodeCachedValue(value, 29, clientCache_.gcCache, 9); PutULONG(value, outputMessage + 4, bigEndian_); unsigned int offset = 8; if (opcode == X_CreateGC) { decodeBuffer.decodeCachedValue(value, 29, clientCache_. drawableCache, 9); PutULONG(value, outputMessage + offset, bigEndian_); offset += 4; } unsigned int bitmask; decodeBuffer.decodeCachedValue(bitmask, 23, clientCache_. createGCBitmaskCache); PutULONG(bitmask, outputMessage + offset, bigEndian_); unsigned int mask = 0x1; for (unsigned int i = 0; i < 23; i++) { if (bitmask & mask) { unsigned char *nextDest = writeBuffer_.addMessage(4); outputLength += 4; unsigned int fieldWidth = CREATEGC_FIELD_WIDTH[i]; if (fieldWidth <= 4) decodeBuffer.decodeValue(value, fieldWidth); else decodeBuffer.decodeCachedValue(value, fieldWidth, *clientCache_. createGCAttrCache [i]); PutULONG(value, nextDest, bigEndian_); } mask <<= 1; } writeBuffer_.unregisterPointer(); } break; case X_CreatePixmap: { outputLength = 16; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeCachedValue(cValue, 8, clientCache_.depthCache); outputMessage[1] = cValue; decodeBuffer.decodeValue(value, 1); if (!value) { decodeBuffer.decodeValue(value, 29, 4); clientCache_.createPixmapLastPixmap += value; clientCache_.createPixmapLastPixmap &= 0x1fffffff; } PutULONG(clientCache_.createPixmapLastPixmap, outputMessage + 4, bigEndian_); decodeBuffer.decodeCachedValue(value, 29, clientCache_.drawableCache, 9); PutULONG(value, outputMessage + 8, bigEndian_); decodeBuffer.decodeCachedValue(value, 16, clientCache_. createPixmapXCache, 8); PutUINT(value, outputMessage + 12, bigEndian_); decodeBuffer.decodeCachedValue(value, 16, clientCache_. createPixmapYCache, 8); PutUINT(value, outputMessage + 14, bigEndian_); } break; case X_CreateWindow: { outputLength = 32; outputMessage = writeBuffer_.addMessage(outputLength); writeBuffer_.registerPointer(&outputMessage); decodeBuffer.decodeCachedValue(cValue, 8, clientCache_.depthCache); outputMessage[1] = cValue; decodeBuffer.decodeCachedValue(value, 29, clientCache_.windowCache, 9); PutULONG(value, outputMessage + 8, bigEndian_); decodeBuffer.decodeCachedValue(value, 29, clientCache_.windowCache, 9); PutULONG(value, outputMessage + 4, bigEndian_); unsigned char *nextDest = outputMessage + 12; unsigned int i; for (i = 0; i < 6; i++) { decodeBuffer.decodeCachedValue(value, 16, *clientCache_. createWindowGeomCache [i], 8); PutUINT(value, nextDest, bigEndian_); nextDest += 2; } decodeBuffer.decodeCachedValue(value, 29, clientCache_.visualCache); PutULONG(value, outputMessage + 24, bigEndian_); unsigned int bitmask; decodeBuffer.decodeCachedValue(bitmask, 15, clientCache_. createWindowBitmaskCache); unsigned int newbitmask = bitmask; int addBackingStore = 0; if ((wantBackingStore != NotUseful) && !(bitmask & CWBackingStore)) { addBackingStore = 1; newbitmask |= CWBackingStore; } PutULONG(newbitmask, outputMessage + 28, bigEndian_); unsigned int mask = 0x1; for (i = 0; i < 15; i++) { if (bitmask & mask) { nextDest = writeBuffer_.addMessage(4); outputLength += 4; decodeBuffer.decodeCachedValue(value, 32, *clientCache_. createWindowAttrCache [i]); PutULONG(value, nextDest, bigEndian_); } else if (mask == CWBackingStore && addBackingStore) { nextDest = writeBuffer_.addMessage(4); outputLength += 4; PutULONG(wantBackingStore, nextDest, bigEndian_); } mask <<= 1; } writeBuffer_.unregisterPointer(); } break; case X_DeleteProperty: { outputLength = 12; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeCachedValue(value, 29, clientCache_.windowCache, 9); PutULONG(value, outputMessage + 4, bigEndian_); decodeBuffer.decodeValue(value, 29, 9); PutULONG(value, outputMessage + 8, bigEndian_); } break; case X_FillPoly: { unsigned int numPoints; decodeBuffer.decodeCachedValue(numPoints, 14, clientCache_. fillPolyNumPointsCache, 4); outputLength = 16 + (numPoints << 2); outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeCachedValue(value, 29, clientCache_.drawableCache, 9); PutULONG(value, outputMessage + 4, bigEndian_); decodeBuffer.decodeCachedValue(value, 29, clientCache_.gcCache, 9); PutULONG(value, outputMessage + 8, bigEndian_); decodeBuffer.decodeValue(value, 2); outputMessage[12] = (unsigned char) value; unsigned int relativeCoordMode; decodeBuffer.decodeValue(relativeCoordMode, 1); outputMessage[13] = (unsigned char) relativeCoordMode; unsigned char *nextDest = outputMessage + 16; unsigned int pointIndex = 0; for (unsigned int i = 0; i < numPoints; i++) { if (relativeCoordMode) { decodeBuffer.decodeCachedValue(value, 16, *clientCache_. fillPolyXRelCache [pointIndex], 8); PutUINT(value, nextDest, bigEndian_); nextDest += 2; decodeBuffer.decodeCachedValue(value, 16, *clientCache_. fillPolyYRelCache [pointIndex], 8); PutUINT(value, nextDest, bigEndian_); nextDest += 2; } else { unsigned int x, y; decodeBuffer.decodeValue(value, 1); if (value) { decodeBuffer.decodeValue(value, 3); x = clientCache_.fillPolyRecentX[value]; y = clientCache_.fillPolyRecentY[value]; } else { decodeBuffer.decodeCachedValue(x, 16, *clientCache_. fillPolyXAbsCache [pointIndex], 8); decodeBuffer.decodeCachedValue(y, 16, *clientCache_. fillPolyYAbsCache [pointIndex], 8); clientCache_.fillPolyRecentX[clientCache_. fillPolyIndex] = x; clientCache_.fillPolyRecentY[clientCache_. fillPolyIndex] = y; clientCache_.fillPolyIndex++; if (clientCache_.fillPolyIndex == 8) clientCache_.fillPolyIndex = 0; } PutUINT(x, nextDest, bigEndian_); nextDest += 2; PutUINT(y, nextDest, bigEndian_); nextDest += 2; } if (pointIndex + 1 < FILL_POLY_MAX_POINTS) pointIndex++; } } break; case X_FreeColors: { unsigned int numPixels; decodeBuffer.decodeValue(numPixels, 16, 4); outputLength = 12 + (numPixels << 2); outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeCachedValue(value, 29, clientCache_.colormapCache, 9); PutULONG(value, outputMessage + 4, bigEndian_); decodeBuffer.decodeValue(value, 32, 4); PutULONG(value, outputMessage + 8, bigEndian_); unsigned char *nextDest = outputMessage + 12; while (numPixels) { decodeBuffer.decodeValue(value, 32, 8); PutULONG(value, nextDest, bigEndian_); nextDest += 4; numPixels--; } } break; case X_FreeCursor: { outputLength = 8; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeCachedValue(value, 29, clientCache_.cursorCache, 9); PutULONG(value, outputMessage + 4, bigEndian_); } break; case X_FreeGC: { outputLength = 8; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeCachedValue(value, 29, clientCache_.gcCache, 9); PutULONG(value, outputMessage + 4, bigEndian_); } break; case X_FreePixmap: { outputLength = 8; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeValue(value, 1); if (!value) { decodeBuffer.decodeValue(value, 29, 4); clientCache_.createPixmapLastPixmap += value; clientCache_.createPixmapLastPixmap &= 0x1fffffff; } PutULONG(clientCache_.createPixmapLastPixmap, outputMessage + 4, bigEndian_); } break; case X_GetAtomName: { outputLength = 8; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeValue(value, 29, 9); PutULONG(value, outputMessage + 4, bigEndian_); sequenceNumQueue_.push(clientCache_. lastRequestSequenceNum, opcode); } break; case X_GetGeometry: { outputLength = 8; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeCachedValue(value, 29, clientCache_.drawableCache, 9); PutULONG(value, outputMessage + 4, bigEndian_); sequenceNumQueue_.push(clientCache_. lastRequestSequenceNum, opcode); } break; case X_GetInputFocus: case X_GetModifierMapping: { outputLength = 4; outputMessage = writeBuffer_.addMessage(outputLength); sequenceNumQueue_.push(clientCache_. lastRequestSequenceNum, opcode); } break; case X_GetKeyboardMapping: { outputLength = 8; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeValue(value, 8); outputMessage[4] = value; decodeBuffer.decodeValue(value, 8); outputMessage[5] = value; sequenceNumQueue_.push(clientCache_. lastRequestSequenceNum, opcode); } break; case X_GetProperty: { outputLength = 24; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeValue(value, 1); outputMessage[1] = (unsigned char) value; decodeBuffer.decodeCachedValue(value, 29, clientCache_.windowCache, 9); PutULONG(value, outputMessage + 4, bigEndian_); unsigned int property; decodeBuffer.decodeValue(property, 29, 9); PutULONG(property, outputMessage + 8, bigEndian_); decodeBuffer.decodeValue(value, 29, 9); PutULONG(value, outputMessage + 12, bigEndian_); decodeBuffer.decodeValue(value, 32, 2); PutULONG(value, outputMessage + 16, bigEndian_); decodeBuffer.decodeValue(value, 32, 8); PutULONG(value, outputMessage + 20, bigEndian_); sequenceNumQueue_.push(clientCache_. lastRequestSequenceNum, opcode, property); } break; case X_GetSelectionOwner: { outputLength = 8; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeCachedValue(value, 29, clientCache_. getSelectionOwnerSelectionCache, 9); PutULONG(value, outputMessage + 4, bigEndian_); sequenceNumQueue_.push(clientCache_. lastRequestSequenceNum, opcode); } break; case X_GrabButton: case X_GrabPointer: { outputLength = 24; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeValue(value, 1); outputMessage[1] = (unsigned char) value; decodeBuffer.decodeCachedValue(value, 29, clientCache_.windowCache, 9); PutULONG(value, outputMessage + 4, bigEndian_); decodeBuffer.decodeCachedValue(value, 16, clientCache_. grabButtonEventMaskCache); PutUINT(value, outputMessage + 8, bigEndian_); decodeBuffer.decodeValue(value, 1); outputMessage[10] = (unsigned char) value; decodeBuffer.decodeValue(value, 1); outputMessage[11] = (unsigned char) value; decodeBuffer.decodeCachedValue(value, 29, clientCache_. grabButtonConfineCache, 9); PutULONG(value, outputMessage + 12, bigEndian_); decodeBuffer.decodeCachedValue(value, 29, clientCache_.cursorCache, 9); PutULONG(value, outputMessage + 16, bigEndian_); if (opcode == X_GrabButton) { decodeBuffer.decodeCachedValue(cValue, 8, clientCache_. grabButtonButtonCache); outputMessage[20] = cValue; decodeBuffer.decodeCachedValue(value, 16, clientCache_. grabButtonModifierCache); PutUINT(value, outputMessage + 22, bigEndian_); } else { decodeBuffer.decodeValue(value, 32, 4); clientCache_.grabKeyboardLastTimestamp += value; PutULONG(clientCache_.grabKeyboardLastTimestamp, outputMessage + 20, bigEndian_); sequenceNumQueue_.push(clientCache_. lastRequestSequenceNum, opcode); } } break; case X_GrabKeyboard: { outputLength = 16; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeValue(value, 1); outputMessage[1] = (unsigned char) value; decodeBuffer.decodeCachedValue(value, 29, clientCache_.windowCache, 9); PutULONG(value, outputMessage + 4, bigEndian_); decodeBuffer.decodeValue(value, 32, 4); clientCache_.grabKeyboardLastTimestamp += value; PutULONG(clientCache_.grabKeyboardLastTimestamp, outputMessage + 8, bigEndian_); decodeBuffer.decodeValue(value, 1); outputMessage[12] = (unsigned char) value; decodeBuffer.decodeValue(value, 1); outputMessage[13] = (unsigned char) value; sequenceNumQueue_.push(clientCache_. lastRequestSequenceNum, opcode); } break; case X_GrabServer: case X_UngrabServer: case X_NoOperation: { outputLength = 4; outputMessage = writeBuffer_.addMessage(outputLength); } break; case X_ImageText8: { unsigned int textLength; decodeBuffer.decodeValue(textLength, 8); outputLength = 16 + RoundUp4(textLength); outputMessage = writeBuffer_.addMessage(outputLength); outputMessage[1] = (unsigned char) textLength; decodeBuffer.decodeCachedValue(value, 29, clientCache_.drawableCache, 9); PutULONG(value, outputMessage + 4, bigEndian_); decodeBuffer.decodeCachedValue(value, 29, clientCache_.gcCache, 9); PutULONG(value, outputMessage + 8, bigEndian_); decodeBuffer.decodeCachedValue(value, 16, clientCache_. imageText8CacheX, 8); clientCache_.imageText8LastX += value; clientCache_.imageText8LastX &= 0xffff; PutUINT(clientCache_.imageText8LastX, outputMessage + 12, bigEndian_); decodeBuffer.decodeCachedValue(value, 16, clientCache_. imageText8CacheY, 8); clientCache_.imageText8LastY += value; clientCache_.imageText8LastY &= 0xffff; PutUINT(clientCache_.imageText8LastY, outputMessage + 14, bigEndian_); unsigned char *nextDest = outputMessage + 16; clientCache_.imageText8TextCompressor.reset(); while (textLength) { *nextDest++ = clientCache_.imageText8TextCompressor. decodeChar(decodeBuffer); textLength--; } } break; case X_InternAtom: { unsigned int nameLength; decodeBuffer.decodeValue(nameLength, 16, 6); outputLength = RoundUp4(nameLength) + 8; outputMessage = writeBuffer_.addMessage(outputLength); PutUINT(nameLength, outputMessage + 4, bigEndian_); decodeBuffer.decodeValue(value, 1); outputMessage[1] = (unsigned char) value; unsigned char *nextDest = outputMessage + 8; clientCache_.internAtomTextCompressor.reset(); for (unsigned int i = 0; i < nameLength; i++) *nextDest++ = clientCache_.internAtomTextCompressor. decodeChar(decodeBuffer); sequenceNumQueue_.push(clientCache_. lastRequestSequenceNum, opcode); } break; case X_ListExtensions: { outputLength = 4; outputMessage = writeBuffer_.addMessage(outputLength); sequenceNumQueue_.push(clientCache_. lastRequestSequenceNum, opcode); } break; case X_ListFonts: { unsigned int textLength; decodeBuffer.decodeValue(textLength, 16, 6); outputLength = 8 + RoundUp4(textLength); outputMessage = writeBuffer_.addMessage(outputLength); PutUINT(textLength, outputMessage + 6, bigEndian_); decodeBuffer.decodeValue(value, 16, 6); PutUINT(value, outputMessage + 4, bigEndian_); unsigned char *nextDest = outputMessage + 8; clientCache_.polyText8TextCompressor.reset(); for (unsigned int i = 0; i < textLength; i++) *nextDest++ = clientCache_.polyText8TextCompressor. decodeChar(decodeBuffer); sequenceNumQueue_.push(clientCache_. lastRequestSequenceNum, opcode); } break; case X_LookupColor: case X_AllocNamedColor: { unsigned int textLength; decodeBuffer.decodeValue(textLength, 16, 6); outputLength = 12 + RoundUp4(textLength); outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeCachedValue(value, 29, clientCache_.colormapCache, 9); PutULONG(value, outputMessage + 4, bigEndian_); PutUINT(textLength, outputMessage + 8, bigEndian_); unsigned char *nextDest = outputMessage + 12; clientCache_.polyText8TextCompressor.reset(); for (unsigned int i = 0; i < textLength; i++) *nextDest++ = clientCache_.polyText8TextCompressor. decodeChar(decodeBuffer); sequenceNumQueue_.push(clientCache_. lastRequestSequenceNum, opcode); } break; case X_MapWindow: case X_UnmapWindow: case X_MapSubwindows: case X_GetWindowAttributes: case X_DestroyWindow: case X_DestroySubwindows: case X_QueryPointer: case X_QueryTree: { outputLength = 8; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeCachedValue(value, 29, clientCache_.windowCache, 9); PutULONG(value, outputMessage + 4, bigEndian_); if ((opcode == X_QueryPointer) || (opcode == X_GetWindowAttributes) || (opcode == X_QueryTree)) sequenceNumQueue_.push(clientCache_. lastRequestSequenceNum, opcode); } break; case X_OpenFont: { unsigned int nameLength; decodeBuffer.decodeValue(nameLength, 16, 7); outputLength = RoundUp4(12 + nameLength); outputMessage = writeBuffer_.addMessage(outputLength); PutUINT(nameLength, outputMessage + 8, bigEndian_); decodeBuffer.decodeValue(value, 29, 5); clientCache_.lastFont += value; clientCache_.lastFont &= 0x1fffffff; PutULONG(clientCache_.lastFont, outputMessage + 4, bigEndian_); unsigned char *nextDest = outputMessage + 12; clientCache_.openFontTextCompressor.reset(); for (; nameLength; nameLength--) *nextDest++ = clientCache_.openFontTextCompressor. decodeChar(decodeBuffer); } break; case X_PolyFillRectangle: { outputLength = 12; outputMessage = writeBuffer_.addMessage(outputLength); writeBuffer_.registerPointer(&outputMessage); decodeBuffer.decodeCachedValue(value, 29, clientCache_.drawableCache, 9); PutULONG(value, outputMessage + 4, bigEndian_); decodeBuffer.decodeCachedValue(value, 29, clientCache_.gcCache, 9); PutULONG(value, outputMessage + 8, bigEndian_); unsigned int index = 0; unsigned int lastX = 0, lastY = 0, lastWidth = 0, lastHeight = 0; unsigned int numRectangles = 0; for (;;) { outputLength += 8; writeBuffer_.addMessage(8); unsigned char *nextDest = outputMessage + 12 + (numRectangles << 3); numRectangles++; decodeBuffer.decodeCachedValue(value, 16, *clientCache_. polyFillRectangleCacheX [index], 8); value += lastX; PutUINT(value, nextDest, bigEndian_); lastX = value; nextDest += 2; decodeBuffer.decodeCachedValue(value, 16, *clientCache_. polyFillRectangleCacheY [index], 8); value += lastY; PutUINT(value, nextDest, bigEndian_); lastY = value; nextDest += 2; decodeBuffer.decodeCachedValue(value, 16, *clientCache_. polyFillRectangleCacheWidth [index], 8); value += lastWidth; PutUINT(value, nextDest, bigEndian_); lastWidth = value; nextDest += 2; decodeBuffer.decodeCachedValue(value, 16, *clientCache_. polyFillRectangleCacheHeight [index], 8); value += lastHeight; PutUINT(value, nextDest, bigEndian_); lastHeight = value; nextDest += 2; index = 1; decodeBuffer.decodeValue(value, 1); if (!value) break; } writeBuffer_.unregisterPointer(); } break; case X_PolyPoint: { unsigned int numPoints; decodeBuffer.decodeValue(numPoints, 16, 4); outputLength = (numPoints << 2) + 12; outputMessage = writeBuffer_.addMessage(outputLength); unsigned int relativeCoordMode; decodeBuffer.decodeValue(relativeCoordMode, 1); outputMessage[1] = (unsigned char) relativeCoordMode; decodeBuffer.decodeCachedValue(value, 29, clientCache_.drawableCache, 9); PutULONG(value, outputMessage + 4, bigEndian_); decodeBuffer.decodeCachedValue(value, 29, clientCache_.gcCache, 9); PutULONG(value, outputMessage + 8, bigEndian_); unsigned char *nextDest = outputMessage + 12; unsigned int index = 0; unsigned int lastX = 0, lastY = 0; for (unsigned int i = 0; i < numPoints; i++) { decodeBuffer.decodeCachedValue(value, 16, *clientCache_. polyPointCacheX[index], 8); lastX += value; PutUINT(lastX, nextDest, bigEndian_); nextDest += 2; decodeBuffer.decodeCachedValue(value, 16, *clientCache_. polyPointCacheY[index], 8); lastY += value; PutUINT(lastY, nextDest, bigEndian_); nextDest += 2; index = 1; } } break; case X_PolyLine: { unsigned int numPoints; decodeBuffer.decodeValue(numPoints, 16, 4); outputLength = (numPoints << 2) + 12; outputMessage = writeBuffer_.addMessage(outputLength); unsigned int relativeCoordMode; decodeBuffer.decodeValue(relativeCoordMode, 1); outputMessage[1] = (unsigned char) relativeCoordMode; decodeBuffer.decodeCachedValue(value, 29, clientCache_.drawableCache, 9); PutULONG(value, outputMessage + 4, bigEndian_); decodeBuffer.decodeCachedValue(value, 29, clientCache_.gcCache, 9); PutULONG(value, outputMessage + 8, bigEndian_); unsigned char *nextDest = outputMessage + 12; unsigned int index = 0; unsigned int lastX = 0, lastY = 0; for (unsigned int i = 0; i < numPoints; i++) { decodeBuffer.decodeCachedValue(value, 16, *clientCache_. polyLineCacheX[index], 8); lastX += value; PutUINT(lastX, nextDest, bigEndian_); nextDest += 2; decodeBuffer.decodeCachedValue(value, 16, *clientCache_. polyLineCacheY[index], 8); lastY += value; PutUINT(lastY, nextDest, bigEndian_); nextDest += 2; index = 1; } } break; case X_PolyRectangle: { unsigned int numRectangles; decodeBuffer.decodeValue(numRectangles, 16, 3); outputLength = (numRectangles << 3) + 12; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeCachedValue(value, 29, clientCache_.drawableCache, 9); PutULONG(value, outputMessage + 4, bigEndian_); decodeBuffer.decodeCachedValue(value, 29, clientCache_.gcCache, 9); PutULONG(value, outputMessage + 8, bigEndian_); unsigned char *nextDest = outputMessage + 12; for (unsigned int i = 0; i < numRectangles; i++) for (unsigned int k = 0; k < 4; k++) { decodeBuffer.decodeCachedValue(value, 16, *clientCache_. polyRectangleGeomCache [k], 8); PutUINT(value, nextDest, bigEndian_); nextDest += 2; } } break; case X_PolySegment: { unsigned int numSegments; decodeBuffer.decodeValue(numSegments, 16, 4); outputLength = (numSegments << 3) + 12; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeCachedValue(value, 29, clientCache_.drawableCache, 9); PutULONG(value, outputMessage + 4, bigEndian_); decodeBuffer.decodeCachedValue(value, 29, clientCache_.gcCache, 9); PutULONG(value, outputMessage + 8, bigEndian_); unsigned char *nextDest = outputMessage + 12; for (numSegments *= 2; numSegments; numSegments--) { unsigned int index; decodeBuffer.decodeValue(index, 1); unsigned int x; decodeBuffer.decodeCachedValue(x, 16, clientCache_. polySegmentCacheX, 6); x += clientCache_.polySegmentLastX[index]; PutUINT(x, nextDest, bigEndian_); nextDest += 2; unsigned int y; decodeBuffer.decodeCachedValue(y, 16, clientCache_. polySegmentCacheY, 6); y += clientCache_.polySegmentLastY[index]; PutUINT(y, nextDest, bigEndian_); nextDest += 2; clientCache_.polySegmentLastX[clientCache_. polySegmentCacheIndex] = x; clientCache_.polySegmentLastY[clientCache_. polySegmentCacheIndex] = y; if (clientCache_.polySegmentCacheIndex == 1) clientCache_.polySegmentCacheIndex = 0; else clientCache_.polySegmentCacheIndex = 1; } } break; case X_PolyText8: { outputLength = 16; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeCachedValue(value, 29, clientCache_.drawableCache, 9); PutULONG(value, outputMessage + 4, bigEndian_); decodeBuffer.decodeCachedValue(value, 29, clientCache_.gcCache, 9); PutULONG(value, outputMessage + 8, bigEndian_); decodeBuffer.decodeCachedValue(value, 16, clientCache_. polyText8CacheX, 8); clientCache_.polyText8LastX += value; clientCache_.polyText8LastX &= 0xffff; PutUINT(clientCache_.polyText8LastX, outputMessage + 12, bigEndian_); decodeBuffer.decodeCachedValue(value, 16, clientCache_. polyText8CacheY, 8); clientCache_.polyText8LastY += value; clientCache_.polyText8LastY &= 0xffff; PutUINT(clientCache_.polyText8LastY, outputMessage + 14, bigEndian_); unsigned int addedLength = 0; writeBuffer_.registerPointer(&outputMessage); for (;;) { decodeBuffer.decodeValue(value, 1); if (!value) break; unsigned int textLength; decodeBuffer.decodeValue(textLength, 8); if (textLength == 255) { addedLength += 5; unsigned char *nextSegment = writeBuffer_.addMessage(5); *nextSegment = (unsigned char) textLength; decodeBuffer.decodeCachedValue(value, 29, clientCache_. polyText8FontCache); PutULONG(value, nextSegment + 1, 1); } else { addedLength += (textLength + 2); unsigned char *nextSegment = writeBuffer_.addMessage(textLength + 2); *nextSegment = (unsigned char) textLength; unsigned char *nextDest = nextSegment + 1; decodeBuffer.decodeCachedValue(cValue, 8, clientCache_. polyText8DeltaCache); *nextDest++ = cValue; clientCache_.polyText8TextCompressor.reset(); while (textLength) { *nextDest++ = clientCache_.polyText8TextCompressor. decodeChar(decodeBuffer); textLength--; } } } outputLength += addedLength; unsigned int mod4 = (addedLength & 0x3); if (mod4) { unsigned int extra = 4 - mod4; unsigned char *nextDest = writeBuffer_.addMessage(extra); for (unsigned int i = 0; i < extra; i++) *nextDest++ = 0; outputLength += extra; } writeBuffer_.unregisterPointer(); } break; case X_PutImage: { decodeBuffer.decodeValue(value, 16, 8); outputLength = (value << 2); outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeValue(value, 2); outputMessage[1] = (unsigned char) value; decodeBuffer.decodeCachedValue(value, 29, clientCache_.drawableCache, 9); PutULONG(value, outputMessage + 4, bigEndian_); decodeBuffer.decodeCachedValue(value, 29, clientCache_.gcCache, 9); PutULONG(value, outputMessage + 8, bigEndian_); unsigned int width; decodeBuffer.decodeCachedValue(width, 16, clientCache_. putImageWidthCache, 8); PutUINT(width, outputMessage + 12, bigEndian_); unsigned int height; decodeBuffer.decodeCachedValue(height, 16, clientCache_. putImageHeightCache, 8); PutUINT(height, outputMessage + 14, bigEndian_); decodeBuffer.decodeCachedValue(value, 16, clientCache_. putImageXCache, 8); clientCache_.putImageLastX += value; clientCache_.putImageLastX &= 0xffff; PutUINT(clientCache_.putImageLastX, outputMessage + 16, bigEndian_); decodeBuffer.decodeCachedValue(value, 16, clientCache_. putImageYCache, 8); clientCache_.putImageLastY += value; clientCache_.putImageLastY &= 0xffff; PutUINT(clientCache_.putImageLastY, outputMessage + 18, bigEndian_); decodeBuffer.decodeCachedValue(cValue, 8, clientCache_. putImageOffsetCache); outputMessage[20] = cValue; decodeBuffer.decodeCachedValue(cValue, 8, clientCache_.depthCache); outputMessage[21] = cValue; unsigned char *nextDest = outputMessage + 24; decodeBuffer.decodeValue(value, COMPRESSION_TYPE_BITS); CompressionType compressionType = (CompressionType) value; if (decompresser && compressionType != NO_STREAM_COMPRESSION) { decompresser->decompressBuffer(compressionType, nextDest, decodeBuffer); } else if ((outputMessage[1] == 0) && (height <= 32) && (width > height * PUT_IMAGE_MIN_ASPECT_RATIO)) { // bitmap that probably contains text; encode using a variant of // text-compression algorithm unsigned int widthInBits = ((width / scanlinePad_) * scanlinePad_); if (widthInBits < width) widthInBits += scanlinePad_; unsigned int widthInBytes = (widthInBits >> 3); unsigned char *nextDest = outputMessage + 24; memset(nextDest, 0, outputLength - 24); unsigned char destMask = 0x80; clientCache_.putImageLastPixels.reset(); for (unsigned int xCoord = 0; xCoord < width; xCoord++) { unsigned int modelNum = clientCache_.putImageLastPixels.getValue(); unsigned int columnValue; decodeBuffer.decodeCachedValue(columnValue, height, clientCache_. putImagePixelCache [modelNum % PUT_IMAGE_PIXEL_CACHE_SIZE], clientCache_. columnPixel0Coder, clientCache_. columnPixel1Coder); unsigned char *next = nextDest; unsigned int mask = (1 << (height - 1)); for (unsigned int h = 0; h < height; h++) { if (columnValue & mask) *next |= destMask; next += widthInBytes; mask >>= 1; } destMask >>= 1; if (destMask == 0) { destMask = 0x80; nextDest++; } clientCache_.putImageLastPixels.add(columnValue); } if ((imageByteOrder_ == 0) && (bitmapBitOrder_ == 0)) { unsigned char *next = outputMessage + 24; for (unsigned int i = 24; i < outputLength; i++) { *next = REVERSED_BYTE[*next]; next++; } } } else if (outputMessage[1] == 0) { // bitmap--use "Modified-Modified-Read" FAX coding if (width + 2 > clientCache_.putImageLineSize) { delete[]clientCache_.putImageReferenceLine; delete[]clientCache_.putImageCodingLine; clientCache_.putImageLineSize = width + 2; clientCache_.putImageReferenceLine = new unsigned int[width + 2]; clientCache_.putImageCodingLine = new unsigned int[width + 2]; } unsigned int widthInBits = ((width / scanlinePad_) * scanlinePad_); if (widthInBits < width) widthInBits += scanlinePad_; unsigned int widthInBytes = (widthInBits >> 3); unsigned int lastPixelValue = 0; for (unsigned int h = 0; h < height; h++) { unsigned int codingLineLength = 0; unsigned char *nextDest = outputMessage + 24 + h * widthInBytes; *nextDest = 0; unsigned char destMask = 0x80; if (h == 0) { unsigned int pixelValue; decodeBuffer.decodeValue(pixelValue, 1); for (unsigned int xCoord = 0; xCoord < width;) { if (pixelValue) { if (pixelValue != lastPixelValue) clientCache_. putImageCodingLine [codingLineLength++] = xCoord; unsigned int runLength = clientCache_.putImagePixel1Coder. decode(decodeBuffer); while (runLength--) { *nextDest |= destMask; destMask >>= 1; if (destMask == 0) { destMask = 0x80; nextDest++; if (xCoord + 1 < width) *nextDest = 0; } xCoord++; } pixelValue = 0; lastPixelValue = 1; } else { if (pixelValue != lastPixelValue) clientCache_. putImageCodingLine [codingLineLength++] = xCoord; unsigned int runLength = clientCache_.putImagePixel0Coder. decode(decodeBuffer); while (runLength--) { destMask >>= 1; if (destMask == 0) { destMask = 0x80; nextDest++; if (xCoord + 1 < width) *nextDest = 0; } xCoord++; } pixelValue = 1; lastPixelValue = 0; } } clientCache_. putImageCodingLine[codingLineLength++] = width; } else { unsigned int lastX = 0; unsigned int nextReferenceIndex = 0; while (lastX < width) { ScanlineDiff diffCode = (ScanlineDiff) clientCache_. putImageDiffCoder. decode(decodeBuffer); switch (diffCode) { case SD_VERTICAL_0: { lastX = clientCache_. putImageCodingLine [codingLineLength++] = clientCache_. putImageReferenceLine [nextReferenceIndex++]; } break; case SD_VERTICAL_PLUS_1: { lastX = clientCache_. putImageCodingLine [codingLineLength++] = clientCache_. putImageReferenceLine [nextReferenceIndex++] + 1; } break; case SD_VERTICAL_PLUS_2: { lastX = clientCache_. putImageCodingLine [codingLineLength++] = clientCache_. putImageReferenceLine [nextReferenceIndex++] + 2; } break; case SD_VERTICAL_MINUS_1: { lastX = clientCache_. putImageCodingLine [codingLineLength++] = clientCache_. putImageReferenceLine [nextReferenceIndex++] - 1; } break; case SD_VERTICAL_MINUS_2: { lastX = clientCache_. putImageCodingLine [codingLineLength++] = clientCache_. putImageReferenceLine [nextReferenceIndex++] - 2; } break; case SD_PASS: { nextReferenceIndex += 2; } break; case SD_HORIZONTAL: { unsigned int diff; if (codingLineLength & 1) diff = clientCache_. putImagePixel0Coder. decode(decodeBuffer); else diff = clientCache_. putImagePixel1Coder. decode(decodeBuffer); lastX += diff; lastX &= 0xffff; clientCache_. putImageCodingLine [codingLineLength++] = lastX; if (codingLineLength & 1) diff = clientCache_. putImagePixel0Coder. decode(decodeBuffer); else diff = clientCache_. putImagePixel1Coder. decode(decodeBuffer); lastX += diff; lastX &= 0xffff; clientCache_. putImageCodingLine [codingLineLength++] = lastX; } default: { } } } } clientCache_. putImageCodingLine[codingLineLength++] = width; unsigned int pixelValue = 0; unsigned int lastPixelChange = 0; unsigned int *nextPixelChange = clientCache_.putImageCodingLine; for (unsigned int xCoord = 0; xCoord < width;) { unsigned int count = *nextPixelChange - lastPixelChange; lastPixelChange = *nextPixelChange++; for (; count; count--) { if (pixelValue) *nextDest |= destMask; destMask >>= 1; if (destMask == 0) { destMask = 0x80; nextDest++; if (xCoord + 1 < width) *nextDest = 0; } xCoord++; } if (pixelValue) pixelValue = 0; else pixelValue = 1; } unsigned int *tmp = clientCache_.putImageReferenceLine; clientCache_.putImageReferenceLine = clientCache_.putImageCodingLine; clientCache_.putImageCodingLine = tmp; } const unsigned char *end = outputMessage + outputLength; if ((imageByteOrder_ == 0) && (bitmapBitOrder_ == 0)) { for (unsigned char *next = outputMessage + 24; next < end; next++) *next = REVERSED_BYTE[*next]; } unsigned char *next = outputMessage + 24 + widthInBytes; const unsigned char *prev = outputMessage + 24; for (; next < end;) *next++ ^= *prev++; } else { // pixmap if (outputMessage[21] == 8) { for (unsigned int i = 24; i < outputLength; i++) { decodeBuffer.decodeCachedValue(cValue, 8, clientCache_. putImageByteCache, 4); *nextDest++ = cValue; } } else { for (unsigned int i = 24; i < outputLength; i++) { decodeBuffer.decodeValue(value, 8); *nextDest++ = (unsigned char) value; } } } } break; case X_QueryBestSize: { outputLength = 12; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeValue(value, 2); outputMessage[1] = (unsigned char) value; decodeBuffer.decodeCachedValue(value, 29, clientCache_.drawableCache, 9); PutULONG(value, outputMessage + 4, bigEndian_); decodeBuffer.decodeValue(value, 16, 8); PutUINT(value, outputMessage + 8, bigEndian_); decodeBuffer.decodeValue(value, 16, 8); PutUINT(value, outputMessage + 10, bigEndian_); sequenceNumQueue_.push(clientCache_. lastRequestSequenceNum, opcode); } break; case X_QueryColors: { unsigned int numColors; decodeBuffer.decodeValue(numColors, 16, 5); outputLength = (numColors << 2) + 8; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeCachedValue(value, 29, clientCache_.colormapCache, 9); PutULONG(value, outputMessage + 4, bigEndian_); unsigned char *nextDest = outputMessage + 8; unsigned int predictedPixel = clientCache_.queryColorsLastPixel; for (unsigned int i = 0; i < numColors; i++) { unsigned int pixel; decodeBuffer.decodeValue(value, 1); if (value) pixel = predictedPixel; else decodeBuffer.decodeValue(pixel, 32, 9); PutULONG(pixel, nextDest, bigEndian_); if (i == 0) clientCache_.queryColorsLastPixel = pixel; predictedPixel = pixel + 1; nextDest += 4; } sequenceNumQueue_.push(clientCache_. lastRequestSequenceNum, opcode); } break; case X_QueryExtension: { unsigned int nameLength; decodeBuffer.decodeValue(nameLength, 16, 6); outputLength = 8 + RoundUp4(nameLength); outputMessage = writeBuffer_.addMessage(outputLength); PutUINT(nameLength, outputMessage + 4, bigEndian_); unsigned char *nextDest = outputMessage + 8; for (unsigned int i = 0; i < nameLength; i++) { decodeBuffer.decodeValue(value, 8); *nextDest++ = (unsigned char) value; } unsigned int hideExtension = 0; if (!strncmp((char *) outputMessage + 8, "MIT-SHM", 7)) { *logofs << "hiding MIT-SHM!"; hideExtension = 1; } sequenceNumQueue_.push(clientCache_. lastRequestSequenceNum, opcode, hideExtension); } break; case X_QueryFont: { outputLength = 8; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeValue(value, 29, 5); clientCache_.lastFont += value; clientCache_.lastFont &= 0x1fffffff; PutULONG(clientCache_.lastFont, outputMessage + 4, bigEndian_); sequenceNumQueue_.push(clientCache_. lastRequestSequenceNum, opcode); } break; case X_SetClipRectangles: { unsigned int numRectangles; decodeBuffer.decodeValue(numRectangles, 13, 4); outputLength = (numRectangles << 3) + 12; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeValue(value, 2); outputMessage[1] = (unsigned char) value; decodeBuffer.decodeCachedValue(value, 29, clientCache_.gcCache, 9); PutULONG(value, outputMessage + 4, bigEndian_); decodeBuffer.decodeCachedValue(value, 16, clientCache_. setClipRectanglesXCache, 8); PutUINT(value, outputMessage + 8, bigEndian_); decodeBuffer.decodeCachedValue(value, 16, clientCache_. setClipRectanglesYCache, 8); PutUINT(value, outputMessage + 10, bigEndian_); unsigned char *nextDest = outputMessage + 12; for (unsigned int i = 0; i < numRectangles; i++) { for (unsigned int k = 0; k < 4; k++) { decodeBuffer.decodeCachedValue(value, 16, *clientCache_. setClipRectanglesGeomCache [k], 8); PutUINT(value, nextDest, bigEndian_); nextDest += 2; } } } break; case X_SetDashes: { unsigned int numDashes; decodeBuffer.decodeCachedValue(numDashes, 16, clientCache_. setDashesLengthCache, 5); outputLength = 12 + RoundUp4(numDashes); outputMessage = writeBuffer_.addMessage(outputLength); PutUINT(numDashes, outputMessage + 10, bigEndian_); decodeBuffer.decodeCachedValue(value, 29, clientCache_.gcCache, 9); PutULONG(value, outputMessage + 4, bigEndian_); decodeBuffer.decodeCachedValue(value, 16, clientCache_. setDashesOffsetCache, 5); PutUINT(value, outputMessage + 8, bigEndian_); unsigned char *nextDest = outputMessage + 12; for (unsigned int i = 0; i < numDashes; i++) { decodeBuffer.decodeCachedValue(cValue, 8, clientCache_. setDashesDashCache_[i & 1], 5); *nextDest++ = cValue; } } break; case X_SetSelectionOwner: { outputLength = 16; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeCachedValue(value, 29, clientCache_. setSelectionOwnerCache, 9); PutULONG(value, outputMessage + 4, bigEndian_); decodeBuffer.decodeCachedValue(value, 29, clientCache_. getSelectionOwnerSelectionCache, 9); PutULONG(value, outputMessage + 8, bigEndian_); decodeBuffer.decodeCachedValue(value, 32, clientCache_. setSelectionOwnerTimestampCache, 9); PutULONG(value, outputMessage + 12, bigEndian_); } break; case X_TranslateCoords: { outputLength = 16; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeCachedValue(value, 29, clientCache_. translateCoordsSrcCache, 9); PutULONG(value, outputMessage + 4, bigEndian_); decodeBuffer.decodeCachedValue(value, 29, clientCache_. translateCoordsDestCache, 9); PutULONG(value, outputMessage + 8, bigEndian_); decodeBuffer.decodeCachedValue(value, 16, clientCache_. translateCoordsXCache, 8); PutUINT(value, outputMessage + 12, bigEndian_); decodeBuffer.decodeCachedValue(value, 16, clientCache_. translateCoordsYCache, 8); PutUINT(value, outputMessage + 14, bigEndian_); sequenceNumQueue_.push(clientCache_. lastRequestSequenceNum, opcode); } break; default: { unsigned int secondByte; decodeBuffer.decodeValue(secondByte, 8); decodeBuffer.decodeValue(outputLength, 16, 8); outputLength <<= 2; outputMessage = writeBuffer_.addMessage(outputLength); outputMessage[1] = (unsigned char) secondByte; unsigned char *nextDest = outputMessage + 4; for (unsigned int i = 4; i < outputLength; i++) { unsigned int nextByte; decodeBuffer.decodeValue(nextByte, 8); *nextDest++ = (unsigned char) nextByte; } } } *outputMessage = (unsigned char) opcode; PutUINT(outputLength >> 2, outputMessage + 2, bigEndian_); } } if (WriteAll(fd_, writeBuffer_.getData(), writeBuffer_.getLength()) < 0) return 0; else return 1; } void ServerChannel:: setBigEndian(int flag) { bigEndian_ = flag; readBuffer_.setBigEndian(flag); } void ServerChannel::encodeCharInfo_(const unsigned char *nextSrc, EncodeBuffer & encodeBuffer) { unsigned int value = GetUINT(nextSrc, bigEndian_) | (GetUINT(nextSrc + 10, bigEndian_) << 16); encodeBuffer.encodeCachedValue(value, 32, *serverCache_.queryFontCharInfoCache[0], 6); nextSrc += 2; for (unsigned int i = 1; i < 5; i++) { unsigned int value = GetUINT(nextSrc, bigEndian_); nextSrc += 2; encodeBuffer.encodeCachedValue(value, 16, *serverCache_. queryFontCharInfoCache[i], 6); } } dxpc-3.9.2/ServerChannel.H0000644000175000017530000000221010560644754014730 0ustar kvigorkvigor#ifndef ServerChannel_H # define ServerChannel_H # include "Channel.H" # include "ServerReadBuffer.H" # include "WriteBuffer.H" # include "ClientCache.H" # include "ServerCache.H" # include "SequenceNumQueue.H" # include "Stats.H" # include "Decompresser.H" class ServerChannel:public Channel { public: ServerChannel(int xServerFD, unsigned int statisticsLevel); virtual ~ ServerChannel(); virtual int doRead(EncodeBuffer &); virtual int doWrite(const unsigned char *message, unsigned int length); void setBigEndian(int flag); protected: void encodeCharInfo_(const unsigned char *nextSrc, EncodeBuffer &); ServerReadBuffer readBuffer_; int fd_; WriteBuffer writeBuffer_; int firstRequest_; int firstReply_; ClientCache clientCache_; ServerCache serverCache_; SequenceNumQueue sequenceNumQueue_; int bigEndian_; unsigned int imageByteOrder_; unsigned int bitmapBitOrder_; unsigned int scanlineUnit_; unsigned int scanlinePad_; unsigned int statisticsLevel_; Stats stats_; Stats replyStats_; Decompresser *decompresser; }; #endif /* ServerChannel_H */ dxpc-3.9.2/config.guess0000755000175000017530000012513210560644754014411 0ustar kvigorkvigor#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. timestamp='2005-02-10' # This file 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 of the License, 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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 Per Bothner . # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you # don't specify an explicit build system type. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit 0 ;; --version | -v ) echo "$version" ; exit 0 ;; --help | --h* | -h ) echo "$usage"; exit 0 ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep __ELF__ >/dev/null then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit 0 ;; amd64:OpenBSD:*:*) echo x86_64-unknown-openbsd${UNAME_RELEASE} exit 0 ;; amiga:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; cats:OpenBSD:*:*) echo arm-unknown-openbsd${UNAME_RELEASE} exit 0 ;; hp300:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; luna88k:OpenBSD:*:*) echo m88k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mac68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; macppc:OpenBSD:*:*) echo powerpc-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvme68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvme88k:OpenBSD:*:*) echo m88k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvmeppc:OpenBSD:*:*) echo powerpc-unknown-openbsd${UNAME_RELEASE} exit 0 ;; sgi:OpenBSD:*:*) echo mips64-unknown-openbsd${UNAME_RELEASE} exit 0 ;; sun3:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; *:OpenBSD:*:*) echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} exit 0 ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit 0 ;; macppc:MirBSD:*:*) echo powerppc-unknown-mirbsd${UNAME_RELEASE} exit 0 ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit 0 ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit 0 ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit 0 ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit 0 ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit 0;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit 0 ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit 0 ;; *:OS/390:*:*) echo i370-ibm-openedition exit 0 ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit 0 ;; *:OS400:*:*) echo powerpc-ibm-os400 exit 0 ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit 0;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit 0;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit 0 ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit 0 ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit 0 ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7 && exit 0 ;; esac ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; i86pc:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit 0 ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit 0 ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit 0 ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit 0 ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit 0 ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit 0 ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit 0 ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit 0 ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit 0 ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit 0 ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit 0 ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit 0 ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit 0 ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c \ && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ && exit 0 echo mips-mips-riscos${UNAME_RELEASE} exit 0 ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit 0 ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit 0 ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit 0 ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit 0 ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit 0 ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit 0 ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit 0 ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit 0 ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit 0 ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit 0 ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit 0 ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit 0 ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit 0 ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit 0 ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit 0 ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 echo rs6000-ibm-aix3.2.5 elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit 0 ;; *:AIX:*:[45]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit 0 ;; *:AIX:*:*) echo rs6000-ibm-aix exit 0 ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit 0 ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit 0 ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit 0 ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit 0 ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit 0 ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit 0 ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then # avoid double evaluation of $set_cc_for_build test -n "$CC_FOR_BUILD" || eval $set_cc_for_build if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit 0 ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit 0 ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 echo unknown-hitachi-hiuxwe2 exit 0 ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit 0 ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit 0 ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit 0 ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit 0 ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit 0 ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit 0 ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit 0 ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit 0 ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit 0 ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit 0 ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit 0 ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit 0 ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit 0 ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit 0 ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit 0 ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:FreeBSD:*:*) echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit 0 ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit 0 ;; i*:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit 0 ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit 0 ;; x86:Interix*:[34]*) echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//' exit 0 ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit 0 ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit 0 ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit 0 ;; amd64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit 0 ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit 0 ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit 0 ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit 0 ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit 0 ;; arm*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; cris:Linux:*:*) echo cris-axis-linux-gnu exit 0 ;; crisv32:Linux:*:*) echo crisv32-axis-linux-gnu exit 0 ;; frv:Linux:*:*) echo frv-unknown-linux-gnu exit 0 ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; mips:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips #undef mipsel #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mipsel #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 ;; mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef mips64 #undef mips64el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=mips64el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=mips64 #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit 0 ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit 0 ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit 0 ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit 0 ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit 0 ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit 0 ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit 0 ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent # problems with other programs or directories called `ld' in the path. # Set LC_ALL=C to ensure ld outputs messages in English. ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ | sed -ne '/supported targets:/!d s/[ ][ ]*/ /g s/.*supported targets: *// s/ .*// p'` case "$ld_supported_targets" in elf32-i386) TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" exit 0 ;; coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit 0 ;; "") # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. echo "${UNAME_MACHINE}-pc-linux-gnuoldld" exit 0 ;; esac # Determine whether the default compiler is a.out or elf eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 LIBC=gnu # else LIBC=gnulibc1 # endif # else LIBC=gnulibc1 # endif #else #ifdef __INTEL_COMPILER LIBC=gnu #else LIBC=gnuaout #endif #endif #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit 0 ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit 0 ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit 0 ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit 0 ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit 0 ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit 0 ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit 0 ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit 0 ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit 0 ;; i*86:*:5:[78]*) case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit 0 ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit 0 ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i386. echo i386-pc-msdosdjgpp exit 0 ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit 0 ;; paragon:*:*:*) echo i860-intel-osf1 exit 0 ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit 0 ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit 0 ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit 0 ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit 0 ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && echo i486-ncr-sysv4.3${OS_REL} && exit 0 /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && echo i486-ncr-sysv4 && exit 0 ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit 0 ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit 0 ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit 0 ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit 0 ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit 0 ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit 0 ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit 0 ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit 0 ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit 0 ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit 0 ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit 0 ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit 0 ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit 0 ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit 0 ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit 0 ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit 0 ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit 0 ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit 0 ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit 0 ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit 0 ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit 0 ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit 0 ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in *86) UNAME_PROCESSOR=i686 ;; unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit 0 ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit 0 ;; *:QNX:*:4*) echo i386-pc-qnx exit 0 ;; NSE-?:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit 0 ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit 0 ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit 0 ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit 0 ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit 0 ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit 0 ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit 0 ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit 0 ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit 0 ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit 0 ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit 0 ;; *:ITS:*:*) echo pdp10-unknown-its exit 0 ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit 0 ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit 0 ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms && exit 0 ;; I*) echo ia64-dec-vms && exit 0 ;; V*) echo vax-dec-vms && exit 0 ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit 0 ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0 # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit 0 ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit 0 ;; c34*) echo c34-convex-bsd exit 0 ;; c38*) echo c38-convex-bsd exit 0 ;; c4*) echo c4-convex-bsd exit 0 ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: dxpc-3.9.2/install-sh0000755000175000017530000002202110560644754014066 0ustar kvigorkvigor#!/bin/sh # install - install a program, script, or datafile scriptversion=2005-02-02.21 # 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. It can only install one file at a time, a restriction # shared with many OS's install programs. # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" chmodcmd="$chmodprog 0755" chowncmd= chgrpcmd= stripcmd= rmcmd="$rmprog -f" mvcmd="$mvprog" src= dst= dir_arg= dstarg= 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: -c (ignored) -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. --help display this help and exit. --version display version info and exit. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test -n "$1"; do case $1 in -c) shift continue;; -d) dir_arg=true shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; --help) echo "$usage"; exit $?;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -s) stripcmd=$stripprog shift continue;; -t) dstarg=$2 shift shift continue;; -T) no_target_directory=true shift continue;; --version) echo "$0 $scriptversion"; exit $?;; *) # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. test -n "$dir_arg$dstarg" && break # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dstarg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dstarg" shift # fnord fi shift # arg dstarg=$arg done break;; esac done if test -z "$1"; 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 for src do # Protect names starting with `-'. case $src in -*) src=./$src ;; esac if test -n "$dir_arg"; then dst=$src src= if test -d "$dst"; then mkdircmd=: chmodcmd= else mkdircmd=$mkdirprog fi 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 "$dstarg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dstarg # 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: $dstarg: Is a directory" >&2 exit 1 fi dst=$dst/`basename "$src"` fi fi # This sed command emulates the dirname command. dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'` # Make sure that the destination directory exists. # Skip lots of stat calls in the usual case. if test ! -d "$dstdir"; then defaultIFS=' ' IFS="${IFS-$defaultIFS}" oIFS=$IFS # Some sh's can't handle IFS=/ for some reason. IFS='%' set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` shift IFS=$oIFS pathcomp= while test $# -ne 0 ; do pathcomp=$pathcomp$1 shift if test ! -d "$pathcomp"; then $mkdirprog "$pathcomp" # mkdir can fail with a `File exist' error in case several # install-sh are creating the directory concurrently. This # is OK. test -d "$pathcomp" || exit fi pathcomp=$pathcomp/ done fi if test -n "$dir_arg"; then $doit $mkdircmd "$dst" \ && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } else dstfile=`basename "$dst"` # 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 trap '(exit $?); exit' 1 2 13 15 # Copy the file name to the temp name. $doit $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 "$dsttmp"; } && # Now rename the file to the real destination. { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 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. { if test -f "$dstdir/$dstfile"; then $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ || { echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 (exit 1); exit 1 } else : fi } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" } } fi || { (exit 1); exit 1; } done # The final little trick to "correctly" pass the exit status to the exit trap. { (exit 0); 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: dxpc-3.9.2/dxpc.man0000644000175000017530000002636010560667560013527 0ustar kvigorkvigor.TH DXPC 1 "February 2, 2007" "dxpc" .ad b .SH NAME dxpc - Differential X Protocol Compressor .SH RELEASE 3.9.1 .SH SYNOPSIS .BR dxpc \fB[common] [client | server] [connect]\fR .br \fB[common]\fR options are: .br -p \fIport_num\fR -f -k -v -s \fIdebug_level\fR -l \fIlog_file\fR .br \fB[client]\fR options (valid for CLIENT process) are: .br -i \fIcompression_lvl\fR -d \fIdisplay_num\fR -u .br \fB[server]\fR options (valid for SERVER process) are: .br -D \fIdisplay\fR -b(a|w) .br \fB[connect]\fR options are: .br \fIhostname\fR -w .SH DESCRIPTION \fBdxpc\fR is an X protocol compressor designed to improve the speed of X11 applications run over low-bandwidth links (such as dialup PPP connections). .sp dxpc must be run at both ends of a low-bandwidth link. On the host where the real X server is, dxpc runs in "Server Proxy" mode. On the host at the other end of the link, dxpc runs in "Client Proxy" mode. The Client Proxy dxpc must be started first. When the Server Proxy dxpc is started, it connects to the Client Proxy. (Note that versions of dxpc before 3.3.1 used the opposite convention.) If either of the two communicating dxpc instances is subsequently terminated, the other one automatically shuts down. .sp The Client Proxy mimics an X server. X client applications connect to the Client Proxy using display "unix:8" (or ":8"; dxpc supports both UNIX domain and TCP sockets). The Client Proxy receives X requests from the application, compresses them, and sends them to the Server Proxy. The Server Proxy uncompresses the requests and sends them to the real X server. Similarly, the Server Proxy receives X events, replies, and errors from the real X server. It compresses these messages and sends them to the Client Proxy, which uncompresses them and sends them to the client application. .sp The compression performance of dxpc depends upon the types of X applications being run. For many applications, dxpc achieves between 3:1 and 6:1 compression of the X protocol traffic. .sp .SH MODES dxpc has two modes; the connection mode, which is either \fIlistening\fR or \fIconnecting\fR; and the X mode, which is either \fIclient\fR or \fIserver\fR. .sp The \fIlistening\fR process waits for a \fIconnecting\fR process to initiate the TCP connection between the two processes. The \fIlistening\fR process must always be started first. The \fIconnecting\fR process initiates the connection to the \fIlistening\fR process. dxpc will run as the \fIconnecting\fR process if a hostname argument is supplied (see connect options, above). Otherwise it will run as the \fIlistening\fR process. .sp The \fIserver\fR process is typically located on the same machine as the real X server, and is responsible for displaying the output of applications. The \fIclient\fR process is typically located on the same machine as the X applications, and is responsible for forwarding the output of those applications to the \fIserver\fR process. By default, dxpc runs as the \fIclient\fR process if it is the \fIlistening\fR process (due to the lack of a hostname argument) and the \fIserver\fR process if it is the \fIconnecting\fR process, but the -w switch reverses this. .sp For example, the command \fBdxpc myhost.work.com\fR starts dxpc as the \fIconnecting\fR process (because a host name is supplied) and the \fIserver\fR process (because it is the \fIconnecting\fR process and -w is not supplied). The command \fBdxpc -w\fR starts dxpc as the \fIlistening\fR process (because no hostname is supplied) and the \fIserver\fR process (because it is the \fIlistening\fR process, and -w reverses the usual logic). .sp .SH Options .TP 12 .B -b(a|w) This option specifies that any windows created should be created with the BackingStore option set to Always (\fB-ba\fR) or WhenMapped (\fB-bw\fR), if the application has not set the option itself. Using the BackingStore option will reduce traffic to repaint exposed regions of the window, at the cost of extra memory use in the X server itself. (This option is ignored in Client Proxy mode.) .B NOTE: The \fB-ba\fR option can cause Expose events to be sent before the client has mapped its windows. This can confuse some client programs, notably GNU Emacs version 20.3. The "bug" in this case is that dxpc shouldn't be setting BackingStore to Always behind the application's back. Neverless, the option is available, if you want to try it; many client programs still function fine with it, and it will cause the contents of iconified windows to be retained. .TP 12 .B -d \fIdisplaynum\fR This option specifies the number of the X display that dxpc imitates. The default value is 8. (This option is ignored in Server Proxy mode.) .TP 12 .B -f This option tells dxpc to fork and run as a daemon process. All subsequent non-error output is suppressed, including statistics reports. The daemon can be killed by use of the \fB-k\fR option. .TP 12 .B -k This option tells dxpc to read a pid from the lockfile in the user's home directory and then send a SIGKILL to the old process. It does some error checking to try to ensure that the file contains a valid pid file (and nothing else). The pidfile will exist only if dxpc was started with the \fB-f\fR option. .TP 12 .B -l This option is used to tell dxpc to write messages and statistics to a logfile. Very useful with the \fB-f\fR option. .TP 12 .B -p \fIportnumber\fR This option specifies the TCP port number to be used for communication between the Client Proxy and the Server Proxy. The default value is 4000. .TP 12 .B -s(1|2) Print a report on dxpc's compression performance for an X application when the application exits. In Client Proxy mode, dxpc displays a report on the compression of messages generated by the X client. In Server Proxy mode, dxpc displays a report on the compression of messages generated by the X server. The \fB-s1\fR option yields a simple report that provides the overall compression ratio. The \fB-s2\fR option yields a far more detailed report on the compression ratios achieved for all the individual message types in the X protocol. The \fB-s2\fR option is the "hacker option"; most people will probably want the \fB-s1\fR report instead. .TP 12 .B "-u -t" Normally, dxpc in Client Proxy mode imitates an X display, :8 by default, by listening on both a UNIX domain socket and a TCP socket. The \fB-u\fR option tells it not to use the UNIX domain port, and the \fB-t\fR option tells it not to use the TCP port. (These options are ignored in Server Proxy mode.) .TP 12 .B "-v" This option tells dxpc to print out its version number and copyright message and exit. .TP 12 .B "-w" Use of this option swaps the connection sequence. That is, the client will initiate the connection to the server. Thus, instead of starting the client like \fBdxpc -f\fR and the server as \fBdxpc -f workserver\fR, you can start the client as \fBdxpc -w -f homepc\fR and the server as \fBdxpc -w -f\fR. This option is intended to be useful for people running the client proxy on a machine behind a firewall. .TP 12 .B \fIhostname\fR This argument must be used in Server Proxy mode to tell dxpc the hostname or IP address of the machine where other dxpc (the one in Client Proxy mode) is running. (Note that the presence of this argument is what puts dxpc in Server Proxy mode. If this argument is not used, dxpc runs in Client Proxy mode.) .TP 12 .B "-D display" Specify X host on which to display proxied applications. Defaults to value of the DISPLAY environment variable. .TP 12 .B "-i(0..9|99|999)" This option controls bitmap image compression. This option is only valid on the instance which is accepting connections; usually this is the client, but the -w option will reverse this, making the -i option valid only on the server. The specified number is the image compression level; higher levels offer better compression at the cost of greater CPU and memory utilization (mostly on the client proxy). The actual behavior of each level is given below. 0 : No compression (except for the very limited compression supported in dxpc 3.7.0). In other words, behaves like 3.7.0 (but is incompatible with it) 1 : LZO lzo1x_1 compression; very fast, low CPU and memory use, reasonable compression. 2-9: LZO lzo1c_... variant compression algorithms. lzo1c_2 actually seems to be worse than lzo1x_1... 99: LZO lzo1c_99 algorithm. Slow, but pretty good compression. NB: I have seen a couple of unexplained crashes when using this level. Not recommended. 999: LZO lzo1x_999 compression. Slow (but fast enough to feed a 128K ISDN link when hosted on a Pentium II/300 without maxing out the processor), but good compression. This is the default and recommended value. .SH EXAMPLES Assume that you're running a real X server on the console of a local workstation called homepc, and that you want to run some X applications on a remote system called workserver and have them display on the console of the local system. .sp On workserver, run .nf $ export DISPLAY=homepc:0 $ dxpc -f $ export DISPLAY=unix:8 .fi On homepc, run .nf $ export DISPLAY=unix:0 $ dxpc -f workserver .fi Now on workserver, .nf $ xterm& $ xemacs& etc... .fi .SH "DXPC AND XAUTH" If you use X authorization, with a .Xauthority file on the workstation where your real X server runs, you'll need to set up a .Xauthority file on the host where the ClientProxy runs. One way to do this is: .sp Copy your ~/.Xauthority file from the host where the real X server runs to the host where the Client Proxy runs. .sp Run .nf xauth list .fi to see the authorization keys. There should be one for your real X display. It will look something like this: .nf /unix:0 MIT-MAGIC-COOKIE-1 .fi On the host where the Client Proxy is located, add a new entry to the .Xauthority file with the display name of the fake X server (the DISPLAY where the Client Proxy is listening) and all of the other values from the entry for the real X display. The xauth "add" command can be used, like this: .nf xauth add /unix:8 MIT-MAGIC-COOKIE-1 .fi where is the name of the host where the Client Proxy is running and has the same value as the obtained for the real X display in step 2. Once you do this, you should be able to run X clients through dxpc successfully. .SH TROUBLESHOOTING .B "Some windows don't appear." This can happen if the \fB-ba\fR option is used, and a client program (such as GNU Emacs version 20.3) does not request backing store and thus assumes that Expose events imply that the window has been mapped. Use \fB-bw\fR, or leave out the \fB-b\fR option altogether. .B "No windows appear." This can happen if you are using a newer version of dxpc with an older one, from before the client and server roles were changed. A connection can be established between them, but both sides believe themselves to be the client side, or both sides believe themselves to be the server side. Make sure you're using the same version of dxpc at both ends of the connection. .SH AUTHOR Brian Pane .SH MAINTAINER Kevin Vigor (kevin@vigor.nu) .SH ACKNOWLEDGMENTS \fBdxpc\fR has adopted many good ideas from the \fBHBX\fR and \fBFHBX\fR systems (http://www.cs.dartmouth.edu/~jmd/decs/DECSpage.html). .sp Thanks to all of the users of dxpc who have contributed feedback and suggestions. .SH SEE ALSO xauth(1), README file from dxpc distribution dxpc-3.9.2/config.sub0000755000175000017530000007540710560644754014065 0ustar kvigorkvigor#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. timestamp='2005-02-10' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file 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 of the License, 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., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, 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. # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit 0 ;; --version | -v ) echo "$version" ; exit 0 ;; --help | --h* | -h ) echo "$usage"; exit 0 ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit 0;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \ kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray) os= basic_machine=$1 ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | m32r | m32rle | m68000 | m68k | m88k | maxq | mcore \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64vr | mips64vrel \ | mips64orion | mips64orionel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | msp430 \ | ns16k | ns32k \ | openrisc | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv8 | sparcv9 | sparcv9b \ | strongarm \ | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ | we32k \ | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* \ | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64vr-* | mips64vrel-* \ | mips64orion-* | mips64orionel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | msp430-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \ | xstormy16-* | xtensa-* \ | ymp-* \ | z8k-*) ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; c90) basic_machine=c90-cray os=-unicos ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16c) basic_machine=cr16c-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; mvs) basic_machine=i370-ibm os=-mvs ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; or32 | or32-*) basic_machine=or32-unknown os=-coff ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff ;; tic55x | c55x*) basic_machine=tic55x-unknown os=-coff ;; tic6x | c6x*) basic_machine=tic6x-unknown os=-coff ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sh64) basic_machine=sh64-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -kaos*) os=-kaos ;; -zvmoe) os=-zvmoe ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: dxpc-3.9.2/Multiplexer.C0000644000175000017530000001753510560644754014516 0ustar kvigorkvigor#include "dxpcconf.h" #include #include #include #include #include #include "Multiplexer.H" #include "Channel.H" #include "util.H" extern int silent; Multiplexer::Multiplexer(int proxyFD): proxyFD_(proxyFD), proxyReadBuffer_(proxyFD), proxyInputChannel_(-1), proxyOutputChannel_(-1) { for (unsigned int i = 0; i < MAX_CONNECTIONS; i++) channels_[i] = 0; } Multiplexer::~Multiplexer() { for (unsigned int i = 0; i < MAX_CONNECTIONS; i++) delete channels_[i]; } // Add the file descriptors for this multiplexer's X connections // to the supplied select set void Multiplexer::setSelectFDs(fd_set * fdSet, unsigned int &max) { int numFDsToSelect = max; for (unsigned int i = 0; i < MAX_CONNECTIONS; i++) if (channels_[i] != 0) { int nextFD = channelIDToFD(i); // CERR << "Multiplexer::setSelectFDs setting " << nextFD << ENDL; FD_SET(nextFD, fdSet); if (nextFD >= numFDsToSelect) numFDsToSelect = nextFD + 1; } max = numFDsToSelect; } int Multiplexer::handleSelect(int fd) { unsigned char controlMessages[9]; unsigned int controlMessagesLength = 0; encodeBuffer_.reset(); if (fd == proxyFD_) { // Data arrived from peer proxy if (!proxyReadBuffer_.doRead()) { if (!silent) { CERR << "lost connection to peer proxy" << ENDL; } return 0; } const unsigned char *message; unsigned int messageLength; while ((message = proxyReadBuffer_.getMessage(messageLength)) != 0) { if ((messageLength == 3) && (message[0] == 0)) { if (message[1] == (unsigned char) CTRL_NEW_CONNECTION) { int channelNum = (int) message[2]; if (!createNewConnectionFromProxy(channelNum)) { controlMessages[controlMessagesLength++] = 0; controlMessages[controlMessagesLength++] = (unsigned char) CTRL_DROP_CONNECTION; controlMessages[controlMessagesLength++] = (unsigned char) channelNum; } } else if (message[1] == (unsigned char) CTRL_DROP_CONNECTION) { int channelNum = (int) message[2]; if (((unsigned int) channelNum < MAX_CONNECTIONS) && (channels_[channelNum] != 0)) { SOCKCLOSE(channelIDToFD(channelNum)); delete channels_[channelNum]; channels_[channelNum] = 0; cleanupChannelFDMapping(channelNum); } } else if (message[1] == (unsigned char) CTRL_SWITCH_CONNECTION) { proxyInputChannel_ = (int) message[2]; } else { CERR << "invalid message from peer proxy!" << ENDL; return 0; } } else { int channelNum = proxyInputChannel_; if ((channelNum >= 0) && ((unsigned int) channelNum < MAX_CONNECTIONS) && (channels_[channelNum] != 0)) { if (!channels_[channelNum]-> doWrite(message, messageLength)) { SOCKCLOSE(channelIDToFD(channelNum)); delete channels_[channelNum]; channels_[channelNum] = 0; cleanupChannelFDMapping(channelNum); controlMessages[controlMessagesLength++] = 0; controlMessages[controlMessagesLength++] = (unsigned char) CTRL_DROP_CONNECTION; controlMessages[controlMessagesLength++] = (unsigned char) channelNum; } } } } } else { // Data arrived from some X connection int channelNum = fdToChannelID(fd); if ((channelNum < 0) || (channels_[channelNum] == 0)) { SOCKCLOSE(fd); return 1; } // CERR << "data received on X channel " << channelNum << ENDL; // Let the channel object read all the new data from its // file descriptor, isolate messages, compress those messages, // and append the compressed form to the encodeBuffer_ if (!channels_[channelNum]->doRead(encodeBuffer_)) { SOCKCLOSE(fd); delete channels_[channelNum]; channels_[channelNum] = 0; cleanupChannelFDMapping(channelNum); // Send channel shutdown message to the peer proxy controlMessages[controlMessagesLength++] = 0; controlMessages[controlMessagesLength++] = (unsigned char) CTRL_DROP_CONNECTION; controlMessages[controlMessagesLength++] = (unsigned char) channelNum; } // Generate a control message to the peer proxy to tell it that // we're now sending data for a different channel else if (channelNum != proxyOutputChannel_) { proxyOutputChannel_ = channelNum; controlMessages[controlMessagesLength++] = 0; controlMessages[controlMessagesLength++] = (unsigned char) CTRL_SWITCH_CONNECTION; controlMessages[controlMessagesLength++] = (unsigned char) channelNum; } } // write any outstanding control messages, followed by any outstanding // compressed X messages, to proxyFD... // This code assumes that "encodeBuffer_.getData()" actually references // a location offset several bytes from the start of the buffer, so that // the length header and any necessary control messages can be inserted // in front of the data already in the buffer. (See EncodeBuffer.C.) // This is an ugly hack, but it's the easiest way to encapsulate the // header and message data together in a single write(2) call. // (Experimentation has shown that doing separate writes for the // header and the data causes the responsiveness of applications // run over dxpc to deteriorate enormously.) unsigned int dataLength = encodeBuffer_.getDataLength(); if (dataLength + controlMessagesLength != 0) { unsigned char temp[5]; unsigned int lengthLength = 0; unsigned int length = dataLength; while (length) { temp[lengthLength++] = (unsigned char) (length & 0x7f); length >>= 7; } unsigned char *data = encodeBuffer_.getData(); unsigned char *outputMessage = data - (controlMessagesLength + lengthLength); unsigned int outputLength = dataLength + controlMessagesLength + lengthLength; unsigned char *nextDest = outputMessage; for (unsigned int i = 0; i < controlMessagesLength; i++) *nextDest++ = controlMessages[i]; for (int j = lengthLength - 1; j > 0; j--) *nextDest++ = (temp[j] | 0x80); if (lengthLength) *nextDest++ = temp[0]; if ((dataLength != 0) && (proxyOutputChannel_ >= 0) && ((unsigned int) proxyOutputChannel_ < MAX_CONNECTIONS) && (channels_[proxyOutputChannel_] != NULL)) channels_[proxyOutputChannel_]->recordFramingBits((controlMessagesLength + lengthLength) << 3); if (WriteAll(proxyFD_, outputMessage, outputLength) <= 0) return 0; } return 1; } dxpc-3.9.2/Multiplexer.H0000644000175000017530000000232710560644754014514 0ustar kvigorkvigor#ifndef Multiplexer_H # define Multiplexer_H # include # ifdef _AIX # include # endif/* _AIX */ # include "ProxyReadBuffer.H" # include "EncodeBuffer.H" # include "constants.H" class Channel; class Multiplexer { public: Multiplexer(int proxyFD); virtual ~ Multiplexer(); void setSelectFDs(fd_set *, unsigned int &max); int handleSelect(int fd); virtual void createNewConnection(int clientFD) = 0; protected: // codes used for control messages in proxy-to-proxy protocol enum ControlCode { CTRL_NEW_CONNECTION, CTRL_DROP_CONNECTION, CTRL_SWITCH_CONNECTION }; virtual int createNewConnectionFromProxy(int channelID) = 0; virtual int channelIDToFD(int channelID) const = 0; virtual int fdToChannelID(int fd) const = 0; virtual void cleanupChannelFDMapping(int channelFD) = 0; // Objects used to read data sent from peer proxy const int proxyFD_; ProxyReadBuffer proxyReadBuffer_; int proxyInputChannel_; // Objects used to send data to peer proxy EncodeBuffer encodeBuffer_; int proxyOutputChannel_; // X connections Channel *channels_[MAX_CONNECTIONS]; }; #endif /* Multiplexer_H */ dxpc-3.9.2/dxpc.spec0000644000175000017530000000354210561416170013671 0ustar kvigorkvigorSummary: A Differential X Protocol Compressor %define major 3 %define minor 9.1 Name: dxpc Version: %{major}.%{minor} Release: 1 Source: http://www.vigor.nu/dxpc/%{version}/dxpc-%{version}.tar.gz License: BSD, GPL Group: X11/XFree86/Servers Packager: Daniel Mealha Cabrita URL: http://www.vigor.nu/dxpc/ BuildRoot: %{_tmppath}/%{name}-%{version}-root Requires: lzo BuildRequires: lzo-devel %description dxpc is an X protocol compressor designed to improve the speed of X11 applications run over low-bandwidth links (such as dialup PPP connections or ADSL). %package -n %{name}-doc # BuildArch: noarch Summary: Extra documentation about dxpc Summary(pt_BR): Documentação adicional sobre a dxpc Summary(es): Extra documentation about dxpc Group: Documentation Group(pt_BR): Documentação Group(es): Documentación %description -n %{name}-doc Extra documentation on dxpc. %prep %setup -q autoconf %build %configure make %install [ "%{buildroot}" != "/" ] && rm -rf %{buildroot} make bindir=%{buildroot}%{_bindir} man1dir=%{buildroot}%{_mandir}/man1/ prefix=%{buildroot}%{_prefix} install %clean [ "%{buildroot}" != "/" ] && rm -rf %{buildroot} %files %defattr(-,root,root) %attr(755,root,root) %{_bindir}/dxpc %attr(644,root,root) %{_mandir}/man1/dxpc.1.gz %files -n %{name}-doc %defattr(0644,root,root,0755) %doc README CHANGES TODO INSTALL %changelog * Sat Jan 04 2006 Daniel Mealha Cabrita - Updated to 3.9.0 sources. - Dropped lzo2_support patch. * Mon Dec 26 2005 Daniel Mealha Cabrita - Updated to 3.8.2 sources. - Added patch lzo2_support. - Changed specfile in order to be more portable. - Fragmented packages into: dxpc and dxpc-doc. * Tue Jul 30 2002 William Stearns - updated to 3.8.1 sources, minor specfile improvements * Wed Sep 29 1999 Stefano Santoro - first attempt dxpc-3.9.2/BlockCacheSet.C0000644000175000017530000000503210560644754014623 0ustar kvigorkvigor#include "dxpcconf.h" #include "BlockCacheSet.H" BlockCacheSet::BlockCacheSet(unsigned int numCaches): caches_(new BlockCache *[numCaches]), size_(numCaches), length_(0) { for (unsigned int i = 0; i < numCaches; i++) caches_[i] = new BlockCache(); } BlockCacheSet::~BlockCacheSet() { for (unsigned int i = 0; i < size_; i++) delete caches_[i]; delete[]caches_; } int BlockCacheSet::lookup(unsigned int dataLength, const unsigned char *data, unsigned int &index) { unsigned int checksum = BlockCache::checksum(dataLength, data); for (unsigned int i = 0; i < length_; i++) if ((caches_[i]->getChecksum() == checksum) && (caches_[i]->compare(dataLength, data, 0))) { // match index = i; if (i) { BlockCache *save = caches_[i]; unsigned int target = (i >> 1); do { caches_[i] = caches_[i - 1]; i--; } while (i > target); caches_[target] = save; } return 1; } // no match unsigned int insertionPoint = (length_ >> 1); unsigned int start; if (length_ >= size_) start = size_ - 1; else { start = length_; length_++; } BlockCache *save = caches_[start]; for (unsigned int k = start; k > insertionPoint; k--) caches_[k] = caches_[k - 1]; caches_[insertionPoint] = save; save->set(dataLength, data); return 0; } void BlockCacheSet::get(unsigned index, unsigned int &size, const unsigned char *&data) { size = caches_[index]->getLength(); data = caches_[index]->getData(); if (index) { BlockCache *save = caches_[index]; unsigned int target = (index >> 1); do { caches_[index] = caches_[index - 1]; index--; } while (index > target); caches_[target] = save; } } void BlockCacheSet::set(unsigned int dataLength, const unsigned char *data) { unsigned int insertionPoint = (length_ >> 1); unsigned int start; if (length_ >= size_) start = size_ - 1; else { start = length_; length_++; } BlockCache *save = caches_[start]; for (unsigned int k = start; k > insertionPoint; k--) caches_[k] = caches_[k - 1]; caches_[insertionPoint] = save; save->set(dataLength, data); } dxpc-3.9.2/BlockCacheSet.H0000644000175000017530000000105110560644754014625 0ustar kvigorkvigor#ifndef BlockCacheSet_H # define BlockCacheSet_H # include "BlockCache.H" class BlockCacheSet { public: BlockCacheSet(unsigned int numCaches); ~BlockCacheSet(); int lookup(unsigned int size, const unsigned char *data, unsigned int &index); void get(unsigned int index, unsigned int &size, const unsigned char *&data); void set(unsigned int size, const unsigned char *data); private: BlockCache ** caches_; unsigned int size_; unsigned int length_; }; #endif /* BlockCacheSet_H */ dxpc-3.9.2/mkinstalldirs0000755000175000017530000000127610560644754014701 0ustar kvigorkvigor#! /bin/sh # mkinstalldirs --- make directory hierarchy # Author: Noah Friedman # Created: 1993-05-16 # Last modified: 1995-03-05 # Public domain errstatus=0 for file in ${1+"$@"} ; do set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` shift pathcomp= for d in ${1+"$@"} ; do pathcomp="$pathcomp$d" case "$pathcomp" in -* ) pathcomp=./$pathcomp ;; esac if test ! -d "$pathcomp"; then echo "mkdir $pathcomp" 1>&2 mkdir "$pathcomp" > /dev/null 2>&1 || lasterr=$? fi if test ! -d "$pathcomp"; then errstatus=$lasterr fi pathcomp="$pathcomp/" done done exit $errstatus dxpc-3.9.2/Compresser.C0000644000175000017530000001105510560644754014315 0ustar kvigorkvigor#include "dxpcconf.h" #include #include "X-headers.H" #include "ClientChannel.H" #include "EncodeBuffer.H" #include "DecodeBuffer.H" #include "util.H" #include #include #include "Compresser.H" typedef struct cEntry { int cLevel; lzo_compress_t cFnc; lzo_uint cWorkMem; lzo_decompress_t dFnc; } cEntry; // The table including all supported LZO algorithms. // lzo1x is the recommeded algortihm, but only comes // with two compression levels: 1 & 999. lzo1c is used to fill // in the gaps. static cEntry _knownAlgorithms[] = { {1, lzo1x_1_compress, LZO1X_MEM_COMPRESS, lzo1x_decompress}, {2, lzo1c_2_compress, LZO1C_MEM_COMPRESS, lzo1c_decompress}, {3, lzo1c_3_compress, LZO1C_MEM_COMPRESS, lzo1c_decompress}, {4, lzo1c_4_compress, LZO1C_MEM_COMPRESS, lzo1c_decompress}, {5, lzo1c_5_compress, LZO1C_MEM_COMPRESS, lzo1c_decompress}, {6, lzo1c_6_compress, LZO1C_MEM_COMPRESS, lzo1c_decompress}, {7, lzo1c_7_compress, LZO1C_MEM_COMPRESS, lzo1c_decompress}, {8, lzo1c_8_compress, LZO1C_MEM_COMPRESS, lzo1c_decompress}, {9, lzo1c_9_compress, LZO1C_MEM_COMPRESS, lzo1c_decompress}, {99, lzo1c_99_compress, LZO1C_99_MEM_COMPRESS, lzo1c_decompress}, {999, lzo1x_999_compress, LZO1X_999_MEM_COMPRESS, lzo1x_decompress}, {0, 0, 0} }; Compresser::Compresser(int compressionLevel) : lzoCompressionWorkspace(0), lzoCompressionBuffer(0), lzoCompressionBufferSize(0), compressionFnc(0) { cEntry *alg = getCEntry(compressionLevel); if (alg) { lzoCompressionWorkspace = new lzo_byte[alg->cWorkMem]; if (lzoCompressionWorkspace) { // memset here supresses valgrind warning in the bowels // of lzo. memset(lzoCompressionWorkspace, 0, alg->cWorkMem); compressionFnc = alg->cFnc; } else { *logofs << "Insufficient memory for image compression level " << compressionLevel << "\n"; } } else { *logofs << "Unknown image compression level " << compressionLevel << "\n"; } } Compresser::~Compresser() { if (lzoCompressionWorkspace) { delete[]lzoCompressionWorkspace; lzoCompressionWorkspace = 0; } if (lzoCompressionBuffer) { delete[]lzoCompressionBuffer; lzoCompressionBuffer = 0; lzoCompressionBufferSize = 0; } } CompressionType Compresser::compressBuffer(const unsigned char *buffer, const unsigned int size, EncodeBuffer & encodeBuffer) { if (!compressionFnc || !lzoCompressionWorkspace || size < 64) { return NO_STREAM_COMPRESSION; } // Algorithm stolen from LZO FAQ. unsigned int max_compressed_size = size + (size / 64) + 16 + 3; if (max_compressed_size > lzoCompressionBufferSize) { if (lzoCompressionBuffer) { delete[]lzoCompressionBuffer; } lzoCompressionBuffer = new lzo_byte[max_compressed_size]; if (lzoCompressionBuffer) { lzoCompressionBufferSize = max_compressed_size; } else { lzoCompressionBufferSize = 0; } } if (!lzoCompressionBuffer) { return NO_STREAM_COMPRESSION; } lzo_uint compressedSize = max_compressed_size; lzo_byte *compressedImage = lzoCompressionBuffer; if (compressionFnc(buffer, size, compressedImage, &compressedSize, lzoCompressionWorkspace) == LZO_E_OK) { assert(compressedSize <= max_compressed_size); assert(compressedSize <= UINT_MAX); encodeBuffer.encodeValue(LZO_COMPRESSION, COMPRESSION_TYPE_BITS); encodeBuffer.encodeValue((unsigned)compressedSize, sizeof(unsigned) * 8); encodeBuffer.encodeValue(size, sizeof(unsigned) * 8); encodeBuffer.encodeRawMem(compressedImage, compressedSize); return LZO_COMPRESSION; } return NO_STREAM_COMPRESSION; } int Compresser::isValidCompressionLevel(int compressionLevel) { return getCEntry(compressionLevel) != 0; } cEntry *Compresser::getCEntry(int compressionLevel) { cEntry *alg = _knownAlgorithms; while (alg->cLevel && alg->cLevel != compressionLevel) { alg++; } if (alg->cLevel) { return alg; } return 0; } lzo_decompress_t Compresser::getDecompresser(int compressionLevel) { cEntry *alg; alg = getCEntry(compressionLevel); if (alg) { return alg->dFnc; } return 0; } dxpc-3.9.2/Compresser.H0000644000175000017530000000221610560644754014321 0ustar kvigorkvigor#ifndef COMPRESSER_H_ # define COMPRESSER_H_ # ifdef LZO2 # include "lzo/lzo1x.h" # include "lzo/lzo1c.h" # else # include "lzo1x.h" # include "lzo1c.h" # endif class EncodeBuffer; struct cEntry; typedef enum { NO_STREAM_COMPRESSION = 0, LZO_COMPRESSION = 1 } CompressionType; // Number of bits needed to hold an enum value. # define COMPRESSION_TYPE_BITS 1 class Compresser { public: Compresser(int compressionLevel); ~Compresser(); CompressionType compressBuffer(const unsigned char *buffer, const unsigned int size, EncodeBuffer & encodeBuffer); // These next two things really belong in a factory class that // builds compressers & decompressers based on the compression // level. But I'm lazy. static int isValidCompressionLevel(int compressionLevel); static lzo_decompress_t getDecompresser(int compressionLevel); private: lzo_byte * lzoCompressionWorkspace; lzo_byte *lzoCompressionBuffer; lzo_uint lzoCompressionBufferSize; lzo_compress_t compressionFnc; static cEntry *getCEntry(int compressionLevel); }; #endif dxpc-3.9.2/Makefile.in0000644000175000017530000000465710560644754014146 0ustar kvigorkvigorCXX = @CXX@ CXXFLAGS = @CXXFLAGS@ @DEFS@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ @X_LIBS@ @X_EXTRA_LIBS@ EXEEXT = @EXEEXT@ MINGW32 = @MINGW32@ srcdir = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ man1dir = @mandir@/man1 VPATH = @srcdir@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ .SUFFIXES: .C # We may have separate source and binary trees -- make sure we can find # dxpcconf.h CPPFLAGS = -I. .C.o: $(CXX) $(CPPFLAGS) -c $(CXXFLAGS) $< TARGET= dxpc$(EXEEXT) # The mingw build results in two targets, the console mode and windows mode # app. ifeq ($(MINGW32),true) SECONDTARGET = dxpc-win32$(EXEEXT) else SECONDTARGET = endif all: $(TARGET) $(SECONDTARGET) pure: pure_$(TARGET) quantify: quant_$(TARGET) SRCS= main.C util.C constants.C Stats.C \ Multiplexer.C ClientMultiplexer.C ServerMultiplexer.C \ ClientChannel.C ServerChannel.C ReadBuffer.C \ ProxyReadBuffer.C ClientReadBuffer.C ServerReadBuffer.C \ EncodeBuffer.C DecodeBuffer.C WriteBuffer.C \ IntCache.C CharCache.C PixelCache.C HuffmanCoder.C \ ClientCache.C ServerCache.C \ TextCompressor.C LastPixels.C SequenceNumQueue.C \ BlockCache.C BlockCacheSet.C Compresser.C Decompresser.C OBJS= $(SRCS:.C=.o) $(TARGET): $(OBJS) $(CXX) $(CPPFLAGS) $(CXXFLAGS) -o $@ $(OBJS) $(LDFLAGS) $(LIBS) ifeq ($(MINGW32),true) $(SECONDTARGET): $(OBJS) $(CXX) -mwindows $(CPPFLAGS) $(CXXFLAGS) -o $@ $(OBJS) $(LDFLAGS) $(LIBS) endif pure_$(TARGET): $(OBJS) purify $(CXX) $(CPPFLAGS) $(CXXFLAGS) -o $@ $(OBJS) $(LDFLAGS) $(LIBS) quant_$(TARGET): $(OBJS) $(OBJS) quantify $(CXX) $(CPPFLAGS) $(CXXFLAGS) -o $@ $(OBJS) $(LDFLAGS) $(LIBS) depends: makedepend -f Makefile $(SRCS) install: install.bin install.man install.bin: $(TARGET) $(srcdir)/mkinstalldirs $(bindir) $(INSTALL) $(TARGET) $(bindir)/$(TARGET) install.man: $(srcdir)/mkinstalldirs $(man1dir) $(INSTALL_DATA) $(TARGET).man $(man1dir)/$(TARGET).1 clean: -rm -f *~ *.o $(TARGET) pure_* quant_* *.bak core gmon.out distclean: clean -rm -f config.status config.log config.cache Makefile tags dxpcconf.h -rm -rf autom4te.cache # gnu indent v2.2.9 has a nasty bug whereby a const method ends up with a # "const const" modifier. indent: indent -bad -bap -bl -bli0 -cdw -i4 -npcs -npsl -nut -ppi1 *.C *.H for f in *.C *.H; do sed "s/const const/const/" $$f >$$f.fixed.$$$$ && cp $$f.fixed.$$$$ $$f; done rm -f *.fixed.$$$$ dxpc-3.9.2/WriteBuffer.C0000644000175000017530000000203510560644754014415 0ustar kvigorkvigor#include #include #include #include #include "WriteBuffer.H" WriteBuffer::WriteBuffer(unsigned int size) : bufferSize_(size), numBytesInBuffer_(0), buffer_(new unsigned char[size]), index_(NULL) { memset(buffer_, 0, size); } WriteBuffer::~WriteBuffer() { delete[]buffer_; } unsigned char *WriteBuffer::addMessage(unsigned int numBytes) { if (numBytesInBuffer_ + numBytes > bufferSize_) { unsigned int indexOffset = 0; if (index_ && *index_) indexOffset = *index_ - buffer_; bufferSize_ = numBytesInBuffer_ + numBytes; unsigned char *newBuffer = new unsigned char[bufferSize_]; memset(newBuffer, 0, bufferSize_); memcpy(newBuffer, buffer_, numBytesInBuffer_); delete[]buffer_; buffer_ = newBuffer; if (index_ && *index_) *index_ = buffer_ + indexOffset; } unsigned char *result = buffer_ + numBytesInBuffer_; numBytesInBuffer_ += numBytes; return result; } dxpc-3.9.2/WriteBuffer.H0000644000175000017530000000130410560644754014420 0ustar kvigorkvigor#ifndef WriteBuffer_H # define WriteBuffer_H class WriteBuffer { public: WriteBuffer(unsigned int size = 1024); ~WriteBuffer(); unsigned char *addMessage(unsigned int numBytes); unsigned char *getData() { return buffer_; } unsigned int getLength() const { return numBytesInBuffer_; } void reset() { numBytesInBuffer_ = 0; } void registerPointer(unsigned char **ptr) { index_ = ptr; } void unregisterPointer() { index_ = 0; } private: unsigned int bufferSize_; unsigned int numBytesInBuffer_; unsigned char *buffer_; unsigned char **index_; }; #endif /* WriteBuffer_H */ dxpc-3.9.2/ReadBuffer.C0000644000175000017530000000440610560644754014202 0ustar kvigorkvigor#include "dxpcconf.h" #include #include #include #include "ReadBuffer.H" static const unsigned int INITIAL_BUFFER_SIZE = 512; ReadBuffer::ReadBuffer(int fd, unsigned int maxReadSize) : fd_(fd), buffer_(new unsigned char[INITIAL_BUFFER_SIZE]), length_(0), size_(INITIAL_BUFFER_SIZE), start_(0), maxReadSize_(maxReadSize) { memset(buffer_, 0, INITIAL_BUFFER_SIZE); } ReadBuffer::~ReadBuffer() { delete[]buffer_; } int ReadBuffer::doRead() { if ((start_ != 0) && (length_ != 0)) { // if any bytes are left over from last time (due to partial message), // shift them to the start of the buffer unsigned char *nextDest = buffer_; unsigned char *nextSrc = buffer_ + start_; for (unsigned int i = 0; i < length_; i++) *nextDest++ = *nextSrc++; } else if (length_ == size_) { // The buffer is full; double its size so that we can read some more unsigned char *newBuffer = new unsigned char[size_ << 1]; memset(newBuffer, 0, size_ << 1); memcpy(newBuffer, buffer_, size_); delete[]buffer_; buffer_ = newBuffer; size_ <<= 1; } start_ = 0; // Read as much data as is available unsigned int readLength = size_ - length_; if (maxReadSize_ && (readLength > maxReadSize_)) readLength = maxReadSize_; int bytesRead = SOCKREAD(fd_, buffer_ + length_, readLength); if (bytesRead <= 0) return 0; length_ += bytesRead; return 1; } const unsigned char *ReadBuffer::getMessage(unsigned int &messageLength) { unsigned int headerLength, dataLength, trailerLength; if (locateMessage(buffer_ + start_, buffer_ + start_ + length_, headerLength, dataLength, trailerLength)) { const unsigned char *result = buffer_ + start_; messageLength = dataLength; if (dataLength) result += headerLength; else messageLength += headerLength; start_ += (headerLength + dataLength + trailerLength); length_ -= (headerLength + dataLength + trailerLength); return result; } else { // No more complete messages remain in buffer return NULL; } } dxpc-3.9.2/ReadBuffer.H0000644000175000017530000000133510560644754014205 0ustar kvigorkvigor#ifndef ReadBuffer_H # define ReadBuffer_H class ReadBuffer { public: ReadBuffer(int fd, unsigned int maxReadSize = 0); virtual ~ ReadBuffer(); int doRead(); const unsigned char *getMessage(unsigned int &dataLength); protected: virtual int locateMessage(const unsigned char *start, const unsigned char *end, unsigned int &headerLength, unsigned int &dataLength, unsigned int &trailerLength) = 0; int fd_; unsigned char *buffer_; unsigned int length_; unsigned int size_; unsigned int start_; unsigned int maxReadSize_; }; #endif /* ReadBuffer_H */ dxpc-3.9.2/PixelCache.C0000644000175000017530000000271410560644754014202 0ustar kvigorkvigor#include "dxpcconf.h" #include "PixelCache.H" static const unsigned int PXC_SIZE = 7; int PixelCache::lookup(unsigned int value, unsigned int &index) { for (unsigned int i = 0; i < length_; i++) if (value == buffer_[i]) { index = i; if (i) { unsigned int target = (i >> 1); do { buffer_[i] = buffer_[i - 1]; i--; } while (i > target); buffer_[target] = value; } return 1; } insert(value); return 0; } unsigned int PixelCache::get(unsigned int index) { unsigned int result = buffer_[index]; if (index != 0) { unsigned int i = index; unsigned int target = (i >> 1); do { buffer_[i] = buffer_[i - 1]; i--; } while (i > target); buffer_[target] = result; } return (unsigned int) result; } void PixelCache::insert(unsigned int value) { unsigned int insertionPoint; if (2 >= length_) insertionPoint = length_; else insertionPoint = 2; unsigned int start; if (length_ >= PXC_SIZE) start = PXC_SIZE - 1; else { start = length_; length_++; } for (unsigned int k = start; k > insertionPoint; k--) buffer_[k] = buffer_[k - 1]; buffer_[insertionPoint] = value; } dxpc-3.9.2/PixelCache.H0000644000175000017530000000065210560644754014206 0ustar kvigorkvigor#ifndef PixelCache_H # define PixelCache_H class PixelCache { public: PixelCache():length_(0) { } unsigned int getSize() const { return (unsigned int) length_; } int lookup(unsigned int value, unsigned int &index); unsigned int get(unsigned int i); void insert(unsigned int value); private: unsigned int length_; unsigned int buffer_[7]; }; #endif /* PixelCache_H */ dxpc-3.9.2/README.mingw0000644000175000017530000000110710560644754014064 0ustar kvigorkvigorAs of release 3.8.3, dxpc builds in the Mingw environment. Using the MSYS build system you can simply type ./configure && make to get Windows executables. Under Mingw, two executables are produced by the build: dpxc.exe is a Windows console application; dxpc-win32.exe is a Win32 application. This means dxpc.exe will open a console window for its output, whereas dxpc-win32 will not. In order to see error messages from dxpc-win32.exe, you will have to redirect the output to a file, and in order to kill the process you will have to use the task manager or some other utility. dxpc-3.9.2/HuffmanCoder.C0000644000175000017530000001471410560644754014541 0ustar kvigorkvigor#include "dxpcconf.h" #include #include "HuffmanCoder.H" #include "EncodeBuffer.H" #include "DecodeBuffer.H" class EncodeNode { public: EncodeNode(unsigned int v, unsigned int f): value_(v), frequency_(f), encoding_(NULL), codeLength_(0), left_(NULL), right_(NULL) { } EncodeNode(EncodeNode * left, EncodeNode * right, unsigned int f): value_(0), frequency_(f), encoding_(NULL), codeLength_(0), left_(left), right_(right) { } ~EncodeNode() { delete[]encoding_; delete left_; delete right_; } unsigned int getValue() const { return value_; } unsigned int getFrequency() const { return frequency_; } void setCode(unsigned char *code, unsigned int length); unsigned int getCodeLength() const { return codeLength_; } const unsigned char *getCode() const { return encoding_; } EncodeNode *addCode(unsigned int v, const char *code); unsigned int decode(DecodeBuffer &); private: unsigned int value_; unsigned int frequency_; unsigned char *encoding_; unsigned int codeLength_; // in bits EncodeNode *left_; EncodeNode *right_; }; void EncodeNode::setCode(unsigned char *code, unsigned int length) { if (encoding_) delete[]encoding_; encoding_ = code; codeLength_ = length; unsigned int nextCodeLength = codeLength_ + 1; if (left_ != NULL) { unsigned char *leftCode = new unsigned char[nextCodeLength]; unsigned int i = 0; for (; i < codeLength_; i++) leftCode[i] = encoding_[i]; leftCode[i] = 0; left_->setCode(leftCode, nextCodeLength); } if (right_ != NULL) { unsigned char *rightCode = new unsigned char[nextCodeLength]; unsigned int i = 0; for (; i < codeLength_; i++) rightCode[i] = encoding_[i]; rightCode[i] = 1; right_->setCode(rightCode, nextCodeLength); } } unsigned int EncodeNode::decode(DecodeBuffer & decodeBuffer) { if ((left_ == NULL) && (right_ == NULL)) return value_; unsigned int nextBit; decodeBuffer.decodeValue(nextBit, 1); if (nextBit == 0) return left_->decode(decodeBuffer); else return right_->decode(decodeBuffer); } EncodeNode *EncodeNode::addCode(unsigned int value, const char *code) { if (*code == 0) { value_ = value; return this; } else if (*code == '0') { if (left_ == NULL) left_ = new EncodeNode(NULL, NULL, 0); return left_->addCode(value, code + 1); } else { if (right_ == NULL) right_ = new EncodeNode(NULL, NULL, 0); return right_->addCode(value, code + 1); } } class Heap { public: Heap(unsigned int maxSize); ~Heap(); void insert(EncodeNode *); EncodeNode *pop(); unsigned int size() const { return numElements_; } private: unsigned int numElements_; unsigned int size_; EncodeNode **heap_; }; Heap::Heap(unsigned int maxSize): numElements_(0), size_(maxSize), heap_(new EncodeNode *[maxSize]) { } Heap::~Heap() { delete[]heap_; } void Heap::insert(EncodeNode * node) { unsigned int location = numElements_++; unsigned int parent = ((location - 1) >> 1); while (location && (heap_[parent]->getFrequency() > node->getFrequency())) { heap_[location] = heap_[parent]; location = parent; parent = ((location - 1) >> 1); } heap_[location] = node; } EncodeNode *Heap::pop() { if (numElements_ == 0) return NULL; EncodeNode *result = heap_[0]; numElements_--; EncodeNode *node = heap_[numElements_]; unsigned int location = 0; do { unsigned int left = (location << 1) + 1; if (left >= numElements_) break; unsigned int nodeToSwap = left; unsigned int right = left + 1; if (right < numElements_) if (heap_[right]->getFrequency() < heap_[left]->getFrequency()) nodeToSwap = right; if (heap_[nodeToSwap]->getFrequency() < node->getFrequency()) { heap_[location] = heap_[nodeToSwap]; location = nodeToSwap; } else break; } while (location < numElements_); heap_[location] = node; return result; } HuffmanCoder::HuffmanCoder(unsigned int histogramLength, const unsigned int *histogram, unsigned int overflowCount): numTokens_(histogramLength), tokens_(new EncodeNode *[histogramLength + 1]) { Heap heap(histogramLength + 1); for (unsigned int i = 0; i < histogramLength; i++) heap.insert(tokens_[i] = new EncodeNode(i, histogram[i])); heap.insert(tokens_[histogramLength] = new EncodeNode(histogramLength, overflowCount)); while (heap.size() > 1) { EncodeNode *node1 = heap.pop(); EncodeNode *node2 = heap.pop(); EncodeNode *newNode = new EncodeNode(node1, node2, node1->getFrequency() + node2->getFrequency()); heap.insert(newNode); } root_ = heap.pop(); root_->setCode(NULL, 0); } HuffmanCoder::HuffmanCoder(unsigned int numCodes, const char **codes): numTokens_(numCodes), tokens_(new EncodeNode *[numCodes]) { root_ = new EncodeNode(NULL, NULL, 0); for (unsigned int i = 0; i < numCodes; i++) tokens_[i] = root_->addCode(i, codes[i]); root_->setCode(NULL, 0); } HuffmanCoder::~HuffmanCoder() { delete root_; delete[]tokens_; } void HuffmanCoder::encode(unsigned int value, EncodeBuffer & encodeBuffer) { unsigned int index = value; if (index >= numTokens_) index = numTokens_; const EncodeNode *node = tokens_[index]; const unsigned char *code = node->getCode(); unsigned int codeLength = node->getCodeLength(); for (unsigned int i = 0; i < codeLength; i++) encodeBuffer.encodeValue(code[i], 1); if (value >= numTokens_) encodeBuffer.encodeValue(value, 16, 8); } unsigned int HuffmanCoder::decode(DecodeBuffer & decodeBuffer) { unsigned int result = root_->decode(decodeBuffer); if (result >= numTokens_) decodeBuffer.decodeValue(result, 16, 8); return result; } dxpc-3.9.2/HuffmanCoder.H0000644000175000017530000000107510560644754014542 0ustar kvigorkvigor#ifndef HuffmanCoder_H # define HuffmanCoder_H class EncodeBuffer; class DecodeBuffer; class EncodeNode; class HuffmanCoder { public: HuffmanCoder(unsigned int histogramLength, const unsigned int *histogram, unsigned int overflowCount = 0); HuffmanCoder(unsigned int numCodes, const char **codes); ~HuffmanCoder(); void encode(unsigned int value, EncodeBuffer &); unsigned int decode(DecodeBuffer &); private: EncodeNode * root_; unsigned int numTokens_; EncodeNode **tokens_; }; #endif /* HuffmanCoder_H */ dxpc-3.9.2/unittest.C0000644000175000017530000001620010560644754014047 0ustar kvigorkvigor// Some standalone unit testing for EncodeBuffer/DecodeBuffer. #include #include #include #include #include #include "EncodeBuffer.H" #include "DecodeBuffer.H" #define NUM_ENTRIES 10000 static void usage(void) { puts("Grow clue."); exit(1); } typedef enum { write, read } TestMode; static int readDump(const char *fileName, unsigned **values, unsigned **bitSize, unsigned **blockSize, DecodeBuffer **decoder) { FILE *fp = fopen(fileName, "rb"); unsigned tmp, i; unsigned *v, *b, *b2; unsigned char *data; if (!fp) { printf("Cannot open %s: %s\n", fileName, strerror(errno)); return 1; } if (fread(&tmp, 1, sizeof(unsigned), fp) != sizeof(unsigned)) { fclose(fp); printf("Cannot read %s: %s\n", fileName, strerror(errno)); return 1; } if (ntohl(tmp) != NUM_ENTRIES) { fclose(fp); printf("NUM_ENTRIES mismatch!\n"); return 1; } v = new unsigned[NUM_ENTRIES]; b = new unsigned[NUM_ENTRIES]; b2 = new unsigned[NUM_ENTRIES]; for (i = 0; i < NUM_ENTRIES; i++) { if (fread(&tmp, 1, sizeof(unsigned), fp) != sizeof(unsigned)) { fclose(fp); printf("Cannot read %s: %s\n", fileName, strerror(errno)); return 1; } v[i] = ntohl(tmp); if (fread(&tmp, 1, sizeof(unsigned), fp) != sizeof(unsigned)) { fclose(fp); printf("Cannot read %s: %s\n", fileName, strerror(errno)); return 1; } b[i] = ntohl(tmp); if (fread(&tmp, 1, sizeof(unsigned), fp) != sizeof(unsigned)) { fclose(fp); printf("Cannot read %s: %s\n", fileName, strerror(errno)); return 1; } b2[i] = ntohl(tmp); } if (fread(&tmp, 1, sizeof(unsigned), fp) != sizeof(unsigned)) { fclose(fp); printf("Cannot read %s: %s\n", fileName, strerror(errno)); return 1; } tmp = ntohl(tmp); data = new unsigned char[tmp]; if (fread(data, 1, tmp, fp) != tmp) { fclose(fp); printf("Cannot read %s: %s\n", fileName, strerror(errno)); return 1; } *values = v; *bitSize = b; *blockSize = b2; *decoder = new DecodeBuffer(data, tmp); return 0; } static int writeDump(const char *fileName, unsigned *values, unsigned *bitSize, unsigned *blockSize, EncodeBuffer *encoder) { FILE *fp = fopen(fileName, "wb"); unsigned tmp, i; if (!fp) { printf("Cannot open %s: %s\n", fileName, strerror(errno)); return 1; } tmp = htonl(NUM_ENTRIES); if (fwrite(&tmp, 1, sizeof(unsigned), fp) != sizeof(unsigned)) { fclose(fp); printf("Cannot write %s: %s\n", fileName, strerror(errno)); return 1; } for (i = 0; i < NUM_ENTRIES; i++) { tmp = htonl(values[i]); if (fwrite(&tmp, 1, sizeof(unsigned), fp) != sizeof(unsigned)) { fclose(fp); printf("Cannot write %s: %s\n", fileName, strerror(errno)); return 1; } tmp = htonl(bitSize[i]); if (fwrite(&tmp, 1, sizeof(unsigned), fp) != sizeof(unsigned)) { fclose(fp); printf("Cannot write %s: %s\n", fileName, strerror(errno)); return 1; } tmp = htonl(blockSize[i]); if (fwrite(&tmp, 1, sizeof(unsigned), fp) != sizeof(unsigned)) { fclose(fp); printf("Cannot write %s: %s\n", fileName, strerror(errno)); return 1; } } tmp = htonl(encoder->getDataLength()); if (fwrite(&tmp, 1, sizeof(unsigned), fp) != sizeof(unsigned)) { fclose(fp); printf("Cannot write %s: %s\n", fileName, strerror(errno)); return 1; } if (fwrite(encoder->getData(), 1, encoder->getDataLength(), fp) != encoder->getDataLength()) { fclose(fp); printf("Cannot write %s: %s\n", fileName, strerror(errno)); return 1; } if (fclose(fp)) { printf("Cannot close %s: %s\n", fileName, strerror(errno)); return 1; } return 0; } int main(int argc, const char *argv[]) { TestMode mode; unsigned *values, *bitSize, *blockSize; EncodeBuffer *encoder = 0; DecodeBuffer *decoder; unsigned i; if (argc < 3) { usage(); } if (!strcmp(argv[1], "write")) { mode = write; } else if (!strcmp(argv[1], "read")) { mode = read; } else if (!strcmp(argv[1], "hack")) { unsigned value; int rc = 0; encoder = new EncodeBuffer(); encoder->encodeValue(0x16, 6); encoder->encodeDirect(1,3); decoder = new DecodeBuffer(encoder->getData(), encoder->getDataLength()); decoder->decodeValue(value,6); if (value != 0x16) { puts("Crap 1."); rc = 1; } decoder->decodeDirect(value, 3); if (value != 1) { puts("Crap 2."); rc = 1; } delete decoder; delete encoder; if (!rc) puts("Happy day!"); return rc; } else { usage(); } if (mode == read) { printf("Reading data from %s...\n", argv[2]); if (readDump(argv[2], &values, &bitSize, &blockSize, &decoder)) { return 1; } } else { puts("Generating random data..."); values = new unsigned[NUM_ENTRIES]; bitSize = new unsigned[NUM_ENTRIES]; blockSize = new unsigned[NUM_ENTRIES]; for (i = 0; i < NUM_ENTRIES; i++) { bitSize[i] = (rand() % 32) + 1; blockSize[i] = (rand() % bitSize[i]) + 1; values[i] = rand(); } puts("Encoding..."); // Now encode 'em. encoder = new EncodeBuffer(); for (i = 0; i < NUM_ENTRIES; i++) { encoder->encodeValue(values[i], bitSize[i], blockSize[i]); } decoder = new DecodeBuffer(encoder->getData(), encoder->getDataLength()); } // Now decode 'em. puts("Decoding..."); for (i = 0; i < NUM_ENTRIES; i++) { unsigned value, valueMask; valueMask = ~0U >> (32 - bitSize[i]); decoder->decodeValue(value, bitSize[i], blockSize[i], 0); if (value != (values[i] & valueMask)) { printf("Bogus decoding data @ %d(%d): expected 0x%08x, got 0x%08x\n", i, bitSize[i], values[i], value); return 1; } } delete decoder; if (mode == write) { printf("Dumping data to %s...\n", argv[2]); if (writeDump(argv[2], values, bitSize, blockSize, encoder)) { return 1; } } delete values; delete bitSize; if (encoder) { delete encoder; } puts("Success."); return 0; } dxpc-3.9.2/ClientCache.C0000644000175000017530000002052210560644754014334 0ustar kvigorkvigor#include "dxpcconf.h" #include #include "ClientCache.H" #include "constants.H" // Histograms used to build static Huffman codes for run-length-encoding // of images...generated by profiling lots of bitmapped text and images // produced by FrameMaker static const unsigned int PIXEL_COUNT_0 = 63; static const unsigned int PixelHistogram0[PIXEL_COUNT_0] = { 82551, 69015, 30616, 24739, 15491, 10108, 7422, 7569, 3408, 3457, 2013, 2144, 3527, 3187, 2883, 1717, 1487, 1024, 789, 618, 993, 1029, 664, 711, 667, 736, 572, 492, 909, 432, 422, 306, 269, 265, 522, 445, 249, 210, 252, 150, 189, 181, 253, 217, 251, 272, 183, 231, 198, 186, 177, 196, 134, 287, 190, 327, 150, 155, 119, 138, 230, 262 }; static const unsigned int PIXEL_OVERFLOW_COUNT_0 = 15400; static const unsigned int PIXEL_COUNT_1 = 32; static const unsigned int PixelHistogram1[PIXEL_COUNT_1] = { 181385, 57253, 51214, 19913, 14296, 8104, 3138, 1706, 1985, 1244, 1011, 581, 869, 327, 456, 397, 661, 191, 198, 155, 95, 76, 28, 18, 10, 3, 3, 11, 2, 0, 6, 2 }; static const unsigned int PIXEL_OVERFLOW_COUNT_1 = 4; static const unsigned int COLUMN_PIXEL_COUNT_0 = 32; static const unsigned int ColumnPixelHistogram0[COLUMN_PIXEL_COUNT_0] = { 4646, 5347, 7237, 10526, 11306, 4105, 2643, 1766, 6663, 3805, 2908, 1225, 502, 1161, 758, 363, 186, 75, 61, 513, 120, 4, 21, 4, 0, 0, 29, 1, 0, 0, 0, 0 }; static const unsigned int COLUMN_PIXEL_COUNT_1 = 32; static const unsigned int ColumnPixelHistogram1[COLUMN_PIXEL_COUNT_1] = { 20339, 8153, 4903, 2193, 933, 310, 1024, 402, 486, 645, 598, 132, 162, 92, 35, 5, 3, 7, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; // Precomputed static prefix code for encoding of run length deltas // between scan lines...based on Group 4 FAX encoding. (Reference: // "FAX: Digital Facsimile Technology and Applications," 2nd Edition; // McConnel, Bodson, and Schaphorst; Artech House, 1992; ISBN 0-89006-495-4) static const char *ScanLineDiffCodes[SD_NUM_CODES] = { "0", // Vertical +0 "100", // Vertical +1 "110", // Vertical -1 "101", // Horizontal "1111", // Pass "11100", // Vertical +2 "11101", // Vertical -2 }; ClientCache::ClientCache(): cursorCache(16), gcCache(16), drawableCache(16), windowCache(16), colormapCache(16), visualCache(16), lastFont(0), lastRequestSequenceNum(0), lastOpcode(0), changePropertyPropertyCache(16), changePropertyTypeCache(16), changePropertyData32Cache(16), changePropertyTextCompressor(textCache, CLIENT_TEXT_CACHE_SIZE), configureWindowBitmaskCache(4), convertSelectionRequestorCache(16), convertSelectionLastTimestamp(0), copyPlaneBitPlaneCache(8), createGCBitmaskCache(8), createPixmapLastPixmap(0), createPixmapXCache(8), createPixmapYCache(8), createWindowBitmaskCache(8), fillPolyNumPointsCache(8), fillPolyIndex(0), getSelectionOwnerSelectionCache(8), grabButtonEventMaskCache(8), grabButtonConfineCache(8), grabButtonModifierCache(8), grabKeyboardLastTimestamp(0), imageText8LastX(0), imageText8LastY(0), imageText8CacheX(8), imageText8CacheY(8), imageText8TextCompressor(textCache, CLIENT_TEXT_CACHE_SIZE), internAtomTextCompressor(textCache, CLIENT_TEXT_CACHE_SIZE), openFontTextCompressor(textCache, CLIENT_TEXT_CACHE_SIZE), polySegmentCacheX(8), polySegmentCacheY(8), polySegmentCacheIndex(0), polyText8LastX(0), polyText8LastY(0), polyText8CacheX(8), polyText8CacheY(8), polyText8FontCache(8), polyText8TextCompressor(textCache, CLIENT_TEXT_CACHE_SIZE), putImageWidthCache(8), putImageHeightCache(8), putImageLastX(0), putImageLastY(0), putImageXCache(8), putImageYCache(8), putImagePixel0Coder(PIXEL_COUNT_0, PixelHistogram0, PIXEL_OVERFLOW_COUNT_0), putImagePixel1Coder(PIXEL_COUNT_1, PixelHistogram1, PIXEL_OVERFLOW_COUNT_1), putImageDiffCoder(SD_NUM_CODES, ScanLineDiffCodes), putImageLastPixels(3), columnPixel0Coder(COLUMN_PIXEL_COUNT_0, ColumnPixelHistogram0, 0), columnPixel1Coder(COLUMN_PIXEL_COUNT_1, ColumnPixelHistogram1, 0), putImageReferenceLine(NULL), putImageCodingLine(NULL), putImageLineSize(0), queryColorsLastPixel(0), setClipRectanglesXCache(8), setClipRectanglesYCache(8), setDashesLengthCache(8), setDashesOffsetCache(8), setSelectionOwnerCache(8), setSelectionOwnerTimestampCache(8), translateCoordsSrcCache(8), translateCoordsDestCache(8), translateCoordsXCache(8), translateCoordsYCache(8) { unsigned int i; for (i = 0; i < 3; i++) { allocColorRGBCache[i] = new IntCache(8); convertSelectionAtomCache[i] = new IntCache(8); } for (i = 0; i < 4; i++) clearAreaGeomCache[i] = new IntCache(8); for (i = 0; i < 7; i++) configureWindowAttrCache[i] = new IntCache(8); for (i = 0; i < 6; i++) { copyAreaGeomCache[i] = new IntCache(8); copyPlaneGeomCache[i] = new IntCache(8); } for (i = 0; i < 23; i++) createGCAttrCache[i] = new IntCache(CREATEGC_FIELD_WIDTH[i]); for (i = 0; i < 6; i++) createWindowGeomCache[i] = new IntCache(8); for (i = 0; i < 15; i++) createWindowAttrCache[i] = new IntCache(8); for (i = 0; i < FILL_POLY_MAX_POINTS; i++) { fillPolyXRelCache[i] = new IntCache(8); fillPolyXAbsCache[i] = new IntCache(8); fillPolyYRelCache[i] = new IntCache(8); fillPolyYAbsCache[i] = new IntCache(8); } for (i = 0; i < 8; i++) { fillPolyRecentX[i] = 0; fillPolyRecentY[i] = 0; } for (i = 0; i < 2; i++) { polyFillRectangleCacheX[i] = new IntCache(8); polyFillRectangleCacheY[i] = new IntCache(8); polyFillRectangleCacheWidth[i] = new IntCache(8); polyFillRectangleCacheHeight[i] = new IntCache(8); } for (i = 0; i < 2; i++) { polyLineCacheX[i] = new IntCache(8); polyLineCacheY[i] = new IntCache(8); } for (i = 0; i < 2; i++) { polyPointCacheX[i] = new IntCache(8); polyPointCacheY[i] = new IntCache(8); } for (i = 0; i < 4; i++) polyRectangleGeomCache[i] = new IntCache(8); for (i = 0; i < 2; i++) { polySegmentLastX[i] = 0; polySegmentLastY[i] = 0; } for (i = 0; i < 4; i++) setClipRectanglesGeomCache[i] = new IntCache(8); } ClientCache::~ClientCache() { unsigned int i; for (i = 0; i < 3; i++) { delete allocColorRGBCache[i]; delete convertSelectionAtomCache[i]; } for (i = 0; i < 4; i++) delete clearAreaGeomCache[i]; for (i = 0; i < 7; i++) delete configureWindowAttrCache[i]; for (i = 0; i < 6; i++) { delete copyAreaGeomCache[i]; delete copyPlaneGeomCache[i]; } for (i = 0; i < 23; i++) delete createGCAttrCache[i]; for (i = 0; i < 6; i++) delete createWindowGeomCache[i]; for (i = 0; i < 15; i++) delete createWindowAttrCache[i]; for (i = 0; i < FILL_POLY_MAX_POINTS; i++) { delete fillPolyXRelCache[i]; delete fillPolyXAbsCache[i]; delete fillPolyYRelCache[i]; delete fillPolyYAbsCache[i]; } for (i = 0; i < 2; i++) { delete polyFillRectangleCacheX[i]; delete polyFillRectangleCacheY[i]; delete polyFillRectangleCacheWidth[i]; delete polyFillRectangleCacheHeight[i]; } for (i = 0; i < 2; i++) { delete polyLineCacheX[i]; delete polyLineCacheY[i]; } for (i = 0; i < 2; i++) { delete polyPointCacheX[i]; delete polyPointCacheY[i]; } for (i = 0; i < 4; i++) delete polyRectangleGeomCache[i]; delete[]putImageReferenceLine; delete[]putImageCodingLine; for (i = 0; i < 4; i++) delete setClipRectanglesGeomCache[i]; } dxpc-3.9.2/ClientCache.H0000644000175000017530000001317310560644754014345 0ustar kvigorkvigor#ifndef ClientCache_H # define ClientCache_H # include "constants.H" # include "EncodeBuffer.H" # include "IntCache.H" # include "CharCache.H" # include "TextCompressor.H" # include "HuffmanCoder.H" # include "PixelCache.H" # include "LastPixels.H" static const unsigned int PUT_IMAGE_PIXEL_CACHE_SIZE = 251; static const unsigned int CLIENT_TEXT_CACHE_SIZE = 9999; class ClientCache { public: ClientCache(); ~ClientCache(); // General-purpose caches: CharCache textCache[CLIENT_TEXT_CACHE_SIZE]; IntCache cursorCache; IntCache gcCache; IntCache drawableCache; IntCache windowCache; IntCache colormapCache; IntCache visualCache; CharCache depthCache; unsigned int lastFont; unsigned int lastRequestSequenceNum; // Opcode prediction caches (predict next opcode based on previous one) CharCache opcodeCache[256]; unsigned char lastOpcode; // AllocColor request IntCache *allocColorRGBCache[3]; // ChangeProperty request CharCache changePropertyFormatCache; IntCache changePropertyPropertyCache; IntCache changePropertyTypeCache; IntCache changePropertyData32Cache; TextCompressor changePropertyTextCompressor; // ClearArea request IntCache *clearAreaGeomCache[4]; // ConfigureWindow request IntCache configureWindowBitmaskCache; IntCache *configureWindowAttrCache[7]; // ConvertSelection request IntCache convertSelectionRequestorCache; IntCache *convertSelectionAtomCache[3]; unsigned int convertSelectionLastTimestamp; // CopyArea request IntCache *copyAreaGeomCache[6]; // CopyPlane request IntCache *copyPlaneGeomCache[6]; IntCache copyPlaneBitPlaneCache; // CreateGC request IntCache createGCBitmaskCache; IntCache *createGCAttrCache[23]; // CreatePixmap request unsigned int createPixmapLastPixmap; IntCache createPixmapXCache; IntCache createPixmapYCache; // CreateWindow request IntCache *createWindowGeomCache[6]; IntCache createWindowBitmaskCache; IntCache *createWindowAttrCache[15]; // FillPoly request IntCache fillPolyNumPointsCache; IntCache *fillPolyXRelCache[FILL_POLY_MAX_POINTS]; IntCache *fillPolyXAbsCache[FILL_POLY_MAX_POINTS]; IntCache *fillPolyYRelCache[FILL_POLY_MAX_POINTS]; IntCache *fillPolyYAbsCache[FILL_POLY_MAX_POINTS]; unsigned int fillPolyRecentX[8]; unsigned int fillPolyRecentY[8]; unsigned int fillPolyIndex; // GetSelectionOwner request IntCache getSelectionOwnerSelectionCache; // GrabButton request // (also used for GrabPointer) IntCache grabButtonEventMaskCache; IntCache grabButtonConfineCache; CharCache grabButtonButtonCache; IntCache grabButtonModifierCache; // GrabKeyboard request unsigned int grabKeyboardLastTimestamp; // ImageText8 request unsigned int imageText8LastX; unsigned int imageText8LastY; IntCache imageText8CacheX; IntCache imageText8CacheY; TextCompressor imageText8TextCompressor; // InternAtom request TextCompressor internAtomTextCompressor; // OpenFont request TextCompressor openFontTextCompressor; // PolyFillRectangle request IntCache *polyFillRectangleCacheX[2]; IntCache *polyFillRectangleCacheY[2]; IntCache *polyFillRectangleCacheWidth[2]; IntCache *polyFillRectangleCacheHeight[2]; // PolyLine request IntCache *polyLineCacheX[2]; IntCache *polyLineCacheY[2]; // PolyPoint request IntCache *polyPointCacheX[2]; IntCache *polyPointCacheY[2]; // PolyRectangle request IntCache *polyRectangleGeomCache[4]; // PolySegment request IntCache polySegmentCacheX; IntCache polySegmentCacheY; unsigned int polySegmentLastX[2]; unsigned int polySegmentLastY[2]; unsigned int polySegmentCacheIndex; // PolyText8 request unsigned int polyText8LastX; unsigned int polyText8LastY; IntCache polyText8CacheX; IntCache polyText8CacheY; IntCache polyText8FontCache; CharCache polyText8DeltaCache; TextCompressor polyText8TextCompressor; // PutImage request IntCache putImageWidthCache; IntCache putImageHeightCache; unsigned int putImageLastX; unsigned int putImageLastY; IntCache putImageXCache; IntCache putImageYCache; CharCache putImageOffsetCache; HuffmanCoder putImagePixel0Coder; HuffmanCoder putImagePixel1Coder; HuffmanCoder putImageDiffCoder; PixelCache putImagePixelCache[PUT_IMAGE_PIXEL_CACHE_SIZE]; LastPixels putImageLastPixels; HuffmanCoder columnPixel0Coder; HuffmanCoder columnPixel1Coder; unsigned int *putImageReferenceLine; unsigned int *putImageCodingLine; unsigned int putImageLineSize; CharCache putImageByteCache; // QueryColors request unsigned int queryColorsLastPixel; // SetClipRectangles request IntCache setClipRectanglesXCache; IntCache setClipRectanglesYCache; IntCache *setClipRectanglesGeomCache[4]; // SetDashes request IntCache setDashesLengthCache; IntCache setDashesOffsetCache; CharCache setDashesDashCache_[2]; // SetSelectionOwner request IntCache setSelectionOwnerCache; IntCache setSelectionOwnerTimestampCache; // TranslateCoords request IntCache translateCoordsSrcCache; IntCache translateCoordsDestCache; IntCache translateCoordsXCache; IntCache translateCoordsYCache; }; // Codes for representing patterns between scan lines of a compressed bitmap: enum ScanlineDiff { SD_VERTICAL_0, SD_VERTICAL_PLUS_1, SD_VERTICAL_MINUS_1, SD_HORIZONTAL, SD_PASS, SD_VERTICAL_MINUS_2, SD_VERTICAL_PLUS_2, SD_NUM_CODES }; #endif /* ClientCache_H */ dxpc-3.9.2/BlockCache.C0000644000175000017530000000216510560644754014153 0ustar kvigorkvigor#include #include "BlockCache.H" int BlockCache::compare(unsigned int size, const unsigned char *data, int overwrite) { int match = 0; if (size == size_) { match = 1; for (unsigned int i = 0; i < size_; i++) if (data[i] != buffer_[i]) { match = 0; break; } } if (!match && overwrite) set(size, data); return match; } void BlockCache::set(unsigned int size, const unsigned char *data) { if (size_ < size) { delete[]buffer_; buffer_ = new unsigned char[size]; } size_ = size; memcpy(buffer_, data, size); checksum_ = checksum(size, data); } unsigned int BlockCache::checksum(unsigned int size, const unsigned char *data) { unsigned int sum = 0; unsigned int shift = 0; const unsigned char *next = data; for (unsigned int i = 0; i < size; i++) { unsigned int value = (unsigned int) *next++; sum += (value << shift); shift++; if (shift == 8) shift = 0; } return sum; } dxpc-3.9.2/BlockCache.H0000644000175000017530000000153710560644754014162 0ustar kvigorkvigor#ifndef BlockCache_H # define BlockCache_H // Cache to hold an arbitrary-length block of bytes class BlockCache { public: BlockCache():buffer_(0), size_(0), checksum_(0) { } ~BlockCache() { delete[]buffer_; } int compare(unsigned int size, const unsigned char *data, int overwrite = 1); void set(unsigned int size, const unsigned char *data); unsigned int getLength() const { return size_; } unsigned int getChecksum() const { return checksum_; } const unsigned char *getData() const { return buffer_; } static unsigned int checksum(unsigned int size, const unsigned char *data); private: unsigned char *buffer_; unsigned int size_; unsigned int checksum_; }; #endif /* BlockCache_H */ dxpc-3.9.2/IntCache.C0000644000175000017530000001006410560644754013650 0ustar kvigorkvigor#include "IntCache.H" IntCache::IntCache(unsigned int size): size_(size), length_(0), buffer_(new unsigned int[size]), lastValueInserted_(0), lastDiff_(0), predictedBlockSize_(0) { } int IntCache::lookup(unsigned int &value, unsigned int &index, unsigned int mask, unsigned int &sameDiff) { for (unsigned int i = 0; i < length_; i++) if (value == buffer_[i]) { index = i; if (i) { unsigned int target = (i >> 1); do { buffer_[i] = buffer_[i - 1]; i--; } while (i > target); buffer_[target] = value; } return 1; } unsigned int insertionPoint; if (2 >= length_) insertionPoint = length_; else insertionPoint = 2; unsigned int start; if (length_ >= size_) start = size_ - 1; else { start = length_; length_++; } for (unsigned int k = start; k > insertionPoint; k--) buffer_[k] = buffer_[k - 1]; buffer_[insertionPoint] = value; unsigned int diff = value - lastValueInserted_; lastValueInserted_ = (value & mask); value = (diff & mask); sameDiff = (value == lastDiff_); if (!sameDiff) { lastDiff_ = value; unsigned int lastChangeIndex = 0; unsigned int lastBitIsOne = (lastDiff_ & 0x1); unsigned int j = 1; for (unsigned int nextMask = 0x2; nextMask & mask; nextMask <<= 1) { unsigned int nextBitIsOne = (lastDiff_ & nextMask); if (nextBitIsOne) { if (!lastBitIsOne) { lastChangeIndex = j; lastBitIsOne = nextBitIsOne; } } else { if (lastBitIsOne) { lastChangeIndex = j; lastBitIsOne = nextBitIsOne; } } j++; } predictedBlockSize_ = lastChangeIndex + 1; if (predictedBlockSize_ < 2) predictedBlockSize_ = 2; } return 0; } unsigned int IntCache::get(unsigned int index) { unsigned int result = buffer_[index]; if (index != 0) { unsigned int i = index; unsigned int target = (i >> 1); do { buffer_[i] = buffer_[i - 1]; i--; } while (i > target); buffer_[target] = result; } return result; } void IntCache::insert(unsigned int &value, unsigned int mask) { unsigned int insertionPoint; if (2 >= length_) insertionPoint = length_; else insertionPoint = 2; unsigned int start; if (length_ >= size_) start = size_ - 1; else { start = length_; length_++; } for (unsigned int k = start; k > insertionPoint; k--) buffer_[k] = buffer_[k - 1]; if (lastDiff_ != value) { lastDiff_ = value; unsigned int lastChangeIndex = 0; unsigned int lastBitIsOne = (lastDiff_ & 0x1); unsigned int j = 1; for (unsigned int nextMask = 0x2; nextMask & mask; nextMask <<= 1) { unsigned int nextBitIsOne = (lastDiff_ & nextMask); if (nextBitIsOne) { if (!lastBitIsOne) { lastChangeIndex = j; lastBitIsOne = nextBitIsOne; } } else { if (lastBitIsOne) { lastChangeIndex = j; lastBitIsOne = nextBitIsOne; } } j++; } predictedBlockSize_ = lastChangeIndex + 1; if (predictedBlockSize_ < 2) predictedBlockSize_ = 2; } lastValueInserted_ += value; lastValueInserted_ &= mask; buffer_[insertionPoint] = lastValueInserted_; value = lastValueInserted_; } dxpc-3.9.2/IntCache.H0000644000175000017530000000156410560644754013662 0ustar kvigorkvigor#ifndef IntCache_H # define IntCache_H class IntCache { public: IntCache(unsigned int size); ~IntCache() { delete[]buffer_; } unsigned int getSize() const { return length_; } int lookup(unsigned int &value, unsigned int &index, unsigned int mask, unsigned int &sameDiff); unsigned int get(unsigned int i); void insert(unsigned int &value, unsigned int mask); unsigned int getLastDiff(unsigned int mask) const { mask = 0; return lastDiff_; } unsigned int getBlockSize(unsigned int max) const { max = 0; return predictedBlockSize_; } private: unsigned int size_; unsigned int length_; unsigned int *buffer_; unsigned int lastValueInserted_; unsigned int lastDiff_; unsigned int predictedBlockSize_; }; #endif /* IntCache_H */ dxpc-3.9.2/util.C0000644000175000017530000000636210560644754013155 0ustar kvigorkvigor#include "dxpcconf.h" #include #include #include "constants.H" #include "util.H" #include unsigned int GetUINT(unsigned const char *buffer, int bigEndian) { unsigned int result; if (bigEndian) { result = *buffer; result <<= 8; result += buffer[1]; } else { result = buffer[1]; result <<= 8; result += *buffer; } return result; } unsigned int GetULONG(unsigned const char *buffer, int bigEndian) { const unsigned char *next = (bigEndian ? buffer : buffer + 3); unsigned int result = 0; for (int i = 0; i < 4; i++) { result <<= 8; result += *next; if (bigEndian) next++; else next--; } return result; } void PutUINT(unsigned int value, unsigned char *buffer, int bigEndian) { if (bigEndian) { buffer[1] = (unsigned char) (value & 0xff); value >>= 8; *buffer = (unsigned char) value; } else { *buffer = (unsigned char) (value & 0xff); value >>= 8; buffer[1] = (unsigned char) value; } } void PutULONG(unsigned int value, unsigned char *buffer, int bigEndian) { if (bigEndian) { buffer += 3; for (int i = 4; i; i--) { *buffer-- = (unsigned char) (value & 0xff); value >>= 8; } } else { for (int i = 4; i; i--) { *buffer++ = (unsigned char) (value & 0xff); value >>= 8; } } } unsigned int RoundUp4(unsigned int x) { unsigned int y = x / 4; y *= 4; if (y != x) y += 4; return y; } void PrintVersionInfo() { COUT << "dxpc - Differential X Protocol Compressor - " << "Version " << DXPC_VERSION_MAJOR << '.' << DXPC_VERSION_MINOR << '.' << DXPC_VERSION_PATCH; if (DXPC_VERSION_BETA != 0) COUT << "beta" << DXPC_VERSION_BETA; COUT << ENDL; COUT << getLicenseInfo() << ENDL; } void DumpMessage(const unsigned char *src, unsigned int numBytes) { for (unsigned int i = 0; i < numBytes; i++) COUT << i << '\t' << (unsigned int) (src[i]) << ENDL; } const char *GetArg(int &argi, int argc, const char **argv) { const char *nextArg = argv[argi] + 2; // skip "-" and flag character if (*nextArg == 0) { if (argi + 1 == argc) return NULL; else { argi++; return argv[argi]; } } else return nextArg; } int WriteAll(int fd, const unsigned char *data, unsigned int length) { unsigned int bytesWritten = 0; #undef SPEWIT #ifdef SPEWIT unsigned i = 0; while (i < length) { unsigned rem = length - i; if (rem > 16) { rem = 16; } fprintf(stderr, "%04x: ", i % 16); for (unsigned j = 0; j < rem; j++) { fprintf(stderr, "%02x ", data[i++]); } fprintf(stderr, "\n"); } #endif while (bytesWritten < length) { int result = SOCKWRITE(fd, data + bytesWritten, length - bytesWritten); if (result <= 0) return -1; bytesWritten += result; } return length; } dxpc-3.9.2/util.H0000644000175000017530000000135310560644754013155 0ustar kvigorkvigor#ifndef util_H # define util_H # include "dxpcconf.h" extern unsigned int GetUINT(unsigned const char *, int bigEndian); extern unsigned int GetULONG(unsigned const char *, int bigEndian); extern void PutUINT(unsigned int, unsigned char *, int bigEndian); extern void PutULONG(unsigned int, unsigned char *, int bigEndian); extern unsigned int RoundUp4(unsigned int); extern void PrintVersionInfo(); extern void DumpMessage(const unsigned char *data, unsigned int length); extern const char *GetArg(int &argi, int argc, const char **argv); extern int WriteAll(int fd, const unsigned char *data, unsigned int length); extern OSTREAM *logofs; // globals in main.C extern int compressImages; extern int wantBackingStore; #endif /* util_H */ dxpc-3.9.2/ClientReadBuffer.C0000644000175000017530000000200310560644754015330 0ustar kvigorkvigor#include "ClientReadBuffer.H" #include "ClientChannel.H" #include "util.H" int ClientReadBuffer::locateMessage(const unsigned char *start, const unsigned char *end, unsigned int &headerLength, unsigned int &dataLength, unsigned int &trailerLength) { unsigned int size = end - start; if (size < 4) return 0; if (firstMessage_) { if (size < 12) return 0; if (*start == 0x42) bigEndian_ = 1; else bigEndian_ = 0; channel_->setBigEndian(bigEndian_); dataLength = 12 + RoundUp4(GetUINT(start + 6, bigEndian_)) + RoundUp4(GetUINT(start + 8, bigEndian_)); } else { dataLength = (GetUINT(start + 2, bigEndian_) << 2); } if (size < dataLength) return 0; firstMessage_ = 0; headerLength = 0; trailerLength = 0; return 1; } dxpc-3.9.2/ClientReadBuffer.H0000644000175000017530000000134310560644754015343 0ustar kvigorkvigor#ifndef ClientReadBuffer_H # define ClientReadBuffer_H # include "ReadBuffer.H" class ClientChannel; class ClientReadBuffer:public ReadBuffer { public: ClientReadBuffer(int fd, ClientChannel * channel):ReadBuffer(fd), firstMessage_(1), channel_(channel) { } virtual ~ ClientReadBuffer() { } protected: virtual int locateMessage(const unsigned char *start, const unsigned char *end, unsigned int &headerLength, unsigned int &dataLength, unsigned int &trailerLength); int firstMessage_; int bigEndian_; ClientChannel *channel_; }; #endif /* ClientReadBuffer_H */ dxpc-3.9.2/ServerMultiplexer.C0000644000175000017530000000467210560644754015703 0ustar kvigorkvigor#include "dxpcconf.h" #include #include #include #include "ServerMultiplexer.H" #include "ServerChannel.H" #if !defined(__MINGW32__) # include #endif #if !defined(__CYGWIN32__) && !defined(__MINGW32__) # include #endif ServerMultiplexer::ServerMultiplexer(int proxyFD, int xServerAddrFamily, sockaddr * xServerAddr, unsigned int xServerAddrLength, unsigned int statisticsLevel) : Multiplexer(proxyFD), xServerAddrFamily_(xServerAddrFamily), xServerAddr_(xServerAddr), xServerAddrLength_(xServerAddrLength), statisticsLevel_(statisticsLevel) { for (unsigned int i = 0; i < MAX_CONNECTIONS; i++) { channelIDToFDMap_[i] = -1; } } ServerMultiplexer::~ServerMultiplexer() { if (xServerAddr_) { delete xServerAddr_; } } void ServerMultiplexer::createNewConnection(int clientFD) { clientFD = 0; CERR << "Internal error: in ServerMultiplexer::createNewConnection" << ENDL; } int ServerMultiplexer::createNewConnectionFromProxy(int channelID) { // Connect to the real X server int xServerFD = socket(xServerAddrFamily_, SOCK_STREAM, PF_UNSPEC); if (xServerFD == -1) { CERR << "socket() failed, errno=" << errno << ENDL; return 0; } SETNODELAY(xServerFD); if (connect(xServerFD, xServerAddr_, xServerAddrLength_) == -1) { CERR << "connect() to X server failed, errno=" << errno << " (" << strerror(errno) << ")" << ENDL; SOCKCLOSE(xServerFD); return 0; } channelIDToFDMap_[channelID] = xServerFD; channels_[channelID] = new ServerChannel(xServerFD, statisticsLevel_); return 1; } int ServerMultiplexer::channelIDToFD(int channelID) const { if ((channelID < 0) || ((unsigned int) channelID >= MAX_CONNECTIONS)) return -1; else return channelIDToFDMap_[channelID]; } int ServerMultiplexer::fdToChannelID(int fd) const { for (unsigned i = 0; i < MAX_CONNECTIONS; i++) { if (channelIDToFDMap_[i] == fd) { return i; } } CERR << "No such fd " << fd << " in ServerMultiplexer::fdToChannelID" << ENDL; return -1; } void ServerMultiplexer::cleanupChannelFDMapping(int channelID) { channelIDToFDMap_[channelID] = -1; } dxpc-3.9.2/ServerMultiplexer.H0000644000175000017530000000172410560644754015703 0ustar kvigorkvigor#ifndef ServerMultiplexer_H # define ServerMultiplexer_H # include # ifndef __MINGW32__ # include # endif # include "Multiplexer.H" class ServerMultiplexer:public Multiplexer { public: ServerMultiplexer(int proxyFD, int xServerAddrFamily, sockaddr * xServerAddr, unsigned int xServerAddrLength, unsigned int statisticsLevel); virtual ~ServerMultiplexer(); protected: virtual void createNewConnection(int fd); virtual int createNewConnectionFromProxy(int channelID); virtual int channelIDToFD(int channelID) const; virtual int fdToChannelID(int fd) const; virtual void cleanupChannelFDMapping(int channelFD); int fdToChannelIDMap_[MAX_CONNECTIONS]; int channelIDToFDMap_[MAX_CONNECTIONS]; int xServerAddrFamily_; sockaddr *xServerAddr_; unsigned int xServerAddrLength_; unsigned int statisticsLevel_; }; #endif /* ServerMultiplexer_H */ dxpc-3.9.2/Xproto-cygwin.h0000644000175000017530000001757610560644754015047 0ustar kvigorkvigor/* X11R5 version of Xproto.h stripped down for CygWin 32 environment. */ /* * $XConsortium: Xproto.h,v 1.85 91/04/06 12:57:05 rws Exp $ */ /* Definitions for the X window system used by server and c bindings */ /* * This packet-construction scheme makes the following assumptions: * * 1. The compiler is able * to generate code which addresses one- and two-byte quantities. * In the worst case, this would be done with bit-fields. If bit-fields * are used it may be necessary to reorder the request fields in this file, * depending on the order in which the machine assigns bit fields to * machine words. There may also be a problem with sign extension, * as K+R specify that bitfields are always unsigned. * * 2. 2- and 4-byte fields in packet structures must be ordered by hand * such that they are naturally-aligned, so that no compiler will ever * insert padding bytes. * * 3. All packets are hand-padded to a multiple of 4 bytes, for * the same reason. */ #ifndef XPROTO_H #define XPROTO_H /*********************************************************** Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts, and the Massachusetts Institute of Technology, Cambridge, Massachusetts. All Rights Reserved 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 names of Digital or MIT 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. ******************************************************************/ /* Reply codes */ #define X_Reply 1 /* Normal reply */ #define X_Error 0 /* Error */ /* Request codes */ #define X_CreateWindow 1 #define X_ChangeWindowAttributes 2 #define X_GetWindowAttributes 3 #define X_DestroyWindow 4 #define X_DestroySubwindows 5 #define X_ChangeSaveSet 6 #define X_ReparentWindow 7 #define X_MapWindow 8 #define X_MapSubwindows 9 #define X_UnmapWindow 10 #define X_UnmapSubwindows 11 #define X_ConfigureWindow 12 #define X_CirculateWindow 13 #define X_GetGeometry 14 #define X_QueryTree 15 #define X_InternAtom 16 #define X_GetAtomName 17 #define X_ChangeProperty 18 #define X_DeleteProperty 19 #define X_GetProperty 20 #define X_ListProperties 21 #define X_SetSelectionOwner 22 #define X_GetSelectionOwner 23 #define X_ConvertSelection 24 #define X_SendEvent 25 #define X_GrabPointer 26 #define X_UngrabPointer 27 #define X_GrabButton 28 #define X_UngrabButton 29 #define X_ChangeActivePointerGrab 30 #define X_GrabKeyboard 31 #define X_UngrabKeyboard 32 #define X_GrabKey 33 #define X_UngrabKey 34 #define X_AllowEvents 35 #define X_GrabServer 36 #define X_UngrabServer 37 #define X_QueryPointer 38 #define X_GetMotionEvents 39 #define X_TranslateCoords 40 #define X_WarpPointer 41 #define X_SetInputFocus 42 #define X_GetInputFocus 43 #define X_QueryKeymap 44 #define X_OpenFont 45 #define X_CloseFont 46 #define X_QueryFont 47 #define X_QueryTextExtents 48 #define X_ListFonts 49 #define X_ListFontsWithInfo 50 #define X_SetFontPath 51 #define X_GetFontPath 52 #define X_CreatePixmap 53 #define X_FreePixmap 54 #define X_CreateGC 55 #define X_ChangeGC 56 #define X_CopyGC 57 #define X_SetDashes 58 #define X_SetClipRectangles 59 #define X_FreeGC 60 #define X_ClearArea 61 #define X_CopyArea 62 #define X_CopyPlane 63 #define X_PolyPoint 64 #define X_PolyLine 65 #define X_PolySegment 66 #define X_PolyRectangle 67 #define X_PolyArc 68 #define X_FillPoly 69 #define X_PolyFillRectangle 70 #define X_PolyFillArc 71 #define X_PutImage 72 #define X_GetImage 73 #define X_PolyText8 74 #define X_PolyText16 75 #define X_ImageText8 76 #define X_ImageText16 77 #define X_CreateColormap 78 #define X_FreeColormap 79 #define X_CopyColormapAndFree 80 #define X_InstallColormap 81 #define X_UninstallColormap 82 #define X_ListInstalledColormaps 83 #define X_AllocColor 84 #define X_AllocNamedColor 85 #define X_AllocColorCells 86 #define X_AllocColorPlanes 87 #define X_FreeColors 88 #define X_StoreColors 89 #define X_StoreNamedColor 90 #define X_QueryColors 91 #define X_LookupColor 92 #define X_CreateCursor 93 #define X_CreateGlyphCursor 94 #define X_FreeCursor 95 #define X_RecolorCursor 96 #define X_QueryBestSize 97 #define X_QueryExtension 98 #define X_ListExtensions 99 #define X_ChangeKeyboardMapping 100 #define X_GetKeyboardMapping 101 #define X_ChangeKeyboardControl 102 #define X_GetKeyboardControl 103 #define X_Bell 104 #define X_ChangePointerControl 105 #define X_GetPointerControl 106 #define X_SetScreenSaver 107 #define X_GetScreenSaver 108 #define X_ChangeHosts 109 #define X_ListHosts 110 #define X_SetAccessControl 111 #define X_SetCloseDownMode 112 #define X_KillClient 113 #define X_RotateProperties 114 #define X_ForceScreenSaver 115 #define X_SetPointerMapping 116 #define X_GetPointerMapping 117 #define X_SetModifierMapping 118 #define X_GetModifierMapping 119 #define X_NoOperation 127 #define X_TCP_PORT 6000 #endif /* XPROTO_H */ dxpc-3.9.2/X-headers.H0000644000175000017530000000043510560644754014020 0ustar kvigorkvigor#ifndef DXPC_H_HEADERS_H_ # define DXPC_H_HEADERS_H_ # if !defined(__CYGWIN32__) && !defined(__MINGW32__) # include # include # include # # else # include "X-mingw.h" # include "Xproto-cygwin.h" # include "Xatom-mingw.h" # endif #endif dxpc-3.9.2/Xatom-mingw.h0000644000175000017530000000472610560644754014456 0ustar kvigorkvigor#ifndef XATOM_H #define XATOM_H 1 /* THIS IS A GENERATED FILE * * Do not change! Changing this file implies a protocol change! */ #define XA_PRIMARY ((Atom) 1) #define XA_SECONDARY ((Atom) 2) #define XA_ARC ((Atom) 3) #define XA_ATOM ((Atom) 4) #define XA_BITMAP ((Atom) 5) #define XA_CARDINAL ((Atom) 6) #define XA_COLORMAP ((Atom) 7) #define XA_CURSOR ((Atom) 8) #define XA_CUT_BUFFER0 ((Atom) 9) #define XA_CUT_BUFFER1 ((Atom) 10) #define XA_CUT_BUFFER2 ((Atom) 11) #define XA_CUT_BUFFER3 ((Atom) 12) #define XA_CUT_BUFFER4 ((Atom) 13) #define XA_CUT_BUFFER5 ((Atom) 14) #define XA_CUT_BUFFER6 ((Atom) 15) #define XA_CUT_BUFFER7 ((Atom) 16) #define XA_DRAWABLE ((Atom) 17) #define XA_FONT ((Atom) 18) #define XA_INTEGER ((Atom) 19) #define XA_PIXMAP ((Atom) 20) #define XA_POINT ((Atom) 21) #define XA_RECTANGLE ((Atom) 22) #define XA_RESOURCE_MANAGER ((Atom) 23) #define XA_RGB_COLOR_MAP ((Atom) 24) #define XA_RGB_BEST_MAP ((Atom) 25) #define XA_RGB_BLUE_MAP ((Atom) 26) #define XA_RGB_DEFAULT_MAP ((Atom) 27) #define XA_RGB_GRAY_MAP ((Atom) 28) #define XA_RGB_GREEN_MAP ((Atom) 29) #define XA_RGB_RED_MAP ((Atom) 30) #define XA_STRING ((Atom) 31) #define XA_VISUALID ((Atom) 32) #define XA_WINDOW ((Atom) 33) #define XA_WM_COMMAND ((Atom) 34) #define XA_WM_HINTS ((Atom) 35) #define XA_WM_CLIENT_MACHINE ((Atom) 36) #define XA_WM_ICON_NAME ((Atom) 37) #define XA_WM_ICON_SIZE ((Atom) 38) #define XA_WM_NAME ((Atom) 39) #define XA_WM_NORMAL_HINTS ((Atom) 40) #define XA_WM_SIZE_HINTS ((Atom) 41) #define XA_WM_ZOOM_HINTS ((Atom) 42) #define XA_MIN_SPACE ((Atom) 43) #define XA_NORM_SPACE ((Atom) 44) #define XA_MAX_SPACE ((Atom) 45) #define XA_END_SPACE ((Atom) 46) #define XA_SUPERSCRIPT_X ((Atom) 47) #define XA_SUPERSCRIPT_Y ((Atom) 48) #define XA_SUBSCRIPT_X ((Atom) 49) #define XA_SUBSCRIPT_Y ((Atom) 50) #define XA_UNDERLINE_POSITION ((Atom) 51) #define XA_UNDERLINE_THICKNESS ((Atom) 52) #define XA_STRIKEOUT_ASCENT ((Atom) 53) #define XA_STRIKEOUT_DESCENT ((Atom) 54) #define XA_ITALIC_ANGLE ((Atom) 55) #define XA_X_HEIGHT ((Atom) 56) #define XA_QUAD_WIDTH ((Atom) 57) #define XA_WEIGHT ((Atom) 58) #define XA_POINT_SIZE ((Atom) 59) #define XA_RESOLUTION ((Atom) 60) #define XA_COPYRIGHT ((Atom) 61) #define XA_NOTICE ((Atom) 62) #define XA_FONT_NAME ((Atom) 63) #define XA_FAMILY_NAME ((Atom) 64) #define XA_FULL_NAME ((Atom) 65) #define XA_CAP_HEIGHT ((Atom) 66) #define XA_WM_CLASS ((Atom) 67) #define XA_WM_TRANSIENT_FOR ((Atom) 68) #define XA_LAST_PREDEFINED ((Atom) 68) #endif /* XATOM_H */ dxpc-3.9.2/EncodeBuffer.C0000644000175000017530000002444210560644754014526 0ustar kvigorkvigor#include #include #include #include #include #include "dxpcconf.h" #include "EncodeBuffer.H" #include "IntCache.H" #include "CharCache.H" #include "PixelCache.H" #include "HuffmanCoder.H" #include "constants.H" // #define DEBUG #ifdef DEBUG # define DBG(fmt, ...) printf(fmt, __VA_ARGS__) #else # define DBG(fmt,...) #endif static const int INITIAL_BUFFER_SIZE = 256; static const int PREFIX_SIZE = 16; EncodeBuffer::EncodeBuffer() { size = INITIAL_BUFFER_SIZE; buffer = new unsigned char[size + PREFIX_SIZE]; buffer += PREFIX_SIZE; end = buffer + size; reset(); } EncodeBuffer::~EncodeBuffer() { delete[](buffer - PREFIX_SIZE); } void EncodeBuffer::reset() { nextDest = buffer; freeBitsInDest = 8; cumulativeBits = 0; *nextDest = 0; } void EncodeBuffer::encodeDirect(unsigned int value, unsigned int numBits) { unsigned remainingBits = numBits; assert(numBits <= (sizeof(unsigned) * 8)); assert(numBits != 0); if (end - nextDest < 8) { growBuffer(8); } DBG("EncodeBuffer::encodeDirect: bits %d, freeBitsInDest = %d, value = 0x%08x\n", numBits, freeBitsInDest, value); // Copy a byte at a time, least significant bits first. while (remainingBits) { if (freeBitsInDest > remainingBits) { // We must left shift the value into place. value = value & PARTIAL_INT_MASK[remainingBits]; value <<= (freeBitsInDest - remainingBits); *nextDest |= value; freeBitsInDest -= remainingBits; remainingBits = 0; } else { // We're using all available bits in nextDest, no shift needed. *nextDest |= value & PARTIAL_INT_MASK[freeBitsInDest]; value >>= freeBitsInDest; remainingBits -= freeBitsInDest; *(++nextDest) = 0; freeBitsInDest = 8; } } } void EncodeBuffer::encodeValue(unsigned int value, unsigned int numBits, unsigned int blockSize) { unsigned int remainingBits = numBits; unsigned int numBlocks = 0; assert(numBits <= (sizeof(unsigned) * 8)); assert(numBits != 0); assert(blockSize <= numBits); DBG("EncodeBuffer::encodeValue: bits %d, blockSize %d, freeBitsInDest = %d, value = 0x%08x\n", numBits, blockSize, freeBitsInDest, value); if (blockSize == 0) blockSize = numBits; if ((blockSize == numBits) || (numBits < 3)) { // Don't bother with trying block compression. encodeDirect(value, numBits); return; } do { unsigned int bitsToWrite = blockSize > remainingBits ? remainingBits : blockSize; unsigned int block; // Grab the bitsToWrite least significant bits. block = value & PARTIAL_INT_MASK[bitsToWrite]; value >>= bitsToWrite; // Store 'em. encodeDirect(block, bitsToWrite); remainingBits -= bitsToWrite; if (remainingBits) { unsigned int lastBit; // See if all remaining bits match the most significant bit of the // block just written. lastBit = block & (1 << (bitsToWrite - 1)); unsigned int mask = PARTIAL_INT_MASK[remainingBits]; if ((lastBit && ((value & mask) == mask)) || (!lastBit && ((value & mask) == 0))) { // Remaining bits all match the last bit. // Write a zero marker and we're outta here. DBG("All remaining bits match last bit written (%d) " "(mask = 0x%08x, value = 0x%08x, remainingBits = %d)\n", lastBit ? 1 : 0, mask, value, remainingBits); encodeDirect(0, 1); remainingBits = 0; } else { DBG("Need more blocks (lastBit = %d, value = 0x%08x, mask = 0x%08x, remainingBits = %d\n", lastBit ? 1 : 0, value, mask, remainingBits); // We need more blocks. Write a one marker and go on. encodeDirect(1, 1); } } if (++numBlocks >= 4) { blockSize = numBits; } else if (blockSize > 2) { blockSize >>= 1; } } while (remainingBits); } unsigned int EncodeBuffer::getDataLength() const { unsigned int length = nextDest - buffer; if (freeBitsInDest != 8) length++; return length; } unsigned int EncodeBuffer::getDataLengthInBits() const { unsigned int length = nextDest - buffer; return length * 8 + (8 - freeBitsInDest); } unsigned char *EncodeBuffer::getData() { return buffer; } unsigned int EncodeBuffer::getCumulativeBitsWritten() { unsigned int bitsWritten = getDataLength(); unsigned int diff = bitsWritten - cumulativeBits; cumulativeBits = bitsWritten; return diff; } void EncodeBuffer::growBuffer(unsigned int minumumFreeSpaceAfterGrow) { unsigned int nextDestOffset = nextDest - buffer; unsigned int newSize = size + size; // Make sure the new size will accomodate the required minumum free // space. if (minumumFreeSpaceAfterGrow < 2) { minumumFreeSpaceAfterGrow = 2; } if (newSize - nextDestOffset < minumumFreeSpaceAfterGrow) { newSize = nextDestOffset + minumumFreeSpaceAfterGrow; } unsigned char *newBuffer = new unsigned char[newSize + PREFIX_SIZE] + PREFIX_SIZE; memcpy(newBuffer, buffer, nextDestOffset + 1); newBuffer[nextDestOffset + 1] = 0; delete[](buffer - PREFIX_SIZE); buffer = newBuffer; size = newSize; end = buffer + size; nextDest = buffer + nextDestOffset; } void EncodeBuffer::forceBufferToByteBoundary() { if (freeBitsInDest != 8) { freeBitsInDest = 8; if (++nextDest == end) { growBuffer(); } *nextDest = 0; } } void EncodeBuffer::encodeIndex(unsigned index, int isEscape) { if (index > 1 && !isEscape) index++; DBG("EncodeBuffer::encodeIndex: writing %d\n", index); // Write n leading zeros followed by a 1. while (index) { if (freeBitsInDest <= index) { if (++nextDest == end) { growBuffer(); } *nextDest = 0; index -= freeBitsInDest; freeBitsInDest = 8; } else { freeBitsInDest -= index; index = 0; } } // Now write the trailing one. encodeDirect(1,1); } void EncodeBuffer::encodeEscapeIndex(void) { DBG("EncodeBuffer::encodeEscapeIndex\n"); // Write the magic index 2, which is encoded as '001'. encodeIndex(2, 1); } void EncodeBuffer::encodeCachedValue(unsigned int value, unsigned int numBits, IntCache & cache, unsigned int blockSize) { (void)blockSize; unsigned int newBlockSize = cache.getBlockSize(numBits); unsigned int index; unsigned int sameDiff; // The index is encoded as the number of leading zeros before a 1 // bit. The index value 2 is a magic escape code. DBG("encodeIntCache.\n"); if (cache.lookup(value, index, PARTIAL_INT_MASK[numBits], sameDiff)) { encodeIndex(index); } else { encodeEscapeIndex(); if (sameDiff) encodeDirect(1, 1); else { encodeDirect(0, 1); encodeValue(value, numBits, newBlockSize); } } } void EncodeBuffer::encodeCachedValue(unsigned char value, unsigned int numBits, CharCache & cache, unsigned int blockSize) { unsigned int index; DBG("encodeCharCache.\n"); if (cache.lookup(value, index)) { encodeIndex(index); } else { encodeEscapeIndex(); encodeValue(value, numBits, blockSize); } } void EncodeBuffer::encodeCachedValue(unsigned int value, unsigned int numBits, PixelCache & cache, HuffmanCoder & escapeCoder0, HuffmanCoder & escapeCoder1) { unsigned int index; DBG("encodePixelCache.\n"); if (cache.lookup(value, index)) { encodeIndex(index); } else { encodeEscapeIndex(); // To transmit the value, use run-length coding with the static // Huffman code implemented by the supplied "escapeCoder" object //X encodeValue(value, numBits, numBits); unsigned int srcMask = 0x1; unsigned int pixelValue = ((value & srcMask) ? 1 : 0); encodeDirect(pixelValue, 1); for (unsigned int x = 0; x < numBits;) { unsigned int runStart = x; if (pixelValue) { while (x < numBits) { if (!(value & srcMask)) break; srcMask <<= 1; x++; } } else { while (x < numBits) { if (value & srcMask) break; srcMask <<= 1; x++; } } unsigned int runLength = x - runStart; if (pixelValue) { escapeCoder1.encode(runLength - 1, *this); pixelValue = 0; } else { escapeCoder0.encode(runLength - 1, *this); pixelValue = 1; } } } } void EncodeBuffer::encodeRawMem(const unsigned char *buffer, unsigned int len) { forceBufferToByteBoundary(); if (end - nextDest < (ptrdiff_t) len) { growBuffer(len); } memcpy(nextDest, buffer, len); nextDest += len; if (nextDest == end) { growBuffer(); } else if (nextDest > end) { CERR << "EncodeBuffer::encodeRawMem overrun" << ENDL; abort(); } *nextDest = 0; } dxpc-3.9.2/EncodeBuffer.H0000644000175000017530000000275710560644754014540 0ustar kvigorkvigor#ifndef EncodeBuffer_H # define EncodeBuffer_H class IntCache; class CharCache; class PixelCache; class HuffmanCoder; class EncodeBuffer { public: EncodeBuffer(); ~EncodeBuffer(); void reset(); void encodeValue(unsigned int value, unsigned int numBits, unsigned int blockSize = 0); void encodeCachedValue(unsigned int value, unsigned int numBits, IntCache & cache, unsigned int blockSize = 0); void encodeCachedValue(unsigned char value, unsigned int numBits, CharCache & cache, unsigned int blockSize = 0); void encodeCachedValue(unsigned int value, unsigned int numBits, PixelCache & cache, HuffmanCoder & escapeCoder0, HuffmanCoder & escapeCoder1); void encodeRawMem(const unsigned char *buffer, unsigned int len); void encodeDirect(unsigned int value, unsigned int numBits); unsigned char *getData(); unsigned int getDataLength() const; unsigned int getDataLengthInBits() const; unsigned int getCumulativeBitsWritten(); private: void growBuffer(unsigned int minimumFreeSpaceAfterGrow = 0); void forceBufferToByteBoundary(); void encodeIndex(unsigned index, int isEscape = 0); void encodeEscapeIndex(void); unsigned int size; unsigned char *buffer; unsigned char *end; unsigned char *nextDest; unsigned int freeBitsInDest; unsigned int cumulativeBits; }; #endif /* EncodeBuffer_H */ dxpc-3.9.2/DecodeBuffer.C0000644000175000017530000002360310560644754014512 0ustar kvigorkvigor#include #include #include #include #include "DecodeBuffer.H" #include "IntCache.H" #include "CharCache.H" #include "PixelCache.H" #include "HuffmanCoder.H" #include "constants.H" #include #include #define OSTREAM std::ostream #define OFSTREAM std::ofstream #define COUT std::cout #define CERR std::cerr #define ENDL std::endl #define IOS_OUT std::ios::out // #define DEBUG #ifdef DEBUG # define DBG(fmt, ...) printf(fmt, __VA_ARGS__) #else # define DBG(fmt,...) #endif DecodeBuffer::DecodeBuffer(const unsigned char *data, unsigned int length) { buffer = data; end = buffer + length; nextSrc = buffer; availableBitsInSrc = 8; } int DecodeBuffer::countLeadingZeros(unsigned &value, int endOkay) { unsigned ix = 0; assert(availableBitsInSrc != 0); DBG("DecodeBuffer::countLeadingZeros: availableBitsInSrc = %d, *src = 0x%08x\n", availableBitsInSrc, *nextSrc); while (nextSrc < end) { unsigned mask = 1U << (availableBitsInSrc - 1); while (availableBitsInSrc) { if ((*nextSrc) & mask) { DBG("DecodeBuffer::countLeadingZeros: got %d\n", ix); // consume the 1 bit. availableBitsInSrc--; if (!availableBitsInSrc) { availableBitsInSrc = 8; nextSrc++; } value = ix; return 1; } ix++; mask >>= 1; availableBitsInSrc--; } nextSrc++; availableBitsInSrc = 8; } if (!endOkay) { CERR << "DecodeBuffer::countLeadingZeros: assertion failed." << ENDL; abort(); } return 0; } int DecodeBuffer::decodeDirect(unsigned int &value, unsigned int numBits, int endOkay) { unsigned remainingBits = numBits; unsigned destShift = 0; value = 0; assert(numBits <= (sizeof(unsigned) * 8)); assert(numBits != 0); DBG("DecodeBuffer::decodeDirect: %d bits, availableBitsInSrc = %d: ", numBits, availableBitsInSrc); while (remainingBits) { if (nextSrc >= end) { if (!endOkay) { CERR << "DecodeBuffer::decodeDirect: assertation failed" << ENDL; } return 0; } if (availableBitsInSrc > remainingBits) { // We must shift the bits into place. unsigned readBits = *nextSrc >> (availableBitsInSrc - remainingBits); value |= (readBits & PARTIAL_INT_MASK[remainingBits]) << destShift; availableBitsInSrc -= remainingBits; remainingBits = 0; } else { unsigned readBits = *nextSrc & PARTIAL_INT_MASK[availableBitsInSrc]; value |= readBits << destShift; destShift += availableBitsInSrc; remainingBits -= availableBitsInSrc; nextSrc++; availableBitsInSrc = 8; } } DBG("value = 0x%08x\n", value); return 1; } int DecodeBuffer::decodeValue(unsigned int &value, unsigned int numBits, unsigned int blockSize, int endOkay) { unsigned int remainingBits = numBits; unsigned int numBlocks = 0; unsigned int result = 0; DBG("DecodeBuffer::decodeValue: %d bits, %d blocksize\n", numBits, blockSize); assert(numBits <= (sizeof(unsigned) * 8)); assert(numBits != 0); assert(blockSize <= numBits); if (blockSize == 0) blockSize = numBits; if ((blockSize == numBits) || (numBits < 3)) { // No use for block compression. return decodeDirect(value, numBits, endOkay); } do { unsigned int bitsToRead = blockSize > remainingBits ? remainingBits : blockSize; unsigned int block; if (!decodeDirect(block, bitsToRead, endOkay)) { return 0; } result = result | (block << (numBits - remainingBits)); remainingBits -= bitsToRead; if (remainingBits) { unsigned marker; // Now read the marker bit. if (!decodeDirect(marker, 1, endOkay)) { return 0; } if (!marker) { // The remainder of the value is all the same as the most significant bit // of the last block we read. unsigned lastBit = block & (1 << (bitsToRead - 1)); DBG("decodeBuffer: got block compression (lastBit = %d, remainingBits = %d)\n", lastBit ? 1 : 0, remainingBits); if (lastBit) { // We need to build a mask of doom. unsigned mask = PARTIAL_INT_MASK[remainingBits]; mask <<= (numBits - remainingBits); DBG("Mask of ones = 0x%08x\n", mask); result |= mask; } // No need to extend zeros. // Break out of outer loop, we're done. remainingBits = 0; } } if (++numBlocks >= 4) { blockSize = numBits; } else if (blockSize > 2) { blockSize >>= 1; } } while (remainingBits); DBG("decodeValue: value = 0x%08x\n", value); value = result; return 1; } // Simply returns a pointer to the correct spot in the internal // buffer. If the caller needs this data to last beyond the lifetime // of the internal buffer, they must copy the data. const unsigned char *DecodeBuffer::decodeRawMem(unsigned int len) { const unsigned char *retVal; // Force ourselves to a byte boundary. if (availableBitsInSrc != 8) { availableBitsInSrc = 8; nextSrc++; } retVal = nextSrc; if (end - nextSrc < (ptrdiff_t) len) { CERR << "DecodeBuffer::decodeRawMem called with " << len << " length with only " << end - nextSrc << " bytes remaining." << ENDL; abort(); } nextSrc += len; return retVal; } int DecodeBuffer::decodeCachedValue(unsigned int &value, unsigned int numBits, IntCache &cache, unsigned int blockSize, int endOkay) { unsigned int index; DBG("decodeIntCache.\n"); if (!countLeadingZeros(index, endOkay)) { return 0; } if (index == 2) { unsigned int sameDiff; decodeDirect(sameDiff, 1); if (sameDiff) { value = cache.getLastDiff(PARTIAL_INT_MASK[numBits]); cache.insert(value, PARTIAL_INT_MASK[numBits]); return 1; } blockSize = cache.getBlockSize(numBits); if (!decodeValue(value, numBits, blockSize, endOkay)) { return 0; } cache.insert(value, PARTIAL_INT_MASK[numBits]); return 1; } if (index > 2) index--; if (index > cache.getSize()) { CERR << "Assertion 2 failed in DecodeCachedValue: index=" << index << ", cache size=" << cache.getSize() << ENDL; abort(); } value = cache.get(index); return 1; } int DecodeBuffer::decodeCachedValue(unsigned char &value, unsigned int numBits, CharCache &cache, unsigned int blockSize, int endOkay) { unsigned int index; DBG("decodeCharCache.\n"); if (!countLeadingZeros(index, endOkay)) { return 0; } if (index == 2) { unsigned int val; if (decodeValue(val, numBits, blockSize, endOkay)) { value = (unsigned char) val; cache.insert(value); return 1; } return 0; } if (index > 2) index--; if (index > cache.getSize()) { CERR << "Assertion 4 failed in DecodeCachedValue: index=" << index << ", cache size=" << cache.getSize() << ENDL; abort(); } value = cache.get(index); return 1; } int DecodeBuffer::decodeCachedValue(unsigned int &value, unsigned int numBits, PixelCache & cache, HuffmanCoder & escapeCoder0, HuffmanCoder & escapeCoder1, int endOkay) { unsigned int index = 0; DBG("decodePixelCache.\n"); if (!countLeadingZeros(index, endOkay)) { return 0; } if (index == 2) { value = 0; unsigned int pixelValue; if (!decodeDirect(pixelValue, 1, endOkay)) return 0; unsigned int mask = 0x1; for (unsigned int x = 0; x < numBits;) { unsigned int runLength; if (pixelValue) { runLength = escapeCoder1.decode(*this) + 1; for (unsigned int i = runLength; i; i--) { value |= mask; mask <<= 1; } pixelValue = 0; } else { runLength = escapeCoder0.decode(*this) + 1; mask <<= runLength; pixelValue = 1; } x += runLength; } cache.insert(value); return 1; } if (index > 2) index--; if (index > cache.getSize()) { CERR << "Assertion 6 failed in DecodeCachedValue: index=" << index << ", cache size=" << cache.getSize() << ENDL; abort(); } value = cache.get(index); return 1; } dxpc-3.9.2/DecodeBuffer.H0000644000175000017530000000244010560644754014513 0ustar kvigorkvigor#ifndef DecodeBuffer_H # define DecodeBuffer_H class IntCache; class CharCache; class PixelCache; class HuffmanCoder; class DecodeBuffer { public: DecodeBuffer(const unsigned char *data, unsigned int length); int decodeValue(unsigned int &value, unsigned int numBits, unsigned int blockSize = 0, int endOkay = 0); int decodeCachedValue(unsigned int &value, unsigned int numBits, IntCache & cache, unsigned int blockSize = 0, int endOkay = 0); int decodeCachedValue(unsigned char &value, unsigned int numBits, CharCache & cache, unsigned int blockSize = 0, int endOkay = 0); int decodeCachedValue(unsigned int &value, unsigned int numBits, PixelCache & cache, HuffmanCoder & escapeCoder0, HuffmanCoder & escapeCoder1, int endOkay = 0); const unsigned char *decodeRawMem(unsigned int len); int decodeDirect(unsigned int &value, unsigned int numBits, int endOkay = 0); private: const unsigned char *buffer; const unsigned char *end; const unsigned char *nextSrc; unsigned int availableBitsInSrc; int countLeadingZeros(unsigned &value, int endOkay); }; #endif /* DecodeBuffer_H */ dxpc-3.9.2/Stats.C0000644000175000017530000000276210560644754013276 0ustar kvigorkvigor#include "dxpcconf.h" #include "Stats.H" #include "util.H" Stats::Stats() { for (unsigned int i = 0; i < STATS_OPCODE_MAX; i++) { count_[i] = 0; bitsIn_[i] = 0; bitsOut_[i] = 0; } } Stats::~Stats() { } void Stats::add(unsigned int opcode, unsigned int bitsIn, unsigned int bitsOut) { count_[opcode]++; bitsIn_[opcode] += bitsIn; bitsOut_[opcode] += bitsOut; } void Stats::summarize(unsigned int &bitsIn, unsigned int &bitsOut, int showDetails) { unsigned int totalBitsIn = 0; unsigned int totalBitsOut = 0; if (showDetails) { *logofs << "\nmsg\t\tbits\tbits\tcompression" << ENDL; *logofs << "type\tcount\tin\tout\tratio" << ENDL; *logofs << "----\t-----\t-----\t-----\t-----------" << ENDL; } for (unsigned int i = 0; i < STATS_OPCODE_MAX; i++) if (count_[i]) { totalBitsIn += bitsIn_[i]; totalBitsOut += bitsOut_[i]; if (showDetails) { if (i == 256) { *logofs << "other"; } else { *logofs << i; } *logofs << '\t' << count_[i] << '\t' << bitsIn_[i] << '\t' << bitsOut_[i] << '\t' << (float) bitsIn_[i] / (float) bitsOut_[i] << ":1" << ENDL; } } bitsIn = totalBitsIn; bitsOut = totalBitsOut; } dxpc-3.9.2/Stats.H0000644000175000017530000000072510560644754013300 0ustar kvigorkvigor#ifndef Stats_H # define Stats_H # define STATS_OPCODE_MAX 257 class Stats { public: Stats(); ~Stats(); void add(unsigned int opcode, unsigned int bitsIn, unsigned int bitsOut); void summarize(unsigned int &bitsIn, unsigned int &bitsOut, int showDetails = 0); private: unsigned int count_[STATS_OPCODE_MAX]; unsigned int bitsIn_[STATS_OPCODE_MAX]; unsigned int bitsOut_[STATS_OPCODE_MAX]; }; #endif /* Stats_H */ dxpc-3.9.2/INSTALL0000644000175000017530000000423010560644754013115 0ustar kvigorkvigorBUILDING DXPC ============= To build dxpc, you need: 1. the dxpc source 2. the X11R4, X11R5, or X11R6 include files 3. a C++ compiler for each of the machines/operating systems on which you want to run the Client and/or Server Proxy. 4. the LZO library source, available from http://www.oberhumer.com/opensource/lzo/ (preferred) or http://www.vigor.nu/dxpc/ Once you have these things, here's how to compile and install dxpc: 1. Build and install the LZO library. NB: if you do not have root access on the machine you are working on, you will have to use the --prefix option to LZO's configure script to specify a location for the installation. NB: if you are building for the Win32 platform using the Cygwin32 environment, please see Cygwin notes below. 2. Generate a Makefile To do this, go to the dxpc source directory and run: ./configure This is a GNU autoconf configure script, so it likely will work on your system. If it doesn't, please send the maintainer an email, including any error messages. NB: if you had to install LZO in some non-default location using the --prefix=DIR option (as described in step one), you should now specify the path to LZO by providing the --with-lzo-lib=DIR option to dxpc's configure script. 3. Compile dxpc Just run: make 4. Install dxpc Once you have compiled dxpc, you can install the dxpc executable and its manual page by running: make install make install.man (Since there is only one executable to install, you could also just copy it to your chosen bin directory manually, if you prefer.) Cygwin notes: For some odd reason, the Cygwin linker doesn't by default look in /usr/local/lib. Since lzo installs here by default, I needed to use the --with-lzo-=lib option to configure like so: dxpc> ./configure --with-lzo-lib=/usr/local You may obviously need to change the path given above if you installed lzo in some non-default location. On the final make, the linker complains about the -R option, but generates a valid dxpc.exe anyway. dxpc-3.9.2/dxpc.logo.jpg0000644000175000017530000006772210560644754014502 0ustar kvigorkvigorÿØÿàJFIFÿÛC  !"$"$ÿÛCÿÀX "ÿÄ ÿĵ}!1AQa"q2‘¡#B±ÁRÑð$3br‚ %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyzƒ„…†‡ˆ‰Š’“”•–—˜™š¢£¤¥¦§¨©ª²³´µ¶·¸¹ºÂÃÄÅÆÇÈÉÊÒÓÔÕÖרÙÚáâãäåæçèéêñòóôõö÷øùúÿÄ ÿĵw!1AQaq"2B‘¡±Á #3RðbrÑ $4á%ñ&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz‚ƒ„…†‡ˆ‰Š’“”•–—˜™š¢£¤¥¦§¨©ª²³´µ¶·¸¹ºÂÃÄÅÆÇÈÉÊÒÓÔÕÖרÙÚâãäåæçèéêòóôõö÷øùúÿÚ ?øÊŠ( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š)ÊŽßu¾ƒ4Ú*O"lgÉ“»M0‚:ŒPQEQEQEQEQEQEQRG ÒŒÇþê“L ƒ‚>†€Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š*Λi%õìVÑõsÉôÍ?KÓnõ)¼«Xó¼ç…_©®ÓEð,ï%i}Fv¯øŸÒµ´[;kAÄ¢1íÉ÷>¤×OA@4ß éP¨ kO}ƒ?Ÿÿ^·mt ¸ àv©-z Ô´…C†ìäçÊ‹Ãÿ­RËà­>åv½º0=ùVÍ 9ïÀ­kaÀ¾ÝhÍu_…eÊ–KTBGT–+†ñÂ{Û@Ïg39Úã#ó+éwüi%Ž7S¹Aâ€>2Õô}GJ“mí³F ÀqʟƳëê/ˆzf—šóM !Ø#ÛíîoZðh"ÕšêÄ„s"sÜ{/äÎQJ ³PI'õÓi~–XÄ—²˜³ÿ,Óïîz:æ)UY˜*‚ÄôW [xkK‡ÛùêìOéÒµ ³‚² Oð®?ÏJó‹}TŸ”²”WiÚøJúLæ†!è2ÄOֻķvû©ß°«)§Êz®ßsÿÖ 6ÓÂ6iƒq4³ã…òçõ­k= NˆŒlzWqýs]"iÀd³zô«ÖVH³Œ.ãê~´m£¸„1o—åTµZ_ÂÑÜÄ7tWèËô5è°Øí²rGlô®fèävÍx~»¥Ï¤ßµ¬ÜލøÀeõªë9ÒSÑähЈ?yO¨üGô¯' Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( ºý¥3‘È‹ƒøŠçë¡ð?üOÿ\¿¨ öÈbæ>ÞïþÏ¿8üÏëX6\Ý!ÏjÞ·Æ(JÛ·ùíZ¶c‚8ã…eÛc zqØV­ öü3ÅkÚz~+bØ ãŒôéY6}×±j(Ú ÿ>”Š|CåéM“ ¬OðŒþå/¾Õª˜ƒ~êÝŒh=ñó~¼~Ã\&àÁ°Àç9äÿú«¤ÕÃÜy’1‹—cîsŸç\õÆUYˆÎ9þtá_ãTžå“zG&Èð@üëµNn®ÀŸþ±©ô»aB?¹üÛ'úŠÐTô¥PŽÂ09$ñÓôÿ°–±!ùPqíV•ù9ö§õ BzSÄgüÿŸ¥N<~8§õ Dc¯'éþÎkCG€5Èã¿Qõªárzfµü7ûÑžþô»wn#Ó$$s³ÓŠó»ƒ™Ÿó×üþuë:ݱM&P@ÉLדÊ>sÛŸóýh³€r9ë^9â›§ë×VÊ»SvôìžGåœ~ì¯þEy×ÅK]·Ö—`¬Cúƒ‘üè‹¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š»g¥jhg(y ØP~™ë@¨®ŠÛÂw’çO`ÿt?Ò´í|'f¸2É,§Ópòã@UKµÅÁÄK'ûªMz%®‰§[b´ˆјn#ó­7OûL‚8ã ƒ§Ojó[jÓ ßgöØJtþÕ#]Ëröüq^û¤xn‡&?›±îMrz¶œm.®#%vä}3Åx¼±É”•uV"·üÿÓÿ×/ê+¦Ö4ÛkøŠM†çc¯Þ_¡ÇéY>Ó¥´Ö/íæí·,¬?ˆŠë¬x¸>Ý«~ß§zÁ³\F1Þ·­úP•·Q޹ýkZϨ=x¬›NO^?¥kÚg#Üñ@XàƒÆGzÙµ}1ÛüûÖE—UÁÏ#šØµÁ\þTz1Àãše⟰Ü8&6ÁvëéS ãZy@aeaÃŒÙèæRÜ*ŒzôªrèÂãîn\vó[XŠJ‰¶zÚ˜ÒÈά[î° ”¼xšE ¤.=0 U€œsÓßüÿ…6ÅäàŽã¯ºŠ´¹ã¯Ö€" ÏCøÓ‚ô&¥öïÒžª1Àã¯ùÿ?•D‘ž1ëOX³Çùâ¥ç§­8(éØ P8àVÏ…”kDŒ3šÌ«ú‚=F&ÏB:ЭüFÐÚÃLL/É,ƒê1_<ܦÙYHèÄ~¸þµõ×cMOᎨ(ÉXÂ1ôãÿ­_&ëP˜uãÛŒ1ãœÿ^¼ÿŸÎ¸ÿŠùšRÌS‚~„þØ¿óþ{W5ñ xVèà¥ÿ¾Çøšòš(¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (©ôûsw}°Ïï.GažMt¾У–%Ô/Sp'÷Q‘Æ?¼§ÿªºÕŒg £>ÝkNÊÊ­ãAùT;Ž˜«i¨ùB¨ö  „µ™ºFG׊,\™Âý9­ £êiÛxôÿ'ü(ŠXÄ:îo©Åt^²C.G§½fãŸÇ×ëÿ×®¯Ápn•F1ÎzPQmh µ ×™xºÑŸU¼E8ýé=:ñŸë^É=¹aFÉÅy·-ÀñØÀþ ~(´çëhìÎrž:Ó´‹oô×$ïÊjßšÙ^00sÉÇOåLŠ%Y£Ú¡y=¹é@v|ÜGõ­ëqÅaZ‚·Š¸ÆÖôt}(F×’¯ãZö}°:œÖE¯QÁ=±ë[}GÖ€6¬G#ƒÁõ­«<ñÏ?ʱ¬1Æ:{VÝž0÷  Ê0*lv#¿¥1ÔŽ*RFN:ŒçüÿŸç@C­Y‹]JxX`‰zg·ùïYÌëÐüy£Åq_ÄB±ùã¡Ç˜ÿÐMq2ØL™ÆÂ?Ù?Za]š=±‚=28?Ò¬»ŸoéÿÖºŒ8³¶ºLæ2èF? ¦†ÏLû~´îþŸùéÍ8vÿ£šÈ²èÿÖ+bÏø}(nÃ’=}ëzË ó¬+ÐóÅoØŽ8Ô}ÉøSä)Çùâ•WåëR(ƒÐ¥djqùÖRÄ8ÞÅyµÖ¨‘Í$3¯•*®L×§êHcC•ú}+É>(Ú•uÔ-]Ãà~Mý?*`K«j÷‚ÒY ÁLg¹éúK 9&<à®Aɯñ=ÕÏö¹?h—å Ë󞨯\ðw‰SZÒRí˜ „;•ÇF¯Ðõ¥ :ˆìån=š¤]<çæ™GÐf³ûc*vý)²kç•Gó¦²ÙB92±öÖƒšrY¾ìzzW3q®çîå³êj„ڵÜïÛ@ƒKbœÃ~gùÔ-©[ÇÊ@™÷®2Kù‰æFëôÿ=ª»Ý“Œ±=:Ðo¸ÉxŽ®‰Ûjà~•¶÷ëy.Á‹I¯(û['#Ö´luö…v»ëU},Þ§ŽvÚ~^¹ÿ?…yoÅ+õ–òÞÁ" ]þ§€?CùŠè|OãmauWY'<¿¿µy}ÝÄ·W2\NÛ¤‘‹1¨*(¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ –ÒcouëÖ7 ùŠŠ÷=.u¹±ŠPC£§óÏçV³Ç?ýoóÖ¸†úº½‘³•Àx°Ó±ý1ø ëÍÔ+ÿ-ûƒþ}¨Î}Gùÿ9ýisíúõ¿Ï5DßD:ncíMkñü1†çüþ¡ŸzžÎc Â8ãœV_ÉÓå§üúši¼¶]Éç8çÿ­@Nü9ñ:ßxFçÃ÷n °ó"'¨aé^âYñ¢€.d Ï\1wÀþ" 2¦ðŒ¾ø5‘â0ãY¼`8y™ÿ3‘üÅeê‘lä=}ÅVð쑾¦®¹T±O ÏåÅWÔ¥%<¢r>÷qÓÖ©éS'žPy?Š»n _ñÉÞMn[) w®vÍŽõýîÜž[?çüšè-Ÿj€Ü÷É  k5ðsýϱbŒ‘ùÖ¼¬p-Žþõ¥h'f”Øé_aÜ¢V>øoå^‡á­7¡çVšÕÏ]ø"¼ŽÊÒññ·`ϽlØéÚ©MËlà8Ö€=±¼£\E¿Mñ5¼‡°v_ès\¦³¡Üé’li"—iᑲøW/ö½°ùmnS×sþÇùÕw×uY‘åÜW¨läuÿ `mêC;‡,;}+ν,@ðÅUеk½ð\Z¹ÁâD'åqèkCÇã$”z(þµÏÒÔtïA¨Ä¢)•%#˜Û†úþùo£]ı>¤šòºRÌF $}iÜDŸ\µO½s?ïŒÕ|Oh§‰Ëÿº†¸Š(¸L¾+c†V=·0ãT¦ñ-ë#{’Oô¬:)\ u½NN·%G¢¨V[Ë©F$¹™‡¡sŠ‚Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š·¥^ɧޥÄy 2ÿxwè¶7ñÞ[¤ñ:²0Èϯ/«ºN¥>6øŽä?y àÐ¥OqŽz¥!”ñœ~5g­[] "mÝÿõêÁº üdûf€5|Ö=éHdl›­bK¨ªšeN;µT—[·RÒ²ÙÉ ¦©a”IAÍj\ë¿iù‹ºP-œ;f¼âM}å7±0¼Tâ)Éù"êÔÜ^ܼò–8ÇðŽ=«.çRŠÐ&p wïø×'&»~à…uO÷GøÖ|óK;îšFsîzPªèoÐóÑÕÑ@eÇOóÖ´ôÇi÷ÇŽ¿r -/­Ìò+-¼…D[ŒäéÈæ»ëk-±ýôØP‹v ÙéZ¶—Ê„a3Ó½U¶µ¹pO¶kRÒ6ÄŸ–hÝ®»$`m‰=yýóÍlXøºæ#³Â{cüj•œ pv(Ïû5³caç0.OR?¥X5<´ÏÊinüQ¦j%¾ÕeÔô`}Å-î•5«æ9PW9ýk PµmåžØc·ÿ*¨ÆàRÖŒÅÞÙö/÷Gøàõ»³k1@Å”Œ×]uvc°Úq\ô«Û»&“I¸ýð£œ잀ýiåž-¼ºõÄÊÁ” Žøëúæ²iÒ#Ç#G"”u8e#m (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ væþñüé´PEPEPZ¾°‡PÔ¼»ƒû¨Ô».p[¶?ZÊ«|÷6÷qÉh[ÍÎÞØï@½¦\E·ÚQ„Ú0ÇJÙ¶›Œ$ûúÖ&‡m*YÅ-Ê,w  ºƒ§®+rÝUpBçŽôz œ°Ú½þµ£l÷ )‡J«(ãü+JFâ÷4rÝîxäQšè4kà )væ±íŒJ~á[úEµ¼²¨uxîhåþ¢n#Ê6OlÖ4׳©)/#©­ýNÆÖ,5¸àïgùÖMݲMAŽ£éM[¨æ¦b¹VVP¯ýåÿë×âkƒhH@uÏZíu(¦€°eÊäòÅø®Ú×RÓåµ¼ #~…NO¨ÿ ñÝÇ}«Íqœ}p1šÏ«šÕ‰Óu)m ‚@‡å`1yNQ@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@køNâÚÛVq´nB¨Ì8V$~\d~5‘Wô-.}_P[H>^7;‘«ë@©¥NÌ`²×=+jÙ˜ŒŽ>•GHÓ£²°ŽÖÅc] ¹äÖ´0¶sòç­O Jx,G~y­ hÛ ôÅEo·×Ó½i[Y;‘ûßüw­>ÙJy­½:ò[|ÁúñPÙi…À`篺]'ÃâV]͘9  ùu)®#!•@Æ8ª2©;Žî}Hÿ?çÞOàé¦EkD·_mäJǾðƧjŸ¼².ÉÛ"’?\Ðx’2•ó¦¥y¿ÚçN²žê^eO¼ªyÿNùô¯VÕ,gHkY“¨qùÿž•Àxªu‰óœ´óõÔòÜÎóÌÛÎI¨«GÄoi&³pöHÝ`g¾=³YÔQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQE×ø[B´’Ò+ˤ<œª·ÝQôïøþUÛiir*FŠªüª¬ Œè–HÙßë]Ÿþ½Ý?Ê€6#«ôN?ñ«tü(Nרü°k^Ï·Ö²-s‘ŠØ²¨í@ºv2:~•Úx}rV¸Ý79^>•ÜxpWŸJíô؉ˆp}ë?[ x­Ý.,À8íY¾! ÜP¨œ\×âÍ3OÔmÄw¶P\+tãëÖ»MG;ÿåõÑò'ãÛéLñ_­UgÒž}6AÑwSò<þµä~!Ðïô;ϳޠç;$C•o§øúwVêG={׌|Zÿ(øÿ–ãÿA4€ój(¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¥’“À€ŠÚÓ¼7©]áºòp/ñ®›LðM± fY®|‹úyýKµÄ¸òíå|ôڄׯXxbÖyvöñ㺦OækR-å€ã° ]3Qn–7?÷èÓ†•©“°\ƒïîK¢CþßÔ£Eƒ¾ïÈP…+S°\œúDOò§dj›wg]í¯w])T ²L£Ø€? _ìÆ#ýuÁïP„W'Ù—÷èÒcjÿô ¼ÿ¿-þï#L#?¼ŸŸö©F˜ÇþZÎ?à@JðQ¢êädi—ŒL)±uú]ÿߣ^ø4Ãÿ=ŸÜ’9ý)³IÏï_ò_ð =Ð-æƒGµŽhž6 ÈaŽsþ*Þ±¸ÚºÝ4Ë Ûö‚q´sù ÖïÌg¶QÅjF*܃U#õõÿ?Ö®@xãñ  ;QÈÿ?çŠ×²ŒŠÇµíÅlYòçÐiyN=+½ðºüÑþUÁéxÊô¯Dð¢åÐvÍz6‘û88íéÖ²|M‘í]6‰ 6ã°¬_Fmô /Õ$9<çó®[\Uúé]V®öçŸzåµÑÂñÇÍ@v¬q»xÏÅŸøðŒúÌ;{öMoî·Ð׎üYÁÓãÿ®ÀÈÓÍ(¢Š@QEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQER€IÀ&ºÿ x]¥t¸¾q<¬$qÿÿ ÅÑt+½H‡Ç“üôa×è;ýzW h·³PÑC‡ï,ƒ.º7KŽ^0œ Ú·µèqÛ­fYéqFF-êÜšÓ†Íp>P^HUr1Çz” v}(º[Ô~u2Â\§ùÿs}zW¯vü¥qÚ¿!º~uã?Oú|ÿËqü{.±Ññוã_ñýž¿õÜ#ý1L6¢Š)QEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEkJ²“P¿ŽÖ>7˜ÿu{šö/iñÛۢƨaõ®;áÖ™˜MÛ¯Í1Âû ÿý+ÓtØ2GzÐÛ8B 8Õf€‚–€ßéOqüáM_˵(õÿOé@ž¢—ëþzÒwÇN}zRþ?çüãò ž”ãŽxéÛÐ3Ûð¥?âhÇÞøSŒŸJ]€:Ó‡â?¥0ž¢œ¨ã¡=}?ÏåN´ÀÃ?çüúR†ÿ?áþs@Œ×ù÷§.0JxêsùÓƒŽçÖ€\~§Ë÷ÏòjëÃ.zÿJäu" B:y‡ÿAj…:­Z‡îþ_ÈUdãõ«Qž™  +_¼?ÏzزþµiÔsÓüÿŸ­lÙÖèƒåNƒñ¯_ðJeS·#üÿ*ò °±ñžƒ­{?Ó÷1ôí@“Äj0zVG‹¿äMlG÷è+#Å£:iühÄ|CÄ­õ®?]íÓøº¥v>"âwúâ¸íw >ÍL3VÎ[“þMx×ÅrŸz™@ý {&­œ¶3^7ñ`ľ>ø˜cò4æÔQE (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ ’Ú¸¸ŽûÒ0QøÔu·à»?\G#å…Kþ=ó OðÝš[Ú* !P_ ®²ÍÇÀë×úÖ>—Ä@û¢·T`(îÿ®€é@à`QϨü¨ /z^ÿ_Öš½~´áÉ÷ï@ÿ=jxá-Ô~¾ßçô§XÛ™œg‘×§ù÷­ajQ3·é@oÐ{¥VðMhݦÕ9ÆÎOaõ¬ËÛhòÌÎÃ=cùÐÌÃ8ü(óÇéYÿÚ6EF/®âj&Õ¬Tÿ öÿÖÔÒ‹€1óJ“Y´þ‰ÿõê3­ÅÚ?ð*è…ÎGÞ?­(ºûõͶ·OîõÓßíµˆbüdÿëÐN.{oÇzwÚ‡÷—ù×/ý¶3³Çÿ}šC®)ÿ—t_Äñ@<—¡cb “Žõ¬[³•ýÿý”Ò[Þ-Ò‚ ×õÿ9¢è ¨s‘¿¸ö4‹ý*Ô}þ§ùš¬jÄt§jyZزþóXÖ¿xzs[=Euz&<ÿxv¯pðBÿ£Fqé^áîZ?÷‡½{§‚ú_A@‚¼ < ÈñgüƒúÖºr8‘âÃÿÆ ñü|7ûÕÆë½½üë²ñ'ü|1>¿Ö¸Í{îÇúSŒÖ:¶ÏZñÏŠÿñà?×äkØõŽ­×ðükÇ~,ôã¤ÃùóZ(¢Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@v? aÝ4òú²(ýI®:»ï†IþˆíŒfsÏÑEzVš¹eã8ö­OÔÿ…g飑N?*ÐÏœwÿõÐàv”g¸ÅJ#"€piê2Bç4ÁÔuü*{Aºp84Òø~Á¥À'ó­»í9 P»0•tß 4í cÊŒÇOjÚø‹¢2ò5Ú1×§Zñ­u#‚Þ@ávÈ5嚵ĒL@l.{šô_ˆë˜W€q^5¶TãrûŠÂ˜J2wëÚ¹[ÅL†\NËÁv?(úzÖ‡Ä ¶±³KXäýìä‚Aä ëþp²Þ%ÕIÈ’5'ü$º·ü÷_ûàV=¯ÿ ©ÿ=SþýŠ?á#Õ?çªß±YP¿ü$z®1ç'ýð)á$Õ¿ç²ß±è gðUä·ZM³ÌAvˆ@Æk~å@‰û}\·Ãà[I³꿯ùÿ=zˤÛi;É×þúôu«tªéÁÍOùü…iÛ}àk^Ǩ¬{^õëŠØ²ÎWë@w‡‡Üïó ÷_ÇŒDñÀ+Âô,f1×W¹ø0ÿ EŽ:t ý>àúV?‹N4Ó[ÿ«_ ¬_iÇé@'â/õíõ®7\û£è¥v>!ÿ^ß_ë\n³÷cç×ùSÖz·õükÇ>,ãìk×ýxéô5ìZɘúgšñß‹6*AàÎ=ûój(¢Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@zÃ1þƒÏü÷nÿìŠóêô†¿òéÿ-ŸÿAéºhù±Ó§áW—§ýZ£§rØàûgÚ¯)ú‘þM8;š^ôƒŽ¤gùñJ{ƒÇjZµaÿ+éþúõV¬éßñòœ÷ôÀ¢<¨ýw·ò«ñ”¨’1ŽL—?áXÿOÉ_¾x?îÖ§Æcþ‘9á |Ýñw‘ŒŽ¸ë\L `ŒøWgñ‹¶úƒÓÚ¸©¨ÿ?ç4æøÖm”}ß# vûƸúì>*ÿÈnÛ¯ü{ÿìÆ¸ú(¢Š(¢Š(¢ŠßÒ|Yªi¶ñÛÂ"dŒmRAÝLƒ[š?Žî%¼Xõ"R#Ñ·’¡½HíÇzá*Kh%¹ Èç {UµÝÅÑQ ØVçpé_~¢µP2¢ƒ#1äëþs\÷„täé1[¼¯$„ïcØ{ öÿ]á”g 䓞Ô,jÌ>ób¬Ãnwÿ:‚ 1Çùý*Üê3@m­œ¨ýãgýêèô¨&GV7òGß™1øÖ¹vÁëšÔ¶·¸˜óžƒ=?JÝ¿¼¾ ‹^‡À_ÝÜ?AÐp{gõ¬K›­qÜ£ø‹RqþÕÌ„èU=Æ™s2FGû¦¨¼w#ûƒß€*ßM®*euËé 99¹Ï©®/Æߊô»sx·w–é’ê³Tzò2}ë§Ô¥¾1:/sÇ?¨®?Ä:ìöPI-ÌÁ3œ¨Ïòæ˜eÇÄÝ^V'a#¶çúW?âÝëP,7Æ¡_vG^„ZÌÕ.Vòþk”…!Y!`Ê«R¸Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@zÃ_šÇ“7oöEyýzÃ@>Áÿm›?÷È KÓìOÓéWÇ>‡9üúÕCKíÏoéWÇB1íé@ 0=ý)ÇÓ“sÏëKϨü¨jΛÿH3Þ«U7þ>—ê;ûÐÐÿ›˜?Þ=½«_ã1ÍÔCýóü«àcaà_öO¥l|e ßF÷{}(æï‰ý1»üÃúWßwÿ­þÉö®Ïâ?ü}{é\Só_Š¿ò·>¶ÿû3W]ÅOù [ŸúwÿÙrQEQEQEU½*þ}6ñnmöî0È#ÒªUýÁ5-R+Y&X‘¹$žN;zõ _Ū@—‘£ iVìyϱ×O‘H^>•‹¢ÙGm bÄ«„Uükm]” Ëøq@ÆŒgh[&pP‰ñÛœÕëyGۊ׳‰8ÉêpµÓéQB]23\£?Êã©âº =YÊdéü,Gò T†%€2¨Æ+Ö¾PÒ­ê6¥¢3·fF?ÌÖÖ ßz?E~–Ù9Ø£?Þæßô+bÛjܤRÇ’»\u÷Åv×ÖŒlö¯4ø—uq¤[´© fíWÇ}M0<¦úÖ[+¹-¦ÛæFpv¶A÷¨)ÎÌîÎìY˜ä“Ôšm (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ (¢€ ô†ñãÓþ[?_÷EyýzÃ?øòÿ¶Ïÿ ŠôÍ,ð¼ãéW×ÐqøÖ~™÷G=¿¥hs“ü¿ÏÒ€ÿW§jpéÍ7Žç§ô¥^ŸÎ€VtÜý©qž¾•Z¬ißñô¿Qüèß>¶Ùás»ü+kãçQ^{W?ðeñuϸ­Ÿ‹NQNÜPÎߎnÜýZâ˜öô®Ëâ9ÿJ?Q\[ óŠ_ò·ÿ®ùšäk­ø¡ÿ!›úà?™®J€ (¢€ (¢€ (¢€ QF3žØ¤­Þ[Xê‘\ÝÛùñ©è*¼=H MðkßǧDš¤™œÃ=@ôozêÕ7F 8äÖ&‘%…å¼wV’ù±¸ùHíÛÇë[!Ê"ààr(Ô1Œà qÍhZÆ£¢ç±ïYpÈĘçüÿŸÊ¯À¥€ÜŸCÖ€6­6Œd/½tZmÔQ²n’0p;Šæ,àrFøWG¦Ø±eÉЮ±©AäŒ9éü11þ•ÏK« éæ°öCýk¢ÔtÕX¾l­b¾œ¼åÐg¥a^êñ6@‚l÷%@þµÅx¢âÖKY¤½Tò¶ímäcùí]ÝîŸî!÷JóŠ=Ö¡da²œ©C¸¡¾Û˜ûóé[Ÿ_uàn=©½Àùûâ9ÿLaÇQ\[žqþ{Woñ%12¸Ï-ƒ\3žIÿ?çüúÐ|N9Ö-ÿë€ÿÐruÕüL?ñ8·ÿ®}~c\¥ (¢€ (¢€ )ÑÆò6ÈÑe5m4­AÆE¤ƒëÇó  UkK±ŸQ¼K[uË7$žŠ;“V‹¨ùdãV´ý3X±¹K«I–W¡ ú9Ôè^³I·ŽÖÕw åóüG×?ç¥u±m¨mªÃÖ¹ßÞÏyhwÇ?ñ*ž¸Ï VÚ”2ô'­_‡a<:œt9«–òF¤`ñŽ?:̉ŒcéZ6°ž‡õ  [YÕ@Æ è4Û’¬…Cz}kÊÙrHïJê4Ëx· $ç§gT¿•áÂÀ>¤’,V×W9;< }Пë]n£m Ä6©ûëTsŽãüþ)Àú÷ö  `cdv tä“þzU…¹ñ*cd–ËJµùGPùÿ?J˜~_‡jιŸÅ—<5äl`åGéŠÏšÓÄq,ÑÿzBk¥Œðj)Oï8Àÿõÿõè—þÅÖæ`«öpß«–þñ5øÂµž÷äíùWAh|¸®çÃÎ^½©ã—üX¬ÌLXñÆgoËîÖ|ß µÈ[^i[s‚UäÎ;ÿ}!}'ú>3Ú¹-U²ðûŸ‡—3,÷ð¤}Å'?¨®[Å:µ µ~ìµìSá|MExÅýßægíÒ2è­6³-Ô©¨d°“ªÇÂÙ%xÛÓqªð}JTSåŠHΦWÏÔ¥:Rqši®ŒÕ4ö (¢ aEPEPEPE*‚Çf¥H?¼*ÞŽ­o ´ˆh«Ká>½dóˆu {[û§ò£ktþUr”Ç}«u’§¢“û…í DÔRVˆ·‘¿ƒZ_±×en¸[=`ŸÍX^Þ+s6ŠÑ:x?Ä1´çí"þ5”ø[4ŽÔïèÐÕxw(ÑVšÂàt ßCP¼'Þ€õÇæ×ʱ¸}jÒ’^Žß~Å)ÅìÈ袊à,(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š+Ð~ÿÇOùlÿú¯>¯Aøf?Ðí³è"€='NûŸðOj¾~ù§üÿŸj¡§}ÑëéWÏqŒuãüÿž´îsèN=ÏÿªÓäÒ˜õã¥*õéÉì:ÿŸóÞ€ŒóëÞ¬Ø.¿Ö«onŸç¥X±?éO;Ъü;}·IéZ_9ü dx¶Ì1Æ? ¿ãÇÊ’Nzõêºâž6l7Ns\³|ÖÛb‹Øgqì+¸ñ©ùÿóŸôÔôÏúšoqw‹å’[èZG.Þ_R}ÍbV¿Š?ãî/úçýMdT1…Q@Þ‘"ñe“Hê‹–fÀåM{²slr9‹<º?ƾ«6·w0äÜM^…®?*¸G™ÚàÏv‡¯áZv¾ƒúW‚&»­'ÝÕ¯Øÿ3S'‰üB‡+¬^ÿ] mõiw'˜ú2Üüƒš”uÿ=3_:øœnì{nãò¥_x¥qróöèú´»˜ú1~½‡áþÏ­8r:~^Ïã_9Âgâœý¹yÔ½AñŸŠIûróö¿Ï­V—pæ>#õÏçNcWÍÇÆ¾+È?Û·|ýáëšEñ§Š×¦½{Ó¾j] Ϧa9Q^µ(õþµòÿü&þ-VÈ×ï¿ï¾?*_øN|_·ð_t#;ùçÞ±jÎÃ>¤©ô¨¥?¼O׿ùÅ|Äž<ñ‚.Ñâ Ìc°'®{ŠFñߋۯˆ/ï ?¥ >¢´?¾×g¢8 ¹è»“÷\ÿ:æµõëŠøêˆ>;¹!_Åúç§É{"ÿ"*¼ú߉¯Azî«2°Áó¯$lÄ×f[íJ-“)(î}?®H‘´+ª(Ç,p:WŠüRÖtö°’[Ø'™Îб¸lsÏNœWÑî>mį+Ë9ÍfÜKæÈ[¢Žz ôó,²X<}¼½ç²_‹dB|ÏB:(¢¾|Ô+^Ãþ=#üdV½üzGô?ξǂ¿ß§þùÄçÄü(žŠJZý:çQEWoÎIõ§¨És@RÒíQ’O£mÄ2y~æ¿(Éòz˜ê­CH§«þºÕ*(¢(m æCaV‘@¥¥¯Ò°YnR޽úœ’›–áEW¢@QEÀ`€G¡ª—1¿1üúUº+—á±ÐäÄAI~+Ñî‡J/Ch¤…¶ºãÓÞ£­ÙcIP£ŒƒY7vÍz¡èkó û†je×­GÞ§ø¯_/3¶•e=äQE|¡¸QES㌷'DI¸äô©Åz8,©ïÏỏJÚ!TMêú$•‘Sã‰ä?(ãÔÔ°[îÃ?NÃÖ­ÀôÙvI*ÉT­¢íÕÿ‘Œê[DC²/-óÒ¦€Ô´WÔÐÃQ ­N60rop¢ŠJÞâ’Š)QE®2)má—ï ϨàÕ+‹\´GxôïZTW‰˜ä8z~Ò—u£ÿƒó¹¤*Ê;$pF %kÝÚ¤Ã#å~Ç×ëYR#Få`Šü¿9Èëås÷µƒÙþ³;iÕSCh¢Šñ Š( Š( Š( Š( Š( Š( Š( Š( Š( Š( ½áž>ÃÛý{çþùçõè ?ãÇ¡ÿ\Ýúü¢€=+NéøåW»ÿ_ùÿõzÕ-?®=…]?úÞßþºpûØ=úçð£·øÿœÒqí¯ùõ§vç€}ÏÖ€Ÿñÿ<Õ‹ ý¡@êj®=ÿÏãSØÿ¯^hÒ¼ؘ}zþ5{Ç º&úŸëYžlL>µwÆM˜¤ü?5¸3ã3‡ü{ÿŸzó¯Þ&9ýØþf½ÆgrN3ŸÖ¼ëÄYQœË,~¦©î#ñ1ÿJ‹þ¹ÿSY5«âOøú‹þ¹ÿSYU,aER ph¢€&@̹U'è)v?÷ò¢Ò_.Lò·Zѯ®ÊrÚ9…~v¤·Vþ·9êMÁìglî7åK±ÿ¸ß•hQ^²áªóñýÄ{gØÎØÿÜoÊýÆü«JŠêÍ?ùøþàöϱšQñ÷ò¦V­A=º¿Ì¼7ó®Lg Îç£.gÛo¸¨Ö×Rƒ Ó*WFC†4Æëã±¥î¬ÑÐÆÑEÌ0¢Šµa÷ó|«úšêÁ`êc+Æ=ßáæL¤¢®Ë60ùQîaó7_j±EEu(†"ßÄx¿^§ nÛB úù³·9õ¿åŠŸ÷¿Â¨Ò’I$œ“Ö’¿&̱óÇâ%Z%Ùt_×S¾QV (¢¸ Ö°ÿDüdÖ½üz§ÓúרpWûôÿÂÿ4sâ~MEWéÇ´RRÓ XD`±ûíúTôQXápÔðÔ•*jÉMÉÝ…TR\ÁÃH3è9«­‰¥‡5Y(¯7`I½‰¨ª†þz9ü)É{nßÄWê+†æ]9rªÑûÊösìY¢‘YXeXê -z±’’ºzQEUÀ)$E‘ 8È=ih¥(Æqq’º`bÝBÐJTò?„úŠŠ¶o!BWø‡+XÕøßäÿÙ¸«Cà–«õ_/ÊÇ¡F§ƒšçÄbèá£ÍZj+ÍØ¥ö'¢ª}¾î¿ä?Æœ·°¥—ê+†9î]'eZ?y^Î}‹4SQÕÆUƒjuzQœf¹¢îˆ (¤¦UïmÄÑä}ñÓßÚ¬Q\¸¼-,]Qª¯TdâîŒ8<*æ§×¨áºýj~'˜àgÄÊ„ú~+£=II]Q\EQ@Q@Q@Q@Q@Q@Q@Q@Q@zÃCþƒ×¤Íßý‘^]ÿÃN,Iÿ\Ùÿ¾Ez^ŸÛè*ïQõçùÿžj–Ûè*èÿ=ÿÏùõ ÎG^ÏëþsJ=:vëø{SGO_ÿWùÿ&”p}½OÓ¯ù÷ n{ÿ*žÈ´/ÍéÞ äŸóõïSYŸß f€= ÂM‰‡×Ö®x©·DüóÆ:Îð¡ùד۽\ñ)ÌOŸQüé­ÀòÞžýkˆÖmMÌ$¨ýâç×Ô*í|jyÇ÷¿È®QúÕ½Äy¿‰[¸Õ&=zšÉ®ÇÀ V" ‡ŸÌ×9P÷QE€(¢Š*ýŒ»“Ën«ÓéT)ѱG ½EzYVa,!Té³^DT‡2±­E6'Fw§Wê´êF¤TâîžÇ VŠJZÕ(¢Š`1Ô0ÃEV’ÙOÝ${U¶Ó^V;/¡_ø‘¿æiµ±”x¤§Iç3M¯ÊgY4Žä:$2Hzš×‰hz ¯c–›Ø|Íú µ_¥ðÎUõJÚ¢÷çø.ß«8ëO™Ù “€+&êS4¥¿„p*Ρ6”§“÷ªxœW›{YýR›Ò;ù¾ß/ÏÐÒ…;.fQE|iÐQE­cÿ‰øÿ:É­køôOÇùרp_ûìÿÂÿ4sâ~OEWé‡QEWi²:Æ…Üà Z˾œË&Õ?"ô÷÷¯#:Íá–aý¦òz%çþHÒ>w`¹»yI J§§­V¢Šü‡Œ¯Œ¨êV•ßõ·c¾1QVAEW1DÊñ>Q±üjZÜ,Ëè㨬z–'d`êpE}CžV˪r·z}Wê¼ÿ3*´”×™µE2±‡éõúõ:‘©8;§ª8°QE¥Ä•©EåϸŸÇ½jÕ]I7[î§5óÜOX¼¾zky|·ü.kF\³2ªeàQ¢¤¯Éðº]Ò)A¦Ô–ë¾e^Ùæ½|4eV¤iÇví÷™·erýªl„zžMKEúí 1¡J4ã²V8[»¸QEµÄÉdX»œO¬›ù¼ÙŠƒò¯Þ¼L÷7YfÚ-dôKÏü—üJTùåa·7RLHÎÔþè¨(¢¿Äâ«bª:µ¤å'Üô#d:–›š©ŒÐX’7xÛr1´í.ËÏ:ŠË‘RBÆ)ŽÝké2<Ö¶ª»ýÛÝ~«Ïó1«%ækQ@9(¯Õïs„(¢ŠW9ãÂÈ{Ž>µŒF m<±¯ÞuSY7e Ã4d<×çÜkJŒÕ:Ñ’æZ5}mºû¿S¯ Þ¨ŠŠ(¯€:‚Š( Š( Š( Š( Š( Š( Š( Š( Š( ½á°ÿ@ëœÌݺ|£üþ5çõè? ÿã˯Y›ÿAéwÝëØsW¿OéþöZ£§ôÀÕÐGN>Ÿçüó@Ϩã¸ÿ?—áù/ù8ïþM7õÿ?ýoÔûÒýyõ÷ãÿ­@úóõ©ìñæ¨íØ~\uçñ÷ÿ?ãSÚÿ®üZîü0Ø?çÒ­kç0¿¹ÌUœ`Õxÿ¢I×§õÖày?ŒÏÎ;sŸ¥r²sùWSãOõóž+“ö«{ˆáüyí8ëˆþf¹Úè¼xâgòÇ?øñ®v¡î0¢Š)QEQEbÊo-ö±ù[ô5¡Xõ¡e7˜›XüËúŠû^Í?æ£ÿê¿Uó9«Ãí"Í”µöÇ0QE@Rú]£ËSÉëíV&EcøVS±f,NI¯–âlÓØRú½7ïK%ÿÞŒ.îÄ«Pù’naò¯_z…»…^¦µaŒEAÛõ¯žáÌ«ë•ý¥EîGñ}êÿàšÕŸ*²L¸”Es×°÷§ÖeäÞlœ”t¯µÏ3E—á›Ç-ùü¿Èç§vBij'$õ¤¢Šü¡·'vwQHŠ( µ¬ãÕ?æk&µ¬ãÕ?Ïzúþ ÿ}Ÿø_æŽ|GÂOE%ú]Î1h¢Š«ˆ†öO.݈8'YUn#O©ªù_bl{§Ò /¿Wùþv6…Š(¯—7 (¢€ rô¦Ó–´¦ýá2ö˜ÿ3GëȫՕhÛnúœV­~¯Âx—WÈþËkå¿ùœUÕ¥p¢Š+éî`’.øÙ=A´TÊ*qq{00‡ ON6ÜH=Ò ü-EÒœ ú6¾ãÓÜp«šjåÙ½*­8b}Z¾›†iû\ÂW‡ù˜ÖÒ%ª)(¯Ônq E%\î_Ë߸V-jj‹p=Z²ëòÞ5ĺ˜ØÒéþ/þŽÜ:´nQE|qÐQE($t4á!î3L¢®%…ŠÆ„wѤ*¥X°¦¾ ßÃSš£E{’â|ÉÁB5,’¶‰~f~ƽ‹ypßÇ ¨žYïHÇêi”W—[0ÅWþ-I?VËPŠÙQ\…Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@zÃ?øó:ÿ”ËüÍsÕÐøëþBpÿ×ý˜×=P÷QE€(¢Š(¢Š)Ñ9Ž@ãµ6Šºs•9)ÅÙ jæ¼l/CN¬û¶?–ÇånžÆ¯×ê¹Na~Të³^gHr» EVúm‰å©äõ®œn2:­=—âû 1rvE{¹¼É0>èéPQSÚCæÉÈùG&¿,ýþeŠï)¿ëäŽí!Å„;WÍaÉéì*Ý%àWêØ%<цËñ}YÃ)9;‘^0²§S×éYuªÜš£wÇÜ:ç_ÅiÕk¶Z[Ë¿ùem(¢ŠøÃ (¢Š(¢Š+VÇþ=Sñþu•Z¶?ñêŸó¯®àß÷Ùÿ…þhÃð“ÑEú]Î ¢Š)Ü íPþýG¢ÕJ³©ÇÏüUjüo=“–cY¾ìô)|(¢ŠòMŠ( œ½)´åéZSZ‰C†ÐÖÍbö­ªýƒ$íY‡õ91=Š(¯¸¹ÌQEd^Œ]Éõ¨…Mÿø!P×âYŠåÇVKùåù³Ò‡Â…­K‹T÷Ïó¬ºÕ³ÿdúWÒðv¸É·ü¯óF8„šŠ(¯ÒN0¢Š)GVû‘sYõVéãý*…~CÅnù¥OûwÿIG}Q_:lQEQEQEQEQEQEQEQEQEQEQEQEQEQEQEè †,Éõ™þ:+ÏëÐ>ô.?ç³ÿè#ühÒl>îO·¥\éÈúŠ¥`>NÝ]ûúÿŸóÚ€pp1ùÒþŸçüþ^Ô=¿*QõéÿÖÿ?‡æ¿çüÿžÞÕ5§úñ߯ùÿ>õü¿Ïùü¿9í9”u ÃDlG^ÜU\ÿ£8úw÷SE<sþMXÕú;ôíüÅRÜ/ñ§ß'ýªå$ïÃçØ×Wã.¿ð/JådõíT÷ÃøïþBp×ý˜×=]?ä'9ýÏõ5ÎÔ=ÆQE (¢€ (¢€ (¥E,ÁTdšq‹“InÖqy’dýÕëZ4ÈcFvëïO¯Ô²lµ`0ê/âz¿òù5'ÎÆÊâ8ËÕ—#—rÇ©©o&óîÖ ¯ŽâÓ땽7îGñ}ÿÈè¥Uv*‚Ì “Òµ`ŒEQ×¹õ5ZÂ5‡'îÕÊúÊý…/¬Ô^ô¶ò_ð#*Ó»² È¢ŠúÆ®¬ÌŽD¥Oz™‡za¯7E4ã%tËLÌu(ÅOQM«—qî]èþUN¿2ÌpRÁÖpéÓÐ섹•Š(®Š( µl¿ãÕ?ÏzÊ­[/øõOóÞ¾»ƒßgþù£ GÂOE%úIÆ-QL íP~ýOû5R¯êhHG¸5B¿#â:NžeRýuûÑÝEÞ(¢ŠðÍBŠ( ŸMQÍ>º(Ǩ˜ dë[“Ý2ö…kWè\ B¬û´¾ëÿ™Éˆz ¢Š+í.sQEÀɾ9»ÃùTTû£›™ûF˜+ñtùñ•eÞR‹=(«E Z¶G6©þ{ÖMiéç6Àz+éx>|¸Ù.ñš1Ä|%š)(¯Ò®q…QH Z¨ùûšÏ­=MsoŸF³+ò~.¦ã™I÷Iþýü;÷Š)T ¦¾i&Ý‘±4„Ï­IµOUð¥Pv¥¯­£‡ötÔØÁ»±†ÏAúÓM¸ìÆ¥¥Ö­à°Õ>(%ø~Bæ’êV08èA¨ÙYNb¯b¨#f¹«dtä¿víøU}J4U—€WŠÑ“ï ðñ8 øiß¡ª’ch¢Šã((¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š+¿øh?ÐÎ@ævÿÐWüþUÀWðÓþƒ"®wÉàûÕK.:pж=@üÏ¥/åž?Ï­(ëßôƒ°éóþ4~‡üÿ*wóÿ?ýóššÓpãùŸóÅ@à?ýu=§úÑëí@fŒx^MXÕú4‡Ÿ_ÔU](÷Èâ¬j_ñç'§ýÇøU-Àó?}ïø®a‡æº©‹­s-ëÅSÂxûþBpãþyS\åtŸ?ä'ýrþµÍÔ1…QHŠ( Š( ¯XE…óXrz}*½¬^lœýÑÉ­úîË9åõª‹E·¯—çèsÖ½Ô-V½—blSÉëô©äpˆXö¬¹»–=MzüE™ýV±ƒ÷¥ø#:0æwcj[hŒ²ü#“QV…O' ÷³óWÈä˜:xÌ\aQèµ·{tþº\è«'ÝÀÀéKEú¢Ðá (¢¨˜ÃúȨ©d4DEP¹Ë|ºzV¨å@èT×ÍæùzÅÑi|KUýyšÓŸ+3¨¥`UŠž¢’¿:iÅÙER­[/øõOÇùÖUjÙǪ}?­}o¾Oü/óF„šŠ(¯Ò0¥¤¢˜ ™wFk:h9A‘éZ•®óÙîYO”¤¾}iMÄË¢´4o¼ ûÔfÞ?Cù×ÄUáüD_ºÓ_qÒª¦S§ª3 ㊲"Eè¿)SÉ%j¿¸NÅm¤v£Ò§#ÒšE)àT6`¤>Åw\ýњѪöQìqêßʧ¯Ñ8ð¸(©o-~ý¿ •eÍ!h¢Šöîd„à{RÔ7¯²ÙÏr0+ V"8z3«-¢›û‡wc%Žæ$÷9 RQ_†s6îÏPu_Óätô9ª¬iï¶àÌ1^ÿâU œžÍÛïÓó1ª¯iÑEúáÀQE #¹Mð:÷#ŠÆ­Ú¥,¬‡ä<Šøî)Ê'Œ”+Si[Gú~§M œ·L ªÌp£&­CÁ“ËT 0—ãàrjxwÏ'Í/ÁJ¥Æâ“üQŠõ;ŒÅ§bŒVnˆîMj¿!'¹© !þJƒjéK_Y†ÃÆÂKcîîFaCÓ"˜Ðgø¿1SÑS<{Ä™FK"y\íUf†H¾úàv5±Yú›åÕ=M|‡ä˜,>Xˆ&¥¥»;³¢•I9X§EWÀAEPEPEPEPEPEPEPEPEP]ÿÃCþ…ô™‡_öEpßü4ÏØÿí³cþùé6ŸÒ®g'¯ëÿ×÷ªVD‘“éWAõ=ýúÿZ#¶>ŸZpäýyÿÏ_Λî~¿ç§ù4 öúw ¿l}GùÿëÔö¿ë…AèOæj[?õ zcüÿŸé@V–xçÓü*Ƥâ]/8û¿ÎªéDàÅZÔä&:îKp<ãÅáûØ®aúwÅu,Œäs¿Šå›§áëT÷Ã|Aÿ¤?ÔÿìÆ¹ªé~ ÿÈRúãÿ³æªã (¢Q@*‚Ä2M%\°‹þZ°ÿv»²ì ±µÕ(íÕöDÎ\ªåˆ#FuîjJJkîv' Ýý­~™R¥›hÅI9²•ì»ßbŸ”UzÒþÍP~yÿLR‹ ùé'ÓŠü¿‰©Š­*³Ý±ŠŠ²3*Ky RíÜ{Uóaoýù?Ji³µòÕóøVTjNERÍj6“VdêCAÈ<ŠZŠˆ#3Ù©kõŒ» n5c¿UÙœ3+°QEÞˆ (¢©Öé¤T”Æ®Jôú”™Rò<®ñÔuª•¦ÀAèk:E(åOjüÿˆp^ʪ­¤·õÿ‚uQ•Õ†ÑEó†ÁZ¶_ñêŸç½eV­Ÿü{'Óú×ÖpûäÿÂÿ4aˆøI¨¤¥¯ÑÎ0¢Š)Ü‘Ô0¥¢‰%%f$`àÓH©È­4§¥y•pm|:¢ÔˆH¦‘R”oJO-jàžoEZ‘© ‡{naòÿ:•!ËsíSV¸\žóS­·oóªtAEWÑ…QEÀ*†©&Yb¹5yÜ"cÀ#™$g=I¯’âüÁQÃ,<^³ßÑ›ýMðð¼®6Š(¯ÌÎÑE9I0êE2”V›‹FÔnÇB3Nª:t½b'Ýjí~Í•cãŽÂƲ߯¯_ó<éÖV (¢½ ’Ù:ã¿ju3Šœ\e°"©N抲Ê`ŠŒÅè:ñªà'îjT®GF)þ[{RˆÏµd°ÕÙ ¢ÕåZÆ•w¥Ü4w™ÂÈÊÕ,e (¢R€IÀëBWöñd°ëZ`TVñ£ÇsÖ¥¯Ò²L·êT/%ïËWþ_×Sޤù˜ŽÁ±è*(Ø©,~óuã¥[‚ÿ;áùÔit]¿C^c"~ÆÝçÿÒ”l®Ê¾w’þ½0ÈOV5e­!Ï¡¦I £q(Hë‘ø×Ìò•X’NzÑS>™ëM)ê?OóÞŽQäîâ¬Äá×9ïP¸ãÐÑ*ã9¯k#Ì^½¥ðKGåçýt3©dY¢’–¿INûaEUR0È¥¢†®¬ÆFjµÊe•±×å5m…Fë¹Xc<ù ×ÏæøUW8˵þãH;4fQEù‘Ú©gÿÉôþµ—Z–ñìŸOë_YÁÿï“ÿêŒ+ü$ÔQE~sZ)(§pŠ«s9†uî¥ya]C)È5ÇCFµiÑ‹÷£ºý}àÒLuQ]·$(¢Š«€QE´RQNà-•Röä(1Æ~nçÒ¸ñøú8.­W§âßdTbä숵 ÷·”‡åO©ª”Q_cñµ1ÕåZ¦ïð]ŽøÅEYQ\eQ@ ¬Uƒ)Á­m0š<ÿê+"Ÿ‡CƒüëÝÈó™eµ½í`÷_ªóü̪Óç^fͼÉ2ex=Ç¥K_«Q¯N¼Jnñ}NšvaEV·¢’ŠWi(¢€ (¢QEÀ)²:¢c€)Y‚©f8½fÝÜ› ƒ õ¯8ÍéåÔnõ›Ù~¾†”é¹²9ä2È\þÐTtQ_“U«:³u&îÞ¬îJÊÈ(¢ŠÌaEPEPEPEPEPEPEPEPEP]ïÃ6dqÆDçõQ\v_ & %Älq‡FŽAþB€=RÇîó×s®OùïÞ¨éç€>¢®Â€éïÓšvF3Пñ¦õçêy¥Ÿþ¿Ò€ŸSúÿõþ¿äÔÖœÌ:uþµ>‡õÿëý?ȧDÛdSŸóþÏÖéïÀ•Ñ Õ#$à‘ÇÏxve§Ö½÷À~³Ö´vÞ@`¿•0>oñ5”“ÄÛ‰'¨É®AÓ`*G#Žkß>$xJ]ö@S÷Lr¦kÇõý,¡iO å›’Lýzö²HáÕi]ü;/?øu/k#“©m iÛ£ï]!ðšÏãÿß¿þ½YµÑ£µPƒôÎGS_S˜gãEª.òzzB›¾¦qtP¹ÀÏ¥(èψæ­iêÑãp_­x–±ilYÇ—Ãu”èµÇd 澪¥ÕÚÊsœ’sL i4Ûo“¯«©'ó¨eÒtç$·—õØGùéWcÒ€F:þ4”t-0ô °5ƒ­ÙX6°Éœ¬`½úãô®«R¹û=”’)ù±…úšäH$䓜䞴F6Î92$gÈÆ½V¸·{{+;óóSøV§ÝùˆàŸóþqZí¿âc²U:ŽºW3ÎGqÜSXd{ÖÚpzÇü*ÄVÖï÷¡ŒÿÀEv,bjÍ ”æ‚òr?úÔ»qÅuñéÖ%Fmc'éNþͰ#›HÿïšËë,qŒ˜Ï¿õ¤ÙÏCœþµÚÿfØϬ_•LÓÆ?Ñ#ãÚ¥Õ‹Ž'g|QåöÇ·5Ûfiüÿ¢EÉÏJwö^œý’:Žt8}ƒ¾´å\v#­vÿÙ–cì±ÃÚ”éšüúCÿ|ÓU{Ž1`Óöû×cýa‚>Ëü)ßÙÖ;ú,`äÿ5ß | ¬‘.'ãüÿžÔ téøÿŸóÍvi§XÿH¿/¥^·Ó4àû ê€ÿ:¯íöbä<ýW$ ' Ïÿ^®[i:…Á+90z3.Ñ©ükТŠ‡îâ?ÝP)ÍÀç\ÖRÌ_ÙCä8a¢¼.~Ó"‚vÇùõÿ=kø€=à(Ò½/Vÿ‡É=ò¯1ø–ÁtiÇÌêæô¬ªU•Jw—˜Ò³<ÆŠ(®"‚µ,ÿãÙ?ÏzË­;?øöO§õ¯ªá÷Éÿ…þh¿ÂMEWè‡ ´RQNàPÔ¿×/ûµV­j_ë—ýßëUkòl÷þF}C¾—À‚Š(¯$°¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(Ð>êaí¾Ë#пðÐþ+Ѭ¤ÈÁï^ ¢_6¨Çr2TpàwS×ü öMñn YÃdG|ô4¿N½ùéÅE ‡@sÏz}8ÿú¿^žÔ¹Ç°¤ë“þ{÷£ùãÓÚ€õ ÿŸÿ]AŸÿU =³í×§ëKïëþ­YŠí׿§ûoPXý b³óéNÎ(ïÚ×ûËùÒý¬uÈÿ¾ªŽ}Ïç@'>¿.±?™.‹8Î{V^G¿åVõb^OZ£ÇùÇùô A¹N5NëJ?÷?£UÎ8ý:SZ8݃•ù€à÷ú~´'®ή[ÿUN*x¥Të@Q}Þ•?¡ÏOZ¨—P„Ãéþ:wÛ!÷Ϧ(ÐÉî)j°¼„woÊ—í°ÿµùPšÇÒ«}¶ö¿*>Ù:·å@þ¼ŸçJ==ê ½ƒ[ò¥ûtêß•Zè=)AãüÿŸéTΣl¹ÉaíŠkj¶ŠYøÿdÐŒüÿŸòjôGþ}+”oéQ—™ˆì#ªZ—ÄÏé»RHoåfè#« ïAãéHzò{ߌР‹- Gÿjk€¸ü?ιgâ—ŠoÔ¥¼–úzÓ¼1ü[?¦(Õ|S©Øé†Iﮣ‚àõ>õÀÓ¢Š)QEQEUûYc[u êÏûÕ +ÑË3åõ]X+¶­¯Éþ„NêÆ§üô_Η΋þz/çYTW¹þ·WÿŸkñ3úºîjùÑÏEüé<è¿ç¢þu—Eëuùö¿úºîX¾eyT«6ö5^Š+æñ˜™b«Ê´•›6ŒyU‚Š(®a…Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@Q@:7xÜ> 1); do { buffer_[i] = buffer_[i - 1]; i--; } while (i > target); buffer_[target] = value; } return 1; } insert(value); return 0; } unsigned int CharCache::get(unsigned int index) { unsigned char result = buffer_[index]; if (index != 0) { unsigned int i = index; unsigned int target = (i >> 1); do { buffer_[i] = buffer_[i - 1]; i--; } while (i > target); buffer_[target] = result; } return (unsigned int) result; } void CharCache::insert(unsigned char value) { unsigned int insertionPoint; if (2 >= length_) insertionPoint = length_; else insertionPoint = 2; unsigned int start; if (length_ >= SIZE) start = SIZE - 1; else { start = length_; length_++; } for (unsigned int k = start; k > insertionPoint; k--) buffer_[k] = buffer_[k - 1]; buffer_[insertionPoint] = value; } dxpc-3.9.2/CharCache.H0000644000175000017530000000165710560644754014010 0ustar kvigorkvigor#ifndef CharCache_H # define CharCache_H // CharCache is a counterpart of IntCache that is // optimized for use in compressing text composed // of 8-bit characters. (There used to be an // abstract class Cache from which CharCache and // IntCache were derived. This has been eliminated, // however, since the use of virtual functions // increased the size of each CharCache by 50% // (not a good thing when TextCompressor has an // array of several thousand CharCaches :-) class CharCache { public: CharCache():length_(0) { } ~CharCache() { } unsigned int getSize() const { return (unsigned int) length_; } int lookup(unsigned char value, unsigned int &index); unsigned int get(unsigned int i); void insert(unsigned char value); private: unsigned char length_; unsigned char buffer_[7]; // limit to 7 chars so object will fit in 8 bytes }; #endif /* CharCache_H */ dxpc-3.9.2/ClientChannel.C0000644000175000017530000047554610560644754014725 0ustar kvigorkvigor#include #include "X-headers.H" #include "ClientChannel.H" #include "EncodeBuffer.H" #include "DecodeBuffer.H" #include "util.H" #include ClientChannel::ClientChannel(int xClientFD, unsigned int statisticsLevel) : readBuffer_(xClientFD, this), fd_(xClientFD), firstRequest_(1), firstReply_(1), statisticsLevel_(statisticsLevel) { if (compressImages) { compresser = new Compresser(compressImages); } else { compresser = 0; } } ClientChannel::~ClientChannel() { if (statisticsLevel_ > 0) { *logofs << "\n*** dxpc Client-side Compression Statistics ***\n"; if (statisticsLevel_ >= 2) { *logofs << "\nCompression of requests by message type:\n"; } unsigned int bitsIn, bitsOut; stats_.summarize(bitsIn, bitsOut, (statisticsLevel_ >= 2)); if (statisticsLevel_ >= 2) { *logofs << '\n' << framingBitsOut_ << " bits used for dxpc message framing and multiplexing\n"; } bitsOut += framingBitsOut_; *logofs << "\nOverall compression:" << ENDL << " " << bitsIn << " bits compressed to " << bitsOut << ENDL; if (bitsOut > 0) { *logofs << " (" << (float) bitsIn / (float) bitsOut << ":1 compression ratio)" << ENDL << ENDL; } } if (compresser) { delete compresser; compresser = 0; } } int ClientChannel::doRead(EncodeBuffer & encodeBuffer) { if (!readBuffer_.doRead()) return 0; const unsigned char *buffer; unsigned int size; while ((buffer = readBuffer_.getMessage(size)) != 0) { if (firstRequest_) { for (unsigned int i = 0; i < size; i++) { encodeBuffer.encodeValue((unsigned int) buffer[i], 8); } firstRequest_ = 0; } else { clientCache_.lastRequestSequenceNum++; unsigned char opcode = *buffer; if ((opcode == X_PolyFillRectangle) && (GetUINT(buffer + 2, bigEndian_) == 3)) { opcode = X_NoOperation; } encodeBuffer.encodeCachedValue(opcode, 8, clientCache_. opcodeCache[clientCache_. lastOpcode]); clientCache_.lastOpcode = opcode; switch (opcode) { case X_AllocColor: { encodeBuffer. encodeCachedValue(GetULONG(buffer + 4, bigEndian_), 29, clientCache_.colormapCache, 9); const unsigned char *nextSrc = buffer + 8; unsigned int colorData[3]; for (unsigned int i = 0; i < 3; i++) { unsigned int value = GetUINT(nextSrc, bigEndian_); encodeBuffer.encodeCachedValue(value, 16, *(clientCache_. allocColorRGBCache [i]), 4); colorData[i] = value; nextSrc += 2; } sequenceNumQueue_.push(clientCache_. lastRequestSequenceNum, opcode, colorData[0], colorData[1], colorData[2]); } break; case X_ChangeProperty: { unsigned char format = buffer[16]; encodeBuffer.encodeCachedValue(format, 8, clientCache_. changePropertyFormatCache); unsigned int dataLength = GetULONG(buffer + 20, bigEndian_); encodeBuffer.encodeValue(dataLength, 32, 6); encodeBuffer.encodeValue(buffer[1], 2); encodeBuffer.encodeCachedValue(GetULONG(buffer + 4, bigEndian_), 29, clientCache_.windowCache, 9); encodeBuffer. encodeCachedValue(GetULONG(buffer + 8, bigEndian_), 29, clientCache_. changePropertyPropertyCache, 9); encodeBuffer. encodeCachedValue(GetULONG(buffer + 12, bigEndian_), 29, clientCache_. changePropertyTypeCache, 9); const unsigned char *nextSrc = buffer + 24; if (format == 8) { clientCache_.changePropertyTextCompressor.reset(); for (unsigned int i = 0; i < dataLength; i++) clientCache_.changePropertyTextCompressor. encodeChar(*nextSrc++, encodeBuffer); } else if (format == 32) { for (unsigned int i = 0; i < dataLength; i++) { encodeBuffer.encodeCachedValue(GetULONG(nextSrc, bigEndian_), 32, clientCache_. changePropertyData32Cache); nextSrc += 4; } } else { for (unsigned int i = 0; i < dataLength; i++) { encodeBuffer.encodeValue(GetUINT(nextSrc, bigEndian_), 16); nextSrc += 2; } } } break; case X_ChangeWindowAttributes: { encodeBuffer.encodeValue((size - 12) >> 2, 4); encodeBuffer.encodeCachedValue(GetULONG(buffer + 4, bigEndian_), 29, clientCache_.windowCache, 9); unsigned int bitmask = GetULONG(buffer + 8, bigEndian_); encodeBuffer.encodeCachedValue(bitmask, 15, clientCache_. createWindowBitmaskCache); const unsigned char *nextSrc = buffer + 12; unsigned int mask = 0x1; for (unsigned int j = 0; j < 15; j++) { if (bitmask & mask) { encodeBuffer.encodeCachedValue(GetULONG(nextSrc, bigEndian_), 32, *clientCache_. createWindowAttrCache [j]); nextSrc += 4; } mask <<= 1; } } break; case X_ClearArea: { encodeBuffer.encodeValue((unsigned int) buffer[1], 1); encodeBuffer.encodeCachedValue(GetULONG(buffer + 4, bigEndian_), 29, clientCache_.windowCache, 9); const unsigned char *nextSrc = buffer + 8; for (unsigned int i = 0; i < 4; i++) { encodeBuffer.encodeCachedValue(GetUINT(nextSrc, bigEndian_), 16, *clientCache_. clearAreaGeomCache[i], 8); nextSrc += 2; } } break; case X_CloseFont: { unsigned int font = GetULONG(buffer + 4, bigEndian_); encodeBuffer.encodeValue(font - clientCache_.lastFont, 29, 5); clientCache_.lastFont = font; } break; case X_ConfigureWindow: { encodeBuffer.encodeCachedValue(GetULONG(buffer + 4, bigEndian_), 29, clientCache_.windowCache, 9); unsigned int bitmask = GetUINT(buffer + 8, bigEndian_); encodeBuffer.encodeCachedValue(bitmask, 7, clientCache_. configureWindowBitmaskCache); unsigned int mask = 0x1; const unsigned char *nextSrc = buffer + 12; for (unsigned int i = 0; i < 7; i++) { if (bitmask & mask) { encodeBuffer.encodeCachedValue(GetULONG(nextSrc, bigEndian_), CONFIGUREWINDOW_FIELD_WIDTH [i], *clientCache_. configureWindowAttrCache [i], 8); nextSrc += 4; } mask <<= 1; } } break; case X_ConvertSelection: { encodeBuffer. encodeCachedValue(GetULONG(buffer + 4, bigEndian_), 29, clientCache_. convertSelectionRequestorCache, 9); const unsigned char *nextSrc = buffer + 8; for (unsigned int i = 0; i < 3; i++) { encodeBuffer. encodeCachedValue(GetULONG(nextSrc, bigEndian_), 29, *(clientCache_. convertSelectionAtomCache[i]), 9); nextSrc += 4; } unsigned int timestamp = GetULONG(nextSrc, bigEndian_); encodeBuffer.encodeValue(timestamp - clientCache_. convertSelectionLastTimestamp, 32, 4); clientCache_.convertSelectionLastTimestamp = timestamp; } break; case X_CopyArea: { encodeBuffer.encodeCachedValue(GetULONG(buffer + 4, bigEndian_), 29, clientCache_.drawableCache, 9); encodeBuffer. encodeCachedValue(GetULONG(buffer + 8, bigEndian_), 29, clientCache_.drawableCache, 9); encodeBuffer. encodeCachedValue(GetULONG(buffer + 12, bigEndian_), 29, clientCache_.gcCache, 9); const unsigned char *nextSrc = buffer + 16; for (unsigned int i = 0; i < 6; i++) { encodeBuffer.encodeCachedValue(GetUINT(nextSrc, bigEndian_), 16, *clientCache_. copyAreaGeomCache[i], 8); nextSrc += 2; } } break; case X_CopyGC: { encodeBuffer.encodeCachedValue(GetULONG(buffer + 4, bigEndian_), 29, clientCache_.gcCache, 9); encodeBuffer. encodeCachedValue(GetULONG(buffer + 8, bigEndian_), 29, clientCache_.gcCache, 9); encodeBuffer. encodeCachedValue(GetULONG(buffer + 12, bigEndian_), 23, clientCache_.createGCBitmaskCache); } break; case X_CopyPlane: { encodeBuffer.encodeCachedValue(GetULONG(buffer + 4, bigEndian_), 29, clientCache_.drawableCache, 9); encodeBuffer. encodeCachedValue(GetULONG(buffer + 8, bigEndian_), 29, clientCache_.drawableCache, 9); encodeBuffer. encodeCachedValue(GetULONG(buffer + 12, bigEndian_), 29, clientCache_.gcCache, 9); const unsigned char *nextSrc = buffer + 16; for (unsigned int i = 0; i < 6; i++) { encodeBuffer.encodeCachedValue(GetUINT(nextSrc, bigEndian_), 16, *clientCache_. copyPlaneGeomCache[i], 8); nextSrc += 2; } encodeBuffer.encodeCachedValue(GetULONG(buffer + 28, bigEndian_), 32, clientCache_. copyPlaneBitPlaneCache, 10); } break; case X_CreateGC: case X_ChangeGC: { encodeBuffer.encodeCachedValue(GetULONG(buffer + 4, bigEndian_), 29, clientCache_.gcCache, 9); const unsigned char *nextSrc = buffer + 8; if (opcode == X_CreateGC) { encodeBuffer.encodeCachedValue(GetULONG(buffer + 8, bigEndian_), 29, clientCache_. drawableCache, 9); nextSrc += 4; } unsigned int bitmask = GetULONG(nextSrc, bigEndian_); nextSrc += 4; encodeBuffer.encodeCachedValue(bitmask, 23, clientCache_. createGCBitmaskCache); unsigned int mask = 0x1; for (unsigned int i = 0; i < 23; i++) { if (bitmask & mask) { unsigned int value = GetULONG(nextSrc, bigEndian_); nextSrc += 4; unsigned int fieldWidth = CREATEGC_FIELD_WIDTH[i]; if (fieldWidth <= 4) { encodeBuffer.encodeValue(value, fieldWidth); } else { encodeBuffer.encodeCachedValue(value, fieldWidth, *clientCache_. createGCAttrCache [i]); } } mask <<= 1; } } break; case X_CreatePixmap: { encodeBuffer.encodeCachedValue(buffer[1], 8, clientCache_.depthCache); unsigned int pixmap = GetULONG(buffer + 4, bigEndian_); unsigned int diff = pixmap - clientCache_.createPixmapLastPixmap; if (diff == 0) encodeBuffer.encodeValue(1, 1); else { encodeBuffer.encodeValue(0, 1); encodeBuffer.encodeValue(diff, 29, 4); clientCache_.createPixmapLastPixmap = pixmap; } encodeBuffer.encodeCachedValue(GetULONG(buffer + 8, bigEndian_), 29, clientCache_.drawableCache, 9); encodeBuffer. encodeCachedValue(GetUINT(buffer + 12, bigEndian_), 16, clientCache_.createPixmapXCache, 8); encodeBuffer. encodeCachedValue(GetUINT(buffer + 14, bigEndian_), 16, clientCache_.createPixmapYCache, 8); } break; case X_CreateWindow: { encodeBuffer.encodeCachedValue((unsigned int) buffer[1], 8, clientCache_.depthCache); encodeBuffer. encodeCachedValue(GetULONG(buffer + 8, bigEndian_), 29, clientCache_.windowCache, 9); encodeBuffer. encodeCachedValue(GetULONG(buffer + 4, bigEndian_), 29, clientCache_.windowCache, 9); const unsigned char *nextSrc = buffer + 12; for (unsigned int i = 0; i < 6; i++) { encodeBuffer.encodeCachedValue(GetUINT(nextSrc, bigEndian_), 16, *clientCache_. createWindowGeomCache [i], 8); nextSrc += 2; } encodeBuffer.encodeCachedValue(GetULONG(buffer + 24, bigEndian_), 29, clientCache_.visualCache); unsigned int bitmask = GetULONG(buffer + 28, bigEndian_); encodeBuffer.encodeCachedValue(bitmask, 15, clientCache_. createWindowBitmaskCache); nextSrc = buffer + 32; unsigned int mask = 0x1; for (unsigned int j = 0; j < 15; j++) { if (bitmask & mask) { encodeBuffer.encodeCachedValue(GetULONG(nextSrc, bigEndian_), 32, *clientCache_. createWindowAttrCache [j]); nextSrc += 4; } mask <<= 1; } } break; case X_DeleteProperty: { encodeBuffer. encodeCachedValue(GetULONG(buffer + 4, bigEndian_), 29, clientCache_.windowCache, 9); encodeBuffer.encodeValue(GetULONG(buffer + 8, bigEndian_), 29, 9); } break; case X_FillPoly: { unsigned int numPoints = ((size - 16) >> 2); encodeBuffer.encodeCachedValue(numPoints, 14, clientCache_. fillPolyNumPointsCache, 4); encodeBuffer. encodeCachedValue(GetULONG(buffer + 4, bigEndian_), 29, clientCache_.drawableCache, 9); encodeBuffer. encodeCachedValue(GetULONG(buffer + 8, bigEndian_), 29, clientCache_.gcCache, 9); encodeBuffer.encodeValue((unsigned int) buffer[12], 2); encodeBuffer.encodeValue((unsigned int) buffer[13], 1); int relativeCoordMode = (buffer[13] != 0); const unsigned char *nextSrc = buffer + 16; unsigned int pointIndex = 0; for (unsigned int i = 0; i < numPoints; i++) { if (relativeCoordMode) { encodeBuffer.encodeCachedValue(GetUINT(nextSrc, bigEndian_), 16, *clientCache_. fillPolyXRelCache [pointIndex], 8); nextSrc += 2; encodeBuffer.encodeCachedValue(GetUINT(nextSrc, bigEndian_), 16, *clientCache_. fillPolyYRelCache [pointIndex], 8); nextSrc += 2; } else { unsigned int x = GetUINT(nextSrc, bigEndian_); nextSrc += 2; unsigned int y = GetUINT(nextSrc, bigEndian_); nextSrc += 2; unsigned int j; for (j = 0; j < 8; j++) if ((x == clientCache_.fillPolyRecentX[j]) && (y == clientCache_.fillPolyRecentY[j])) break; if (j < 8) { encodeBuffer.encodeValue(1, 1); encodeBuffer.encodeValue(j, 3); } else { encodeBuffer.encodeValue(0, 1); encodeBuffer.encodeCachedValue(x, 16, *clientCache_. fillPolyXAbsCache [pointIndex], 8); encodeBuffer.encodeCachedValue(y, 16, *clientCache_. fillPolyYAbsCache [pointIndex], 8); clientCache_.fillPolyRecentX[clientCache_. fillPolyIndex] = x; clientCache_.fillPolyRecentY[clientCache_. fillPolyIndex] = y; clientCache_.fillPolyIndex++; if (clientCache_.fillPolyIndex == 8) clientCache_.fillPolyIndex = 0; } } if (pointIndex + 1 < FILL_POLY_MAX_POINTS) pointIndex++; } } break; case X_FreeColors: { unsigned int numPixels = GetUINT(buffer + 2, bigEndian_) - 3; encodeBuffer.encodeValue(numPixels, 16, 4); encodeBuffer. encodeCachedValue(GetULONG(buffer + 4, bigEndian_), 29, clientCache_.colormapCache, 9); encodeBuffer.encodeValue(GetULONG(buffer + 8, bigEndian_), 32, 4); const unsigned char *nextSrc = buffer + 12; while (numPixels) { encodeBuffer. encodeValue(GetULONG(nextSrc, bigEndian_), 32, 8); nextSrc += 4; numPixels--; } } break; case X_FreeCursor: { encodeBuffer. encodeCachedValue(GetULONG(buffer + 4, bigEndian_), 29, clientCache_.cursorCache, 9); } break; case X_FreeGC: { encodeBuffer.encodeCachedValue(GetULONG(buffer + 4, bigEndian_), 29, clientCache_.gcCache, 9); } break; case X_FreePixmap: { unsigned int pixmap = GetULONG(buffer + 4, bigEndian_); unsigned int diff = pixmap - clientCache_.createPixmapLastPixmap; if (diff == 0) encodeBuffer.encodeValue(1, 1); else { encodeBuffer.encodeValue(0, 1); clientCache_.createPixmapLastPixmap = pixmap; encodeBuffer.encodeValue(diff, 29, 4); } } break; case X_GetAtomName: { encodeBuffer.encodeValue(GetULONG(buffer + 4, bigEndian_), 29, 9); sequenceNumQueue_.push(clientCache_. lastRequestSequenceNum, opcode); } break; case X_GetGeometry: { encodeBuffer.encodeCachedValue(GetULONG(buffer + 4, bigEndian_), 29, clientCache_.drawableCache, 9); sequenceNumQueue_.push(clientCache_. lastRequestSequenceNum, opcode); } break; case X_GetInputFocus: case X_GetModifierMapping: { sequenceNumQueue_.push(clientCache_. lastRequestSequenceNum, opcode); } break; case X_GetKeyboardMapping: { encodeBuffer.encodeValue((unsigned int) buffer[4], 8); encodeBuffer.encodeValue((unsigned int) buffer[5], 8); sequenceNumQueue_.push(clientCache_. lastRequestSequenceNum, opcode); } break; case X_GetProperty: { encodeBuffer.encodeValue((unsigned int) buffer[1], 1); encodeBuffer.encodeCachedValue(GetULONG(buffer + 4, bigEndian_), 29, clientCache_.windowCache, 9); unsigned int property = GetULONG(buffer + 8, bigEndian_); encodeBuffer.encodeValue(property, 29, 9); encodeBuffer. encodeValue(GetULONG(buffer + 12, bigEndian_), 29, 9); encodeBuffer. encodeValue(GetULONG(buffer + 16, bigEndian_), 32, 2); encodeBuffer. encodeValue(GetULONG(buffer + 20, bigEndian_), 32, 8); sequenceNumQueue_.push(clientCache_. lastRequestSequenceNum, opcode, property); } break; case X_GetSelectionOwner: { encodeBuffer.encodeCachedValue(GetULONG(buffer + 4, bigEndian_), 29, clientCache_. getSelectionOwnerSelectionCache, 9); sequenceNumQueue_.push(clientCache_. lastRequestSequenceNum, opcode); } break; case X_GrabButton: case X_GrabPointer: { encodeBuffer.encodeValue((unsigned int) buffer[1], 1); encodeBuffer.encodeCachedValue(GetULONG(buffer + 4, bigEndian_), 29, clientCache_.windowCache, 9); encodeBuffer. encodeCachedValue(GetUINT(buffer + 8, bigEndian_), 16, clientCache_. grabButtonEventMaskCache); encodeBuffer.encodeValue((unsigned int) buffer[10], 1); encodeBuffer.encodeValue((unsigned int) buffer[11], 1); encodeBuffer.encodeCachedValue(GetULONG(buffer + 12, bigEndian_), 29, clientCache_. grabButtonConfineCache, 9); encodeBuffer. encodeCachedValue(GetULONG(buffer + 16, bigEndian_), 29, clientCache_.cursorCache, 9); if (opcode == X_GrabButton) { encodeBuffer.encodeCachedValue(buffer[20], 8, clientCache_. grabButtonButtonCache); encodeBuffer. encodeCachedValue(GetUINT (buffer + 22, bigEndian_), 16, clientCache_. grabButtonModifierCache); } else { unsigned int timestamp = GetULONG(buffer + 20, bigEndian_); encodeBuffer.encodeValue(timestamp - clientCache_. grabKeyboardLastTimestamp, 32, 4); clientCache_.grabKeyboardLastTimestamp = timestamp; sequenceNumQueue_.push(clientCache_. lastRequestSequenceNum, opcode); } } break; case X_GrabKeyboard: { encodeBuffer.encodeValue((unsigned int) buffer[1], 1); encodeBuffer.encodeCachedValue(GetULONG(buffer + 4, bigEndian_), 29, clientCache_.windowCache, 9); unsigned int timestamp = GetULONG(buffer + 8, bigEndian_); encodeBuffer.encodeValue(timestamp - clientCache_. grabKeyboardLastTimestamp, 32, 4); clientCache_.grabKeyboardLastTimestamp = timestamp; encodeBuffer.encodeValue((unsigned int) buffer[12], 1); encodeBuffer.encodeValue((unsigned int) buffer[13], 1); sequenceNumQueue_.push(clientCache_. lastRequestSequenceNum, opcode); } break; case X_GrabServer: case X_UngrabServer: case X_NoOperation: { } break; case X_ImageText8: { unsigned int textLength = (unsigned int) buffer[1]; encodeBuffer.encodeValue(textLength, 8); encodeBuffer.encodeCachedValue(GetULONG(buffer + 4, bigEndian_), 29, clientCache_.drawableCache, 9); encodeBuffer. encodeCachedValue(GetULONG(buffer + 8, bigEndian_), 29, clientCache_.gcCache, 9); unsigned int x = GetUINT(buffer + 12, bigEndian_); int xDiff = x - clientCache_.imageText8LastX; clientCache_.imageText8LastX = x; encodeBuffer.encodeCachedValue(xDiff, 16, clientCache_. imageText8CacheX, 8); unsigned int y = GetUINT(buffer + 14, bigEndian_); int yDiff = y - clientCache_.imageText8LastY; clientCache_.imageText8LastY = y; encodeBuffer.encodeCachedValue(yDiff, 16, clientCache_. imageText8CacheY, 8); const unsigned char *nextSrc = buffer + 16; clientCache_.imageText8TextCompressor.reset(); for (unsigned int j = 0; j < textLength; j++) clientCache_.imageText8TextCompressor. encodeChar(*nextSrc++, encodeBuffer); } break; case X_InternAtom: { unsigned int nameLength = GetUINT(buffer + 4, bigEndian_); encodeBuffer.encodeValue(nameLength, 16, 6); encodeBuffer.encodeValue((unsigned int) buffer[1], 1); const unsigned char *nextSrc = buffer + 8; clientCache_.internAtomTextCompressor.reset(); for (unsigned int i = 0; i < nameLength; i++) clientCache_.internAtomTextCompressor. encodeChar(*nextSrc++, encodeBuffer); sequenceNumQueue_.push(clientCache_. lastRequestSequenceNum, opcode); } break; case X_ListExtensions: { sequenceNumQueue_.push(clientCache_. lastRequestSequenceNum, opcode); } break; case X_ListFonts: { unsigned int textLength = GetUINT(buffer + 6, bigEndian_); encodeBuffer.encodeValue(textLength, 16, 6); encodeBuffer.encodeValue(GetUINT(buffer + 4, bigEndian_), 16, 6); const unsigned char *nextSrc = buffer + 8; clientCache_.polyText8TextCompressor.reset(); for (unsigned int i = 0; i < textLength; i++) clientCache_.polyText8TextCompressor. encodeChar(*nextSrc++, encodeBuffer); sequenceNumQueue_.push(clientCache_. lastRequestSequenceNum, opcode); } break; case X_LookupColor: case X_AllocNamedColor: { sequenceNumQueue_.push(clientCache_. lastRequestSequenceNum, opcode); unsigned int textLength = GetUINT(buffer + 8, bigEndian_); encodeBuffer.encodeValue(textLength, 16, 6); encodeBuffer. encodeCachedValue(GetULONG(buffer + 4, bigEndian_), 29, clientCache_.colormapCache, 9); const unsigned char *nextSrc = buffer + 12; clientCache_.polyText8TextCompressor.reset(); for (unsigned int i = 0; i < textLength; i++) clientCache_.polyText8TextCompressor. encodeChar(*nextSrc++, encodeBuffer); } break; case X_MapWindow: case X_UnmapWindow: case X_MapSubwindows: case X_GetWindowAttributes: case X_DestroyWindow: case X_DestroySubwindows: case X_QueryPointer: case X_QueryTree: { encodeBuffer.encodeCachedValue(GetULONG(buffer + 4, bigEndian_), 29, clientCache_.windowCache, 9); if ((opcode == X_QueryPointer) || (opcode == X_GetWindowAttributes) || (opcode == X_QueryTree)) { sequenceNumQueue_.push(clientCache_. lastRequestSequenceNum, opcode); } } break; case X_OpenFont: { unsigned int nameLength = GetUINT(buffer + 8, bigEndian_); encodeBuffer.encodeValue(nameLength, 16, 7); unsigned int font = GetULONG(buffer + 4, bigEndian_); encodeBuffer.encodeValue(font - clientCache_.lastFont, 29, 5); clientCache_.lastFont = font; const unsigned char *nextSrc = buffer + 12; clientCache_.openFontTextCompressor.reset(); for (; nameLength; nameLength--) clientCache_.openFontTextCompressor. encodeChar(*nextSrc++, encodeBuffer); } break; case X_PolyFillRectangle: { encodeBuffer.encodeCachedValue(GetULONG(buffer + 4, bigEndian_), 29, clientCache_.drawableCache, 9); encodeBuffer. encodeCachedValue(GetULONG(buffer + 8, bigEndian_), 29, clientCache_.gcCache, 9); unsigned int index = 0; unsigned int lastX = 0, lastY = 0; unsigned int lastWidth = 0, lastHeight = 0; for (unsigned int i = 12; i < size;) { unsigned int x = GetUINT(buffer + i, bigEndian_); unsigned int newX = x; x -= lastX; lastX = newX; encodeBuffer.encodeCachedValue(x, 16, *clientCache_. polyFillRectangleCacheX [index], 8); i += 2; unsigned int y = GetUINT(buffer + i, bigEndian_); unsigned int newY = y; y -= lastY; lastY = newY; encodeBuffer.encodeCachedValue(y, 16, *clientCache_. polyFillRectangleCacheY [index], 8); i += 2; unsigned int width = GetUINT(buffer + i, bigEndian_); unsigned int newWidth = width; width -= lastWidth; lastWidth = newWidth; encodeBuffer.encodeCachedValue(width, 16, *clientCache_. polyFillRectangleCacheWidth [index], 8); i += 2; unsigned int height = GetUINT(buffer + i, bigEndian_); unsigned int newHeight = height; height -= lastHeight; lastHeight = newHeight; encodeBuffer.encodeCachedValue(height, 16, *clientCache_. polyFillRectangleCacheHeight [index], 8); i += 2; index = 1; encodeBuffer.encodeValue(((i < size) ? 1 : 0), 1); } } break; case X_PolyPoint: { encodeBuffer.encodeValue(GetUINT(buffer + 2, bigEndian_) - 3, 16, 4); encodeBuffer.encodeValue((unsigned int) buffer[1], 1); encodeBuffer.encodeCachedValue(GetULONG(buffer + 4, bigEndian_), 29, clientCache_.drawableCache, 9); encodeBuffer. encodeCachedValue(GetULONG(buffer + 8, bigEndian_), 29, clientCache_.gcCache, 9); const unsigned char *nextSrc = buffer + 12; unsigned int index = 0; unsigned int lastX = 0, lastY = 0; for (unsigned int i = 12; i < size; i += 4) { unsigned int x = GetUINT(nextSrc, bigEndian_); nextSrc += 2; unsigned int tmp = x; x -= lastX; lastX = tmp; encodeBuffer.encodeCachedValue(x, 16, *clientCache_. polyPointCacheX[index], 8); unsigned int y = GetUINT(nextSrc, bigEndian_); nextSrc += 2; tmp = y; y -= lastY; lastY = tmp; encodeBuffer.encodeCachedValue(y, 16, *clientCache_. polyPointCacheY[index], 8); index = 1; } } break; case X_PolyLine: { encodeBuffer.encodeValue(GetUINT(buffer + 2, bigEndian_) - 3, 16, 4); encodeBuffer.encodeValue((unsigned int) buffer[1], 1); encodeBuffer.encodeCachedValue(GetULONG(buffer + 4, bigEndian_), 29, clientCache_.drawableCache, 9); encodeBuffer. encodeCachedValue(GetULONG(buffer + 8, bigEndian_), 29, clientCache_.gcCache, 9); const unsigned char *nextSrc = buffer + 12; unsigned int index = 0; unsigned int lastX = 0, lastY = 0; for (unsigned int i = 12; i < size; i += 4) { unsigned int x = GetUINT(nextSrc, bigEndian_); nextSrc += 2; unsigned int tmp = x; x -= lastX; lastX = tmp; encodeBuffer.encodeCachedValue(x, 16, *clientCache_. polyLineCacheX[index], 8); unsigned int y = GetUINT(nextSrc, bigEndian_); nextSrc += 2; tmp = y; y -= lastY; lastY = tmp; encodeBuffer.encodeCachedValue(y, 16, *clientCache_. polyLineCacheY[index], 8); index = 1; } } break; case X_PolyRectangle: { encodeBuffer.encodeValue((GetUINT(buffer + 2, bigEndian_) - 3) >> 1, 16, 3); encodeBuffer. encodeCachedValue(GetULONG(buffer + 4, bigEndian_), 29, clientCache_.drawableCache, 9); encodeBuffer. encodeCachedValue(GetULONG(buffer + 8, bigEndian_), 29, clientCache_.gcCache, 9); const unsigned char *end = buffer + size; const unsigned char *nextSrc = buffer + 12; while (nextSrc < end) for (unsigned int i = 0; i < 4; i++) { encodeBuffer.encodeCachedValue(GetUINT(nextSrc, bigEndian_), 16, *clientCache_. polyRectangleGeomCache [i], 8); nextSrc += 2; } } break; case X_PolySegment: { encodeBuffer.encodeValue((GetUINT(buffer + 2, bigEndian_) - 3) >> 1, 16, 4); encodeBuffer. encodeCachedValue(GetULONG(buffer + 4, bigEndian_), 29, clientCache_.drawableCache, 9); encodeBuffer. encodeCachedValue(GetULONG(buffer + 8, bigEndian_), 29, clientCache_.gcCache, 9); const unsigned char *end = buffer + size; const unsigned char *nextSrc = buffer + 12; // unsigned int index = 0; // unsigned int lastX1, lastY1, lastX2, lastY2; while (nextSrc < end) { unsigned int x = GetUINT(nextSrc, bigEndian_); nextSrc += 2; unsigned int xDiff0 = x - clientCache_.polySegmentLastX[0]; unsigned int xDiff1 = x - clientCache_.polySegmentLastX[1]; int xDiff0Abs = (int) xDiff0; if (xDiff0Abs < 0) xDiff0Abs = -xDiff0Abs; int xDiff1Abs = (int) xDiff1; if (xDiff1Abs < 0) xDiff1Abs = -xDiff1Abs; unsigned int y = GetUINT(nextSrc, bigEndian_); nextSrc += 2; unsigned int yDiff0 = y - clientCache_.polySegmentLastY[0]; unsigned int yDiff1 = y - clientCache_.polySegmentLastY[1]; int yDiff0Abs = (int) yDiff0; if (yDiff0Abs < 0) yDiff0Abs = -yDiff0Abs; int yDiff1Abs = (int) yDiff1; if (yDiff1Abs < 0) yDiff1Abs = -yDiff1Abs; int diff0 = xDiff0Abs + yDiff0Abs; int diff1 = xDiff1Abs + yDiff1Abs; if (diff0 < diff1) { encodeBuffer.encodeValue(0, 1); encodeBuffer.encodeCachedValue(xDiff0, 16, clientCache_. polySegmentCacheX, 6); encodeBuffer.encodeCachedValue(yDiff0, 16, clientCache_. polySegmentCacheY, 6); } else { encodeBuffer.encodeValue(1, 1); encodeBuffer.encodeCachedValue(xDiff1, 16, clientCache_. polySegmentCacheX, 6); encodeBuffer.encodeCachedValue(yDiff1, 16, clientCache_. polySegmentCacheY, 6); } clientCache_.polySegmentLastX[clientCache_. polySegmentCacheIndex] = x; clientCache_.polySegmentLastY[clientCache_. polySegmentCacheIndex] = y; clientCache_.polySegmentCacheIndex = clientCache_.polySegmentCacheIndex == 1 ? 0 : 1; } } break; case X_PolyText8: { encodeBuffer.encodeCachedValue(GetULONG(buffer + 4, bigEndian_), 29, clientCache_.drawableCache, 9); encodeBuffer. encodeCachedValue(GetULONG(buffer + 8, bigEndian_), 29, clientCache_.gcCache, 9); unsigned int x = GetUINT(buffer + 12, bigEndian_); int xDiff = x - clientCache_.polyText8LastX; clientCache_.polyText8LastX = x; encodeBuffer.encodeCachedValue(xDiff, 16, clientCache_. polyText8CacheX, 8); unsigned int y = GetUINT(buffer + 14, bigEndian_); int yDiff = y - clientCache_.polyText8LastY; clientCache_.polyText8LastY = y; encodeBuffer.encodeCachedValue(yDiff, 16, clientCache_. polyText8CacheY, 8); const unsigned char *end = buffer + size - 1; const unsigned char *nextSrc = buffer + 16; while (nextSrc < end) { unsigned int textLength = (unsigned int) *nextSrc++; encodeBuffer.encodeValue(1, 1); encodeBuffer.encodeValue(textLength, 8); if (textLength == 255) { encodeBuffer. encodeCachedValue(GetULONG(nextSrc, 1), 29, clientCache_. polyText8FontCache); nextSrc += 4; } else { encodeBuffer.encodeCachedValue(*nextSrc++, 8, clientCache_. polyText8DeltaCache); clientCache_.polyText8TextCompressor.reset(); for (unsigned int i = 0; i < textLength; i++) clientCache_.polyText8TextCompressor. encodeChar(*nextSrc++, encodeBuffer); } } encodeBuffer.encodeValue(0, 1); } break; case X_PutImage: { encodeBuffer.encodeValue(GetUINT(buffer + 2, bigEndian_), 16, 8); encodeBuffer.encodeValue((unsigned int) buffer[1], 2); encodeBuffer.encodeCachedValue(GetULONG(buffer + 4, bigEndian_), 29, clientCache_.drawableCache, 9); encodeBuffer. encodeCachedValue(GetULONG(buffer + 8, bigEndian_), 29, clientCache_.gcCache, 9); unsigned int width = GetUINT(buffer + 12, bigEndian_); encodeBuffer.encodeCachedValue(width, 16, clientCache_. putImageWidthCache, 8); unsigned int height = GetUINT(buffer + 14, bigEndian_); encodeBuffer.encodeCachedValue(height, 16, clientCache_. putImageHeightCache, 8); unsigned int x = GetUINT(buffer + 16, bigEndian_); int xDiff = x - clientCache_.putImageLastX; clientCache_.putImageLastX = x; encodeBuffer.encodeCachedValue(xDiff, 16, clientCache_. putImageXCache, 8); unsigned int y = GetUINT(buffer + 18, bigEndian_); int yDiff = y - clientCache_.putImageLastY; clientCache_.putImageLastY = y; encodeBuffer.encodeCachedValue(yDiff, 16, clientCache_. putImageYCache, 8); encodeBuffer.encodeCachedValue(buffer[20], 8, clientCache_. putImageOffsetCache); encodeBuffer.encodeCachedValue(buffer[21], 8, clientCache_.depthCache); const unsigned char *nextSrc = buffer + 24; if (!compresser || (compresser-> compressBuffer(nextSrc, size - 24, encodeBuffer) == NO_STREAM_COMPRESSION)) { encodeBuffer.encodeValue(NO_STREAM_COMPRESSION, COMPRESSION_TYPE_BITS); if ((buffer[1] == 0) && (height <= 32) && (width > height * PUT_IMAGE_MIN_ASPECT_RATIO)) { // bitmap that probably contains text; // encode using a variant of // text-compression algorithm if ((imageByteOrder_ == 0) && (bitmapBitOrder_ == 0)) { unsigned char *next = (unsigned char *) buffer + 24; for (unsigned int i = 24; i < size; i++) { *next = REVERSED_BYTE[*next]; next++; } } unsigned int widthInBits = ((width / scanlinePad_) * scanlinePad_); if (widthInBits < width) widthInBits += scanlinePad_; unsigned int widthInBytes = (widthInBits >> 3); const unsigned char *nextSrc = buffer + 24; unsigned char srcMask = 0x80; clientCache_.putImageLastPixels.reset(); for (unsigned int xCoord = 0; xCoord < width; xCoord++) { unsigned int columnValue = 0; const unsigned char *next = nextSrc; for (unsigned int h = 0; h < height; h++) { columnValue <<= 1; if (srcMask & *next) columnValue |= 1; next += widthInBytes; } unsigned int modelNum = clientCache_.putImageLastPixels. getValue(); encodeBuffer.encodeCachedValue(columnValue, height, clientCache_. putImagePixelCache [modelNum % PUT_IMAGE_PIXEL_CACHE_SIZE], clientCache_. columnPixel0Coder, clientCache_. columnPixel1Coder); clientCache_.putImageLastPixels. add(columnValue); srcMask >>= 1; if (srcMask == 0) { srcMask = 0x80; nextSrc++; } } } else if (buffer[1] == 0) { // bitmap--use "Modified-Modified-Read" FAX coding if (width + 2 > clientCache_.putImageLineSize) { delete[]clientCache_.putImageReferenceLine; delete[]clientCache_.putImageCodingLine; clientCache_.putImageLineSize = width + 2; clientCache_.putImageReferenceLine = new unsigned int[width + 2]; clientCache_.putImageCodingLine = new unsigned int[width + 2]; } unsigned int widthInBits = ((width / scanlinePad_) * scanlinePad_); if (widthInBits < width) widthInBits += scanlinePad_; unsigned int widthInBytes = (widthInBits >> 3); for (unsigned int h = 0; h < height; h++) { unsigned int codingLineLength = 0; const unsigned char *nextSrc = buffer + 24 + h * widthInBytes; unsigned char nextSrcChar = *nextSrc; if (h) nextSrcChar ^= *(nextSrc - widthInBytes); if ((imageByteOrder_ == 0) && (bitmapBitOrder_ == 0)) nextSrcChar = REVERSED_BYTE[nextSrcChar]; unsigned char srcMask = 0x80; // precede each encoded row with a single bit // indicating // what pixel value (0 or 1) begins the row. unsigned int lastPixelValue = 0; unsigned int pixelValue = ((nextSrcChar & srcMask) ? 1 : 0); if (h == 0) encodeBuffer.encodeValue(pixelValue, 1); for (unsigned int xCoord = 0; xCoord < width;) { // right here we're looking at the start of // a new run unsigned int runStart = xCoord; if (pixelValue) { if (pixelValue != lastPixelValue) clientCache_. putImageCodingLine [codingLineLength++] = xCoord; while (xCoord < width) { if (!(nextSrcChar & srcMask)) break; srcMask >>= 1; if (srcMask == 0) { srcMask = 0x80; nextSrc++; if (xCoord + 1 < width) { nextSrcChar = *nextSrc; if (h) nextSrcChar ^= *(nextSrc - widthInBytes); if ((imageByteOrder_ == 0) && (bitmapBitOrder_ == 0)) nextSrcChar = REVERSED_BYTE [nextSrcChar]; } } xCoord++; } lastPixelValue = pixelValue; } else // pixelValue == 0 { if (pixelValue != lastPixelValue) clientCache_. putImageCodingLine [codingLineLength++] = xCoord; while (xCoord < width) { if (nextSrcChar & srcMask) break; srcMask >>= 1; if (srcMask == 0) { srcMask = 0x80; nextSrc++; if (xCoord + 1 < width) { nextSrcChar = *nextSrc; if (h) nextSrcChar ^= *(nextSrc - widthInBytes); if ((imageByteOrder_ == 0) && (bitmapBitOrder_ == 0)) nextSrcChar = REVERSED_BYTE [nextSrcChar]; } } xCoord++; } lastPixelValue = pixelValue; } // here 'nextSrc' points to either a color change or the // pixel after the end of the scan line. Thus the length // of the solid-color block that just ended can be encoded // (invariant: runLength >= 1) unsigned int runLength = xCoord - runStart; if (pixelValue) { if (h == 0) clientCache_.putImagePixel1Coder. encode(runLength, encodeBuffer); pixelValue = 0; } else { if (h == 0) clientCache_.putImagePixel0Coder. encode(runLength, encodeBuffer); pixelValue = 1; } } clientCache_. putImageCodingLine[codingLineLength++] = width; clientCache_. putImageCodingLine[codingLineLength++] = width; if (h) { unsigned int lastX = 0; unsigned int nextCodingIndex = 0, nextReferenceIndex = 0; while (lastX < width) { unsigned int nextCoding = clientCache_. putImageCodingLine [nextCodingIndex]; unsigned int nextReference = clientCache_. putImageReferenceLine [nextReferenceIndex]; if (nextCoding == nextReference) { clientCache_.putImageDiffCoder. encode(SD_VERTICAL_0, encodeBuffer); lastX = nextCoding; nextCodingIndex++; nextReferenceIndex++; continue; } if (nextCoding > nextReference) { unsigned int diff = nextCoding - nextReference; if (diff == 1) { clientCache_. putImageDiffCoder. encode(SD_VERTICAL_PLUS_1, encodeBuffer); lastX = nextCoding; nextCodingIndex++; nextReferenceIndex++; } else if (diff == 2) { clientCache_. putImageDiffCoder. encode(SD_VERTICAL_PLUS_2, encodeBuffer); lastX = nextCoding; nextCodingIndex++; nextReferenceIndex++; } else { clientCache_. putImageDiffCoder. encode(SD_PASS, encodeBuffer); nextReferenceIndex += 2; } } else // (nextCoding < nextReference) { unsigned int diff = nextReference - nextCoding; if (nextReference == width) diff = 99999; if (diff == 1) { clientCache_. putImageDiffCoder. encode (SD_VERTICAL_MINUS_1, encodeBuffer); lastX = nextCoding; nextCodingIndex++; nextReferenceIndex++; } else if (diff == 2) { clientCache_. putImageDiffCoder. encode (SD_VERTICAL_MINUS_2, encodeBuffer); lastX = nextCoding; nextCodingIndex++; nextReferenceIndex++; } else { clientCache_. putImageDiffCoder. encode(SD_HORIZONTAL, encodeBuffer); if (nextCodingIndex & 1) clientCache_. putImagePixel0Coder. encode(nextCoding - lastX, encodeBuffer); else clientCache_. putImagePixel1Coder. encode(nextCoding - lastX, encodeBuffer); lastX = nextCoding; nextCoding = clientCache_. putImageCodingLine [++nextCodingIndex]; if (nextCodingIndex & 1) clientCache_. putImagePixel0Coder. encode(nextCoding - lastX, encodeBuffer); else clientCache_. putImagePixel1Coder. encode(nextCoding - lastX, encodeBuffer); lastX = nextCoding; nextCodingIndex++; } } } } unsigned int *tmp = clientCache_.putImageReferenceLine; clientCache_.putImageReferenceLine = clientCache_.putImageCodingLine; clientCache_.putImageCodingLine = tmp; } } else { // pixmap, not bitmap if (buffer[21] == 8) { for (unsigned int i = 24; i < size; i++) encodeBuffer.encodeCachedValue(*nextSrc++, 8, clientCache_. putImageByteCache, 4); } else { for (unsigned int i = 24; i < size; i++) encodeBuffer. encodeValue((unsigned int) *nextSrc++, 8); } } } } break; case X_QueryBestSize: { encodeBuffer.encodeValue((unsigned int) buffer[1], 2); encodeBuffer.encodeCachedValue(GetULONG(buffer + 4, bigEndian_), 29, clientCache_.drawableCache, 9); encodeBuffer.encodeValue(GetUINT(buffer + 8, bigEndian_), 16, 8); encodeBuffer.encodeValue(GetUINT(buffer + 10, bigEndian_), 16, 8); sequenceNumQueue_.push(clientCache_. lastRequestSequenceNum, opcode); } break; case X_QueryColors: { unsigned int numColors = ((size - 8) >> 2); encodeBuffer.encodeValue(numColors, 16, 5); encodeBuffer. encodeCachedValue(GetULONG(buffer + 4, bigEndian_), 29, clientCache_.colormapCache, 9); const unsigned char *nextSrc = buffer + 8; unsigned int predictedPixel = clientCache_.queryColorsLastPixel; for (unsigned int i = 0; i < numColors; i++) { unsigned int pixel = GetULONG(nextSrc, bigEndian_); nextSrc += 4; if (pixel == predictedPixel) encodeBuffer.encodeValue(1, 1); else { encodeBuffer.encodeValue(0, 1); encodeBuffer.encodeValue(pixel, 32, 9); } if (i == 0) clientCache_.queryColorsLastPixel = pixel; predictedPixel = pixel + 1; } sequenceNumQueue_.push(clientCache_. lastRequestSequenceNum, opcode); } break; case X_QueryExtension: { unsigned int nameLength = GetUINT(buffer + 4, bigEndian_); encodeBuffer.encodeValue(nameLength, 16, 6); const unsigned char *nextSrc = buffer + 8; for (; nameLength; nameLength--) encodeBuffer.encodeValue((unsigned int) *nextSrc++, 8); sequenceNumQueue_.push(clientCache_. lastRequestSequenceNum, opcode); } break; case X_QueryFont: { unsigned int font = GetULONG(buffer + 4, bigEndian_); encodeBuffer.encodeValue(font - clientCache_.lastFont, 29, 5); clientCache_.lastFont = font; sequenceNumQueue_.push(clientCache_. lastRequestSequenceNum, opcode); } break; case X_SetClipRectangles: { unsigned int numRectangles = ((size - 12) >> 3); encodeBuffer.encodeValue(numRectangles, 13, 4); encodeBuffer.encodeValue((unsigned int) buffer[1], 2); encodeBuffer. encodeCachedValue(GetULONG(buffer + 4, bigEndian_), 29, clientCache_.gcCache, 9); encodeBuffer. encodeCachedValue(GetUINT(buffer + 8, bigEndian_), 16, clientCache_. setClipRectanglesXCache, 8); encodeBuffer. encodeCachedValue(GetUINT(buffer + 10, bigEndian_), 16, clientCache_. setClipRectanglesYCache, 8); const unsigned char *nextSrc = buffer + 12; for (unsigned int i = 0; i < numRectangles; i++) { for (unsigned int j = 0; j < 4; j++) { encodeBuffer. encodeCachedValue(GetUINT (nextSrc, bigEndian_), 16, *clientCache_. setClipRectanglesGeomCache [j], 8); nextSrc += 2; } } } break; case X_SetDashes: { unsigned int numDashes = GetUINT(buffer + 10, bigEndian_); encodeBuffer.encodeCachedValue(numDashes, 16, clientCache_. setDashesLengthCache, 5); encodeBuffer. encodeCachedValue(GetULONG(buffer + 4, bigEndian_), 29, clientCache_.gcCache, 9); encodeBuffer. encodeCachedValue(GetUINT(buffer + 8, bigEndian_), 16, clientCache_.setDashesOffsetCache, 5); const unsigned char *nextSrc = buffer + 12; for (unsigned int i = 0; i < numDashes; i++) encodeBuffer.encodeCachedValue(*nextSrc++, 8, clientCache_. setDashesDashCache_[i & 1], 5); } break; case X_SetSelectionOwner: { encodeBuffer. encodeCachedValue(GetULONG(buffer + 4, bigEndian_), 29, clientCache_.setSelectionOwnerCache, 9); encodeBuffer. encodeCachedValue(GetULONG(buffer + 8, bigEndian_), 29, clientCache_. getSelectionOwnerSelectionCache, 9); encodeBuffer. encodeCachedValue(GetULONG(buffer + 12, bigEndian_), 32, clientCache_. setSelectionOwnerTimestampCache, 9); } break; case X_TranslateCoords: { encodeBuffer. encodeCachedValue(GetULONG(buffer + 4, bigEndian_), 29, clientCache_. translateCoordsSrcCache, 9); encodeBuffer. encodeCachedValue(GetULONG(buffer + 8, bigEndian_), 29, clientCache_. translateCoordsDestCache, 9); encodeBuffer. encodeCachedValue(GetUINT(buffer + 12, bigEndian_), 16, clientCache_.translateCoordsXCache, 8); encodeBuffer. encodeCachedValue(GetUINT(buffer + 14, bigEndian_), 16, clientCache_.translateCoordsYCache, 8); sequenceNumQueue_.push(clientCache_. lastRequestSequenceNum, opcode); } break; default: { encodeBuffer.encodeValue((unsigned int) buffer[1], 8); encodeBuffer.encodeValue(GetUINT(buffer + 2, bigEndian_), 16, 8); const unsigned char *nextSrc = buffer + 4; for (unsigned int i = 4; i < size; i++) encodeBuffer.encodeValue((unsigned int) *nextSrc++, 8); } } // end switch stats_.add(*buffer, size << 3, encodeBuffer.getCumulativeBitsWritten()); } // end non-initial request } return 1; } int ClientChannel:: doWrite(const unsigned char *message, unsigned int length) { writeBuffer_.reset(); // uncompress messages DecodeBuffer decodeBuffer(message, length); if (firstReply_) { unsigned int opcode; decodeBuffer.decodeValue(opcode, 8); unsigned int secondByte; decodeBuffer.decodeValue(secondByte, 8); unsigned int major; decodeBuffer.decodeValue(major, 16); unsigned int minor; decodeBuffer.decodeValue(minor, 16); unsigned int extraLength; decodeBuffer.decodeValue(extraLength, 16); unsigned int outputLength = 8 + (extraLength << 2); unsigned char *outputMessage = writeBuffer_.addMessage(outputLength); *outputMessage = (unsigned char) opcode; outputMessage[1] = (unsigned char) secondByte; PutUINT(major, outputMessage + 2, bigEndian_); PutUINT(minor, outputMessage + 4, bigEndian_); PutUINT(extraLength, outputMessage + 6, bigEndian_); unsigned char *nextDest = outputMessage + 8; unsigned int cached; decodeBuffer.decodeValue(cached, 1); if (cached) memcpy(nextDest, ServerCache::lastInitReply.getData(), outputLength - 8); else { for (unsigned i = 8; i < outputLength; i++) { unsigned int nextByte; decodeBuffer.decodeValue(nextByte, 8); *nextDest++ = (unsigned char) nextByte; } ServerCache::lastInitReply.set(outputLength - 8, outputMessage + 8); } imageByteOrder_ = outputMessage[30]; bitmapBitOrder_ = outputMessage[31]; scanlineUnit_ = outputMessage[32]; scanlinePad_ = outputMessage[33]; firstReply_ = 0; } else { unsigned char opcode; while (decodeBuffer.decodeCachedValue(opcode, 8, serverCache_. opcodeCache[serverCache_. lastOpcode], 8, 1)) { serverCache_.lastOpcode = opcode; unsigned char *outputMessage = NULL; unsigned int outputLength = 0; unsigned int value; // general-purpose temp variable for decoding ints unsigned char cValue; // general-purpose temp variable for decoding chars if (opcode == 1) { // reply unsigned int sequenceNumDiff; decodeBuffer.decodeCachedValue(sequenceNumDiff, 16, serverCache_. replySequenceNumCache, 7); unsigned int sequenceNum = serverCache_.lastSequenceNum + sequenceNumDiff; sequenceNum &= 0xffff; serverCache_.lastSequenceNum = sequenceNum; unsigned short int nextSequenceNum; unsigned char nextOpcode; if (sequenceNumQueue_.peek(nextSequenceNum, nextOpcode) && (nextSequenceNum == sequenceNum)) { unsigned int requestData[3]; sequenceNumQueue_.pop(nextSequenceNum, nextOpcode, requestData[0], requestData[1], requestData[2]); switch (nextOpcode) { case X_AllocColor: { outputLength = 32; outputMessage = writeBuffer_.addMessage(outputLength); unsigned char *nextDest = outputMessage + 8; for (unsigned int i = 0; i < 3; i++) { decodeBuffer.decodeValue(value, 1); if (value) PutUINT(requestData[i], nextDest, bigEndian_); else { decodeBuffer.decodeValue(value, 16, 6); PutUINT(requestData[i] + value, nextDest, bigEndian_); } nextDest += 2; } decodeBuffer.decodeValue(value, 32, 9); PutULONG(value, outputMessage + 16, bigEndian_); } break; case X_GetAtomName: { unsigned int nameLength; decodeBuffer.decodeValue(nameLength, 16, 6); outputLength = RoundUp4(nameLength) + 32; outputMessage = writeBuffer_.addMessage(outputLength); PutUINT(nameLength, outputMessage + 8, bigEndian_); unsigned char *nextDest = outputMessage + 32; clientCache_.internAtomTextCompressor.reset(); for (unsigned int i = 0; i < nameLength; i++) { *nextDest++ = clientCache_.internAtomTextCompressor. decodeChar(decodeBuffer); } } break; case X_GetGeometry: { outputLength = 32; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeCachedValue(cValue, 8, serverCache_. depthCache); outputMessage[1] = cValue; decodeBuffer.decodeCachedValue(value, 29, serverCache_. getGeometryRootCache, 9); PutULONG(value, outputMessage + 8, bigEndian_); unsigned char *nextDest = outputMessage + 12; for (unsigned int i = 0; i < 5; i++) { decodeBuffer.decodeCachedValue(value, 16, *serverCache_. getGeometryGeomCache [i], 8); PutUINT(value, nextDest, bigEndian_); nextDest += 2; } } break; case X_GetInputFocus: { outputLength = 32; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeValue(value, 2); outputMessage[1] = (unsigned char) value; decodeBuffer.decodeCachedValue(value, 29, serverCache_. getInputFocusWindowCache, 9); PutULONG(value, outputMessage + 8, bigEndian_); } break; case X_GetKeyboardMapping: { decodeBuffer.decodeValue(value, 1); if (value) { unsigned int dataLength = ServerCache::getKeyboardMappingLastMap. getLength(); outputLength = 32 + dataLength; outputMessage = writeBuffer_.addMessage(outputLength); outputMessage[1] = ServerCache:: getKeyboardMappingLastKeysymsPerKeycode; memcpy(outputMessage + 32, ServerCache::getKeyboardMappingLastMap. getData(), dataLength); break; } unsigned int numKeycodes; decodeBuffer.decodeValue(numKeycodes, 8); unsigned int keysymsPerKeycode; decodeBuffer.decodeValue(keysymsPerKeycode, 8, 4); ServerCache:: getKeyboardMappingLastKeysymsPerKeycode = keysymsPerKeycode; outputLength = 32 + numKeycodes * keysymsPerKeycode * 4; outputMessage = writeBuffer_.addMessage(outputLength); outputMessage[1] = (unsigned char) keysymsPerKeycode; unsigned char *nextDest = outputMessage + 32; unsigned char previous = 0; for (unsigned int count = numKeycodes * keysymsPerKeycode; count; --count) { decodeBuffer.decodeValue(value, 1); if (value) PutULONG((unsigned int) NoSymbol, nextDest, bigEndian_); else { unsigned int keysym; decodeBuffer.decodeCachedValue(keysym, 24, serverCache_. getKeyboardMappingKeysymCache, 9); decodeBuffer.decodeCachedValue(cValue, 8, serverCache_. getKeyboardMappingLastByteCache, 5); previous += cValue; PutULONG((keysym << 8) | previous, nextDest, bigEndian_); } nextDest += 4; } ServerCache::getKeyboardMappingLastMap. set(outputLength - 32, outputMessage + 32); } break; case X_GetModifierMapping: { unsigned int keycodesPerModifier; decodeBuffer.decodeValue(keycodesPerModifier, 8); outputLength = 32 + (keycodesPerModifier << 3); outputMessage = writeBuffer_.addMessage(outputLength); outputMessage[1] = (unsigned char) keycodesPerModifier; unsigned char *nextDest = outputMessage + 32; decodeBuffer.decodeValue(value, 1); if (value) { memcpy(outputMessage + 32, ServerCache::getModifierMappingLastMap. getData(), ServerCache::getModifierMappingLastMap. getLength()); break; } for (unsigned int count = outputLength - 32; count; count--) { decodeBuffer.decodeValue(value, 1); if (value) *nextDest++ = 0; else { decodeBuffer.decodeValue(value, 8); *nextDest++ = value; } } ServerCache::getModifierMappingLastMap. set(outputLength - 32, outputMessage + 32); } break; case X_GetProperty: { unsigned char format; decodeBuffer.decodeCachedValue(format, 8, serverCache_. getPropertyFormatCache); unsigned int length; decodeBuffer.decodeValue(length, 32, 9); unsigned int numBytes = length; if (format == 16) numBytes <<= 1; else if (format == 32) numBytes <<= 2; outputLength = 32 + RoundUp4(numBytes); outputMessage = writeBuffer_.addMessage(outputLength); outputMessage[1] = format; PutULONG(length, outputMessage + 16, bigEndian_); decodeBuffer.decodeCachedValue(value, 29, serverCache_. getPropertyTypeCache, 9); PutULONG(value, outputMessage + 8, bigEndian_); decodeBuffer.decodeValue(value, 32, 9); PutULONG(value, outputMessage + 12, bigEndian_); unsigned char *nextDest = outputMessage + 32; if (format == 8) { if (requestData[0] == XA_RESOURCE_MANAGER) { decodeBuffer.decodeValue(value, 1); if (value) { memcpy(nextDest, ServerCache::xResources. getData(), ServerCache::xResources. getLength()); break; } } serverCache_.getPropertyTextCompressor. reset(); for (unsigned int i = 0; i < numBytes; i++) { unsigned char nextChar; nextChar = *nextDest++ = serverCache_. getPropertyTextCompressor. decodeChar(decodeBuffer); if (nextChar == 10) { serverCache_. getPropertyTextCompressor. reset(nextChar); } } if (requestData[0] == XA_RESOURCE_MANAGER) ServerCache::xResources.set(numBytes, outputMessage + 32); } else { for (unsigned int i = 0; i < numBytes; i++) { decodeBuffer.decodeValue(value, 8); *nextDest++ = (unsigned char) value; } } } break; case X_GetSelectionOwner: { outputLength = 32; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeCachedValue(value, 29, serverCache_. getSelectionOwnerCache, 9); PutULONG(value, outputMessage + 8, bigEndian_); } break; case X_GetWindowAttributes: { outputLength = 44; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeValue(value, 2); outputMessage[1] = (unsigned char) value; decodeBuffer.decodeCachedValue(value, 29, serverCache_. visualCache, 9); PutULONG(value, outputMessage + 8, bigEndian_); decodeBuffer.decodeCachedValue(value, 16, serverCache_. getWindowAttributesClassCache, 3); PutUINT(value, outputMessage + 12, bigEndian_); decodeBuffer.decodeCachedValue(cValue, 8, serverCache_. getWindowAttributesBitGravityCache); outputMessage[14] = cValue; decodeBuffer.decodeCachedValue(cValue, 8, serverCache_. getWindowAttributesWinGravityCache); outputMessage[15] = cValue; decodeBuffer.decodeCachedValue(value, 32, serverCache_. getWindowAttributesPlanesCache, 9); PutULONG(value, outputMessage + 16, bigEndian_); decodeBuffer.decodeCachedValue(value, 32, serverCache_. getWindowAttributesPixelCache, 9); PutULONG(value, outputMessage + 20, bigEndian_); decodeBuffer.decodeValue(value, 1); outputMessage[24] = (unsigned char) value; decodeBuffer.decodeValue(value, 1); outputMessage[25] = (unsigned char) value; decodeBuffer.decodeValue(value, 2); outputMessage[26] = (unsigned char) value; decodeBuffer.decodeValue(value, 1); outputMessage[27] = (unsigned char) value; decodeBuffer.decodeCachedValue(value, 29, serverCache_. colormapCache, 9); PutULONG(value, outputMessage + 28, bigEndian_); decodeBuffer.decodeCachedValue(value, 32, serverCache_. getWindowAttributesAllEventsCache); PutULONG(value, outputMessage + 32, bigEndian_); decodeBuffer.decodeCachedValue(value, 32, serverCache_. getWindowAttributesYourEventsCache); PutULONG(value, outputMessage + 36, bigEndian_); decodeBuffer.decodeCachedValue(value, 16, serverCache_. getWindowAttributesDontPropagateCache); PutUINT(value, outputMessage + 40, bigEndian_); } break; case X_GrabKeyboard: case X_GrabPointer: { outputLength = 32; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeValue(value, 3); outputMessage[1] = (unsigned char) value; } break; case X_InternAtom: { outputLength = 32; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeValue(value, 29, 9); PutULONG(value, outputMessage + 8, bigEndian_); } break; case X_ListExtensions: { decodeBuffer.decodeValue(value, 32, 8); outputLength = 32 + (value << 2); outputMessage = writeBuffer_.addMessage(outputLength); unsigned int numExtensions; decodeBuffer.decodeValue(numExtensions, 8); outputMessage[1] = (unsigned char) numExtensions; unsigned char *nextDest = outputMessage + 32; for (; numExtensions; numExtensions--) { unsigned int length; decodeBuffer.decodeValue(length, 8); *nextDest++ = (unsigned char) length; for (; length; length--) { decodeBuffer.decodeValue(value, 8); *nextDest++ = value; } } } break; case X_ListFonts: { decodeBuffer.decodeValue(value, 32, 8); outputLength = 32 + (value << 2); outputMessage = writeBuffer_.addMessage(outputLength); unsigned int numFonts; decodeBuffer.decodeValue(numFonts, 16, 6); PutUINT(numFonts, outputMessage + 8, bigEndian_); unsigned char *nextDest = outputMessage + 32; for (; numFonts; numFonts--) { unsigned int length; decodeBuffer.decodeValue(length, 8); *nextDest++ = (unsigned char) length; serverCache_.getPropertyTextCompressor. reset(); for (; length; length--) *nextDest++ = serverCache_. getPropertyTextCompressor. decodeChar(decodeBuffer); } } break; case X_LookupColor: case X_AllocNamedColor: { outputLength = 32; outputMessage = writeBuffer_.addMessage(outputLength); unsigned char *nextDest = outputMessage + 8; if (nextOpcode == X_AllocNamedColor) { decodeBuffer.decodeValue(value, 32, 9); PutULONG(value, nextDest, bigEndian_); nextDest += 4; } unsigned int count = 3; do { decodeBuffer.decodeValue(value, 16, 9); PutUINT(value, nextDest, bigEndian_); unsigned int visualColor; decodeBuffer.decodeValue(visualColor, 16, 5); visualColor += value; visualColor &= 0xffff; PutUINT(visualColor, nextDest + 6, bigEndian_); nextDest += 2; } while (--count); } break; case X_QueryBestSize: { outputLength = 32; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeValue(value, 16, 8); PutUINT(value, outputMessage + 8, bigEndian_); decodeBuffer.decodeValue(value, 16, 8); PutUINT(value, outputMessage + 10, bigEndian_); } break; case X_QueryColors: { unsigned int cached; decodeBuffer.decodeValue(cached, 1, 1); if (cached) { unsigned int numColors = serverCache_.queryColorsLastReply. getLength() / 6; outputLength = 32 + (numColors << 3); outputMessage = writeBuffer_.addMessage(outputLength); PutUINT(numColors, outputMessage + 8, bigEndian_); const unsigned char *nextSrc = serverCache_.queryColorsLastReply. getData(); unsigned char *nextDest = outputMessage + 32; for (; numColors; numColors--) { for (unsigned int i = 0; i < 6; i++) *nextDest++ = *nextSrc++; nextDest += 2; } } else { unsigned int numColors; decodeBuffer.decodeValue(numColors, 16, 5); outputLength = 32 + (numColors << 3); outputMessage = writeBuffer_.addMessage(outputLength); PutUINT(numColors, outputMessage + 8, bigEndian_); unsigned char *nextDest = outputMessage + 32; for (unsigned int c = 0; c < numColors; c++) { for (unsigned int i = 0; i < 3; i++) { decodeBuffer.decodeValue(value, 16); PutUINT(value, nextDest, bigEndian_); nextDest += 2; } } serverCache_.queryColorsLastReply. set(numColors * 6, outputMessage + 32); const unsigned char *nextSrc = nextDest - 1; nextDest = outputMessage + 32 + ((numColors - 1) << 3) + 5; for (; numColors > 1; numColors--) { for (unsigned int i = 0; i < 6; i++) *nextDest-- = *nextSrc--; nextDest -= 2; } } } break; case X_QueryExtension: { outputLength = 32; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeValue(value, 1); outputMessage[8] = (unsigned char) value; decodeBuffer.decodeValue(value, 8); outputMessage[9] = (unsigned char) value; decodeBuffer.decodeValue(value, 8); outputMessage[10] = (unsigned char) value; decodeBuffer.decodeValue(value, 8); outputMessage[11] = (unsigned char) value; } break; case X_QueryFont: { unsigned int numProperties; unsigned int numCharInfos; decodeBuffer.decodeValue(numProperties, 16, 8); decodeBuffer.decodeValue(numCharInfos, 32, 10); outputLength = 60 + numProperties * 8 + numCharInfos * 12; outputMessage = writeBuffer_.addMessage(outputLength); PutUINT(numProperties, outputMessage + 46, bigEndian_); PutULONG(numCharInfos, outputMessage + 56, bigEndian_); decodeCharInfo_(decodeBuffer, outputMessage + 8); decodeCharInfo_(decodeBuffer, outputMessage + 24); decodeBuffer.decodeValue(value, 16, 9); PutUINT(value, outputMessage + 40, bigEndian_); decodeBuffer.decodeValue(value, 16, 9); PutUINT(value, outputMessage + 42, bigEndian_); decodeBuffer.decodeValue(value, 16, 9); PutUINT(value, outputMessage + 44, bigEndian_); decodeBuffer.decodeValue(value, 1); outputMessage[48] = (unsigned char) value; decodeBuffer.decodeValue(value, 8); outputMessage[49] = (unsigned char) value; decodeBuffer.decodeValue(value, 8); outputMessage[50] = (unsigned char) value; decodeBuffer.decodeValue(value, 1); outputMessage[51] = (unsigned char) value; decodeBuffer.decodeValue(value, 16, 9); PutUINT(value, outputMessage + 52, bigEndian_); decodeBuffer.decodeValue(value, 16, 9); PutUINT(value, outputMessage + 54, bigEndian_); unsigned char *nextDest = outputMessage + 60; decodeBuffer.decodeValue(value, 1); if (value) { unsigned int index; decodeBuffer.decodeValue(index, 4); unsigned int length; const unsigned char *data; ServerCache::queryFontFontCache.get(index, length, data); memcpy(nextDest, data, length); break; } unsigned char *saveDest = nextDest; unsigned int length = numProperties * 8 + numCharInfos * 12; for (; numProperties; numProperties--) { decodeBuffer.decodeValue(value, 32, 9); PutULONG(value, nextDest, bigEndian_); decodeBuffer.decodeValue(value, 32, 9); PutULONG(value, nextDest + 4, bigEndian_); nextDest += 8; } for (; numCharInfos; numCharInfos--) { decodeCharInfo_(decodeBuffer, nextDest); nextDest += 12; } ServerCache::queryFontFontCache.set(length, saveDest); } break; case X_QueryPointer: { outputLength = 32; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeValue(value, 1); outputMessage[1] = (unsigned char) value; decodeBuffer.decodeCachedValue(value, 29, serverCache_. queryPointerRootCache, 9); PutULONG(value, outputMessage + 8, bigEndian_); decodeBuffer.decodeCachedValue(value, 29, serverCache_. queryPointerChildCache, 9); PutULONG(value, outputMessage + 12, bigEndian_); decodeBuffer.decodeCachedValue(value, 16, serverCache_. motionNotifyRootXCache, 8); serverCache_.motionNotifyLastRootX += value; PutUINT(serverCache_.motionNotifyLastRootX, outputMessage + 16, bigEndian_); decodeBuffer.decodeCachedValue(value, 16, serverCache_. motionNotifyRootYCache, 8); serverCache_.motionNotifyLastRootY += value; PutUINT(serverCache_.motionNotifyLastRootY, outputMessage + 18, bigEndian_); decodeBuffer.decodeCachedValue(value, 16, serverCache_. motionNotifyEventXCache, 8); PutUINT(serverCache_.motionNotifyLastRootX + value, outputMessage + 20, bigEndian_); decodeBuffer.decodeCachedValue(value, 16, serverCache_. motionNotifyEventYCache, 8); PutUINT(serverCache_.motionNotifyLastRootY + value, outputMessage + 22, bigEndian_); decodeBuffer.decodeCachedValue(value, 16, serverCache_. motionNotifyStateCache); PutUINT(value, outputMessage + 24, bigEndian_); } break; case X_QueryTree: { unsigned int secondByte; decodeBuffer.decodeValue(secondByte, 8); unsigned int replyLength; decodeBuffer.decodeValue(replyLength, 32); outputLength = 32 + (replyLength << 2); outputMessage = writeBuffer_.addMessage(outputLength); outputMessage[1] = (unsigned char) secondByte; unsigned char *nextDest = outputMessage + 8; for (unsigned int i = 8; i < outputLength; i++) { unsigned int nextByte; decodeBuffer.decodeValue(nextByte, 8); *nextDest++ = (unsigned char) nextByte; } } break; case X_TranslateCoords: { outputLength = 32; outputMessage = writeBuffer_.addMessage(outputLength); decodeBuffer.decodeValue(value, 1); outputMessage[1] = (unsigned char) value; decodeBuffer.decodeCachedValue(value, 29, serverCache_. translateCoordsChildCache, 9); PutULONG(value, outputMessage + 8, bigEndian_); decodeBuffer.decodeCachedValue(value, 16, serverCache_. translateCoordsXCache, 8); PutUINT(value, outputMessage + 12, bigEndian_); decodeBuffer.decodeCachedValue(value, 16, serverCache_. translateCoordsYCache, 8); PutUINT(value, outputMessage + 14, bigEndian_); } break; default: { CERR << "assertion failed in ClientProxyReader::processMessage():\n" << " no matching request for reply with sequence number " << sequenceNum << ENDL; } } } else { unsigned int secondByte; decodeBuffer.decodeValue(secondByte, 8); unsigned int replyLength; decodeBuffer.decodeValue(replyLength, 32); outputLength = 32 + (replyLength << 2); outputMessage = writeBuffer_.addMessage(outputLength); outputMessage[1] = (unsigned char) secondByte; unsigned char *nextDest = outputMessage + 8; for (unsigned int i = 8; i < outputLength; i++) { unsigned int nextByte; decodeBuffer.decodeValue(nextByte, 8); *nextDest++ = (unsigned char) nextByte; } } PutULONG((outputLength - 32) >> 2, outputMessage + 4, bigEndian_); } else { // event or error unsigned int sequenceNumDiff; decodeBuffer.decodeCachedValue(sequenceNumDiff, 16, serverCache_. eventSequenceNumCache, 7); serverCache_.lastSequenceNum += sequenceNumDiff; serverCache_.lastSequenceNum &= 0xffff; outputLength = 32; outputMessage = writeBuffer_.addMessage(outputLength); // check if this is an error that matches a sequence number for // which we were expecting a reply unsigned short int dummySequenceNum; unsigned char dummyOpcode; if (sequenceNumQueue_.peek(dummySequenceNum, dummyOpcode) && ((unsigned int) dummySequenceNum == serverCache_.lastSequenceNum)) sequenceNumQueue_.pop(dummySequenceNum, dummyOpcode); switch (opcode) { case 0: { unsigned char code; decodeBuffer.decodeCachedValue(code, 8, serverCache_. errorCodeCache); outputMessage[1] = code; if ((code != 11) && (code != 8) && (code != 15) && (code != 1)) { decodeBuffer.decodeValue(value, 32, 16); PutULONG(value, outputMessage + 4, bigEndian_); } if (code >= 18) { decodeBuffer.decodeCachedValue(value, 16, serverCache_. errorMinorCache); PutUINT(value, outputMessage + 8, bigEndian_); } decodeBuffer.decodeCachedValue(cValue, 8, serverCache_. errorMajorCache); outputMessage[10] = cValue; if (code >= 18) { unsigned char *nextDest = outputMessage + 11; for (unsigned int i = 11; i < 32; i++) { decodeBuffer.decodeValue(value, 8); *nextDest++ = (unsigned char) cValue; } } } break; case ButtonPress: case ButtonRelease: case KeyPress: case KeyRelease: case MotionNotify: case EnterNotify: case LeaveNotify: { if (opcode == MotionNotify) decodeBuffer.decodeValue(value, 1); else if ((opcode == EnterNotify) || (opcode == LeaveNotify)) decodeBuffer.decodeValue(value, 3); else if (opcode == KeyRelease) { decodeBuffer.decodeValue(value, 1); if (value) value = serverCache_.keyPressLastKey; else decodeBuffer.decodeValue(value, 8); } else if ((opcode == ButtonPress) || (opcode == ButtonRelease)) { decodeBuffer.decodeCachedValue(cValue, 8, serverCache_. buttonCache); value = (unsigned int) cValue; } else decodeBuffer.decodeValue(value, 8); outputMessage[1] = (unsigned char) value; decodeBuffer.decodeCachedValue(value, 32, serverCache_. motionNotifyTimestampCache, 9); serverCache_.lastTimestamp += value; PutULONG(serverCache_.lastTimestamp, outputMessage + 4, bigEndian_); unsigned char *nextDest = outputMessage + 8; int skipRest = 0; if (opcode == KeyRelease) { decodeBuffer.decodeValue(value, 1); if (value) { for (unsigned int i = 0; i < 23; i++) *nextDest++ = serverCache_.keyPressCache[i]; skipRest = 1; } } if (!skipRest) { for (unsigned int i = 0; i < 3; i++) { decodeBuffer.decodeCachedValue(value, 29, *serverCache_. motionNotifyWindowCache [i], 6); PutULONG(value, nextDest, bigEndian_); nextDest += 4; } decodeBuffer.decodeCachedValue(value, 16, serverCache_. motionNotifyRootXCache, 6); serverCache_.motionNotifyLastRootX += value; PutUINT(serverCache_.motionNotifyLastRootX, outputMessage + 20, bigEndian_); decodeBuffer.decodeCachedValue(value, 16, serverCache_. motionNotifyRootYCache, 6); serverCache_.motionNotifyLastRootY += value; PutUINT(serverCache_.motionNotifyLastRootY, outputMessage + 22, bigEndian_); decodeBuffer.decodeCachedValue(value, 16, serverCache_. motionNotifyEventXCache, 6); PutUINT(serverCache_.motionNotifyLastRootX + value, outputMessage + 24, bigEndian_); decodeBuffer.decodeCachedValue(value, 16, serverCache_. motionNotifyEventYCache, 6); PutUINT(serverCache_.motionNotifyLastRootY + value, outputMessage + 26, bigEndian_); decodeBuffer.decodeCachedValue(value, 16, serverCache_. motionNotifyStateCache); PutUINT(value, outputMessage + 28, bigEndian_); if ((opcode == EnterNotify) || (opcode == LeaveNotify)) decodeBuffer.decodeValue(value, 2); else decodeBuffer.decodeValue(value, 1); outputMessage[30] = (unsigned char) value; if ((opcode == EnterNotify) || (opcode == LeaveNotify)) { decodeBuffer.decodeValue(value, 2); outputMessage[31] = (unsigned char) value; } else if (opcode == KeyPress) { serverCache_.keyPressLastKey = outputMessage[1]; for (unsigned int i = 8; i < 31; i++) { serverCache_.keyPressCache[i - 8] = outputMessage[i]; } } } } break; case ColormapNotify: { decodeBuffer.decodeCachedValue(value, 29, serverCache_. colormapNotifyWindowCache, 8); PutULONG(value, outputMessage + 4, bigEndian_); decodeBuffer.decodeCachedValue(value, 29, serverCache_. colormapNotifyColormapCache, 8); PutULONG(value, outputMessage + 8, bigEndian_); decodeBuffer.decodeValue(value, 1); outputMessage[12] = (unsigned char) value; decodeBuffer.decodeValue(value, 1); outputMessage[13] = (unsigned char) value; } break; case ConfigureNotify: { unsigned char *nextDest = outputMessage + 4; for (unsigned int i = 0; i < 3; i++) { decodeBuffer.decodeCachedValue(value, 29, *serverCache_. configureNotifyWindowCache [i], 9); PutULONG(value, nextDest, bigEndian_); nextDest += 4; } for (unsigned int j = 0; j < 5; j++) { decodeBuffer.decodeCachedValue(value, 16, *serverCache_. configureNotifyGeomCache [j], 8); PutUINT(value, nextDest, bigEndian_); nextDest += 2; } decodeBuffer.decodeValue(value, 1); *nextDest = value; } break; case CreateNotify: { decodeBuffer.decodeCachedValue(value, 29, serverCache_. createNotifyWindowCache, 9); PutULONG(value, outputMessage + 4, bigEndian_); decodeBuffer.decodeValue(value, 29, 5); serverCache_.createNotifyLastWindow += value; serverCache_.createNotifyLastWindow &= 0x1fffffff; PutULONG(serverCache_.createNotifyLastWindow, outputMessage + 8, bigEndian_); unsigned char *nextDest = outputMessage + 12; for (unsigned int i = 0; i < 5; i++) { decodeBuffer.decodeValue(value, 16, 9); PutUINT(value, nextDest, bigEndian_); nextDest += 2; } decodeBuffer.decodeValue(value, 1); *nextDest = (unsigned char) value; } break; case Expose: { decodeBuffer.decodeCachedValue(value, 29, serverCache_. exposeWindowCache, 9); PutULONG(value, outputMessage + 4, bigEndian_); unsigned char *nextDest = outputMessage + 8; for (unsigned int i = 0; i < 5; i++) { decodeBuffer.decodeCachedValue(value, 16, *serverCache_. exposeGeomCache[i], 6); PutUINT(value, nextDest, bigEndian_); nextDest += 2; } } break; case FocusIn: case FocusOut: { decodeBuffer.decodeValue(value, 3); outputMessage[1] = (unsigned char) value; decodeBuffer.decodeCachedValue(value, 29, serverCache_. focusInWindowCache, 9); PutULONG(value, outputMessage + 4, bigEndian_); decodeBuffer.decodeValue(value, 2); outputMessage[8] = (unsigned char) value; } break; case KeymapNotify: { decodeBuffer.decodeValue(value, 1); if (value) memcpy(outputMessage + 1, ServerCache::lastKeymap.getData(), 31); else { unsigned char *nextDest = outputMessage + 1; for (unsigned int i = 1; i < 32; i++) { decodeBuffer.decodeValue(value, 8); *nextDest++ = (unsigned char) value; } ServerCache::lastKeymap.set(31, outputMessage + 1); } } break; case MapNotify: case UnmapNotify: case DestroyNotify: { decodeBuffer.decodeCachedValue(value, 29, serverCache_. mapNotifyEventCache, 9); PutULONG(value, outputMessage + 4, bigEndian_); decodeBuffer.decodeCachedValue(value, 29, serverCache_. mapNotifyWindowCache, 9); PutULONG(value, outputMessage + 8, bigEndian_); if ((opcode == MapNotify) || (opcode == UnmapNotify)) { decodeBuffer.decodeValue(value, 1); outputMessage[12] = (unsigned char) value; } } break; case NoExpose: { decodeBuffer.decodeCachedValue(value, 29, serverCache_. noExposeDrawableCache, 9); PutULONG(value, outputMessage + 4, bigEndian_); decodeBuffer.decodeCachedValue(value, 16, serverCache_. noExposeMinorCache); PutUINT(value, outputMessage + 8, bigEndian_); decodeBuffer.decodeCachedValue(cValue, 8, serverCache_. noExposeMajorCache); outputMessage[10] = cValue; } break; case PropertyNotify: { decodeBuffer.decodeCachedValue(value, 29, serverCache_. propertyNotifyWindowCache, 9); PutULONG(value, outputMessage + 4, bigEndian_); decodeBuffer.decodeCachedValue(value, 29, serverCache_. propertyNotifyAtomCache, 9); PutULONG(value, outputMessage + 8, bigEndian_); decodeBuffer.decodeValue(value, 32, 9); serverCache_.lastTimestamp += value; PutULONG(serverCache_.lastTimestamp, outputMessage + 12, bigEndian_); decodeBuffer.decodeValue(value, 1); outputMessage[16] = (unsigned char) value; } break; case ReparentNotify: { unsigned char *nextDest = outputMessage + 4; for (unsigned int i = 0; i < 3; i++) { decodeBuffer.decodeCachedValue(value, 29, serverCache_. reparentNotifyWindowCache, 9); PutULONG(value, nextDest, bigEndian_); nextDest += 4; } decodeBuffer.decodeValue(value, 16, 6); PutUINT(value, nextDest, bigEndian_); decodeBuffer.decodeValue(value, 16, 6); PutUINT(value, nextDest + 2, bigEndian_); decodeBuffer.decodeValue(value, 1); outputMessage[20] = (unsigned char) value; } break; case SelectionClear: { decodeBuffer.decodeValue(value, 32, 9); serverCache_.lastTimestamp += value; PutULONG(serverCache_.lastTimestamp, outputMessage + 4, bigEndian_); decodeBuffer.decodeCachedValue(value, 29, serverCache_. selectionClearWindowCache, 9); PutULONG(value, outputMessage + 8, bigEndian_); decodeBuffer.decodeCachedValue(value, 29, serverCache_. selectionClearAtomCache, 9); PutULONG(value, outputMessage + 12, bigEndian_); } break; case SelectionRequest: { decodeBuffer.decodeValue(value, 32, 9); serverCache_.lastTimestamp += value; PutULONG(serverCache_.lastTimestamp, outputMessage + 4, bigEndian_); decodeBuffer.decodeCachedValue(value, 29, serverCache_. selectionClearWindowCache, 9); PutULONG(value, outputMessage + 8, bigEndian_); decodeBuffer.decodeCachedValue(value, 29, serverCache_. selectionClearWindowCache, 9); PutULONG(value, outputMessage + 12, bigEndian_); decodeBuffer.decodeCachedValue(value, 29, serverCache_. selectionClearAtomCache, 9); PutULONG(value, outputMessage + 16, bigEndian_); decodeBuffer.decodeCachedValue(value, 29, serverCache_. selectionClearAtomCache, 9); PutULONG(value, outputMessage + 20, bigEndian_); decodeBuffer.decodeCachedValue(value, 29, serverCache_. selectionClearAtomCache, 9); PutULONG(value, outputMessage + 24, bigEndian_); } break; case VisibilityNotify: { decodeBuffer.decodeCachedValue(value, 29, serverCache_. visibilityNotifyWindowCache, 9); PutULONG(value, outputMessage + 4, bigEndian_); decodeBuffer.decodeValue(value, 2); outputMessage[8] = (unsigned char) value; } break; default: { unsigned int secondByte; decodeBuffer.decodeValue(secondByte, 8); outputMessage[1] = secondByte; unsigned char *nextDest = outputMessage + 4; for (unsigned int i = 4; i < outputLength; i++) { unsigned int nextByte; decodeBuffer.decodeValue(nextByte, 8); *nextDest++ = (unsigned char) nextByte; } } } } *outputMessage = (unsigned char) opcode; PutUINT(serverCache_.lastSequenceNum, outputMessage + 2, bigEndian_); } } if (WriteAll(fd_, writeBuffer_.getData(), writeBuffer_.getLength()) < 0) { return 0; } return 1; } void ClientChannel::setBigEndian(int flag) { bigEndian_ = flag; } void ClientChannel::decodeCharInfo_(DecodeBuffer & decodeBuffer, unsigned char *nextDest) { unsigned int value; decodeBuffer.decodeCachedValue(value, 32, *serverCache_.queryFontCharInfoCache[0], 6); PutUINT(value & 0xffff, nextDest, bigEndian_); PutUINT(value >> 16, nextDest + 10, bigEndian_); nextDest += 2; for (unsigned int i = 1; i < 5; i++) { unsigned int value; decodeBuffer.decodeCachedValue(value, 16, *serverCache_. queryFontCharInfoCache[i], 6); PutUINT(value, nextDest, bigEndian_); nextDest += 2; } } dxpc-3.9.2/ClientChannel.H0000644000175000017530000000216310560644754014707 0ustar kvigorkvigor#ifndef ClientChannel_H # define ClientChannel_H # include "Channel.H" # include "ClientReadBuffer.H" # include "WriteBuffer.H" # include "ClientCache.H" # include "ServerCache.H" # include "SequenceNumQueue.H" # include "Stats.H" # include "Compresser.H" class DecodeBuffer; class ClientChannel:public Channel { public: ClientChannel(int xClientFD, unsigned int statisticsLevel); virtual ~ ClientChannel(); virtual int doRead(EncodeBuffer &); virtual int doWrite(const unsigned char *message, unsigned int length); void setBigEndian(int flag); protected: void decodeCharInfo_(DecodeBuffer &, unsigned char *); ClientReadBuffer readBuffer_; int fd_; WriteBuffer writeBuffer_; int firstRequest_; int firstReply_; ClientCache clientCache_; ServerCache serverCache_; SequenceNumQueue sequenceNumQueue_; int bigEndian_; unsigned int imageByteOrder_; unsigned int bitmapBitOrder_; unsigned int scanlineUnit_; unsigned int scanlinePad_; unsigned int statisticsLevel_; Stats stats_; Compresser *compresser; }; #endif /* ClientChannel_H */ dxpc-3.9.2/dxpcconf.h.in0000644000175000017530000000353510560644754014455 0ustar kvigorkvigor#ifndef DXPCCONF_H_ #define DXPCCONF_H_ #undef ACCEPT_SOCKLEN_T #undef HAVE_IOSTREAM #undef HAVE_IOSTREAM_H #undef HAVE_FSTREAM #undef HAVE_FSTREAM_H #if defined(HAVE_IOSTREAM) // Use fullblown modern C++ iostream fun. #include #include #define OSTREAM std::ostream #define OFSTREAM std::ofstream #define COUT std::cout #define CERR std::cerr #define ENDL std::endl #define IOS_OUT std::ios::out #elif defined (HAVE_IOSTREAM_H) // Stone-age iostreams. #include #include #define OSTREAM ostream #define OFSTREAM ofstream #define COUT cout #define CERR cerr #define ENDL endl #define IOS_OUT ios::out #else #error Require iostream or iostream.h #endif #if defined(__MINGW32__) #include # define SOCKREAD(socket,buffer,len) \ recv(socket,(char *)buffer,len,0) # define SOCKWRITE(socket,buffer,len) \ send(socket,(const char *)buffer,len,0) # define SOCKCLOSE(socket) \ closesocket(socket) #define SETNODELAY(fd) \ do { \ int one = 1; \ setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, \ (const char *)&one, sizeof(one)); \ } while (0) #define ACCEPT_SOCKLEN_T int #else # define SOCKREAD(socket,buffer,len) \ read(socket,buffer,len) # define SOCKWRITE(socket,buffer,len) \ write(socket,buffer,len) # define SOCKCLOSE(socket) \ close(socket) #define SETNODELAY(fd) \ do { \ int one = 1; \ setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, \ (const void *)&one, sizeof(one)); \ } while (0) #endif #endif dxpc-3.9.2/Channel.H0000644000175000017530000000073010560644754013546 0ustar kvigorkvigor#ifndef Channel_H # define Channel_H class EncodeBuffer; class Channel { public: Channel():framingBitsOut_(0) { } virtual ~ Channel() { } virtual int doRead(EncodeBuffer &) = 0; virtual int doWrite(const unsigned char *message, unsigned int length) = 0; void recordFramingBits(unsigned int numBits) { framingBitsOut_ += numBits; } protected: unsigned int framingBitsOut_; }; #endif /* Channel_H */ dxpc-3.9.2/X-mingw.h0000644000175000017530000004752510560644754013601 0ustar kvigorkvigor/* * $Xorg: X.h,v 1.4 2001/02/09 02:03:22 xorgcvs Exp $ */ /* Definitions for the X window system likely to be used by applications */ #ifndef X_H #define X_H /*********************************************************** Copyright 1987, 1998 The Open Group 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. 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 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. All Rights Reserved 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. ******************************************************************/ /* $XFree86: xc/include/X.h,v 1.6 2003/07/09 15:27:28 tsi Exp $ */ #define X_PROTOCOL 11 /* current protocol version */ #define X_PROTOCOL_REVISION 0 /* current minor version */ /* Resources */ /* * _XSERVER64 must ONLY be defined when compiling X server sources on * systems where unsigned long is not 32 bits, must NOT be used in * client or library code. */ #ifndef _XSERVER64 # ifndef _XTYPEDEF_XID # define _XTYPEDEF_XID typedef unsigned long XID; # endif # ifndef _XTYPEDEF_MASK # define _XTYPEDEF_MASK typedef unsigned long Mask; # endif # ifndef _XTYPEDEF_ATOM # define _XTYPEDEF_ATOM typedef unsigned long Atom; /* Also in Xdefs.h */ # endif typedef unsigned long VisualID; typedef unsigned long Time; #else # include # ifndef _XTYPEDEF_XID # define _XTYPEDEF_XID typedef CARD32 XID; # endif # ifndef _XTYPEDEF_MASK # define _XTYPEDEF_MASK typedef CARD32 Mask; # endif # ifndef _XTYPEDEF_ATOM # define _XTYPEDEF_ATOM typedef CARD32 Atom; # endif typedef CARD32 VisualID; typedef CARD32 Time; #endif typedef XID Window; typedef XID Drawable; #ifndef _XTYPEDEF_FONT # define _XTYPEDEF_FONT typedef XID Font; #endif typedef XID Pixmap; typedef XID Cursor; typedef XID Colormap; typedef XID GContext; typedef XID KeySym; typedef unsigned char KeyCode; /***************************************************************** * RESERVED RESOURCE AND CONSTANT DEFINITIONS *****************************************************************/ #ifndef None #define None 0L /* universal null resource or null atom */ #endif #define ParentRelative 1L /* background pixmap in CreateWindow and ChangeWindowAttributes */ #define CopyFromParent 0L /* border pixmap in CreateWindow and ChangeWindowAttributes special VisualID and special window class passed to CreateWindow */ #define PointerWindow 0L /* destination window in SendEvent */ #define InputFocus 1L /* destination window in SendEvent */ #define PointerRoot 1L /* focus window in SetInputFocus */ #define AnyPropertyType 0L /* special Atom, passed to GetProperty */ #define AnyKey 0L /* special Key Code, passed to GrabKey */ #define AnyButton 0L /* special Button Code, passed to GrabButton */ #define AllTemporary 0L /* special Resource ID passed to KillClient */ #define CurrentTime 0L /* special Time */ #define NoSymbol 0L /* special KeySym */ /***************************************************************** * EVENT DEFINITIONS *****************************************************************/ /* Input Event Masks. Used as event-mask window attribute and as arguments to Grab requests. Not to be confused with event names. */ #define NoEventMask 0L #define KeyPressMask (1L<<0) #define KeyReleaseMask (1L<<1) #define ButtonPressMask (1L<<2) #define ButtonReleaseMask (1L<<3) #define EnterWindowMask (1L<<4) #define LeaveWindowMask (1L<<5) #define PointerMotionMask (1L<<6) #define PointerMotionHintMask (1L<<7) #define Button1MotionMask (1L<<8) #define Button2MotionMask (1L<<9) #define Button3MotionMask (1L<<10) #define Button4MotionMask (1L<<11) #define Button5MotionMask (1L<<12) #define ButtonMotionMask (1L<<13) #define KeymapStateMask (1L<<14) #define ExposureMask (1L<<15) #define VisibilityChangeMask (1L<<16) #define StructureNotifyMask (1L<<17) #define ResizeRedirectMask (1L<<18) #define SubstructureNotifyMask (1L<<19) #define SubstructureRedirectMask (1L<<20) #define FocusChangeMask (1L<<21) #define PropertyChangeMask (1L<<22) #define ColormapChangeMask (1L<<23) #define OwnerGrabButtonMask (1L<<24) /* Event names. Used in "type" field in XEvent structures. Not to be confused with event masks above. They start from 2 because 0 and 1 are reserved in the protocol for errors and replies. */ #define KeyPress 2 #define KeyRelease 3 #define ButtonPress 4 #define ButtonRelease 5 #define MotionNotify 6 #define EnterNotify 7 #define LeaveNotify 8 #define FocusIn 9 #define FocusOut 10 #define KeymapNotify 11 #define Expose 12 #define GraphicsExpose 13 #define NoExpose 14 #define VisibilityNotify 15 #define CreateNotify 16 #define DestroyNotify 17 #define UnmapNotify 18 #define MapNotify 19 #define MapRequest 20 #define ReparentNotify 21 #define ConfigureNotify 22 #define ConfigureRequest 23 #define GravityNotify 24 #define ResizeRequest 25 #define CirculateNotify 26 #define CirculateRequest 27 #define PropertyNotify 28 #define SelectionClear 29 #define SelectionRequest 30 #define SelectionNotify 31 #define ColormapNotify 32 #define ClientMessage 33 #define MappingNotify 34 #define LASTEvent 35 /* must be bigger than any event # */ /* Key masks. Used as modifiers to GrabButton and GrabKey, results of QueryPointer, state in various key-, mouse-, and button-related events. */ #define ShiftMask (1<<0) #define LockMask (1<<1) #define ControlMask (1<<2) #define Mod1Mask (1<<3) #define Mod2Mask (1<<4) #define Mod3Mask (1<<5) #define Mod4Mask (1<<6) #define Mod5Mask (1<<7) /* modifier names. Used to build a SetModifierMapping request or to read a GetModifierMapping request. These correspond to the masks defined above. */ #define ShiftMapIndex 0 #define LockMapIndex 1 #define ControlMapIndex 2 #define Mod1MapIndex 3 #define Mod2MapIndex 4 #define Mod3MapIndex 5 #define Mod4MapIndex 6 #define Mod5MapIndex 7 /* button masks. Used in same manner as Key masks above. Not to be confused with button names below. */ #define Button1Mask (1<<8) #define Button2Mask (1<<9) #define Button3Mask (1<<10) #define Button4Mask (1<<11) #define Button5Mask (1<<12) #define AnyModifier (1<<15) /* used in GrabButton, GrabKey */ /* button names. Used as arguments to GrabButton and as detail in ButtonPress and ButtonRelease events. Not to be confused with button masks above. Note that 0 is already defined above as "AnyButton". */ #define Button1 1 #define Button2 2 #define Button3 3 #define Button4 4 #define Button5 5 /* Notify modes */ #define NotifyNormal 0 #define NotifyGrab 1 #define NotifyUngrab 2 #define NotifyWhileGrabbed 3 #define NotifyHint 1 /* for MotionNotify events */ /* Notify detail */ #define NotifyAncestor 0 #define NotifyVirtual 1 #define NotifyInferior 2 #define NotifyNonlinear 3 #define NotifyNonlinearVirtual 4 #define NotifyPointer 5 #define NotifyPointerRoot 6 #define NotifyDetailNone 7 /* Visibility notify */ #define VisibilityUnobscured 0 #define VisibilityPartiallyObscured 1 #define VisibilityFullyObscured 2 /* Circulation request */ #define PlaceOnTop 0 #define PlaceOnBottom 1 /* protocol families */ #define FamilyInternet 0 /* IPv4 */ #define FamilyDECnet 1 #define FamilyChaos 2 #define FamilyInternet6 6 /* IPv6 */ /* authentication families not tied to a specific protocol */ #define FamilyServerInterpreted 5 /* Property notification */ #define PropertyNewValue 0 #define PropertyDelete 1 /* Color Map notification */ #define ColormapUninstalled 0 #define ColormapInstalled 1 /* GrabPointer, GrabButton, GrabKeyboard, GrabKey Modes */ #define GrabModeSync 0 #define GrabModeAsync 1 /* GrabPointer, GrabKeyboard reply status */ #define GrabSuccess 0 #define AlreadyGrabbed 1 #define GrabInvalidTime 2 #define GrabNotViewable 3 #define GrabFrozen 4 /* AllowEvents modes */ #define AsyncPointer 0 #define SyncPointer 1 #define ReplayPointer 2 #define AsyncKeyboard 3 #define SyncKeyboard 4 #define ReplayKeyboard 5 #define AsyncBoth 6 #define SyncBoth 7 /* Used in SetInputFocus, GetInputFocus */ #define RevertToNone (int)None #define RevertToPointerRoot (int)PointerRoot #define RevertToParent 2 /***************************************************************** * ERROR CODES *****************************************************************/ #define Success 0 /* everything's okay */ #define BadRequest 1 /* bad request code */ #define BadValue 2 /* int parameter out of range */ #define BadWindow 3 /* parameter not a Window */ #define BadPixmap 4 /* parameter not a Pixmap */ #define BadAtom 5 /* parameter not an Atom */ #define BadCursor 6 /* parameter not a Cursor */ #define BadFont 7 /* parameter not a Font */ #define BadMatch 8 /* parameter mismatch */ #define BadDrawable 9 /* parameter not a Pixmap or Window */ #define BadAccess 10 /* depending on context: - key/button already grabbed - attempt to free an illegal cmap entry - attempt to store into a read-only color map entry. - attempt to modify the access control list from other than the local host. */ #define BadAlloc 11 /* insufficient resources */ #define BadColor 12 /* no such colormap */ #define BadGC 13 /* parameter not a GC */ #define BadIDChoice 14 /* choice not in range or already used */ #define BadName 15 /* font or color name doesn't exist */ #define BadLength 16 /* Request length incorrect */ #define BadImplementation 17 /* server is defective */ #define FirstExtensionError 128 #define LastExtensionError 255 /***************************************************************** * WINDOW DEFINITIONS *****************************************************************/ /* Window classes used by CreateWindow */ /* Note that CopyFromParent is already defined as 0 above */ #define InputOutput 1 #define InputOnly 2 /* Window attributes for CreateWindow and ChangeWindowAttributes */ #define CWBackPixmap (1L<<0) #define CWBackPixel (1L<<1) #define CWBorderPixmap (1L<<2) #define CWBorderPixel (1L<<3) #define CWBitGravity (1L<<4) #define CWWinGravity (1L<<5) #define CWBackingStore (1L<<6) #define CWBackingPlanes (1L<<7) #define CWBackingPixel (1L<<8) #define CWOverrideRedirect (1L<<9) #define CWSaveUnder (1L<<10) #define CWEventMask (1L<<11) #define CWDontPropagate (1L<<12) #define CWColormap (1L<<13) #define CWCursor (1L<<14) /* ConfigureWindow structure */ #define CWX (1<<0) #define CWY (1<<1) #define CWWidth (1<<2) #define CWHeight (1<<3) #define CWBorderWidth (1<<4) #define CWSibling (1<<5) #define CWStackMode (1<<6) /* Bit Gravity */ #define ForgetGravity 0 #define NorthWestGravity 1 #define NorthGravity 2 #define NorthEastGravity 3 #define WestGravity 4 #define CenterGravity 5 #define EastGravity 6 #define SouthWestGravity 7 #define SouthGravity 8 #define SouthEastGravity 9 #define StaticGravity 10 /* Window gravity + bit gravity above */ #define UnmapGravity 0 /* Used in CreateWindow for backing-store hint */ #define NotUseful 0 #define WhenMapped 1 #define Always 2 /* Used in GetWindowAttributes reply */ #define IsUnmapped 0 #define IsUnviewable 1 #define IsViewable 2 /* Used in ChangeSaveSet */ #define SetModeInsert 0 #define SetModeDelete 1 /* Used in ChangeCloseDownMode */ #define DestroyAll 0 #define RetainPermanent 1 #define RetainTemporary 2 /* Window stacking method (in configureWindow) */ #define Above 0 #define Below 1 #define TopIf 2 #define BottomIf 3 #define Opposite 4 /* Circulation direction */ #define RaiseLowest 0 #define LowerHighest 1 /* Property modes */ #define PropModeReplace 0 #define PropModePrepend 1 #define PropModeAppend 2 /***************************************************************** * GRAPHICS DEFINITIONS *****************************************************************/ /* graphics functions, as in GC.alu */ #define GXclear 0x0 /* 0 */ #define GXand 0x1 /* src AND dst */ #define GXandReverse 0x2 /* src AND NOT dst */ #define GXcopy 0x3 /* src */ #define GXandInverted 0x4 /* NOT src AND dst */ #define GXnoop 0x5 /* dst */ #define GXxor 0x6 /* src XOR dst */ #define GXor 0x7 /* src OR dst */ #define GXnor 0x8 /* NOT src AND NOT dst */ #define GXequiv 0x9 /* NOT src XOR dst */ #define GXinvert 0xa /* NOT dst */ #define GXorReverse 0xb /* src OR NOT dst */ #define GXcopyInverted 0xc /* NOT src */ #define GXorInverted 0xd /* NOT src OR dst */ #define GXnand 0xe /* NOT src OR NOT dst */ #define GXset 0xf /* 1 */ /* LineStyle */ #define LineSolid 0 #define LineOnOffDash 1 #define LineDoubleDash 2 /* capStyle */ #define CapNotLast 0 #define CapButt 1 #define CapRound 2 #define CapProjecting 3 /* joinStyle */ #define JoinMiter 0 #define JoinRound 1 #define JoinBevel 2 /* fillStyle */ #define FillSolid 0 #define FillTiled 1 #define FillStippled 2 #define FillOpaqueStippled 3 /* fillRule */ #define EvenOddRule 0 #define WindingRule 1 /* subwindow mode */ #define ClipByChildren 0 #define IncludeInferiors 1 /* SetClipRectangles ordering */ #define Unsorted 0 #define YSorted 1 #define YXSorted 2 #define YXBanded 3 /* CoordinateMode for drawing routines */ #define CoordModeOrigin 0 /* relative to the origin */ #define CoordModePrevious 1 /* relative to previous point */ /* Polygon shapes */ #define Complex 0 /* paths may intersect */ #define Nonconvex 1 /* no paths intersect, but not convex */ #define Convex 2 /* wholly convex */ /* Arc modes for PolyFillArc */ #define ArcChord 0 /* join endpoints of arc */ #define ArcPieSlice 1 /* join endpoints to center of arc */ /* GC components: masks used in CreateGC, CopyGC, ChangeGC, OR'ed into GC.stateChanges */ #define GCFunction (1L<<0) #define GCPlaneMask (1L<<1) #define GCForeground (1L<<2) #define GCBackground (1L<<3) #define GCLineWidth (1L<<4) #define GCLineStyle (1L<<5) #define GCCapStyle (1L<<6) #define GCJoinStyle (1L<<7) #define GCFillStyle (1L<<8) #define GCFillRule (1L<<9) #define GCTile (1L<<10) #define GCStipple (1L<<11) #define GCTileStipXOrigin (1L<<12) #define GCTileStipYOrigin (1L<<13) #define GCFont (1L<<14) #define GCSubwindowMode (1L<<15) #define GCGraphicsExposures (1L<<16) #define GCClipXOrigin (1L<<17) #define GCClipYOrigin (1L<<18) #define GCClipMask (1L<<19) #define GCDashOffset (1L<<20) #define GCDashList (1L<<21) #define GCArcMode (1L<<22) #define GCLastBit 22 /***************************************************************** * FONTS *****************************************************************/ /* used in QueryFont -- draw direction */ #define FontLeftToRight 0 #define FontRightToLeft 1 #define FontChange 255 /***************************************************************** * IMAGING *****************************************************************/ /* ImageFormat -- PutImage, GetImage */ #define XYBitmap 0 /* depth 1, XYFormat */ #define XYPixmap 1 /* depth == drawable depth */ #define ZPixmap 2 /* depth == drawable depth */ /***************************************************************** * COLOR MAP STUFF *****************************************************************/ /* For CreateColormap */ #define AllocNone 0 /* create map with no entries */ #define AllocAll 1 /* allocate entire map writeable */ /* Flags used in StoreNamedColor, StoreColors */ #define DoRed (1<<0) #define DoGreen (1<<1) #define DoBlue (1<<2) /***************************************************************** * CURSOR STUFF *****************************************************************/ /* QueryBestSize Class */ #define CursorShape 0 /* largest size that can be displayed */ #define TileShape 1 /* size tiled fastest */ #define StippleShape 2 /* size stippled fastest */ /***************************************************************** * KEYBOARD/POINTER STUFF *****************************************************************/ #define AutoRepeatModeOff 0 #define AutoRepeatModeOn 1 #define AutoRepeatModeDefault 2 #define LedModeOff 0 #define LedModeOn 1 /* masks for ChangeKeyboardControl */ #define KBKeyClickPercent (1L<<0) #define KBBellPercent (1L<<1) #define KBBellPitch (1L<<2) #define KBBellDuration (1L<<3) #define KBLed (1L<<4) #define KBLedMode (1L<<5) #define KBKey (1L<<6) #define KBAutoRepeatMode (1L<<7) #define MappingSuccess 0 #define MappingBusy 1 #define MappingFailed 2 #define MappingModifier 0 #define MappingKeyboard 1 #define MappingPointer 2 /***************************************************************** * SCREEN SAVER STUFF *****************************************************************/ #define DontPreferBlanking 0 #define PreferBlanking 1 #define DefaultBlanking 2 #define DisableScreenSaver 0 #define DisableScreenInterval 0 #define DontAllowExposures 0 #define AllowExposures 1 #define DefaultExposures 2 /* for ForceScreenSaver */ #define ScreenSaverReset 0 #define ScreenSaverActive 1 /***************************************************************** * HOSTS AND CONNECTIONS *****************************************************************/ /* for ChangeHosts */ #define HostInsert 0 #define HostDelete 1 /* for ChangeAccessControl */ #define EnableAccess 1 #define DisableAccess 0 /* Display classes used in opening the connection * Note that the statically allocated ones are even numbered and the * dynamically changeable ones are odd numbered */ #define StaticGray 0 #define GrayScale 1 #define StaticColor 2 #define PseudoColor 3 #define TrueColor 4 #define DirectColor 5 /* Byte order used in imageByteOrder and bitmapBitOrder */ #define LSBFirst 0 #define MSBFirst 1 #endif /* X_H */ dxpc-3.9.2/ProxyReadBuffer.C0000644000175000017530000000164310560644754015244 0ustar kvigorkvigor#include "ProxyReadBuffer.H" int ProxyReadBuffer::locateMessage(const unsigned char *start, const unsigned char *end, unsigned int &headerLength, unsigned int &dataLength, unsigned int &trailerLength) { unsigned int lengthLength = 0; dataLength = 0; const unsigned char *nextSrc = start; unsigned char next; do { if (nextSrc >= end) return 0; next = *nextSrc++; dataLength <<= 7; dataLength |= (unsigned int) (next & 0x7f); lengthLength++; } while (next & 0x80); trailerLength = 0; headerLength = (dataLength == 0) ? 3 : lengthLength; unsigned int totalLength = headerLength + dataLength + trailerLength; if (start + totalLength > end) return 0; else return 1; } dxpc-3.9.2/ProxyReadBuffer.H0000644000175000017530000000107410560644754015247 0ustar kvigorkvigor#ifndef ProxyReadBuffer_H # define ProxyReadBuffer_H # include "ReadBuffer.H" class ProxyReadBuffer:public ReadBuffer { public: ProxyReadBuffer(int fd) : ReadBuffer(fd) { } virtual ~ ProxyReadBuffer() { } protected: virtual int locateMessage(const unsigned char *start, const unsigned char *end, unsigned int &headerLength, unsigned int &dataLength, unsigned int &trailerLength); }; #endif /* ProxyReadBuffer_H */ dxpc-3.9.2/dxpc.logo-small.jpg0000644000175000017530000001067710560644754015605 0ustar kvigorkvigorÿØÿàJFIFÿÛC    $.' ",#(7),01444'9=82<.342ÿÛC  2!!22222222222222222222222222222222222222222222222222ÿÀ…‘"ÿÄ ÿĵ}!1AQa"q2‘¡#B±ÁRÑð$3br‚ %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyzƒ„…†‡ˆ‰Š’“”•–—˜™š¢£¤¥¦§¨©ª²³´µ¶·¸¹ºÂÃÄÅÆÇÈÉÊÒÓÔÕÖרÙÚáâãäåæçèéêñòóôõö÷øùúÿÄ ÿĵw!1AQaq"2B‘¡±Á #3RðbrÑ $4á%ñ&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz‚ƒ„…†‡ˆ‰Š’“”•–—˜™š¢£¤¥¦§¨©ª²³´µ¶·¸¹ºÂÃÄÅÆÇÈÉÊÒÓÔÕÖרÙÚâãäåæçèéêòóôõö÷øùúÿÚ ?÷ú(¢€ (®{[ñ†“ Ì`¹‘žãhc`¹é’H×qÛ‘†¸ïøê? º[Cmö›¦[j 9Æ}O8úÖ<ÿU‹5¦ž$ÁfyyÁ8Ç@üMqÞ6Ö ×oÒöB²¨*y*@äg¸ÏOÊ€:›‰z­Ëî’Ȩ̂ePÀãêIþU×YxÇKº°šæy~ÌÐæ£‘“‚:óí^A¤ÝçÐVEÅÍÃÜ\Û9130 ã'QÎhׯ~(é0-à–fÞ`£ôÉý)4/\j·E¥µŠ+=Ár Ü ï“Á€¯X‡zî|=CC‘bÌw?B(ØèªöNe°·‘º¼JÇ>¤V(¢Š(¢Š(¢Š(¢Š(¢Š(¯ñý´ñøßQórK²²œuR£ú? ÷úÃ×¼5i®ìyY¢¸AµdQž:àŽã4á6Å"ÑuäR²­á€À0ø þPÆÑiч%Ã}¯jO‡Z{¡K«‰%SÔ*þy®âVŸc¢]Xéö0lQw‘ß&L6žF3š©¡¥F_´ÀŒÜ.~„ñZ– mzæé’SÂÜ´'k0 OpAÆGNטÒöI‰e/E|½Åz‡ÃÄ $¤¸Â9,=Fp¯Ï#®hµð¿+{Vr@$ú×S¡øS²fËDÿxÉà×ñèôP#EŽ5EáP°§ÑEQEQEQEQEQX¾#ñŸ†ôãsrwHÙD§ævôÔö  ª+Â5oëÚ¼›¶µ€ôŠWsÔþ&± Åć/q3S!>¾þç󠤫çë“x‹[Y§Ž8Ñj,c'$õ'ôô«‚ ²sŸœ÷ëüÍgJÒöä¼sõÏõ ¿Âš­ü…X‚§£Šì|4#Ðï§òúHËRÀ’9éÉÔÖgÈ„—ž@SŸÊµÑBê2).ùÐ{EPEPEPEPEPEP_>ø»[}{Ä—7Ë[ÆÆ+qØ(8Èç'ñ¯z½}–:¬Lxö¾hBHÉêI44h\p2i<ÕŒA]?‡t»{½úæPK¤±Æ1èI½ Â^ÓšÓËg Ò3•̨Æ YÀ*ØúÏ2,·lëО+é_ì='þvXÿ¯uÿ ð/øjo_Ç ³ÁpfÔFH*2zƒÓÛ×Ò€=á‚fk†ôP+EøÕæôûJÿ:á¼ã6Жr4ï´n1\cþkªðÕåljõ+™VÕmÕ$YNé g !G?\gð J¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(®¢3¦]X_§û¦¾hîŽÕô¾¤q¥Ý‘Ú#þù5óDgåS@¿…\j {ÜBS^›á?ù{y­¦y/‡¥è×€’š.ŸR?­zÇ„$è™8•ü1@õâÿòu4øòO\ûÇ ƒëžèkGÇ^9Ö4Oͧ[ÜE ¦Pn`UNrzŒ–˜ìk…ÖuGñÑͨ^$’F0*= G×¥3HË“–/÷€¯Køe·íWÿp°EäH\à“éÀwäöèkͬàš8ók^‡­iáêUmA^Âm-Ïd¤¯$Ö¾=èVV­§YOy4++ü"øµŸæèàÖ>™ûDF÷*š®€Ñ@O2Û\oeÿ€°üÇÒ¶†4Ü`ô:G¹ÑXÞñ>â›/µè÷©s †B{2œøŽ}ëNââKy..%H¡‰K¼Ž@UP2I' Êá(¾Y-JÜšŠñwöƒÒlî LŸQ qö‰ÉF> X¨™iûEËæyá¥Ùë ß#ð+Ïæ+®~&jñƒ%Î(÷š+Í4ŸŽ>ÔdHî^ëOvã71eAÿyIãÜãð¯E·¸‚òÚ;‹iRhdPÉ"6å`zGZ­ ”ªE¡¦žÄôQEd2µþ³®°vŸ)°}85ó2` ™?ξ˜Ôäwéä¿þ‚kæhÏÊ9õ Foø—L¸Îé£ã=~a^¹à€F‚Û‡&wþ•ãºCbÔ€zÍþ„+Ù<ÿ ûjßÈQÐc㋼2o-!Ý«iàÉÑóJZ>:ž2=Æ8É5ò§’¾¦¾ó¯˜>4x!|7â«XóMÔX¶ùb›’Ê=ûÃñz™l©J^Ê¢ZìDïº4>øÊM/Yo ]³5óµ<Ÿ.P2G°`ÐêMu?u[Ïx¢Ïáæˆç âMFeÉ88죒;’£ƒ×•ðm´?ü qã‹äT¿Co¥@àt?ǃëŒÿº?Ú®·à"i÷zn¯ª½Ã\k“ÜŸµ´ŸyTò¸=ÃÄž9Ç5R:rh-‹×þ“oFz¦¤Úhz=®™aŽÚÚ1/°î}I9$÷$×Ç>*`Þ0ÖØnÁ¿œüÝÖ7_zûV¾(ñC—ñ~´ìA-9?Œ[dŽõfßaTØØð?ÃýWÇr¥‘K{X1ç]J2ªNpêÍÇAø‘‘Ÿü'¼ð>“¦5$¿´iDND6ŒpHÜF21שµìŸ-"¶ø_§J‹µîdšY«yŒ ÿß*´ŸZ!ðŸW·qx6g®ï9:~ýh«šÖ†%ÆE;XGξñU÷„5ø5;';A <9ÂÍu?ÓÐà×§üwñ·Ú´½GÓ¦ak¨[®¡1dlt>™ Hõ¼AOÊ3Zþ&žK¨|=,ªFtÄE>ª“J€ôÝÿõ×neJ”+¥©0oTd"á}ë¸Ó>øƒUðeω`‹÷h›ííB3Kr• ÆHêN8 ×_lé+o§xrÉ$6Öö±Œ±Q$ôÖ¯2ÅÏ N1¥¥ÂæzŸË#G"2H¹ ¬0A÷ì_¼g=ž·ÿÅÔ¥¬îÃ=°bw( zœzŽIϸ_ø{þ"hî¯tÍ?Peû’¼I'ëÜp8«öZm†™•aeokËJƒò¼ºÙ¯¶¡ìªÆï¹jwEÊ(¢¼sB¶ Ó®³ÓÉoäkæEéøšúkQRúmÒ/V…ÀüT×Ì‹ÀÁìMl鯶؟IPÿã½§Á Ç'Íoä+ÅtÈÚ[vÀ%Uƒ1 šõk¶ZVœmnäd!‹Ú[9ê02xÅìÉx¼å›ã'Å5µ‰ðÖ’î¹Ä£8'=2ä`tùTž¹­_‹ßìâðáÑ4[¶{Ûñ¶WU+åÃüCœ·N7t8®áÿˆæÑ´™,­KÆæC$¦7*dÏœp=¿í¤½•7S«ÛüÉz»ÿõ»ÍSÇ—VsÀö¶ÚhÖ¶ì £pŒ7c¶ÑÚ²<âÙ¼â›mI V";¸×øâ$gÔpG¸ÇBkkâ eST!þ× #¹Étí’zz{è+ÏkÜÂ{:Øe#)];ŸtZ]Á}g ݬ«-¼ñ‰"‘C)~ñ‡ŠØ?Œ5¶ X6¡9 I$þñº“Í{÷Àû«¯\Á<¬ñZÞ4p>â•V#>™bð’|c­ÿØB~Øÿ–\™]?eˆ©ÅMÝ&zOÃ?Œ¾Ðãе«IžÒco=²‚Ê‹e$g’NG®1Æk+â§ÅQã{xt*Ú[}29<×i°gÀ$'98Jé¿áðÿÚ~Ñý‡¦ùÿó×쉻óÆk3áÞƒyáéÚ>¡åýªßÍßå6åù¤v8˜WS\§z²qz6Ê[j0ǵ-VC ;Ðt}M÷ßéVWmÇÍqnŽ}ºƒZTP›[FÇGÓ4µÅ†ih1ŒA Æ1øW©)hm½À(¢Š(¢Š‚{k{¸Ì70G4gªÈ‡äk4øOÃä’t{,“ÿ<…Pÿ—‡¿è eÿ~…ð‰x{þ€ö_÷èQEKoáÍÖA$Uš8èÂÈúqZ€À¢Š(¢Š(¢Š(¢Š(¢Š(¢Š(¢ŠÿÙdxpc-3.9.2/main.C.orig0000644000175000017530000011760210560723705014055 0ustar kvigorkvigor#include "dxpcconf.h" #include #include #include #include #include #include #include #include #include #include #if !defined(__MINGW32__) # include # include # include # include # include # include # include # include #endif #if !defined(__CYGWIN32__) && !defined(__MINGW32__) # include # include #endif #include "X-headers.H" #ifdef _AIX # include #endif /* _AIX */ #include "constants.H" #include "util.H" #include "ClientMultiplexer.H" #include "ServerMultiplexer.H" #include "Compresser.H" #if defined(__EMX__ ) || defined(__CYGWIN32__) || defined(__MINGW32__) struct sockaddr_un { u_short sun_family; /* socket family: AF_UNIX */ char sun_path[108]; /* path name (not used) */ }; #endif #ifdef _AIX # include #endif /* _AIX */ #if defined(hpux) && !defined(RLIM_INFINITY) /* HP-UX hides this define */ # define RLIM_INFINITY 0x7fffffff #endif static void Usage(const char **argv); static void Cleanup(); static void HandleSignal(int); static int AwaitConnection(int portNum); static int ConnectToRemote(char *remoteHost, int portNum); static void DaemonInit(unsigned int); static void KillDaemon(unsigned int); static void MakeLockFileName(char *, unsigned int); static int VersionNumbersMatch(int sockfd); static int ReadDataCh(int fd, char *buf, int maxlen, char stop); static int parseRemoteOptions(char *opts); // This variable tells whether or not the client should initiate the // connection. (see -w option) static int ClientInitiateConnection = 0; // Maximum number of open file descriptors for this process static unsigned int maxNumFDs = 0; // Variable to tell output routines whether they should be quiet or not // Added for -f option // This variable is used by other files int silent = 0; // Variable to indicate whether the user wants backing store turned on // to help reduce network traffic at some cost in server memory. // This variable is used by other files. int wantBackingStore = 0; // These two variables are needed for the forking // We don't fork by default since old versions didn't static int dofork = 0; static char lockfilename[512] = { 0 }; // And the default lockfilename - this goes in the user's $HOME dir static const char *LOCK_FILE_NAME = ".dxpc.pid"; // Now statistics can go to a file char logfilename[1024] = { 0 }; OSTREAM *logofs; // Controls miniLZO PutImage compression: used by other files. int compressImages = -1; // Info about sockets used by the client proxy (global so that // the cleanup signal handler can access it) static char udomSocketPathname[100]; static int useUnixDomainSocket = 1; sockaddr_in serverAddr; // dxpc runs in client mode or server mode enum ProxyMode { PROXY_CLIENT, PROXY_SERVER } proxyMode = PROXY_SERVER; // Macro is TRUE if we should initiate the connection. #define WE_INITIATE_CONNECTION \ ((proxyMode == PROXY_SERVER && !ClientInitiateConnection) \ || (proxyMode == PROXY_CLIENT && ClientInitiateConnection)) // #define COREDUMPS_ENABLED #ifdef COREDUMPS_ENABLED int enableCoredumps(void) { rlimit rlim; if (getrlimit(RLIMIT_CORE, &rlim)) { CERR << "Cannot read RLIMIT_CORE: " << strerror(errno) << ENDL; return -1; } if (rlim.rlim_cur < rlim.rlim_max) { rlim.rlim_cur = rlim.rlim_max; if (setrlimit(RLIMIT_CORE, &rlim)) { CERR << "Cannot set RLIMIT_CORE: " << strerror(errno) << ENDL; return -2; } } CERR << "Set RLIMIT_CORE to " << rlim.rlim_max << ENDL; return 0; } #endif int main(int argc, char **argv) { udomSocketPathname[0] = 0; unsigned int proxyPort = DEFAULT_PROXY_PORT; unsigned int displayNum = DEFAULT_DISPLAY_NUM; unsigned int statisticsLevel = 0; int useTCPSocket = 1; char *remoteHost = NULL; const char *displaySrc = 0; #ifdef COREDUMPS_ENABLED enableCoredumps(); #endif // used to use getopt here, but it caused too many // portability problems for (int argi = 1; argi < argc; argi++) { char *nextArg = argv[argi]; if (*nextArg == '-') { switch (nextArg[1]) { case 'b': { const char *arg = GetArg(argi, argc, (const char **) argv); if (!arg) Usage((const char **) argv); if (*arg == 'a') wantBackingStore = 2 /* Always */ ; else if (*arg == 'm' || *arg == 'w') wantBackingStore = 1 /* WhenMapped */ ; else if (*arg == 'n') wantBackingStore = 0; else Usage((const char **) argv); } break; case 'd': { const char *arg = GetArg(argi, argc, (const char **) argv); if (arg == NULL) Usage((const char **) argv); else displayNum = atoi(arg); } break; case 'D': displaySrc = GetArg(argi, argc, (const char **) argv); if (!displaySrc) { Usage((const char **) argv); } break; case 'f': dofork = 1; break; case 'k': KillDaemon(proxyPort); // This function doesn't return break; case 'l': { const char *arg = GetArg(argi, argc, (const char **) argv); if (!arg) Usage((const char **) argv); else strcpy(logfilename, arg); } break; case 'p': { const char *arg = GetArg(argi, argc, (const char **) argv); if (arg == NULL) Usage((const char **) argv); else proxyPort = atoi(arg); } break; case 's': { const char *arg = GetArg(argi, argc, (const char **) argv); if (arg == NULL) Usage((const char **) argv); else statisticsLevel = atoi(arg); } break; case 't': useTCPSocket = 0; break; case 'u': useUnixDomainSocket = 0; break; case 'v': PrintVersionInfo(); exit(0); case 'w': ClientInitiateConnection = 1; break; case 'i': { const char *arg = GetArg(argi, argc, (const char **) argv); if (arg == NULL) Usage((const char **) argv); else compressImages = atoi(arg); } break; default: Usage((const char **) argv); } } else { if (remoteHost != NULL) Usage((const char **) argv); else remoteHost = nextArg; } } if (logfilename[0] != '\0') { logofs = new OFSTREAM(logfilename, IOS_OUT); } else { logofs = &COUT; } int xServerAddrFamily = AF_INET; sockaddr *xServerAddr = NULL; unsigned int xServerAddrLength = 0; if ((!remoteHost && !ClientInitiateConnection) || (remoteHost && ClientInitiateConnection)) { COUT << "dxpc proxy running in CLIENT mode" << ENDL; proxyMode = PROXY_CLIENT; } else { COUT << "dxpc proxy running in SERVER mode" << ENDL; proxyMode = PROXY_SERVER; // Keep Cleanup() from deleting the real X server's pipe // when we exit... useUnixDomainSocket = 0; // $DISPLAY is the X server for which we'll act as a proxy if (!displaySrc) { displaySrc = getenv("DISPLAY"); } if ((displaySrc == NULL) || (*displaySrc == 0)) { CERR << "$DISPLAY is not set" << ENDL; Cleanup(); } char *display = new char[strlen(displaySrc) + 1]; if (!display) { CERR << "Out of memory duping DISPLAY" << ENDL; Cleanup(); } strcpy(display, displaySrc); char *separator = strchr(display, ':'); if ((separator == NULL) || !isdigit(*(separator + 1))) { CERR << "invalid DISPLAY '" << display << "'" << ENDL; Cleanup(); } *separator = 0; int displayNum = atoi(separator + 1); if ((separator == display) || !strcmp(display, "unix")) { // UNIX domain port xServerAddrFamily = AF_UNIX; sockaddr_un *xServerAddrUNIX = new sockaddr_un; xServerAddrUNIX->sun_family = AF_UNIX; sprintf(udomSocketPathname, "/tmp/.X11-unix/X%d", displayNum); struct stat statInfo; if (stat(udomSocketPathname, &statInfo) == -1) { #if (defined(__hpux) || defined(hpux)) && !defined(PGID_USE_PID) sprintf(udomSocketPathname, "/usr/spool/sockets/X11/%d", displayNum); if (stat(udomSocketPathname, &statInfo) == -1) { #endif CERR << "cannot open UNIX domain connection to X server" << ENDL; Cleanup(); #if (defined(__hpux) || defined(hpux)) && !defined(PGID_USE_PID) } #endif } strcpy(xServerAddrUNIX->sun_path, udomSocketPathname); xServerAddr = (sockaddr *) xServerAddrUNIX; // xServerAddrLength = strlen(udomSocketPathname) + 2; xServerAddrLength = sizeof(sockaddr_un); } else { // TCP port xServerAddrFamily = AF_INET; int ipAddr; hostent *hostAddr = gethostbyname(display); if (hostAddr == NULL) { // on some UNIXes, gethostbyname doesn't accept IP addresses, // so try inet_addr: ipAddr = (int) inet_addr(display); if (ipAddr == -1) { CERR << "Unknown host '" << display << "'" << ENDL; Cleanup(); } } else ipAddr = *(int *) hostAddr->h_addr_list[0]; sockaddr_in *xServerAddrTCP = new sockaddr_in; xServerAddrTCP->sin_family = AF_INET; xServerAddrTCP->sin_port = htons(X_TCP_PORT + displayNum); xServerAddrTCP->sin_addr.s_addr = ipAddr; xServerAddr = (sockaddr *) xServerAddrTCP; xServerAddrLength = sizeof(sockaddr_in); } if (display) { delete[]display; display = 0; } } // Sanity check compressImages. if (WE_INITIATE_CONNECTION) { if (compressImages != -1) { CERR << "warning: image compression option (-i) ignored " << "when initiating connection" << ENDL; compressImages = -1; } } else { // We will accept connections; we control image compression. if (compressImages == -1) { // Default image compression level. compressImages = DEFAULT_IMAGE_COMPRESSION_LEVEL; } else if (compressImages && !Compresser::isValidCompressionLevel(compressImages)) { CERR << "warning: invalid image compression level " << compressImages << ": image compression disabled" << ENDL; compressImages = 0; } if (!silent) { COUT << "using image compression level " << compressImages << ENDL; } } // Increase the max # of open file descriptors for this process maxNumFDs = 0; #if defined(RLIMIT_NOFILE) rlimit limits; if (getrlimit(RLIMIT_NOFILE, &limits) == 0) { if (limits.rlim_max == RLIM_INFINITY) maxNumFDs = 0; else maxNumFDs = (unsigned int) limits.rlim_max; } #endif /* RLIMIT_NOFILE */ #if defined(_SC_OPEN_MAX) if (maxNumFDs == 0) maxNumFDs = sysconf(_SC_OPEN_MAX); #endif #if defined(FD_SETSIZE) if (maxNumFDs > FD_SETSIZE) maxNumFDs = FD_SETSIZE; #endif /* FD_SETSIZE */ #if defined(RLIMIT_NOFILE) if (limits.rlim_cur < maxNumFDs) { limits.rlim_cur = maxNumFDs; setrlimit(RLIMIT_NOFILE, &limits); } #endif /* RLIMIT_NOFILE */ #ifndef __MINGW32__ if (maxNumFDs == 0) { CERR << "cannot determine number of available file descriptors, exiting!" << ENDL; return 1; } // Install some signal handlers for graceful shutdown signal(SIGHUP, HandleSignal); signal(SIGINT, HandleSignal); signal(SIGTERM, HandleSignal); signal(SIGPIPE, (void (*)(int)) SIG_IGN); #else // __MINGW32__ WSADATA wsaData; if (WSAStartup(0x20, &wsaData)) { CERR << "WSAStartup failed" << ENDL; return 1; } #endif // __MINGW32__ // If running as client proxy, open sockets that mimic an // X display to which X clients can connect (e.g., unix:8 // and :8) int tcpFD = -1; int unixFD = -1; if (proxyMode == PROXY_CLIENT) { if (useTCPSocket) { // Open TCP socket for display tcpFD = socket(AF_INET, SOCK_STREAM, PF_UNSPEC); if (tcpFD == -1) { CERR << "socket() failed for TCP socket, errno=" << errno << ENDL; Cleanup(); } int flag = 1; if (setsockopt(tcpFD, SOL_SOCKET, SO_REUSEADDR, (char *) &flag, sizeof(flag)) < 0) { CERR << "setsockopt(SO_REUSEADDR) failed for TCP socket, errno = " << errno << ENDL; } SETNODELAY(tcpFD); sockaddr_in tcpAddr; tcpAddr.sin_family = AF_INET; unsigned int xPortTCP = X_TCP_PORT + displayNum; tcpAddr.sin_port = htons(xPortTCP); tcpAddr.sin_addr.s_addr = htonl(INADDR_ANY); if (bind(tcpFD, (sockaddr *) & tcpAddr, sizeof(tcpAddr)) == -1) { CERR << "bind() failed for TCP port " << xPortTCP << ", errno=" << errno << ENDL; Cleanup(); } if (listen(tcpFD, 5) == -1) { CERR << "listen() failed for TCP port " << xPortTCP << ", errno=" << errno << ENDL; Cleanup(); } } if (useUnixDomainSocket) { // Open UNIX domain socket for display unixFD = socket(AF_UNIX, SOCK_STREAM, PF_UNSPEC); if (unixFD == -1) { CERR << "socket() failed for UNIX domain socket, errno=" << errno << ENDL; Cleanup(); } sockaddr_un unixAddr; unixAddr.sun_family = AF_UNIX; struct stat dirStat; if ((stat("/tmp/.X11-unix", &dirStat) == -1) && (errno == ENOENT)) { mkdir("/tmp/.X11-unix" #ifndef __MINGW32__ , 0777 #endif ); chmod("/tmp/.X11-unix", 0777); } sprintf(udomSocketPathname, "/tmp/.X11-unix/X%d", displayNum); strcpy(unixAddr.sun_path, udomSocketPathname); if (bind(unixFD, (sockaddr *) & unixAddr, strlen(udomSocketPathname) + 2) == -1) { CERR << "bind() failed for UNIX domain socket " << udomSocketPathname << ", errno=" << errno << ENDL; CERR << "This probably means you do not have sufficient rights to " << "write to /tmp/.X11-unix/." << ENDL << "Either use the -u option or obtain the necessary rights." << ENDL; Cleanup(); } if (listen(unixFD, 5) == -1) { CERR << "listen() failed for UNIX domain socket " << udomSocketPathname << ", errno=" << errno << ENDL; Cleanup(); } } } if (dofork) { DaemonInit(proxyPort); } // Set up low-bandwidth connection between the proxies int proxyFD = -1; if (WE_INITIATE_CONNECTION) { proxyFD = ConnectToRemote(remoteHost, proxyPort); // Compare the version number sent by the host to our version. If we don't // get back an identical string we exit. if (!VersionNumbersMatch(proxyFD)) { Cleanup(); } if (!silent) { *logofs << "connected to " << ((proxyMode == PROXY_CLIENT) ? "server" : "client") << " proxy\nready" << ENDL; } } else { proxyFD = AwaitConnection(proxyPort); if (!silent) { *logofs << "connected to " << ((proxyMode == PROXY_CLIENT) ? "server" : "client") << " proxy\nready" << ENDL; } } // Create multiplexer Multiplexer *multiplexer; if (proxyMode == PROXY_SERVER) multiplexer = new ServerMultiplexer(proxyFD, xServerAddrFamily, xServerAddr, xServerAddrLength, statisticsLevel); else multiplexer = new ClientMultiplexer(proxyFD, statisticsLevel); if (compressImages) { int err = lzo_init(); if (err != LZO_E_OK) { CERR << "warning: cannot initialize image compression library" << " (error " << err << ")" << ENDL; compressImages = 0; } } // Loop ENDLessly, reading from all of the open file descriptors for (;;) { fd_set readSet; FD_ZERO(&readSet); FD_SET(proxyFD, &readSet); unsigned int numFDsToSelect = proxyFD + 1; if (proxyMode == PROXY_CLIENT) { if (useTCPSocket) { FD_SET(tcpFD, &readSet); if (tcpFD >= (int) numFDsToSelect) numFDsToSelect = tcpFD + 1; } if (useUnixDomainSocket) { FD_SET(unixFD, &readSet); if (unixFD >= (int) numFDsToSelect) numFDsToSelect = unixFD + 1; } } multiplexer->setSelectFDs(&readSet, numFDsToSelect); timeval delay; delay.tv_sec = 600; delay.tv_usec = 0; // PGID_USE_PID, defined in , is specific to HP-UX 10.x #if (defined(__hpux) || defined(hpux)) && !defined(PGID_USE_PID) int result = select(numFDsToSelect, (int *) &readSet, NULL, NULL, &delay); #else int result = select(numFDsToSelect, &readSet, NULL, NULL, &delay); #endif if (result == -1) { if (errno == EINTR) continue; CERR << "select() failed, errno=" << errno << ENDL; delete multiplexer; Cleanup(); } for (unsigned int j = 0; j < numFDsToSelect; j++) { if (!(FD_ISSET(j, &readSet))) continue; if (proxyMode == PROXY_CLIENT) { if ((((int) j == tcpFD) && useTCPSocket) || (((int) j == unixFD) && useUnixDomainSocket)) { int newFD = -1; if (((int) j == tcpFD) && useTCPSocket) { sockaddr_in newAddr; ACCEPT_SOCKLEN_T addrLen = sizeof(sockaddr_in); newFD = accept(tcpFD, (sockaddr *) & newAddr, &addrLen); } else { sockaddr_un newAddr; ACCEPT_SOCKLEN_T addrLen = sizeof(sockaddr_un); newFD = accept(unixFD, (sockaddr *) & newAddr, &addrLen); } if (newFD == -1) { CERR << "accept() failed, errno=" << errno << ENDL; delete multiplexer; Cleanup(); } SETNODELAY(newFD); multiplexer->createNewConnection(newFD); continue; } } if (!multiplexer->handleSelect(j)) { delete multiplexer; Cleanup(); } } } return 0; } static void Usage(const char **argv) { CERR << "Usage: " << argv[0] << " [common options] [client options | server options] [connect options]" << ENDL << ENDL; CERR << "[common options]" << ENDL << " -p port_num Specifies the TCP port on which the LISTENING process" << ENDL << " listens, or to which the CONNECTING process connects" << ENDL << " (default is " << DEFAULT_PROXY_PORT << ")." << ENDL << " -f fork (starts process in background)." << ENDL << " -k kill (kills backgrounded process started via -f)." << ENDL << " -v Print version/license info and exit." << ENDL << " -s (1|2) Print compression stats; -s 1 prints a summary on" << ENDL << " exit, -s 2 prints details for each X application." << ENDL << " -l log_file write output to a logfile instead of stdout." << ENDL << ENDL; CERR << "[client options] (only meaningful to the CLIENT process)" << ENDL << " -i compression_lvl Specify image bitmap compression level (0-9,99," << ENDL << " 999). 0 disables bitmap compression; 999 is maximal;" << ENDL << " other values are tradeoffs of speed vs. compression." << ENDL << " Default is " << DEFAULT_IMAGE_COMPRESSION_LEVEL << "." << ENDL << " -d display_num Specify display number to emulate. Default is 8." << ENDL << " -u Do not attempt to open UNIX domain socket for" << ENDL << " proxied server." << ENDL << " -t Do not attempt to open TCP socket for proxied server." << ENDL << ENDL; CERR << "[server options] (only meaningful to the SERVER process)" << ENDL << " -D Specify X host on which to display proxied" << ENDL << " applications. Defaults to value of the DISPLAY" << ENDL << " environment variable." << ENDL << " -b (a|w) force backing store (-ba = always, -bw = when mapped)" << ENDL << ENDL; CERR << "[connect options]" << ENDL << " hostname The name of the machine on which the LISTENING" << ENDL << " process is running. The presence of the hostname" << ENDL << " argument specifies that this is the CONNECTING" << ENDL << " process. Its absence specifies that this is the" << ENDL << " LISTENING process." << ENDL << " -w If this is the CONNECTING process, specifies that it" << ENDL << " is the CLIENT process (by default, the CONNECTING" << ENDL << " process is the SERVER process). If this is the" << ENDL << " LISTENING process, specifies that it is the SERVER" << ENDL << " process (by default, the LISTENING process is the" << ENDL << " CLIENT process)." << ENDL << ENDL; CERR << "Notes on modes:" << ENDL << ENDL; CERR << "dxpc has two modes; the connection mode, which is either LISTENING or" << ENDL << "CONNECTING; and the X mode, which is either CLIENT or SERVER." << ENDL << ENDL; CERR << "The LISTENING process waits for a CONNECTING process to initiate the TCP" << ENDL << "connection between the two processes. The LISTENING process must always be" << ENDL << "started first. The CONNECTING process initiates the connection to the" << ENDL << "LISTENING process. dxpc will run as the CONNECTING process if a hostname" << ENDL << "argument is supplied (see connect options, above). Otherwise it will run as" << ENDL << "the LISTENING process." << ENDL << ENDL; CERR << "The SERVER process is typically located on the same machine as the real X" << ENDL << "server, and is responsible for displaying the output of applications. The" << ENDL << "CLIENT process is typically located on the same machine as the X" << ENDL << "applications, and is responsible for forwarding the output of those" << ENDL << "applications to the SERVER process. By default, dxpc runs as the CLIENT" << ENDL << "process if it is the LISTENING process (due to the lack of a hostname" << ENDL << "argument) and the SERVER process if it is the CONNECTING process, but the -w" << ENDL << "switch reverses this (see connect options, above)." << ENDL << ENDL; CERR << "For example, the command 'dxpc myhost.work.com' starts dxpc as the" << ENDL << "CONNECTING process (because a host name is supplied) and the SERVER process" << ENDL << "(because it is the CONNECTING process and -w is not supplied). The command" << ENDL << "'dxpc -w' starts dxpc as the LISTENING process (because no hostname is" << ENDL << "supplied) and the SERVER process (because it is the LISTENING process, and" << ENDL << "-w reverses the usual logic)." << ENDL; exit(1); } static void Cleanup() { if (!silent) *logofs << "Closing all file descriptors and shutting down..." << ENDL; if (dofork) if (remove(lockfilename)) perror("Unable to remove lockfile"); if (useUnixDomainSocket) unlink(udomSocketPathname); for (unsigned int i = 0; i < maxNumFDs; i++) (void) close(i); exit(1); } static void HandleSignal(int) { Cleanup(); } // Open TCP socket to listen for server proxy; block until server // proxy connects, then close listener socket and return FD of socket // on which server proxy is connected // static int AwaitConnection(int portNum) { int proxyFD = socket(AF_INET, SOCK_STREAM, 0); if (proxyFD == -1) { CERR << "socket() failed for TCP socket, errno=" << errno << ENDL; Cleanup(); } int flag = 1; if (setsockopt(proxyFD, SOL_SOCKET, SO_REUSEADDR, (char *) &flag, sizeof(flag)) < 0) { CERR << "setsockopt(SO_REUSEADDR) failed for proxy port, errno=" << errno << ENDL; } sockaddr_in tcpAddr; tcpAddr.sin_family = AF_INET; tcpAddr.sin_port = htons(portNum); tcpAddr.sin_addr.s_addr = htonl(INADDR_ANY); if (bind(proxyFD, (sockaddr *) & tcpAddr, sizeof(tcpAddr)) == -1) { CERR << "bind() failed for TCP port " << portNum << ", errno=" << errno << ENDL; Cleanup(); } if (listen(proxyFD, 1) == -1) { CERR << "listen() failed for TCP port " << portNum << ", errno=" << errno << ENDL; Cleanup(); } for (;;) { fd_set readSet; FD_ZERO(&readSet); FD_SET(proxyFD, &readSet); #if (defined(__hpux) || defined(hpux)) && !defined(PGID_USE_PID) int result = select(proxyFD + 1, (int *) &readSet, NULL, NULL, NULL); #else int result = select(proxyFD + 1, &readSet, NULL, NULL, NULL); #endif if (result == -1) { if (errno == EINTR) continue; CERR << "select() failed, errno=" << errno << ENDL; Cleanup(); } if (FD_ISSET(proxyFD, &readSet)) { sockaddr_in newAddr; ACCEPT_SOCKLEN_T addrLen = sizeof(sockaddr_in); int newFD = accept(proxyFD, (sockaddr *) & newAddr, &addrLen); if (newFD == -1) { CERR << "accept() failed, errno=" << errno << ENDL; Cleanup(); } // Now we send our version number. char version[40]; if (!WE_INITIATE_CONNECTION) { sprintf(version, "DXPC %i.%i/ci=%d", DXPC_VERSION_MAJOR, DXPC_VERSION_MINOR, compressImages); } else { sprintf(version, "DXPC %i.%i", DXPC_VERSION_MAJOR, DXPC_VERSION_MINOR); } SOCKWRITE(newFD, version, strlen(version) + 1); // If the client doesn't like our version it will simply close the // socket. SOCKCLOSE(proxyFD); return newFD; } } } // Connect to remote proxy. If successful, return FD of connection; // if unsuccessful, return -1 // static int ConnectToRemote(char *remoteHost, int portNum) { int remoteIPAddr; hostent *hostAddr = gethostbyname(remoteHost); if (hostAddr == NULL) { // on some UNIXes, gethostbyname doesn't accept IP addresses, // so try inet_addr: remoteIPAddr = (int) inet_addr(remoteHost); if (remoteIPAddr == -1) { CERR << "Unknown host '" << remoteHost << "'" << ENDL; Cleanup(); } } else remoteIPAddr = *(int *) hostAddr->h_addr_list[0]; int remoteProxyFD = socket(AF_INET, SOCK_STREAM, PF_UNSPEC); if (remoteProxyFD == -1) { CERR << "socket() failed, errno=" << errno << ENDL; Cleanup(); } int flag = 1; if (setsockopt(remoteProxyFD, SOL_SOCKET, SO_REUSEADDR, (char *) &flag, sizeof(flag)) < 0) { CERR << "setsockopt(SO_REUSEADDR) failed for proxy port, errno=" << errno << ENDL; } if (!silent) { *logofs << "trying to connect to remote proxy..." << ENDL; } sockaddr_in addr; addr.sin_family = AF_INET; addr.sin_port = htons(portNum); addr.sin_addr.s_addr = remoteIPAddr; if (connect(remoteProxyFD, (sockaddr *) & addr, sizeof(sockaddr_in)) == -1) { CERR << "connect() failed, errno=" << errno << ENDL; SOCKCLOSE(remoteProxyFD); Cleanup(); } CERR << "connect succeeded." << ENDL; SETNODELAY(remoteProxyFD); return remoteProxyFD; } static int VersionNumbersMatch(int sockfd) { // We consider the version numbers to match if the major and minor // numbers match. Different patch levels should by definition be // compatible with each other. char version[20]; char recvmsg[40]; char *opts; sprintf(version, "DXPC %i.%i", DXPC_VERSION_MAJOR, DXPC_VERSION_MINOR); if (ReadDataCh(sockfd, recvmsg, sizeof(recvmsg), '\0') < 0) { CERR << "No version number from far end" << ENDL; return 0; } // Split any available options off from version number. if ((opts = strchr(recvmsg, '/')) != NULL) { *opts++ = 0; } if (strncmp(recvmsg, version, strlen(version))) { // Make sure recvmsg will be printable unsigned int ctr; for (ctr = 0; ctr < strlen(recvmsg) && (isgraph(recvmsg[ctr]) || isspace(recvmsg[ctr])); ctr++); recvmsg[ctr] = 0; CERR << "Error version numbers don't match!" << ENDL << "Local version: " << version << ENDL << "Remote version: " << recvmsg << ENDL; return 0; } if (parseRemoteOptions(opts)) { // Not strictly a version number mismatch, but fail anyway. return 0; } // We initiated the connection; if we didn't learn a compression level, // we're screwed. if (compressImages == -1) { CERR << "error: host didn't specify image compression level" << ENDL; return 0; } return 1; } static int ReadDataCh(int fd, char *buf, int maxlen, char stop) { int ctr = 0; int result; while (ctr < maxlen) { if ((result = SOCKREAD(fd, buf + ctr, 1)) == -1 || !result) { return -1; } if (result && *(buf + ctr++) == stop) { return ctr; } } return 0; } static void DaemonInit(unsigned int displayNum) { #if defined(__EMX__) || defined(__MINGW32__) CERR << "The daemon option is disabled on this platform" << ENDL; exit(-1); #else switch (fork()) { case -1: perror("dxpc"); Cleanup(); case 0: break; default: exit(0); } pid_t pid; if ((pid = setsid()) == -1) { CERR << "Error setsid() failed." << ENDL; Cleanup(); } MakeLockFileName(lockfilename, displayNum); // First we try to open the file to see if dxpc is already running FILE *pidfile = fopen(lockfilename, "r"); if (pidfile) { // The open was successful // So we try and read a pid out of it. char oldpid[10]; switch (fread(oldpid, 1, sizeof(oldpid), pidfile)) { case 0: CERR << "Found empty pidfile " << lockfilename << ". Overriding." << ENDL; break; case -1: CERR << "Error reading from old pidfile " << lockfilename << ". Overriding." << ENDL; break; default: // Do a sanity check on the returned data if (!isdigit((int) ((unsigned char) oldpid[0]))) { CERR << "Invalid data in pidfile " << lockfilename << ". Aborting." << ENDL; fclose(pidfile); Cleanup(); } long oldpidval = atoi(oldpid); int override = 0; switch (kill(oldpidval, 0)) { case ESRCH: case EPERM: // Either the pid doesn't exist or is owned by someone // else. It's probably safe to override. CERR << "Stale pidfile found. Overriding." << ENDL; override = 1; break; default: CERR << "Error. It appears another dxpc is running at pid " << oldpidval << ENDL << "If this isn't correct, then delete " << lockfilename << ENDL; } if (override) break; fclose(pidfile); dofork = 0; // So Cleanup() won't delete the lockfile Cleanup(); } fclose(pidfile); } if (!(pidfile = fopen(lockfilename, "w"))) { perror("dxpc"); Cleanup(); } fprintf(pidfile, "%lu", (unsigned long) pid); fclose(pidfile); // Now turn off all non-error output to the console silent = 1; #endif return; } void KillDaemon(unsigned int displayNum) { #ifndef __MINGW32__ char lockfilename[512]; MakeLockFileName(lockfilename, displayNum); FILE *pidfile = fopen(lockfilename, "r"); if (pidfile) { // The open was successful // So we try and read a pid out of it. char pid[10]; switch (fread(pid, 1, sizeof(pid), pidfile)) { case 0: case -1: CERR << "Error reading pid from " << lockfilename << ENDL << "You will have to manually kill the daemon." << ENDL; break; default: fclose(pidfile); // Do a sanity check on the returned data if (!isdigit((int) ((unsigned char) pid[0]))) { CERR << "Invalid data in pidfile " << lockfilename << ". Aborting." << ENDL; exit(1); } long pidval = atoi(pid); COUT << "Killing dxpc at pid " << pidval << ENDL; if (kill(pidval, SIGTERM) == -1) { perror("dxpc"); CERR << "Leaving pidfile intact." << ENDL; exit(1); } } exit(0); } else { CERR << "No daemon is running." << ENDL; exit(1); } #else // MingW. CERR << "Kill not supported on mingw." << ENDL; exit(1); #endif } #ifndef __MINGW32__ static void MakeLockFileName(char *lockfilename, unsigned int displayNum) { char *homedir = getenv("HOME"); if (!homedir) { CERR << "You have no environment variable HOME!" << ENDL << "How did that happen?" << ENDL; exit(1); } strcpy(lockfilename, homedir); strcat(lockfilename, "/"); strcat(lockfilename, LOCK_FILE_NAME); // constants.h struct utsname unameInfo; if (uname(&unameInfo) == -1) { unameInfo.nodename[0] = 0; } else { char *dotptr = strchr(unameInfo.nodename, '.'); if (dotptr) *dotptr = 0; strcat(lockfilename, "-"); strcat(lockfilename, unameInfo.nodename); } struct passwd *passdata; if ((passdata = getpwuid(getuid())) != 0) { strcat(lockfilename, "-"); strcat(lockfilename, passdata->pw_name); } else { strcat(lockfilename, ""); } sprintf(lockfilename + strlen(lockfilename), "-%u", displayNum); } #endif // __MINGW32__ // Parse the option string passed from the remote end at startup. static int parseRemoteOptions(char *opts) { char *name, *value; // The options string is intended to be a series of name/value // tuples in the form name=value seperated by the '/' character. name = strtok(opts, "="); while (name) { value = strtok(NULL, "/"); if (!value) { CERR << "error in remote option " << name << ": no value found" << ENDL; return -1; } // Currently we only have one known option... if (!strcmp(name, "ci")) { if (WE_INITIATE_CONNECTION) { // The far end just told us what level of image compression // to use. compressImages = atoi(value); if (!silent) { COUT << "using image compression level " << compressImages << ENDL; } } else { CERR << "image compression option from initiating side" " ignored" << ENDL; } } else { CERR << "unknown remote option: " << name << " = " << value << ENDL; return -1; } name = strtok(NULL, "="); } return 0; } dxpc-3.9.2/main.C0000644000175000017530000011626211245651203013111 0ustar kvigorkvigor#include "dxpcconf.h" #include #include #include #include #include #include #include #include #include #include #if !defined(__MINGW32__) # include # include # include # include # include # include # include # include #endif #if !defined(__CYGWIN32__) && !defined(__MINGW32__) # include # include #endif #include "X-headers.H" #ifdef _AIX # include #endif /* _AIX */ #include "constants.H" #include "util.H" #include "ClientMultiplexer.H" #include "ServerMultiplexer.H" #include "Compresser.H" #if defined(__EMX__ ) || defined(__CYGWIN32__) || defined(__MINGW32__) struct sockaddr_un { u_short sun_family; /* socket family: AF_UNIX */ char sun_path[108]; /* path name (not used) */ }; #endif #ifdef _AIX # include #endif /* _AIX */ #if defined(hpux) && !defined(RLIM_INFINITY) /* HP-UX hides this define */ # define RLIM_INFINITY 0x7fffffff #endif static void Usage(const char **argv); static void Cleanup(); static void HandleSignal(int); static int AwaitConnection(int portNum); static int ConnectToRemote(char *remoteHost, int portNum); static void DaemonInit(unsigned int); static void KillDaemon(unsigned int); static void MakeLockFileName(char *, unsigned int); static int VersionNumbersMatch(int sockfd); static int ReadDataCh(int fd, char *buf, int maxlen, char stop); static int parseRemoteOptions(char *opts); // This variable tells whether or not the client should initiate the // connection. (see -w option) static int ClientInitiateConnection = 0; // Maximum number of open file descriptors for this process static unsigned int maxNumFDs = 0; // Variable to tell output routines whether they should be quiet or not // Added for -f option // This variable is used by other files int silent = 0; // Variable to indicate whether the user wants backing store turned on // to help reduce network traffic at some cost in server memory. // This variable is used by other files. int wantBackingStore = 0; // These two variables are needed for the forking // We don't fork by default since old versions didn't static int dofork = 0; static char lockfilename[512] = { 0 }; // And the default lockfilename - this goes in the user's $HOME dir static const char *LOCK_FILE_NAME = ".dxpc.pid"; // Now statistics can go to a file char logfilename[1024] = { 0 }; OSTREAM *logofs; // Controls miniLZO PutImage compression: used by other files. int compressImages = -1; // Info about sockets used by the client proxy (global so that // the cleanup signal handler can access it) static char udomSocketPathname[100]; static int useUnixDomainSocket = 1; sockaddr_in serverAddr; // dxpc runs in client mode or server mode enum ProxyMode { PROXY_CLIENT, PROXY_SERVER } proxyMode = PROXY_SERVER; // Macro is TRUE if we should initiate the connection. #define WE_INITIATE_CONNECTION \ ((proxyMode == PROXY_SERVER && !ClientInitiateConnection) \ || (proxyMode == PROXY_CLIENT && ClientInitiateConnection)) // #define COREDUMPS_ENABLED #ifdef COREDUMPS_ENABLED int enableCoredumps(void) { rlimit rlim; if (getrlimit(RLIMIT_CORE, &rlim)) { CERR << "Cannot read RLIMIT_CORE: " << strerror(errno) << ENDL; return -1; } if (rlim.rlim_cur < rlim.rlim_max) { rlim.rlim_cur = rlim.rlim_max; if (setrlimit(RLIMIT_CORE, &rlim)) { CERR << "Cannot set RLIMIT_CORE: " << strerror(errno) << ENDL; return -2; } } CERR << "Set RLIMIT_CORE to " << rlim.rlim_max << ENDL; return 0; } #endif int main(int argc, char **argv) { udomSocketPathname[0] = 0; unsigned int proxyPort = DEFAULT_PROXY_PORT; unsigned int displayNum = DEFAULT_DISPLAY_NUM; unsigned int statisticsLevel = 0; int useTCPSocket = 1; char *remoteHost = NULL; const char *displaySrc = 0; #ifdef COREDUMPS_ENABLED enableCoredumps(); #endif // used to use getopt here, but it caused too many // portability problems for (int argi = 1; argi < argc; argi++) { char *nextArg = argv[argi]; if (*nextArg == '-') { switch (nextArg[1]) { case 'b': { const char *arg = GetArg(argi, argc, (const char **) argv); if (!arg) Usage((const char **) argv); if (*arg == 'a') wantBackingStore = 2 /* Always */ ; else if (*arg == 'm' || *arg == 'w') wantBackingStore = 1 /* WhenMapped */ ; else if (*arg == 'n') wantBackingStore = 0; else Usage((const char **) argv); } break; case 'd': { const char *arg = GetArg(argi, argc, (const char **) argv); if (arg == NULL) Usage((const char **) argv); else displayNum = atoi(arg); } break; case 'D': displaySrc = GetArg(argi, argc, (const char **) argv); if (!displaySrc) { Usage((const char **) argv); } break; case 'f': dofork = 1; break; case 'k': KillDaemon(proxyPort); // This function doesn't return break; case 'l': { const char *arg = GetArg(argi, argc, (const char **) argv); if (!arg) Usage((const char **) argv); else strcpy(logfilename, arg); } break; case 'p': { const char *arg = GetArg(argi, argc, (const char **) argv); if (arg == NULL) Usage((const char **) argv); else proxyPort = atoi(arg); } break; case 's': { const char *arg = GetArg(argi, argc, (const char **) argv); if (arg == NULL) Usage((const char **) argv); else statisticsLevel = atoi(arg); } break; case 't': useTCPSocket = 0; break; case 'u': useUnixDomainSocket = 0; break; case 'v': PrintVersionInfo(); exit(0); case 'w': ClientInitiateConnection = 1; break; case 'i': { const char *arg = GetArg(argi, argc, (const char **) argv); if (arg == NULL) Usage((const char **) argv); else compressImages = atoi(arg); } break; default: Usage((const char **) argv); } } else { if (remoteHost != NULL) Usage((const char **) argv); else remoteHost = nextArg; } } if (logfilename[0] != '\0') { logofs = new OFSTREAM(logfilename, IOS_OUT); } else { logofs = &COUT; } int xServerAddrFamily = AF_INET; sockaddr *xServerAddr = NULL; unsigned int xServerAddrLength = 0; if ((!remoteHost && !ClientInitiateConnection) || (remoteHost && ClientInitiateConnection)) { COUT << "dxpc proxy running in CLIENT mode" << ENDL; proxyMode = PROXY_CLIENT; } else { COUT << "dxpc proxy running in SERVER mode" << ENDL; proxyMode = PROXY_SERVER; // Keep Cleanup() from deleting the real X server's pipe // when we exit... useUnixDomainSocket = 0; // $DISPLAY is the X server for which we'll act as a proxy if (!displaySrc) { displaySrc = getenv("DISPLAY"); } if ((displaySrc == NULL) || (*displaySrc == 0)) { CERR << "$DISPLAY is not set" << ENDL; Cleanup(); } char *display = new char[strlen(displaySrc) + 1]; if (!display) { CERR << "Out of memory duping DISPLAY" << ENDL; Cleanup(); } strcpy(display, displaySrc); char *separator = strchr(display, ':'); if ((separator == NULL) || !isdigit(*(separator + 1))) { CERR << "invalid DISPLAY '" << display << "'" << ENDL; Cleanup(); } *separator = 0; int displayNum = atoi(separator + 1); if ((separator == display) || !strcmp(display, "unix")) { // UNIX domain port xServerAddrFamily = AF_UNIX; sockaddr_un *xServerAddrUNIX = new sockaddr_un; xServerAddrUNIX->sun_family = AF_UNIX; sprintf(udomSocketPathname, "/tmp/.X11-unix/X%d", displayNum); struct stat statInfo; if (stat(udomSocketPathname, &statInfo) == -1) { #if (defined(__hpux) || defined(hpux)) && !defined(PGID_USE_PID) sprintf(udomSocketPathname, "/usr/spool/sockets/X11/%d", displayNum); if (stat(udomSocketPathname, &statInfo) == -1) { #endif CERR << "cannot open UNIX domain connection to X server" << ENDL; Cleanup(); #if (defined(__hpux) || defined(hpux)) && !defined(PGID_USE_PID) } #endif } strcpy(xServerAddrUNIX->sun_path, udomSocketPathname); xServerAddr = (sockaddr *) xServerAddrUNIX; // xServerAddrLength = strlen(udomSocketPathname) + 2; xServerAddrLength = sizeof(sockaddr_un); } else { // TCP port xServerAddrFamily = AF_INET; int ipAddr; hostent *hostAddr = gethostbyname(display); if (hostAddr == NULL) { // on some UNIXes, gethostbyname doesn't accept IP addresses, // so try inet_addr: ipAddr = (int) inet_addr(display); if (ipAddr == -1) { CERR << "Unknown host '" << display << "'" << ENDL; Cleanup(); } } else ipAddr = *(int *) hostAddr->h_addr_list[0]; sockaddr_in *xServerAddrTCP = new sockaddr_in; xServerAddrTCP->sin_family = AF_INET; xServerAddrTCP->sin_port = htons(X_TCP_PORT + displayNum); xServerAddrTCP->sin_addr.s_addr = ipAddr; xServerAddr = (sockaddr *) xServerAddrTCP; xServerAddrLength = sizeof(sockaddr_in); } if (display) { delete[]display; display = 0; } } // Sanity check compressImages. if (WE_INITIATE_CONNECTION) { if (compressImages != -1) { CERR << "warning: image compression option (-i) ignored " << "when initiating connection" << ENDL; compressImages = -1; } } else { // We will accept connections; we control image compression. if (compressImages == -1) { // Default image compression level. compressImages = DEFAULT_IMAGE_COMPRESSION_LEVEL; } else if (compressImages && !Compresser::isValidCompressionLevel(compressImages)) { CERR << "warning: invalid image compression level " << compressImages << ": image compression disabled" << ENDL; compressImages = 0; } if (!silent) { COUT << "using image compression level " << compressImages << ENDL; } } // Increase the max # of open file descriptors for this process maxNumFDs = 0; #if defined(RLIMIT_NOFILE) rlimit limits; if (getrlimit(RLIMIT_NOFILE, &limits) == 0) { if (limits.rlim_max == RLIM_INFINITY) maxNumFDs = 0; else maxNumFDs = (unsigned int) limits.rlim_max; } #endif /* RLIMIT_NOFILE */ #if defined(_SC_OPEN_MAX) if (maxNumFDs == 0) maxNumFDs = sysconf(_SC_OPEN_MAX); #endif #if defined(FD_SETSIZE) if (maxNumFDs > FD_SETSIZE) maxNumFDs = FD_SETSIZE; #endif /* FD_SETSIZE */ #if defined(RLIMIT_NOFILE) if (limits.rlim_cur < maxNumFDs) { limits.rlim_cur = maxNumFDs; setrlimit(RLIMIT_NOFILE, &limits); } #endif /* RLIMIT_NOFILE */ #ifndef __MINGW32__ if (maxNumFDs == 0) { CERR << "cannot determine number of available file descriptors, exiting!" << ENDL; return 1; } // Install some signal handlers for graceful shutdown signal(SIGHUP, HandleSignal); signal(SIGINT, HandleSignal); signal(SIGTERM, HandleSignal); signal(SIGPIPE, (void (*)(int)) SIG_IGN); #else // __MINGW32__ WSADATA wsaData; if (WSAStartup(0x20, &wsaData)) { CERR << "WSAStartup failed" << ENDL; return 1; } #endif // __MINGW32__ // If running as client proxy, open sockets that mimic an // X display to which X clients can connect (e.g., unix:8 // and :8) int tcpFD = -1; int unixFD = -1; if (proxyMode == PROXY_CLIENT) { if (useTCPSocket) { // Open TCP socket for display tcpFD = socket(AF_INET, SOCK_STREAM, PF_UNSPEC); if (tcpFD == -1) { CERR << "socket() failed for TCP socket, errno=" << errno << ENDL; Cleanup(); } int flag = 1; if (setsockopt(tcpFD, SOL_SOCKET, SO_REUSEADDR, (char *) &flag, sizeof(flag)) < 0) { CERR << "setsockopt(SO_REUSEADDR) failed for TCP socket, errno = " << errno << ENDL; } SETNODELAY(tcpFD); sockaddr_in tcpAddr; tcpAddr.sin_family = AF_INET; unsigned int xPortTCP = X_TCP_PORT + displayNum; tcpAddr.sin_port = htons(xPortTCP); tcpAddr.sin_addr.s_addr = htonl(INADDR_ANY); if (bind(tcpFD, (sockaddr *) & tcpAddr, sizeof(tcpAddr)) == -1) { CERR << "bind() failed for TCP port " << xPortTCP << ", errno=" << errno << ENDL; Cleanup(); } if (listen(tcpFD, 5) == -1) { CERR << "listen() failed for TCP port " << xPortTCP << ", errno=" << errno << ENDL; Cleanup(); } } if (useUnixDomainSocket) { // Open UNIX domain socket for display unixFD = socket(AF_UNIX, SOCK_STREAM, PF_UNSPEC); if (unixFD == -1) { CERR << "socket() failed for UNIX domain socket, errno=" << errno << ENDL; Cleanup(); } sockaddr_un unixAddr; unixAddr.sun_family = AF_UNIX; struct stat dirStat; if ((stat("/tmp/.X11-unix", &dirStat) == -1) && (errno == ENOENT)) { mkdir("/tmp/.X11-unix" #ifndef __MINGW32__ , 0777 #endif ); chmod("/tmp/.X11-unix", 0777); } sprintf(udomSocketPathname, "/tmp/.X11-unix/X%d", displayNum); strcpy(unixAddr.sun_path, udomSocketPathname); if (bind(unixFD, (sockaddr *) & unixAddr, strlen(udomSocketPathname) + 2) == -1) { CERR << "bind() failed for UNIX domain socket " << udomSocketPathname << ", errno=" << errno << ENDL; CERR << "This probably means you do not have sufficient rights to " << "write to /tmp/.X11-unix/." << ENDL << "Either use the -u option or obtain the necessary rights." << ENDL; Cleanup(); } if (listen(unixFD, 5) == -1) { CERR << "listen() failed for UNIX domain socket " << udomSocketPathname << ", errno=" << errno << ENDL; Cleanup(); } } } if (dofork) { DaemonInit(proxyPort); } // Set up low-bandwidth connection between the proxies int proxyFD = -1; if (WE_INITIATE_CONNECTION) { proxyFD = ConnectToRemote(remoteHost, proxyPort); // Compare the version number sent by the host to our version. If we don't // get back an identical string we exit. if (!VersionNumbersMatch(proxyFD)) { Cleanup(); } if (!silent) { *logofs << "connected to " << ((proxyMode == PROXY_CLIENT) ? "server" : "client") << " proxy\nready" << ENDL; } } else { proxyFD = AwaitConnection(proxyPort); if (!silent) { *logofs << "connected to " << ((proxyMode == PROXY_CLIENT) ? "server" : "client") << " proxy\nready" << ENDL; } } // Create multiplexer Multiplexer *multiplexer; if (proxyMode == PROXY_SERVER) multiplexer = new ServerMultiplexer(proxyFD, xServerAddrFamily, xServerAddr, xServerAddrLength, statisticsLevel); else multiplexer = new ClientMultiplexer(proxyFD, statisticsLevel); if (compressImages) { int err = lzo_init(); if (err != LZO_E_OK) { CERR << "warning: cannot initialize image compression library" << " (error " << err << ")" << ENDL; compressImages = 0; } } // Loop ENDLessly, reading from all of the open file descriptors for (;;) { fd_set readSet; FD_ZERO(&readSet); FD_SET(proxyFD, &readSet); unsigned int numFDsToSelect = proxyFD + 1; if (proxyMode == PROXY_CLIENT) { if (useTCPSocket) { FD_SET(tcpFD, &readSet); if (tcpFD >= (int) numFDsToSelect) numFDsToSelect = tcpFD + 1; } if (useUnixDomainSocket) { FD_SET(unixFD, &readSet); if (unixFD >= (int) numFDsToSelect) numFDsToSelect = unixFD + 1; } } multiplexer->setSelectFDs(&readSet, numFDsToSelect); timeval delay; delay.tv_sec = 600; delay.tv_usec = 0; // PGID_USE_PID, defined in , is specific to HP-UX 10.x #if (defined(__hpux) || defined(hpux)) && !defined(PGID_USE_PID) int result = select(numFDsToSelect, (int *) &readSet, NULL, NULL, &delay); #else int result = select(numFDsToSelect, &readSet, NULL, NULL, &delay); #endif if (result == -1) { if (errno == EINTR) continue; CERR << "select() failed, errno=" << errno << ENDL; delete multiplexer; Cleanup(); } for (unsigned int j = 0; j < numFDsToSelect; j++) { if (!(FD_ISSET(j, &readSet))) continue; if (proxyMode == PROXY_CLIENT) { if ((((int) j == tcpFD) && useTCPSocket) || (((int) j == unixFD) && useUnixDomainSocket)) { int newFD = -1; if (((int) j == tcpFD) && useTCPSocket) { sockaddr_in newAddr; ACCEPT_SOCKLEN_T addrLen = sizeof(sockaddr_in); newFD = accept(tcpFD, (sockaddr *) & newAddr, &addrLen); } else { sockaddr_un newAddr; ACCEPT_SOCKLEN_T addrLen = sizeof(sockaddr_un); newFD = accept(unixFD, (sockaddr *) & newAddr, &addrLen); } if (newFD == -1) { CERR << "accept() failed, errno=" << errno << ENDL; delete multiplexer; Cleanup(); } SETNODELAY(newFD); multiplexer->createNewConnection(newFD); continue; } } if (!multiplexer->handleSelect(j)) { delete multiplexer; Cleanup(); } } } return 0; } static void Usage(const char **argv) { CERR << "Usage: " << argv[0] << " [common options] [client options | server options] [connect options]" << ENDL << ENDL; CERR << "[common options]" << ENDL << " -p port_num Specifies the TCP port on which the LISTENING process" << ENDL << " listens, or to which the CONNECTING process connects" << ENDL << " (default is " << DEFAULT_PROXY_PORT << ")." << ENDL << " -f fork (starts process in background)." << ENDL << " -k kill (kills backgrounded process started via -f)." << ENDL << " -v Print version/license info and exit." << ENDL << " -s (1|2) Print compression stats; -s 1 prints a summary on" << ENDL << " exit, -s 2 prints details for each X application." << ENDL << " -l log_file write output to a logfile instead of stdout." << ENDL << ENDL; CERR << "[client options] (only meaningful to the CLIENT process)" << ENDL << " -i compression_lvl Specify image bitmap compression level (0-9,99," << ENDL << " 999). 0 disables bitmap compression; 999 is maximal;" << ENDL << " other values are tradeoffs of speed vs. compression." << ENDL << " Default is " << DEFAULT_IMAGE_COMPRESSION_LEVEL << "." << ENDL << " -d display_num Specify display number to emulate. Default is 8." << ENDL << " -u Do not attempt to open UNIX domain socket for" << ENDL << " proxied server." << ENDL << " -t Do not attempt to open TCP socket for proxied server." << ENDL << ENDL; CERR << "[server options] (only meaningful to the SERVER process)" << ENDL << " -D Specify X host on which to display proxied" << ENDL << " applications. Defaults to value of the DISPLAY" << ENDL << " environment variable." << ENDL << " -b (a|w) force backing store (-ba = always, -bw = when mapped)" << ENDL << ENDL; CERR << "[connect options]" << ENDL << " hostname The name of the machine on which the LISTENING" << ENDL << " process is running. The presence of the hostname" << ENDL << " argument specifies that this is the CONNECTING" << ENDL << " process. Its absence specifies that this is the" << ENDL << " LISTENING process." << ENDL << " -w If this is the CONNECTING process, specifies that it" << ENDL << " is the CLIENT process (by default, the CONNECTING" << ENDL << " process is the SERVER process). If this is the" << ENDL << " LISTENING process, specifies that it is the SERVER" << ENDL << " process (by default, the LISTENING process is the" << ENDL << " CLIENT process)." << ENDL << ENDL; CERR << "Notes on modes:" << ENDL << ENDL; CERR << "dxpc has two modes; the connection mode, which is either LISTENING or" << ENDL << "CONNECTING; and the X mode, which is either CLIENT or SERVER." << ENDL << ENDL; CERR << "The LISTENING process waits for a CONNECTING process to initiate the TCP" << ENDL << "connection between the two processes. The LISTENING process must always be" << ENDL << "started first. The CONNECTING process initiates the connection to the" << ENDL << "LISTENING process. dxpc will run as the CONNECTING process if a hostname" << ENDL << "argument is supplied (see connect options, above). Otherwise it will run as" << ENDL << "the LISTENING process." << ENDL << ENDL; CERR << "The SERVER process is typically located on the same machine as the real X" << ENDL << "server, and is responsible for displaying the output of applications. The" << ENDL << "CLIENT process is typically located on the same machine as the X" << ENDL << "applications, and is responsible for forwarding the output of those" << ENDL << "applications to the SERVER process. By default, dxpc runs as the CLIENT" << ENDL << "process if it is the LISTENING process (due to the lack of a hostname" << ENDL << "argument) and the SERVER process if it is the CONNECTING process, but the -w" << ENDL << "switch reverses this (see connect options, above)." << ENDL << ENDL; CERR << "For example, the command 'dxpc myhost.work.com' starts dxpc as the" << ENDL << "CONNECTING process (because a host name is supplied) and the SERVER process" << ENDL << "(because it is the CONNECTING process and -w is not supplied). The command" << ENDL << "'dxpc -w' starts dxpc as the LISTENING process (because no hostname is" << ENDL << "supplied) and the SERVER process (because it is the LISTENING process, and" << ENDL << "-w reverses the usual logic)." << ENDL; exit(1); } static void Cleanup() { if (!silent) *logofs << "Closing all file descriptors and shutting down..." << ENDL; if (dofork) if (remove(lockfilename)) perror("Unable to remove lockfile"); if (useUnixDomainSocket) unlink(udomSocketPathname); for (unsigned int i = 0; i < maxNumFDs; i++) (void) close(i); exit(1); } static void HandleSignal(int) { Cleanup(); } // Open TCP socket to listen for server proxy; block until server // proxy connects, then close listener socket and return FD of socket // on which server proxy is connected // static int AwaitConnection(int portNum) { int proxyFD = socket(AF_INET, SOCK_STREAM, 0); if (proxyFD == -1) { CERR << "socket() failed for TCP socket, errno=" << errno << ENDL; Cleanup(); } int flag = 1; if (setsockopt(proxyFD, SOL_SOCKET, SO_REUSEADDR, (char *) &flag, sizeof(flag)) < 0) { CERR << "setsockopt(SO_REUSEADDR) failed for proxy port, errno=" << errno << ENDL; } sockaddr_in tcpAddr; tcpAddr.sin_family = AF_INET; tcpAddr.sin_port = htons(portNum); tcpAddr.sin_addr.s_addr = htonl(INADDR_ANY); if (bind(proxyFD, (sockaddr *) & tcpAddr, sizeof(tcpAddr)) == -1) { CERR << "bind() failed for TCP port " << portNum << ", errno=" << errno << ENDL; Cleanup(); } if (listen(proxyFD, 1) == -1) { CERR << "listen() failed for TCP port " << portNum << ", errno=" << errno << ENDL; Cleanup(); } for (;;) { fd_set readSet; FD_ZERO(&readSet); FD_SET(proxyFD, &readSet); #if (defined(__hpux) || defined(hpux)) && !defined(PGID_USE_PID) int result = select(proxyFD + 1, (int *) &readSet, NULL, NULL, NULL); #else int result = select(proxyFD + 1, &readSet, NULL, NULL, NULL); #endif if (result == -1) { if (errno == EINTR) continue; CERR << "select() failed, errno=" << errno << ENDL; Cleanup(); } if (FD_ISSET(proxyFD, &readSet)) { sockaddr_in newAddr; ACCEPT_SOCKLEN_T addrLen = sizeof(sockaddr_in); int newFD = accept(proxyFD, (sockaddr *) & newAddr, &addrLen); if (newFD == -1) { CERR << "accept() failed, errno=" << errno << ENDL; Cleanup(); } // Now we send our version number. char version[40]; if (!WE_INITIATE_CONNECTION) { sprintf(version, "DXPC %i.%i/ci=%d", DXPC_VERSION_MAJOR, DXPC_VERSION_MINOR, compressImages); } else { sprintf(version, "DXPC %i.%i", DXPC_VERSION_MAJOR, DXPC_VERSION_MINOR); } SOCKWRITE(newFD, version, strlen(version) + 1); // If the client doesn't like our version it will simply close the // socket. SOCKCLOSE(proxyFD); return newFD; } } } // Connect to remote proxy. If successful, return FD of connection; // if unsuccessful, return -1 // static int ConnectToRemote(char *remoteHost, int portNum) { int remoteIPAddr; hostent *hostAddr = gethostbyname(remoteHost); if (hostAddr == NULL) { // on some UNIXes, gethostbyname doesn't accept IP addresses, // so try inet_addr: remoteIPAddr = (int) inet_addr(remoteHost); if (remoteIPAddr == -1) { CERR << "Unknown host '" << remoteHost << "'" << ENDL; Cleanup(); } } else remoteIPAddr = *(int *) hostAddr->h_addr_list[0]; int remoteProxyFD = socket(AF_INET, SOCK_STREAM, PF_UNSPEC); if (remoteProxyFD == -1) { CERR << "socket() failed, errno=" << errno << ENDL; Cleanup(); } int flag = 1; if (setsockopt(remoteProxyFD, SOL_SOCKET, SO_REUSEADDR, (char *) &flag, sizeof(flag)) < 0) { CERR << "setsockopt(SO_REUSEADDR) failed for proxy port, errno=" << errno << ENDL; } if (!silent) { *logofs << "trying to connect to remote proxy..." << ENDL; } sockaddr_in addr; addr.sin_family = AF_INET; addr.sin_port = htons(portNum); addr.sin_addr.s_addr = remoteIPAddr; if (connect(remoteProxyFD, (sockaddr *) & addr, sizeof(sockaddr_in)) == -1) { CERR << "connect() failed, errno=" << errno << ENDL; SOCKCLOSE(remoteProxyFD); Cleanup(); } CERR << "connect succeeded." << ENDL; SETNODELAY(remoteProxyFD); return remoteProxyFD; } static int VersionNumbersMatch(int sockfd) { // We consider the version numbers to match if the major and minor // numbers match. Different patch levels should by definition be // compatible with each other. char version[20]; char recvmsg[40]; char *opts; sprintf(version, "DXPC %i.%i", DXPC_VERSION_MAJOR, DXPC_VERSION_MINOR); if (ReadDataCh(sockfd, recvmsg, sizeof(recvmsg), '\0') < 0) { CERR << "No version number from far end" << ENDL; return 0; } // Split any available options off from version number. if ((opts = strchr(recvmsg, '/')) != NULL) { *opts++ = 0; } if (strncmp(recvmsg, version, strlen(version))) { // Make sure recvmsg will be printable unsigned int ctr; for (ctr = 0; ctr < strlen(recvmsg) && (isgraph(recvmsg[ctr]) || isspace(recvmsg[ctr])); ctr++); recvmsg[ctr] = 0; CERR << "Error version numbers don't match!" << ENDL << "Local version: " << version << ENDL << "Remote version: " << recvmsg << ENDL; return 0; } if (parseRemoteOptions(opts)) { // Not strictly a version number mismatch, but fail anyway. return 0; } // We initiated the connection; if we didn't learn a compression level, // we're screwed. if (compressImages == -1) { CERR << "error: host didn't specify image compression level" << ENDL; return 0; } return 1; } static int ReadDataCh(int fd, char *buf, int maxlen, char stop) { int ctr = 0; int result; while (ctr < maxlen) { if ((result = SOCKREAD(fd, buf + ctr, 1)) == -1 || !result) { return -1; } if (result && *(buf + ctr++) == stop) { return ctr; } } return 0; } static void DaemonInit(unsigned int displayNum) { #if defined(__EMX__) || defined(__MINGW32__) CERR << "The daemon option is disabled on this platform" << ENDL; exit(-1); #else switch (fork()) { case -1: perror("dxpc"); Cleanup(); case 0: break; default: exit(0); } pid_t pid; if ((pid = setsid()) == -1) { CERR << "Error setsid() failed." << ENDL; Cleanup(); } MakeLockFileName(lockfilename, displayNum); // First we try to open the file to see if dxpc is already running FILE *pidfile = fopen(lockfilename, "r"); if (pidfile) { // The open was successful // So we try and read a pid out of it. long oldpidval; switch (fscanf(pidfile, "%ld", &oldpidval)) { case 0: CERR << "Found invalid old pidfile " << lockfilename << ". Overriding." << ENDL; break; case EOF: CERR << "Error reading from old pidfile " << lockfilename << ". Overriding." << ENDL; break; default: int override = 0; switch (kill(oldpidval, 0)) { case ESRCH: case EPERM: // Either the pid doesn't exist or is owned by someone // else. It's probably safe to override. CERR << "Stale pidfile found. Overriding." << ENDL; override = 1; break; default: CERR << "Error. It appears another dxpc is running at pid " << oldpidval << ENDL << "If this isn't correct, then delete " << lockfilename << ENDL; } if (override) break; fclose(pidfile); dofork = 0; // So Cleanup() won't delete the lockfile Cleanup(); } fclose(pidfile); } if (!(pidfile = fopen(lockfilename, "w"))) { perror("dxpc"); Cleanup(); } fprintf(pidfile, "%lu", (unsigned long) pid); fclose(pidfile); // Now turn off all non-error output to the console silent = 1; #endif return; } void KillDaemon(unsigned int displayNum) { #ifndef __MINGW32__ char lockfilename[512]; MakeLockFileName(lockfilename, displayNum); FILE *pidfile = fopen(lockfilename, "r"); if (pidfile) { // The open was successful // So we try and read a pid out of it. long pidval; switch (fscanf(pidfile, "%ld", &pidval)) { case 0: case EOF: CERR << "Error reading pid from " << lockfilename << ENDL << "You will have to manually kill the daemon." << ENDL; break; default: fclose(pidfile); COUT << "Killing dxpc at pid " << pidval << ENDL; if (kill(pidval, SIGTERM) == -1) { perror("dxpc"); CERR << "Leaving pidfile intact." << ENDL; exit(1); } } exit(0); } else { CERR << "No daemon is running." << ENDL; exit(1); } #else // MingW. CERR << "Kill not supported on mingw." << ENDL; exit(1); #endif } #ifndef __MINGW32__ static void MakeLockFileName(char *lockfilename, unsigned int displayNum) { char *homedir = getenv("HOME"); if (!homedir) { CERR << "You have no environment variable HOME!" << ENDL << "How did that happen?" << ENDL; exit(1); } strcpy(lockfilename, homedir); strcat(lockfilename, "/"); strcat(lockfilename, LOCK_FILE_NAME); // constants.h struct utsname unameInfo; if (uname(&unameInfo) == -1) { unameInfo.nodename[0] = 0; } else { char *dotptr = strchr(unameInfo.nodename, '.'); if (dotptr) *dotptr = 0; strcat(lockfilename, "-"); strcat(lockfilename, unameInfo.nodename); } struct passwd *passdata; if ((passdata = getpwuid(getuid())) != 0) { strcat(lockfilename, "-"); strcat(lockfilename, passdata->pw_name); } else { strcat(lockfilename, ""); } sprintf(lockfilename + strlen(lockfilename), "-%u", displayNum); } #endif // __MINGW32__ // Parse the option string passed from the remote end at startup. static int parseRemoteOptions(char *opts) { char *name, *value; // The options string is intended to be a series of name/value // tuples in the form name=value seperated by the '/' character. name = strtok(opts, "="); while (name) { value = strtok(NULL, "/"); if (!value) { CERR << "error in remote option " << name << ": no value found" << ENDL; return -1; } // Currently we only have one known option... if (!strcmp(name, "ci")) { if (WE_INITIATE_CONNECTION) { // The far end just told us what level of image compression // to use. compressImages = atoi(value); if (!silent) { COUT << "using image compression level " << compressImages << ENDL; } } else { CERR << "image compression option from initiating side" " ignored" << ENDL; } } else { CERR << "unknown remote option: " << name << " = " << value << ENDL; return -1; } name = strtok(NULL, "="); } return 0; } dxpc-3.9.2/constants.H0000644000175000017530000000306311245651605014206 0ustar kvigorkvigor#ifndef Constants_H # define Constants_H // dxpc version number static const unsigned int DXPC_VERSION_MAJOR = 3; static const unsigned int DXPC_VERSION_MINOR = 9; static const unsigned int DXPC_VERSION_PATCH = 2; static const unsigned int DXPC_VERSION_BETA = 0; // zero if not beta // Maximum number of X connections supported static const unsigned int MAX_CONNECTIONS = 256; // TCP port on which server proxy listens for connections from // client proxy static const unsigned int DEFAULT_PROXY_PORT = 4000; // X display number that client proxy imitates static const unsigned int DEFAULT_DISPLAY_NUM = 8; // Default image compression level. static const int DEFAULT_IMAGE_COMPRESSION_LEVEL = 9; // Bit masks to select the lower 'i' bits of an int, 0 <= 'i' <= 32 extern const unsigned int PARTIAL_INT_MASK[33]; // Maximum number of points in a FillPoly request that are given // their own history caches static const unsigned int FILL_POLY_MAX_POINTS = 10; // Sizes of optional fields for ConfigureWindow request extern const unsigned int CONFIGUREWINDOW_FIELD_WIDTH[7]; // Sizes of optional fields for CreateGC request extern const unsigned int CREATEGC_FIELD_WIDTH[23]; // Mapping to reverse the bits in a byte, for image processing on // little-endian architectures: extern unsigned char REVERSED_BYTE[256]; // Min width/height ratio for treatment of a bitmap image as a line of // bitmapped text static const unsigned int PUT_IMAGE_MIN_ASPECT_RATIO = 8; // Return the license/copyright info string. extern const char *getLicenseInfo(); #endif /* Constants_H */ dxpc-3.9.2/CHANGES0000644000175000017530000003740511245651702013061 0ustar kvigorkvigordxpc Change Log This is dxpc version 3.9.2 3.9.2 Release: Improved pidfile handling code contributed by jay Berkenbilt. 3.9.1 Release: Fix assertion failure on 64-bit architectures using LZO 2.0+. Clean up harmless compiler warnings in ClientMultiplexer and ServerMultiplexer. 3.9.0 Release: Re-implemented EncodeBuffer/DecodeBuffer to use considerably less CPU and very slightly improve compression. Builds with LZO 2.0 release. Compiles under the Mingw environment to create native Win32 binaries. Added dxpcssh sample script courtesy of Wicher Minnaard. Added dxpc.spec file contributed by Daniel Mealha Cabrita. Fixed some small memory leaks and potential buffer overruns. Indented all sources. 3.8.2 Release: Made configure script check for or and use whichever is available, which enables building with gcc 3.2; minor cleanups to configure script. 3.8.1 Release: Patched to compile properly on Digital Unix (workaround for buggy DEC compiler). Cleaned up various signed/unsigned and similar errors; now compiles cleanly with "gcc -ansi -pedantic -Wall". Added -b option to force backing store; originally by Ken Raeburn, integrated with 3.8.0 by Albert Ting. Changed license to BSD license. 3.8.0 Release: Minor syntax fixes: string constant was split over a line in main.C (non-gcc compilers don't like this); added #include stdlib.h to EncodeBuffer.C; removed unnecessary virtual attribute from Compresser::compressBuffer and Decompresser::decompressBuffer; made FILL_POLY_MAX_POINTS unsigned to get rid of some signed/unsigned mismatches; updated copyright notice and man page. Beta 4: Performance optimizations in EncodeBuffer and in the EncodeBuffer/Compresser and DecodeBuffer/Decompresser interfaces. Removed (#if'd out) unused EncodeBuffer::encodeByte method. Initialize ServerChannel::decompresser to NULL when -i0 flag is used to disable image compression (fixes segfault problem when using -i0). Beta 3: configure script now supports --with-lzo-lib option to specify path to LZO library (in case it is in a non-standard location). Updated usage command, which was sorely out of date. Added -D option to specify display on server side; takes precedence over the DISPLAY evironment variable. Added proxy port to lock file name, making it possible to run multiple processes on the same unit on different proxy ports. Changed default image compression level to 999. Beta 2.1: Now compiles under Cygwin32 environment for Windows 95/NT targets. No other changes. Beta 2: Added X_GetAtomName fix proposed by Ken Raeburn . Now works properly with emacs 20.3. See source level changes section below for details. configure script works on machines with broken cc (like Solaris-x86), tests for lzo library, and detects DXPC_ACCEPT_IS_SIZE_T more reliably. Beta 1: This release consists of dxpc-3.7.0 with support for LZO bitmap image compression hacked in. This significantly helps bitmap-happy applications such as Netscape. Two fixes contributed by Alexander Elkins (aoe@fc.hp.com) are also included; see source level changes section below for details. This has currently been tested on Solaris-x86 and FreeBSD platforms; ymmv. dxpc-3.8.0 is not backward compatible with any previous version. User level changes: dxpc now accepts the new option -i[n] for image compression. [n] is the image compression level; higher levels offer better compression at the cost of greater CPU and memory utilization (mostly on the client proxy). Valid values for [n] are: 0 : No compression (except for the very limited compression supported in 3.7.0). In other words, behaves like 3.7.0 (but is still incompatible with it...) 1 : LZO lzo1x_1 compression; very fast, low CPU and memory use, reasonable compression. This is the default and recommended value. 2-9: LZO lzo1c_... variant compression algorithms. lzo1c_2 actually seems to be worse than lzo1x_1... 99: LZO lzo1c_99 algorithm. Slow, but pretty good compression. NB: I have seen a couple of unexplained crashes when using this level. Not recommended. 999: LZO lzo1x_999 compression. Slow (but fast enough to feed a 128K ISDN link when hosted on a Pentium II/300 without maxing out the processor), but good compression. I recommend -i999 for most applications unless you have a very slow CPU; you are welcome to experiment with the other variants, but they are mostly there for experimental purposes. NB: the -i parameter is only valid on the dxpc instance which is accepting the connection. This is usually the client proxy, but the -w flag changes it to the server proxy. This proxy will communicate the compression level to the other end at startup, eliminating problems with differing compression levels. Source level changes: Building dxpc now requires the lzo compression libraries, available from http://wildsau.idv.uni-linz.ac.at/mfx/lzo.html. The passing of the -i option is handled by tacking a parameter on after the version number sent at startup. Note that despite the comment to the contrary in the code, this is only sent one way, from the proxy accepting the connection to the initiator. Compression is indicated in the stream by a 1-bit compression indicator sent following the compressed X_PutImage parameters and preceding the bitmap data. Note that is present even with -i0, so dxpc 3.8.0 with the -i0 flag is actually (very slightly) worse than dxpc-3.7.0. Files changed: Compresser.[CH] : new files; client proxy support for compressing X_PutImage messages; Cygwin32 hackery. Decompresser.[CH] : new files; server proxy support for decompressing X_PutImage messages; Cygwin32 hackery. main.C: : Handle new -i command line option; clean up -w support slightly; Cygwin32 hackery. ClientChannel.C : create and call Compresser instance if necessary; Alexander Elkins fix #1; Cygwin32 hackery. ServerChannel.C : create and call Decompresser instance if necessary; Alexander Elkins fix #1; Ken Raeburn fix; Cygwin32 hackery. Constants.H : bump version number. SequenceNumQueue.C : Alexander Elkins fix #2. Xproto-cygwin.h : new file; hacked up version of X11R5 Xproto.H required for building under Cygwin32 environment. configure.in : added AC_LANG_CPLUSPLUS to prevent failure on machines with broken cc (Solaris x86); added tests for lzo library; fixed ugly hack for determining size of accept()'s third parameter (thanks to Jim Meyering); added test for Cygwin32. Note: if I was a really good OO designer type guy, I would have created a CompressionFactory class that instantiated the Compresser and Decompresser instances appropiately. Since I am lazy and don't forsee extending this to include other compression algorithms, this is left as an exercise for the reader. Fix descriptions from Alexander Elkins (diffs refer to release 3.7.0): Fix #1: These are context diffs showing a fix to set scanlinePad_ in the ClientChannel and ServerChannel classes to the correct value which is received in byte 33 not byte 32 of the X server's first reply. The symptom of this defect is that the data sent by the PutImage request is invalid and the lower portion of the image displayed looks like white noise. This was initially observed to occur when displaying the xv X client through dxpc to WRQ's Reflection X server running on an NT Workstation for which bitmap-format-scanline-unit is 8 and bitmap-format-scanline-pad is 32. The defect did not manifest itself on HPUX Workstations for which bitmap-format-scanline-unit is 32 and bitmap-format-scanline-pad is 32. -> diff -C 3 dxpc-3.7.0/old/ClientChannel.C dxpc-3.7.0/new/ClientChannel.C *** dxpc-3.7.0/old/ClientChannel.C Fri Jun 13 20:36:02 1997 --- dxpc-3.7.0/new/ClientChannel.C Thu Oct 22 14:24:09 1998 *************** *** 1444,1450 **** imageByteOrder_ = outputMessage[30]; bitmapBitOrder_ = outputMessage[31]; scanlineUnit_ = outputMessage[32]; ! scanlinePad_ = outputMessage[32]; firstReply_ = 0; } else --- 1444,1450 ---- imageByteOrder_ = outputMessage[30]; bitmapBitOrder_ = outputMessage[31]; scanlineUnit_ = outputMessage[32]; ! scanlinePad_ = outputMessage[33]; firstReply_ = 0; } else -> diff -C 3 dxpc-3.7.0/old/ServerChannel.C dxpc-3.7.0/new/ServerChannel.C *** dxpc-3.7.0/old/ServerChannel.C Fri Aug 29 17:40:37 1997 --- dxpc-3.7.0/new/ServerChannel.C Thu Oct 22 14:24:34 1998 *************** *** 75,81 **** imageByteOrder_ = buffer[30]; bitmapBitOrder_ = buffer[31]; scanlineUnit_ = buffer[32]; ! scanlinePad_ = buffer[32]; firstReply_ = 0; encodeBuffer.encodeValue((unsigned int) buffer[0], 8); encodeBuffer.encodeValue((unsigned int) buffer[1], 8); --- 75,81 ---- imageByteOrder_ = buffer[30]; bitmapBitOrder_ = buffer[31]; scanlineUnit_ = buffer[32]; ! scanlinePad_ = buffer[33]; firstReply_ = 0; encodeBuffer.encodeValue((unsigned int) buffer[0], 8); encodeBuffer.encodeValue((unsigned int) buffer[1], 8); Fix #2: This is a context diff showing a fix for the push function in the SequenceNumQueue class. When the is queue expanded, the old entries were improperly copied to the new memory space resulting in reply sequence numbers not being found in the queue. Sometimes dxpc would crash, sometimes it would abort, always killing the X server as well. We saw this happen when a large number of XAllocColor requests were sent. -> diff -C 3 dxpc3.7.0/old/SequenceNumQueue.C dxpc3.7.0/new/SequenceNumQueue.C *** dxpc3.7.0/old/old/SequenceNumQueue.C Tue Oct 20 16:28:05 1998 --- dxpc3.7.0/old/new/SequenceNumQueue.C Tue Oct 20 16:28:17 1998 *************** *** 39,45 **** for (int i = startIndex_; (unsigned int) i < length_; i++) newQueue[i - startIndex_] = queue_[i]; for (int i1 = 0; (unsigned int) i1 < startIndex_; i1++) ! newQueue[i1 + startIndex_] = queue_[i1]; delete[]queue_; queue_ = newQueue; startIndex_ = 0; --- 39,45 ---- for (int i = startIndex_; (unsigned int) i < length_; i++) newQueue[i - startIndex_] = queue_[i]; for (int i1 = 0; (unsigned int) i1 < startIndex_; i1++) ! newQueue[i1 + length_ - startIndex_] = queue_[i1]; delete[]queue_; queue_ = newQueue; startIndex_ = 0; Fix description from Ken Raeburn (diffs refer to version 3.7.0): To: dxpc@mcfeeley.cc.utexas.edu Cc: "Albert L. Ting" , Roderick Schertler Subject: Re: DXPC and Emacs 20.3 References: <18362.905628421@eeyore.ibcinc.com> <13818.52242.39296.479928@lamb.artisan.com> <19972.905636479@eeyore.ibcinc.com> From: Ken Raeburn Date: 07 Oct 1998 15:55:16 -0400 In-Reply-To: Roderick Schertler's message of "Sat, 12 Sep 1998 17:41:19 -0400" Message-ID: Lines: 116 X-Mailer: Gnus v5.6.27/Emacs 19.34 Reply-To: dxpc@mcfeeley.cc.utexas.edu Sender: owner-dxpc@mcfeeley.cc.utexas.edu X-Listprocessor-Version: 8.2.07 -- ListProc(tm) by CREN I didn't see any followup mail on this on the dxpc list (maybe I accidentally deleted something, but I didn't see any list archive mentioned on the web site), and I was kinda bored last night, so I looked into it. With the test program included in Roderick's message, I didn't get an empty string, I got a truncated font name, only 16 characters when it should've been 63. That certainly seems like a dxpc bug. The patch below seems to fix that. The 2-byte "name length" that was being read from the GetAtomName reply was being used as the number of bytes, but offset 4 has a 4-byte count of words (name plus padding, so divide by 4 rounding up), not a 2-byte count of bytes. If the byte orders were different, the result could well be a zero, explaining the empty string. I don't know what the emacs patch was, but if it was checking for 0-length font names, it may not be adequate, depending on how the name is used after that. You may be getting non-unique prefixes back instead. IMHO the right fix may be to request the name of some atom that emacs has interned, and die with an error if it's not correct, maybe referring the user to docs in the source tree for fixing this bug. Unless emacs never actually needs to know the font names, in which case it should never ask. So now this test program runs okay for me (atom name is -Misc-Fixed-Medium-R-SemiCondensed--13-120-75-75-C-60-ISO8859-1), and emacs-20.3 properly fetches three font names, but then emacs seems to hang for me. Without dxpc, everything's okay. I have some "xmon" dumps I'll start looking over, of emacs-20.3-with-dxpc and emacs-20.3-without-dxpc and emacs-20.2-with-dxpc, to see how they differ, unless someone has good ideas where to start. As far as I can tell from the 20.3+dxpc dump alone, Emacs seems to think it's mapped its windows and written text into them, but the X server and/or window manager don't see it that way. I've seen the MapWindow requests etc, but the window doesn't appear, and the window manager hasn't even created a frame window to act as parent to the emacs window. --- ServerChannel.C~ Sat Aug 22 01:44:50 1998 +++ ServerChannel.C Wed Oct 7 05:50:16 1998 @@ -144,7 +144,7 @@ break; case X_GetAtomName: { - unsigned int nameLength = GetUINT(buffer + 4, bigEndian_); + unsigned int nameLength = GetUINT(buffer + 8, bigEndian_); encodeBuffer.encodeValue(nameLength, 16, 6); const unsigned char *nextSrc = buffer + 32; clientCache_.internAtomTextCompressor.reset(); 8/18/1999, Kevin Vigor (kvigor@ascend.com) 3.7.0 (Septmber 7, 1997) Added compression for CloseFont, ConvertSelection, CreateNotify, DeleteProperty, FreeColors, FreeCursor, GetAtomName, ListFonts, ReparentNotify, SelectionClear, SelectionRequest, and QueryBestSize messages Improved compression slightly for ChangeGC, CreateGC, CreateWindow, ConfigureWindow, and FillPoly requests Improved the text compression slightly (lengthened the context for next-character prediction, added logic to use 1st-order predictive model if 3rd-order model hasn't been built yet (helps improve prediction during startup)) Added detection of the "accept requires a size_t third arg" OSes in the autoconf configure script (using the original logic from dxpc-3.3.0) Fixed a bug in ServerCache.C that was introduced in 3.6.1 (which was a beta only release). 3.6.0 (May 26, 1997) Improved compression for various X messages: - PolyFillRectangle - AllocNamedColor - LookupColor - KeyPress - KeyRelease - ButtonPress - ButtonRelease 3.5.0 (February 27, 1997) Changed checking of version numbers so that it prints out both numbers (local and remote) to aid in resolving version problems. Added ability to fork and run as a daemon process (-f cmdline option). (Thanks to Brian Williams (epabcw@epa.ericsson.se) for the idea. Added ability to have the client initiate the connection to the server. Also, -k cmdline option will search for a daemonized dxpc and send it SIGTERM. Many documentation fixes related to changes implemented in 3.3.1 (an unreleased version, whose changes didn't make it into the docs for 3.4.0). dxpc got a mailing list! To subscribe, send a message with a blank subject to listproc@mcfeeley.cc.utexas.edu with the words sub dxpc yourfirstname yourlastname in the body of the message. 3.4.0 (November 14, 1996) New maintainer: Zachary Vonler (lightborn@mail.utexas.edu) dxpc now has a home page: http://ccwf.cc.utexas.edu/~zvonler/dxpc/ Implemented exchange of version numbers when connection between client and server is first established so that in the future people won't have problems trying to run incompatible versions. Server and client switched cmdline args, so that the client needs no parameters, and the server needs the hostname of the remote machine. No change history is available for versions prior to 3.4.0. dxpc-3.9.2/README0000644000175000017530000005010511245652035012736 0ustar kvigorkvigorCopyright (c) 1995,1996 Brian Pane Copyright (c) 1996,1997 Zachary Vonler and Brian Pane Copyright (c) 1999-2009 Kevin Vigor and Brian Pane All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. dxpc - a Differential X Protocol Compressor home page: http://www.vigor.nu/dxpc/ Version 3.9.2 August 27, 2009 0. WHAT'S NEW IN RELEASE 3.9.2 =========================== See file CHANGES for changelog. Please note that this release is NOT compatible with any release of dxpc prior to 3.9.0, and is compatible with all previous 3.9.x releases. 1. INTRODUCTION TO DXPC ==================== dxpc is an X protocol compressor designed to improve the speed of X11 applications run over low-bandwidth links (such as dialup PPP connections). dxpc consists of two processes: 1. a Client Proxy that runs on the "remote" machine (the machine where the X clients are running) 2. a Server Proxy that runs on the "local" machine (the machine where the X server is running) (Starting in the dxpc-3.0, release, the Client Proxy and Server Proxy are instances of the same program, called "dxpc"; command-line arguments tell the program whether it is acting as a Client Proxy or a Server Proxy.) The Client Proxy mimics an X server. X client applications connect to the Client Proxy using display "unix:8" (or ":8"; dxpc supports both UNIX domain and TCP sockets). The Client Proxy receives X requests from the application, compresses them, and sends them to the Server Proxy. The Server Proxy uncompresses the requests and sends them to the real X server. Similarly, the Server Proxy receives X events, replies, and errors from the real X server. It compresses these messages and sends them to the Client Proxy, which uncompresses them and sends them to the client application. dxpc attempts to exploit patterns in X protocol messages to limit the amount of data sent between the Client Proxy and Server Proxy. For many X message types, each field has a high probability of having the same value as it had in some previous message of the the same type. For such fields, dxpc maintains caches of the last 'n' values, with a least-recently-used replacement policy. If a field value in a new message is already present in the corresponding cache, dxpc transmits the value's index within the cache rather than the value itself. Because the number of bits needed to represent this index is typically much smaller than the number of bits needed to represent the value itself, transmission of cache indices typically results in a significant reduction in the number of bytes transmitted over the low-bandwidth link. In other cases, the value of a field in an X message may differ from that field's value in the last message of the same type by a small value. Some X messages contain sequence numbers or timestamps that have this property. X requests that create new objects also tend to have this property; in a "Create Window" request, for example, the value of the "Window ID" being created is typically equal to "(Window ID of the last window created) + (some small positive integer)." For fields like these, dxpc transmits the difference between the field value in the new message and the value of the corresponding field in the previous message of the same type. This value usually is a small number that can be encoded in far fewer bits than the actual field value. 2. BUILDING DXPC ============= See the file INSTALL in the dxpc distribution for instructions on building and installing dxpc. 3. RUNNING DXPC ============ On the machine where the X clients are located, set DISPLAY to point to the X server (e.g., "homepc:0.0") and run: dxpc [-p ] [-d ] [-u] [-t] [-s(1|2)] [-v] [-f|-k] On the machine where the X server is located, set DISPLAY to point to your real X server (e.g., "unix:0") and run: dxpc [-p ] [-f|-k] [-s(1|2)] [-v] where is the hostname or IP address of the machine where the dxpc Client Proxy is running. (The presence of the argument tells dxpc to act as a Server Proxy. Without this argument, it is a Client Proxy.) The Client Proxy normally listens on TCP port 4000. If you need to use some different port, you can specify the port number by using the -p option for both the Client Proxy and the Server Proxy. Also, the Client Proxy normally mimics display unix:8 (and :8). If you need to use a display number other than 8, you can use the -d option. If the -u option is used, dxpc mimics only :8, not unix:8. If the -t option is used, dxpc mimics only unix:8, not :8. The "-s1" and "-s2" options enable the reporting of compression ratio statistics. See the section on "COMPRESSION STATISTICS" below for details. The "-v" option causes dxpc to display its version number and exit. The two communicating instances of dxpc must have the same version number. The "-f" option tells dxpc to fork immediately and run as a daemon process to facilitate starting it in scripts. This option also suppresses all non-error output. The "-k" option finds a running daemonized dxpc and kills it. 4. RUNNING APPLICATIONS ==================== Once the Client Proxy and Server Proxy are running, set the $DISPLAY to unix:8 (or .8 for clients that aren't running on the same machine as the Client Proxy) and then just run X client applications as you normally would. 5. DXPC AND XAUTH ============== If you use X authorization, with a .Xauthority file on the workstation where your real X server runs, you'll need to set up a .Xauthority file on the host where Client Proxy runs. One way to do this is: 1. Copy your ~/.Xauthority file from the host where the real X server runs to the host where the Client Proxy runs. 2. Run xauth list to see the authorization keys. There should be one for your real X display. It will look something like this: /unix:0 MIT-MAGIC-COOKIE-1 3. On the host where the Client Proxy is located, add a new entry to the .Xauthority file with the display name of the fake X server (the DISPLAY where the Client Proxy is listening) and all of the other values from the entry for the real X display. The xauth "add" command can be used, like this: xauth add /unix:8 MIT-MAGIC-COOKIE-1 where is the name of the host where the Client Proxy is running and has the same value as the obtained for the real X display in step 2. Once you do this, you should be able to run X clients through dxpc successfully. Bruce Mah has kindly contributed a pair of programs to automate this setup. [DISCLAIMER: This is unsupported software, so please don't send him too much nasty email if it doesn't work on your system configuration.] The first program, rxauth, copies the .Xauthority data from one host to another. The second, xauthcp, adds a new entry to the .Xauthority file with the same protocol (MIT-MAGIC-COOKIE-1 or whatever) and hex key string as an existing entry. The usage is something like this (where "home-pc" is the host where the real X server and Server Proxy run and proxy-ws is the host where the Client Proxy runs): home-pc% rxauth proxy-ws proxy-ws% xauthcp home-pc/unix:0 proxy-ws/unix:8 proxy-ws% xauthcp home-pc/unix:0 proxy-ws:8 The first command in this example copies the .Xauthority records from home-pc to proxy-ws. The second command updates the .Xauthority file on proxy-ws to include a new security key for display unix:8 (the UNIX domain pipe used by the Client Proxy). The third command updates the .Xauthority file on proxy-ws to include a new security key for display proxy-ws:8 (the TCP port used by the Client Proxy). ----- #!/bin/csh -f # # rxauth # Bruce A. Mah # # Copy xauth keys from one .Xauthority file to another. Assumes # that the target machine has .rhosts equivalence with the the # machine on which this command is executed. # set localdisplay=`/bin/hostname`:0 set remotehost=$1 echo Sending keys for $localdisplay to $remotehost ... xauth nextract - $localdisplay | rsh $remotehost xauth nmerge - echo Done. ----- #!/bin/csh -f # # xauthcp # Bruce A. Mah # # Copy xauth keys used to access one display to another. This ability # is primarily useful when using a proxy X server. In such a situation, # client processes need to access the proxy using the xauth keys of the # real server (assuming the proxy takes no explicit actions to deal # with xauth keys). # if (argc == 3) then echo "$0 source-display dest-display" endif set src=$1 set dst=$2 set tmpfile=/tmp/xauthcp.$$ rm -f $tmpfile xauth list $src | \ awk -v dst=$dst '{ print "xauth add", dst, $2, $3, "; "}' > $tmpfile source $tmpfile rm -f $tmpfile ----- For folks who don't have or don't like csh, here are versions of rxauth and xauthcp that use sh, thanks to Dirk Eddelb"uttel . ----- #!/bin/sh # # rxauth # Bruce A. Mah # # 12 Jul 96 edd@qed.econ.queensu.ca Rewritten as a (ba)sh script # # Copy xauth keys from one .Xauthority file to another. Assumes # that the target machine has .rhosts equivalence with the the # machine on which this command is executed. if [ $# -ne 2 ] then echo $0 remotehost exit -1 fi localdisplay=`/bin/hostname`:0 remotehost=$1 echo Sending keys for $localdisplay to $remotehost ... xauth nextract - $localdisplay | rsh $remotehost /usr/bin/X11/xauth nmerge - echo Done. ----- #!/bin/sh # # xauthcp # Bruce A. Mah # # 12 Jul 96 edd@qed.econ.queensu.ca Rewritten as a (ba)sh script # # Copy xauth keys used to access one display to another. This ability # is primarily useful when using a proxy X server. In such a situation, # client processes need to access the proxy using the xauth keys of the # real server (assuming the proxy takes no explicit actions to deal # with xauth keys). if [ $# -ne 2 ] then echo $0 source-display dest-display exit -1 fi src=$1 dst=$2 tmpfile=/tmp/xauthcp.$$ rm -f $tmpfile xauth list $src | \ awk -v dst=$dst '{ print "xauth add", dst, $2, $3, "; "}' > $tmpfile source $tmpfile rm -f $tmpfile ----- 6. COMPRESSION STATISTICS ====================== The -s option can be used to show compression statistics for an X client when the X client terminates. Use -s1 to get a short report like this: ** dxpc Server-side Compression statistics ** Overall compression: 1551744 bits compressed to 228043 (6.80461:1 compression ratio) The report printed by the Client Proxy shows the compression of the X messages sent by the X client application, and the report printed by the the Server Proxy shows the compression of the messages sent by the X server. Use -s2 for a longer report that shows the compression for each message type, like this: ** dxpc Client-side Compression statistics ** Compression of requests by message type: msg bits bits compression type count in out ratio ---- ----- ----- ----- ----------- 1 61 26240 4019 6.52899:1 2 200 25600 2780 9.20863:1 3 122 7808 600 13.0133:1 4 10 640 162 3.95062:1 8 68 4352 454 9.5859:1 [...] 110 4 128 114 1.12281:1 119 2 64 22 2.90909:1 127 29 928 87 10.6667:1 7096 bits used for dxpc message framing and multiplexing Overall compression: 931040 bits compressed to 218506 (4.26094:1 compression ratio) The "-s2" report can be used as a profile to show what message types contribute the most bits to the total X protocol traffic. (See O'Reilley's "X Protocol Reference" (Volume 0) for details on the messages in the X protocol.) Notes: - The "-s2" option is really a "hacker's option." Basically, if you find yourself saying, "I wonder how effective dxpc's compression of X_PolyFillRectangle requests is," then you should use "-s2"; otherwise, you should use "-s1." - The -s2 report for dpxc_server shows the compression of X server reply messages broken down by request type. (Previous version of dxpc just grouped all replies together under message type = 1.) The "message type" column for each request message type shows the message type of the X client request that caused the X server to generate the reply. For some X replies, either those that are part of X extensions or those in the core protocol for which dxpc doesn't have any special compression code, dxpc doesn't know the request type; the statistics for these replies are grouped under message type "other" at the end of the reply report. - In dxpc-3.0, the Client Proxy and Server Proxy communicate over a single TCP connection. The compressed X messages for many X connections are multiplexed into this single TCP connection. dxpc must transmit some framing bytes and control messages over this channel to manage this multiplexing. This overhead is reported in the " bits used for dxpc message framing and multiplexing" message near the end of the "-s2" report. The number of framing bits is used in the computation of the overall compression ratio to provide an accurate measure of dxpc's real compression ratio. - There are sometimes message types for which the compression ratio is slightly less than 1:1 or slightly greater than 1:1. These generally are message types for which dxpc doesn't do any special compression, either because they don't contribute enough bits to the total X traffic to be worth compressing or because I just haven't had time to write compression code for them yet. In prior versions of dxpc, the compression ratio for such messages would appear as 1:1. Due to the more complex encodings used in dxpc-2.0 and later, the message transmitted between the dxpc proxies will typically be a few bits shorter or a few bits longer than the original X message, so the compression ratio is some value close to 1:1. 7. VERSION NOTES ============= Version 3.6.0 of dxpc is not compatible with prior versions of dxpc (the change in the second component of the version number indicates a protocol change). Thus you must use dxpc-3.6.x on both ends of the link. 8. ACKNOWLEDGMENTS =============== The HBX and FHBX systems (http://www.cs.dartmouth.edu/~jmd/decs/DECSpage.html) have had a significant influence on the design of several of the compression improvements implemented in versions 0.4, 0.9.x, 1.0, and 2.0 of dxpc. Thanks to all of the users of dxpc who have contributed feedback and suggestions. 9. AUTHOR ====== dxpc-0.1 through dxpc-3.3.1 by Brian Pane (current address: brianp@cnet.com) dxpc-3.4.0 through dxpc-3.5.0 by Zachary Vonler (lightborn@mail.utexas.edu) dxpc-3.6.0 by Brian Pane 10. FREQUENTLY ASKED QUESTIONS ========================== Q: How much of a speedup will I see if I use dxpc? A: It depends heavily upon what types of applications you run. With dxpc-3.x, compression ratios for many application are between 3:1 and 6:1. The performance of programs like xterm, xemacs, and exmh is what I would consider "comfortably usable" with dxpc over a 28.8Kb/s PPP link. FrameMaker is only "uncomfortably usable" at 28.8Kb/s. Applications whose X traffic consists mostly of graphics images, like xv or Netscape, will achieve more modest speedups from dxpc, since the implementation of color image compression in dxpc is fairly unsophisticated. Note also that an n:1 compression of the X traffic doesn't mean that your applications will run 'n' times as fast; the PPP framing bytes and compressed IP and TCP headers impose an upper bound on the speedup that can be achieved. Q. Will dxpc work on machine X running operating system Y? A: Probably, if Y is some variant of UNIX and sizeof(int)>=32. I've received reports of people running dxpc successfully on LINUX, NetBSD, SunOS4, SunOS5 (Solaris 2), HP-UX, IRIX, Digital UNIX, Ultrix, AIX, UnixWare, and even OS/2. Q: Why won't dxpc compile? It says it can't find "iostream.h" A: This typically means that your C++ compiler is configured wrong or is missing its supporting libraries. For g++, go FTP the latest versions of the compiler and libraries. For a commercial compiler, check the documentation. Q: Why does dxpc crash immediately when I run it on Linux? A: Some people seem to have bad versions of libc on their Linux systems, such that gethostbyname(2) crashes. The fix for this problem is to upgrade to stable versions of libc and the kernel that work together. Q: Why won't dxpc run? A: Make sure the right programs are running on the right machines with the right arguments: * The Server Proxy (dxpc with the argument) should be running on the system where your real X server is (e.g., your LINUX system at home). * The Client Proxy (dxpc with no argument) should be running on the system where the X client applications are, or on a system with a fast network connection to the hosts where the client applications are (e.g., your workstation at work or school). * When you run the Server Proxy, make sure that $DISPLAY is set to point to the real X server (e.g., "unix:0"). * When you run the Server Proxy, make sure that the hostname or IP addr that you specify on the command line is that of the system where the Client Proxy is running. * When you run X applications, make sure that $DISPLAY is set to point to the Client Proxy (e.g., "unix:8" for an X application on the same hosts as Client Proxy, or ":8" for X applications running on other hosts). * You usually don't need to bother with the "-p" option, unless some other application is already using port 4000 on either end of the link. If you need to use this option, make sure that you use the same argument for "-p" for both dxpc_client and dxpc_server. Also, if your X server uses xauth-style authorization, check out the "dxpc and xauth" section above. If none of the above checks yields a solution, send me some email. Q: I used to be able to run a dxpc_server on my home machine and an instance of dxpc_client on each remote machine where I needed to run X programs. Ever since dxpc-3.0, though, it only lets me run a single instance of the remote Client Proxy per Server Proxy. How am I supposed to run X applications on multiple remote machines? A: Pick one remote machine and run the dxpc Client Proxy on it. On this host, set the display to unix:8. On all of the other remote machines, set the display to :8, where is the machine where you put the Client Proxy. This allows all of your remote X applications to enjoy the benefits of the shared font caches in the Client Proxy (a feature added in 3.0). dxpc-3.9.2/constants.C0000644000175000017530000001460711245652246014211 0ustar kvigorkvigor#include "constants.H" const char copyright[] = "Copyright (c) 1995,1996 Brian Pane\n\ Copyright (c) 1996,1997 Zachary Vonler and Brian Pane\n\ Copyright (c) 1999-2009 Kevin Vigor and Brian Pane\n\ All rights reserved.\n\ \n\ Redistribution and use in source and binary forms, with or without\n\ modification, are permitted provided that the following conditions are met:\n\ \n\ * Redistributions of source code must retain the above copyright\n\ notice, this list of conditions and the following disclaimer.\n\ \n\ * Redistributions in binary form must reproduce the above copyright\n\ notice, this list of conditions and the following disclaimer in the\n\ documentation and/or other materials provided with the distribution.\n\ \n\ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND\n\ CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES,\n\ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\n\ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n\ DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS\n\ BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n\ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n\ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n\ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n\ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n\ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR\n\ OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n\ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH\n\ DAMAGE."; // Make sure that both "source and binary forms" of any dxpc distribution // bear the copyright and liability disclaimer specified in the README. // (Call this function from some other .C file to ensure that the // "copyright" string literal ends up in the resulting binary const char *getLicenseInfo() { return copyright; } const unsigned int PARTIAL_INT_MASK[33] = { 0x00000000, 0x00000001, 0x00000003, 0x00000007, 0x0000000f, 0x0000001f, 0x0000003f, 0x0000007f, 0x000000ff, 0x000001ff, 0x000003ff, 0x000007ff, 0x00000fff, 0x00001fff, 0x00003fff, 0x00007fff, 0x0000ffff, 0x0001ffff, 0x0003ffff, 0x0007ffff, 0x000fffff, 0x001fffff, 0x003fffff, 0x007fffff, 0x00ffffff, 0x01ffffff, 0x03ffffff, 0x07ffffff, 0x0fffffff, 0x1fffffff, 0x3fffffff, 0x7fffffff, 0xffffffff }; const unsigned int CONFIGUREWINDOW_FIELD_WIDTH[7] = { 16, // x 16, // y 16, // width 16, // height 16, // border width 29, // sibling window 3 // stack mode }; const unsigned int CREATEGC_FIELD_WIDTH[23] = { 4, // function 32, // plane mask 32, // foreground 32, // background 16, // line width 2, // line style 2, // cap style 2, // join style 2, // fill style 1, // fill rule 29, // tile 29, // stipple 16, // tile/stipple x origin 16, // tile/stipple y origin 29, // font 1, // subwindow mode 1, // graphics exposures 16, // clip x origin 16, // clip y origin 29, // clip mask 16, // card offset 8, // dashes 1, // arc mode }; unsigned char REVERSED_BYTE[256] = { 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0, 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8, 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8, 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4, 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4, 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec, 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc, 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2, 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2, 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea, 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa, 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6, 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6, 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee, 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe, 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1, 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1, 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9, 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9, 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5, 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5, 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed, 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd, 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3, 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3, 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb, 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb, 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7, 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7, 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef, 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff };