From 41ea54b0217175a4b78980671f4c6818eb66b166 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Wed, 26 Apr 2017 13:26:47 +0200 Subject: nxproxy: Switch to autoreconf. This also solves the last remnant of overlinking as described in GH issue #133. Fixes ArcticaProject/nx-libs#133. --- nxproxy/.gitignore | 22 ++++- nxproxy/Main.c | 120 ------------------------ nxproxy/Makefile.am | 17 ++++ nxproxy/Makefile.in | 112 ----------------------- nxproxy/configure.ac | 32 +++++++ nxproxy/configure.in | 186 ------------------------------------- nxproxy/install-sh | 238 ------------------------------------------------ nxproxy/m4/nx-macros.m4 | 1 + nxproxy/man/Makefile.am | 5 + nxproxy/mkinstalldirs | 34 ------- nxproxy/src/Main.c | 120 ++++++++++++++++++++++++ nxproxy/src/Makefile.am | 17 ++++ 12 files changed, 213 insertions(+), 691 deletions(-) delete mode 100644 nxproxy/Main.c create mode 100644 nxproxy/Makefile.am delete mode 100644 nxproxy/Makefile.in create mode 100644 nxproxy/configure.ac delete mode 100644 nxproxy/configure.in delete mode 100755 nxproxy/install-sh create mode 120000 nxproxy/m4/nx-macros.m4 create mode 100644 nxproxy/man/Makefile.am delete mode 100755 nxproxy/mkinstalldirs create mode 100644 nxproxy/src/Main.c create mode 100644 nxproxy/src/Makefile.am (limited to 'nxproxy') diff --git a/nxproxy/.gitignore b/nxproxy/.gitignore index 3d98254b2..6b771262b 100644 --- a/nxproxy/.gitignore +++ b/nxproxy/.gitignore @@ -1,2 +1,22 @@ Makefile -nxproxy +Makefile.in +aclocal.m4 +compile +config.guess +config.sub +depcomp +install-sh +ltmain.sh +missing +config.h +config.h.in +libtool +m4/libtool.m4 +m4/ltoptions.m4 +m4/ltsugar.m4 +m4/ltversion.m4 +m4/lt~obsolete.m4 +src/.deps/ +src/Makefile +src/Makefile.in +stamp-h1 diff --git a/nxproxy/Main.c b/nxproxy/Main.c deleted file mode 100644 index d9fb1ef4f..000000000 --- a/nxproxy/Main.c +++ /dev/null @@ -1,120 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */ -/* */ -/* NXPROXY, NX protocol compression and NX extensions to this software */ -/* are copyright of NoMachine. Redistribution and use of the present */ -/* software is allowed according to terms specified in the file LICENSE */ -/* which comes in the source distribution. */ -/* */ -/* Check http://www.nomachine.com/licensing.html for applicability. */ -/* */ -/* NX and NoMachine are trademarks of Medialogic S.p.A. */ -/* */ -/* All rigths reserved. */ -/* */ -/**************************************************************************/ - -#include -#include -#include -#include -#include -#include - -#include "NX.h" - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -extern const char *__progname; - -/* - * Entry point when running nxproxy stand-alone. - */ - -int main(int argc, const char **argv) -{ - int result = -1; - - char *options = NULL; - - char *nx_commfd_str = NULL; - - options = getenv("NX_DISPLAY"); - - if ((nx_commfd_str = getenv("NX_COMMFD")) != NULL) - { - errno = 0; - unsigned long int nx_commfd = strtoul(nx_commfd_str, NULL, 10); - - if ((errno) && (0 == nx_commfd)) - { - fprintf(stderr, "%s: NX_COMMFD environment variable's value [%s] is not a file descriptor number. " - "Aborting...\n", - __progname, nx_commfd_str - ); - NXTransCleanup(); - } - else if ((unsigned long int) INT_MAX < nx_commfd) - { - fprintf(stderr, "%s: NX_COMMFD environment variable's value [%lu] is out of range for a file descriptor number. " - "Aborting...\n", - __progname, nx_commfd); - NXTransCleanup(); - } - else { - result = NXTransCreate(nx_commfd, NX_MODE_SERVER, options); - - if (result != 1) - { - fprintf(stderr, "%s: NXTransCreate failed for FD#%lu\n" - "Aborting...", - __progname, nx_commfd); - NXTransCleanup(); - } - - } - - // go into endless loop - - if (result == 1) - { - while (NXTransRunning(NX_FD_ANY)) - result = NXTransContinue(NULL); - } - } - else - { - - if (NXTransParseCommandLine(argc, argv) < 0) - { - NXTransCleanup(); - } - - if (NXTransParseEnvironment(options, 0) < 0) - { - NXTransCleanup(); - } - - /* - * This should not return... - */ - - #ifdef TEST - fprintf(stderr, "%s: Yielding control to NX entry point.\n", __progname); - #endif - - result = NXTransProxy(NX_FD_ANY, NX_MODE_ANY, NX_DISPLAY_ANY); - } - - /* - * ...So these should not be called. - */ - - NXTransExit(result); - - return 0; -} diff --git a/nxproxy/Makefile.am b/nxproxy/Makefile.am new file mode 100644 index 000000000..87ca0cfad --- /dev/null +++ b/nxproxy/Makefile.am @@ -0,0 +1,17 @@ +SUBDIRS = src man + +MAINTAINERCLEANFILES = \ + $(srcdir)/autom4te.cache/* \ + $(srcdir)/build-aux/* \ + $(srcdir)/Makefile.in \ + $(srcdir)/man/Makefile.in \ + $(srcdir)/src/Makefile.in \ + $(srcdir)/aclocal.m4 \ + $(srcdir)/config.h.in \ + $(srcdir)/config.h.in~ \ + $(srcdir)/config.guess \ + $(srcdir)/config.sub \ + $(srcdir)/configure \ + $(NULL) + +DISTCLEANFILES=$(MAINTAINERCLEANFILES) \ No newline at end of file diff --git a/nxproxy/Makefile.in b/nxproxy/Makefile.in deleted file mode 100644 index 3a27cbd29..000000000 --- a/nxproxy/Makefile.in +++ /dev/null @@ -1,112 +0,0 @@ -# -# Get values from configure script. -# -VERSION=@VERSION@ -LIBVERSION=@LIBVERSION@ - -# -# Enable really all warnings. This, though, gives -# a warning due to pthread.h and unistd.h. -# -# -Wredundant-decls -# -CXX = @CXX@ -CXXFLAGS = @CXXFLAGS@ @X_CFLAGS@ @DEFS@ \ - -Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \ - -Wmissing-declarations -Wnested-externs - -CXXINCLUDES = -I. -I../nxcomp - -CC = @CC@ -CCFLAGS = $(CXXFLAGS) -CCINCLUDES = -I. -I../nxcomp -CCDEFINES = - -LDFLAGS = @LDFLAGS@ -LIBS = @LIBS@ - -# -# Only if THREADS is defined. -# -# LIBS = $(LIBS) -lpthread -# - -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@ -DESTDIR = -RM_FILE = rm -f - -# -# This should be autodetected. -# - -MAKEDEPEND = @MAKEDEPEND@ -DEPENDINCLUDES = -I/usr/include/g++ -I/usr/include/g++-3 - -.SUFFIXES: .cpp.c - -.cpp.o: - $(CXX) -c $(CXXFLAGS) $(CXXINCLUDES) $(CXXDEFINES) $< -.c.o: - $(CC) -c $(CCFLAGS) $(CCINCLUDES) $(CCDEFINES) $< - -PROGRAM = nxproxy - -all: depend $(PROGRAM) - -MSRC = Main.c - -CSRC = - -CXXSRC = - -MOBJ = $(MSRC:.c=.o) -COBJ = $(CSRC:.c=.o) -CXXOBJ = $(CXXSRC:.cpp=.o) - -$(PROGRAM): $(MOBJ) $(COBJ) $(CXXOBJ) - $(CXX) $(CXXFLAGS) -o $@ $(MOBJ) $(LDFLAGS) $(LIBS) - -depends: depend.status - -depend: depend.status - -depend.status: - if [ -n "$(MAKEDEPEND)" ] && [ -x "$(MAKEDEPEND)" ] ; then \ - $(MAKEDEPEND) $(CXXINCLUDES) $(CCINCLUDES) \ - $(DEPENDINCLUDES) -f Makefile $(MSRC) $(CSRC) $(CXXSRC) 2>/dev/null; \ - fi - touch depend.status - -install: install.bin install.man - -install.bin: $(PROGRAM) - $(srcdir)/mkinstalldirs $(DESTDIR)$(bindir) - $(INSTALL_PROGRAM) $(PROGRAM) $(DESTDIR)$(bindir)/$(PROGRAM) - -install.man: - $(srcdir)/mkinstalldirs $(DESTDIR)$(man1dir) - $(INSTALL_DATA) man/$(PROGRAM).1 $(DESTDIR)$(man1dir)/$(PROGRAM).1 - -uninstall: uninstall.bin uninstall.man - -uninstall.bin: - $(RM_FILE) $(DESTDIR)$(bindir)/$(PROGRAM) - -uninstall.man: - $(RM_FILE) $(DESTDIR)$(man1dir)/nxproxy.1 - -clean: - -rm -f *~ *.o *.bak st?????? core core.* *.out.* \ - $(PROGRAM) $(PROGRAM).exe $(LIBFULL) $(LIBLOAD) $(LIBSHARED) $(LIBARCHIVE) - -distclean: clean - -rm -rf autom4te.cache config.status config.log config.cache depend.status Makefile tags configure diff --git a/nxproxy/configure.ac b/nxproxy/configure.ac new file mode 100644 index 000000000..b233ff8e3 --- /dev/null +++ b/nxproxy/configure.ac @@ -0,0 +1,32 @@ +dnl *************************************************************************** +dnl *** configure.ac for nxproxy *** +dnl *************************************************************************** + +m4_define([nxproxy_version], m4_esyscmd([tr -d '\n' < VERSION])) + +# Initialize Autoconf +AC_PREREQ(2.60) + +AC_INIT([NX Proxy], [nxproxy_version], [https://github.com/ArcticaProject/nx-libs/issues]) +AC_CONFIG_AUX_DIR([build-aux]) +AC_PROG_CC +AC_CONFIG_SRCDIR([Makefile.am]) +AC_CONFIG_HEADERS([config.h]) +AC_CONFIG_MACRO_DIR([m4]) + +AM_INIT_AUTOMAKE([foreign no-dist-gzip dist-xz]) + +PROXY_VERSION=nxproxy_version +AC_SUBST([PROXY_VERSION]) + +NX_COMPILER_BRAND +AC_LANG([C]) +NX_COMPILER_FLAGS + +AC_CONFIG_FILES([ +Makefile +man/Makefile +src/Makefile +]) + +AC_OUTPUT diff --git a/nxproxy/configure.in b/nxproxy/configure.in deleted file mode 100644 index 12e2a08d2..000000000 --- a/nxproxy/configure.in +++ /dev/null @@ -1,186 +0,0 @@ -dnl Process this file with autoconf to produce a configure script. - -dnl Prolog - -AC_INIT(Main.c) -AC_PREREQ(2.13) - -dnl Reset default compilation flags. - -if test "x$CXXFLAGS" == "x"; then - CXXFLAGS="-O3" -fi -if test "x$CPPFLAGS" == "x"; then - CPPFLAGS="-O3" -fi - -dnl Prefer headers and libraries from nx-X11 if present. - -if test -d "../nx-X11/exports/include" ; then - CXXFLAGS="$CXXFLAGS -I../nx-X11/exports/include" - LIBS="$LIBS -L../nx-X11/exports/lib" -fi - -dnl Check whether --with-ipaq was given. - -if test "${with_ipaq}" = yes; then - echo -e "enabling ipaq configuration" - CXX="arm-linux-c++" - CC="arm-linux-gcc" - unset ac_cv_prog_armcxx - unset ac_cv_prog_armcc - unset ac_cv_prog_CXXCPP - AC_CHECK_PROG([armcxx],["$CXX"],[yes],[no],[$PATH]) - AC_CHECK_PROG([armcc],["$CC"],[yes],[no],[$PATH]) - if test $armcxx = "yes" && test $armcc = "yes" ; then - ac_cv_prog_CXX="$CXX" - ac_cv_prog_CC="$CC" - else - AC_MSG_ERROR(installation or configuration problem: I cannot find compiler for arm-linux) - fi -else - unset ac_cv_prog_CXX - unset ac_cv_prog_CC - unset ac_cv_prog_CXXCPP -fi - -dnl Check for programs. - -AC_PROG_CXX -AC_PROG_CC -AC_LANG_CPLUSPLUS - -dnl Check for BSD compatible install. - -AC_PROG_INSTALL - -dnl Check for extra header files. - -AC_PATH_XTRA - -dnl Custom addition. - -ac_help="$ac_help - --with-symbols give -g flag to compiler to produce debug symbols - --with-info define INFO at compile time to get basic log output - --with-valgrind clean up allocated buffers to avoid valgrind warnings - --with-version use this version for produced libraries" - -dnl Check to see if we're running under Cygwin32. - - -dnl Check to see if we're running under FreeBSD. -AC_DEFUN(nxconf_FreeBSD, -[AC_CACHE_CHECK(for FreeBSD environment, nxconf_cv_freebsd, -[AC_TRY_COMPILE(,[return __FreeBSD__;], -nxconf_cv_freebsd=yes, nxconf_cv_freebsd=no) -rm -f conftest*]) -FreeBSD= -test "$nxconf_cv_freebsd" = yes && FreeBSD=yes]) -nxconf_FreeBSD - - -AC_DEFUN(nxconf_CYGWIN32, -[AC_CACHE_CHECK(for Cygwin32 environment, nxconf_cv_cygwin32, -[AC_TRY_COMPILE(,[return __CYGWIN32__;], -nxconf_cv_cygwin32=yes, nxconf_cv_cygwin32=no) -rm -f conftest*]) -CYGWIN32= -test "$nxconf_cv_cygwin32" = yes && CYGWIN32=yes]) -nxconf_CYGWIN32 - -dnl Check for Darwin environment. - -AC_DEFUN(nxconf_DARWIN, -[AC_CACHE_CHECK(for Darwin environment, nxconf_cv_darwin, -[AC_TRY_COMPILE(,[return __APPLE__;], -nxconf_cv_darwin=yes, nxconf_cv_darwin=no) -rm -f conftest*]) -DARWIN= -test "$nxconf_cv_darwin" = yes && DARWIN=yes]) -nxconf_DARWIN - -dnl Check to see if we're running under Solaris. - -AC_DEFUN(nxconf_SUN, -[AC_CACHE_CHECK(for SunOS environment, nxconf_cv_sun, -[AC_TRY_COMPILE(,[return __sun;], -nxconf_cv_sun=yes, nxconf_cv_sun=no) -rm -f conftest*]) -SUN= -test "$nxconf_cv_sun" = yes && SUN=yes]) -nxconf_SUN - -dnl Check whether --with-version was given. - -AC_SUBST(LIBVERSION) -AC_SUBST(VERSION) -if test "${with_version}" = yes; then - VERSION=${ac_option} -else - VERSION=`cat VERSION` -fi -echo -e "compiling version ${VERSION}" - -LIBVERSION=`echo ${VERSION} | cut -d '.' -f 1` - -CXXFLAGS="$CXXFLAGS -DVERSION=\\\"${VERSION}\\\"" -CPPFLAGS="$CPPFLAGS -DVERSION=\\\"${VERSION}\\\"" - -dnl Check whether --with-symbols or --without-symbols was -dnl given and set the required optimization level. - -if test "${with_symbols}" = yes; then - echo -e "enabling production of debug symbols" - CXXFLAGS="-g $CXXFLAGS" - CPPFLAGS="-g $CPPFLAGS" -else - echo -e "disabling production of debug symbols" -fi - -dnl Check whether --with-info or --without-info was given. - -if test "${with_info}" = yes; then - echo -e "enabling info output in the log file" - CXXFLAGS="$CXXFLAGS -DINFO" - CPPFLAGS="$CPPFLAGS -DINFO" -else - echo -e "disabling info output in the log file" -fi - -dnl Check whether --with-valgrind or --without-valgrind was given. - -if test "${with_valgrind}" = yes; then - echo -e "enabling valgrind memory checker workarounds" - CXXFLAGS="$CXXFLAGS -DVALGRIND" - CPPFLAGS="$CPPFLAGS -DVALGRIND" -else - echo -e "disabling valgrind memory checker workarounds" -fi - -dnl Cygwin requires that the stdc++ library is linked explicitly. -dnl GCC 3.3.x requires also the z, png and jpeg libraries. This is -dnl not true anymore since GCC 3.4.x. - -if test "$CYGWIN32" = yes; then - LIBS="$LIBS -L../nxcomp -lXcomp -lstdc++ -Wl,-e,_mainCRTStartup -ljpeg -lpng -lz" -else - LIBS="$LIBS -L../nxcomp -lXcomp" -fi - -dnl Find makedepend somewhere. - -AC_SUBST(MAKEDEPEND) -MAKEDEPEND="$(which makedepend)" - -# Try to desperately find makedepend. -# Set MAKEDEPEND to the shipped makedepend binary. This will not -# exist in nx-libs-lite, though, in which case MAKEDEPEND -# will stay empty. -if test -z "${MAKEDEPEND}"; then - if test -x "../nx-X11/config/makedepend/makedepend"; then - MAKEDEPEND="../nx-X11/config/makedepend/makedepend" - fi -fi - -AC_OUTPUT(Makefile) diff --git a/nxproxy/install-sh b/nxproxy/install-sh deleted file mode 100755 index 58719246f..000000000 --- a/nxproxy/install-sh +++ /dev/null @@ -1,238 +0,0 @@ -#! /bin/sh -# -# install - install a program, script, or datafile -# This comes from X11R5. -# -# 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. -# - - -# 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}" - -transformbasename="" -transform_arg="" -instcmd="$mvprog" -chmodcmd="$chmodprog 0755" -chowncmd="" -chgrpcmd="" -stripcmd="" -rmcmd="$rmprog -f" -mvcmd="$mvprog" -src="" -dst="" -dir_arg="" - -while [ x"$1" != x ]; do - case $1 in - -c) instcmd="$cpprog" - shift - continue;; - - -d) dir_arg=true - shift - continue;; - - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; - - -o) chowncmd="$chownprog $2" - shift - shift - continue;; - - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; - - -s) stripcmd="$stripprog" - shift - continue;; - - -t=*) transformarg=`echo $1 | sed 's/-t=//'` - shift - continue;; - - -b=*) transformbasename=`echo $1 | sed 's/-b=//'` - shift - continue;; - - *) if [ x"$src" = x ] - then - src=$1 - else - # this colon is to work around a 386BSD /bin/sh bug - : - dst=$1 - fi - shift - continue;; - esac -done - -if [ x"$src" = x ] -then - echo "install: no input file specified" - exit 1 -else - true -fi - -if [ x"$dir_arg" != x ]; then - dst=$src - src="" - - if [ -d $dst ]; then - instcmd=: - else - instcmd=mkdir - fi -else - -# Waiting for this to be detected by the "$instcmd $src $dsttmp" command -# might cause directories to be created, which would be especially bad -# if $src (and thus $dsttmp) contains '*'. - - if [ -f $src -o -d $src ] - then - true - else - echo "install: $src does not exist" - exit 1 - fi - - if [ x"$dst" = x ] - then - echo "install: no destination specified" - exit 1 - else - true - fi - -# If destination is a directory, append the input filename; if your system -# does not like double slashes in filenames, you may need to add some logic - - if [ -d $dst ] - then - dst="$dst"/`basename $src` - else - true - fi -fi - -## this sed command emulates the dirname command -dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` - -# Make sure that the destination directory exists. -# this part is taken from Noah Friedman's mkinstalldirs script - -# Skip lots of stat calls in the usual case. -if [ ! -d "$dstdir" ]; then -defaultIFS=' -' -IFS="${IFS-${defaultIFS}}" - -oIFS="${IFS}" -# Some sh's can't handle IFS=/ for some reason. -IFS='%' -set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` -IFS="${oIFS}" - -pathcomp='' - -while [ $# -ne 0 ] ; do - pathcomp="${pathcomp}${1}" - shift - - if [ ! -d "${pathcomp}" ] ; - then - $mkdirprog "${pathcomp}" - else - true - fi - - pathcomp="${pathcomp}/" -done -fi - -if [ x"$dir_arg" != x ] -then - $doit $instcmd $dst && - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi -else - -# If we're going to rename the final executable, determine the name now. - - if [ x"$transformarg" = x ] - then - dstfile=`basename $dst` - else - dstfile=`basename $dst $transformbasename | - sed $transformarg`$transformbasename - fi - -# don't allow the sed command to completely eliminate the filename - - if [ x"$dstfile" = x ] - then - dstfile=`basename $dst` - else - true - fi - -# Make a temp file name in the proper directory. - - dsttmp=$dstdir/#inst.$$# - -# Move or copy the file name to the temp name - - $doit $instcmd $src $dsttmp && - - trap "rm -f ${dsttmp}" 0 && - -# 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 $instcmd $src $dsttmp" command. - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && - -# Now rename the file to the real destination. - - $doit $rmcmd -f $dstdir/$dstfile && - $doit $mvcmd $dsttmp $dstdir/$dstfile - -fi && - - -exit 0 diff --git a/nxproxy/m4/nx-macros.m4 b/nxproxy/m4/nx-macros.m4 new file mode 120000 index 000000000..813e9b041 --- /dev/null +++ b/nxproxy/m4/nx-macros.m4 @@ -0,0 +1 @@ +../../m4/nx-macros.m4 \ No newline at end of file diff --git a/nxproxy/man/Makefile.am b/nxproxy/man/Makefile.am new file mode 100644 index 000000000..8f9211c07 --- /dev/null +++ b/nxproxy/man/Makefile.am @@ -0,0 +1,5 @@ +NULL = + +dist_man_MANS = \ + nxproxy.1 \ + $(NULL) diff --git a/nxproxy/mkinstalldirs b/nxproxy/mkinstalldirs deleted file mode 100755 index 936cf3407..000000000 --- a/nxproxy/mkinstalldirs +++ /dev/null @@ -1,34 +0,0 @@ -#! /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 diff --git a/nxproxy/src/Main.c b/nxproxy/src/Main.c new file mode 100644 index 000000000..d9fb1ef4f --- /dev/null +++ b/nxproxy/src/Main.c @@ -0,0 +1,120 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */ +/* */ +/* NXPROXY, NX protocol compression and NX extensions to this software */ +/* are copyright of NoMachine. Redistribution and use of the present */ +/* software is allowed according to terms specified in the file LICENSE */ +/* which comes in the source distribution. */ +/* */ +/* Check http://www.nomachine.com/licensing.html for applicability. */ +/* */ +/* NX and NoMachine are trademarks of Medialogic S.p.A. */ +/* */ +/* All rigths reserved. */ +/* */ +/**************************************************************************/ + +#include +#include +#include +#include +#include +#include + +#include "NX.h" + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +extern const char *__progname; + +/* + * Entry point when running nxproxy stand-alone. + */ + +int main(int argc, const char **argv) +{ + int result = -1; + + char *options = NULL; + + char *nx_commfd_str = NULL; + + options = getenv("NX_DISPLAY"); + + if ((nx_commfd_str = getenv("NX_COMMFD")) != NULL) + { + errno = 0; + unsigned long int nx_commfd = strtoul(nx_commfd_str, NULL, 10); + + if ((errno) && (0 == nx_commfd)) + { + fprintf(stderr, "%s: NX_COMMFD environment variable's value [%s] is not a file descriptor number. " + "Aborting...\n", + __progname, nx_commfd_str + ); + NXTransCleanup(); + } + else if ((unsigned long int) INT_MAX < nx_commfd) + { + fprintf(stderr, "%s: NX_COMMFD environment variable's value [%lu] is out of range for a file descriptor number. " + "Aborting...\n", + __progname, nx_commfd); + NXTransCleanup(); + } + else { + result = NXTransCreate(nx_commfd, NX_MODE_SERVER, options); + + if (result != 1) + { + fprintf(stderr, "%s: NXTransCreate failed for FD#%lu\n" + "Aborting...", + __progname, nx_commfd); + NXTransCleanup(); + } + + } + + // go into endless loop + + if (result == 1) + { + while (NXTransRunning(NX_FD_ANY)) + result = NXTransContinue(NULL); + } + } + else + { + + if (NXTransParseCommandLine(argc, argv) < 0) + { + NXTransCleanup(); + } + + if (NXTransParseEnvironment(options, 0) < 0) + { + NXTransCleanup(); + } + + /* + * This should not return... + */ + + #ifdef TEST + fprintf(stderr, "%s: Yielding control to NX entry point.\n", __progname); + #endif + + result = NXTransProxy(NX_FD_ANY, NX_MODE_ANY, NX_DISPLAY_ANY); + } + + /* + * ...So these should not be called. + */ + + NXTransExit(result); + + return 0; +} diff --git a/nxproxy/src/Makefile.am b/nxproxy/src/Makefile.am new file mode 100644 index 000000000..5ec1f9401 --- /dev/null +++ b/nxproxy/src/Makefile.am @@ -0,0 +1,17 @@ +NULL = + +nxexecdir = $(libexecdir) + +nxexec_PROGRAMS = nxproxy + +nxproxy_SOURCES = \ + Main.c \ + $(NULL) + +nxproxy_LDADD = \ + -L$(top_srcdir)/../nxcomp/ -lXcomp \ + $(NULL) + +AM_CPPFLAGS = \ + -I$(top_srcdir)/../nxcomp/ \ + $(NULL) -- cgit v1.2.3