--- rdesktop-1.5.0.orig/.cvsignore +++ rdesktop-1.5.0/.cvsignore @@ -0,0 +1,8 @@ +rdesktop +rdp2vnc +autom4te.cache +Makefile +config.log +config.status +configure +rdesktop*.tar.gz --- rdesktop-1.5.0.orig/Makefile.in +++ rdesktop-1.5.0/Makefile.in @@ -1,13 +1,14 @@ # # rdesktop: A Remote Desktop Protocol client # Makefile.in -# Copyright (C) Matthew Chapman 1999-2005 +# Copyright (C) Matthew Chapman 1999-2007 # prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ mandir = @mandir@ +datarootdir = @datarootdir@ datadir = @datadir@ VERSION = @PACKAGE_VERSION@ @@ -24,19 +25,20 @@ LDVNC = @LDVNC@ VNCLINK = @VNCLINK@ SOUNDOBJ = @SOUNDOBJ@ +SCARDOBJ = @SCARDOBJ@ -RDPOBJ = tcp.o iso.o mcs.o secure.o licence.o rdp.o orders.o bitmap.o cache.o rdp5.o channels.o rdpdr.o serial.o printer.o disk.o parallel.o printercache.o mppc.o pstcache.o lspci.o seamless.o +RDPOBJ = tcp.o iso.o mcs.o secure.o licence.o rdp.o orders.o bitmap.o cache.o rdp5.o channels.o rdpdr.o serial.o printer.o disk.o parallel.o printercache.o mppc.o pstcache.o lspci.o seamless.o ssl.o X11OBJ = rdesktop.o xwin.o xkeymap.o ewmhints.o xclip.o cliprdr.o VNCOBJ = vnc/rdp2vnc.o vnc/vnc.o vnc/xkeymap.o vnc/x11stubs.o .PHONY: all all: $(TARGETS) -rdesktop: $(X11OBJ) $(SOUNDOBJ) $(RDPOBJ) - $(CC) $(CFLAGS) -o rdesktop $(X11OBJ) $(SOUNDOBJ) $(RDPOBJ) $(LDFLAGS) -lX11 +rdesktop: $(X11OBJ) $(SOUNDOBJ) $(RDPOBJ) $(SCARDOBJ) + $(CC) $(CFLAGS) -o rdesktop $(X11OBJ) $(SOUNDOBJ) $(RDPOBJ) $(SCARDOBJ) $(LDFLAGS) -lX11 -rdp2vnc: $(VNCOBJ) $(SOUNDOBJ) $(RDPOBJ) - $(VNCLINK) $(CFLAGS) -o rdp2vnc $(VNCOBJ) $(SOUNDOBJ) $(RDPOBJ) $(LDFLAGS) $(LDVNC) +rdp2vnc: $(VNCOBJ) $(SOUNDOBJ) $(RDPOBJ) $(SCARDOBJ) + $(VNCLINK) $(CFLAGS) -o rdp2vnc $(VNCOBJ) $(SOUNDOBJ) $(RDPOBJ) $(SCARDOBJ) $(LDFLAGS) $(LDVNC) vnc/rdp2vnc.o: rdesktop.c $(CC) $(CFLAGS) $(VNCINC) -DRDP2VNC -o vnc/rdp2vnc.o -c rdesktop.c @@ -81,8 +83,9 @@ cproto -DMAKE_PROTO \ bitmap.c cache.c channels.c cliprdr.c disk.c mppc.c ewmhints.c \ iso.c licence.c mcs.c orders.c parallel.c printer.c printercache.c \ - pstcache.c rdesktop.c rdp5.c rdp.c rdpdr.c rdpsnd.c rdpsnd_oss.c \ - secure.c serial.c tcp.c xclip.c xkeymap.c xwin.c lspci.c seamless.c >> proto.h + pstcache.c rdesktop.c rdp5.c rdp.c rdpdr.c rdpsnd.c \ + secure.c serial.c tcp.c xclip.c xkeymap.c xwin.c lspci.c seamless.c \ + scard.c >> proto.h cat proto.tail >> proto.h .PHONY: clean --- rdesktop-1.5.0.orig/README +++ rdesktop-1.5.0/README @@ -30,3 +30,13 @@ The rdesktop manual page lists the possible options ("man rdesktop"). +Smart-card support notes +------------------------ + +Smart-card support module uses PCSC-lite. You should use PCSC-lite 1.2.9 or +later. + +To enable smart-card support in the rdesktop just run "./configure" with the +"--enable-smartcard" option. Also you can enable smart-card debug with +additional "--with-debug-smartcard" option. + --- rdesktop-1.5.0.orig/bitmap.c +++ rdesktop-1.5.0/bitmap.c @@ -1,7 +1,7 @@ /* -*- c-basic-offset: 8 -*- rdesktop: A Remote Desktop Protocol client. Bitmap decompression routines - Copyright (C) Matthew Chapman 1999-2005 + Copyright (C) Matthew Chapman 1999-2007 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,12 +18,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* three seperate function for speed when decompressing the bitmaps */ -/* when modifing one function make the change in the others */ -/* comment out #define BITMAP_SPEED_OVER_SIZE below for one slower function */ -/* j@american-data.com */ - -#define BITMAP_SPEED_OVER_SIZE +/* three seperate function for speed when decompressing the bitmaps + when modifing one function make the change in the others + jay.sorg@gmail.com */ /* indent is confused by this file */ /* *INDENT-OFF* */ @@ -66,10 +63,8 @@ } \ } -#ifdef BITMAP_SPEED_OVER_SIZE - /* 1 byte bitmap decompress */ -static BOOL +static RD_BOOL bitmap_decompress1(uint8 * output, int width, int height, uint8 * input, int size) { uint8 *end = input + size; @@ -267,7 +262,7 @@ } /* 2 byte bitmap decompress */ -static BOOL +static RD_BOOL bitmap_decompress2(uint8 * output, int width, int height, uint8 * input, int size) { uint8 *end = input + size; @@ -466,7 +461,7 @@ } /* 3 byte bitmap decompress */ -static BOOL +static RD_BOOL bitmap_decompress3(uint8 * output, int width, int height, uint8 * input, int size) { uint8 *end = input + size; @@ -751,254 +746,146 @@ return True; } -#else - -static uint32 -cvalx(uint8 **input, int Bpp) -{ - uint32 rv = 0; - memcpy(&rv, *input, Bpp); - *input += Bpp; - return rv; -} - -static void -setli(uint8 *input, int offset, uint32 value, int Bpp) -{ - input += offset * Bpp; - memcpy(input, &value, Bpp); -} - -static uint32 -getli(uint8 *input, int offset, int Bpp) +/* decompress a colour plane */ +static int +process_plane(uint8 * in, int width, int height, uint8 * out, int size) { - uint32 rv = 0; - input += offset * Bpp; - memcpy(&rv, input, Bpp); - return rv; -} - -static BOOL -bitmap_decompressx(uint8 *output, int width, int height, uint8 *input, int size, int Bpp) -{ - uint8 *end = input + size; - uint8 *prevline = NULL, *line = NULL; - int opcode, count, offset, isfillormix, x = width; - int lastopcode = -1, insertmix = False, bicolour = False; - uint8 code; - uint32 colour1 = 0, colour2 = 0; - uint8 mixmask, mask = 0; - uint32 mix = 0xffffffff; - int fom_mask = 0; - - while (input < end) + int indexw; + int indexh; + int code; + int collen; + int replen; + int color; + int x; + int revcode; + uint8 * last_line; + uint8 * this_line; + uint8 * org_in; + uint8 * org_out; + + org_in = in; + org_out = out; + last_line = 0; + indexh = 0; + while (indexh < height) { - fom_mask = 0; - code = CVAL(input); - opcode = code >> 4; - - /* Handle different opcode forms */ - switch (opcode) - { - case 0xc: - case 0xd: - case 0xe: - opcode -= 6; - count = code & 0xf; - offset = 16; - break; - - case 0xf: - opcode = code & 0xf; - if (opcode < 9) + out = (org_out + width * height * 4) - ((indexh + 1) * width * 4); + color = 0; + this_line = out; + indexw = 0; + if (last_line == 0) + { + while (indexw < width) + { + code = CVAL(in); + replen = code & 0xf; + collen = (code >> 4) & 0xf; + revcode = (replen << 4) | collen; + if ((revcode <= 47) && (revcode >= 16)) { - count = CVAL(input); - count |= CVAL(input) << 8; + replen = revcode; + collen = 0; } - else + while (collen > 0) { - count = (opcode < 0xb) ? 8 : 1; + color = CVAL(in); + *out = color; + out += 4; + indexw++; + collen--; + } + while (replen > 0) + { + *out = color; + out += 4; + indexw++; + replen--; } - offset = 0; - break; - - default: - opcode >>= 1; - count = code & 0x1f; - offset = 32; - break; - } - - /* Handle strange cases for counts */ - if (offset != 0) - { - isfillormix = ((opcode == 2) || (opcode == 7)); - - if (count == 0) - { - if (isfillormix) - count = CVAL(input) + 1; - else - count = CVAL(input) + offset; - } - else if (isfillormix) - { - count <<= 3; } } - - /* Read preliminary data */ - switch (opcode) - { - case 0: /* Fill */ - if ((lastopcode == opcode) && !((x == width) && (prevline == NULL))) - insertmix = True; - break; - case 8: /* Bicolour */ - colour1 = cvalx(&input, Bpp); - case 3: /* Colour */ - colour2 = cvalx(&input, Bpp); - break; - case 6: /* SetMix/Mix */ - case 7: /* SetMix/FillOrMix */ - mix = cvalx(&input, Bpp); - opcode -= 5; - break; - case 9: /* FillOrMix_1 */ - mask = 0x03; - opcode = 0x02; - fom_mask = 3; - break; - case 0x0a: /* FillOrMix_2 */ - mask = 0x05; - opcode = 0x02; - fom_mask = 5; - break; - - } - - lastopcode = opcode; - mixmask = 0; - - /* Output body */ - while (count > 0) + else { - if (x >= width) - { - if (height <= 0) - return False; - - x = 0; - height--; - - prevline = line; - line = output + height * width * Bpp; - } - - switch (opcode) + while (indexw < width) { - case 0: /* Fill */ - if (insertmix) - { - if (prevline == NULL) - setli(line, x, mix, Bpp); - else - setli(line, x, - getli(prevline, x, Bpp) ^ mix, Bpp); - - insertmix = False; - count--; - x++; - } - - if (prevline == NULL) - { - REPEAT(setli(line, x, 0, Bpp))} - else - { - REPEAT(setli - (line, x, getli(prevline, x, Bpp), Bpp)); - } - break; - - case 1: /* Mix */ - if (prevline == NULL) - { - REPEAT(setli(line, x, mix, Bpp)); - } - else - { - REPEAT(setli - (line, x, getli(prevline, x, Bpp) ^ mix, - Bpp)); - } - break; - - case 2: /* Fill or Mix */ - if (prevline == NULL) + code = CVAL(in); + replen = code & 0xf; + collen = (code >> 4) & 0xf; + revcode = (replen << 4) | collen; + if ((revcode <= 47) && (revcode >= 16)) + { + replen = revcode; + collen = 0; + } + while (collen > 0) + { + x = CVAL(in); + if (x & 1) { - REPEAT(MASK_UPDATE(); - if (mask & mixmask) setli(line, x, mix, Bpp); - else - setli(line, x, 0, Bpp);); + x = x >> 1; + x = x + 1; + color = -x; } else { - REPEAT(MASK_UPDATE(); - if (mask & mixmask) - setli(line, x, getli(prevline, x, Bpp) ^ mix, - Bpp); - else - setli(line, x, getli(prevline, x, Bpp), - Bpp);); + x = x >> 1; + color = x; } - break; - - case 3: /* Colour */ - REPEAT(setli(line, x, colour2, Bpp)); - break; - - case 4: /* Copy */ - REPEAT(setli(line, x, cvalx(&input, Bpp), Bpp)); - break; - - case 8: /* Bicolour */ - REPEAT(if (bicolour) - { - setli(line, x, colour2, Bpp); bicolour = False;} - else - { - setli(line, x, colour1, Bpp); bicolour = True; - count++;} - ); - break; - - case 0xd: /* White */ - REPEAT(setli(line, x, 0xffffffff, Bpp)); - break; - - case 0xe: /* Black */ - REPEAT(setli(line, x, 0, Bpp)); - break; - - default: - unimpl("bitmap opcode 0x%x\n", opcode); - return False; + x = last_line[indexw * 4] + color; + *out = x; + out += 4; + indexw++; + collen--; + } + while (replen > 0) + { + x = last_line[indexw * 4] + color; + *out = x; + out += 4; + indexw++; + replen--; + } } } + indexh++; + last_line = this_line; } - - return True; + return (int) (in - org_in); } -#endif +/* 4 byte bitmap decompress */ +static RD_BOOL +bitmap_decompress4(uint8 * output, int width, int height, uint8 * input, int size) +{ + int code; + int bytes_pro; + int total_pro; + + code = CVAL(input); + if (code != 0x10) + { + return False; + } + total_pro = 1; + bytes_pro = process_plane(input, width, height, output + 3, size - total_pro); + total_pro += bytes_pro; + input += bytes_pro; + bytes_pro = process_plane(input, width, height, output + 2, size - total_pro); + total_pro += bytes_pro; + input += bytes_pro; + bytes_pro = process_plane(input, width, height, output + 1, size - total_pro); + total_pro += bytes_pro; + input += bytes_pro; + bytes_pro = process_plane(input, width, height, output + 0, size - total_pro); + total_pro += bytes_pro; + return size == total_pro; +} /* main decompress function */ -BOOL +RD_BOOL bitmap_decompress(uint8 * output, int width, int height, uint8 * input, int size, int Bpp) { -#ifdef BITMAP_SPEED_OVER_SIZE - BOOL rv = False; + RD_BOOL rv = False; + switch (Bpp) { case 1: @@ -1010,11 +897,13 @@ case 3: rv = bitmap_decompress3(output, width, height, input, size); break; + case 4: + rv = bitmap_decompress4(output, width, height, input, size); + break; + default: + unimpl("Bpp %d\n", Bpp); + break; } -#else - BOOL rv; - rv = bitmap_decompressx(output, width, height, input, size, Bpp); -#endif return rv; } --- rdesktop-1.5.0.orig/cache.c +++ rdesktop-1.5.0/cache.c @@ -1,7 +1,7 @@ /* -*- c-basic-offset: 8 -*- rdesktop: A Remote Desktop Protocol client. Cache routines - Copyright (C) Matthew Chapman 1999-2005 + Copyright (C) Matthew Chapman 1999-2007 Copyright (C) Jeroen Meijer 2005 This program is free software; you can redistribute it and/or modify @@ -40,13 +40,13 @@ struct bmpcache_entry { - HBITMAP bitmap; + RD_HBITMAP bitmap; sint16 previous; sint16 next; }; static struct bmpcache_entry g_bmpcache[3][0xa00]; -static HBITMAP g_volatile_bc[3]; +static RD_HBITMAP g_volatile_bc[3]; static int g_bmpcache_lru[3] = { NOT_SET, NOT_SET, NOT_SET }; static int g_bmpcache_mru[3] = { NOT_SET, NOT_SET, NOT_SET }; @@ -190,7 +190,7 @@ } /* Retrieve a bitmap from the cache */ -HBITMAP +RD_HBITMAP cache_get_bitmap(uint8 id, uint16 idx) { if ((id < NUM_ELEMENTS(g_bmpcache)) && (idx < NUM_ELEMENTS(g_bmpcache[0]))) @@ -214,9 +214,9 @@ /* Store a bitmap in the cache */ void -cache_put_bitmap(uint8 id, uint16 idx, HBITMAP bitmap) +cache_put_bitmap(uint8 id, uint16 idx, RD_HBITMAP bitmap) { - HBITMAP old; + RD_HBITMAP old; if ((id < NUM_ELEMENTS(g_bmpcache)) && (idx < NUM_ELEMENTS(g_bmpcache[0]))) { @@ -293,7 +293,7 @@ /* Store a glyph in the font cache */ void cache_put_font(uint8 font, uint16 character, uint16 offset, - uint16 baseline, uint16 width, uint16 height, HGLYPH pixmap) + uint16 baseline, uint16 width, uint16 height, RD_HGLYPH pixmap) { FONTGLYPH *glyph; @@ -392,13 +392,13 @@ /* CURSOR CACHE */ -static HCURSOR g_cursorcache[0x20]; +static RD_HCURSOR g_cursorcache[0x20]; /* Retrieve cursor from cache */ -HCURSOR +RD_HCURSOR cache_get_cursor(uint16 cache_idx) { - HCURSOR cursor; + RD_HCURSOR cursor; if (cache_idx < NUM_ELEMENTS(g_cursorcache)) { @@ -413,9 +413,9 @@ /* Store cursor in cache */ void -cache_put_cursor(uint16 cache_idx, HCURSOR cursor) +cache_put_cursor(uint16 cache_idx, RD_HCURSOR cursor) { - HCURSOR old; + RD_HCURSOR old; if (cache_idx < NUM_ELEMENTS(g_cursorcache)) { --- rdesktop-1.5.0.orig/channels.c +++ rdesktop-1.5.0/channels.c @@ -2,7 +2,7 @@ rdesktop: A Remote Desktop Protocol client. Protocol services - Virtual channels Copyright (C) Erik Forsberg 2003 - Copyright (C) Matthew Chapman 2003-2005 + Copyright (C) Matthew Chapman 2003-2007 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -27,8 +27,8 @@ #define CHANNEL_FLAG_LAST 0x02 #define CHANNEL_FLAG_SHOW_PROTOCOL 0x10 -extern BOOL g_use_rdp5; -extern BOOL g_encryption; +extern RD_BOOL g_use_rdp5; +extern RD_BOOL g_encryption; VCHANNEL g_channels[MAX_CHANNELS]; unsigned int g_num_channels; @@ -83,6 +83,10 @@ uint32 thislength, remaining; uint8 *data; +#ifdef WITH_SCARD + scard_lock(SCARD_LOCK_CHANNEL); +#endif + /* first fragment sent in-place */ s_pop_layer(s, channel_hdr); length = s->end - s->p - 8; @@ -125,6 +129,10 @@ data += thislength; } + +#ifdef WITH_SCARD + scard_unlock(SCARD_LOCK_CHANNEL); +#endif } void --- rdesktop-1.5.0.orig/cliprdr.c +++ rdesktop-1.5.0/cliprdr.c @@ -2,7 +2,7 @@ rdesktop: A Remote Desktop Protocol client. Protocol services - Clipboard functions Copyright (C) Erik Forsberg 2003 - Copyright (C) Matthew Chapman 2003 + Copyright (C) Matthew Chapman 2003-2007 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -175,7 +175,7 @@ ui_clip_set_mode(optarg); } -BOOL +RD_BOOL cliprdr_init(void) { cliprdr_channel = --- rdesktop-1.5.0.orig/config.guess +++ rdesktop-1.5.0/config.guess @@ -1,9 +1,10 @@ #! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. +# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, +# Inc. -timestamp='2003-06-17' +timestamp='2007-07-22' # 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 @@ -17,13 +18,15 @@ # # 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. +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. + # Originally written by Per Bothner . # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. @@ -53,7 +56,7 @@ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +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 @@ -66,11 +69,11 @@ while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) - echo "$timestamp" ; exit 0 ;; + echo "$timestamp" ; exit ;; --version | -v ) - echo "$version" ; exit 0 ;; + echo "$version" ; exit ;; --help | --h* | -h ) - echo "$usage"; exit 0 ;; + echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. @@ -104,7 +107,7 @@ 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" ; } || + { tmp=`(umask 077 && mktemp -d "$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 ; } ; @@ -123,7 +126,7 @@ ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; -esac ;' +esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) @@ -136,13 +139,6 @@ UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown -## for Red Hat Linux -if test -f /etc/redhat-release ; then - VENDOR=redhat ; -else - VENDOR= ; -fi - # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in @@ -165,6 +161,7 @@ arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; + sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched @@ -203,50 +200,32 @@ # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" - exit 0 ;; - amiga:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - arc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - hp300:OpenBSD:*:*) - echo m68k-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 ;; - pmax:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sgi:OpenBSD:*:*) - echo mipseb-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sun3:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - wgrisc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; + exit ;; *:OpenBSD:*:*) - echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} + exit ;; + *:ekkoBSD:*:*) + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} + exit ;; + *:SolidBSD:*:*) + echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} + exit ;; + macppc:MirBSD:*:*) + echo powerpc-unknown-mirbsd${UNAME_RELEASE} + exit ;; + *:MirBSD:*:*) + echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} + exit ;; alpha:OSF1:*:*) - if test $UNAME_RELEASE = "V4.0"; then + case $UNAME_RELEASE in + *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - fi + ;; + *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 @@ -284,42 +263,49 @@ "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/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - exit 0 ;; - Alpha*:OpenVMS:*:*) - echo alpha-hp-vms - exit 0 ;; + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit ;; 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 ;; + exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 - exit 0 ;; + exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 - exit 0;; + exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos - exit 0 ;; + exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos - exit 0 ;; + exit ;; *:OS/390:*:*) echo i370-ibm-openedition - exit 0 ;; + exit ;; + *:z/VM:*:*) + echo s390-ibm-zvmoe + exit ;; + *:OS400:*:*) + echo powerpc-ibm-os400 + exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} - exit 0;; + exit ;; + arm:riscos:*:*|arm:RISCOS:*:*) + echo arm-unknown-riscos + exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp - exit 0;; + exit ;; 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 @@ -327,32 +313,32 @@ else echo pyramid-pyramid-bsd fi - exit 0 ;; + exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 - exit 0 ;; + exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 - exit 0 ;; - DRS?6000:UNIX_SV:4.2*:7*) + exit ;; + 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 ;; + sparc) echo sparc-icl-nx7; exit ;; esac ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - i86pc:SunOS:5.*:*) + exit ;; + i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + exit ;; 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 ;; + exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) @@ -361,10 +347,10 @@ 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 ;; + exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} - exit 0 ;; + exit ;; 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 @@ -376,10 +362,10 @@ echo sparc-sun-sunos${UNAME_RELEASE} ;; esac - exit 0 ;; + exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} - exit 0 ;; + exit ;; # 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 @@ -390,37 +376,40 @@ # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; + m68k:machten:*:*) + echo m68k-apple-machten${UNAME_RELEASE} + exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} - exit 0 ;; + exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 - exit 0 ;; + exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} - exit 0 ;; + exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} - exit 0 ;; + exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} - exit 0 ;; + exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c @@ -444,32 +433,33 @@ exit (-1); } EOF - $CC_FOR_BUILD -o $dummy $dummy.c \ - && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ - && exit 0 + $CC_FOR_BUILD -o $dummy $dummy.c && + dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`$dummy $dummyarg` && + { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} - exit 0 ;; + exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax - exit 0 ;; + exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax - exit 0 ;; + exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax - exit 0 ;; + exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix - exit 0 ;; + exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 - exit 0 ;; + exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 - exit 0 ;; + exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 - exit 0 ;; + exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` @@ -485,29 +475,29 @@ else echo i586-dg-dgux${UNAME_RELEASE} fi - exit 0 ;; + exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 - exit 0 ;; + exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 - exit 0 ;; + exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 - exit 0 ;; + exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd - exit 0 ;; + exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` - exit 0 ;; + exit ;; ????????: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 ' + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix - exit 0 ;; + exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` @@ -515,7 +505,7 @@ IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} - exit 0 ;; + exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build @@ -530,14 +520,18 @@ exit(0); } EOF - $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 - echo rs6000-ibm-aix3.2.5 + if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` + then + echo "$SYSTEM_NAME" + else + echo rs6000-ibm-aix3.2.5 + fi 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 ;; + exit ;; *: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 @@ -551,28 +545,28 @@ IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} - exit 0 ;; + exit ;; *:AIX:*:*) echo rs6000-ibm-aix - exit 0 ;; + exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 - exit 0 ;; + exit ;; 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 + exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx - exit 0 ;; + exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 - exit 0 ;; + exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd - exit 0 ;; + exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 - exit 0 ;; + exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in @@ -634,9 +628,19 @@ 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 + eval $set_cc_for_build + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + grep __LP64__ >/dev/null then HP_ARCH="hppa2.0w" else @@ -644,11 +648,11 @@ fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} - exit 0 ;; + exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} - exit 0 ;; + exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c @@ -676,150 +680,182 @@ exit (0); } EOF - $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 + $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 - exit 0 ;; + exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd - exit 0 ;; + exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd - exit 0 ;; + exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix - exit 0 ;; + exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf - exit 0 ;; + exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf - exit 0 ;; + exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi - exit 0 ;; + exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites - exit 0 ;; + exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd - exit 0 ;; + exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi - exit 0 ;; + exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd - exit 0 ;; + exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd - exit 0 ;; + exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd - exit 0 ;; + exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; 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 ;; + exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; *:UNICOS/mp:*:*) - echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; 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 ;; + exit ;; + 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 ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} - exit 0 ;; + exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} - exit 0 ;; + exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} - exit 0 ;; - *:FreeBSD:*:*|*:GNU/FreeBSD:*:*) - # Determine whether the default compiler uses glibc. - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - #if __GLIBC__ >= 2 - LIBC=gnu - #else - LIBC= - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC} - exit 0 ;; + exit ;; + *:FreeBSD:*:*) + case ${UNAME_MACHINE} in + pc98) + echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + amd64) + echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + *) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + esac + exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin - exit 0 ;; - i*:MINGW*:*) + exit ;; + *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 - exit 0 ;; + exit ;; + i*:windows32*:*) + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 + exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 - exit 0 ;; - x86:Interix*:[34]*) - echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//' - exit 0 ;; + exit ;; + *:Interix*:[3456]*) + case ${UNAME_MACHINE} in + x86) + echo i586-pc-interix${UNAME_RELEASE} + exit ;; + EM64T | authenticamd) + echo x86_64-unknown-interix${UNAME_RELEASE} + exit ;; + esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks - exit 0 ;; + exit ;; 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 ;; + exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin - exit 0 ;; + exit ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + echo x86_64-unknown-cygwin + exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin - exit 0 ;; + exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + exit ;; *:GNU:*:*) + # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` - exit 0 ;; + exit ;; + *: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 ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix - exit 0 ;; + exit ;; arm*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + exit ;; + avr32*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; cris:Linux:*:*) echo cris-axis-linux-gnu - exit 0 ;; + exit ;; + crisv32:Linux:*:*) + echo crisv32-axis-linux-gnu + exit ;; + frv:Linux:*:*) + echo frv-unknown-linux-gnu + exit ;; ia64:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR:-unknown}-linux-gnu - exit 0 ;; + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + exit ;; mips:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c @@ -836,8 +872,12 @@ #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 + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^CPU/{ + s: ::g + p + }'`" + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; mips64:Linux:*:*) eval $set_cc_for_build @@ -855,15 +895,22 @@ #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 + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^CPU/{ + s: ::g + p + }'`" + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; + or32:Linux:*:*) + echo or32-unknown-linux-gnu + exit ;; ppc:Linux:*:*) - echo powerpc-${VENDOR:-unknown}-linux-gnu - exit 0 ;; + echo powerpc-unknown-linux-gnu + exit ;; ppc64:Linux:*:*) - echo powerpc64-${VENDOR:-unknown}-linux-gnu - exit 0 ;; + echo powerpc64-unknown-linux-gnu + exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; @@ -877,7 +924,7 @@ 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 ;; + exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in @@ -885,25 +932,31 @@ PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac - exit 0 ;; + exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu - exit 0 ;; + exit ;; s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-${VENDOR:-ibm}-linux-gnu - exit 0 ;; + echo ${UNAME_MACHINE}-ibm-linux + exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + exit ;; + vax:Linux:*:*) + echo ${UNAME_MACHINE}-dec-linux-gnu + exit ;; x86_64:Linux:*:*) - echo x86_64-${VENDOR:-unknown}-linux-gnu - exit 0 ;; + echo x86_64-unknown-linux-gnu + exit ;; + xtensa:Linux:*:*) + echo xtensa-unknown-linux-gnu + exit ;; 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 @@ -921,15 +974,15 @@ ;; a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" - exit 0 ;; + exit ;; coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" - exit 0 ;; + exit ;; "") # 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 ;; + exit ;; esac # Determine whether the default compiler is a.out or elf eval $set_cc_for_build @@ -946,23 +999,33 @@ LIBC=gnulibc1 # endif #else - #ifdef __INTEL_COMPILER + #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) 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}-${VENDOR:-pc}-linux-${LIBC}" && exit 0 - test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 + eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' + /^LIBC/{ + s: ::g + p + }'`" + test x"${LIBC}" != x && { + echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + exit + } + test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } ;; 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 ;; + exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... @@ -970,24 +1033,27 @@ # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} - exit 0 ;; + exit ;; 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 ;; + exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop - exit 0 ;; + exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos - exit 0 ;; + exit ;; + i*86:syllable:*:*) + echo ${UNAME_MACHINE}-pc-syllable + exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp - exit 0 ;; + exit ;; 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 @@ -995,15 +1061,16 @@ else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi - exit 0 ;; - i*86:*:5:[78]*) + exit ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. 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 ;; + exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /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 ;; + exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv - exit 0 ;; + exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv - exit 0 ;; + exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix - exit 0 ;; - M68*:*:R3V[567]*:*) - test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; - 3[34]??:*: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) + exit ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; + 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 + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && echo i486-ncr-sysv4 && exit 0 ;; + && { echo i486-ncr-sysv4; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 - exit 0 ;; + exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} - exit 0 ;; + exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 - exit 0 ;; + exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 - exit 0 ;; + exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` @@ -1095,68 +1162,81 @@ else echo ns32k-sni-sysv fi - exit 0 ;; + exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 - exit 0 ;; + exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 - exit 0 ;; + exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 - exit 0 ;; + exit ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + echo ${UNAME_MACHINE}-stratus-vos + exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos - exit 0 ;; + exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} - exit 0 ;; + exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 - exit 0 ;; + exit ;; 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 ;; + exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos - exit 0 ;; + exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos - exit 0 ;; + exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos - exit 0 ;; + exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} - exit 0 ;; + exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} - exit 0 ;; + exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} - exit 0 ;; + exit ;; + SX-7:SUPER-UX:*:*) + echo sx7-nec-superux${UNAME_RELEASE} + exit ;; + SX-8:SUPER-UX:*:*) + echo sx8-nec-superux${UNAME_RELEASE} + exit ;; + SX-8R:SUPER-UX:*:*) + echo sx8r-nec-superux${UNAME_RELEASE} + exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} - exit 0 ;; + exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} - exit 0 ;; + exit ;; *:Darwin:*:*) - case `uname -p` in - *86) UNAME_PROCESSOR=i686 ;; - powerpc) UNAME_PROCESSOR=powerpc ;; + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + case $UNAME_PROCESSOR in + unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} - exit 0 ;; + exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then @@ -1164,22 +1244,25 @@ UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} - exit 0 ;; + exit ;; *:QNX:*:4*) echo i386-pc-qnx - exit 0 ;; - NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*) + exit ;; + NSE-?:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk${UNAME_RELEASE} + exit ;; + NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} - exit 0 ;; + exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux - exit 0 ;; + exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv - exit 0 ;; + exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} - exit 0 ;; + exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 @@ -1190,28 +1273,47 @@ UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 - exit 0 ;; + exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 - exit 0 ;; + exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex - exit 0 ;; + exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 - exit 0 ;; + exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 - exit 0 ;; + exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 - exit 0 ;; + exit ;; *:ITS:*:*) echo pdp10-unknown-its - exit 0 ;; + exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} - exit 0 ;; + exit ;; + *:DragonFly:*:*) + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "${UNAME_MACHINE}" in + A*) echo alpha-dec-vms ; exit ;; + I*) echo ia64-dec-vms ; exit ;; + V*) echo vax-dec-vms ; exit ;; + esac ;; + *:XENIX:*:SysV) + echo i386-pc-xenix + exit ;; + i*86:skyos:*:*) + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + exit ;; + i*86:rdos:*:*) + echo ${UNAME_MACHINE}-pc-rdos + exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 @@ -1243,7 +1345,7 @@ #endif #if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix"); exit (0); + printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) @@ -1332,11 +1434,12 @@ } EOF -$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0 +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) @@ -1345,22 +1448,22 @@ case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd - exit 0 ;; + exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi - exit 0 ;; + exit ;; c34*) echo c34-convex-bsd - exit 0 ;; + exit ;; c38*) echo c38-convex-bsd - exit 0 ;; + exit ;; c4*) echo c4-convex-bsd - exit 0 ;; + exit ;; esac fi @@ -1371,7 +1474,9 @@ the operating system you are using. It is advised that you download the most up to date version of the config scripts from - ftp://ftp.gnu.org/pub/gnu/config/ + http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess +and + http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub If the version you run ($0) is already up to date, please send the following data and any information you think might be --- rdesktop-1.5.0.orig/config.sub +++ rdesktop-1.5.0/config.sub @@ -1,9 +1,10 @@ #! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. +# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, +# Inc. -timestamp='2003-06-18' +timestamp='2007-06-28' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -21,14 +22,15 @@ # # 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. - +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. + # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # @@ -70,7 +72,7 @@ version="\ GNU config.sub ($timestamp) -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +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 @@ -83,11 +85,11 @@ while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) - echo "$timestamp" ; exit 0 ;; + echo "$timestamp" ; exit ;; --version | -v ) - echo "$version" ; exit 0 ;; + echo "$version" ; exit ;; --help | --h* | -h ) - echo "$usage"; exit 0 ;; + echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. @@ -99,7 +101,7 @@ *local*) # First pass through any local machine types. echo $1 - exit 0;; + exit ;; * ) break ;; @@ -118,7 +120,9 @@ # 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* | freebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) + nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | 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/'` ;; @@ -144,7 +148,7 @@ -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) + -apple | -axis | -knuth | -cray) os= basic_machine=$1 ;; @@ -169,6 +173,10 @@ -hiux*) os=-hiuxwe2 ;; + -sco6) + os=-sco5v6 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` @@ -185,6 +193,10 @@ # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; + -sco5v6*) + # 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/'` @@ -228,14 +240,17 @@ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ - | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ + | am33_2.0 \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ + | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ - | fr30 | frv \ + | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ - | ip2k \ - | m32r | m68000 | m68k | m88k | mcore \ + | ip2k | iq2000 \ + | m32c | m32r | m32rle | m68000 | m68k | m88k \ + | maxq | mb | microblaze | mcore | mep \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ @@ -244,28 +259,33 @@ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ + | mt \ | msp430 \ + | nios | nios2 \ | ns16k | ns32k \ - | openrisc | or32 \ + | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ - | s390 | s390x \ - | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ + | score \ + | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ - | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \ - | strongarm \ + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ + | spu | strongarm \ | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ | we32k \ - | x86 | xscale | xstormy16 | xtensa \ + | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k) basic_machine=$basic_machine-unknown ;; @@ -276,6 +296,9 @@ ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; + ms1) + basic_machine=mt-unknown + ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and @@ -295,20 +318,20 @@ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ - | avr-* \ - | bs2000-* \ + | avr-* | avr32-* \ + | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ - | clipper-* | cydra-* \ + | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ - | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ + | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ - | ip2k-* \ - | m32r-* \ + | ip2k-* | iq2000-* \ + | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | mcore-* \ + | m88110-* | m88k-* | maxq-* | mcore-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ @@ -317,31 +340,36 @@ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ + | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ + | mmix-* \ + | mt-* \ | msp430-* \ - | none-* | np1-* | nv1-* | ns16k-* | ns32k-* \ + | nios-* | nios2-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ - | s390-* | s390x-* \ - | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ - | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ - | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ + | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ + | sparclite-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ - | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ - | xtensa-* \ + | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ + | xstormy16-* | xtensa-* \ | ymp-* \ | z8k-*) ;; @@ -361,6 +389,9 @@ basic_machine=a29k-amd os=-udi ;; + abacus) + basic_machine=abacus-unknown + ;; adobe68k) basic_machine=m68010-adobe os=-scout @@ -378,6 +409,9 @@ amd64) basic_machine=x86_64-pc ;; + amd64-*) + basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; amdahl) basic_machine=580-amdahl os=-sysv @@ -437,12 +471,27 @@ basic_machine=j90-cray os=-unicos ;; + craynv) + basic_machine=craynv-cray + os=-unicosmp + ;; + cr16) + basic_machine=cr16-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 ;; @@ -465,6 +514,10 @@ basic_machine=m88k-motorola os=-sysv3 ;; + djgpp) + basic_machine=i586-pc + os=-msdosdjgpp + ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx @@ -630,6 +683,10 @@ basic_machine=i386-pc os=-mingw32 ;; + mingw32ce) + basic_machine=arm-unknown + os=-mingw32ce + ;; miniframe) basic_machine=m68000-convergent ;; @@ -643,10 +700,6 @@ mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; - mmix*) - basic_machine=mmix-knuth - os=-mmixware - ;; monitor) basic_machine=m68k-rom68k os=-coff @@ -659,6 +712,9 @@ basic_machine=i386-pc os=-msdos ;; + ms1-*) + basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` + ;; mvs) basic_machine=i370-ibm os=-mvs @@ -727,10 +783,6 @@ np1) basic_machine=np1-gould ;; - nv1) - basic_machine=nv1-cray - os=-unicosmp - ;; nsr-tandem) basic_machine=nsr-tandem ;; @@ -738,9 +790,12 @@ basic_machine=hppa1.1-oki os=-proelf ;; - or32 | or32-*) + openrisc | openrisc-*) basic_machine=or32-unknown - os=-coff + ;; + os400) + basic_machine=powerpc-ibm + os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson @@ -767,6 +822,12 @@ pc532 | pc532-*) basic_machine=ns32k-pc532 ;; + pc98) + basic_machine=i386-pc + ;; + pc98-*) + basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; @@ -823,6 +884,10 @@ basic_machine=i586-unknown os=-pw32 ;; + rdos) + basic_machine=i386-pc + os=-rdos + ;; rom68k) basic_machine=m68k-rom68k os=-coff @@ -833,6 +898,12 @@ 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 @@ -843,6 +914,10 @@ sb1el) basic_machine=mipsisa64sb1el-unknown ;; + sde) + basic_machine=mipsisa32-sde + os=-elf + ;; sei) basic_machine=mips-sei os=-seiux @@ -854,6 +929,9 @@ basic_machine=sh-hitachi os=-hms ;; + sh5el) + basic_machine=sh5le-unknown + ;; sh64) basic_machine=sh64-unknown ;; @@ -956,6 +1034,10 @@ tower | tower-32) basic_machine=m68k-ncr ;; + tpf) + basic_machine=s390x-ibm + os=-tpf + ;; udi29k) basic_machine=a29k-amd os=-udi @@ -999,6 +1081,10 @@ basic_machine=hppa1.1-winbond os=-proelf ;; + xbox) + basic_machine=i686-pc + os=-mingw32 + ;; xps | xps100) basic_machine=xps100-honeywell ;; @@ -1029,6 +1115,9 @@ romp) basic_machine=romp-ibm ;; + mmix) + basic_machine=mmix-knuth + ;; rs6000) basic_machine=rs6000-ibm ;; @@ -1045,13 +1134,10 @@ we32k) basic_machine=we32k-att ;; - sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele) + sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; - sh64) - basic_machine=sh64-unknown - ;; - sparc | sparcv9 | sparcv9b) + sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) @@ -1124,19 +1210,23 @@ | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ - | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ + | -openbsd* | -solidbsd* \ + | -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* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -mingw32* | -linux-gnu* | -linux-newlib* | -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*) + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ + | -skyos* | -haiku* | -rdos* | -toppers* | -drops*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1154,12 +1244,15 @@ os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ - | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -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|'` ;; @@ -1172,6 +1265,9 @@ -opened*) os=-openedition ;; + -os400*) + os=-os400 + ;; -wince*) os=-wince ;; @@ -1193,6 +1289,9 @@ -atheos*) os=-atheos ;; + -syllable*) + os=-syllable + ;; -386bsd) os=-bsd ;; @@ -1215,6 +1314,9 @@ -sinix*) os=-sysv4 ;; + -tpf*) + os=-tpf + ;; -triton*) os=-sysv3 ;; @@ -1251,6 +1353,9 @@ -kaos*) os=-kaos ;; + -zvmoe) + os=-zvmoe + ;; -none) ;; *) @@ -1273,6 +1378,12 @@ # system, and we'll never get to this point. case $basic_machine in + score-*) + os=-elf + ;; + spu-*) + os=-elf + ;; *-acorn) os=-riscix1.2 ;; @@ -1282,8 +1393,8 @@ arm*-semi) os=-aout ;; - c4x-* | tic4x-*) - os=-coff + c4x-* | tic4x-*) + os=-coff ;; # This must come before the *-dec entry. pdp10-*) @@ -1310,6 +1421,9 @@ m68*-cisco) os=-aout ;; + mep-*) + os=-elf + ;; mips*-cisco) os=-elf ;; @@ -1328,9 +1442,15 @@ *-be) os=-beos ;; + *-haiku) + os=-haiku + ;; *-ibm) os=-aix ;; + *-knuth) + os=-mmixware + ;; *-wec) os=-proelf ;; @@ -1463,9 +1583,15 @@ -mvs* | -opened*) vendor=ibm ;; + -os400*) + vendor=ibm + ;; -ptx*) vendor=sequent ;; + -tpf*) + vendor=ibm + ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; @@ -1490,7 +1616,7 @@ esac echo $basic_machine$os -exit 0 +exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) --- rdesktop-1.5.0.orig/configure +++ rdesktop-1.5.0/configure @@ -1,25 +1,54 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.59 for rdesktop 1.5.0. +# Generated by GNU Autoconf 2.61 for rdesktop 1.5.0. # -# Copyright (C) 2003 Free Software Foundation, Inc. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +# 2002, 2003, 2004, 2005, 2006 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 +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh 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 + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + + + +# PATH needs CR +# 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 -DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then @@ -29,8 +58,43 @@ fi +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +as_nl=' +' +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +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 +IFS=$as_save_IFS + + ;; +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_myself: error: cannot find myself; rerun with an absolute file name" >&2 + { (exit 1); exit 1; } +fi + # Work around bugs in pre-3.0 UWIN ksh. -$as_unset ENV MAIL MAILPATH +for as_var in ENV MAIL MAILPATH +do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +done PS1='$ ' PS2='> ' PS4='+ ' @@ -44,18 +108,19 @@ 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 + ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var fi done # Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1; then +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi -if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false @@ -63,157 +128,388 @@ # Name of the executable. -as_me=`$as_basename "$0" || +as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)$' \| \ - . : '\(.\)' 2>/dev/null || + X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } - /^X\/\(\/\/\)$/{ s//\1/; q; } - /^X\/\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` +# CDPATH. +$as_unset CDPATH -# 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 +if test "x$CONFIG_SHELL" = x; then + if (eval ":") 2>/dev/null; then + as_have_required=yes +else + as_have_required=no +fi + + if test $as_have_required = yes && (eval ": +(as_func_return () { + (exit \$1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. fi +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +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 +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi - ;; - 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 - '') +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = \"\$1\" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test \$exitcode = 0) || { (exit 1); exit 1; } + +( + as_lineno_1=\$LINENO + as_lineno_2=\$LINENO + test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && + test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } +") 2> /dev/null; then + : +else + as_candidate_shells= 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 + case $as_dir in /*) - if ("$as_dir/$as_base" -c ' + for as_base in sh bash ksh sh5; do + as_candidate_shells="$as_candidate_shells $as_dir/$as_base" + done;; + esac +done +IFS=$as_save_IFS + + + for as_shell in $as_candidate_shells $SHELL; do + # Try only shells that exist, to save several forks. + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { ("$as_shell") 2> /dev/null <<\_ASEOF +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+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + +: +_ASEOF +}; then + CONFIG_SHELL=$as_shell + as_have_required=yes + if { "$as_shell" 2> /dev/null <<\_ASEOF +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+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + +: +(as_func_return () { + (exit $1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = "$1" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test $exitcode = 0) || { (exit 1); exit 1; } + +( 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 + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } + +_ASEOF +}; then + break +fi + +fi + + done + + if test "x$CONFIG_SHELL" != x; then + for as_var in BASH_ENV ENV + do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + done + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} +fi + + + if test $as_have_required = no; then + echo This script requires a shell more modern than all the + echo shells that I found on your system. Please install a + echo modern shell, or manually run the script under such a + echo shell if you do have one. + { (exit 1); exit 1; } +fi + + +fi + +fi + + + +(eval "as_func_return () { + (exit \$1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = \"\$1\" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test \$exitcode = 0") || { + echo No shell found that supports shell functions. + echo Please tell autoconf@gnu.org about your system, + echo including any error possibly output before this + echo message +} + + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # 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. + # line-number line after each line using $LINENO; the second 'sed' + # does the real work. The second script uses 'N' to pair each + # line-number line with the line containing $LINENO, 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 | + # scripts with optimization help from Paolo Bonzini. Blame Lee + # E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno N - s,$,-, - : loop - s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop - s,-$,, - s,^['$as_cr_digits']*\n,, + s/-\n.*// ' >$as_me.lineno && - chmod +x $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 + # original and so on. Autoconf is especially sensitive 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= ;; +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in +-n*) + case `echo 'x\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + *) ECHO_C='\c';; + esac;; +*) + ECHO_N='-n';; esac -if expr a : '\(a\)' >/dev/null 2>&1; then +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir +fi 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='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || 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 +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: @@ -222,7 +518,28 @@ as_mkdir_p=false fi -as_executable_p="test -f" +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x # 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'" @@ -231,39 +548,27 @@ 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 7<&0 &1 # 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_clean_files= ac_config_libobj_dir=. +LIBOBJS= 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='rdesktop' PACKAGE_TARNAME='rdesktop' @@ -275,42 +580,126 @@ # Factoring default headers for most tests. ac_includes_default="\ #include -#if HAVE_SYS_TYPES_H +#ifdef HAVE_SYS_TYPES_H # include #endif -#if HAVE_SYS_STAT_H +#ifdef HAVE_SYS_STAT_H # include #endif -#if STDC_HEADERS +#ifdef STDC_HEADERS # include # include #else -# if HAVE_STDLIB_H +# ifdef HAVE_STDLIB_H # include # endif #endif -#if HAVE_STRING_H -# if !STDC_HEADERS && HAVE_MEMORY_H +#ifdef HAVE_STRING_H +# if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif -#if HAVE_STRINGS_H +#ifdef HAVE_STRINGS_H # include #endif -#if HAVE_INTTYPES_H +#ifdef HAVE_INTTYPES_H # include -#else -# if HAVE_STDINT_H -# include -# endif #endif -#if HAVE_UNISTD_H +#ifdef HAVE_STDINT_H +# include +#endif +#ifdef 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 CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CPP EGREP X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS STRIP ac_ct_STRIP ssldir VNCINC LDVNC VNCLINK RDP2VNCTARGET SOUNDOBJ LIBOBJS LIBICONV build build_cpu build_vendor build_os host host_cpu host_vendor host_os LTLIBOBJS' +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 +datarootdir +datadir +sysconfdir +sharedstatedir +localstatedir +includedir +oldincludedir +docdir +infodir +htmldir +dvidir +pdfdir +psdir +libdir +localedir +mandir +DEFS +ECHO_C +ECHO_N +ECHO_T +LIBS +build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +CPPFLAGS +ac_ct_CC +EXEEXT +OBJEXT +INSTALL_PROGRAM +INSTALL_SCRIPT +INSTALL_DATA +CPP +GREP +EGREP +XMKMF +X_CFLAGS +X_PRE_LIBS +X_LIBS +X_EXTRA_LIBS +PKG_CONFIG +STRIP +ssldir +SCARDOBJ +VNCINC +LDVNC +VNCLINK +RDP2VNCTARGET +SOUNDOBJ +LIBOBJS +LIBICONV +build +build_cpu +build_vendor +build_os +host +host_cpu +host_vendor +host_os +LTLIBOBJS' ac_subst_files='' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +CPP +XMKMF' + # Initialize some variables set by options. ac_init_help= @@ -337,34 +726,48 @@ # 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. +# (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' -datadir='${prefix}/share' +datarootdir='${prefix}/share' +datadir='${datarootdir}' 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' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' ac_prev= +ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then - eval "$ac_prev=\$ac_option" + eval $ac_prev=\$ac_option ac_prev= continue fi - ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` + case $ac_option in + *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *) ac_optarg=yes ;; + esac # Accept the important Cygnus configure options, so we can diagnose typos. - case $ac_option in + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; @@ -386,33 +789,45 @@ --config-cache | -C) cache_file=config.cache ;; - -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ - | --da=*) + -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$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 && + 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" ;; + ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` + eval enable_$ac_feature=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; -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 && + 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'" ;; + ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` + eval enable_$ac_feature=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ @@ -439,6 +854,12 @@ -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$ac_optarg ;; + -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; @@ -463,13 +884,16 @@ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst \ - | --locals | --local | --loca | --loc | --lo) + | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* \ - | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) @@ -534,6 +958,16 @@ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$ac_optarg ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; @@ -586,24 +1020,20 @@ -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 && + 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'" ;; + ac_package=`echo $ac_package | sed 's/[-.]/_/g'` + 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 && + 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" ;; + ac_package=`echo $ac_package | sed 's/[-.]/_/g'` + eval with_$ac_package=no ;; --x) # Obsolete; use --with-x. @@ -634,8 +1064,7 @@ 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'" + eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) @@ -655,27 +1084,19 @@ { (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 +# Be sure to have absolute directory names. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir do - eval ac_val=$`echo $ac_var` + eval ac_val=\$$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; }; };; + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac + { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; } done # There might be people who depend on the old broken behavior: `$host' @@ -702,74 +1123,76 @@ test "$silent" = yes && exec 6>/dev/null +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + { echo "$as_me: error: Working directory cannot be determined" >&2 + { (exit 1); exit 1; }; } +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + { echo "$as_me: error: pwd does not report name of working directory" >&2 + { (exit 1); exit 1; }; } + + # 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 || + # Try the directory containing this script, then the parent directory. + ac_confdir=`$as_dirname -- "$0" || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$0" : 'X\(//\)[^/]' \| \ X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || + 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'` + 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 + 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 +if test ! -r "$srcdir/$ac_unique_file"; then + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } - else - { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&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_CC_set=${CC+set} -ac_env_CC_value=$CC -ac_cv_env_CC_set=${CC+set} -ac_cv_env_CC_value=$CC -ac_env_CFLAGS_set=${CFLAGS+set} -ac_env_CFLAGS_value=$CFLAGS -ac_cv_env_CFLAGS_set=${CFLAGS+set} -ac_cv_env_CFLAGS_value=$CFLAGS -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_CPP_set=${CPP+set} -ac_env_CPP_value=$CPP -ac_cv_env_CPP_set=${CPP+set} -ac_cv_env_CPP_value=$CPP + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done # # Report the --help message. @@ -798,9 +1221,6 @@ -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] @@ -818,15 +1238,22 @@ --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] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/rdesktop] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF @@ -851,6 +1278,9 @@ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-static-openssl link OpenSSL statically + --enable-smartcard Enables smart-card support. + + --enable-static-libsamplerate link libsamplerate statically --disable-largefile omit support for large files Optional Packages: @@ -861,143 +1291,113 @@ --with-egd-socket=PATH look for Entropy Gathering Daemon socket at PATH --with-libvncserver-config=CMD use CMD as libvncserver-config --with-libvncserver make rdp2vnc - --with-libao=DIR look for libao at DIR/include, DIR/lib - --with-sound select sound system ("oss", "sgi", "sun" or "libao") + --with-sound select sound system ("oss", "sgi", "sun", "alsa" or "libao") --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib --with-ipv6 enable IPv6-support --with-debug enable protocol debugging output --with-debug-kbd enable debugging of keyboard handling --with-debug-rdp5 enable debugging of RDP5 code --with-debug-clipboard enable debugging of clipboard code + --with-debug-sound enable debugging of sound code --with-debug-channel enable debugging of virtual channel code + --with-debug-seamless enable debugging of SeamlessRDP code + --with-debug-smartcard enable debugging of smart-card code Some influential environment variables: CC C compiler command CFLAGS 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 + LIBS libraries to pass to the linker, e.g. -l + CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if + you have headers in a nonstandard directory CPP C preprocessor + XMKMF Path to xmkmf, Makefile generator for X Window System Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. _ACEOF +ac_status=$? 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 + test -d "$ac_dir" || continue ac_builddir=. -if test "$ac_dir" != .; then +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) 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 + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix case $srcdir in - .) # No --srcdir option. We are building in place. + .) # 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_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. 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;; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - 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 + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested 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 else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi - cd $ac_popdir + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } done fi -test -n "$ac_init_help" && exit 0 +test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF rdesktop configure 1.5.0 -generated by GNU Autoconf 2.59 +generated by GNU Autoconf 2.61 -Copyright (C) 2003 Free Software Foundation, Inc. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006 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 + exit fi -exec 5>config.log -cat >&5 <<_ACEOF +cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by rdesktop $as_me 1.5.0, which was -generated by GNU Autoconf 2.59. Invocation command line was +generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ _ACEOF +exec 5>>config.log { cat <<_ASUNAME ## --------- ## @@ -1016,7 +1416,7 @@ /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` +/usr/bin/hostinfo = `(/usr/bin/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` @@ -1030,6 +1430,7 @@ test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done +IFS=$as_save_IFS } >&5 @@ -1051,7 +1452,6 @@ ac_configure_args= ac_configure_args0= ac_configure_args1= -ac_sep= ac_must_keep_next=false for ac_pass in 1 2 do @@ -1062,7 +1462,7 @@ -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 @@ -1084,9 +1484,7 @@ -* ) 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=" " + ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac done @@ -1097,8 +1495,8 @@ # 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. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { @@ -1111,20 +1509,34 @@ _ASBOX echo # The following way of writing the cache mishandles newlines in values, -{ +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 +echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + *) $as_unset $ac_var ;; + esac ;; + esac + done (set) 2>&1 | - case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in - *ac_space=\ *) + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) sed -n \ - "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" - ;; + "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" + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; - esac; -} + esac | + sort +) echo cat <<\_ASBOX @@ -1135,22 +1547,28 @@ echo for ac_var in $ac_subst_vars do - eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX -## ------------- ## -## Output files. ## -## ------------- ## +## ------------------- ## +## File substitutions. ## +## ------------------- ## _ASBOX echo for ac_var in $ac_subst_files do - eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + echo "$ac_var='\''$ac_val'\''" done | sort echo fi @@ -1162,26 +1580,24 @@ ## ----------- ## _ASBOX echo - sed "/^$/d" confdefs.h | sort + cat confdefs.h 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 && + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status - ' 0 +' 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 +rm -f -r conftest* confdefs.h # Predefined preprocessor variables. @@ -1212,14 +1628,17 @@ # 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 +if test -n "$CONFIG_SITE"; then + set x "$CONFIG_SITE" +elif test "x$prefix" != xNONE; then + set x "$prefix/share/config.site" "$prefix/etc/config.site" +else + set x "$ac_default_prefix/share/config.site" \ + "$ac_default_prefix/etc/config.site" fi -for ac_site_file in $CONFIG_SITE; do +shift +for ac_site_file +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;} @@ -1235,8 +1654,8 @@ { 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;; + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; esac fi else @@ -1248,12 +1667,11 @@ # 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 +for ac_var in $ac_precious_vars; 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" + 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 @@ -1278,8 +1696,7 @@ # 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=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in @@ -1296,12 +1713,6 @@ { (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 - @@ -1326,6 +1737,11 @@ +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 @@ -1339,8 +1755,8 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -1353,32 +1769,34 @@ 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 + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done +IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi + fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +{ 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_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -1391,36 +1809,51 @@ 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 + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done +IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 + { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi - CC=$ac_ct_CC + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -1433,74 +1866,34 @@ 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 + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done +IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; 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_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # 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_CC="cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - CC=$ac_ct_CC -else - CC="$ac_cv_prog_CC" -fi + fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -1514,7 +1907,7 @@ 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 + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue @@ -1525,6 +1918,7 @@ fi done done +IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. @@ -1542,22 +1936,23 @@ fi CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi + fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then - for ac_prog in cl + for ac_prog in cl.exe 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 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -1570,36 +1965,38 @@ 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 + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done +IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi + test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC - for ac_prog in cl + for ac_prog in cl.exe 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 +{ 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_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -1612,29 +2009,45 @@ 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 + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done +IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 + { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi + test -n "$ac_ct_CC" && break done - CC=$ac_ct_CC + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi fi fi @@ -1647,21 +2060,35 @@ { (exit 1); exit 1; }; } # Provide some information about the compiler. -echo "$as_me:$LINENO:" \ - "checking for C compiler version" >&5 +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_try="$ac_compiler --version >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_try="$ac_compiler -v >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_try="$ac_compiler -V >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler -V >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } @@ -1686,47 +2113,77 @@ # 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 +{ 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 +# +# List of possible output files, starting from the most likely. +# The algorithm is not robust to junk in `.', hence go to wildcards (a.*) +# only as a last resort. b.out is created by i960 compilers. +ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out' +# +# The IRIX 6 linker writes into existing files which may not be +# executable, retaining their permissions. Remove them first so a +# subsequent execution test works. +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { (ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' 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. + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; [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 + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. break;; * ) break;; esac done +test "$ac_cv_exeext" = no && ac_cv_exeext= + else + ac_file='' +fi + +{ echo "$as_me:$LINENO: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6; } +if test -z "$ac_file"; then echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -1738,19 +2195,21 @@ 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 +# Check that 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 +{ 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 + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then @@ -1769,22 +2228,27 @@ fi fi fi -echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 +{ 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 +# Check that 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 +{ 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 { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then @@ -1795,9 +2259,8 @@ 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_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - export ac_cv_exeext break;; * ) break;; esac @@ -1811,14 +2274,14 @@ fi rm -f conftest$ac_cv_exeext -echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 -echo "${ECHO_T}$ac_cv_exeext" >&6 +{ 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 +{ 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 @@ -1838,14 +2301,20 @@ } _ACEOF rm -f conftest.o conftest.obj -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac @@ -1863,12 +2332,12 @@ 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 +{ 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 +{ 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_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -1891,50 +2360,49 @@ } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_compiler_gnu=no + ac_compiler_gnu=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi -echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 -echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 +{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; } GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS -CFLAGS="-g" -echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 -echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; } if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -1950,38 +2418,118 @@ } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + CFLAGS="" + 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 { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + 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 { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_prog_cc_g=no + fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag fi -echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 +{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then @@ -1997,12 +2545,12 @@ CFLAGS= fi fi -echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 -echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 -if test "${ac_cv_prog_cc_stdc+set}" = set; then +{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 +echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } +if test "${ac_cv_prog_cc_c89+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_cv_prog_cc_stdc=no + ac_cv_prog_cc_c89=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -2036,12 +2584,17 @@ /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std1 is added to get + as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std1. */ + that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; @@ -2056,239 +2609,97 @@ return 0; } _ACEOF -# Don't try gcc -ansi; that turns off useful extensions and -# breaks some systems' header files. -# AIX -qlanglvl=ansi -# Ultrix and OSF/1 -std1 -# HP-UX 10.20 and later -Ae -# HP-UX older versions -Aa -D_HPUX_SOURCE -# SVR4 -Xc -D__EXTENSIONS__ -for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_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_cc_stdc=$ac_arg -break + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_c89=$ac_arg else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 + fi -rm -f conftest.err conftest.$ac_objext + +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break done -rm -f conftest.$ac_ext conftest.$ac_objext +rm -f conftest.$ac_ext CC=$ac_save_CC fi - -case "x$ac_cv_prog_cc_stdc" in - x|xno) - echo "$as_me:$LINENO: result: none needed" >&5 -echo "${ECHO_T}none needed" >&6 ;; +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6; } ;; + xno) + { echo "$as_me:$LINENO: result: unsupported" >&5 +echo "${ECHO_T}unsupported" >&6; } ;; *) - echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 - CC="$CC $ac_cv_prog_cc_stdc" ;; + CC="$CC $ac_cv_prog_cc_c89" + { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; esac -# Some people use a C++ compiler to compile C. Since we use `exit', -# in C++ we need to declare it. In case someone uses the same compiler -# for both compiling C and C++ we need to have the C++ compiler decide -# the declaration of exit, since it's the most demanding environment. -cat >conftest.$ac_ext <<_ACEOF -#ifndef __cplusplus - choke me -#endif -_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_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_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 - 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_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_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_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_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 - -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 -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 - -if test "$GCC" = yes; then - CFLAGS="$CFLAGS -Wall" +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 + +if test "$GCC" = yes; then + CFLAGS="$CFLAGS -Wall" fi ac_aux_dir= -for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do - if test -f $ac_dir/install-sh; then +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 + 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 + 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;} + { { 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. + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. +ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. +ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. + # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or @@ -2303,8 +2714,8 @@ # 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 +{ 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 @@ -2326,7 +2737,7 @@ # 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 -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$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. @@ -2345,21 +2756,22 @@ ;; esac done +IFS=$as_save_IFS 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 + # As a last resort, use the slow shell script. Don't cache a + # value 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. + # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi -echo "$as_me:$LINENO: result: $INSTALL" >&5 -echo "${ECHO_T}$INSTALL" >&6 +{ 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. @@ -2381,8 +2793,8 @@ 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 -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 +{ 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; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -2416,24 +2828,22 @@ #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 +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then : else echo "$as_me: failed program was:" >&5 @@ -2442,9 +2852,10 @@ # 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 + # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -2454,24 +2865,22 @@ /* 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 +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then # Broken: success on invalid input. continue else @@ -2482,6 +2891,7 @@ ac_preproc_ok=: break fi + rm -f conftest.err conftest.$ac_ext done @@ -2499,8 +2909,8 @@ else ac_cv_prog_CPP=$CPP fi -echo "$as_me:$LINENO: result: $CPP" >&5 -echo "${ECHO_T}$CPP" >&6 +{ echo "$as_me:$LINENO: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do @@ -2523,24 +2933,22 @@ #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 +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then : else echo "$as_me: failed program was:" >&5 @@ -2549,9 +2957,10 @@ # 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 + # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -2561,24 +2970,22 @@ /* 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 +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then # Broken: success on invalid input. continue else @@ -2589,6 +2996,7 @@ ac_preproc_ok=: break fi + rm -f conftest.err conftest.$ac_ext done @@ -2611,23 +3019,170 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu -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 "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 +echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; } +if test "${ac_cv_path_GREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Extract the first word of "grep ggrep" to use in msg output +if test -z "$GREP"; then +set dummy grep ggrep; ac_prog_name=$2 +if test "${ac_cv_path_GREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_path_GREP_found=false +# Loop through the user's path and test for each of PROGNAME-LIST +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue + # Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + ac_count=`expr $ac_count + 1` + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + + $ac_path_GREP_found && break 3 + done +done + +done +IFS=$as_save_IFS + + +fi + +GREP="$ac_cv_path_GREP" +if test -z "$GREP"; then + { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} + { (exit 1); exit 1; }; } +fi + +else + ac_cv_path_GREP=$GREP +fi + + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 +echo "${ECHO_T}$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ echo "$as_me:$LINENO: checking for egrep" >&5 +echo $ECHO_N "checking for egrep... $ECHO_C" >&6; } +if test "${ac_cv_path_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_path_EGREP="$GREP -E" + else + # Extract the first word of "egrep" to use in msg output +if test -z "$EGREP"; then +set dummy egrep; ac_prog_name=$2 +if test "${ac_cv_path_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' + ac_path_EGREP_found=false +# Loop through the user's path and test for each of PROGNAME-LIST +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue + # Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + ac_count=`expr $ac_count + 1` + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + + $ac_path_EGREP_found && break 3 + done +done + +done +IFS=$as_save_IFS + + +fi + +EGREP="$ac_cv_path_EGREP" +if test -z "$EGREP"; then + { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} + { (exit 1); exit 1; }; } fi -echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 -echo "${ECHO_T}$ac_cv_prog_egrep" >&6 - EGREP=$ac_cv_prog_egrep + +else + ac_cv_path_EGREP=$EGREP +fi + + + fi +fi +{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 +echo "${ECHO_T}$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" -echo "$as_me:$LINENO: checking for ANSI C header files" >&5 -echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 +{ 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 @@ -2651,35 +3206,31 @@ } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; 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 + ac_cv_header_stdc=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +rm -f core 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. @@ -2735,6 +3286,7 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include +#include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) @@ -2754,18 +3306,27 @@ for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) - exit(2); - exit (0); + return 2; + return 0; } _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then @@ -2778,12 +3339,14 @@ ( 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 +rm -f core *.core core.conftest.* 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 +{ 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 @@ -2792,8 +3355,77 @@ fi -echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5 -echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6 +# 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 { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; 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 core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&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 + + +{ echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5 +echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6; } if test "${ac_cv_c_bigendian+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -2810,7 +3442,8 @@ int main () { -#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN +#if ! (defined BYTE_ORDER && defined BIG_ENDIAN && defined LITTLE_ENDIAN \ + && BYTE_ORDER && BIG_ENDIAN && LITTLE_ENDIAN) bogus endian macros #endif @@ -2819,27 +3452,22 @@ } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then # It does; now see whether it defined to BIG_ENDIAN or not. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -2862,40 +3490,36 @@ } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_c_bigendian=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_c_bigendian=no + ac_cv_c_bigendian=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -# It does not; compile a test program. + # It does not; compile a test program. if test "$cross_compiling" = yes; then # try to guess the endianness by grepping values into an object file ac_cv_c_bigendian=unknown @@ -2905,11 +3529,11 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -short ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; -short ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; +short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; +short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; } -short ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; -short ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; +short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; +short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; } int main () @@ -2920,27 +3544,22 @@ } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then ac_cv_c_bigendian=yes fi @@ -2956,8 +3575,10 @@ echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 + fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -2965,27 +3586,41 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +$ac_includes_default int main () { + /* Are we little or big endian? From Harbison&Steele. */ union { - long l; - char c[sizeof (long)]; + long int l; + char c[sizeof (long int)]; } u; u.l = 1; - exit (u.c[sizeof (long) - 1] == 1); + return u.c[sizeof (long int) - 1] == 1; + + ; + return 0; } _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then @@ -2998,13 +3633,16 @@ ( exit $ac_status ) ac_cv_c_bigendian=yes fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi + + fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5 -echo "${ECHO_T}$ac_cv_c_bigendian" >&6 +{ echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5 +echo "${ECHO_T}$ac_cv_c_bigendian" >&6; } case $ac_cv_c_bigendian in yes) cat >>confdefs.h <<\_ACEOF @@ -3024,44 +3662,49 @@ { (exit 1); exit 1; }; } ;; esac -echo "$as_me:$LINENO: checking for X" >&5 -echo $ECHO_N "checking for X... $ECHO_C" >&6 +{ 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. +# Check whether --with-x was given. if test "${with_x+set}" = set; then - withval="$with_x" + withval=$with_x; +fi -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 + case $x_includes,$x_libraries in #( + *\'*) { { echo "$as_me:$LINENO: error: Cannot use X directory names containing '" >&5 +echo "$as_me: error: Cannot use X directory names containing '" >&2;} + { (exit 1); exit 1; }; };; #( + *,NONE | NONE,*) 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 +rm -f -r 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}"' +incroot: + @echo incroot='${INCROOT}' +usrlibdir: + @echo usrlibdir='${USRLIBDIR}' +libdir: + @echo libdir='${LIBDIR}' _ACEOF - if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then + if (export CC; ${XMKMF-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` + for ac_var in incroot usrlibdir libdir; do + eval "ac_im_$ac_var=\`\${MAKE-make} $ac_var 2>/dev/null | sed -n 's/^$ac_var=//p'\`" + done # 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 + 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 @@ -3069,7 +3712,7 @@ # 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) ;; + /usr/include) ac_x_includes= ;; *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;; esac case $ac_im_usrlibdir in @@ -3078,7 +3721,7 @@ esac fi cd .. - rm -fr conftest.dir + rm -f -r conftest.dir fi # Standard set of common directories for X headers. @@ -3119,7 +3762,7 @@ /usr/openwin/share/include' if test "$ac_x_includes" = no; then - # Guess where to find include files, by looking for Intrinsic.h. + # Guess where to find include files, by looking for Xlib.h. # First, try using that file with no special directory specified. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -3127,26 +3770,24 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include +#include _ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then # We can compile using X headers with no special include directory. ac_x_includes= else @@ -3154,12 +3795,13 @@ sed 's/^/| /' conftest.$ac_ext >&5 for ac_dir in $ac_x_header_dirs; do - if test -r "$ac_dir/X11/Intrinsic.h"; then + if test -r "$ac_dir/X11/Xlib.h"; then ac_x_includes=$ac_dir break fi done fi + rm -f conftest.err conftest.$ac_ext fi # $ac_x_includes = no @@ -3168,44 +3810,40 @@ # See if we find them without any special options. # Don't add to $LIBS permanently. ac_save_LIBS=$LIBS - LIBS="-lXt $LIBS" + LIBS="-lX11 $LIBS" 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 () { -XtMalloc (0) +XrmInitialize () ; 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 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then LIBS=$ac_save_LIBS # We can link X programs with no special library path. ac_x_libraries= @@ -3213,49 +3851,54 @@ echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -LIBS=$ac_save_LIBS + 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 + if test -r "$ac_dir/libX11.$ac_extension"; then ac_x_libraries=$ac_dir break 2 fi done done fi -rm -f conftest.err conftest.$ac_objext \ + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ 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 +case $ac_x_includes,$ac_x_libraries in #( + no,* | *,no | *\'*) + # Didn't find X, or a directory has "'" in its name. + ac_cv_have_x="have_x=no";; #( + *) + # 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'" +esac fi - - fi +;; #( + *) have_x=yes;; + esac 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 + { 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 + 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 @@ -3276,12 +3919,12 @@ 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 + { 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" + ac_xsave_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -3297,43 +3940,32 @@ } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_R_nospace=yes + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + X_LIBS="$X_LIBS -R$x_libraries" 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 + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -3349,47 +3981,42 @@ } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_R_space=yes + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + X_LIBS="$X_LIBS -R $x_libraries" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_R_space=no + { echo "$as_me:$LINENO: result: neither works" >&5 +echo "${ECHO_T}neither works" >&6; } +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext fi -rm -f conftest.err conftest.$ac_objext \ + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ 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 + ac_c_werror_flag=$ac_xsave_c_werror_flag + LIBS=$ac_xsave_LIBS fi # Check for system-dependent libraries X programs must link with. @@ -3410,50 +4037,46 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Override any gcc2 internal prototype to avoid an error. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ #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 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 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; 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 + { 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 @@ -3466,63 +4089,60 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Override any gcc2 internal prototype to avoid an error. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ #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 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 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; 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 + ac_cv_lib_dnet_dnet_ntoa=no fi -rm -f conftest.err conftest.$ac_objext \ + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ 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 +{ 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 + { 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 @@ -3535,63 +4155,61 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Override any gcc2 internal prototype to avoid an error. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ #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 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 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; 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 + ac_cv_lib_dnet_stub_dnet_ntoa=no fi -rm -f conftest.err conftest.$ac_objext \ + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ 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 +{ 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 \ + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS="$ac_xsave_LIBS" @@ -3603,8 +4221,8 @@ # 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 + { 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 @@ -3631,72 +4249,63 @@ #undef gethostbyname -/* Override any gcc2 internal prototype to avoid an error. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ #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) +#if defined __stub_gethostbyname || defined __stub___gethostbyname choke me -#else -char (*f) () = gethostbyname; -#endif -#ifdef __cplusplus -} #endif int main () { -return f != gethostbyname; +return 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 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; 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 + ac_cv_func_gethostbyname=no fi -rm -f conftest.err conftest.$ac_objext \ + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ 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 +{ 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 + { 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 @@ -3709,63 +4318,60 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Override any gcc2 internal prototype to avoid an error. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ #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 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 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; 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 + ac_cv_lib_nsl_gethostbyname=no fi -rm -f conftest.err conftest.$ac_objext \ + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ 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 +{ 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 + { 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 @@ -3778,56 +4384,53 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Override any gcc2 internal prototype to avoid an error. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ #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 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 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; 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 + ac_cv_lib_bsd_gethostbyname=no fi -rm -f conftest.err conftest.$ac_objext \ + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ 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 +{ 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 @@ -3842,8 +4445,8 @@ # 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 + { 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 @@ -3870,72 +4473,63 @@ #undef connect -/* Override any gcc2 internal prototype to avoid an error. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ #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) +#if defined __stub_connect || defined __stub___connect choke me -#else -char (*f) () = connect; -#endif -#ifdef __cplusplus -} #endif int main () { -return f != connect; +return 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 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; 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 + ac_cv_func_connect=no fi -rm -f conftest.err conftest.$ac_objext \ + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ 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 +{ 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 + { 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 @@ -3948,56 +4542,53 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Override any gcc2 internal prototype to avoid an error. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ #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 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 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; 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 + ac_cv_lib_socket_connect=no fi -rm -f conftest.err conftest.$ac_objext \ + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ 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 +{ 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 @@ -4005,8 +4596,8 @@ 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 + { 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 @@ -4033,72 +4624,63 @@ #undef remove -/* Override any gcc2 internal prototype to avoid an error. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ #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) +#if defined __stub_remove || defined __stub___remove choke me -#else -char (*f) () = remove; -#endif -#ifdef __cplusplus -} #endif int main () { -return f != remove; +return 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 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; 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 + ac_cv_func_remove=no fi -rm -f conftest.err conftest.$ac_objext \ + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ 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 +{ 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 + { 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 @@ -4111,56 +4693,53 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Override any gcc2 internal prototype to avoid an error. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ #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 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 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; 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 + ac_cv_lib_posix_remove=no fi -rm -f conftest.err conftest.$ac_objext \ + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ 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 +{ 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 @@ -4168,8 +4747,8 @@ 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 + { 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 @@ -4196,72 +4775,63 @@ #undef shmat -/* Override any gcc2 internal prototype to avoid an error. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ #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) +#if defined __stub_shmat || defined __stub___shmat choke me -#else -char (*f) () = shmat; -#endif -#ifdef __cplusplus -} #endif int main () { -return f != shmat; +return 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 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; 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 + ac_cv_func_shmat=no fi -rm -f conftest.err conftest.$ac_objext \ + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ 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 +{ 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 + { 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 @@ -4274,56 +4844,53 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Override any gcc2 internal prototype to avoid an error. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ #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 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 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; 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 + ac_cv_lib_ipc_shmat=no fi -rm -f conftest.err conftest.$ac_objext \ + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ 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 +{ 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 @@ -4340,8 +4907,8 @@ # 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 + { 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 @@ -4354,56 +4921,53 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Override any gcc2 internal prototype to avoid an error. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ #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 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 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; 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 + ac_cv_lib_ICE_IceConnectionNumber=no fi -rm -f conftest.err conftest.$ac_objext \ + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ 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 +{ 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 @@ -4413,13 +4977,53 @@ fi -echo "$as_me:$LINENO: checking for library containing socket" >&5 -echo $ECHO_N "checking for library containing socket... $ECHO_C" >&6 +# Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; 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_path_PKG_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + { echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 +echo "${ECHO_T}$PKG_CONFIG" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + +{ echo "$as_me:$LINENO: checking for library containing socket" >&5 +echo $ECHO_N "checking for library containing socket... $ECHO_C" >&6; } if test "${ac_cv_search_socket+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_func_search_save_LIBS=$LIBS -ac_cv_search_socket=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -4427,125 +5031,82 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Override any gcc2 internal prototype to avoid an error. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ #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 socket (); int main () { -socket (); +return socket (); ; 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 +for ac_lib in '' socket; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_search_socket="none required" + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_search_socket=$ac_res else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test "$ac_cv_search_socket" = no; then - for ac_lib in socket; do - LIBS="-l$ac_lib $ac_func_search_save_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 socket (); -int -main () -{ -socket (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_search_socket="-l$ac_lib" -break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +fi +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext + if test "${ac_cv_search_socket+set}" = set; then + break fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - done +done +if test "${ac_cv_search_socket+set}" = set; then + : +else + ac_cv_search_socket=no fi +rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi -echo "$as_me:$LINENO: result: $ac_cv_search_socket" >&5 -echo "${ECHO_T}$ac_cv_search_socket" >&6 -if test "$ac_cv_search_socket" != no; then - test "$ac_cv_search_socket" = "none required" || LIBS="$ac_cv_search_socket $LIBS" +{ echo "$as_me:$LINENO: result: $ac_cv_search_socket" >&5 +echo "${ECHO_T}$ac_cv_search_socket" >&6; } +ac_res=$ac_cv_search_socket +if test "$ac_res" != no; then + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi -echo "$as_me:$LINENO: checking for library containing inet_aton" >&5 -echo $ECHO_N "checking for library containing inet_aton... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking for library containing inet_aton" >&5 +echo $ECHO_N "checking for library containing inet_aton... $ECHO_C" >&6; } if test "${ac_cv_search_inet_aton+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_func_search_save_LIBS=$LIBS -ac_cv_search_inet_aton=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -4553,203 +5114,89 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Override any gcc2 internal prototype to avoid an error. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ #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 inet_aton (); int main () { -inet_aton (); +return inet_aton (); ; 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 +for ac_lib in '' resolv; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_search_inet_aton="none required" + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_search_inet_aton=$ac_res else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 + fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test "$ac_cv_search_inet_aton" = no; then - for ac_lib in resolv; do - LIBS="-l$ac_lib $ac_func_search_save_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 inet_aton (); -int -main () -{ -inet_aton (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_search_inet_aton="-l$ac_lib" -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_exeext conftest.$ac_ext - done -fi -LIBS=$ac_func_search_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_search_inet_aton" >&5 -echo "${ECHO_T}$ac_cv_search_inet_aton" >&6 -if test "$ac_cv_search_inet_aton" != no; then - test "$ac_cv_search_inet_aton" = "none required" || LIBS="$ac_cv_search_inet_aton $LIBS" +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext + if test "${ac_cv_search_inet_aton+set}" = set; then + break 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_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_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" +done +if test "${ac_cv_search_inet_aton+set}" = set; then + : else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_Header=no" + ac_cv_search_inet_aton=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS 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 +{ echo "$as_me:$LINENO: result: $ac_cv_search_inet_aton" >&5 +echo "${ECHO_T}$ac_cv_search_inet_aton" >&6; } +ac_res=$ac_cv_search_inet_aton +if test "$ac_res" != no; then + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi -done - if test "${ac_cv_header_sys_select_h+set}" = set; then - echo "$as_me:$LINENO: checking for sys/select.h" >&5 -echo $ECHO_N "checking for sys/select.h... $ECHO_C" >&6 + { echo "$as_me:$LINENO: checking for sys/select.h" >&5 +echo $ECHO_N "checking for sys/select.h... $ECHO_C" >&6; } if test "${ac_cv_header_sys_select_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi -echo "$as_me:$LINENO: result: $ac_cv_header_sys_select_h" >&5 -echo "${ECHO_T}$ac_cv_header_sys_select_h" >&6 +{ echo "$as_me:$LINENO: result: $ac_cv_header_sys_select_h" >&5 +echo "${ECHO_T}$ac_cv_header_sys_select_h" >&6; } else # Is the header compilable? -echo "$as_me:$LINENO: checking sys/select.h usability" >&5 -echo $ECHO_N "checking sys/select.h usability... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking sys/select.h usability" >&5 +echo $ECHO_N "checking sys/select.h usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -4760,41 +5207,37 @@ #include _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_header_compiler=no + 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 + +rm -f core 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 sys/select.h presence" >&5 -echo $ECHO_N "checking sys/select.h presence... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking sys/select.h presence" >&5 +echo $ECHO_N "checking sys/select.h presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -4803,24 +5246,22 @@ /* 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 +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 @@ -4828,9 +5269,10 @@ 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 +{ 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_c_preproc_warn_flag in @@ -4854,25 +5296,18 @@ echo "$as_me: WARNING: sys/select.h: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: sys/select.h: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: sys/select.h: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## ----------------------------------- ## -## Report this to the rdesktop lists. ## -## ----------------------------------- ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 + ;; esac -echo "$as_me:$LINENO: checking for sys/select.h" >&5 -echo $ECHO_N "checking for sys/select.h... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking for sys/select.h" >&5 +echo $ECHO_N "checking for sys/select.h... $ECHO_C" >&6; } if test "${ac_cv_header_sys_select_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_sys_select_h=$ac_header_preproc fi -echo "$as_me:$LINENO: result: $ac_cv_header_sys_select_h" >&5 -echo "${ECHO_T}$ac_cv_header_sys_select_h" >&6 +{ echo "$as_me:$LINENO: result: $ac_cv_header_sys_select_h" >&5 +echo "${ECHO_T}$ac_cv_header_sys_select_h" >&6; } fi if test $ac_cv_header_sys_select_h = yes; then @@ -4884,17 +5319,17 @@ if test "${ac_cv_header_sys_modem_h+set}" = set; then - echo "$as_me:$LINENO: checking for sys/modem.h" >&5 -echo $ECHO_N "checking for sys/modem.h... $ECHO_C" >&6 + { echo "$as_me:$LINENO: checking for sys/modem.h" >&5 +echo $ECHO_N "checking for sys/modem.h... $ECHO_C" >&6; } if test "${ac_cv_header_sys_modem_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi -echo "$as_me:$LINENO: result: $ac_cv_header_sys_modem_h" >&5 -echo "${ECHO_T}$ac_cv_header_sys_modem_h" >&6 +{ echo "$as_me:$LINENO: result: $ac_cv_header_sys_modem_h" >&5 +echo "${ECHO_T}$ac_cv_header_sys_modem_h" >&6; } else # Is the header compilable? -echo "$as_me:$LINENO: checking sys/modem.h usability" >&5 -echo $ECHO_N "checking sys/modem.h usability... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking sys/modem.h usability" >&5 +echo $ECHO_N "checking sys/modem.h usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -4905,41 +5340,37 @@ #include _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_header_compiler=no + 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 + +rm -f core 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 sys/modem.h presence" >&5 -echo $ECHO_N "checking sys/modem.h presence... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking sys/modem.h presence" >&5 +echo $ECHO_N "checking sys/modem.h presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -4948,24 +5379,22 @@ /* 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 +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 @@ -4973,9 +5402,10 @@ 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 +{ 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_c_preproc_warn_flag in @@ -4999,25 +5429,18 @@ echo "$as_me: WARNING: sys/modem.h: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: sys/modem.h: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: sys/modem.h: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## ----------------------------------- ## -## Report this to the rdesktop lists. ## -## ----------------------------------- ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 + ;; esac -echo "$as_me:$LINENO: checking for sys/modem.h" >&5 -echo $ECHO_N "checking for sys/modem.h... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking for sys/modem.h" >&5 +echo $ECHO_N "checking for sys/modem.h... $ECHO_C" >&6; } if test "${ac_cv_header_sys_modem_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_sys_modem_h=$ac_header_preproc fi -echo "$as_me:$LINENO: result: $ac_cv_header_sys_modem_h" >&5 -echo "${ECHO_T}$ac_cv_header_sys_modem_h" >&6 +{ echo "$as_me:$LINENO: result: $ac_cv_header_sys_modem_h" >&5 +echo "${ECHO_T}$ac_cv_header_sys_modem_h" >&6; } fi if test $ac_cv_header_sys_modem_h = yes; then @@ -5029,17 +5452,17 @@ if test "${ac_cv_header_sys_filio_h+set}" = set; then - echo "$as_me:$LINENO: checking for sys/filio.h" >&5 -echo $ECHO_N "checking for sys/filio.h... $ECHO_C" >&6 + { echo "$as_me:$LINENO: checking for sys/filio.h" >&5 +echo $ECHO_N "checking for sys/filio.h... $ECHO_C" >&6; } if test "${ac_cv_header_sys_filio_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi -echo "$as_me:$LINENO: result: $ac_cv_header_sys_filio_h" >&5 -echo "${ECHO_T}$ac_cv_header_sys_filio_h" >&6 +{ echo "$as_me:$LINENO: result: $ac_cv_header_sys_filio_h" >&5 +echo "${ECHO_T}$ac_cv_header_sys_filio_h" >&6; } else # Is the header compilable? -echo "$as_me:$LINENO: checking sys/filio.h usability" >&5 -echo $ECHO_N "checking sys/filio.h usability... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking sys/filio.h usability" >&5 +echo $ECHO_N "checking sys/filio.h usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -5050,41 +5473,37 @@ #include _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_header_compiler=no + 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 + +rm -f core 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 sys/filio.h presence" >&5 -echo $ECHO_N "checking sys/filio.h presence... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking sys/filio.h presence" >&5 +echo $ECHO_N "checking sys/filio.h presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -5093,24 +5512,22 @@ /* 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 +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 @@ -5118,9 +5535,10 @@ 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 +{ 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_c_preproc_warn_flag in @@ -5144,25 +5562,18 @@ echo "$as_me: WARNING: sys/filio.h: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: sys/filio.h: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: sys/filio.h: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## ----------------------------------- ## -## Report this to the rdesktop lists. ## -## ----------------------------------- ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 + ;; esac -echo "$as_me:$LINENO: checking for sys/filio.h" >&5 -echo $ECHO_N "checking for sys/filio.h... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking for sys/filio.h" >&5 +echo $ECHO_N "checking for sys/filio.h... $ECHO_C" >&6; } if test "${ac_cv_header_sys_filio_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_sys_filio_h=$ac_header_preproc fi -echo "$as_me:$LINENO: result: $ac_cv_header_sys_filio_h" >&5 -echo "${ECHO_T}$ac_cv_header_sys_filio_h" >&6 +{ echo "$as_me:$LINENO: result: $ac_cv_header_sys_filio_h" >&5 +echo "${ECHO_T}$ac_cv_header_sys_filio_h" >&6; } fi if test $ac_cv_header_sys_filio_h = yes; then @@ -5174,17 +5585,17 @@ if test "${ac_cv_header_sys_strtio_h+set}" = set; then - echo "$as_me:$LINENO: checking for sys/strtio.h" >&5 -echo $ECHO_N "checking for sys/strtio.h... $ECHO_C" >&6 + { echo "$as_me:$LINENO: checking for sys/strtio.h" >&5 +echo $ECHO_N "checking for sys/strtio.h... $ECHO_C" >&6; } if test "${ac_cv_header_sys_strtio_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi -echo "$as_me:$LINENO: result: $ac_cv_header_sys_strtio_h" >&5 -echo "${ECHO_T}$ac_cv_header_sys_strtio_h" >&6 +{ echo "$as_me:$LINENO: result: $ac_cv_header_sys_strtio_h" >&5 +echo "${ECHO_T}$ac_cv_header_sys_strtio_h" >&6; } else # Is the header compilable? -echo "$as_me:$LINENO: checking sys/strtio.h usability" >&5 -echo $ECHO_N "checking sys/strtio.h usability... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking sys/strtio.h usability" >&5 +echo $ECHO_N "checking sys/strtio.h usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -5195,41 +5606,37 @@ #include _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_header_compiler=no + 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 + +rm -f core 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 sys/strtio.h presence" >&5 -echo $ECHO_N "checking sys/strtio.h presence... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking sys/strtio.h presence" >&5 +echo $ECHO_N "checking sys/strtio.h presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -5238,24 +5645,22 @@ /* 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 +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 @@ -5263,9 +5668,10 @@ 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 +{ 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_c_preproc_warn_flag in @@ -5289,25 +5695,18 @@ echo "$as_me: WARNING: sys/strtio.h: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: sys/strtio.h: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: sys/strtio.h: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## ----------------------------------- ## -## Report this to the rdesktop lists. ## -## ----------------------------------- ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 + ;; esac -echo "$as_me:$LINENO: checking for sys/strtio.h" >&5 -echo $ECHO_N "checking for sys/strtio.h... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking for sys/strtio.h" >&5 +echo $ECHO_N "checking for sys/strtio.h... $ECHO_C" >&6; } if test "${ac_cv_header_sys_strtio_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_sys_strtio_h=$ac_header_preproc fi -echo "$as_me:$LINENO: result: $ac_cv_header_sys_strtio_h" >&5 -echo "${ECHO_T}$ac_cv_header_sys_strtio_h" >&6 +{ echo "$as_me:$LINENO: result: $ac_cv_header_sys_strtio_h" >&5 +echo "${ECHO_T}$ac_cv_header_sys_strtio_h" >&6; } fi if test $ac_cv_header_sys_strtio_h = yes; then @@ -5319,17 +5718,17 @@ if test "${ac_cv_header_locale_h+set}" = set; then - echo "$as_me:$LINENO: checking for locale.h" >&5 -echo $ECHO_N "checking for locale.h... $ECHO_C" >&6 + { echo "$as_me:$LINENO: checking for locale.h" >&5 +echo $ECHO_N "checking for locale.h... $ECHO_C" >&6; } if test "${ac_cv_header_locale_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi -echo "$as_me:$LINENO: result: $ac_cv_header_locale_h" >&5 -echo "${ECHO_T}$ac_cv_header_locale_h" >&6 +{ echo "$as_me:$LINENO: result: $ac_cv_header_locale_h" >&5 +echo "${ECHO_T}$ac_cv_header_locale_h" >&6; } else # Is the header compilable? -echo "$as_me:$LINENO: checking locale.h usability" >&5 -echo $ECHO_N "checking locale.h usability... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking locale.h usability" >&5 +echo $ECHO_N "checking locale.h usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -5340,41 +5739,37 @@ #include _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_header_compiler=no + 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 + +rm -f core 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 locale.h presence" >&5 -echo $ECHO_N "checking locale.h presence... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking locale.h presence" >&5 +echo $ECHO_N "checking locale.h presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -5383,24 +5778,22 @@ /* 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 +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 @@ -5408,9 +5801,10 @@ 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 +{ 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_c_preproc_warn_flag in @@ -5434,25 +5828,18 @@ echo "$as_me: WARNING: locale.h: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: locale.h: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: locale.h: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## ----------------------------------- ## -## Report this to the rdesktop lists. ## -## ----------------------------------- ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 + ;; esac -echo "$as_me:$LINENO: checking for locale.h" >&5 -echo $ECHO_N "checking for locale.h... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking for locale.h" >&5 +echo $ECHO_N "checking for locale.h... $ECHO_C" >&6; } if test "${ac_cv_header_locale_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_locale_h=$ac_header_preproc fi -echo "$as_me:$LINENO: result: $ac_cv_header_locale_h" >&5 -echo "${ECHO_T}$ac_cv_header_locale_h" >&6 +{ echo "$as_me:$LINENO: result: $ac_cv_header_locale_h" >&5 +echo "${ECHO_T}$ac_cv_header_locale_h" >&6; } fi if test $ac_cv_header_locale_h = yes; then @@ -5464,17 +5851,17 @@ if test "${ac_cv_header_langinfo_h+set}" = set; then - echo "$as_me:$LINENO: checking for langinfo.h" >&5 -echo $ECHO_N "checking for langinfo.h... $ECHO_C" >&6 + { echo "$as_me:$LINENO: checking for langinfo.h" >&5 +echo $ECHO_N "checking for langinfo.h... $ECHO_C" >&6; } if test "${ac_cv_header_langinfo_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi -echo "$as_me:$LINENO: result: $ac_cv_header_langinfo_h" >&5 -echo "${ECHO_T}$ac_cv_header_langinfo_h" >&6 +{ echo "$as_me:$LINENO: result: $ac_cv_header_langinfo_h" >&5 +echo "${ECHO_T}$ac_cv_header_langinfo_h" >&6; } else # Is the header compilable? -echo "$as_me:$LINENO: checking langinfo.h usability" >&5 -echo $ECHO_N "checking langinfo.h usability... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking langinfo.h usability" >&5 +echo $ECHO_N "checking langinfo.h usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -5485,41 +5872,37 @@ #include _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_header_compiler=no + 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 + +rm -f core 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 langinfo.h presence" >&5 -echo $ECHO_N "checking langinfo.h presence... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking langinfo.h presence" >&5 +echo $ECHO_N "checking langinfo.h presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -5528,24 +5911,22 @@ /* 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 +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 @@ -5553,9 +5934,10 @@ 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 +{ 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_c_preproc_warn_flag in @@ -5579,25 +5961,18 @@ echo "$as_me: WARNING: langinfo.h: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: langinfo.h: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: langinfo.h: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## ----------------------------------- ## -## Report this to the rdesktop lists. ## -## ----------------------------------- ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 + ;; esac -echo "$as_me:$LINENO: checking for langinfo.h" >&5 -echo $ECHO_N "checking for langinfo.h... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking for langinfo.h" >&5 +echo $ECHO_N "checking for langinfo.h... $ECHO_C" >&6; } if test "${ac_cv_header_langinfo_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_langinfo_h=$ac_header_preproc fi -echo "$as_me:$LINENO: result: $ac_cv_header_langinfo_h" >&5 -echo "${ECHO_T}$ac_cv_header_langinfo_h" >&6 +{ echo "$as_me:$LINENO: result: $ac_cv_header_langinfo_h" >&5 +echo "${ECHO_T}$ac_cv_header_langinfo_h" >&6; } fi if test $ac_cv_header_langinfo_h = yes; then @@ -5612,8 +5987,8 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -5626,32 +6001,34 @@ 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 + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done +IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then - echo "$as_me:$LINENO: result: $STRIP" >&5 -echo "${ECHO_T}$STRIP" >&6 + { echo "$as_me:$LINENO: result: $STRIP" >&5 +echo "${ECHO_T}$STRIP" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi + fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +{ 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_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -5664,32 +6041,51 @@ 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 + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_STRIP="strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done +IFS=$as_save_IFS - test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then - echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 -echo "${ECHO_T}$ac_ct_STRIP" >&6 + { echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 +echo "${ECHO_T}$ac_ct_STRIP" >&6; } else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi - STRIP=$ac_ct_STRIP + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi else STRIP="$ac_cv_prog_STRIP" fi + + + + + rpath="" # @@ -5702,13 +6098,12 @@ fi return 1 } -echo "$as_me:$LINENO: checking for OpenSSL directory" >&5 -echo $ECHO_N "checking for OpenSSL directory... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking for OpenSSL directory" >&5 +echo $ECHO_N "checking for OpenSSL directory... $ECHO_C" >&6; } -# Check whether --with-openssl or --without-openssl was given. +# Check whether --with-openssl was given. if test "${with_openssl+set}" = set; then - withval="$with_openssl" - + withval=$with_openssl; checkssldir "$withval" else @@ -5720,18 +6115,19 @@ done -fi; +fi + if test -z "$ssldir"; then - echo "$as_me:$LINENO: result: Not found" >&5 -echo "${ECHO_T}Not found" >&6 + { echo "$as_me:$LINENO: result: Not found" >&5 +echo "${ECHO_T}Not found" >&6; } echo echo "Couldn't find your OpenSSL library installation dir" echo "Use --with-openssl option to fix this problem" echo exit 1 fi -echo "$as_me:$LINENO: result: $ssldir" >&5 -echo "${ECHO_T}$ssldir" >&6 +{ echo "$as_me:$LINENO: result: $ssldir" >&5 +echo "${ECHO_T}$ssldir" >&6; } cat >>confdefs.h <<_ACEOF #define ssldir "$ssldir" @@ -5739,10 +6135,9 @@ CFLAGS="$CFLAGS -I$ssldir/include" -# Check whether --enable-static-openssl or --disable-static-openssl was given. +# Check whether --enable-static-openssl was given. if test "${enable_static_openssl+set}" = set; then - enableval="$enable_static_openssl" - + enableval=$enable_static_openssl; LIBS="$LIBS $ssldir/lib/libcrypto.a" else @@ -5750,299 +6145,330 @@ LIBS="$LIBS -L$ssldir/lib -lcrypto" rpath="$rpath:$ssldir/lib" -fi; - +fi -# -# Alignment -# -echo "$as_me:$LINENO: checking if architecture needs alignment" >&5 -echo $ECHO_N "checking if architecture needs alignment... $ECHO_C" >&6 -if test "$cross_compiling" = yes; then - echo "$as_me:$LINENO: result: assuming yes" >&5 -echo "${ECHO_T}assuming yes" >&6 - cat >>confdefs.h <<\_ACEOF -#define NEED_ALIGN 1 -_ACEOF +# Check whether --enable-smartcard was given. +if test "${enable_smartcard+set}" = set; then + enableval=$enable_smartcard; + case "$OSTYPE" in + darwin*) + if test "${ac_cv_header_PCSC_pcsclite_h+set}" = set; then + { echo "$as_me:$LINENO: checking for PCSC/pcsclite.h" >&5 +echo $ECHO_N "checking for PCSC/pcsclite.h... $ECHO_C" >&6; } +if test "${ac_cv_header_PCSC_pcsclite_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_PCSC_pcsclite_h" >&5 +echo "${ECHO_T}$ac_cv_header_PCSC_pcsclite_h" >&6; } else - cat >conftest.$ac_ext <<_ACEOF + # Is the header compilable? +{ echo "$as_me:$LINENO: checking PCSC/pcsclite.h usability" >&5 +echo $ECHO_N "checking PCSC/pcsclite.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. */ - -#include -#include -int main(int argc, char **argv) -{ - unsigned char test[8] = { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88 }; - signal(SIGBUS, exit); - signal(SIGABRT, exit); - signal(SIGSEGV, exit); - if (*((unsigned int *)(test + 1)) != 0x55443322 && *((unsigned int *)(test + 1)) != 0x22334455) { - return 1; - } - return 0; -} +$ac_includes_default +#include _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 +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); }; }; then - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -( exit $ac_status ) -echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - cat >>confdefs.h <<\_ACEOF -#define NEED_ALIGN 1 -_ACEOF - -fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext + ac_header_compiler=no fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } -# -# EGD -# - -# Check whether --with-egd-socket or --without-egd-socket was given. -if test "${with_egd_socket+set}" = set; then - withval="$with_egd_socket" - EGD_SOCKET="$withval" -else - EGD_SOCKET="/var/run/egd-pool" - -fi; -cat >>confdefs.h <<_ACEOF -#define EGD_SOCKET "$EGD_SOCKET" +# Is the header present? +{ echo "$as_me:$LINENO: checking PCSC/pcsclite.h presence" >&5 +echo $ECHO_N "checking PCSC/pcsclite.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 { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.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; } -# -# rdp2vnc -# -vncserverconfig=libvncserver-config - -# Check whether --with-libvncserver-config or --without-libvncserver-config was given. -if test "${with_libvncserver_config+set}" = set; then - withval="$with_libvncserver_config" - vncserverconfig="$withval" - -fi; - -# Check whether --with-libvncserver or --without-libvncserver was given. -if test "${with_libvncserver+set}" = set; then - withval="$with_libvncserver" +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: PCSC/pcsclite.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: PCSC/pcsclite.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: PCSC/pcsclite.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: PCSC/pcsclite.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: PCSC/pcsclite.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: PCSC/pcsclite.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: PCSC/pcsclite.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: PCSC/pcsclite.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: PCSC/pcsclite.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: PCSC/pcsclite.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: PCSC/pcsclite.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: PCSC/pcsclite.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: PCSC/pcsclite.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: PCSC/pcsclite.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: PCSC/pcsclite.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: PCSC/pcsclite.h: in the future, the compiler will take precedence" >&2;} - VNCINC=`$vncserverconfig --cflags` + ;; +esac +{ echo "$as_me:$LINENO: checking for PCSC/pcsclite.h" >&5 +echo $ECHO_N "checking for PCSC/pcsclite.h... $ECHO_C" >&6; } +if test "${ac_cv_header_PCSC_pcsclite_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_PCSC_pcsclite_h=$ac_header_preproc +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_PCSC_pcsclite_h" >&5 +echo "${ECHO_T}$ac_cv_header_PCSC_pcsclite_h" >&6; } - LDVNC=`$vncserverconfig --libs` +fi +if test $ac_cv_header_PCSC_pcsclite_h = yes; then + WITH_SCARD=1 +else + WITH_SCARD=0 +fi - VNCLINK=`$vncserverconfig --link` - RDP2VNCTARGET="rdp2vnc" + cat >>confdefs.h <<\_ACEOF +#define PCSC_OSX 1 +_ACEOF + cat >>confdefs.h <<\_ACEOF +#define WITH_PCSC120 1 +_ACEOF + PCSCLITE_CFLAGS="" + PCSCLITE_LIBS="-framework PCSC" + ;; + *) + if test -n "$PKG_CONFIG"; then -fi; + { echo "$as_me:$LINENO: WARNING: pkg-config not available, cannot check for libpcsclite" >&5 +echo "$as_me: WARNING: pkg-config not available, cannot check for libpcsclite" >&2;} + WITH_SCARD=0 -# -# sound -# + fi + ;; + esac -# Check whether --with-libao or --without-libao was given. -if test "${with_libao+set}" = set; then - withval="$with_libao" + if test x"$WITH_SCARD" = "x1"; then + SCARDOBJ="scard.o" + CFLAGS="$CFLAGS $PCSCLITE_CFLAGS" + LIBS="$LIBS $PCSCLITE_LIBS" + cat >>confdefs.h <<\_ACEOF +#define WITH_SCARD 1 +_ACEOF - CFLAGS="$CFLAGS -I$withval/include" - CPPFLAGS="$CPPFLAGS -I$withval/include" - LIBS="$LIBS -L$withval/lib" - rpath="$rpath:$withval/lib" + fi +fi -fi; -sound="yes" -# Check whether --with-sound or --without-sound was given. -if test "${with_sound+set}" = set; then - withval="$with_sound" - sound="$withval" +# +# Alignment +# +{ echo "$as_me:$LINENO: checking if architecture needs alignment" >&5 +echo $ECHO_N "checking if architecture needs alignment... $ECHO_C" >&6; } +if test "$cross_compiling" = yes; then + { echo "$as_me:$LINENO: result: assuming yes" >&5 +echo "${ECHO_T}assuming yes" >&6; } + cat >>confdefs.h <<\_ACEOF +#define NEED_ALIGN 1 +_ACEOF -fi; -if test "$sound" = yes; then - if test "${ac_cv_header_ao_ao_h+set}" = set; then - echo "$as_me:$LINENO: checking for ao/ao.h" >&5 -echo $ECHO_N "checking for ao/ao.h... $ECHO_C" >&6 -if test "${ac_cv_header_ao_ao_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: $ac_cv_header_ao_ao_h" >&5 -echo "${ECHO_T}$ac_cv_header_ao_ao_h" >&6 else - # Is the header compilable? -echo "$as_me:$LINENO: checking ao/ao.h usability" >&5 -echo $ECHO_N "checking ao/ao.h usability... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF + 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 + +#include +#include +int main(int argc, char **argv) +{ + unsigned char test[8] = { 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88 }; + signal(SIGBUS, exit); + signal(SIGABRT, exit); + signal(SIGSEGV, exit); + if (*((unsigned int *)(test + 1)) != 0x55443322 && *((unsigned int *)(test + 1)) != 0x22334455) { + return 1; + } + 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_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 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 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_header_compiler=yes + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } else - echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +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 ao/ao.h presence" >&5 -echo $ECHO_N "checking ao/ao.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 +( exit $ac_status ) +{ echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + cat >>confdefs.h <<\_ACEOF +#define NEED_ALIGN 1 _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_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes + fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + + + +# +# EGD +# + +# Check whether --with-egd-socket was given. +if test "${with_egd_socket+set}" = set; then + withval=$with_egd_socket; EGD_SOCKET="$withval" else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 + EGD_SOCKET="/var/run/egd-pool" - 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_c_preproc_warn_flag in - yes:no: ) - { echo "$as_me:$LINENO: WARNING: ao/ao.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: ao/ao.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: ao/ao.h: proceeding with the compiler's result" >&5 -echo "$as_me: WARNING: ao/ao.h: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { echo "$as_me:$LINENO: WARNING: ao/ao.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: ao/ao.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: ao/ao.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: ao/ao.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: ao/ao.h: see the Autoconf documentation" >&5 -echo "$as_me: WARNING: ao/ao.h: see the Autoconf documentation" >&2;} - { echo "$as_me:$LINENO: WARNING: ao/ao.h: section \"Present But Cannot Be Compiled\"" >&5 -echo "$as_me: WARNING: ao/ao.h: section \"Present But Cannot Be Compiled\"" >&2;} - { echo "$as_me:$LINENO: WARNING: ao/ao.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: ao/ao.h: proceeding with the preprocessor's result" >&2;} - { echo "$as_me:$LINENO: WARNING: ao/ao.h: in the future, the compiler will take precedence" >&5 -echo "$as_me: WARNING: ao/ao.h: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## ----------------------------------- ## -## Report this to the rdesktop lists. ## -## ----------------------------------- ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -echo "$as_me:$LINENO: checking for ao/ao.h" >&5 -echo $ECHO_N "checking for ao/ao.h... $ECHO_C" >&6 -if test "${ac_cv_header_ao_ao_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_header_ao_ao_h=$ac_header_preproc +cat >>confdefs.h <<_ACEOF +#define EGD_SOCKET "$EGD_SOCKET" +_ACEOF + + + +# +# rdp2vnc +# +vncserverconfig=libvncserver-config + +# Check whether --with-libvncserver-config was given. +if test "${with_libvncserver_config+set}" = set; then + withval=$with_libvncserver_config; vncserverconfig="$withval" + fi -echo "$as_me:$LINENO: result: $ac_cv_header_ao_ao_h" >&5 -echo "${ECHO_T}$ac_cv_header_ao_ao_h" >&6 + + +# Check whether --with-libvncserver was given. +if test "${with_libvncserver+set}" = set; then + withval=$with_libvncserver; + VNCINC=`$vncserverconfig --cflags` + + LDVNC=`$vncserverconfig --libs` + + VNCLINK=`$vncserverconfig --link` + + RDP2VNCTARGET="rdp2vnc" + + fi -if test $ac_cv_header_ao_ao_h = yes; then - sound=libao + + +# +# sound +# + +sound="yes" + +# Check whether --with-sound was given. +if test "${with_sound+set}" = set; then + withval=$with_sound; + sound="$withval" + fi - if test "${ac_cv_header_sys_soundcard_h+set}" = set; then - echo "$as_me:$LINENO: checking for sys/soundcard.h" >&5 -echo $ECHO_N "checking for sys/soundcard.h... $ECHO_C" >&6 +if test "${ac_cv_header_sys_soundcard_h+set}" = set; then + { echo "$as_me:$LINENO: checking for sys/soundcard.h" >&5 +echo $ECHO_N "checking for sys/soundcard.h... $ECHO_C" >&6; } if test "${ac_cv_header_sys_soundcard_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi -echo "$as_me:$LINENO: result: $ac_cv_header_sys_soundcard_h" >&5 -echo "${ECHO_T}$ac_cv_header_sys_soundcard_h" >&6 +{ echo "$as_me:$LINENO: result: $ac_cv_header_sys_soundcard_h" >&5 +echo "${ECHO_T}$ac_cv_header_sys_soundcard_h" >&6; } else # Is the header compilable? -echo "$as_me:$LINENO: checking sys/soundcard.h usability" >&5 -echo $ECHO_N "checking sys/soundcard.h usability... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking sys/soundcard.h usability" >&5 +echo $ECHO_N "checking sys/soundcard.h usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -6053,41 +6479,37 @@ #include _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_header_compiler=no + 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 + +rm -f core 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 sys/soundcard.h presence" >&5 -echo $ECHO_N "checking sys/soundcard.h presence... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking sys/soundcard.h presence" >&5 +echo $ECHO_N "checking sys/soundcard.h presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -6096,24 +6518,22 @@ /* 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 +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 @@ -6121,9 +6541,10 @@ 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 +{ 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_c_preproc_warn_flag in @@ -6147,44 +6568,39 @@ echo "$as_me: WARNING: sys/soundcard.h: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: sys/soundcard.h: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: sys/soundcard.h: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## ----------------------------------- ## -## Report this to the rdesktop lists. ## -## ----------------------------------- ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 + ;; esac -echo "$as_me:$LINENO: checking for sys/soundcard.h" >&5 -echo $ECHO_N "checking for sys/soundcard.h... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking for sys/soundcard.h" >&5 +echo $ECHO_N "checking for sys/soundcard.h... $ECHO_C" >&6; } if test "${ac_cv_header_sys_soundcard_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_sys_soundcard_h=$ac_header_preproc fi -echo "$as_me:$LINENO: result: $ac_cv_header_sys_soundcard_h" >&5 -echo "${ECHO_T}$ac_cv_header_sys_soundcard_h" >&6 +{ echo "$as_me:$LINENO: result: $ac_cv_header_sys_soundcard_h" >&5 +echo "${ECHO_T}$ac_cv_header_sys_soundcard_h" >&6; } fi if test $ac_cv_header_sys_soundcard_h = yes; then - sound=oss + HAVE_OSS=1 +else + HAVE_OSS=0 fi - if test "${ac_cv_header_dmedia_audio_h+set}" = set; then - echo "$as_me:$LINENO: checking for dmedia/audio.h" >&5 -echo $ECHO_N "checking for dmedia/audio.h... $ECHO_C" >&6 +if test "${ac_cv_header_dmedia_audio_h+set}" = set; then + { echo "$as_me:$LINENO: checking for dmedia/audio.h" >&5 +echo $ECHO_N "checking for dmedia/audio.h... $ECHO_C" >&6; } if test "${ac_cv_header_dmedia_audio_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi -echo "$as_me:$LINENO: result: $ac_cv_header_dmedia_audio_h" >&5 -echo "${ECHO_T}$ac_cv_header_dmedia_audio_h" >&6 +{ echo "$as_me:$LINENO: result: $ac_cv_header_dmedia_audio_h" >&5 +echo "${ECHO_T}$ac_cv_header_dmedia_audio_h" >&6; } else # Is the header compilable? -echo "$as_me:$LINENO: checking dmedia/audio.h usability" >&5 -echo $ECHO_N "checking dmedia/audio.h usability... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking dmedia/audio.h usability" >&5 +echo $ECHO_N "checking dmedia/audio.h usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -6195,41 +6611,37 @@ #include _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_header_compiler=no + 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 + +rm -f core 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 dmedia/audio.h presence" >&5 -echo $ECHO_N "checking dmedia/audio.h presence... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking dmedia/audio.h presence" >&5 +echo $ECHO_N "checking dmedia/audio.h presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -6238,24 +6650,22 @@ /* 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 +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 @@ -6263,9 +6673,10 @@ 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 +{ 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_c_preproc_warn_flag in @@ -6289,44 +6700,39 @@ echo "$as_me: WARNING: dmedia/audio.h: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: dmedia/audio.h: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: dmedia/audio.h: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## ----------------------------------- ## -## Report this to the rdesktop lists. ## -## ----------------------------------- ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 + ;; esac -echo "$as_me:$LINENO: checking for dmedia/audio.h" >&5 -echo $ECHO_N "checking for dmedia/audio.h... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking for dmedia/audio.h" >&5 +echo $ECHO_N "checking for dmedia/audio.h... $ECHO_C" >&6; } if test "${ac_cv_header_dmedia_audio_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_dmedia_audio_h=$ac_header_preproc fi -echo "$as_me:$LINENO: result: $ac_cv_header_dmedia_audio_h" >&5 -echo "${ECHO_T}$ac_cv_header_dmedia_audio_h" >&6 +{ echo "$as_me:$LINENO: result: $ac_cv_header_dmedia_audio_h" >&5 +echo "${ECHO_T}$ac_cv_header_dmedia_audio_h" >&6; } fi if test $ac_cv_header_dmedia_audio_h = yes; then - sound=sgi + HAVE_SGI=1 +else + HAVE_SGI=0 fi - if test "${ac_cv_header_sys_audioio_h+set}" = set; then - echo "$as_me:$LINENO: checking for sys/audioio.h" >&5 -echo $ECHO_N "checking for sys/audioio.h... $ECHO_C" >&6 +if test "${ac_cv_header_sys_audioio_h+set}" = set; then + { echo "$as_me:$LINENO: checking for sys/audioio.h" >&5 +echo $ECHO_N "checking for sys/audioio.h... $ECHO_C" >&6; } if test "${ac_cv_header_sys_audioio_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi -echo "$as_me:$LINENO: result: $ac_cv_header_sys_audioio_h" >&5 -echo "${ECHO_T}$ac_cv_header_sys_audioio_h" >&6 +{ echo "$as_me:$LINENO: result: $ac_cv_header_sys_audioio_h" >&5 +echo "${ECHO_T}$ac_cv_header_sys_audioio_h" >&6; } else # Is the header compilable? -echo "$as_me:$LINENO: checking sys/audioio.h usability" >&5 -echo $ECHO_N "checking sys/audioio.h usability... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking sys/audioio.h usability" >&5 +echo $ECHO_N "checking sys/audioio.h usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -6337,41 +6743,37 @@ #include _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_header_compiler=no + 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 + +rm -f core 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 sys/audioio.h presence" >&5 -echo $ECHO_N "checking sys/audioio.h presence... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking sys/audioio.h presence" >&5 +echo $ECHO_N "checking sys/audioio.h presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -6380,24 +6782,22 @@ /* 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 +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 @@ -6405,9 +6805,10 @@ 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 +{ 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_c_preproc_warn_flag in @@ -6431,68 +6832,211 @@ echo "$as_me: WARNING: sys/audioio.h: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: sys/audioio.h: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: sys/audioio.h: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## ----------------------------------- ## -## Report this to the rdesktop lists. ## -## ----------------------------------- ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 + ;; esac -echo "$as_me:$LINENO: checking for sys/audioio.h" >&5 -echo $ECHO_N "checking for sys/audioio.h... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking for sys/audioio.h" >&5 +echo $ECHO_N "checking for sys/audioio.h... $ECHO_C" >&6; } if test "${ac_cv_header_sys_audioio_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_sys_audioio_h=$ac_header_preproc fi -echo "$as_me:$LINENO: result: $ac_cv_header_sys_audioio_h" >&5 -echo "${ECHO_T}$ac_cv_header_sys_audioio_h" >&6 +{ echo "$as_me:$LINENO: result: $ac_cv_header_sys_audioio_h" >&5 +echo "${ECHO_T}$ac_cv_header_sys_audioio_h" >&6; } fi if test $ac_cv_header_sys_audioio_h = yes; then - sound=sun + HAVE_SUN=1 +else + HAVE_SUN=0 fi + +# Check whether --enable-static-libsamplerate was given. +if test "${enable_static_libsamplerate+set}" = set; then + enableval=$enable_static_libsamplerate; static_libsamplerate=yes +else + static_libsamplerate=no fi -if test "$sound" = no; then - break -elif test "$sound" = oss; then - SOUNDOBJ="rdpsnd.o rdpsnd_oss.o" - cat >>confdefs.h <<\_ACEOF -#define WITH_RDPSND 1 -_ACEOF -elif test "$sound" = sgi; then - SOUNDOBJ="rdpsnd.o rdpsnd_sgi.o" - LDFLAGS="$LDFLAGS -laudio" - cat >>confdefs.h <<\_ACEOF -#define WITH_RDPSND 1 -_ACEOF -elif test "$sound" = sun; then - SOUNDOBJ="rdpsnd.o rdpsnd_sun.o" - cat >>confdefs.h <<\_ACEOF -#define WITH_RDPSND 1 -_ACEOF +if test -n "$PKG_CONFIG"; then -elif test "$sound" = libao; then - SOUNDOBJ="rdpsnd.o rdpsnd_libao.o" - LDFLAGS="$LDFLAGS -lao" - cat >>confdefs.h <<\_ACEOF -#define WITH_RDPSND 1 -_ACEOF + { echo "$as_me:$LINENO: WARNING: pkg-config not available, cannot check for ao" >&5 +echo "$as_me: WARNING: pkg-config not available, cannot check for ao" >&2;} + HAVE_LIBAO=0 + + + { echo "$as_me:$LINENO: WARNING: pkg-config not available, cannot check for alsa" >&5 +echo "$as_me: WARNING: pkg-config not available, cannot check for alsa" >&2;} + HAVE_ALSA=0 + + + { echo "$as_me:$LINENO: WARNING: pkg-config not available, cannot check for samplerate" >&5 +echo "$as_me: WARNING: pkg-config not available, cannot check for samplerate" >&2;} + HAVE_LIBSAMPLERATE=0 + + if test x"$HAVE_LIBSAMPLERATE" = "x1"; then + cat >>confdefs.h <<\_ACEOF +#define HAVE_LIBSAMPLERATE 1 +_ACEOF + + if test x"$static_libsamplerate" = "xyes"; then + _libsamplerate_libdir=`$PKG_CONFIG --errors-to-stdout --variable=libdir samplerate` + LIBSAMPLERATE_LIBS="$_libsamplerate_libdir""/libsamplerate.a" + fi + LIBSAMPLERATE_LIBS="$LIBSAMPLERATE_LIBS -lm" + fi +fi + +if test "$sound" != "no"; then + SOUNDOBJ="$SOUNDOBJ rdpsnd.o rdpsnd_dsp.o" + CFLAGS="$CFLAGS $LIBSAMPLERATE_CFLAGS" + LIBS="$LIBS $LIBSAMPLERATE_LIBS" + cat >>confdefs.h <<\_ACEOF +#define WITH_RDPSND 1 +_ACEOF -else - { echo "$as_me:$LINENO: WARNING: sound support disabled" >&5 -echo "$as_me: WARNING: sound support disabled" >&2;} - { echo "$as_me:$LINENO: WARNING: Currently supported systems are Open Sound System (oss), SGI AL (sgi), Sun/BSD (sun) and libao" >&5 -echo "$as_me: WARNING: Currently supported systems are Open Sound System (oss), SGI AL (sgi), Sun/BSD (sun) and libao" >&2;} fi +case $sound in + yes) + if test x"$HAVE_OSS" = "x1"; then + SOUNDOBJ="$SOUNDOBJ rdpsnd_oss.o" + cat >>confdefs.h <<\_ACEOF +#define RDPSND_OSS 1 +_ACEOF + + fi + + if test x"$HAVE_SGI" = "x1"; then + SOUNDOBJ="$SOUNDOBJ rdpsnd_sgi.o" + LIBS="$LIBS -laudio" + cat >>confdefs.h <<\_ACEOF +#define RDPSND_SGI 1 +_ACEOF + + fi + + if test x"$HAVE_SUN" = "x1"; then + SOUNDOBJ="$SOUNDOBJ rdpsnd_sun.o" + cat >>confdefs.h <<\_ACEOF +#define RDPSND_SUN 1 +_ACEOF + + fi + + if test x"$HAVE_ALSA" = "x1"; then + SOUNDOBJ="$SOUNDOBJ rdpsnd_alsa.o" + CFLAGS="$CFLAGS $ALSA_CFLAGS" + LIBS="$LIBS $ALSA_LIBS" + cat >>confdefs.h <<\_ACEOF +#define RDPSND_ALSA 1 +_ACEOF + + fi + + if test x"$HAVE_LIBAO" = "x1"; then + SOUNDOBJ="$SOUNDOBJ rdpsnd_libao.o" + CFLAGS="$CFLAGS $LIBAO_CFLAGS" + LIBS="$LIBS $LIBAO_LIBS" + cat >>confdefs.h <<\_ACEOF +#define RDPSND_LIBAO 1 +_ACEOF + + fi + + ;; + + oss) + if test x"$HAVE_OSS" = "x1"; then + SOUNDOBJ="$SOUNDOBJ rdpsnd_oss.o" + cat >>confdefs.h <<\_ACEOF +#define RDPSND_OSS 1 +_ACEOF + + else + { { echo "$as_me:$LINENO: error: Selected sound system is not available." >&5 +echo "$as_me: error: Selected sound system is not available." >&2;} + { (exit 1); exit 1; }; } + fi + ;; + + sgi) + if test x"$HAVE_SGI" = "x1"; then + SOUNDOBJ="$SOUNDOBJ rdpsnd_sgi.o" + LIBS="$LIBS -laudio" + cat >>confdefs.h <<\_ACEOF +#define RDPSND_SGI 1 +_ACEOF + + else + { { echo "$as_me:$LINENO: error: Selected sound system is not available." >&5 +echo "$as_me: error: Selected sound system is not available." >&2;} + { (exit 1); exit 1; }; } + fi + ;; + + sun) + if test x"$HAVE_SUN" = "x1"; then + SOUNDOBJ="$SOUNDOBJ rdpsnd_sun.o" + cat >>confdefs.h <<\_ACEOF +#define RDPSND_SUN 1 +_ACEOF + + else + { { echo "$as_me:$LINENO: error: Selected sound system is not available." >&5 +echo "$as_me: error: Selected sound system is not available." >&2;} + { (exit 1); exit 1; }; } + fi + ;; + + alsa) + if test x"$HAVE_ALSA" = "x1"; then + SOUNDOBJ="$SOUNDOBJ rdpsnd_alsa.o" + CFLAGS="$CFLAGS $ALSA_CFLAGS" + LIBS="$LIBS $ALSA_LIBS" + cat >>confdefs.h <<\_ACEOF +#define RDPSND_ALSA 1 +_ACEOF + + else + { { echo "$as_me:$LINENO: error: Selected sound system is not available." >&5 +echo "$as_me: error: Selected sound system is not available." >&2;} + { (exit 1); exit 1; }; } + fi + ;; + + libao) + if test x"$HAVE_LIBAO" = "x1"; then + SOUNDOBJ="$SOUNDOBJ rdpsnd_libao.o" + CFLAGS="$CFLAGS $LIBAO_CFLAGS" + LIBS="$LIBS $LIBAO_LIBS" + cat >>confdefs.h <<\_ACEOF +#define RDPSND_LIBAO 1 +_ACEOF + + else + { { echo "$as_me:$LINENO: error: Selected sound system is not available." >&5 +echo "$as_me: error: Selected sound system is not available." >&2;} + { (exit 1); exit 1; }; } + fi + ;; + + no) + ;; + + *) + { echo "$as_me:$LINENO: WARNING: sound support disabled" >&5 +echo "$as_me: WARNING: sound support disabled" >&2;} + { echo "$as_me:$LINENO: WARNING: Currently supported systems are Open Sound System (oss), SGI AL (sgi), Sun/BSD (sun), ALSA (alsa) and libao" >&5 +echo "$as_me: WARNING: Currently supported systems are Open Sound System (oss), SGI AL (sgi), Sun/BSD (sun), ALSA (alsa) and libao" >&2;} + ;; +esac + + # # dirfd @@ -6510,9 +7054,9 @@ ac_header_dirent=no for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do as_ac_Header=`echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_hdr that defines DIR" >&5 -echo $ECHO_N "checking for $ac_hdr that defines DIR... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then +{ echo "$as_me:$LINENO: checking for $ac_hdr that defines DIR" >&5 +echo $ECHO_N "checking for $ac_hdr that defines DIR... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -6534,38 +7078,35 @@ } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; 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" + eval "$as_ac_Header=no" fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +rm -f core 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 +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_hdr" | $as_tr_cpp` 1 @@ -6577,13 +7118,12 @@ done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then - echo "$as_me:$LINENO: checking for library containing opendir" >&5 -echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6 + { echo "$as_me:$LINENO: checking for library containing opendir" >&5 +echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6; } if test "${ac_cv_search_opendir+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_func_search_save_LIBS=$LIBS -ac_cv_search_opendir=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -6591,126 +7131,83 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Override any gcc2 internal prototype to avoid an error. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ #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 opendir (); int main () { -opendir (); +return opendir (); ; 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 +for ac_lib in '' dir; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_search_opendir="none required" + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_search_opendir=$ac_res else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test "$ac_cv_search_opendir" = no; then - for ac_lib in dir; do - LIBS="-l$ac_lib $ac_func_search_save_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 opendir (); -int -main () -{ -opendir (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_search_opendir="-l$ac_lib" -break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +fi +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext + if test "${ac_cv_search_opendir+set}" = set; then + break fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - done +done +if test "${ac_cv_search_opendir+set}" = set; then + : +else + ac_cv_search_opendir=no fi +rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi -echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5 -echo "${ECHO_T}$ac_cv_search_opendir" >&6 -if test "$ac_cv_search_opendir" != no; then - test "$ac_cv_search_opendir" = "none required" || LIBS="$ac_cv_search_opendir $LIBS" +{ echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5 +echo "${ECHO_T}$ac_cv_search_opendir" >&6; } +ac_res=$ac_cv_search_opendir +if test "$ac_res" != no; then + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi else - echo "$as_me:$LINENO: checking for library containing opendir" >&5 -echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6 + { echo "$as_me:$LINENO: checking for library containing opendir" >&5 +echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6; } if test "${ac_cv_search_opendir+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_func_search_save_LIBS=$LIBS -ac_cv_search_opendir=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -6718,115 +7215,73 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -/* Override any gcc2 internal prototype to avoid an error. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ #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 opendir (); int main () { -opendir (); +return opendir (); ; 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 +for ac_lib in '' x; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_search_opendir="none required" + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_search_opendir=$ac_res else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test "$ac_cv_search_opendir" = no; then - for ac_lib in x; do - LIBS="-l$ac_lib $ac_func_search_save_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 opendir (); -int -main () -{ -opendir (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_search_opendir="-l$ac_lib" -break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 +fi +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext + if test "${ac_cv_search_opendir+set}" = set; then + break fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - done +done +if test "${ac_cv_search_opendir+set}" = set; then + : +else + ac_cv_search_opendir=no fi +rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi -echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5 -echo "${ECHO_T}$ac_cv_search_opendir" >&6 -if test "$ac_cv_search_opendir" != no; then - test "$ac_cv_search_opendir" = "none required" || LIBS="$ac_cv_search_opendir $LIBS" +{ echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5 +echo "${ECHO_T}$ac_cv_search_opendir" >&6; } +ac_res=$ac_cv_search_opendir +if test "$ac_res" != no; then + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi @@ -6852,9 +7307,9 @@ for ac_func in dirfd do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -6880,68 +7335,60 @@ #undef $ac_func -/* Override any gcc2 internal prototype to avoid an error. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" -{ #endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +#if defined __stub_$ac_func || defined __stub___$ac_func choke me -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} #endif int main () { -return f != $ac_func; +return $ac_func (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -eval "$as_ac_var=no" + eval "$as_ac_var=no" fi -rm -f conftest.err conftest.$ac_objext \ + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 @@ -6950,8 +7397,8 @@ fi done - echo "$as_me:$LINENO: checking whether dirfd is declared" >&5 -echo $ECHO_N "checking whether dirfd is declared... $ECHO_C" >&6 + { echo "$as_me:$LINENO: checking whether dirfd is declared" >&5 +echo $ECHO_N "checking whether dirfd is declared... $ECHO_C" >&6; } if test "${ac_cv_have_decl_dirfd+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -6967,7 +7414,7 @@ main () { #ifndef dirfd - char *p = (char *) dirfd; + (void) dirfd; #endif ; @@ -6975,38 +7422,34 @@ } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_have_decl_dirfd=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_have_decl_dirfd=no + ac_cv_have_decl_dirfd=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_have_decl_dirfd" >&5 -echo "${ECHO_T}$ac_cv_have_decl_dirfd" >&6 +{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_dirfd" >&5 +echo "${ECHO_T}$ac_cv_have_decl_dirfd" >&6; } if test $ac_cv_have_decl_dirfd = yes; then cat >>confdefs.h <<_ACEOF @@ -7024,8 +7467,8 @@ - echo "$as_me:$LINENO: checking whether dirfd is a macro" >&5 -echo $ECHO_N "checking whether dirfd is a macro... $ECHO_C" >&6 + { echo "$as_me:$LINENO: checking whether dirfd is a macro" >&5 +echo $ECHO_N "checking whether dirfd is a macro... $ECHO_C" >&6; } if test "${jm_cv_func_dirfd_macro+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -7049,8 +7492,8 @@ rm -f conftest* fi -echo "$as_me:$LINENO: result: $jm_cv_func_dirfd_macro" >&5 -echo "${ECHO_T}$jm_cv_func_dirfd_macro" >&6 +{ echo "$as_me:$LINENO: result: $jm_cv_func_dirfd_macro" >&5 +echo "${ECHO_T}$jm_cv_func_dirfd_macro" >&6; } # Use the replacement only if we have no function, macro, # or declaration with that name. @@ -7060,9 +7503,9 @@ for ac_func in dirfd do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -7088,88 +7531,78 @@ #undef $ac_func -/* Override any gcc2 internal prototype to avoid an error. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" -{ #endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +#if defined __stub_$ac_func || defined __stub___$ac_func choke me -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} #endif int main () { -return f != $ac_func; +return $ac_func (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -eval "$as_ac_var=no" + eval "$as_ac_var=no" fi -rm -f conftest.err conftest.$ac_objext \ + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF else - case $LIBOBJS in - "$ac_func.$ac_objext" | \ - *" $ac_func.$ac_objext" | \ - "$ac_func.$ac_objext "* | \ + case " $LIBOBJS " in *" $ac_func.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS $ac_func.$ac_objext" ;; + *) LIBOBJS="$LIBOBJS $ac_func.$ac_objext" + ;; esac fi done - echo "$as_me:$LINENO: checking how to get the file descriptor associated with an open DIR*" >&5 -echo $ECHO_N "checking how to get the file descriptor associated with an open DIR*... $ECHO_C" >&6 + { echo "$as_me:$LINENO: checking how to get the file descriptor associated with an open DIR*" >&5 +echo $ECHO_N "checking how to get the file descriptor associated with an open DIR*... $ECHO_C" >&6; } if test "${gl_cv_sys_dir_fd_member_name+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -7195,35 +7628,32 @@ } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then dir_fd_found=yes 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 + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext CFLAGS=$dirfd_save_CFLAGS test "$dir_fd_found" = yes && break done @@ -7233,8 +7663,8 @@ fi -echo "$as_me:$LINENO: result: $gl_cv_sys_dir_fd_member_name" >&5 -echo "${ECHO_T}$gl_cv_sys_dir_fd_member_name" >&6 +{ echo "$as_me:$LINENO: result: $gl_cv_sys_dir_fd_member_name" >&5 +echo "${ECHO_T}$gl_cv_sys_dir_fd_member_name" >&6; } if test $gl_cv_sys_dir_fd_member_name != no_such_member; then cat >>confdefs.h <<_ACEOF @@ -7257,28 +7687,28 @@ -# Check whether --with-libiconv-prefix or --without-libiconv-prefix was given. +# Check whether --with-libiconv-prefix was given. if test "${with_libiconv_prefix+set}" = set; then - withval="$with_libiconv_prefix" - + withval=$with_libiconv_prefix; for dir in `echo "$withval" | tr : ' '`; do if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi done -fi; +fi + if test "${ac_cv_header_iconv_h+set}" = set; then - echo "$as_me:$LINENO: checking for iconv.h" >&5 -echo $ECHO_N "checking for iconv.h... $ECHO_C" >&6 + { echo "$as_me:$LINENO: checking for iconv.h" >&5 +echo $ECHO_N "checking for iconv.h... $ECHO_C" >&6; } if test "${ac_cv_header_iconv_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi -echo "$as_me:$LINENO: result: $ac_cv_header_iconv_h" >&5 -echo "${ECHO_T}$ac_cv_header_iconv_h" >&6 +{ echo "$as_me:$LINENO: result: $ac_cv_header_iconv_h" >&5 +echo "${ECHO_T}$ac_cv_header_iconv_h" >&6; } else # Is the header compilable? -echo "$as_me:$LINENO: checking iconv.h usability" >&5 -echo $ECHO_N "checking iconv.h usability... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking iconv.h usability" >&5 +echo $ECHO_N "checking iconv.h usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -7289,41 +7719,37 @@ #include _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_header_compiler=no + 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 + +rm -f core 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 iconv.h presence" >&5 -echo $ECHO_N "checking iconv.h presence... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking iconv.h presence" >&5 +echo $ECHO_N "checking iconv.h presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -7332,24 +7758,22 @@ /* 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 +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 @@ -7357,9 +7781,10 @@ 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 +{ 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_c_preproc_warn_flag in @@ -7383,25 +7808,18 @@ echo "$as_me: WARNING: iconv.h: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: iconv.h: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: iconv.h: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## ----------------------------------- ## -## Report this to the rdesktop lists. ## -## ----------------------------------- ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 + ;; esac -echo "$as_me:$LINENO: checking for iconv.h" >&5 -echo $ECHO_N "checking for iconv.h... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking for iconv.h" >&5 +echo $ECHO_N "checking for iconv.h... $ECHO_C" >&6; } if test "${ac_cv_header_iconv_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_iconv_h=$ac_header_preproc fi -echo "$as_me:$LINENO: result: $ac_cv_header_iconv_h" >&5 -echo "${ECHO_T}$ac_cv_header_iconv_h" >&6 +{ echo "$as_me:$LINENO: result: $ac_cv_header_iconv_h" >&5 +echo "${ECHO_T}$ac_cv_header_iconv_h" >&6; } fi if test $ac_cv_header_iconv_h = yes; then @@ -7413,8 +7831,8 @@ - echo "$as_me:$LINENO: checking for iconv" >&5 -echo $ECHO_N "checking for iconv... $ECHO_C" >&6 + { echo "$as_me:$LINENO: checking for iconv" >&5 +echo $ECHO_N "checking for iconv... $ECHO_C" >&6; } if test "${am_cv_func_iconv+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -7440,34 +7858,32 @@ } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then am_cv_func_iconv=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 + fi -rm -f conftest.err conftest.$ac_objext \ + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext if test "$am_cv_func_iconv" != yes; then am_save_LIBS="$LIBS" @@ -7491,50 +7907,48 @@ } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then am_cv_lib_iconv=yes am_cv_func_iconv=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 + fi -rm -f conftest.err conftest.$ac_objext \ + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS="$am_save_LIBS" fi fi -echo "$as_me:$LINENO: result: $am_cv_func_iconv" >&5 -echo "${ECHO_T}$am_cv_func_iconv" >&6 +{ echo "$as_me:$LINENO: result: $am_cv_func_iconv" >&5 +echo "${ECHO_T}$am_cv_func_iconv" >&6; } if test "$am_cv_func_iconv" = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_ICONV 1 _ACEOF - echo "$as_me:$LINENO: checking for iconv declaration" >&5 -echo $ECHO_N "checking for iconv declaration... $ECHO_C" >&6 + { echo "$as_me:$LINENO: checking for iconv declaration" >&5 +echo $ECHO_N "checking for iconv declaration... $ECHO_C" >&6; } if test "${am_cv_proto_iconv+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -7567,43 +7981,39 @@ } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then am_cv_proto_iconv_arg1="" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -am_cv_proto_iconv_arg1="const" + am_cv_proto_iconv_arg1="const" fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);" fi am_cv_proto_iconv=`echo "$am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` - echo "$as_me:$LINENO: result: ${ac_t:- + { echo "$as_me:$LINENO: result: ${ac_t:- }$am_cv_proto_iconv" >&5 echo "${ECHO_T}${ac_t:- - }$am_cv_proto_iconv" >&6 + }$am_cv_proto_iconv" >&6; } cat >>confdefs.h <<_ACEOF #define ICONV_CONST $am_cv_proto_iconv_arg1 @@ -7625,8 +8035,8 @@ - echo "$as_me:$LINENO: checking for socklen_t" >&5 -echo $ECHO_N "checking for socklen_t... $ECHO_C" >&6 + { echo "$as_me:$LINENO: checking for socklen_t" >&5 +echo $ECHO_N "checking for socklen_t... $ECHO_C" >&6; } if test "${ac_cv_type_socklen_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -7639,56 +8049,53 @@ #include #include +typedef socklen_t ac__type_new_; int main () { -if ((socklen_t *) 0) +if ((ac__type_new_ *) 0) return 0; -if (sizeof (socklen_t)) +if (sizeof (ac__type_new_)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_type_socklen_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_type_socklen_t=no + ac_cv_type_socklen_t=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_type_socklen_t" >&5 -echo "${ECHO_T}$ac_cv_type_socklen_t" >&6 +{ echo "$as_me:$LINENO: result: $ac_cv_type_socklen_t" >&5 +echo "${ECHO_T}$ac_cv_type_socklen_t" >&6; } if test $ac_cv_type_socklen_t = yes; then : else - echo "$as_me:$LINENO: checking for socklen_t equivalent" >&5 -echo $ECHO_N "checking for socklen_t equivalent... $ECHO_C" >&6 + { echo "$as_me:$LINENO: checking for socklen_t equivalent" >&5 +echo $ECHO_N "checking for socklen_t equivalent... $ECHO_C" >&6; } if test "${socklen_t_equiv+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -7722,27 +8129,22 @@ } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then socklen_t_equiv="$t" break @@ -7751,8 +8153,10 @@ echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 + fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done done @@ -7764,8 +8168,8 @@ fi - echo "$as_me:$LINENO: result: $socklen_t_equiv" >&5 -echo "${ECHO_T}$socklen_t_equiv" >&6 + { echo "$as_me:$LINENO: result: $socklen_t_equiv" >&5 +echo "${ECHO_T}$socklen_t_equiv" >&6; } cat >>confdefs.h <<_ACEOF #define socklen_t $socklen_t_equiv @@ -7782,18 +8186,19 @@ for ac_header in sys/vfs.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if eval "test \"\${$as_ac_Header+set}\" = set"; then - 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 +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+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 +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } else # Is the header compilable? -echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -7804,41 +8209,37 @@ #include <$ac_header> _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_header_compiler=no + 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 + +rm -f core 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 $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -7847,24 +8248,22 @@ /* end confdefs.h. */ #include <$ac_header> _ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 @@ -7872,9 +8271,10 @@ 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 +{ 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_c_preproc_warn_flag in @@ -7898,25 +8298,19 @@ echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## ----------------------------------- ## -## Report this to the rdesktop lists. ## -## ----------------------------------- ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 + ;; esac -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 "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+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 +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } fi if test `eval echo '${'$as_ac_Header'}'` = yes; then @@ -7932,18 +8326,19 @@ for ac_header in sys/statvfs.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if eval "test \"\${$as_ac_Header+set}\" = set"; then - 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 +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+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 +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } else # Is the header compilable? -echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -7954,41 +8349,37 @@ #include <$ac_header> _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_header_compiler=no + 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 + +rm -f core 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 $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -7997,24 +8388,22 @@ /* end confdefs.h. */ #include <$ac_header> _ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 @@ -8022,9 +8411,10 @@ 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 +{ 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_c_preproc_warn_flag in @@ -8048,25 +8438,19 @@ echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## ----------------------------------- ## -## Report this to the rdesktop lists. ## -## ----------------------------------- ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 + ;; esac -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 "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+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 +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } fi if test `eval echo '${'$as_ac_Header'}'` = yes; then @@ -8082,18 +8466,19 @@ for ac_header in sys/statfs.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if eval "test \"\${$as_ac_Header+set}\" = set"; then - 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 +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+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 +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } else # Is the header compilable? -echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -8104,41 +8489,37 @@ #include <$ac_header> _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_header_compiler=no + 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 + +rm -f core 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 $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -8147,24 +8528,22 @@ /* end confdefs.h. */ #include <$ac_header> _ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 @@ -8172,9 +8551,10 @@ 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 +{ 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_c_preproc_warn_flag in @@ -8198,25 +8578,19 @@ echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## ----------------------------------- ## -## Report this to the rdesktop lists. ## -## ----------------------------------- ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 + ;; esac -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 "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+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 +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } fi if test `eval echo '${'$as_ac_Header'}'` = yes; then @@ -8232,18 +8606,19 @@ for ac_header in sys/param.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if eval "test \"\${$as_ac_Header+set}\" = set"; then - 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 +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+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 +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } else # Is the header compilable? -echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -8254,41 +8629,37 @@ #include <$ac_header> _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_header_compiler=no + 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 + +rm -f core 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 $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -8297,24 +8668,22 @@ /* end confdefs.h. */ #include <$ac_header> _ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 @@ -8322,9 +8691,10 @@ 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 +{ 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_c_preproc_warn_flag in @@ -8348,25 +8718,19 @@ echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## ----------------------------------- ## -## Report this to the rdesktop lists. ## -## ----------------------------------- ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 + ;; esac -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 "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+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 +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } fi if test `eval echo '${'$as_ac_Header'}'` = yes; then @@ -8390,9 +8754,9 @@ for ac_header in sys/mount.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 "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -8406,38 +8770,35 @@ #include <$ac_header> _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; 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" + eval "$as_ac_Header=no" fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +rm -f core 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 +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 @@ -8457,8 +8818,8 @@ # Test for statvfs64. if test $space = no; then # SVR4 - echo "$as_me:$LINENO: checking statvfs64 function (SVR4)" >&5 -echo $ECHO_N "checking statvfs64 function (SVR4)... $ECHO_C" >&6 + { echo "$as_me:$LINENO: checking statvfs64 function (SVR4)" >&5 +echo $ECHO_N "checking statvfs64 function (SVR4)... $ECHO_C" >&6; } if test "${fu_cv_sys_stat_statvfs64+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -8484,13 +8845,22 @@ } _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then @@ -8503,11 +8873,13 @@ ( exit $ac_status ) fu_cv_sys_stat_statvfs64=no fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi + + fi -echo "$as_me:$LINENO: result: $fu_cv_sys_stat_statvfs64" >&5 -echo "${ECHO_T}$fu_cv_sys_stat_statvfs64" >&6 +{ echo "$as_me:$LINENO: result: $fu_cv_sys_stat_statvfs64" >&5 +echo "${ECHO_T}$fu_cv_sys_stat_statvfs64" >&6; } if test $fu_cv_sys_stat_statvfs64 = yes; then space=yes @@ -8526,8 +8898,8 @@ # is what it gets when this test fails. if test $space = no; then # SVR4 - echo "$as_me:$LINENO: checking statvfs function (SVR4)" >&5 -echo $ECHO_N "checking statvfs function (SVR4)... $ECHO_C" >&6 + { echo "$as_me:$LINENO: checking statvfs function (SVR4)" >&5 +echo $ECHO_N "checking statvfs function (SVR4)... $ECHO_C" >&6; } if test "${fu_cv_sys_stat_statvfs+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -8548,39 +8920,36 @@ } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then fu_cv_sys_stat_statvfs=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -fu_cv_sys_stat_statvfs=no + fu_cv_sys_stat_statvfs=no fi -rm -f conftest.err conftest.$ac_objext \ + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $fu_cv_sys_stat_statvfs" >&5 -echo "${ECHO_T}$fu_cv_sys_stat_statvfs" >&6 +{ echo "$as_me:$LINENO: result: $fu_cv_sys_stat_statvfs" >&5 +echo "${ECHO_T}$fu_cv_sys_stat_statvfs" >&6; } if test $fu_cv_sys_stat_statvfs = yes; then space=yes @@ -8593,8 +8962,8 @@ if test $space = no; then # DEC Alpha running OSF/1 - echo "$as_me:$LINENO: checking for 3-argument statfs function (DEC OSF/1)" >&5 -echo $ECHO_N "checking for 3-argument statfs function (DEC OSF/1)... $ECHO_C" >&6 + { echo "$as_me:$LINENO: checking for 3-argument statfs function (DEC OSF/1)" >&5 +echo $ECHO_N "checking for 3-argument statfs function (DEC OSF/1)... $ECHO_C" >&6; } if test "${fu_cv_sys_stat_statfs3_osf1+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -8619,13 +8988,22 @@ } _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then @@ -8638,8 +9016,10 @@ ( exit $ac_status ) fu_cv_sys_stat_statfs3_osf1=no fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi + + fi @@ -8657,8 +9037,8 @@ if test $space = no; then # AIX - echo "$as_me:$LINENO: checking for two-argument statfs with statfs.bsize member (AIX, 4.3BSD)" >&5 -echo $ECHO_N "checking for two-argument statfs with statfs.bsize member (AIX, 4.3BSD)... $ECHO_C" >&6 + { echo "$as_me:$LINENO: checking for two-argument statfs with statfs.bsize member (AIX, 4.3BSD)" >&5 +echo $ECHO_N "checking for two-argument statfs with statfs.bsize member (AIX, 4.3BSD)... $ECHO_C" >&6; } if test "${fu_cv_sys_stat_statfs2_bsize+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -8689,13 +9069,22 @@ } _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then @@ -8708,12 +9097,14 @@ ( exit $ac_status ) fu_cv_sys_stat_statfs2_bsize=no fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi + + fi - echo "$as_me:$LINENO: result: $fu_cv_sys_stat_statfs2_bsize" >&5 -echo "${ECHO_T}$fu_cv_sys_stat_statfs2_bsize" >&6 + { echo "$as_me:$LINENO: result: $fu_cv_sys_stat_statfs2_bsize" >&5 +echo "${ECHO_T}$fu_cv_sys_stat_statfs2_bsize" >&6; } if test $fu_cv_sys_stat_statfs2_bsize = yes; then space=yes @@ -8726,8 +9117,8 @@ if test $space = no; then # SVR3 - echo "$as_me:$LINENO: checking for four-argument statfs (AIX-3.2.5, SVR3)" >&5 -echo $ECHO_N "checking for four-argument statfs (AIX-3.2.5, SVR3)... $ECHO_C" >&6 + { echo "$as_me:$LINENO: checking for four-argument statfs (AIX-3.2.5, SVR3)" >&5 +echo $ECHO_N "checking for four-argument statfs (AIX-3.2.5, SVR3)... $ECHO_C" >&6; } if test "${fu_cv_sys_stat_statfs4+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -8749,13 +9140,22 @@ } _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then @@ -8768,12 +9168,14 @@ ( exit $ac_status ) fu_cv_sys_stat_statfs4=no fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi + + fi - echo "$as_me:$LINENO: result: $fu_cv_sys_stat_statfs4" >&5 -echo "${ECHO_T}$fu_cv_sys_stat_statfs4" >&6 + { echo "$as_me:$LINENO: result: $fu_cv_sys_stat_statfs4" >&5 +echo "${ECHO_T}$fu_cv_sys_stat_statfs4" >&6; } if test $fu_cv_sys_stat_statfs4 = yes; then space=yes @@ -8786,8 +9188,8 @@ if test $space = no; then # 4.4BSD and NetBSD - echo "$as_me:$LINENO: checking for two-argument statfs with statfs.fsize member (4.4BSD and NetBSD)" >&5 -echo $ECHO_N "checking for two-argument statfs with statfs.fsize member (4.4BSD and NetBSD)... $ECHO_C" >&6 + { echo "$as_me:$LINENO: checking for two-argument statfs with statfs.fsize member (4.4BSD and NetBSD)" >&5 +echo $ECHO_N "checking for two-argument statfs with statfs.fsize member (4.4BSD and NetBSD)... $ECHO_C" >&6; } if test "${fu_cv_sys_stat_statfs2_fsize+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -8815,13 +9217,22 @@ } _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then @@ -8834,12 +9245,14 @@ ( exit $ac_status ) fu_cv_sys_stat_statfs2_fsize=no fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi + + fi - echo "$as_me:$LINENO: result: $fu_cv_sys_stat_statfs2_fsize" >&5 -echo "${ECHO_T}$fu_cv_sys_stat_statfs2_fsize" >&6 + { echo "$as_me:$LINENO: result: $fu_cv_sys_stat_statfs2_fsize" >&5 +echo "${ECHO_T}$fu_cv_sys_stat_statfs2_fsize" >&6; } if test $fu_cv_sys_stat_statfs2_fsize = yes; then space=yes @@ -8852,8 +9265,8 @@ if test $space = no; then # Ultrix - echo "$as_me:$LINENO: checking for two-argument statfs with struct fs_data (Ultrix)" >&5 -echo $ECHO_N "checking for two-argument statfs with struct fs_data (Ultrix)... $ECHO_C" >&6 + { echo "$as_me:$LINENO: checking for two-argument statfs with struct fs_data (Ultrix)" >&5 +echo $ECHO_N "checking for two-argument statfs with struct fs_data (Ultrix)... $ECHO_C" >&6; } if test "${fu_cv_sys_stat_fs_data+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -8885,13 +9298,22 @@ } _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then @@ -8904,12 +9326,14 @@ ( exit $ac_status ) fu_cv_sys_stat_fs_data=no fi -rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi + + fi - echo "$as_me:$LINENO: result: $fu_cv_sys_stat_fs_data" >&5 -echo "${ECHO_T}$fu_cv_sys_stat_fs_data" >&6 + { echo "$as_me:$LINENO: result: $fu_cv_sys_stat_fs_data" >&5 +echo "${ECHO_T}$fu_cv_sys_stat_fs_data" >&6; } if test $fu_cv_sys_stat_fs_data = yes; then space=yes @@ -8942,8 +9366,8 @@ #endif " -echo "$as_me:$LINENO: checking for struct statfs.f_namemax" >&5 -echo $ECHO_N "checking for struct statfs.f_namemax... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking for struct statfs.f_namemax" >&5 +echo $ECHO_N "checking for struct statfs.f_namemax... $ECHO_C" >&6; } if test "${ac_cv_member_struct_statfs_f_namemax+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -8966,33 +9390,28 @@ } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_member_struct_statfs_f_namemax=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -9011,40 +9430,37 @@ } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_member_struct_statfs_f_namemax=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_member_struct_statfs_f_namemax=no + ac_cv_member_struct_statfs_f_namemax=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_member_struct_statfs_f_namemax" >&5 -echo "${ECHO_T}$ac_cv_member_struct_statfs_f_namemax" >&6 +{ echo "$as_me:$LINENO: result: $ac_cv_member_struct_statfs_f_namemax" >&5 +echo "${ECHO_T}$ac_cv_member_struct_statfs_f_namemax" >&6; } if test $ac_cv_member_struct_statfs_f_namemax = yes; then cat >>confdefs.h <<_ACEOF @@ -9054,8 +9470,8 @@ fi -echo "$as_me:$LINENO: checking for struct statvfs.f_namemax" >&5 -echo $ECHO_N "checking for struct statvfs.f_namemax... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking for struct statvfs.f_namemax" >&5 +echo $ECHO_N "checking for struct statvfs.f_namemax... $ECHO_C" >&6; } if test "${ac_cv_member_struct_statvfs_f_namemax+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -9078,33 +9494,28 @@ } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_member_struct_statvfs_f_namemax=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -9123,40 +9534,37 @@ } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_member_struct_statvfs_f_namemax=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_member_struct_statvfs_f_namemax=no + ac_cv_member_struct_statvfs_f_namemax=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_member_struct_statvfs_f_namemax" >&5 -echo "${ECHO_T}$ac_cv_member_struct_statvfs_f_namemax" >&6 +{ echo "$as_me:$LINENO: result: $ac_cv_member_struct_statvfs_f_namemax" >&5 +echo "${ECHO_T}$ac_cv_member_struct_statvfs_f_namemax" >&6; } if test $ac_cv_member_struct_statvfs_f_namemax = yes; then cat >>confdefs.h <<_ACEOF @@ -9166,8 +9574,8 @@ fi -echo "$as_me:$LINENO: checking for struct statfs.f_namelen" >&5 -echo $ECHO_N "checking for struct statfs.f_namelen... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking for struct statfs.f_namelen" >&5 +echo $ECHO_N "checking for struct statfs.f_namelen... $ECHO_C" >&6; } if test "${ac_cv_member_struct_statfs_f_namelen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -9190,33 +9598,28 @@ } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_member_struct_statfs_f_namelen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -9235,40 +9638,37 @@ } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_member_struct_statfs_f_namelen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_member_struct_statfs_f_namelen=no + ac_cv_member_struct_statfs_f_namelen=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_member_struct_statfs_f_namelen" >&5 -echo "${ECHO_T}$ac_cv_member_struct_statfs_f_namelen" >&6 +{ echo "$as_me:$LINENO: result: $ac_cv_member_struct_statfs_f_namelen" >&5 +echo "${ECHO_T}$ac_cv_member_struct_statfs_f_namelen" >&6; } if test $ac_cv_member_struct_statfs_f_namelen = yes; then cat >>confdefs.h <<_ACEOF @@ -9278,8 +9678,8 @@ fi -echo "$as_me:$LINENO: checking for struct statvfs.f_namelen" >&5 -echo $ECHO_N "checking for struct statvfs.f_namelen... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking for struct statvfs.f_namelen" >&5 +echo $ECHO_N "checking for struct statvfs.f_namelen... $ECHO_C" >&6; } if test "${ac_cv_member_struct_statvfs_f_namelen+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -9302,33 +9702,28 @@ } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_member_struct_statvfs_f_namelen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -9347,40 +9742,37 @@ } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_member_struct_statvfs_f_namelen=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_member_struct_statvfs_f_namelen=no + ac_cv_member_struct_statvfs_f_namelen=no fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_member_struct_statvfs_f_namelen" >&5 -echo "${ECHO_T}$ac_cv_member_struct_statvfs_f_namelen" >&6 +{ echo "$as_me:$LINENO: result: $ac_cv_member_struct_statvfs_f_namelen" >&5 +echo "${ECHO_T}$ac_cv_member_struct_statvfs_f_namelen" >&6; } if test $ac_cv_member_struct_statvfs_f_namelen = yes; then cat >>confdefs.h <<_ACEOF @@ -9394,15 +9786,15 @@ # # Large file support # -# Check whether --enable-largefile or --disable-largefile was given. +# Check whether --enable-largefile was given. if test "${enable_largefile+set}" = set; then - enableval="$enable_largefile" + enableval=$enable_largefile; +fi -fi; if test "$enable_largefile" != no; then - echo "$as_me:$LINENO: checking for special C compiler options needed for large files" >&5 -echo $ECHO_N "checking for special C compiler options needed for large files... $ECHO_C" >&6 + { echo "$as_me:$LINENO: checking for special C compiler options needed for large files" >&5 +echo $ECHO_N "checking for special C compiler options needed for large files... $ECHO_C" >&6; } if test "${ac_cv_sys_largefile_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else @@ -9410,8 +9802,8 @@ if test "$GCC" != yes; then ac_save_CC=$CC while :; do - # IRIX 6.2 and later do not support large files by default, - # so use the C compiler's -n32 option if that helps. + # IRIX 6.2 and later do not support large files by default, + # so use the C compiler's -n32 option if that helps. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -9435,84 +9827,77 @@ return 0; } _ACEOF - rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 + rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 + fi -rm -f conftest.err conftest.$ac_objext - CC="$CC -n32" - rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 + +rm -f core conftest.err conftest.$ac_objext + CC="$CC -n32" + rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_sys_largefile_CC=' -n32'; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 + fi -rm -f conftest.err conftest.$ac_objext + +rm -f core conftest.err conftest.$ac_objext break done CC=$ac_save_CC rm -f conftest.$ac_ext fi fi -echo "$as_me:$LINENO: result: $ac_cv_sys_largefile_CC" >&5 -echo "${ECHO_T}$ac_cv_sys_largefile_CC" >&6 +{ echo "$as_me:$LINENO: result: $ac_cv_sys_largefile_CC" >&5 +echo "${ECHO_T}$ac_cv_sys_largefile_CC" >&6; } if test "$ac_cv_sys_largefile_CC" != no; then CC=$CC$ac_cv_sys_largefile_CC fi - echo "$as_me:$LINENO: checking for _FILE_OFFSET_BITS value needed for large files" >&5 -echo $ECHO_N "checking for _FILE_OFFSET_BITS value needed for large files... $ECHO_C" >&6 + { echo "$as_me:$LINENO: checking for _FILE_OFFSET_BITS value needed for large files" >&5 +echo $ECHO_N "checking for _FILE_OFFSET_BITS value needed for large files... $ECHO_C" >&6; } if test "${ac_cv_sys_file_offset_bits+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else while :; do - ac_cv_sys_file_offset_bits=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -9537,34 +9922,31 @@ } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_sys_file_offset_bits=no; 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 + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -9590,54 +9972,53 @@ } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_sys_file_offset_bits=64; 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 + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_cv_sys_file_offset_bits=unknown break done fi -echo "$as_me:$LINENO: result: $ac_cv_sys_file_offset_bits" >&5 -echo "${ECHO_T}$ac_cv_sys_file_offset_bits" >&6 -if test "$ac_cv_sys_file_offset_bits" != no; then - +{ echo "$as_me:$LINENO: result: $ac_cv_sys_file_offset_bits" >&5 +echo "${ECHO_T}$ac_cv_sys_file_offset_bits" >&6; } +case $ac_cv_sys_file_offset_bits in #( + no | unknown) ;; + *) cat >>confdefs.h <<_ACEOF #define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits _ACEOF - -fi +;; +esac rm -f conftest* - echo "$as_me:$LINENO: checking for _LARGE_FILES value needed for large files" >&5 -echo $ECHO_N "checking for _LARGE_FILES value needed for large files... $ECHO_C" >&6 + if test $ac_cv_sys_file_offset_bits = unknown; then + { echo "$as_me:$LINENO: checking for _LARGE_FILES value needed for large files" >&5 +echo $ECHO_N "checking for _LARGE_FILES value needed for large files... $ECHO_C" >&6; } if test "${ac_cv_sys_large_files+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else while :; do - ac_cv_sys_large_files=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -9662,34 +10043,31 @@ } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_sys_large_files=no; 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 + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -9715,47 +10093,47 @@ } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_sys_large_files=1; 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 + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_cv_sys_large_files=unknown break done fi -echo "$as_me:$LINENO: result: $ac_cv_sys_large_files" >&5 -echo "${ECHO_T}$ac_cv_sys_large_files" >&6 -if test "$ac_cv_sys_large_files" != no; then - +{ echo "$as_me:$LINENO: result: $ac_cv_sys_large_files" >&5 +echo "${ECHO_T}$ac_cv_sys_large_files" >&6; } +case $ac_cv_sys_large_files in #( + no | unknown) ;; + *) cat >>confdefs.h <<_ACEOF #define _LARGE_FILES $ac_cv_sys_large_files _ACEOF - -fi +;; +esac rm -f conftest* + fi fi @@ -9763,17 +10141,17 @@ # mntent # if test "${ac_cv_header_mntent_h+set}" = set; then - echo "$as_me:$LINENO: checking for mntent.h" >&5 -echo $ECHO_N "checking for mntent.h... $ECHO_C" >&6 + { echo "$as_me:$LINENO: checking for mntent.h" >&5 +echo $ECHO_N "checking for mntent.h... $ECHO_C" >&6; } if test "${ac_cv_header_mntent_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi -echo "$as_me:$LINENO: result: $ac_cv_header_mntent_h" >&5 -echo "${ECHO_T}$ac_cv_header_mntent_h" >&6 +{ echo "$as_me:$LINENO: result: $ac_cv_header_mntent_h" >&5 +echo "${ECHO_T}$ac_cv_header_mntent_h" >&6; } else # Is the header compilable? -echo "$as_me:$LINENO: checking mntent.h usability" >&5 -echo $ECHO_N "checking mntent.h usability... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking mntent.h usability" >&5 +echo $ECHO_N "checking mntent.h usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -9784,41 +10162,37 @@ #include _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_header_compiler=no + 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 + +rm -f core 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 mntent.h presence" >&5 -echo $ECHO_N "checking mntent.h presence... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking mntent.h presence" >&5 +echo $ECHO_N "checking mntent.h presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -9827,24 +10201,22 @@ /* 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 +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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_c_preproc_warn_flag - ac_cpp_err=$ac_cpp_err$ac_c_werror_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 @@ -9852,9 +10224,10 @@ 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 +{ 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_c_preproc_warn_flag in @@ -9878,25 +10251,18 @@ echo "$as_me: WARNING: mntent.h: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: mntent.h: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: mntent.h: in the future, the compiler will take precedence" >&2;} - ( - cat <<\_ASBOX -## ----------------------------------- ## -## Report this to the rdesktop lists. ## -## ----------------------------------- ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 + ;; esac -echo "$as_me:$LINENO: checking for mntent.h" >&5 -echo $ECHO_N "checking for mntent.h... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking for mntent.h" >&5 +echo $ECHO_N "checking for mntent.h... $ECHO_C" >&6; } if test "${ac_cv_header_mntent_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_mntent_h=$ac_header_preproc fi -echo "$as_me:$LINENO: result: $ac_cv_header_mntent_h" >&5 -echo "${ECHO_T}$ac_cv_header_mntent_h" >&6 +{ echo "$as_me:$LINENO: result: $ac_cv_header_mntent_h" >&5 +echo "${ECHO_T}$ac_cv_header_mntent_h" >&6; } fi if test $ac_cv_header_mntent_h = yes; then @@ -9911,9 +10277,9 @@ for ac_func in setmntent do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -9939,68 +10305,60 @@ #undef $ac_func -/* Override any gcc2 internal prototype to avoid an error. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" -{ #endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +#if defined __stub_$ac_func || defined __stub___$ac_func choke me -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} #endif int main () { -return f != $ac_func; +return $ac_func (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -eval "$as_ac_var=no" + eval "$as_ac_var=no" fi -rm -f conftest.err conftest.$ac_objext \ + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 @@ -10014,10 +10372,9 @@ # IPv6 # -# Check whether --with-ipv6 or --without-ipv6 was given. +# Check whether --with-ipv6 was given. if test "${with_ipv6+set}" = set; then - withval="$with_ipv6" - + withval=$with_ipv6; if test $withval != "no"; then cat >>confdefs.h <<\_ACEOF @@ -10026,17 +10383,17 @@ fi -fi; +fi + # # debugging # -# Check whether --with-debug or --without-debug was given. +# Check whether --with-debug was given. if test "${with_debug+set}" = set; then - withval="$with_debug" - + withval=$with_debug; if test $withval != "no"; then cat >>confdefs.h <<\_ACEOF @@ -10045,13 +10402,13 @@ fi -fi; +fi -# Check whether --with-debug-kbd or --without-debug-kbd was given. -if test "${with_debug_kbd+set}" = set; then - withval="$with_debug_kbd" +# Check whether --with-debug-kbd was given. +if test "${with_debug_kbd+set}" = set; then + withval=$with_debug_kbd; if test $withval != "no"; then cat >>confdefs.h <<\_ACEOF @@ -10060,13 +10417,13 @@ fi -fi; +fi -# Check whether --with-debug-rdp5 or --without-debug-rdp5 was given. -if test "${with_debug_rdp5+set}" = set; then - withval="$with_debug_rdp5" +# Check whether --with-debug-rdp5 was given. +if test "${with_debug_rdp5+set}" = set; then + withval=$with_debug_rdp5; if test $withval != "no"; then cat >>confdefs.h <<\_ACEOF @@ -10075,13 +10432,13 @@ fi -fi; +fi -# Check whether --with-debug-clipboard or --without-debug-clipboard was given. -if test "${with_debug_clipboard+set}" = set; then - withval="$with_debug_clipboard" +# Check whether --with-debug-clipboard was given. +if test "${with_debug_clipboard+set}" = set; then + withval=$with_debug_clipboard; if test $withval != "no"; then cat >>confdefs.h <<\_ACEOF @@ -10090,13 +10447,28 @@ fi -fi; +fi -# Check whether --with-debug-channel or --without-debug-channel was given. -if test "${with_debug_channel+set}" = set; then - withval="$with_debug_channel" +# Check whether --with-debug-sound was given. +if test "${with_debug_sound+set}" = set; then + withval=$with_debug_sound; + if test $withval != "no"; + then + cat >>confdefs.h <<\_ACEOF +#define WITH_DEBUG_SOUND 1 +_ACEOF + + fi + +fi + + + +# Check whether --with-debug-channel was given. +if test "${with_debug_channel+set}" = set; then + withval=$with_debug_channel; if test $withval != "no"; then cat >>confdefs.h <<\_ACEOF @@ -10105,7 +10477,39 @@ fi -fi; +fi + + + +# Check whether --with-debug-seamless was given. +if test "${with_debug_seamless+set}" = set; then + withval=$with_debug_seamless; + if test $withval != "no"; + then + cat >>confdefs.h <<\_ACEOF +#define WITH_DEBUG_SEAMLESS 1 +_ACEOF + + fi + +fi + + + +# Check whether --with-debug-smartcard was given. +if test "${with_debug_smartcard+set}" = set; then + withval=$with_debug_smartcard; + if test $withval != "no"; + then + if test x"$WITH_SCARD" = "x1"; then + cat >>confdefs.h <<\_ACEOF +#define WITH_DEBUG_SCARD 1 +_ACEOF + + fi + fi + +fi # @@ -10114,57 +10518,86 @@ # strip leading colon from rpath rpath=`echo $rpath |sed 's/^://'` # 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;} +$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || + { { echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5 +echo "$as_me: error: cannot run $SHELL $ac_aux_dir/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 +{ 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" && + ac_build_alias=$build_alias +test "x$ac_build_alias" = x && + ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` +test "x$ac_build_alias" = x && { { 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;} +ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || + { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5 +echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_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 +{ echo "$as_me:$LINENO: result: $ac_cv_build" >&5 +echo "${ECHO_T}$ac_cv_build" >&6; } +case $ac_cv_build in +*-*-*) ;; +*) { { echo "$as_me:$LINENO: error: invalid value of canonical build" >&5 +echo "$as_me: error: invalid value of canonical build" >&2;} + { (exit 1); exit 1; }; };; +esac 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/'` +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_build +shift +build_cpu=$1 +build_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +build_os=$* +IFS=$ac_save_IFS +case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac -echo "$as_me:$LINENO: checking host system type" >&5 -echo $ECHO_N "checking host system type... $ECHO_C" >&6 +{ 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;} + if test "x$host_alias" = x; then + ac_cv_host=$ac_cv_build +else + ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || + { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5 +echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;} { (exit 1); exit 1; }; } +fi fi -echo "$as_me:$LINENO: result: $ac_cv_host" >&5 -echo "${ECHO_T}$ac_cv_host" >&6 +{ echo "$as_me:$LINENO: result: $ac_cv_host" >&5 +echo "${ECHO_T}$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) { { echo "$as_me:$LINENO: error: invalid value of canonical host" >&5 +echo "$as_me: error: invalid value of canonical host" >&2;} + { (exit 1); exit 1; }; };; +esac 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/'` +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_host +shift +host_cpu=$1 +host_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +host_os=$* +IFS=$ac_save_IFS +case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac case "$host" in @@ -10184,7 +10617,8 @@ esac - ac_config_files="$ac_config_files Makefile" +ac_config_files="$ac_config_files Makefile" + 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 @@ -10203,39 +10637,58 @@ # 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. +# So, we kill variables containing newlines. # 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. -{ +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 +echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + *) $as_unset $ac_var ;; + esac ;; + esac + done + (set) 2>&1 | - case `(ac_space=' '; set | grep ac_space) 2>&1` in - *ac_space=\ *) + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}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" + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; - esac; -} | + esac | + sort +) | sed ' + /^ac_cv_env_/b end t clear - : 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" + 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 "$as_me:$LINENO: updating cache $cache_file" >&5 +echo "$as_me: updating cache $cache_file" >&6;} cat confcache >$cache_file else - echo "not updating unwritable cache $cache_file" + { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 +echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache @@ -10244,63 +10697,48 @@ # 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 - # Transform confdefs.h into DEFS. # Protect against shell expansion while executing Makefile rules. # Protect against Makefile macro expansion. # # If the first sed substitution is executed (which looks for macros that -# take arguments), then we branch to the quote section. Otherwise, +# take arguments), then branch to the quote section. Otherwise, # look for a macro that doesn't take arguments. -cat >confdef2opt.sed <<\_ACEOF +ac_script=' t clear -: clear -s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g +:clear +s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g t quote -s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g +s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g t quote -d -: quote -s,[ `~#$^&*(){}\\|;'"<>?],\\&,g -s,\[,\\&,g -s,\],\\&,g -s,\$,$$,g -p -_ACEOF -# We use echo to avoid assuming a particular line-breaking character. -# The extra dot is to prevent the shell from consuming trailing -# line-breaks from the sub-command output. A line-break within -# single-quotes doesn't work because, if this script is created in a -# platform that uses two characters for line-breaks (e.g., DOS), tr -# would break. -ac_LF_and_DOT=`echo; echo .` -DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'` -rm -f confdef2opt.sed +b any +:quote +s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g +s/\[/\\&/g +s/\]/\\&/g +s/\$/$$/g +H +:any +${ + g + s/^\n// + s/\n/ /g + p +} +' +DEFS=`sed -n "$ac_script" confdefs.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' + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`echo "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" + ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs @@ -10331,17 +10769,45 @@ ## M4sh Initialization. ## ## --------------------- ## -# Be Bourne compatible +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh 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 + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + + + +# PATH needs CR +# 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 -DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then @@ -10351,8 +10817,43 @@ fi +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +as_nl=' +' +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +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 +IFS=$as_save_IFS + + ;; +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_myself: error: cannot find myself; rerun with an absolute file name" >&2 + { (exit 1); exit 1; } +fi + # Work around bugs in pre-3.0 UWIN ksh. -$as_unset ENV MAIL MAILPATH +for as_var in ENV MAIL MAILPATH +do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +done PS1='$ ' PS2='> ' PS4='+ ' @@ -10366,18 +10867,19 @@ 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 + ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var fi done # Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1; then +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi -if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false @@ -10385,159 +10887,120 @@ # Name of the executable. -as_me=`$as_basename "$0" || +as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)$' \| \ - . : '\(.\)' 2>/dev/null || + X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } - /^X\/\(\/\/\)$/{ s//\1/; q; } - /^X\/\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - + 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 +# CDPATH. +$as_unset CDPATH - 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 + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # 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. + # line-number line after each line using $LINENO; the second 'sed' + # does the real work. The second script uses 'N' to pair each + # line-number line with the line containing $LINENO, 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 | + # scripts with optimization help from Paolo Bonzini. Blame Lee + # E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno N - s,$,-, - : loop - s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop - s,-$,, - s,^['$as_cr_digits']*\n,, + s/-\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;} + 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 + # original and so on. Autoconf is especially sensitive 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= ;; +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in +-n*) + case `echo 'x\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + *) ECHO_C='\c';; + esac;; +*) + ECHO_N='-n';; esac -if expr a : '\(a\)' >/dev/null 2>&1; then +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir +fi 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='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || 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 +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: @@ -10546,7 +11009,28 @@ as_mkdir_p=false fi -as_executable_p="test -f" +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x # 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'" @@ -10555,31 +11039,14 @@ 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 +# Save the log message, 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 - +# values after options handling. +ac_log=" This file was extended by rdesktop $as_me 1.5.0, which was -generated by GNU Autoconf 2.59. Invocation command line was +generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -10587,30 +11054,18 @@ CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ -_CSEOF -echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 -echo >&5 +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + _ACEOF +cat >>$CONFIG_STATUS <<_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 +config_files="$ac_config_files" -if test -n "$ac_config_commands"; then - echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS -fi +_ACEOF cat >>$CONFIG_STATUS <<\_ACEOF - ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. @@ -10618,7 +11073,7 @@ Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit - -V, --version print version number, then exit + -V, --version print version number and configuration settings, 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 @@ -10629,19 +11084,21 @@ $config_files Report bugs to ." -_ACEOF +_ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ rdesktop config.status 1.5.0 -configured by $0, generated by GNU Autoconf 2.59, - with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" +configured by $0, generated by GNU Autoconf 2.61, + with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" -Copyright (C) 2003 Free Software Foundation, Inc. +Copyright (C) 2006 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" + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +INSTALL='$INSTALL' _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF @@ -10652,60 +11109,42 @@ do case $1 in --*=*) - ac_option=`expr "x$1" : 'x\([^=]*\)='` - ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` + 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 ) + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + echo "$ac_cs_version"; exit ;; + --debug | --debu | --deb | --de | --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;; + --he | --h | --help | --hel | -h ) + echo "$ac_cs_usage"; exit ;; -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;} + -*) { 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" ;; + *) ac_config_targets="$ac_config_targets $1" + ac_need_defaults=false ;; esac shift @@ -10721,28 +11160,42 @@ _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 + echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 + CONFIG_SHELL=$SHELL + export CONFIG_SHELL + exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + echo "$ac_log" +} >&5 - - - +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +_ACEOF cat >>$CONFIG_STATUS <<\_ACEOF + +# Handling of arguments. for ac_config_target in $ac_config_targets do - case "$ac_config_target" in - # Handling of arguments. - "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; + case $ac_config_target in + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + *) { { 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 @@ -10752,349 +11205,430 @@ 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, +# simply because there is no reason against having 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. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. $debug || { - trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 + tmp= + trap 'exit_status=$? + { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$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` && + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { - tmp=./confstat$$-$RANDOM - (umask 077 && mkdir $tmp) + tmp=./conf$$-$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. +# Set up the sed scripts for 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,@CC@,$CC,;t t -s,@CFLAGS@,$CFLAGS,;t t -s,@LDFLAGS@,$LDFLAGS,;t t -s,@CPPFLAGS@,$CPPFLAGS,;t t -s,@ac_ct_CC@,$ac_ct_CC,;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,@CPP@,$CPP,;t t -s,@EGREP@,$EGREP,;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,@STRIP@,$STRIP,;t t -s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t -s,@ssldir@,$ssldir,;t t -s,@VNCINC@,$VNCINC,;t t -s,@LDVNC@,$LDVNC,;t t -s,@VNCLINK@,$VNCLINK,;t t -s,@RDP2VNCTARGET@,$RDP2VNCTARGET,;t t -s,@SOUNDOBJ@,$SOUNDOBJ,;t t -s,@LIBOBJS@,$LIBOBJS,;t t -s,@LIBICONV@,$LIBICONV,;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,@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 +if test -n "$CONFIG_FILES"; then + +_ACEOF + + + +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + cat >conf$$subs.sed <<_ACEOF +SHELL!$SHELL$ac_delim +PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim +PACKAGE_NAME!$PACKAGE_NAME$ac_delim +PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim +PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim +PACKAGE_STRING!$PACKAGE_STRING$ac_delim +PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim +exec_prefix!$exec_prefix$ac_delim +prefix!$prefix$ac_delim +program_transform_name!$program_transform_name$ac_delim +bindir!$bindir$ac_delim +sbindir!$sbindir$ac_delim +libexecdir!$libexecdir$ac_delim +datarootdir!$datarootdir$ac_delim +datadir!$datadir$ac_delim +sysconfdir!$sysconfdir$ac_delim +sharedstatedir!$sharedstatedir$ac_delim +localstatedir!$localstatedir$ac_delim +includedir!$includedir$ac_delim +oldincludedir!$oldincludedir$ac_delim +docdir!$docdir$ac_delim +infodir!$infodir$ac_delim +htmldir!$htmldir$ac_delim +dvidir!$dvidir$ac_delim +pdfdir!$pdfdir$ac_delim +psdir!$psdir$ac_delim +libdir!$libdir$ac_delim +localedir!$localedir$ac_delim +mandir!$mandir$ac_delim +DEFS!$DEFS$ac_delim +ECHO_C!$ECHO_C$ac_delim +ECHO_N!$ECHO_N$ac_delim +ECHO_T!$ECHO_T$ac_delim +LIBS!$LIBS$ac_delim +build_alias!$build_alias$ac_delim +host_alias!$host_alias$ac_delim +target_alias!$target_alias$ac_delim +CC!$CC$ac_delim +CFLAGS!$CFLAGS$ac_delim +LDFLAGS!$LDFLAGS$ac_delim +CPPFLAGS!$CPPFLAGS$ac_delim +ac_ct_CC!$ac_ct_CC$ac_delim +EXEEXT!$EXEEXT$ac_delim +OBJEXT!$OBJEXT$ac_delim +INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim +INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim +INSTALL_DATA!$INSTALL_DATA$ac_delim +CPP!$CPP$ac_delim +GREP!$GREP$ac_delim +EGREP!$EGREP$ac_delim +XMKMF!$XMKMF$ac_delim +X_CFLAGS!$X_CFLAGS$ac_delim +X_PRE_LIBS!$X_PRE_LIBS$ac_delim +X_LIBS!$X_LIBS$ac_delim +X_EXTRA_LIBS!$X_EXTRA_LIBS$ac_delim +PKG_CONFIG!$PKG_CONFIG$ac_delim +STRIP!$STRIP$ac_delim +ssldir!$ssldir$ac_delim +SCARDOBJ!$SCARDOBJ$ac_delim +VNCINC!$VNCINC$ac_delim +LDVNC!$LDVNC$ac_delim +VNCLINK!$VNCLINK$ac_delim +RDP2VNCTARGET!$RDP2VNCTARGET$ac_delim +SOUNDOBJ!$SOUNDOBJ$ac_delim +LIBOBJS!$LIBOBJS$ac_delim +LIBICONV!$LIBICONV$ac_delim +build!$build$ac_delim +build_cpu!$build_cpu$ac_delim +build_vendor!$build_vendor$ac_delim +build_os!$build_os$ac_delim +host!$host$ac_delim +host_cpu!$host_cpu$ac_delim +host_vendor!$host_vendor$ac_delim +host_os!$host_os$ac_delim +LTLIBOBJS!$LTLIBOBJS$ac_delim +_ACEOF + + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 75; then + break + elif $ac_last_try; then + { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 +echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} + { (exit 1); exit 1; }; } + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi -fi # test -n "$CONFIG_FILES" +done + +ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` +if test -n "$ac_eof"; then + ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` + ac_eof=`expr $ac_eof + 1` +fi +cat >>$CONFIG_STATUS <<_ACEOF +cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end +_ACEOF +sed ' +s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g +s/^/s,@/; s/!/@,|#_!!_#|/ +:n +t n +s/'"$ac_delim"'$/,g/; t +s/$/\\/; p +N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n +' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF +:end +s/|#_!!_#|//g +CEOF$ac_eof _ACEOF + + +# 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 + 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 ;; +fi # test -n "$CONFIG_FILES" + + +for ac_tag in :F $CONFIG_FILES +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 +echo "$as_me: error: Invalid tag $ac_tag." >&2;} + { (exit 1); exit 1; }; };; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift - # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. - ac_dir=`(dirname "$ac_file") 2>/dev/null || + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 +echo "$as_me: error: cannot find input file: $ac_f" >&2;} + { (exit 1); exit 1; }; };; + esac + ac_file_inputs="$ac_file_inputs $ac_f" + done + + # 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. */ + configure_input="Generated from "`IFS=: + echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure." + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + fi + + case $ac_tag in + *:-:* | *:-) cat >"$tmp/stdin";; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || + 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" + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + { as_dir="$ac_dir" + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || + while :; do + case $as_dir in #( + *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || + 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'` + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break 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;} + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 +echo "$as_me: error: cannot create directory $as_dir" >&2;} { (exit 1); exit 1; }; }; } - ac_builddir=. -if test "$ac_dir" != .; then +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) 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 + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix case $srcdir in - .) # No --srcdir option. We are building in place. + .) # 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_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. 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 ;; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix -# 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 $ac_mode in + :F) + # + # CONFIG_FILE + # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; - *) ac_INSTALL=$ac_top_builddir$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac +_ACEOF - 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; } +cat >>$CONFIG_STATUS <<\_ACEOF +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= + +case `sed -n '/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p +' $ac_file_inputs` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +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 +s&@configure_input@&$configure_input&;t t +s&@top_builddir@&$ac_top_builddir_sub&;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&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +$ac_datarootdir_hack +" $ac_file_inputs | sed -f "$tmp/subs-1.sed" >$tmp/out + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && + { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined." >&5 +echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined." >&2;} -done -_ACEOF + rm -f "$tmp/stdin" + case $ac_file in + -) cat "$tmp/out"; rm -f "$tmp/out";; + *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; + esac + ;; + + + + esac + +done # for ac_tag -cat >>$CONFIG_STATUS <<\_ACEOF { (exit 0); exit 0; } _ACEOF --- rdesktop-1.5.0.orig/configure.ac +++ rdesktop-1.5.0/configure.ac @@ -13,6 +13,8 @@ AC_C_BIGENDIAN([AC_DEFINE(B_ENDIAN)], [AC_DEFINE(L_ENDIAN)]) AC_PATH_XTRA +AC_PATH_PROG(PKG_CONFIG, pkg-config) + AC_SEARCH_LIBS(socket, socket) AC_SEARCH_LIBS(inet_aton, resolv) @@ -25,6 +27,15 @@ AC_CHECK_TOOL(STRIP, strip, :) +dnl Don't depend on pkg-config +m4_ifdef([PKG_CHECK_MODULES], [], [ + m4_errprint([warning: pkg-config checks are not available]) + m4_defun([PKG_CHECK_MODULES], [ + AC_MSG_WARN([pkg-config not available, cannot check for $2]) + $4 + ]) +]) + rpath="" # @@ -77,6 +88,34 @@ rpath="$rpath:$ssldir/lib" ]) +AC_ARG_ENABLE(smartcard, + [ --enable-smartcard Enables smart-card support. + ], + [ + case "$OSTYPE" in + darwin*) + AC_CHECK_HEADER(PCSC/pcsclite.h, [WITH_SCARD=1], [WITH_SCARD=0]) + AC_DEFINE(PCSC_OSX) + AC_DEFINE(WITH_PCSC120) + PCSCLITE_CFLAGS="" + PCSCLITE_LIBS="-framework PCSC" + ;; + *) + if test -n "$PKG_CONFIG"; then + PKG_CHECK_MODULES(PCSCLITE, libpcsclite, [WITH_SCARD=1], [WITH_SCARD=0]) + fi + ;; + esac + + if test x"$WITH_SCARD" = "x1"; then + SCARDOBJ="scard.o" + CFLAGS="$CFLAGS $PCSCLITE_CFLAGS" + LIBS="$LIBS $PCSCLITE_LIBS" + AC_DEFINE(WITH_SCARD) + fi + ]) + +AC_SUBST(SCARDOBJ) # # Alignment @@ -139,48 +178,137 @@ # # sound # -AC_ARG_WITH(libao, - [ --with-libao=DIR look for libao at DIR/include, DIR/lib], - [ - CFLAGS="$CFLAGS -I$withval/include" - CPPFLAGS="$CPPFLAGS -I$withval/include" - LIBS="$LIBS -L$withval/lib" - rpath="$rpath:$withval/lib" - ] -) sound="yes" AC_ARG_WITH(sound, - [ --with-sound select sound system ("oss", "sgi", "sun" or "libao") ], + [ --with-sound select sound system ("oss", "sgi", "sun", "alsa" or "libao") ], [ sound="$withval" ]) -if test "$sound" = yes; then - AC_CHECK_HEADER(ao/ao.h, [sound=libao]) - AC_CHECK_HEADER(sys/soundcard.h, [sound=oss]) - AC_CHECK_HEADER(dmedia/audio.h, [sound=sgi]) - AC_CHECK_HEADER(sys/audioio.h, [sound=sun]) + +AC_CHECK_HEADER(sys/soundcard.h, [HAVE_OSS=1], [HAVE_OSS=0]) +AC_CHECK_HEADER(dmedia/audio.h, [HAVE_SGI=1], [HAVE_SGI=0]) +AC_CHECK_HEADER(sys/audioio.h, [HAVE_SUN=1], [HAVE_SUN=0]) + +AC_ARG_ENABLE(static-libsamplerate, + [ --enable-static-libsamplerate link libsamplerate statically], + [static_libsamplerate=yes], + [static_libsamplerate=no]) + +if test -n "$PKG_CONFIG"; then + PKG_CHECK_MODULES(LIBAO, ao, [HAVE_LIBAO=1], [HAVE_LIBAO=0]) + PKG_CHECK_MODULES(ALSA, alsa, [HAVE_ALSA=1], [HAVE_ALSA=0]) + PKG_CHECK_MODULES(LIBSAMPLERATE, samplerate, [HAVE_LIBSAMPLERATE=1], [HAVE_LIBSAMPLERATE=0]) + if test x"$HAVE_LIBSAMPLERATE" = "x1"; then + AC_DEFINE(HAVE_LIBSAMPLERATE) + if test x"$static_libsamplerate" = "xyes"; then + _libsamplerate_libdir=`$PKG_CONFIG --errors-to-stdout --variable=libdir samplerate` + LIBSAMPLERATE_LIBS="$_libsamplerate_libdir""/libsamplerate.a" + fi + LIBSAMPLERATE_LIBS="$LIBSAMPLERATE_LIBS -lm" + fi fi -if test "$sound" = no; then - break -elif test "$sound" = oss; then - SOUNDOBJ="rdpsnd.o rdpsnd_oss.o" - AC_DEFINE(WITH_RDPSND) -elif test "$sound" = sgi; then - SOUNDOBJ="rdpsnd.o rdpsnd_sgi.o" - LDFLAGS="$LDFLAGS -laudio" - AC_DEFINE(WITH_RDPSND) -elif test "$sound" = sun; then - SOUNDOBJ="rdpsnd.o rdpsnd_sun.o" - AC_DEFINE(WITH_RDPSND) -elif test "$sound" = libao; then - SOUNDOBJ="rdpsnd.o rdpsnd_libao.o" - LDFLAGS="$LDFLAGS -lao" + +if test "$sound" != "no"; then + SOUNDOBJ="$SOUNDOBJ rdpsnd.o rdpsnd_dsp.o" + CFLAGS="$CFLAGS $LIBSAMPLERATE_CFLAGS" + LIBS="$LIBS $LIBSAMPLERATE_LIBS" AC_DEFINE(WITH_RDPSND) -else - AC_MSG_WARN([sound support disabled]) - AC_MSG_WARN([Currently supported systems are Open Sound System (oss), SGI AL (sgi), Sun/BSD (sun) and libao]) fi + +case $sound in + yes) + if test x"$HAVE_OSS" = "x1"; then + SOUNDOBJ="$SOUNDOBJ rdpsnd_oss.o" + AC_DEFINE(RDPSND_OSS) + fi + + if test x"$HAVE_SGI" = "x1"; then + SOUNDOBJ="$SOUNDOBJ rdpsnd_sgi.o" + LIBS="$LIBS -laudio" + AC_DEFINE(RDPSND_SGI) + fi + + if test x"$HAVE_SUN" = "x1"; then + SOUNDOBJ="$SOUNDOBJ rdpsnd_sun.o" + AC_DEFINE(RDPSND_SUN) + fi + + if test x"$HAVE_ALSA" = "x1"; then + SOUNDOBJ="$SOUNDOBJ rdpsnd_alsa.o" + CFLAGS="$CFLAGS $ALSA_CFLAGS" + LIBS="$LIBS $ALSA_LIBS" + AC_DEFINE(RDPSND_ALSA) + fi + + if test x"$HAVE_LIBAO" = "x1"; then + SOUNDOBJ="$SOUNDOBJ rdpsnd_libao.o" + CFLAGS="$CFLAGS $LIBAO_CFLAGS" + LIBS="$LIBS $LIBAO_LIBS" + AC_DEFINE(RDPSND_LIBAO) + fi + + ;; + + oss) + if test x"$HAVE_OSS" = "x1"; then + SOUNDOBJ="$SOUNDOBJ rdpsnd_oss.o" + AC_DEFINE(RDPSND_OSS) + else + AC_MSG_ERROR([Selected sound system is not available.]) + fi + ;; + + sgi) + if test x"$HAVE_SGI" = "x1"; then + SOUNDOBJ="$SOUNDOBJ rdpsnd_sgi.o" + LIBS="$LIBS -laudio" + AC_DEFINE(RDPSND_SGI) + else + AC_MSG_ERROR([Selected sound system is not available.]) + fi + ;; + + sun) + if test x"$HAVE_SUN" = "x1"; then + SOUNDOBJ="$SOUNDOBJ rdpsnd_sun.o" + AC_DEFINE(RDPSND_SUN) + else + AC_MSG_ERROR([Selected sound system is not available.]) + fi + ;; + + alsa) + if test x"$HAVE_ALSA" = "x1"; then + SOUNDOBJ="$SOUNDOBJ rdpsnd_alsa.o" + CFLAGS="$CFLAGS $ALSA_CFLAGS" + LIBS="$LIBS $ALSA_LIBS" + AC_DEFINE(RDPSND_ALSA) + else + AC_MSG_ERROR([Selected sound system is not available.]) + fi + ;; + + libao) + if test x"$HAVE_LIBAO" = "x1"; then + SOUNDOBJ="$SOUNDOBJ rdpsnd_libao.o" + CFLAGS="$CFLAGS $LIBAO_CFLAGS" + LIBS="$LIBS $LIBAO_LIBS" + AC_DEFINE(RDPSND_LIBAO) + else + AC_MSG_ERROR([Selected sound system is not available.]) + fi + ;; + + no) + ;; + + *) + AC_MSG_WARN([sound support disabled]) + AC_MSG_WARN([Currently supported systems are Open Sound System (oss), SGI AL (sgi), Sun/BSD (sun), ALSA (alsa) and libao]) + ;; +esac + AC_SUBST(SOUNDOBJ) # @@ -684,6 +812,15 @@ fi ]) +AC_ARG_WITH(debug-sound, + [ --with-debug-sound enable debugging of sound code], + [ + if test $withval != "no"; + then + AC_DEFINE(WITH_DEBUG_SOUND,1) + fi + ]) + AC_ARG_WITH(debug-channel, [ --with-debug-channel enable debugging of virtual channel code], [ @@ -693,6 +830,25 @@ fi ]) +AC_ARG_WITH(debug-seamless, + [ --with-debug-seamless enable debugging of SeamlessRDP code], + [ + if test $withval != "no"; + then + AC_DEFINE(WITH_DEBUG_SEAMLESS,1) + fi + ]) + +AC_ARG_WITH(debug-smartcard, + [ --with-debug-smartcard enable debugging of smart-card code], + [ + if test $withval != "no"; + then + if test x"$WITH_SCARD" = "x1"; then + AC_DEFINE(WITH_DEBUG_SCARD,1) + fi + fi + ]) # # target-specific stuff --- rdesktop-1.5.0.orig/constants.h +++ rdesktop-1.5.0/constants.h @@ -1,8 +1,8 @@ /* rdesktop: A Remote Desktop Protocol client. Miscellaneous protocol constants - Copyright (C) Matthew Chapman 1999-2005 - + Copyright (C) Matthew Chapman 1999-2007 + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or @@ -312,8 +312,10 @@ #define MASK_CHANGE_BIT(var, mask, active) (var = ((var & ~mask) | (active ? mask : 0))) /* Clipboard constants, "borrowed" from GCC system headers in - the w32 cross compiler */ + the w32 cross compiler + this is the CF_ set when WINVER is 0x0400 */ +#ifndef CF_TEXT #define CF_TEXT 1 #define CF_BITMAP 2 #define CF_METAFILEPICT 3 @@ -340,6 +342,7 @@ #define CF_PRIVATELAST 767 #define CF_GDIOBJFIRST 768 #define CF_GDIOBJLAST 1023 +#endif /* Sound format constants */ #define WAVE_FORMAT_PCM 1 @@ -354,28 +357,28 @@ #define CHANNEL_OPTION_SHOW_PROTOCOL 0x00200000 /* NT status codes for RDPDR */ -#define STATUS_SUCCESS 0x00000000 -#define STATUS_NOT_IMPLEMENTED 0x00000001 -#define STATUS_PENDING 0x00000103 - -#define STATUS_NO_MORE_FILES 0x80000006 -#define STATUS_DEVICE_PAPER_EMPTY 0x8000000e -#define STATUS_DEVICE_POWERED_OFF 0x8000000f -#define STATUS_DEVICE_OFF_LINE 0x80000010 -#define STATUS_DEVICE_BUSY 0x80000011 - -#define STATUS_INVALID_HANDLE 0xc0000008 -#define STATUS_INVALID_PARAMETER 0xc000000d -#define STATUS_NO_SUCH_FILE 0xc000000f -#define STATUS_INVALID_DEVICE_REQUEST 0xc0000010 -#define STATUS_ACCESS_DENIED 0xc0000022 -#define STATUS_OBJECT_NAME_COLLISION 0xc0000035 -#define STATUS_DISK_FULL 0xc000007f -#define STATUS_FILE_IS_A_DIRECTORY 0xc00000ba -#define STATUS_NOT_SUPPORTED 0xc00000bb -#define STATUS_TIMEOUT 0xc0000102 -#define STATUS_NOTIFY_ENUM_DIR 0xc000010c -#define STATUS_CANCELLED 0xc0000120 +#define RD_STATUS_SUCCESS 0x00000000 +#define RD_STATUS_NOT_IMPLEMENTED 0x00000001 +#define RD_STATUS_PENDING 0x00000103 + +#define RD_STATUS_NO_MORE_FILES 0x80000006 +#define RD_STATUS_DEVICE_PAPER_EMPTY 0x8000000e +#define RD_STATUS_DEVICE_POWERED_OFF 0x8000000f +#define RD_STATUS_DEVICE_OFF_LINE 0x80000010 +#define RD_STATUS_DEVICE_BUSY 0x80000011 + +#define RD_STATUS_INVALID_HANDLE 0xc0000008 +#define RD_STATUS_INVALID_PARAMETER 0xc000000d +#define RD_STATUS_NO_SUCH_FILE 0xc000000f +#define RD_STATUS_INVALID_DEVICE_REQUEST 0xc0000010 +#define RD_STATUS_ACCESS_DENIED 0xc0000022 +#define RD_STATUS_OBJECT_NAME_COLLISION 0xc0000035 +#define RD_STATUS_DISK_FULL 0xc000007f +#define RD_STATUS_FILE_IS_A_DIRECTORY 0xc00000ba +#define RD_STATUS_NOT_SUPPORTED 0xc00000bb +#define RD_STATUS_TIMEOUT 0xc0000102 +#define RD_STATUS_NOTIFY_ENUM_DIR 0xc000010c +#define RD_STATUS_CANCELLED 0xc0000120 /* RDPDR constants */ @@ -425,3 +428,10 @@ #define SEAMLESSRDP_HELLO_RECONNECT 0x0001 #define SEAMLESSRDP_HELLO_HIDDEN 0x0002 + +/* Smartcard constants */ +#define SCARD_LOCK_TCP 0 +#define SCARD_LOCK_SEC 1 +#define SCARD_LOCK_CHANNEL 2 +#define SCARD_LOCK_RDPDR 3 +#define SCARD_LOCK_LAST 4 --- rdesktop-1.5.0.orig/debian/changelog +++ rdesktop-1.5.0/debian/changelog @@ -0,0 +1,149 @@ +rdesktop (1.5.0-3+cvs20071006) unstable; urgency=low + + * Fix segfault in XGetPointerMapping() thanks to Felix Domke + (closes: #445779). + + -- Laszlo Boszormenyi (GCS) Sun, 21 Oct 2007 21:34:16 +0200 + +rdesktop (1.5.0-2+cvs20071006) unstable; urgency=low + + * CVS snapshot. + + -- Laszlo Boszormenyi (GCS) Sat, 06 Oct 2007 10:20:59 +0200 + +rdesktop (1.5.0-2) unstable; urgency=low + + * Fix segfault regression caused by libx11-6 security fix. + + -- Laszlo Boszormenyi (GCS) Thu, 12 Apr 2007 21:34:13 +0000 + +rdesktop (1.5.0-1) unstable; urgency=low + + * New upstream release (closes: #393520), accept Victor's change + (closes: #343946). + * New maintainer with ACK from Tomas. + * Tune packaging. + + -- Laszlo Boszormenyi (GCS) Tue, 17 Oct 2006 21:31:16 +0000 + +rdesktop (1.4.1-1.1) unstable; urgency=low + + * Non-maintainer upload. + * xlibs-dev transition. + + -- Victor Seva Sat, 17 Dec 2005 16:17:35 +0100 + +rdesktop (1.4.1-1) unstable; urgency=low + + * New upstream release. + + -- Tomas Fasth Tue, 24 May 2005 13:31:34 +0000 + +rdesktop (1.4.0-2) unstable; urgency=low + + * New maintainer. + * Update Standards-Version to 3.6.1 + + -- Tomas Fasth Fri, 15 Apr 2005 17:47:28 +0000 + +rdesktop (1.4.0-1) unstable; urgency=low + + * NMU: New upstream release with a nod from Sam. + * NMU: Fixed debian/rules to come clean with lintian as follows; + Man page now goes to /usr/share/man instead of /usr/X11R6/man. + Calling dh_installchangelogs before calling dh_installdocs. + + -- Tomas Fasth Wed, 13 Apr 2005 22:59:56 +0000 + +rdesktop (1.3.1-1.1) unstable; urgency=low + + * NMU: apply XEmbed patch, Closes: #268896 + + -- Riku Voipio Sat, 6 Nov 2004 10:09:21 +0000 + +rdesktop (1.3.1-1) unstable; urgency=low + + * New upstream release + * Removes unnecessary manpage. Closes: #223832. + + -- Sam Johnston Wed, 4 Feb 2004 17:52:26 +1100 + +rdesktop (1.3.0-1) unstable; urgency=medium + + * New upstream release + * Adds ChangeLog. Closes: #189667. + * Adds RDP5 support. Closes: #212362. + * Resolves keymap problems. Closes: #198201. + * Adds upstream documentation. Closes: #189666. + + -- Sam Johnston Thu, 30 Oct 2003 13:09:41 +1100 + +rdesktop (1.2.0-2) unstable; urgency=medium + + * resolves lintian warnings: out-of-date-standards-version, + copyright-lists-upstream-authors-with-dh_make-boilerplate, + postinst-should-not-set-usr-doc-link + * built against libssl0.9.7. Closes: #180997. + * updates maintainer email address + * no upstream changelog - 1.2.0 changes listed below. Closes: #186974. + * new more portable key mapping code + * support for high (128-bit) encryption + * toggling out of full-screen mode with Ctrl-Alt-Enter + * a few extra options including host:port syntax + * many, many bug fixes and optimisations + + -- Sam Johnston Tue, 8 Apr 2003 13:56:51 +1000 + +rdesktop (1.2.0-1) unstable; urgency=low + + * New upstream release. Closes: #179546. + + -- Sam Johnston Sun, 23 Feb 2003 17:22:28 +1100 + +rdesktop (1.2beta1-1) unstable; urgency=low + + * New upstream version released (beta) + * License exemption obtained for OpenSSL. Closes: #172574. + + -- Sam Johnston Sun, 8 Dec 2002 15:00:42 +1100 + +rdesktop (1.1.0-2) unstable; urgency=low + + * Moved into main (http://www.debian.org/legal/cryptoinmain) + + -- Sam Johnston Sat, 23 Mar 2002 21:43:05 +1100 + +rdesktop (1.1.0-1) unstable; urgency=low + + * New upstream version released + * Incorporates many fixes from the unified patches: + http://bibl4.oru.se/projects/rdesktop/patch19-changes.txt + * Keyboard support fixes and official manpage to be included in next + release + + -- Sam Johnston Mon, 17 Sep 2001 23:52:08 +1000 + +rdesktop (1.0.0+19.6.6-2.1) unstable; urgency=low + + * NMU (for porting) + * Change rdesktop.h to include and define L_ENDIAN / B_ENDIAN + based on that. Closes: #103409 #103499 + * Change rdesktop.h to define NEEDS_ALIGN on all architecture except i386. + + -- Matthew Wilcox Wed, 11 Jul 2001 20:04:56 -0400 + +rdesktop (1.0.0+19.6.6-2) unstable; urgency=low + + * Rebuild with sane version of dpkg-dev + + -- Sam Johnston Tue, 3 Jul 2001 00:12:06 +1000 + +rdesktop (1.0.0+19.6.6-1) unstable; urgency=low + + * Initial Release. + + -- Sam Johnston Wed, 27 Jun 2001 23:53:17 +1000 + +Local variables: +mode: debian-changelog +End: --- rdesktop-1.5.0.orig/debian/compat +++ rdesktop-1.5.0/debian/compat @@ -0,0 +1 @@ +4 --- rdesktop-1.5.0.orig/debian/control +++ rdesktop-1.5.0/debian/control @@ -0,0 +1,16 @@ +Source: rdesktop +Section: x11 +Priority: optional +Maintainer: Laszlo Boszormenyi (GCS) +Build-Depends: debhelper (>= 4.0.0), autotools-dev, libxt-dev, libx11-dev, x-dev, libssl-dev +Standards-Version: 3.7.2 + +Package: rdesktop +Architecture: any +Depends: ${shlibs:Depends} +Description: RDP client for Windows NT/2000 Terminal Server + rdesktop is an open source client for Windows NT/2000 Terminal Server, capable + of natively speaking its Remote Desktop Protocol (RDP) in order to present + the user's NT/2000 desktop. Unlike Citrix ICA, no server extensions are + required. + --- rdesktop-1.5.0.orig/debian/copyright +++ rdesktop-1.5.0/debian/copyright @@ -0,0 +1,32 @@ +This package was debianized by Sam Johnston on +Wed, 27 Jun 2001 00:52:32 +1000. +Adopted by Laszlo Boszormenyi (GCS) on +Tue Oct 17 23:37:49 CEST 2006 from Tomas Fasth . + +It was downloaded from http://www.rdesktop.org + +Upstream Author: Matthew Chapman + +Copyright: + + Copyright (C) Matthew Chapman 1999-2000 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version, with the additional exemption that + compiling, linking, and/or using OpenSSL together with this software is + allowed. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. + +On Debian GNU/Linux systems, the complete text of the GNU General Public +License can be found in the `/usr/share/common-licenses' directory. + --- rdesktop-1.5.0.orig/debian/docs +++ rdesktop-1.5.0/debian/docs @@ -0,0 +1,9 @@ +doc/AUTHORS +doc/HACKING +doc/TODO +doc/ipv6.txt +doc/keymap-names.txt +doc/keymapping.txt +doc/licensing.txt +doc/patches.txt +doc/redirection.txt --- rdesktop-1.5.0.orig/debian/rules +++ rdesktop-1.5.0/debian/rules @@ -0,0 +1,83 @@ +#!/usr/bin/make -f +# -*- makefile -*- + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + + +# These are used for cross-compiling and for saving the configure script +# from having to guess our platform (since we know it already) +DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) +DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) + + +CFLAGS = -Wall -g + +ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) + CFLAGS += -O0 +else + CFLAGS += -O2 +endif + +config.status: configure + dh_testdir + + CFLAGS="$(CFLAGS)" ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info + + +build: build-stamp + +build-stamp: config.status + dh_testdir + + $(MAKE) + + touch build-stamp + +clean: + dh_testdir + dh_testroot + rm -f build-stamp + + [ ! -f Makefile ] || $(MAKE) distclean + +ifneq "$(wildcard /usr/share/misc/config.sub)" "" + cp -f /usr/share/misc/config.sub config.sub +endif +ifneq "$(wildcard /usr/share/misc/config.guess)" "" + cp -f /usr/share/misc/config.guess config.guess +endif + + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + $(MAKE) install DESTDIR=$(CURDIR)/debian/rdesktop + +binary-indep: build install + +binary-arch: build install + dh_testdir + dh_testroot + dh_installchangelogs doc/ChangeLog + dh_installexamples + dh_install + dh_installmenu + dh_installman + dh_installdocs + dh_link + dh_strip + dh_compress + dh_fixperms + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install --- rdesktop-1.5.0.orig/disk.c +++ rdesktop-1.5.0/disk.c @@ -1,7 +1,7 @@ /* -*- c-basic-offset: 8 -*- rdesktop: A Remote Desktop Protocol client. Disk Redirection - Copyright (C) Jeroen Meijer 2003 + Copyright (C) Jeroen Meijer 2003-2007 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -140,7 +140,7 @@ extern RDPDR_DEVICE g_rdpdr_device[]; FILEINFO g_fileinfo[MAX_OPEN_FILES]; -BOOL g_notify_stamp = False; +RD_BOOL g_notify_stamp = False; typedef struct { @@ -150,15 +150,15 @@ char type[PATH_MAX]; } FsInfoType; -static NTSTATUS NotifyInfo(NTHANDLE handle, uint32 info_class, NOTIFY * p); +static RD_NTSTATUS NotifyInfo(RD_NTHANDLE handle, uint32 info_class, NOTIFY * p); static time_t -get_create_time(struct stat *st) +get_create_time(struct stat *filestat) { time_t ret, ret1; - ret = MIN(st->st_ctime, st->st_mtime); - ret1 = MIN(ret, st->st_atime); + ret = MIN(filestat->st_ctime, filestat->st_mtime); + ret1 = MIN(ret, filestat->st_atime); if (ret1 != (time_t) 0) return ret1; @@ -262,7 +262,7 @@ open_weak_exclusive(const char *pathname, int flags, mode_t mode) { int ret; - struct stat statbuf; + struct stat filestat; ret = open(pathname, flags, mode); if (ret != -1 || !(flags & O_EXCL)) @@ -291,7 +291,7 @@ } /* Retry with GUARDED semantics */ - if (stat(pathname, &statbuf) != -1) + if (stat(pathname, &filestat) != -1) { /* File exists */ errno = EEXIST; @@ -337,11 +337,11 @@ } /* Opens or creates a file or directory */ -static NTSTATUS +static RD_NTSTATUS disk_create(uint32 device_id, uint32 accessmask, uint32 sharemode, uint32 create_disposition, - uint32 flags_and_attributes, char *filename, NTHANDLE * phandle) + uint32 flags_and_attributes, char *filename, RD_NTHANDLE * phandle) { - NTHANDLE handle; + RD_NTHANDLE handle; DIR *dirp; int flags, mode; char path[PATH_MAX]; @@ -395,7 +395,7 @@ if ((stat(path, &filestat) == 0) && (S_ISDIR(filestat.st_mode))) { if (flags_and_attributes & FILE_NON_DIRECTORY_FILE) - return STATUS_FILE_IS_A_DIRECTORY; + return RD_STATUS_FILE_IS_A_DIRECTORY; else flags_and_attributes |= FILE_DIRECTORY_FILE; } @@ -414,16 +414,16 @@ { case EACCES: - return STATUS_ACCESS_DENIED; + return RD_STATUS_ACCESS_DENIED; case ENOENT: - return STATUS_NO_SUCH_FILE; + return RD_STATUS_NO_SUCH_FILE; default: perror("opendir"); - return STATUS_NO_SUCH_FILE; + return RD_STATUS_NO_SUCH_FILE; } } handle = DIRFD(dirp); @@ -452,22 +452,22 @@ { case EISDIR: - return STATUS_FILE_IS_A_DIRECTORY; + return RD_STATUS_FILE_IS_A_DIRECTORY; case EACCES: - return STATUS_ACCESS_DENIED; + return RD_STATUS_ACCESS_DENIED; case ENOENT: - return STATUS_NO_SUCH_FILE; + return RD_STATUS_NO_SUCH_FILE; case EEXIST: - return STATUS_OBJECT_NAME_COLLISION; + return RD_STATUS_OBJECT_NAME_COLLISION; default: perror("open"); - return STATUS_NO_SUCH_FILE; + return RD_STATUS_NO_SUCH_FILE; } } @@ -493,36 +493,39 @@ g_fileinfo[handle].accessmask = accessmask; strncpy(g_fileinfo[handle].path, path, PATH_MAX - 1); g_fileinfo[handle].delete_on_close = False; - g_notify_stamp = True; + + if (accessmask & GENERIC_ALL || accessmask & GENERIC_WRITE) + g_notify_stamp = True; *phandle = handle; - return STATUS_SUCCESS; + return RD_STATUS_SUCCESS; } -static NTSTATUS -disk_close(NTHANDLE handle) +static RD_NTSTATUS +disk_close(RD_NTHANDLE handle) { struct fileinfo *pfinfo; pfinfo = &(g_fileinfo[handle]); - g_notify_stamp = True; + if (pfinfo->accessmask & GENERIC_ALL || pfinfo->accessmask & GENERIC_WRITE) + g_notify_stamp = True; - rdpdr_abort_io(handle, 0, STATUS_CANCELLED); + rdpdr_abort_io(handle, 0, RD_STATUS_CANCELLED); if (pfinfo->pdir) { if (closedir(pfinfo->pdir) < 0) { perror("closedir"); - return STATUS_INVALID_HANDLE; + return RD_STATUS_INVALID_HANDLE; } if (pfinfo->delete_on_close) if (rmdir(pfinfo->path) < 0) { perror(pfinfo->path); - return STATUS_ACCESS_DENIED; + return RD_STATUS_ACCESS_DENIED; } pfinfo->delete_on_close = False; } @@ -531,23 +534,23 @@ if (close(handle) < 0) { perror("close"); - return STATUS_INVALID_HANDLE; + return RD_STATUS_INVALID_HANDLE; } if (pfinfo->delete_on_close) if (unlink(pfinfo->path) < 0) { perror(pfinfo->path); - return STATUS_ACCESS_DENIED; + return RD_STATUS_ACCESS_DENIED; } pfinfo->delete_on_close = False; } - return STATUS_SUCCESS; + return RD_STATUS_SUCCESS; } -static NTSTATUS -disk_read(NTHANDLE handle, uint8 * data, uint32 length, uint32 offset, uint32 * result) +static RD_NTSTATUS +disk_read(RD_NTHANDLE handle, uint8 * data, uint32 length, uint32 offset, uint32 * result) { int n; @@ -574,20 +577,20 @@ /* Implement 24 Byte directory read ?? with STATUS_NOT_IMPLEMENTED server doesn't read again */ /* return STATUS_FILE_IS_A_DIRECTORY; */ - return STATUS_NOT_IMPLEMENTED; + return RD_STATUS_NOT_IMPLEMENTED; default: perror("read"); - return STATUS_INVALID_PARAMETER; + return RD_STATUS_INVALID_PARAMETER; } } *result = n; - return STATUS_SUCCESS; + return RD_STATUS_SUCCESS; } -static NTSTATUS -disk_write(NTHANDLE handle, uint8 * data, uint32 length, uint32 offset, uint32 * result) +static RD_NTSTATUS +disk_write(RD_NTHANDLE handle, uint8 * data, uint32 length, uint32 offset, uint32 * result) { int n; @@ -602,19 +605,19 @@ switch (errno) { case ENOSPC: - return STATUS_DISK_FULL; + return RD_STATUS_DISK_FULL; default: - return STATUS_ACCESS_DENIED; + return RD_STATUS_ACCESS_DENIED; } } *result = n; - return STATUS_SUCCESS; + return RD_STATUS_SUCCESS; } -NTSTATUS -disk_query_information(NTHANDLE handle, uint32 info_class, STREAM out) +RD_NTSTATUS +disk_query_information(RD_NTHANDLE handle, uint32 info_class, STREAM out) { uint32 file_attributes, ft_high, ft_low; struct stat filestat; @@ -627,7 +630,7 @@ { perror("stat"); out_uint8(out, 0); - return STATUS_ACCESS_DENIED; + return RD_STATUS_ACCESS_DENIED; } /* Set file attributes */ @@ -689,13 +692,13 @@ default: unimpl("IRP Query (File) Information class: 0x%x\n", info_class); - return STATUS_INVALID_PARAMETER; + return RD_STATUS_INVALID_PARAMETER; } - return STATUS_SUCCESS; + return RD_STATUS_SUCCESS; } -NTSTATUS -disk_set_information(NTHANDLE handle, uint32 info_class, STREAM in, STREAM out) +RD_NTSTATUS +disk_set_information(RD_NTHANDLE handle, uint32 info_class, STREAM in, STREAM out) { uint32 length, file_attributes, ft_high, ft_low, delete_on_close; char newname[PATH_MAX], fullpath[PATH_MAX]; @@ -742,7 +745,7 @@ in_uint32_le(in, file_attributes); if (fstat(handle, &filestat)) - return STATUS_ACCESS_DENIED; + return RD_STATUS_ACCESS_DENIED; tvs.modtime = filestat.st_mtime; tvs.actime = filestat.st_atime; @@ -768,7 +771,7 @@ ctime(&tvs.modtime)); #endif if (utime(pfinfo->path, &tvs) && errno != EPERM) - return STATUS_ACCESS_DENIED; + return RD_STATUS_ACCESS_DENIED; } if (!file_attributes) @@ -787,7 +790,7 @@ #endif if (fchmod(handle, mode)) - return STATUS_ACCESS_DENIED; + return RD_STATUS_ACCESS_DENIED; break; @@ -804,7 +807,7 @@ } else { - return STATUS_INVALID_PARAMETER; + return RD_STATUS_INVALID_PARAMETER; } sprintf(fullpath, "%s%s", g_rdpdr_device[pfinfo->device_id].local_path, @@ -813,7 +816,7 @@ if (rename(pfinfo->path, fullpath) != 0) { perror("rename"); - return STATUS_ACCESS_DENIED; + return RD_STATUS_ACCESS_DENIED; } break; @@ -852,46 +855,46 @@ /* prevents start of writing if not enough space left on device */ if (STATFS_FN(g_rdpdr_device[pfinfo->device_id].local_path, &stat_fs) == 0) if (stat_fs.f_bfree * stat_fs.f_bsize < length) - return STATUS_DISK_FULL; + return RD_STATUS_DISK_FULL; if (ftruncate_growable(handle, length) != 0) { - return STATUS_DISK_FULL; + return RD_STATUS_DISK_FULL; } break; default: unimpl("IRP Set File Information class: 0x%x\n", info_class); - return STATUS_INVALID_PARAMETER; + return RD_STATUS_INVALID_PARAMETER; } - return STATUS_SUCCESS; + return RD_STATUS_SUCCESS; } -NTSTATUS -disk_check_notify(NTHANDLE handle) +RD_NTSTATUS +disk_check_notify(RD_NTHANDLE handle) { struct fileinfo *pfinfo; - NTSTATUS status = STATUS_PENDING; + RD_NTSTATUS status = RD_STATUS_PENDING; NOTIFY notify; pfinfo = &(g_fileinfo[handle]); if (!pfinfo->pdir) - return STATUS_INVALID_DEVICE_REQUEST; + return RD_STATUS_INVALID_DEVICE_REQUEST; status = NotifyInfo(handle, pfinfo->info_class, ¬ify); - if (status != STATUS_PENDING) + if (status != RD_STATUS_PENDING) return status; if (memcmp(&pfinfo->notify, ¬ify, sizeof(NOTIFY))) { /*printf("disk_check_notify found changed event\n"); */ memcpy(&pfinfo->notify, ¬ify, sizeof(NOTIFY)); - status = STATUS_NOTIFY_ENUM_DIR; + status = RD_STATUS_NOTIFY_ENUM_DIR; } return status; @@ -899,12 +902,12 @@ } -NTSTATUS -disk_create_notify(NTHANDLE handle, uint32 info_class) +RD_NTSTATUS +disk_create_notify(RD_NTHANDLE handle, uint32 info_class) { struct fileinfo *pfinfo; - NTSTATUS ret = STATUS_PENDING; + RD_NTSTATUS ret = RD_STATUS_PENDING; /* printf("start disk_create_notify info_class %X\n", info_class); */ @@ -915,8 +918,8 @@ if (info_class & 0x1000) { /* ???? */ - if (ret == STATUS_PENDING) - return STATUS_SUCCESS; + if (ret == RD_STATUS_PENDING) + return RD_STATUS_SUCCESS; } /* printf("disk_create_notify: num_entries %d\n", pfinfo->notify.num_entries); */ @@ -926,23 +929,23 @@ } -static NTSTATUS -NotifyInfo(NTHANDLE handle, uint32 info_class, NOTIFY * p) +static RD_NTSTATUS +NotifyInfo(RD_NTHANDLE handle, uint32 info_class, NOTIFY * p) { struct fileinfo *pfinfo; - struct stat buf; + struct stat filestat; struct dirent *dp; char *fullname; DIR *dpr; pfinfo = &(g_fileinfo[handle]); - if (fstat(handle, &buf) < 0) + if (fstat(handle, &filestat) < 0) { perror("NotifyInfo"); - return STATUS_ACCESS_DENIED; + return RD_STATUS_ACCESS_DENIED; } - p->modify_time = buf.st_mtime; - p->status_time = buf.st_ctime; + p->modify_time = filestat.st_mtime; + p->status_time = filestat.st_ctime; p->num_entries = 0; p->total_time = 0; @@ -951,7 +954,7 @@ if (!dpr) { perror("NotifyInfo"); - return STATUS_ACCESS_DENIED; + return RD_STATUS_ACCESS_DENIED; } @@ -963,16 +966,16 @@ fullname = (char *) xmalloc(strlen(pfinfo->path) + strlen(dp->d_name) + 2); sprintf(fullname, "%s/%s", pfinfo->path, dp->d_name); - if (!stat(fullname, &buf)) + if (!stat(fullname, &filestat)) { - p->total_time += (buf.st_mtime + buf.st_ctime); + p->total_time += (filestat.st_mtime + filestat.st_ctime); } xfree(fullname); } closedir(dpr); - return STATUS_PENDING; + return RD_STATUS_PENDING; } static FsInfoType * @@ -1043,8 +1046,8 @@ } -NTSTATUS -disk_query_volume_information(NTHANDLE handle, uint32 info_class, STREAM out) +RD_NTSTATUS +disk_query_volume_information(RD_NTHANDLE handle, uint32 info_class, STREAM out) { struct STATFS_T stat_fs; struct fileinfo *pfinfo; @@ -1055,7 +1058,7 @@ if (STATFS_FN(pfinfo->path, &stat_fs) != 0) { perror("statfs"); - return STATUS_ACCESS_DENIED; + return RD_STATUS_ACCESS_DENIED; } fsinfo = FsVolumeInfo(pfinfo->path); @@ -1103,19 +1106,19 @@ default: unimpl("IRP Query Volume Information class: 0x%x\n", info_class); - return STATUS_INVALID_PARAMETER; + return RD_STATUS_INVALID_PARAMETER; } - return STATUS_SUCCESS; + return RD_STATUS_SUCCESS; } -NTSTATUS -disk_query_directory(NTHANDLE handle, uint32 info_class, char *pattern, STREAM out) +RD_NTSTATUS +disk_query_directory(RD_NTHANDLE handle, uint32 info_class, char *pattern, STREAM out) { uint32 file_attributes, ft_low, ft_high; char *dirname, fullpath[PATH_MAX]; DIR *pdir; struct dirent *pdirent; - struct stat fstat; + struct stat filestat; struct fileinfo *pfinfo; pfinfo = &(g_fileinfo[handle]); @@ -1140,12 +1143,12 @@ pdirent = readdir(pdir); if (pdirent == NULL) - return STATUS_NO_MORE_FILES; + return RD_STATUS_NO_MORE_FILES; /* Get information for directory entry */ sprintf(fullpath, "%s/%s", dirname, pdirent->d_name); - if (stat(fullpath, &fstat)) + if (stat(fullpath, &filestat)) { switch (errno) { @@ -1153,48 +1156,49 @@ case ELOOP: case EACCES: /* These are non-fatal errors. */ - memset(&fstat, 0, sizeof(fstat)); + memset(&filestat, 0, sizeof(filestat)); break; default: /* Fatal error. By returning STATUS_NO_SUCH_FILE, the directory list operation will be aborted */ perror(fullpath); out_uint8(out, 0); - return STATUS_NO_SUCH_FILE; + return RD_STATUS_NO_SUCH_FILE; } } - if (S_ISDIR(fstat.st_mode)) + if (S_ISDIR(filestat.st_mode)) file_attributes |= FILE_ATTRIBUTE_DIRECTORY; if (pdirent->d_name[0] == '.') file_attributes |= FILE_ATTRIBUTE_HIDDEN; if (!file_attributes) file_attributes |= FILE_ATTRIBUTE_NORMAL; - if (!(fstat.st_mode & S_IWUSR)) + if (!(filestat.st_mode & S_IWUSR)) file_attributes |= FILE_ATTRIBUTE_READONLY; /* Return requested information */ out_uint8s(out, 8); /* unknown zero */ - seconds_since_1970_to_filetime(get_create_time(&fstat), &ft_high, &ft_low); + seconds_since_1970_to_filetime(get_create_time(&filestat), &ft_high, + &ft_low); out_uint32_le(out, ft_low); /* create time */ out_uint32_le(out, ft_high); - seconds_since_1970_to_filetime(fstat.st_atime, &ft_high, &ft_low); + seconds_since_1970_to_filetime(filestat.st_atime, &ft_high, &ft_low); out_uint32_le(out, ft_low); /* last_access_time */ out_uint32_le(out, ft_high); - seconds_since_1970_to_filetime(fstat.st_mtime, &ft_high, &ft_low); + seconds_since_1970_to_filetime(filestat.st_mtime, &ft_high, &ft_low); out_uint32_le(out, ft_low); /* last_write_time */ out_uint32_le(out, ft_high); - seconds_since_1970_to_filetime(fstat.st_ctime, &ft_high, &ft_low); + seconds_since_1970_to_filetime(filestat.st_ctime, &ft_high, &ft_low); out_uint32_le(out, ft_low); /* change_write_time */ out_uint32_le(out, ft_high); - out_uint32_le(out, fstat.st_size); /* filesize low */ + out_uint32_le(out, filestat.st_size); /* filesize low */ out_uint32_le(out, 0); /* filesize high */ - out_uint32_le(out, fstat.st_size); /* filesize low */ + out_uint32_le(out, filestat.st_size); /* filesize low */ out_uint32_le(out, 0); /* filesize high */ out_uint32_le(out, file_attributes); out_uint8(out, 2 * strlen(pdirent->d_name) + 2); /* unicode length */ @@ -1210,19 +1214,19 @@ FileNamesInformation */ unimpl("IRP Query Directory sub: 0x%x\n", info_class); - return STATUS_INVALID_PARAMETER; + return RD_STATUS_INVALID_PARAMETER; } - return STATUS_SUCCESS; + return RD_STATUS_SUCCESS; } -static NTSTATUS -disk_device_control(NTHANDLE handle, uint32 request, STREAM in, STREAM out) +static RD_NTSTATUS +disk_device_control(RD_NTHANDLE handle, uint32 request, STREAM in, STREAM out) { if (((request >> 16) != 20) || ((request >> 16) != 9)) - return STATUS_INVALID_PARAMETER; + return RD_STATUS_INVALID_PARAMETER; /* extract operation */ request >>= 2; @@ -1236,10 +1240,10 @@ case 42: /* ? */ default: unimpl("DISK IOCTL %d\n", request); - return STATUS_INVALID_PARAMETER; + return RD_STATUS_INVALID_PARAMETER; } - return STATUS_SUCCESS; + return RD_STATUS_SUCCESS; } DEVICE_FNS disk_fns = { --- rdesktop-1.5.0.orig/disk.h +++ rdesktop-1.5.0/disk.h @@ -1,19 +1,19 @@ /* rdesktop: A Remote Desktop Protocol client. Disk Redirection definitions - Copyright (C) Jeroen Meijer 2003 - Copyright (C) Peter Astrand 2004 - + Copyright (C) Jeroen Meijer 2003-2007 + Copyright (C) Peter Astrand 2004-2007 + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 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., 675 Mass Ave, Cambridge, MA 02139, USA. --- rdesktop-1.5.0.orig/doc/AUTHORS +++ rdesktop-1.5.0/doc/AUTHORS @@ -6,7 +6,7 @@ Peter Kallden Hugo Trippaers Jay Sorg -Peter Åstrand +Peter Ã…strand Michal Mihalik Norbert Federa Erik Forsberg --- rdesktop-1.5.0.orig/doc/ChangeLog +++ rdesktop-1.5.0/doc/ChangeLog @@ -1,3 +1,8 @@ +rdesktop (1.?.?) + * ALSA-driver added + * sound-drivers can now be selected at runtime + * Smartcard support by Alexi Volkov + rdesktop (1.5.0) * SeamlessRDP - seamless windows support * Keymap fixes @@ -15,6 +20,8 @@ * Basic support for Windows Vista Beta 2 * Fix high cpu-usage in OSS-driver + -- Peter Astrand Wed, 13 Sep 2006 15:11:39 +0200 (CEST) + rdesktop (1.4.1) * persistent bitmap cache optimisations * support for more RDP-orders (ellipse, polygon) @@ -62,7 +69,7 @@ * IPv6 * Attaching to console on Windows 2003 - -- Peter Astrand Wed, 29 Oct 2003 16:40:58 +0100 (CET) + -- Peter Astrand Wed, 29 Oct 2003 16:40:58 +0100 (CET) rdesktop (1.2.0) --- rdesktop-1.5.0.orig/doc/HACKING +++ rdesktop-1.5.0/doc/HACKING @@ -14,7 +14,7 @@ Structure --------- -The core protocol stack should be system-independent (i.e. ANSI C +The core protocol stack should be system-independent (i.e. ANSI C89 only) so that it is easy to port. This currently applies to the following files: @@ -23,6 +23,20 @@ rdesktop.c +Compiler support +---------------- +The source code should be compatible with ANSI C89. + + RDP resources ------------- http://dev.remotenetworktechnology.com/refdata.htm + + +Checking for out of memory conditions +------------------------------------- +Try to handle out of memory conditions gracefully. Use the xmalloc +routines from rdesktop.c, instead of calling malloc manually. Also, +remember that several Xlib functions can return NULL. This includes +XGetImage. Use exit_if_null to verify returned pointers. + --- rdesktop-1.5.0.orig/doc/TODO +++ rdesktop-1.5.0/doc/TODO @@ -1,3 +1,11 @@ +* General + + * Rework main loop to a generic event handler (i.e. move select() to + the top of the stack, not the end). Also means rewriting the connect + procedure as a state machine. + + * Stop using static objects for packets and make it more clear when it + is in use (explicit allocation and free). * Clipboard: --- rdesktop-1.5.0.orig/doc/keymapping.txt +++ rdesktop-1.5.0/doc/keymapping.txt @@ -240,4 +240,6 @@ 10. Make sure keymaps can be loaded from ~/.rdesktop/keymaps, KEYMAP_PATH, $CWD/keymaps, and from an absolute path. - +11. Press Shift, then press a key modified by shift, the release + shift, then release the other key. Do this in a speedy fasion. + Make sure the shift state is not stuck down. --- rdesktop-1.5.0.orig/doc/licensing.txt +++ rdesktop-1.5.0/doc/licensing.txt @@ -9,7 +9,7 @@ From the rdesktop mailing list: -Peter Åstrand , 2003-02-06 +Peter Ã…strand , 2003-02-06 > We are running rdesktop 1.2 on machine A and connects to a Windows 2000 > Server (machine B). The W2K machine has 5 real licenses installed ("Windows --- rdesktop-1.5.0.orig/doc/lspci-channel.txt +++ rdesktop-1.5.0/doc/lspci-channel.txt @@ -0,0 +1,39 @@ + +Protocol overview +================= + +The lspci virtual channel makes it possible for the remote RDP server +to enumerate the local PCI devices. The protocol on this channel is +text based and line oriented: One single line per request or +response. UNIX-style LF line breaks are used. The maximum line length +is 1023, newline included. + +rdesktop acts as a server, with only one request: + + LSPCI + +The response is several lines with this syntax: + +,,,,,, + +After the last line, a line with a single dot is sent. + +Example: + +0300,102b,0525,102b,0338,04,00 +0401,8086,24d5,1028,0174,02,8f +. + + +Usage +===== + +To enable to lspci virtual channel, run rdesktop with "-r lspci". + + +References +========== + +http://www.microsoft.com/msj/1099/terminal/terminal.aspx +http://msdn.microsoft.com/library/default.asp?url=/library/en-us/termserv/termserv/terminal_services_virtual_channels.asp + --- rdesktop-1.5.0.orig/doc/rdesktop.1 +++ rdesktop-1.5.0/doc/rdesktop.1 @@ -122,7 +122,7 @@ size, in pixels. The special word "standard" means 18 pixels. .TP .BR "-T " -Sets the window title. +Sets the window title. The title must be specified using an UTF-8 string. .TP .BR "-N" Enable numlock syncronization between the Xserver and the remote RDP @@ -202,6 +202,14 @@ clients PCI devices. See the file lspci-channel.txt in the documentation for more information. .TP +.BR "-r scard[:<Scard Name>=<Alias Name>[;<Vendor Name>][,...]]" +Enables redirection of one or more smart-cards. You can provide +static name binding between linux and windows. To do this you +can use optional parameters as described: <Scard Name> - device name in +Linux/Unix enviroment, <Alias Name> - device name shown in Windows enviroment +<Vendor Name> - optional device vendor name. For list of examples run +rdesktop without parameters. +.TP .BR "-0" Attach to the console of the server (requires Windows Server 2003 or newer). --- rdesktop-1.5.0.orig/doc/rdpsnd-rec.txt +++ rdesktop-1.5.0/doc/rdpsnd-rec.txt @@ -0,0 +1,181 @@ +Overview +======== + +This is a rdesktop specific extension to the RDPSND protocol to +support recording. + +The basic protocol is the same as RDPSND (described in rdpsnd.txt), +but with a bunch of new opcodes. + +A client indicates to the server that it can support recording by +setting bit 24 (0x00800000) in "Flags" in RDPSND_NEGOTIATE. + +New opcodes + + 0x27 RDPSND_REC_NEGOTIATE + 0x28 RDPSND_REC_START + 0x29 RDPSND_REC_STOP + 0x2A RDPSND_REC_DATA + 0x2B RDPSND_REC_SET_VOLUME + +Opcodes +======= + +The following is a list of the new opcodes and their payload. + +RDPSND_REC_NEGOTIATE +-------------------- + +Sent immediatly after RDPSND_NEGOTIATE when the client indicates that +it supports recording. Allows the server to determine the +capabilities of the client. + +The client should reply with an identical packet, with the relevant +fields filled in, and a filtered list of formats (based on what the +client supports). + + 0 1 2 3 + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +| Flags | ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +| Left channel | Right channel | ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +| Format count | Version | ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +| ... | ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +| Format tag | Channels | ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +| Frames per sec. | ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +| Bytes per sec. | ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +| Block align | Bits per sample | ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +| Extra size | Extra data ... | ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +| ... | ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + +Flags + + Flags for capabilities. Currently unused. + +Left channel + + Initial volume for left channel. Reserved when sent from server. + +Right channel + + Initial volume for right channel. Reserved when sent from server. + +Format count + + Number of format structures following the header. + +Version + + Version of the RDPSND record protocol. Current version is 1. + +Format tag + + Audio format type as registered at Microsoft. + +Channels + + Number of channels per frame. + +Frames per sec. + + Frames per second in Hz. + +Bytes per sec. + + Number of bytes per second. Should be the product of + "Frames per sec." and "Block align". + +Block align + + The size of each frame. Note that not all bytes may contain + useful data. + +Bits per sample + + Number of bits per sample. Commonly 8 or 16. + +Extra size + + Number of bytes of extra information following this format + description. + +Extra data + + Optional extra format data. Contents specific to each format + type. + +RDPSND_REC_START +---------------- + +Sent from the server to tell the client to start recording. + + 0 1 2 3 + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +| Format index | | ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + +Format index + + Waveform data format in the form of an index to the previously + negotiated format list. + +RDPSND_REC_STOP +--------------- + +Tells the client to stop sending record data. Must be sent before a +new RDPSND_REC_START is sent. + +No payload and no response. + +RDPSND_REC_DATA +--------------- + +Chunk of recorded data. The client is free to choose how much data +should be queued up before a packet is sent. The payload must not +exceed 32768 bytes though. + +No response. + + 0 1 2 3 + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +| Waveform data | ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +| ... | ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + +Waveform data + + Binary waveform data in the format specified by the format index. + Size defined by the packet boundary. + +RDPSND_REC_SET_VOLUME +--------------------- + +Request from the server to the client to change the input volume. +No response. + + 0 1 2 3 + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +| Left channel | Right channel | ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + +Left channel + + Volume of left channel in the range [0, 65535]. + +Right channel + + Volume of right channel in the range [0, 65535]. --- rdesktop-1.5.0.orig/doc/rdpsnd.txt +++ rdesktop-1.5.0/doc/rdpsnd.txt @@ -0,0 +1,298 @@ +Overview +======== + +The RDPSND protocol is a binary, packet based protocol that maps +Microsoft's legacy wave API to a RDP channel. + +All values are in little endian ordering. + +Responses are sent with the same opcode as the request, and usually +also with the same packet structure. + +The basic structure of a packet is: + + 0 1 2 3 + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +| Opcode | Unknown | Payload size | ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +| ... | ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + +Opcode + + Command or response type. Known values: + + 0x01 RDPSND_CLOSE + 0x02 RDPSND_WRITE + 0x03 RDPSND_SET_VOLUME + 0x04 Unknown (4 bytes payload, no response) + 0x05 RDPSND_COMPLETION + 0x06 RDPSND_PING + 0x07 RDPSND_NEGOTIATE + +Unknown + + Usage not known. Not valid when message comes from server + +Payload size + + Number of bytes following the header. + +Opcodes +======= + +Following is a list of all known opcodes and the contents in their +payloads. + +RDPSND_CLOSE +------------ + +Tells the client that all applications on the server have released +control of the sound system, allowing the client to free any local +resources. + +No payload and no response. + +RDPSND_WRITE +------------ + +Request to play a chunk of data. The client is expected to queue up +the data and send a RDPSND_COMPLETION when playback has finished. + +No response. + + 0 1 2 3 + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +| Tick | Format index | ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +| Packet index | Pad | ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +| Waveform data | ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +| ... | ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + +Tick + + Low 16 bits of clock tick count when packet was scheduled for + playback. + +Format index + + Waveform data format in the form of an index to the previously + negotiated format list. + +Packet index + + Index number of this packet. + +Pad + + Unused padding. + +Waveform data + + Binary waveform data in the format specified by the format index. + Size defined by the packet boundary. + + Because of a strange design in Microsoft's server, the length of + the packet will be 4 bytes short and bytes 12 to 15 (4 bytes) of + the payload should be removed. + +RDPSND_SET_VOLUME +----------------- + +Request from the server to the client to change the output volume. +No response. + + 0 1 2 3 + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +| Left channel | Right channel | ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + +Left channel + + Volume of left channel in the range [0, 65535]. + +Right channel + + Volume of right channel in the range [0, 65535]. + +RDPSND_COMPLETION +----------------- + +Sent by the client to the server when a packet, queued by +RDPSND_WRITE, has finished playing. + +No response is sent by the server. + + 0 1 2 3 + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +| Tick | Packet index | Reserved | ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + +Tick + + Clock tick count when packet finished playing on device. + +Packet index + + Index number of packet played. + +Reserved + + Reserved. Always 0. + +RDPSND_PING +----------- + +Sent by the server to the client to determine transport latency. +The client must respond by echoing the first four bytes of this +packet. + + 0 1 2 3 + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +| Tick | Reserved | ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +| Garbage | ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +| ... | ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + +Tick + + Clock tick count when sent from server. + +Reserved + + Reserved. Always 0. + +Garbage + + 1016 optional bytes of random data. Purpose unknown. + Only sent from server. + +RDPSND_NEGOTIATE +---------------- + +Initial packet sent by server when the client [re]connects. Allows +the server to determine the capabilities of the client. + +The client should reply with an identical packet, with the relevant +fields filled in, and a filtered list of formats (based on what the +client supports). + + 0 1 2 3 + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +| Flags | ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +| Left channel | Right channel | ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +| Pitch | ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +| UDP port | Format count | ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +| Initial idx | Version | Padding | ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +| ... | ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +| Format tag | Channels | ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +| Frames per sec. | ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +| Bytes per sec. | ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +| Block align | Bits per sample | ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +| Extra size | Extra data ... | ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +| ... | ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + +Flags + + Flags for client capabilities. Data not valid when from server. + + 0000 0001 Do UDP song and dance (details unknown). Must be + set for sound to work. + 0000 0002 Volume control support. Indicates that volume + fields are valid and that the client understands + RDPSND_SET_VOLUME. + 0000 0004 Pitch field is valid. + +Left channel + + Initial volume for left channel. Data not valid when from server. + +Right channel + + Initial volume for right channel. Data not valid when from server. + +Pitch + + Initial pitch of the sound device. Data not valid when from server. + +UDP port + + Port used for UDP transfers. Sent in network (big endian) order. + Data not valid when from server. + +Format count + + Number of format structures following the header. + +Initial index + + Initial packet index. The first RDPSND_WRITE will have a packet + index one larger than this value. Data not valid when from client. + +Version + + Software version. Server (XP & 2K3) sets this to 5. Client (XP) + also sets this to 5. + +Padding + + Unused. + +Format tag + + Audio format type as registered at Microsoft. + +Channels + + Number of channels per frame. + +Frames per sec. + + Frames per second in Hz. + +Bytes per sec. + + Number of bytes per second. Should be the product of + "Frames per sec." and "Block align". + +Block align + + The size of each frame. Note that not all bytes may contain + useful data. + +Bits per sample + + Number of bits per sample. Commonly 8 or 16. + +Extra size + + Number of bytes of extra information following this format + description. + +Extra data + + Optional extra format data. Contents specific to each format + type. --- rdesktop-1.5.0.orig/doc/seamlessrdp-channel.txt +++ rdesktop-1.5.0/doc/seamlessrdp-channel.txt @@ -0,0 +1,325 @@ +TODO +---- + +* Command for executing new programs. + +* Commands for changing z order and focus. + +* Think about protocol version management + +* Try to assure that messages aren't repeated or are sent for hidden windows. + +Overview +======== + +The protocol is a line based protocol following this simple syntax: + + OPERATION,SERIAL[,ARG1[,ARG2,[...]]] + +Each operation will have an increasing serial number. The initial value is +implementation defined. + +The goal is to have a generic protocol that can be used for other display +systems (e.g. VNC) as well. + +One line may not exceed 1024 bytes, including newline. + +The protocol has no concept of hidden or unmapped windows. A window does not +exist unless it is visible. Note that a minimized window is an exception to +this rule. + +The protocol has no way of indicating failure, meaning that all commands are +expected to succeed. If a command fails, the receiving end must send a +corresponding command back, indicating the actual state. + +Data types +========== +Window ID are written in hex, like 0x4321. + +Window positions can be negative. This happens when a window is moved +outside the desktop. + +All integers fit inside 32 bits. + +Strings are sent in UTF-8 and do not contain any characters less than 0x20 or +the character , (comma). + +Server to Client Operations +=========================== + +CREATE +------ + +Allocate structures for a new window. + +Syntax: + CREATE,<SERIAL>,<ID>,<GRPID>,<PARENT>,<FLAGS> + +Indicates that a window has appeared on the server. If PARENT is non-zero then +the new window is a child of that window (it's transient for it). The special +value 0xFFFFFFFF for PARENT means that the window is a popup window without a +parent. It's commonly used for splash screens, tool tips and context menus. + +The group id identifies a set of windows that belong together. It is currently +only used for modal windows and DESTROYGRP. + +Flags: + 0x0001 : Create a window that's modal with regard to the other windows + in the same group. + +Note that very little information is included in this message. Things like +title and state will come in subsequent messages. This message should only +be used to allocate data structures for the new window. + +DESTROY +------- + +Remove a window. + +Syntax: + DESTROY,<SERIAL>,<ID>,<FLAGS> + +Remove the window and deallocate all associated structures. + +DESTROYGRP +---------- + +Destroy an entire group of windows. + +Syntax: + DESTROYGRP,<SERIAL>,<GRPID>,<FLAGS> + +Every window that belongs to the group GRPID should be destroyed as if they +each got a DESTROY message. + +POSITION +-------- + +Move and/or resize a window. + +Syntax: + POSITION,<SERIAL>,<ID>,<X>,<Y>,<WIDTH>,<HEIGHT>,<FLAGS> + +If the window isn't visible yet (because a +STATE hasn't been set or because it's minimized), you must store the position +and size. A new POSITION is not guaranteed to be sent when the window changes +state. + +TITLE +----- + +Sets a window title. + +Syntax: + TITLE,<SERIAL>,<ID>,<TITLE>,<FLAGS> + +The text is guaranteed to be stripped of control characters (< 0x20). + +Note that this has the same requirement as POSITION, that the title needs to +be stored for newly created windows until a STATE is sent. It is however not +guaranteed that a TITLE will be sent before the first STATE. + + +ZCHANGE +------- + +The window moved in z order. + +Syntax: + ZCHANGE,<SERIAL>,<ID>,<BEHIND>,<FLAGS> + +The window with the id ID is behind the window with the id BEHIND. If +BEHIND is 0, then this window should be brought to the front. + +STATE +----- + +Changes the window's state and/or title. + +Syntax: + STATE,<SERIAL>,<ID>,<STATE>,<FLAGS> + +State can have one of three values: + 0 : "Normal" window. + 1 : Minimized. + 2 : Maximized. + +The initial STATE for a window will always be preceeded by one CREATE and one +POSITION. Optionally, a TITLE may also be sent before the first STATE. + +DEBUG +----- + +Debug output from the server component. + +Syntax: + DEBUG,<SERIAL>,<STRING> + +Used for debugging. + +SYNCBEGIN +--------- + +Indicates that a synchronisation has begun. + +Syntax: + SYNCBEGIN,<SERIAL>,<FLAGS> + +Sent when the server starts a synchronisation. The client should flush all +information at this point. + +SYNCEND +------- + +Indicates that a synchronisation is complete. + +Syntac: + SYNCEND,<SERIAL>,<FLAGS> + +Sent when the last message that is part of the synchronisation has been sent. +This may be followed by duplicate messages and/or messages referring invalid +windows that were queued up during the synchronisation. + +HELLO +----- + +Initial message sent by server. + +Syntax: + HELLO,<SERIAL>,<FLAGS> + +The server starts each connection by sending this message. Normally the client +will react by sending a SYNC back to the server. + +Flags: + 0x0001 : This is a reconnect to an existing session. + 0x0002 : The desktop is currently hidden (see HIDE). + +ACK +--- + +Acknowledgement of a request to manipulate a window. + +Syntax: + ACK,<SERIAL>,<ACKSERIAL> + +Whenever one of the commands POSITION, ZCHANGE, STATE or FOCUS is executed on +the server, the server will send an ACK back to the client. The purpose of this +is to inform the client of when the operation was actually performed, allowing +high latencies in the channel. + +HIDE +---- + +The desktop has become hidden on the server. + +Syntax: + HIDE,<SERIAL>,<FLAGS> + +This message is sent when the desktop on the server is obscured by something +that cannot be tracked. The client should remove all windows and display the +entire desktop, allowing the user to handle whatever is blocking the view. + +Note that updates to windows will still be sent as the windows still exist on +the server, they are merely not visible. + +UNHIDE +------ + +The desktop has been restored on the server. + +Syntax: + UNHIDE,<SERIAL>,<FLAGS> + +This message is sent some time after a HIDE, indicating that the windowed view +has been restored. If the client has dropped all information about windows then +it can send a SYNC to re-enumerate them. + +SETICON +------- + +Sets an icon for a window. + +Syntax: + SETICON,<SERIAL>,<ID>,<CHUNK>,<FORMAT>,<WIDTH>,<HEIGHT>,<DATA> + +This message is sent when a window is initially created and at any time when +the application modifies its icon. + +A window can have multiple icons, but only one of a given format and size. A +SETICON received for an already existing format and size is expected to over- +write that icon. + +Since icons can potentially be very large, it can easily overflow the line +limitation in the protocol. To handle this, multiple SETICON will be issued +with an ever increasing chunk number. + +The initial chunk is 0 (zero) and all chunks must be sent in order. Multiple +SETICON sets for the same window may not interleave. SETICON sets for +different windows may interleave though. + +Formats: + RGBA : Four bytes of data per pixel, representing red, green, blue and + alpha, in that order. + +Data is the raw icon data written in hex (e.g. 3fab32...). Chunks must be +divided on a whole byte boundary. Case is not specified. + +DELICON +------- + +Removes an icon for a window. + +Syntax: + DELICON,<SERIAL>,<ID>,<FORMAT>,<WIDTH>,<HEIGHT> + +Removes the icon of a window matching the given format and size, previously +set with SETICON. + +This command may not be interleaved with a SETICON set. + +Client to Server Operations +=========================== + +SYNC +---- + +Request a synchronisation of window information. + +Syntax: + SYNC,<SERIAL>,<FLAGS> + +For each window, the server will send CREATE, POSITION and STATE, in that +order, just as if the window was created. Note that a TITLE may also, +optionally, be sent before the STATE. + +POSITION +-------- + +Identical to the command sent from server to client. + +TITLE +----- + +Identical to the command sent from server to client. + +ZCHANGE +------- + +Identical to the command sent from server to client. + +STATE +----- + +Identical to the command sent from server to client. + +FOCUS +----- + +Sets which window has input focus. + +Syntax: + FOCUS,<SERIAL>,<ID>,<FLAGS> + +Changes which window that will recieve the keyboard events. Note that this +might cause the window to change z order. --- rdesktop-1.5.0.orig/ewmhints.c +++ rdesktop-1.5.0/ewmhints.c @@ -4,7 +4,8 @@ Support functions for Extended Window Manager Hints, http://www.freedesktop.org/wiki/Standards_2fwm_2dspec - Copyright (C) Peter Astrand <astrand@cendio.se> 2005 + Copyright 2005 Peter Astrand <astrand@cendio.se> for Cendio AB + Copyright 2007 Pierre Ossman <ossman@cendio.se> for Cendio AB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -34,7 +35,8 @@ static Atom g_net_wm_state_maximized_vert_atom, g_net_wm_state_maximized_horz_atom, g_net_wm_state_hidden_atom, g_net_wm_name_atom, g_utf8_string_atom, - g_net_wm_state_skip_taskbar_atom, g_net_wm_state_skip_pager_atom, g_net_wm_state_modal_atom; + g_net_wm_state_skip_taskbar_atom, g_net_wm_state_skip_pager_atom, + g_net_wm_state_modal_atom, g_net_wm_icon_atom; Atom g_net_wm_state_atom, g_net_wm_desktop_atom; @@ -187,6 +189,7 @@ g_net_wm_state_atom = XInternAtom(g_display, "_NET_WM_STATE", False); g_net_wm_desktop_atom = XInternAtom(g_display, "_NET_WM_DESKTOP", False); g_net_wm_name_atom = XInternAtom(g_display, "_NET_WM_NAME", False); + g_net_wm_icon_atom = XInternAtom(g_display, "_NET_WM_ICON", False); g_utf8_string_atom = XInternAtom(g_display, "UTF8_STRING", False); } @@ -202,7 +205,7 @@ unsigned char *prop_return; uint32 *return_words; unsigned long item; - BOOL maximized_vert, maximized_horz, hidden; + RD_BOOL maximized_vert, maximized_horz, hidden; maximized_vert = maximized_horz = hidden = False; @@ -423,6 +426,113 @@ return 0; } +void +ewmh_set_icon(Window wnd, int width, int height, const char *rgba_data) +{ + unsigned long nitems, i; + unsigned char *props; + uint32 *cur_set, *new_set; + uint32 *icon; + + cur_set = NULL; + new_set = NULL; + + if (get_property_value(wnd, "_NET_WM_ICON", 10000, &nitems, &props, 1) >= 0) + { + cur_set = (uint32 *) props; + + for (i = 0; i < nitems;) + { + if (cur_set[i] == width && cur_set[i + 1] == height) + break; + + i += 2 + cur_set[i] * cur_set[i + 1]; + } + + if (i != nitems) + icon = cur_set + i; + else + { + new_set = xmalloc((nitems + width * height + 2) * 4); + memcpy(new_set, cur_set, nitems * 4); + icon = new_set + nitems; + nitems += width * height + 2; + } + } + else + { + new_set = xmalloc((width * height + 2) * 4); + icon = new_set; + nitems = width * height + 2; + } + + icon[0] = width; + icon[1] = height; + + /* Convert RGBA -> ARGB */ + for (i = 0; i < width * height; i++) + { + icon[i + 2] = + rgba_data[i * 4 + 3] << 24 | + ((rgba_data[i * 4 + 0] << 16) & 0x00FF0000) | + ((rgba_data[i * 4 + 1] << 8) & 0x0000FF00) | + ((rgba_data[i * 4 + 2] << 0) & 0x000000FF); + } + + XChangeProperty(g_display, wnd, g_net_wm_icon_atom, XA_CARDINAL, 32, + PropModeReplace, (unsigned char *) (new_set ? new_set : cur_set), nitems); + + if (cur_set) + XFree(cur_set); + if (new_set) + xfree(new_set); +} + +void +ewmh_del_icon(Window wnd, int width, int height) +{ + unsigned long nitems, i, icon_size; + unsigned char *props; + uint32 *cur_set, *new_set; + + cur_set = NULL; + new_set = NULL; + + if (get_property_value(wnd, "_NET_WM_ICON", 10000, &nitems, &props, 1) < 0) + return; + + cur_set = (uint32 *) props; + + for (i = 0; i < nitems;) + { + if (cur_set[i] == width && cur_set[i + 1] == height) + break; + + i += 2 + cur_set[i] * cur_set[i + 1]; + } + + if (i == nitems) + goto out; + + icon_size = width * height + 2; + new_set = xmalloc((nitems - icon_size) * 4); + + if (i != 0) + memcpy(new_set, cur_set, i * 4); + if (i != nitems - icon_size) + memcpy(new_set + i * 4, cur_set + i * 4 + icon_size, nitems - icon_size); + + nitems -= icon_size; + + XChangeProperty(g_display, wnd, g_net_wm_icon_atom, XA_CARDINAL, 32, + PropModeReplace, (unsigned char *) new_set, nitems); + + xfree(new_set); + + out: + XFree(cur_set); +} + #endif /* MAKE_PROTO */ --- rdesktop-1.5.0.orig/indent-all.sh +++ rdesktop-1.5.0/indent-all.sh @@ -0,0 +1,3 @@ +#!/bin/sh +indent -bli0 -i8 -cli8 -npcs -l100 *.h *.c vnc/*.h vnc/*.c + --- rdesktop-1.5.0.orig/iso.c +++ rdesktop-1.5.0/iso.c @@ -1,18 +1,18 @@ /* -*- c-basic-offset: 8 -*- rdesktop: A Remote Desktop Protocol client. Protocol services - ISO layer - Copyright (C) Matthew Chapman 1999-2005 - + Copyright (C) Matthew Chapman 1999-2007 + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 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., 675 Mass Ave, Cambridge, MA 02139, USA. @@ -168,7 +168,7 @@ } /* Establish a connection up to the ISO layer */ -BOOL +RD_BOOL iso_connect(char *server, char *username) { uint8 code = 0; @@ -192,7 +192,7 @@ } /* Establish a reconnection up to the ISO layer */ -BOOL +RD_BOOL iso_reconnect(char *server) { uint8 code = 0; --- rdesktop-1.5.0.orig/keymaps/convert-map +++ rdesktop-1.5.0/keymaps/convert-map @@ -2,7 +2,7 @@ # -*-Python-*- # # -# Copyright (C) 2001 Peter Åstrand <peter@cendio.se> +# Copyright (C) 2001 Peter Ã…strand <astrand@cendio.se> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by --- rdesktop-1.5.0.orig/keymaps/is +++ rdesktop-1.5.0/keymaps/is @@ -1,4 +1,4 @@ -# 2004-03-16 Halldór Guðmundsson and Morten Lange +# 2004-03-16 Halldór Guðmundsson and Morten Lange # Keyboard definition file for the Icelandic keyboard # to be used in rdesktop 1.3.x ( See rdesktop.org) # generated from XKB map de, and changed manually --- rdesktop-1.5.0.orig/licence.c +++ rdesktop-1.5.0/licence.c @@ -1,8 +1,8 @@ /* -*- c-basic-offset: 8 -*- rdesktop: A Remote Desktop Protocol client. RDP licensing negotiation - Copyright (C) Matthew Chapman 1999-2005 - + Copyright (C) Matthew Chapman 1999-2007 + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or @@ -12,14 +12,14 @@ 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "rdesktop.h" -#include <openssl/rc4.h> +#include "ssl.h" extern char g_username[64]; extern char g_hostname[16]; @@ -27,7 +27,7 @@ static uint8 g_licence_key[16]; static uint8 g_licence_sign_key[16]; -BOOL g_licence_issued = False; +RD_BOOL g_licence_issued = False; /* Generate a session key and RC4 keys, given client and server randoms */ static void @@ -143,7 +143,7 @@ uint8 hwid[LICENCE_HWID_SIZE]; uint8 *licence_data; int licence_size; - RC4_KEY crypt_key; + SSL_RC4 crypt_key; /* Retrieve the server random from the incoming packet */ in_uint8p(s, server_random, SEC_RANDOM_SIZE); @@ -161,8 +161,8 @@ sec_sign(signature, 16, g_licence_sign_key, 16, hwid, sizeof(hwid)); /* Now encrypt the HWID */ - RC4_set_key(&crypt_key, 16, g_licence_key); - RC4(&crypt_key, sizeof(hwid), hwid, hwid); + ssl_rc4_set_key(&crypt_key, g_licence_key, 16); + ssl_rc4_crypt(&crypt_key, hwid, hwid, sizeof(hwid)); licence_present(null_data, null_data, licence_data, licence_size, hwid, signature); xfree(licence_data); @@ -201,7 +201,7 @@ } /* Parse an authentication request packet */ -static BOOL +static RD_BOOL licence_parse_authreq(STREAM s, uint8 ** token, uint8 ** signature) { uint16 tokenlen; @@ -230,15 +230,15 @@ uint8 hwid[LICENCE_HWID_SIZE], crypt_hwid[LICENCE_HWID_SIZE]; uint8 sealed_buffer[LICENCE_TOKEN_SIZE + LICENCE_HWID_SIZE]; uint8 out_sig[LICENCE_SIGNATURE_SIZE]; - RC4_KEY crypt_key; + SSL_RC4 crypt_key; /* Parse incoming packet and save the encrypted token */ licence_parse_authreq(s, &in_token, &in_sig); memcpy(out_token, in_token, LICENCE_TOKEN_SIZE); /* Decrypt the token. It should read TEST in Unicode. */ - RC4_set_key(&crypt_key, 16, g_licence_key); - RC4(&crypt_key, LICENCE_TOKEN_SIZE, in_token, decrypt_token); + ssl_rc4_set_key(&crypt_key, g_licence_key, 16); + ssl_rc4_crypt(&crypt_key, in_token, decrypt_token, LICENCE_TOKEN_SIZE); /* Generate a signature for a buffer of token and HWID */ licence_generate_hwid(hwid); @@ -247,8 +247,8 @@ sec_sign(out_sig, 16, g_licence_sign_key, 16, sealed_buffer, sizeof(sealed_buffer)); /* Now encrypt the HWID */ - RC4_set_key(&crypt_key, 16, g_licence_key); - RC4(&crypt_key, LICENCE_HWID_SIZE, hwid, crypt_hwid); + ssl_rc4_set_key(&crypt_key, g_licence_key, 16); + ssl_rc4_crypt(&crypt_key, hwid, crypt_hwid, LICENCE_HWID_SIZE); licence_send_authresp(out_token, crypt_hwid, out_sig); } @@ -257,7 +257,7 @@ static void licence_process_issue(STREAM s) { - RC4_KEY crypt_key; + SSL_RC4 crypt_key; uint32 length; uint16 check; int i; @@ -267,8 +267,8 @@ if (!s_check_rem(s, length)) return; - RC4_set_key(&crypt_key, 16, g_licence_key); - RC4(&crypt_key, length, s->p, s->p); + ssl_rc4_set_key(&crypt_key, g_licence_key, 16); + ssl_rc4_crypt(&crypt_key, s->p, s->p, length); in_uint16(s, check); if (check != 0) --- rdesktop-1.5.0.orig/lspci.c +++ rdesktop-1.5.0/lspci.c @@ -41,7 +41,7 @@ /* Handle one line of output from the lspci subprocess */ -static BOOL +static RD_BOOL handle_child_line(const char *line, void *data) { const char *val; @@ -106,7 +106,7 @@ /* Process one line of input from virtual channel */ -static BOOL +static RD_BOOL lspci_process_line(const char *line, void *data) { char *lspci_command[5] = { "lspci", "-m", "-n", "-v", NULL }; @@ -148,7 +148,7 @@ } /* Initialize this module: Register the lspci channel */ -BOOL +RD_BOOL lspci_init(void) { lspci_channel = --- rdesktop-1.5.0.orig/mcs.c +++ rdesktop-1.5.0/mcs.c @@ -1,18 +1,18 @@ /* -*- c-basic-offset: 8 -*- rdesktop: A Remote Desktop Protocol client. Protocol services - Multipoint Communications Service - Copyright (C) Matthew Chapman 1999-2005 - + Copyright (C) Matthew Chapman 1999-2007 + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 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., 675 Mass Ave, Cambridge, MA 02139, USA. @@ -25,7 +25,7 @@ extern unsigned int g_num_channels; /* Parse an ASN.1 BER header */ -static BOOL +static RD_BOOL ber_parse_header(STREAM s, int tagval, int *length) { int tag, len; @@ -36,7 +36,8 @@ } else { - in_uint8(s, tag)} + in_uint8(s, tag); + } if (tag != tagval) { @@ -105,7 +106,7 @@ } /* Parse a DOMAIN_PARAMS structure (ASN.1 BER) */ -static BOOL +static RD_BOOL mcs_parse_domain_params(STREAM s) { int length; @@ -147,7 +148,7 @@ } /* Expect a MCS_CONNECT_RESPONSE message (ASN.1 BER) */ -static BOOL +static RD_BOOL mcs_recv_connect_response(STREAM mcs_data) { uint8 result; @@ -221,7 +222,7 @@ } /* Expect a AUcf message (ASN.1 PER) */ -static BOOL +static RD_BOOL mcs_recv_aucf(uint16 * mcs_userid) { uint8 opcode, result; @@ -270,7 +271,7 @@ } /* Expect a CJcf message (ASN.1 PER) */ -static BOOL +static RD_BOOL mcs_recv_cjcf(void) { uint8 opcode, result; @@ -372,7 +373,7 @@ } /* Establish a connection up to the MCS layer */ -BOOL +RD_BOOL mcs_connect(char *server, STREAM mcs_data, char *username) { unsigned int i; @@ -413,7 +414,7 @@ } /* Establish a connection up to the MCS layer */ -BOOL +RD_BOOL mcs_reconnect(char *server, STREAM mcs_data) { unsigned int i; --- rdesktop-1.5.0.orig/mppc.c +++ rdesktop-1.5.0/mppc.c @@ -1,7 +1,7 @@ /* -*- c-basic-offset: 8 -*- rdesktop: A Remote Desktop Protocol client. Protocol services - RDP decompression - Copyright (C) Matthew Chapman 1999-2005 + Copyright (C) Matthew Chapman 1999-2007 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -63,7 +63,7 @@ int next_offset, match_off; int match_len; int old_offset, match_bits; - BOOL big = ctype & RDP_MPPC_BIG ? True : False; + RD_BOOL big = ctype & RDP_MPPC_BIG ? True : False; uint8 *dict = g_mppc_dict.hist; --- rdesktop-1.5.0.orig/orders.c +++ rdesktop-1.5.0/orders.c @@ -1,7 +1,7 @@ /* -*- c-basic-offset: 8 -*- rdesktop: A Remote Desktop Protocol client. RDP order processing - Copyright (C) Matthew Chapman 1999-2005 + Copyright (C) Matthew Chapman 1999-2007 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -23,7 +23,7 @@ extern uint8 *g_next_packet; static RDP_ORDER_STATE g_order_state; -extern BOOL g_use_rdp5; +extern RD_BOOL g_use_rdp5; /* Read field indicating which parameters are present */ static void @@ -55,7 +55,7 @@ /* Read a co-ordinate (16-bit, or 8-bit delta) */ static void -rdp_in_coord(STREAM s, sint16 * coord, BOOL delta) +rdp_in_coord(STREAM s, sint16 * coord, RD_BOOL delta) { sint8 change; @@ -102,7 +102,7 @@ } /* Parse bounds information */ -static BOOL +static RD_BOOL rdp_parse_bounds(STREAM s, BOUNDS * bounds) { uint8 present; @@ -133,7 +133,7 @@ } /* Parse a pen */ -static BOOL +static RD_BOOL rdp_parse_pen(STREAM s, PEN * pen, uint32 present) { if (present & 1) @@ -149,7 +149,7 @@ } /* Parse a brush */ -static BOOL +static RD_BOOL rdp_parse_brush(STREAM s, BRUSH * brush, uint32 present) { if (present & 1) @@ -172,7 +172,7 @@ /* Process a destination blt order */ static void -process_destblt(STREAM s, DESTBLT_ORDER * os, uint32 present, BOOL delta) +process_destblt(STREAM s, DESTBLT_ORDER * os, uint32 present, RD_BOOL delta) { if (present & 0x01) rdp_in_coord(s, &os->x, delta); @@ -197,7 +197,7 @@ /* Process a pattern blt order */ static void -process_patblt(STREAM s, PATBLT_ORDER * os, uint32 present, BOOL delta) +process_patblt(STREAM s, PATBLT_ORDER * os, uint32 present, RD_BOOL delta) { if (present & 0x0001) rdp_in_coord(s, &os->x, delta); @@ -231,7 +231,7 @@ /* Process a screen blt order */ static void -process_screenblt(STREAM s, SCREENBLT_ORDER * os, uint32 present, BOOL delta) +process_screenblt(STREAM s, SCREENBLT_ORDER * os, uint32 present, RD_BOOL delta) { if (present & 0x0001) rdp_in_coord(s, &os->x, delta); @@ -262,7 +262,7 @@ /* Process a line order */ static void -process_line(STREAM s, LINE_ORDER * os, uint32 present, BOOL delta) +process_line(STREAM s, LINE_ORDER * os, uint32 present, RD_BOOL delta) { if (present & 0x0001) in_uint16_le(s, os->mixmode); @@ -301,7 +301,7 @@ /* Process an opaque rectangle order */ static void -process_rect(STREAM s, RECT_ORDER * os, uint32 present, BOOL delta) +process_rect(STREAM s, RECT_ORDER * os, uint32 present, RD_BOOL delta) { uint32 i; if (present & 0x01) @@ -341,7 +341,7 @@ /* Process a desktop save order */ static void -process_desksave(STREAM s, DESKSAVE_ORDER * os, uint32 present, BOOL delta) +process_desksave(STREAM s, DESKSAVE_ORDER * os, uint32 present, RD_BOOL delta) { int width, height; @@ -377,9 +377,9 @@ /* Process a memory blt order */ static void -process_memblt(STREAM s, MEMBLT_ORDER * os, uint32 present, BOOL delta) +process_memblt(STREAM s, MEMBLT_ORDER * os, uint32 present, RD_BOOL delta) { - HBITMAP bitmap; + RD_HBITMAP bitmap; if (present & 0x0001) { @@ -423,9 +423,9 @@ /* Process a 3-way blt order */ static void -process_triblt(STREAM s, TRIBLT_ORDER * os, uint32 present, BOOL delta) +process_triblt(STREAM s, TRIBLT_ORDER * os, uint32 present, RD_BOOL delta) { - HBITMAP bitmap; + RD_HBITMAP bitmap; if (present & 0x000001) { @@ -482,11 +482,11 @@ /* Process a polygon order */ static void -process_polygon(STREAM s, POLYGON_ORDER * os, uint32 present, BOOL delta) +process_polygon(STREAM s, POLYGON_ORDER * os, uint32 present, RD_BOOL delta) { int index, data, next; uint8 flags = 0; - POINT *points; + RD_POINT *points; if (present & 0x01) rdp_in_coord(s, &os->x, delta); @@ -528,8 +528,8 @@ return; } - points = (POINT *) xmalloc((os->npoints + 1) * sizeof(POINT)); - memset(points, 0, (os->npoints + 1) * sizeof(POINT)); + points = (RD_POINT *) xmalloc((os->npoints + 1) * sizeof(RD_POINT)); + memset(points, 0, (os->npoints + 1) * sizeof(RD_POINT)); points[0].x = os->x; points[0].y = os->y; @@ -561,11 +561,11 @@ /* Process a polygon2 order */ static void -process_polygon2(STREAM s, POLYGON2_ORDER * os, uint32 present, BOOL delta) +process_polygon2(STREAM s, POLYGON2_ORDER * os, uint32 present, RD_BOOL delta) { int index, data, next; uint8 flags = 0; - POINT *points; + RD_POINT *points; if (present & 0x0001) rdp_in_coord(s, &os->x, delta); @@ -613,8 +613,8 @@ return; } - points = (POINT *) xmalloc((os->npoints + 1) * sizeof(POINT)); - memset(points, 0, (os->npoints + 1) * sizeof(POINT)); + points = (RD_POINT *) xmalloc((os->npoints + 1) * sizeof(RD_POINT)); + memset(points, 0, (os->npoints + 1) * sizeof(RD_POINT)); points[0].x = os->x; points[0].y = os->y; @@ -646,12 +646,12 @@ /* Process a polyline order */ static void -process_polyline(STREAM s, POLYLINE_ORDER * os, uint32 present, BOOL delta) +process_polyline(STREAM s, POLYLINE_ORDER * os, uint32 present, RD_BOOL delta) { int index, next, data; uint8 flags = 0; PEN pen; - POINT *points; + RD_POINT *points; if (present & 0x01) rdp_in_coord(s, &os->x, delta); @@ -690,8 +690,8 @@ return; } - points = (POINT *) xmalloc((os->lines + 1) * sizeof(POINT)); - memset(points, 0, (os->lines + 1) * sizeof(POINT)); + points = (RD_POINT *) xmalloc((os->lines + 1) * sizeof(RD_POINT)); + memset(points, 0, (os->lines + 1) * sizeof(RD_POINT)); points[0].x = os->x; points[0].y = os->y; @@ -724,7 +724,7 @@ /* Process an ellipse order */ static void -process_ellipse(STREAM s, ELLIPSE_ORDER * os, uint32 present, BOOL delta) +process_ellipse(STREAM s, ELLIPSE_ORDER * os, uint32 present, RD_BOOL delta) { if (present & 0x01) rdp_in_coord(s, &os->left, delta); @@ -756,7 +756,7 @@ /* Process an ellipse2 order */ static void -process_ellipse2(STREAM s, ELLIPSE2_ORDER * os, uint32 present, BOOL delta) +process_ellipse2(STREAM s, ELLIPSE2_ORDER * os, uint32 present, RD_BOOL delta) { if (present & 0x0001) rdp_in_coord(s, &os->left, delta); @@ -794,7 +794,7 @@ /* Process a text order */ static void -process_text2(STREAM s, TEXT2_ORDER * os, uint32 present, BOOL delta) +process_text2(STREAM s, TEXT2_ORDER * os, uint32 present, RD_BOOL delta) { int i; @@ -874,7 +874,7 @@ static void process_raw_bmpcache(STREAM s) { - HBITMAP bitmap; + RD_HBITMAP bitmap; uint16 cache_idx, bufsize; uint8 cache_id, width, height, bpp, Bpp; uint8 *data, *inverted; @@ -907,7 +907,7 @@ static void process_bmpcache(STREAM s) { - HBITMAP bitmap; + RD_HBITMAP bitmap; uint16 cache_idx, size; uint8 cache_id, width, height, bpp, Bpp; uint8 *data, *bmpdata; @@ -961,9 +961,9 @@ /* Process a bitmap cache v2 order */ static void -process_bmpcache2(STREAM s, uint16 flags, BOOL compressed) +process_bmpcache2(STREAM s, uint16 flags, RD_BOOL compressed) { - HBITMAP bitmap; + RD_HBITMAP bitmap; int y; uint8 cache_id, cache_idx_low, width, height, Bpp; uint16 cache_idx, bufsize; @@ -1045,7 +1045,7 @@ { COLOURENTRY *entry; COLOURMAP map; - HCOLOURMAP hmap; + RD_HCOLOURMAP hmap; uint8 cache_id; int i; @@ -1077,7 +1077,7 @@ static void process_fontcache(STREAM s) { - HGLYPH bitmap; + RD_HGLYPH bitmap; uint8 font, nglyphs; uint16 character, offset, baseline, width, height; int i, datasize; @@ -1163,7 +1163,7 @@ uint32 present; uint8 order_flags; int size, processed = 0; - BOOL delta; + RD_BOOL delta; while (processed < num_orders) { --- rdesktop-1.5.0.orig/orders.h +++ rdesktop-1.5.0/orders.h @@ -1,18 +1,18 @@ /* rdesktop: A Remote Desktop Protocol client. RDP order processing - Copyright (C) Matthew Chapman 1999-2005 - + Copyright (C) Matthew Chapman 1999-2007 + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 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., 675 Mass Ave, Cambridge, MA 02139, USA. --- rdesktop-1.5.0.orig/parallel.c +++ rdesktop-1.5.0/parallel.c @@ -1,7 +1,7 @@ /* -*- c-basic-offset: 8 -*- rdesktop: A Remote Desktop Protocol client. - Copyright (C) Matthew Chapman 1999-2005 - + Copyright (C) Matthew Chapman 1999-2007 + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or @@ -11,7 +11,7 @@ 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., 675 Mass Ave, Cambridge, MA 02139, USA. @@ -75,9 +75,9 @@ return count; } -static NTSTATUS +static RD_NTSTATUS parallel_create(uint32 device_id, uint32 access, uint32 share_mode, uint32 disposition, - uint32 flags, char *filename, NTHANDLE * handle) + uint32 flags, char *filename, RD_NTHANDLE * handle) { int parallel_fd; @@ -85,7 +85,7 @@ if (parallel_fd == -1) { perror("open"); - return STATUS_ACCESS_DENIED; + return RD_STATUS_ACCESS_DENIED; } /* all read and writes should be non blocking */ @@ -101,30 +101,30 @@ *handle = parallel_fd; - return STATUS_SUCCESS; + return RD_STATUS_SUCCESS; } -static NTSTATUS -parallel_close(NTHANDLE handle) +static RD_NTSTATUS +parallel_close(RD_NTHANDLE handle) { int i = get_device_index(handle); if (i >= 0) g_rdpdr_device[i].handle = 0; close(handle); - return STATUS_SUCCESS; + return RD_STATUS_SUCCESS; } -static NTSTATUS -parallel_read(NTHANDLE handle, uint8 * data, uint32 length, uint32 offset, uint32 * result) +static RD_NTSTATUS +parallel_read(RD_NTHANDLE handle, uint8 * data, uint32 length, uint32 offset, uint32 * result) { *result = read(handle, data, length); - return STATUS_SUCCESS; + return RD_STATUS_SUCCESS; } -static NTSTATUS -parallel_write(NTHANDLE handle, uint8 * data, uint32 length, uint32 offset, uint32 * result) +static RD_NTSTATUS +parallel_write(RD_NTHANDLE handle, uint8 * data, uint32 length, uint32 offset, uint32 * result) { - int rc = STATUS_SUCCESS; + int rc = RD_STATUS_SUCCESS; int n = write(handle, data, length); if (n < 0) @@ -137,13 +137,13 @@ switch (errno) { case EAGAIN: - rc = STATUS_DEVICE_OFF_LINE; + rc = RD_STATUS_DEVICE_OFF_LINE; case ENOSPC: - rc = STATUS_DEVICE_PAPER_EMPTY; + rc = RD_STATUS_DEVICE_PAPER_EMPTY; case EIO: - rc = STATUS_DEVICE_OFF_LINE; + rc = RD_STATUS_DEVICE_OFF_LINE; default: - rc = STATUS_DEVICE_POWERED_OFF; + rc = RD_STATUS_DEVICE_POWERED_OFF; } #if defined(LPGETSTATUS) if (ioctl(handle, LPGETSTATUS, &status) == 0) @@ -157,11 +157,11 @@ return rc; } -static NTSTATUS -parallel_device_control(NTHANDLE handle, uint32 request, STREAM in, STREAM out) +static RD_NTSTATUS +parallel_device_control(RD_NTHANDLE handle, uint32 request, STREAM in, STREAM out) { if ((request >> 16) != FILE_DEVICE_PARALLEL) - return STATUS_INVALID_PARAMETER; + return RD_STATUS_INVALID_PARAMETER; /* extract operation */ request >>= 2; @@ -178,7 +178,7 @@ printf("\n"); unimpl("UNKNOWN IOCTL %d\n", request); } - return STATUS_SUCCESS; + return RD_STATUS_SUCCESS; } DEVICE_FNS parallel_fns = { --- rdesktop-1.5.0.orig/parse.h +++ rdesktop-1.5.0/parse.h @@ -1,18 +1,18 @@ /* rdesktop: A Remote Desktop Protocol client. Parsing primitives - Copyright (C) Matthew Chapman 1999-2005 - + Copyright (C) Matthew Chapman 1999-2007 + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 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., 675 Mass Ave, Cambridge, MA 02139, USA. --- rdesktop-1.5.0.orig/printer.c +++ rdesktop-1.5.0/printer.c @@ -1,6 +1,6 @@ /* -*- c-basic-offset: 8 -*- rdesktop: A Remote Desktop Protocol client. - Copyright (C) Matthew Chapman 1999-2005 + Copyright (C) Matthew Chapman 1999-2007 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,7 +22,7 @@ extern RDPDR_DEVICE g_rdpdr_device[]; static PRINTER * -get_printer_data(NTHANDLE handle) +get_printer_data(RD_NTHANDLE handle) { int index; @@ -100,9 +100,9 @@ return count; } -static NTSTATUS +static RD_NTSTATUS printer_create(uint32 device_id, uint32 access, uint32 share_mode, uint32 disposition, uint32 flags, - char *filename, NTHANDLE * handle) + char *filename, RD_NTHANDLE * handle) { char cmd[256]; PRINTER *pprinter_data; @@ -122,11 +122,11 @@ g_rdpdr_device[device_id].handle = fileno(pprinter_data->printer_fp); *handle = g_rdpdr_device[device_id].handle; - return STATUS_SUCCESS; + return RD_STATUS_SUCCESS; } -static NTSTATUS -printer_close(NTHANDLE handle) +static RD_NTSTATUS +printer_close(RD_NTHANDLE handle) { int i = get_device_index(handle); if (i >= 0) @@ -136,11 +136,11 @@ pclose(pprinter_data->printer_fp); g_rdpdr_device[i].handle = 0; } - return STATUS_SUCCESS; + return RD_STATUS_SUCCESS; } -static NTSTATUS -printer_write(NTHANDLE handle, uint8 * data, uint32 length, uint32 offset, uint32 * result) +static RD_NTSTATUS +printer_write(RD_NTHANDLE handle, uint8 * data, uint32 length, uint32 offset, uint32 * result) { PRINTER *pprinter_data; @@ -150,9 +150,9 @@ if (ferror(pprinter_data->printer_fp)) { *result = 0; - return STATUS_INVALID_HANDLE; + return RD_STATUS_INVALID_HANDLE; } - return STATUS_SUCCESS; + return RD_STATUS_SUCCESS; } DEVICE_FNS printer_fns = { --- rdesktop-1.5.0.orig/printercache.c +++ rdesktop-1.5.0/printercache.c @@ -1,8 +1,8 @@ /* -*- c-basic-offset: 8 -*- * rdesktop: A Remote Desktop Protocol client. * Entrypoint and utility functions - * Copyright (C) Matthew Chapman 1999-2005 - * Copyright (C) Jeroen Meijer 2003 + * Copyright (C) Matthew Chapman 1999-2007 + * Copyright (C) Jeroen Meijer 2003-2007 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -36,7 +36,7 @@ #include <string.h> #include "rdesktop.h" -static BOOL +static RD_BOOL printercache_mkdir(char *base, char *printer) { char *path; @@ -72,7 +72,7 @@ return True; } -static BOOL +static RD_BOOL printercache_unlink_blob(char *printer) { char *path; @@ -109,7 +109,7 @@ } -static BOOL +static RD_BOOL printercache_rename_blob(char *printer, char *new_printer) { char *printer_path; --- rdesktop-1.5.0.orig/proto.h +++ rdesktop-1.5.0/proto.h @@ -1,6 +1,6 @@ /* -*- c-basic-offset: 8 -*- rdesktop: A Remote Desktop Protocol client. - Copyright (C) Matthew Chapman 1999-2005 + Copyright (C) Matthew Chapman 1999-2007 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -26,24 +26,24 @@ #endif /* *INDENT-ON* */ /* bitmap.c */ -BOOL bitmap_decompress(uint8 * output, int width, int height, uint8 * input, int size, int Bpp); +RD_BOOL bitmap_decompress(uint8 * output, int width, int height, uint8 * input, int size, int Bpp); /* cache.c */ void cache_rebuild_bmpcache_linked_list(uint8 id, sint16 * idx, int count); void cache_bump_bitmap(uint8 id, uint16 idx, int bump); void cache_evict_bitmap(uint8 id); -HBITMAP cache_get_bitmap(uint8 id, uint16 idx); -void cache_put_bitmap(uint8 id, uint16 idx, HBITMAP bitmap); +RD_HBITMAP cache_get_bitmap(uint8 id, uint16 idx); +void cache_put_bitmap(uint8 id, uint16 idx, RD_HBITMAP bitmap); void cache_save_state(void); FONTGLYPH *cache_get_font(uint8 font, uint16 character); void cache_put_font(uint8 font, uint16 character, uint16 offset, uint16 baseline, uint16 width, - uint16 height, HGLYPH pixmap); + uint16 height, RD_HGLYPH pixmap); DATABLOB *cache_get_text(uint8 cache_id); void cache_put_text(uint8 cache_id, void *data, int length); uint8 *cache_get_desktop(uint32 offset, int cx, int cy, int bytes_per_pixel); void cache_put_desktop(uint32 offset, int cx, int cy, int scanline, int bytes_per_pixel, uint8 * data); -HCURSOR cache_get_cursor(uint16 cache_idx); -void cache_put_cursor(uint16 cache_idx, HCURSOR cursor); +RD_HCURSOR cache_get_cursor(uint16 cache_idx); +void cache_put_cursor(uint16 cache_idx, RD_HCURSOR cursor); /* channels.c */ VCHANNEL *channel_register(char *name, uint32 flags, void (*callback) (STREAM)); STREAM channel_init(VCHANNEL * channel, uint32 length); @@ -55,15 +55,15 @@ void cliprdr_send_data_request(uint32 format); void cliprdr_send_data(uint8 * data, uint32 length); void cliprdr_set_mode(const char *optarg); -BOOL cliprdr_init(void); +RD_BOOL cliprdr_init(void); /* disk.c */ int disk_enum_devices(uint32 * id, char *optarg); -NTSTATUS disk_query_information(NTHANDLE handle, uint32 info_class, STREAM out); -NTSTATUS disk_set_information(NTHANDLE handle, uint32 info_class, STREAM in, STREAM out); -NTSTATUS disk_check_notify(NTHANDLE handle); -NTSTATUS disk_create_notify(NTHANDLE handle, uint32 info_class); -NTSTATUS disk_query_volume_information(NTHANDLE handle, uint32 info_class, STREAM out); -NTSTATUS disk_query_directory(NTHANDLE handle, uint32 info_class, char *pattern, STREAM out); +RD_NTSTATUS disk_query_information(RD_NTHANDLE handle, uint32 info_class, STREAM out); +RD_NTSTATUS disk_set_information(RD_NTHANDLE handle, uint32 info_class, STREAM in, STREAM out); +RD_NTSTATUS disk_check_notify(RD_NTHANDLE handle); +RD_NTSTATUS disk_create_notify(RD_NTHANDLE handle, uint32 info_class); +RD_NTSTATUS disk_query_volume_information(RD_NTHANDLE handle, uint32 info_class, STREAM out); +RD_NTSTATUS disk_query_directory(RD_NTHANDLE handle, uint32 info_class, char *pattern, STREAM out); /* mppc.c */ int mppc_expand(uint8 * data, uint32 clen, uint8 ctype, uint32 * roff, uint32 * rlen); /* ewmhints.c */ @@ -73,8 +73,8 @@ STREAM iso_init(int length); void iso_send(STREAM s); STREAM iso_recv(uint8 * rdpver); -BOOL iso_connect(char *server, char *username); -BOOL iso_reconnect(char *server); +RD_BOOL iso_connect(char *server, char *username); +RD_BOOL iso_reconnect(char *server); void iso_disconnect(void); void iso_reset_state(void); /* licence.c */ @@ -84,8 +84,8 @@ void mcs_send_to_channel(STREAM s, uint16 channel); void mcs_send(STREAM s); STREAM mcs_recv(uint16 * channel, uint8 * rdpver); -BOOL mcs_connect(char *server, STREAM mcs_data, char *username); -BOOL mcs_reconnect(char *server, STREAM mcs_data); +RD_BOOL mcs_connect(char *server, STREAM mcs_data, char *username); +RD_BOOL mcs_reconnect(char *server, STREAM mcs_data); void mcs_disconnect(void); void mcs_reset_state(void); /* orders.c */ @@ -100,15 +100,16 @@ void printercache_process(STREAM s); /* pstcache.c */ void pstcache_touch_bitmap(uint8 cache_id, uint16 cache_idx, uint32 stamp); -BOOL pstcache_load_bitmap(uint8 cache_id, uint16 cache_idx); -BOOL pstcache_save_bitmap(uint8 cache_id, uint16 cache_idx, uint8 * key, uint8 width, uint8 height, - uint16 length, uint8 * data); +RD_BOOL pstcache_load_bitmap(uint8 cache_id, uint16 cache_idx); +RD_BOOL pstcache_save_bitmap(uint8 cache_id, uint16 cache_idx, uint8 * key, uint8 width, + uint8 height, uint16 length, uint8 * data); int pstcache_enumerate(uint8 id, HASH_KEY * keylist); -BOOL pstcache_init(uint8 cache_id); +RD_BOOL pstcache_init(uint8 cache_id); /* rdesktop.c */ int main(int argc, char *argv[]); void generate_random(uint8 * random); void *xmalloc(int size); +void exit_if_null(void *ptr); char *xstrdup(const char *s); void *xrealloc(void *oldmem, int size); void xfree(void *mem); @@ -118,19 +119,20 @@ void hexdump(unsigned char *p, unsigned int len); char *next_arg(char *src, char needle); void toupper_str(char *p); -BOOL str_startswith(const char *s, const char *prefix); -BOOL str_handle_lines(const char *input, char **rest, str_handle_lines_t linehandler, void *data); -BOOL subprocess(char *const argv[], str_handle_lines_t linehandler, void *data); +RD_BOOL str_startswith(const char *s, const char *prefix); +RD_BOOL str_handle_lines(const char *input, char **rest, str_handle_lines_t linehandler, + void *data); +RD_BOOL subprocess(char *const argv[], str_handle_lines_t linehandler, void *data); char *l_to_a(long N, int base); int load_licence(unsigned char **data); void save_licence(unsigned char *data, int length); -BOOL rd_pstcache_mkdir(void); +RD_BOOL rd_pstcache_mkdir(void); int rd_open_file(char *filename); void rd_close_file(int fd); int rd_read_file(int fd, void *ptr, int len); int rd_write_file(int fd, void *ptr, int len); int rd_lseek_file(int fd, int offset); -BOOL rd_lock_file(int fd, int start, int len); +RD_BOOL rd_lock_file(int fd, int start, int len); /* rdp5.c */ void rdp5_process(STREAM s); /* rdp.c */ @@ -145,34 +147,35 @@ void process_bitmap_updates(STREAM s); void process_palette(STREAM s); void process_disconnect_pdu(STREAM s, uint32 * ext_disc_reason); -void rdp_main_loop(BOOL * deactivated, uint32 * ext_disc_reason); -BOOL rdp_loop(BOOL * deactivated, uint32 * ext_disc_reason); -BOOL rdp_connect(char *server, uint32 flags, char *domain, char *password, char *command, - char *directory); -BOOL rdp_reconnect(char *server, uint32 flags, char *domain, char *password, char *command, - char *directory, char *cookie); +void rdp_main_loop(RD_BOOL * deactivated, uint32 * ext_disc_reason); +RD_BOOL rdp_loop(RD_BOOL * deactivated, uint32 * ext_disc_reason); +RD_BOOL rdp_connect(char *server, uint32 flags, char *domain, char *password, char *command, + char *directory); +RD_BOOL rdp_reconnect(char *server, uint32 flags, char *domain, char *password, char *command, + char *directory, char *cookie); void rdp_reset_state(void); void rdp_disconnect(void); /* rdpdr.c */ -int get_device_index(NTHANDLE handle); +int get_device_index(RD_NTHANDLE handle); void convert_to_unix_filename(char *filename); -BOOL rdpdr_init(void); -void rdpdr_add_fds(int *n, fd_set * rfds, fd_set * wfds, struct timeval *tv, BOOL * timeout); +void rdpdr_send_completion(uint32 device, uint32 id, uint32 status, uint32 result, uint8 * buffer, + uint32 length); +RD_BOOL rdpdr_init(void); +void rdpdr_add_fds(int *n, fd_set * rfds, fd_set * wfds, struct timeval *tv, RD_BOOL * timeout); struct async_iorequest *rdpdr_remove_iorequest(struct async_iorequest *prev, struct async_iorequest *iorq); -void rdpdr_check_fds(fd_set * rfds, fd_set * wfds, BOOL timed_out); -BOOL rdpdr_abort_io(uint32 fd, uint32 major, NTSTATUS status); +void rdpdr_check_fds(fd_set * rfds, fd_set * wfds, RD_BOOL timed_out); +RD_BOOL rdpdr_abort_io(uint32 fd, uint32 major, RD_NTSTATUS status); /* rdpsnd.c */ -void rdpsnd_send_completion(uint16 tick, uint8 packet_index); -BOOL rdpsnd_init(void); -/* rdpsnd_oss.c */ -BOOL wave_out_open(void); -void wave_out_close(void); -BOOL wave_out_format_supported(WAVEFORMATEX * pwfx); -BOOL wave_out_set_format(WAVEFORMATEX * pwfx); -void wave_out_volume(uint16 left, uint16 right); -void wave_out_write(STREAM s, uint16 tick, uint8 index); -void wave_out_play(void); +void rdpsnd_record(const void *data, unsigned int size); +RD_BOOL rdpsnd_init(char *optarg); +void rdpsnd_show_help(void); +void rdpsnd_add_fds(int *n, fd_set * rfds, fd_set * wfds, struct timeval *tv); +void rdpsnd_check_fds(fd_set * rfds, fd_set * wfds); +struct audio_packet *rdpsnd_queue_current_packet(void); +RD_BOOL rdpsnd_queue_empty(void); +void rdpsnd_queue_next(unsigned long completed_in_us); +int rdpsnd_queue_next_tick(void); /* secure.c */ void sec_hash_48(uint8 * out, uint8 * in, uint8 * salt1, uint8 * salt2, uint8 salt); void sec_hash_16(uint8 * out, uint8 * in, uint8 * salt1, uint8 * salt2); @@ -185,19 +188,20 @@ void sec_send(STREAM s, uint32 flags); void sec_process_mcs_data(STREAM s); STREAM sec_recv(uint8 * rdpver); -BOOL sec_connect(char *server, char *username); -BOOL sec_reconnect(char *server); +RD_BOOL sec_connect(char *server, char *username); +RD_BOOL sec_reconnect(char *server); void sec_disconnect(void); void sec_reset_state(void); /* serial.c */ int serial_enum_devices(uint32 * id, char *optarg); -BOOL serial_get_event(NTHANDLE handle, uint32 * result); -BOOL serial_get_timeout(NTHANDLE handle, uint32 length, uint32 * timeout, uint32 * itv_timeout); +RD_BOOL serial_get_event(RD_NTHANDLE handle, uint32 * result); +RD_BOOL serial_get_timeout(RD_NTHANDLE handle, uint32 length, uint32 * timeout, + uint32 * itv_timeout); /* tcp.c */ STREAM tcp_init(uint32 maxlen); void tcp_send(STREAM s); STREAM tcp_recv(STREAM s, uint32 length); -BOOL tcp_connect(char *server); +RD_BOOL tcp_connect(char *server); void tcp_disconnect(void); char *tcp_get_address(void); void tcp_reset_state(void); @@ -211,13 +215,13 @@ void xclip_init(void); void xclip_deinit(void); /* xkeymap.c */ -BOOL xkeymap_from_locale(const char *locale); +RD_BOOL xkeymap_from_locale(const char *locale); FILE *xkeymap_open(const char *filename); void xkeymap_init(void); -BOOL handle_special_keys(uint32 keysym, unsigned int state, uint32 ev_time, BOOL pressed); +RD_BOOL handle_special_keys(uint32 keysym, unsigned int state, uint32 ev_time, RD_BOOL pressed); key_translation xkeymap_translate_key(uint32 keysym, unsigned int keycode, unsigned int state); void xkeymap_send_keys(uint32 keysym, unsigned int keycode, unsigned int state, uint32 ev_time, - BOOL pressed, uint8 nesting); + RD_BOOL pressed, uint8 nesting); uint16 xkeymap_translate_button(unsigned int button); char *get_ksname(uint32 keysym); void save_remote_modifiers(uint8 scancode); @@ -228,28 +232,28 @@ void reset_modifier_keys(void); void rdp_send_scancode(uint32 time, uint16 flags, uint8 scancode); /* xwin.c */ -BOOL get_key_state(unsigned int state, uint32 keysym); -BOOL ui_init(void); +RD_BOOL get_key_state(unsigned int state, uint32 keysym); +RD_BOOL ui_init(void); void ui_deinit(void); -BOOL ui_create_window(void); +RD_BOOL ui_create_window(void); void ui_resize_window(void); void ui_destroy_window(void); void xwin_toggle_fullscreen(void); int ui_select(int rdp_socket); void ui_move_pointer(int x, int y); -HBITMAP ui_create_bitmap(int width, int height, uint8 * data); +RD_HBITMAP ui_create_bitmap(int width, int height, uint8 * data); void ui_paint_bitmap(int x, int y, int cx, int cy, int width, int height, uint8 * data); -void ui_destroy_bitmap(HBITMAP bmp); -HGLYPH ui_create_glyph(int width, int height, uint8 * data); -void ui_destroy_glyph(HGLYPH glyph); -HCURSOR ui_create_cursor(unsigned int x, unsigned int y, int width, int height, uint8 * andmask, - uint8 * xormask); -void ui_set_cursor(HCURSOR cursor); -void ui_destroy_cursor(HCURSOR cursor); +void ui_destroy_bitmap(RD_HBITMAP bmp); +RD_HGLYPH ui_create_glyph(int width, int height, uint8 * data); +void ui_destroy_glyph(RD_HGLYPH glyph); +RD_HCURSOR ui_create_cursor(unsigned int x, unsigned int y, int width, int height, uint8 * andmask, + uint8 * xormask); +void ui_set_cursor(RD_HCURSOR cursor); +void ui_destroy_cursor(RD_HCURSOR cursor); void ui_set_null_cursor(void); -HCOLOURMAP ui_create_colourmap(COLOURMAP * colours); -void ui_destroy_colourmap(HCOLOURMAP map); -void ui_set_colourmap(HCOLOURMAP map); +RD_HCOLOURMAP ui_create_colourmap(COLOURMAP * colours); +void ui_destroy_colourmap(RD_HCOLOURMAP map); +void ui_set_colourmap(RD_HCOLOURMAP map); void ui_set_clip(int x, int y, int cx, int cy); void ui_reset_clip(void); void ui_bell(void); @@ -257,17 +261,17 @@ void ui_patblt(uint8 opcode, int x, int y, int cx, int cy, BRUSH * brush, int bgcolour, int fgcolour); void ui_screenblt(uint8 opcode, int x, int y, int cx, int cy, int srcx, int srcy); -void ui_memblt(uint8 opcode, int x, int y, int cx, int cy, HBITMAP src, int srcx, int srcy); -void ui_triblt(uint8 opcode, int x, int y, int cx, int cy, HBITMAP src, int srcx, int srcy, +void ui_memblt(uint8 opcode, int x, int y, int cx, int cy, RD_HBITMAP src, int srcx, int srcy); +void ui_triblt(uint8 opcode, int x, int y, int cx, int cy, RD_HBITMAP src, int srcx, int srcy, BRUSH * brush, int bgcolour, int fgcolour); void ui_line(uint8 opcode, int startx, int starty, int endx, int endy, PEN * pen); void ui_rect(int x, int y, int cx, int cy, int colour); -void ui_polygon(uint8 opcode, uint8 fillmode, POINT * point, int npoints, BRUSH * brush, +void ui_polygon(uint8 opcode, uint8 fillmode, RD_POINT * point, int npoints, BRUSH * brush, int bgcolour, int fgcolour); -void ui_polyline(uint8 opcode, POINT * points, int npoints, PEN * pen); +void ui_polyline(uint8 opcode, RD_POINT * points, int npoints, PEN * pen); void ui_ellipse(uint8 opcode, uint8 fillmode, int x, int y, int cx, int cy, BRUSH * brush, int bgcolour, int fgcolour); -void ui_draw_glyph(int mixmode, int x, int y, int cx, int cy, HGLYPH glyph, int srcx, int srcy, +void ui_draw_glyph(int mixmode, int x, int y, int cx, int cy, RD_HGLYPH glyph, int srcx, int srcy, int bgcolour, int fgcolour); void ui_draw_text(uint8 font, uint8 flags, uint8 opcode, int mixmode, int x, int y, int clipx, int clipy, int clipcx, int clipcy, int boxx, int boxy, int boxcx, int boxcy, @@ -276,7 +280,7 @@ void ui_desktop_restore(uint32 offset, int x, int y, int cx, int cy); void ui_begin_update(void); void ui_end_update(void); -void ui_seamless_begin(BOOL hidden); +void ui_seamless_begin(RD_BOOL hidden); void ui_seamless_hide_desktop(void); void ui_seamless_unhide_desktop(void); void ui_seamless_toggle(void); @@ -284,6 +288,9 @@ unsigned long flags); void ui_seamless_destroy_window(unsigned long id, unsigned long flags); void ui_seamless_destroy_group(unsigned long id, unsigned long flags); +void ui_seamless_seticon(unsigned long id, const char *format, int width, int height, int chunk, + const char *data, int chunk_len); +void ui_seamless_delicon(unsigned long id, const char *format, int width, int height); void ui_seamless_move_window(unsigned long id, int x, int y, int width, int height, unsigned long flags); void ui_seamless_restack_window(unsigned long id, unsigned long behind, unsigned long flags); @@ -292,9 +299,9 @@ void ui_seamless_syncbegin(unsigned long flags); void ui_seamless_ack(unsigned int serial); /* lspci.c */ -BOOL lspci_init(void); +RD_BOOL lspci_init(void); /* seamless.c */ -BOOL seamless_init(void); +RD_BOOL seamless_init(void); unsigned int seamless_send_sync(void); unsigned int seamless_send_state(unsigned long id, unsigned int state, unsigned long flags); unsigned int seamless_send_position(unsigned long id, int x, int y, int width, int height, @@ -302,6 +309,9 @@ void seamless_select_timeout(struct timeval *tv); unsigned int seamless_send_zchange(unsigned long id, unsigned long below, unsigned long flags); unsigned int seamless_send_focus(unsigned long id, unsigned long flags); +/* scard.c */ +void scard_lock(int lock); +void scard_unlock(int lock); /* *INDENT-OFF* */ #ifdef __cplusplus --- rdesktop-1.5.0.orig/proto.head +++ rdesktop-1.5.0/proto.head @@ -1,6 +1,6 @@ /* -*- c-basic-offset: 8 -*- rdesktop: A Remote Desktop Protocol client. - Copyright (C) Matthew Chapman 1999-2005 + Copyright (C) Matthew Chapman 1999-2007 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by --- rdesktop-1.5.0.orig/pstcache.c +++ rdesktop-1.5.0/pstcache.c @@ -1,7 +1,7 @@ /* -*- c-basic-offset: 8 -*- rdesktop: A Remote Desktop Protocol client. Persistent Bitmap Cache routines - Copyright (C) Jeroen Meijer 2004-2005 + Copyright (C) Jeroen Meijer 2004-2007 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -25,13 +25,13 @@ #define IS_PERSISTENT(id) (id < 8 && g_pstcache_fd[id] > 0) extern int g_server_depth; -extern BOOL g_bitmap_cache; -extern BOOL g_bitmap_cache_persist_enable; -extern BOOL g_bitmap_cache_precache; +extern RD_BOOL g_bitmap_cache; +extern RD_BOOL g_bitmap_cache_persist_enable; +extern RD_BOOL g_bitmap_cache_precache; int g_pstcache_fd[8]; int g_pstcache_Bpp; -BOOL g_pstcache_enumerated = False; +RD_BOOL g_pstcache_enumerated = False; uint8 zero_key[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; @@ -50,13 +50,13 @@ } /* Load a bitmap from the persistent cache */ -BOOL +RD_BOOL pstcache_load_bitmap(uint8 cache_id, uint16 cache_idx) { uint8 *celldata; int fd; CELLHEADER cellhdr; - HBITMAP bitmap; + RD_HBITMAP bitmap; if (!g_bitmap_cache_persist_enable) return False; @@ -79,7 +79,7 @@ } /* Store a bitmap in the persistent cache */ -BOOL +RD_BOOL pstcache_save_bitmap(uint8 cache_id, uint16 cache_idx, uint8 * key, uint8 width, uint8 height, uint16 length, uint8 * data) { @@ -160,7 +160,7 @@ } /* initialise the persistent bitmap cache */ -BOOL +RD_BOOL pstcache_init(uint8 cache_id) { int fd; --- rdesktop-1.5.0.orig/rdesktop.c +++ rdesktop-1.5.0/rdesktop.c @@ -1,7 +1,7 @@ /* -*- c-basic-offset: 8 -*- rdesktop: A Remote Desktop Protocol client. Entrypoint and utility functions - Copyright (C) Matthew Chapman 1999-2005 + Copyright (C) Matthew Chapman 1999-2007 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -45,7 +45,7 @@ #include <sys/un.h> /* sockaddr_un */ #endif -#include <openssl/md5.h> +#include "ssl.h" char g_title[64] = ""; char g_username[64]; @@ -71,31 +71,31 @@ extern int g_tcp_port_rdp; int g_server_depth = -1; int g_win_button_size = 0; /* If zero, disable single app mode */ -BOOL g_bitmap_compression = True; -BOOL g_sendmotion = True; -BOOL g_bitmap_cache = True; -BOOL g_bitmap_cache_persist_enable = False; -BOOL g_bitmap_cache_precache = True; -BOOL g_encryption = True; -BOOL packet_encryption = True; -BOOL g_desktop_save = True; /* desktop save order */ -BOOL g_polygon_ellipse_orders = True; /* polygon / ellipse orders */ -BOOL g_fullscreen = False; -BOOL g_grab_keyboard = True; -BOOL g_hide_decorations = False; -BOOL g_use_rdp5 = True; -BOOL g_rdpclip = True; -BOOL g_console_session = False; -BOOL g_numlock_sync = False; -BOOL lspci_enabled = False; -BOOL g_owncolmap = False; -BOOL g_ownbackstore = True; /* We can't rely on external BackingStore */ -BOOL g_seamless_rdp = False; +RD_BOOL g_bitmap_compression = True; +RD_BOOL g_sendmotion = True; +RD_BOOL g_bitmap_cache = True; +RD_BOOL g_bitmap_cache_persist_enable = False; +RD_BOOL g_bitmap_cache_precache = True; +RD_BOOL g_encryption = True; +RD_BOOL g_packet_encryption = True; +RD_BOOL g_desktop_save = True; /* desktop save order */ +RD_BOOL g_polygon_ellipse_orders = True; /* polygon / ellipse orders */ +RD_BOOL g_fullscreen = False; +RD_BOOL g_grab_keyboard = True; +RD_BOOL g_hide_decorations = False; +RD_BOOL g_use_rdp5 = True; +RD_BOOL g_rdpclip = True; +RD_BOOL g_console_session = False; +RD_BOOL g_numlock_sync = False; +RD_BOOL g_lspci_enabled = False; +RD_BOOL g_owncolmap = False; +RD_BOOL g_ownbackstore = True; /* We can't rely on external BackingStore */ +RD_BOOL g_seamless_rdp = False; uint32 g_embed_wnd; uint32 g_rdp5_performanceflags = RDP5_NO_WALLPAPER | RDP5_NO_FULLWINDOWDRAG | RDP5_NO_MENUANIMATIONS; /* Session Directory redirection */ -BOOL g_redirect = False; +RD_BOOL g_redirect = False; char g_redirect_server[64]; char g_redirect_domain[16]; char g_redirect_password[64]; @@ -104,7 +104,7 @@ uint32 g_redirect_flags = 0; #ifdef WITH_RDPSND -BOOL g_rdpsnd = False; +RD_BOOL g_rdpsnd = False; #endif #ifdef HAVE_ICONV @@ -127,7 +127,7 @@ usage(char *program) { fprintf(stderr, "rdesktop: A Remote Desktop Protocol client.\n"); - fprintf(stderr, "Version " VERSION ". Copyright (C) 1999-2005 Matt Chapman.\n"); + fprintf(stderr, "Version " VERSION ". Copyright (C) 1999-2007 Matt Chapman.\n"); fprintf(stderr, "See http://www.rdesktop.org/ for more information.\n\n"); fprintf(stderr, "Usage: %s [options] server[:port]\n", program); @@ -179,8 +179,13 @@ fprintf(stderr, " '-r printer:mydeskjet': enable printer redirection\n"); fprintf(stderr, " or mydeskjet=\"HP LaserJet IIIP\" to enter server driver as well\n"); - fprintf(stderr, " '-r sound:[local|off|remote]': enable sound redirection\n"); +#ifdef WITH_RDPSND + fprintf(stderr, + " '-r sound:[local[:driver[:device]]|off|remote]': enable sound redirection\n"); fprintf(stderr, " remote would leave sound on server\n"); + fprintf(stderr, " available drivers for 'local':\n"); + rdpsnd_show_help(); +#endif fprintf(stderr, " '-r clipboard:[off|PRIMARYCLIPBOARD|CLIPBOARD]': enable clipboard\n"); fprintf(stderr, " redirection.\n"); @@ -188,6 +193,21 @@ " 'PRIMARYCLIPBOARD' looks at both PRIMARY and CLIPBOARD\n"); fprintf(stderr, " when sending data to server.\n"); fprintf(stderr, " 'CLIPBOARD' looks at only CLIPBOARD.\n"); +#ifdef WITH_SCARD + fprintf(stderr, " '-r scard[:\"Scard Name\"=\"Alias Name[;Vendor Name]\"[,...]]\n"); + fprintf(stderr, " example: -r scard:\"eToken PRO 00 00\"=\"AKS ifdh 0\"\n"); + fprintf(stderr, + " \"eToken PRO 00 00\" -> Device in Linux/Unix enviroment\n"); + fprintf(stderr, + " \"AKS ifdh 0\" -> Device shown in Windows enviroment \n"); + fprintf(stderr, " example: -r scard:\"eToken PRO 00 00\"=\"AKS ifdh 0;AKS\"\n"); + fprintf(stderr, + " \"eToken PRO 00 00\" -> Device in Linux/Unix enviroment\n"); + fprintf(stderr, + " \"AKS ifdh 0\" -> Device shown in Windows enviroment \n"); + fprintf(stderr, + " \"AKS\" -> Device vendor name \n"); +#endif fprintf(stderr, " -0: attach to console\n"); fprintf(stderr, " -4: use RDP version 4\n"); fprintf(stderr, " -5: use RDP version 5 (default)\n"); @@ -299,11 +319,11 @@ rdp_reset_state(); } -static BOOL +static RD_BOOL read_password(char *password, int size) { struct termios tios; - BOOL ret = False; + RD_BOOL ret = False; int istty = 0; char *p; @@ -393,16 +413,19 @@ char password[64]; char shell[256]; char directory[256]; - BOOL prompt_password, deactivated; + RD_BOOL prompt_password, deactivated; struct passwd *pw; uint32 flags, ext_disc_reason = 0; char *p; int c; char *locale = NULL; int username_option = 0; - BOOL geometry_option = False; + RD_BOOL geometry_option = False; int run_count = 0; /* Session Directory support */ - BOOL continue_connect = True; /* Session Directory support */ + RD_BOOL continue_connect = True; /* Session Directory support */ +#ifdef WITH_RDPSND + char *rdpsnd_optarg = NULL; +#endif #ifdef HAVE_LOCALE_H /* Set locale according to environment */ @@ -559,7 +582,7 @@ g_encryption = False; break; case 'E': - packet_encryption = False; + g_packet_encryption = False; break; case 'm': g_sendmotion = False; @@ -610,7 +633,8 @@ g_server_depth = strtol(optarg, NULL, 10); if (g_server_depth != 8 && g_server_depth != 16 && - g_server_depth != 15 && g_server_depth != 24) + g_server_depth != 15 && g_server_depth != 24 + && g_server_depth != 32) { error("Invalid server colour depth.\n"); return 1; @@ -663,7 +687,12 @@ if (str_startswith(optarg, "local")) #ifdef WITH_RDPSND + { + rdpsnd_optarg = + next_arg(optarg, ':'); g_rdpsnd = True; + } + #else warning("Not compiled with sound support\n"); #endif @@ -698,7 +727,7 @@ } else if (str_startswith(optarg, "lspci")) { - lspci_enabled = True; + g_lspci_enabled = True; } else if (str_startswith(optarg, "lptport")) { @@ -729,9 +758,17 @@ else g_rdpclip = True; } + else if (strncmp("scard", optarg, 5) == 0) + { +#ifdef WITH_SCARD + scard_enum_devices(&g_num_devices, optarg + 5); +#else + warning("Not compiled with smartcard support\n"); +#endif + } else { - warning("Unknown -r argument\n\n\tPossible arguments are: comport, disk, lptport, printer, sound, clipboard\n"); + warning("Unknown -r argument\n\n\tPossible arguments are: comport, disk, lptport, printer, sound, clipboard, scard\n"); } break; @@ -876,10 +913,15 @@ #ifdef WITH_RDPSND if (g_rdpsnd) - rdpsnd_init(); + { + if (!rdpsnd_init(rdpsnd_optarg)) + { + warning("Initializing sound-support failed!\n"); + } + } #endif - if (lspci_enabled) + if (g_lspci_enabled) lspci_init(); rdpdr_init(); @@ -897,7 +939,7 @@ /* By setting encryption to False here, we have an encrypted login packet but unencrypted transfer of other packets */ - if (!packet_encryption) + if (!g_packet_encryption) g_encryption = False; @@ -969,11 +1011,11 @@ #ifdef EGD_SOCKET /* Read 32 random bytes from PRNGD or EGD socket (based on OpenSSL RAND_egd) */ -static BOOL +static RD_BOOL generate_random_egd(uint8 * buf) { struct sockaddr_un addr; - BOOL ret = False; + RD_BOOL ret = False; int fd; fd = socket(AF_UNIX, SOCK_STREAM, 0); @@ -1011,7 +1053,7 @@ { struct stat st; struct tms tmsbuf; - MD5_CTX md5; + SSL_MD5 md5; uint32 *r; int fd, n; @@ -1043,11 +1085,11 @@ r[7] = st.st_ctime; /* Hash both halves with MD5 to obscure possible patterns */ - MD5_Init(&md5); - MD5_Update(&md5, random, 16); - MD5_Final(random, &md5); - MD5_Update(&md5, random + 16, 16); - MD5_Final(random + 16, &md5); + ssl_md5_init(&md5); + ssl_md5_update(&md5, random, 16); + ssl_md5_final(&md5, random); + ssl_md5_update(&md5, random + 16, 16); + ssl_md5_final(&md5, random + 16); } /* malloc; exit if out of memory */ @@ -1063,6 +1105,17 @@ return mem; } +/* Exit on NULL pointer. Use to verify result from XGetImage etc */ +void +exit_if_null(void *ptr) +{ + if (ptr == NULL) + { + error("unexpected null pointer. Out of memory?\n"); + exit(1); + } +} + /* strdup */ char * xstrdup(const char *s) @@ -1249,7 +1302,7 @@ } -BOOL +RD_BOOL str_startswith(const char *s, const char *prefix) { return (strncmp(s, prefix, strlen(prefix)) == 0); @@ -1260,7 +1313,7 @@ line. Incomplete lines are saved in the rest variable, which should initially point to NULL. When linehandler returns False, stop and return False. Otherwise, return True. */ -BOOL +RD_BOOL str_handle_lines(const char *input, char **rest, str_handle_lines_t linehandler, void *data) { char *buf, *p; @@ -1268,7 +1321,7 @@ size_t inputlen; size_t buflen; size_t restlen = 0; - BOOL ret = True; + RD_BOOL ret = True; /* Copy data to buffer */ inputlen = strlen(input); @@ -1316,7 +1369,7 @@ /* Execute the program specified by argv. For each line in stdout/stderr output, call linehandler. Returns false on failure. */ -BOOL +RD_BOOL subprocess(char *const argv[], str_handle_lines_t linehandler, void *data) { pid_t child; @@ -1482,7 +1535,7 @@ } /* Create the bitmap cache directory */ -BOOL +RD_BOOL rd_pstcache_mkdir(void) { char *home; @@ -1559,7 +1612,7 @@ } /* do a write lock on a file */ -BOOL +RD_BOOL rd_lock_file(int fd, int start, int len) { struct flock lock; --- rdesktop-1.5.0.orig/rdesktop.h +++ rdesktop-1.5.0/rdesktop.h @@ -1,18 +1,18 @@ /* rdesktop: A Remote Desktop Protocol client. Master include file - Copyright (C) Matthew Chapman 1999-2005 - + Copyright (C) Matthew Chapman 1999-2007 + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 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., 675 Mass Ave, Cambridge, MA 02139, USA. @@ -21,6 +21,13 @@ #include <stdlib.h> #include <stdio.h> #include <string.h> +#ifdef _WIN32 +#define WINVER 0x0400 +#include <windows.h> +#include <winsock.h> +#include <time.h> +#define DIR int +#else #include <dirent.h> #include <sys/time.h> #ifdef HAVE_SYS_SELECT_H @@ -29,6 +36,7 @@ #include <sys/types.h> #include <unistd.h> #endif +#endif #include <limits.h> /* PATH_MAX */ #define VERSION "1.5.0" @@ -57,12 +65,24 @@ #define DEBUG_CLIPBOARD(args) #endif +#ifdef WITH_DEBUG_SOUND +#define DEBUG_SOUND(args) printf args; +#else +#define DEBUG_SOUND(args) +#endif + #ifdef WITH_DEBUG_CHANNEL #define DEBUG_CHANNEL(args) printf args; #else #define DEBUG_CHANNEL(args) #endif +#ifdef WITH_DEBUG_SCARD +#define DEBUG_SCARD(args) printf args; +#else +#define DEBUG_SCARD(args) +#endif + #define STRNCPY(dst,src,n) { strncpy(dst,src,n-1); dst[n-1] = 0; } #ifndef MIN --- rdesktop-1.5.0.orig/rdesktop.spec +++ rdesktop-1.5.0/rdesktop.spec @@ -2,11 +2,11 @@ Name: rdesktop Version: 1.5.0 Release: 1 -Copyright: GPL; see COPYING +License: GPL; see COPYING Group: Applications/Communications Source: rdesktop-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-buildroot -Packager: Peter Åstrand <peter@cendio.se> +Packager: Peter Ã…strand <astrand@cendio.se> %description rdesktop is a client for Remote Desktop Protocol (RDP), used in a number of --- rdesktop-1.5.0.orig/rdp.c +++ rdesktop-1.5.0/rdp.c @@ -1,7 +1,7 @@ /* -*- c-basic-offset: 8 -*- rdesktop: A Remote Desktop Protocol client. Protocol services - RDP layer - Copyright (C) Matthew Chapman 1999-2005 + Copyright (C) Matthew Chapman 1999-2007 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,8 +19,10 @@ */ #include <time.h> +#ifndef _WIN32 #include <errno.h> #include <unistd.h> +#endif #include "rdesktop.h" #ifdef HAVE_ICONV @@ -36,20 +38,20 @@ extern uint16 g_mcs_userid; extern char g_username[64]; extern char g_codepage[16]; -extern BOOL g_bitmap_compression; -extern BOOL g_orders; -extern BOOL g_encryption; -extern BOOL g_desktop_save; -extern BOOL g_polygon_ellipse_orders; -extern BOOL g_use_rdp5; +extern RD_BOOL g_bitmap_compression; +extern RD_BOOL g_orders; +extern RD_BOOL g_encryption; +extern RD_BOOL g_desktop_save; +extern RD_BOOL g_polygon_ellipse_orders; +extern RD_BOOL g_use_rdp5; extern uint16 g_server_rdp_version; extern uint32 g_rdp5_performanceflags; extern int g_server_depth; extern int g_width; extern int g_height; -extern BOOL g_bitmap_cache; -extern BOOL g_bitmap_cache_persist_enable; -extern BOOL g_numlock_sync; +extern RD_BOOL g_bitmap_cache; +extern RD_BOOL g_bitmap_cache_persist_enable; +extern RD_BOOL g_numlock_sync; uint8 *g_next_packet; uint32 g_rdp_shareid; @@ -57,7 +59,7 @@ extern RDPCOMP g_mppc_dict; /* Session Directory support */ -extern BOOL g_redirect; +extern RD_BOOL g_redirect; extern char g_redirect_server[64]; extern char g_redirect_domain[16]; extern char g_redirect_password[64]; @@ -71,7 +73,7 @@ #endif #ifdef HAVE_ICONV -static BOOL g_iconv_works = True; +static RD_BOOL g_iconv_works = True; #endif /* Receive an RDP packet */ @@ -183,8 +185,8 @@ size_t i = 1, o = 4; if ((iconv_h = iconv_open(WINDOWS_CODEPAGE, g_codepage)) == (iconv_t) - 1) { - warning("rdp_out_unistr: iconv_open[%s -> %s] fail %d\n", - g_codepage, WINDOWS_CODEPAGE, (int) iconv_h); + warning("rdp_out_unistr: iconv_open[%s -> %s] fail %p\n", + g_codepage, WINDOWS_CODEPAGE, iconv_h); g_iconv_works = False; rdp_out_unistr(s, string, len); @@ -254,8 +256,8 @@ { if ((iconv_h = iconv_open(g_codepage, WINDOWS_CODEPAGE)) == (iconv_t) - 1) { - warning("rdp_in_unistr: iconv_open[%s -> %s] fail %d\n", - WINDOWS_CODEPAGE, g_codepage, (int) iconv_h); + warning("rdp_in_unistr: iconv_open[%s -> %s] fail %p\n", + WINDOWS_CODEPAGE, g_codepage, iconv_h); g_iconv_works = False; return rdp_in_unistr(s, string, uni_len); @@ -996,7 +998,7 @@ { uint16 x, y, width, height, cache_idx, masklen, datalen; uint8 *mask, *data; - HCURSOR cursor; + RD_HCURSOR cursor; in_uint16_le(s, cache_idx); in_uint16_le(s, x); @@ -1153,7 +1155,7 @@ { COLOURENTRY *entry; COLOURMAP map; - HCOLOURMAP hmap; + RD_HCOLOURMAP hmap; int i; in_uint8s(s, 2); /* pad */ @@ -1223,7 +1225,7 @@ } /* Process data PDU */ -static BOOL +static RD_BOOL process_data_pdu(STREAM s, uint32 * ext_disc_reason) { uint8 data_pdu_type; @@ -1308,7 +1310,7 @@ } /* Process redirect PDU from Session Directory */ -static BOOL +static RD_BOOL process_redirect_pdu(STREAM s /*, uint32 * ext_disc_reason */ ) { uint32 len; @@ -1358,19 +1360,19 @@ /* Process incoming packets */ /* nevers gets out of here till app is done */ void -rdp_main_loop(BOOL * deactivated, uint32 * ext_disc_reason) +rdp_main_loop(RD_BOOL * deactivated, uint32 * ext_disc_reason) { while (rdp_loop(deactivated, ext_disc_reason)) ; } /* used in uiports and rdp_main_loop, processes the rdp packets waiting */ -BOOL -rdp_loop(BOOL * deactivated, uint32 * ext_disc_reason) +RD_BOOL +rdp_loop(RD_BOOL * deactivated, uint32 * ext_disc_reason) { uint8 type; - BOOL disc = False; /* True when a disconnect PDU was received */ - BOOL cont = True; + RD_BOOL disc = False; /* True when a disconnect PDU was received */ + RD_BOOL cont = True; STREAM s; while (cont) @@ -1407,7 +1409,7 @@ } /* Establish a connection up to the RDP layer */ -BOOL +RD_BOOL rdp_connect(char *server, uint32 flags, char *domain, char *password, char *command, char *directory) { @@ -1419,7 +1421,7 @@ } /* Establish a reconnection up to the RDP layer */ -BOOL +RD_BOOL rdp_reconnect(char *server, uint32 flags, char *domain, char *password, char *command, char *directory, char *cookie) { --- rdesktop-1.5.0.orig/rdp5.c +++ rdesktop-1.5.0/rdp5.c @@ -1,8 +1,8 @@ /* -*- c-basic-offset: 8 -*- rdesktop: A Remote Desktop Protocol client. Protocol services - RDP5 short form PDU processing - Copyright (C) Matthew Chapman 1999-2005 - Copyright (C) Erik Forsberg 2003 + Copyright (C) Matthew Chapman 1999-2007 + Copyright (C) Erik Forsberg 2003-2007 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by --- rdesktop-1.5.0.orig/rdpdr.c +++ rdesktop-1.5.0/rdpdr.c @@ -1,6 +1,6 @@ /* -*- c-basic-offset: 8 -*- rdesktop: A Remote Desktop Protocol client. - Copyright (C) Matthew Chapman 1999-2005 + Copyright (C) Matthew Chapman 1999-2007 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -60,13 +60,16 @@ extern DEVICE_FNS printer_fns; extern DEVICE_FNS parallel_fns; extern DEVICE_FNS disk_fns; +#ifdef WITH_SCARD +extern DEVICE_FNS scard_fns; +#endif extern FILEINFO g_fileinfo[]; -extern BOOL g_notify_stamp; +extern RD_BOOL g_notify_stamp; static VCHANNEL *rdpdr_channel; /* If select() times out, the request for the device with handle g_min_timeout_fd is aborted */ -NTHANDLE g_min_timeout_fd; +RD_NTHANDLE g_min_timeout_fd; uint32 g_num_devices; /* Table with information about rdpdr devices */ @@ -91,7 +94,7 @@ /* Return device_id for a given handle */ int -get_device_index(NTHANDLE handle) +get_device_index(RD_NTHANDLE handle) { int i; for (i = 0; i < RDPDR_MAX_DEVICES; i++) @@ -114,7 +117,7 @@ } } -static BOOL +static RD_BOOL rdpdr_handle_ok(int device, int handle) { switch (g_rdpdr_device[device].device_type) @@ -135,7 +138,7 @@ } /* Add a new io request to the table containing pending io requests so it won't block rdesktop */ -static BOOL +static RD_BOOL add_async_iorequest(uint32 device, uint32 file, uint32 id, uint32 major, uint32 length, DEVICE_FNS * fns, uint32 total_timeout, uint32 interval_timeout, uint8 * buffer, uint32 offset) @@ -309,13 +312,16 @@ channel_send(s, rdpdr_channel); } -static void +void rdpdr_send_completion(uint32 device, uint32 id, uint32 status, uint32 result, uint8 * buffer, uint32 length) { uint8 magic[4] = "rDCI"; STREAM s; +#ifdef WITH_SCARD + scard_lock(SCARD_LOCK_RDPDR); +#endif s = channel_init(rdpdr_channel, 20 + length); out_uint8a(s, magic, 4); out_uint32_le(s, device); @@ -330,6 +336,9 @@ /* hexdump(s->channel_hdr + 8, s->end - s->channel_hdr - 8); */ #endif channel_send(s, rdpdr_channel); +#ifdef WITH_SCARD + scard_unlock(SCARD_LOCK_RDPDR); +#endif } static void @@ -356,8 +365,8 @@ uint8 *buffer, *pst_buf; struct stream out; DEVICE_FNS *fns; - BOOL rw_blocking = True; - NTSTATUS status = STATUS_INVALID_DEVICE_REQUEST; + RD_BOOL rw_blocking = True; + RD_NTSTATUS status = RD_STATUS_INVALID_DEVICE_REQUEST; in_uint32_le(s, device); in_uint32_le(s, file); @@ -395,6 +404,11 @@ break; case DEVICE_TYPE_SCARD: +#ifdef WITH_SCARD + fns = &scard_fns; + rw_blocking = False; + break; +#endif default: error("IRP for bad device %ld\n", device); @@ -425,7 +439,7 @@ if (!fns->create) { - status = STATUS_NOT_SUPPORTED; + status = RD_STATUS_NOT_SUPPORTED; break; } @@ -437,7 +451,7 @@ case IRP_MJ_CLOSE: if (!fns->close) { - status = STATUS_NOT_SUPPORTED; + status = RD_STATUS_NOT_SUPPORTED; break; } @@ -448,7 +462,7 @@ if (!fns->read) { - status = STATUS_NOT_SUPPORTED; + status = RD_STATUS_NOT_SUPPORTED; break; } @@ -459,7 +473,7 @@ #endif if (!rdpdr_handle_ok(device, file)) { - status = STATUS_INVALID_HANDLE; + status = RD_STATUS_INVALID_HANDLE; break; } @@ -468,7 +482,7 @@ buffer = (uint8 *) xrealloc((void *) buffer, length); if (!buffer) { - status = STATUS_CANCELLED; + status = RD_STATUS_CANCELLED; break; } status = fns->read(file, buffer, length, offset, &result); @@ -480,7 +494,7 @@ pst_buf = (uint8 *) xmalloc(length); if (!pst_buf) { - status = STATUS_CANCELLED; + status = RD_STATUS_CANCELLED; break; } serial_get_timeout(file, length, &total_timeout, &interval_timeout); @@ -488,11 +502,11 @@ (device, file, id, major, length, fns, total_timeout, interval_timeout, pst_buf, offset)) { - status = STATUS_PENDING; + status = RD_STATUS_PENDING; break; } - status = STATUS_CANCELLED; + status = RD_STATUS_CANCELLED; break; case IRP_MJ_WRITE: @@ -500,7 +514,7 @@ if (!fns->write) { - status = STATUS_NOT_SUPPORTED; + status = RD_STATUS_NOT_SUPPORTED; break; } @@ -512,7 +526,7 @@ #endif if (!rdpdr_handle_ok(device, file)) { - status = STATUS_INVALID_HANDLE; + status = RD_STATUS_INVALID_HANDLE; break; } @@ -526,7 +540,7 @@ pst_buf = (uint8 *) xmalloc(length); if (!pst_buf) { - status = STATUS_CANCELLED; + status = RD_STATUS_CANCELLED; break; } @@ -535,18 +549,18 @@ if (add_async_iorequest (device, file, id, major, length, fns, 0, 0, pst_buf, offset)) { - status = STATUS_PENDING; + status = RD_STATUS_PENDING; break; } - status = STATUS_CANCELLED; + status = RD_STATUS_CANCELLED; break; case IRP_MJ_QUERY_INFORMATION: if (g_rdpdr_device[device].device_type != DEVICE_TYPE_DISK) { - status = STATUS_INVALID_HANDLE; + status = RD_STATUS_INVALID_HANDLE; break; } in_uint32_le(s, info_level); @@ -562,7 +576,7 @@ if (g_rdpdr_device[device].device_type != DEVICE_TYPE_DISK) { - status = STATUS_INVALID_HANDLE; + status = RD_STATUS_INVALID_HANDLE; break; } @@ -578,7 +592,7 @@ if (g_rdpdr_device[device].device_type != DEVICE_TYPE_DISK) { - status = STATUS_INVALID_HANDLE; + status = RD_STATUS_INVALID_HANDLE; break; } @@ -594,7 +608,7 @@ if (g_rdpdr_device[device].device_type != DEVICE_TYPE_DISK) { - status = STATUS_INVALID_HANDLE; + status = RD_STATUS_INVALID_HANDLE; break; } @@ -631,19 +645,17 @@ in_uint32_le(s, info_level); /* notify mask */ - g_notify_stamp = True; - status = disk_create_notify(file, info_level); result = 0; - if (status == STATUS_PENDING) + if (status == RD_STATUS_PENDING) add_async_iorequest(device, file, id, major, length, fns, 0, 0, NULL, 0); break; default: - status = STATUS_INVALID_PARAMETER; + status = RD_STATUS_INVALID_PARAMETER; /* JIF */ unimpl("IRP major=0x%x minor=0x%x\n", major, minor); } @@ -653,7 +665,7 @@ if (!fns->device_control) { - status = STATUS_NOT_SUPPORTED; + status = RD_STATUS_NOT_SUPPORTED; break; } @@ -665,25 +677,33 @@ buffer = (uint8 *) xrealloc((void *) buffer, bytes_out + 0x14); if (!buffer) { - status = STATUS_CANCELLED; + status = RD_STATUS_CANCELLED; break; } out.data = out.p = buffer; out.size = sizeof(buffer); + +#ifdef WITH_SCARD + scardSetInfo(device, id, bytes_out + 0x14); +#endif status = fns->device_control(file, request, s, &out); result = buffer_len = out.p - out.data; /* Serial SERIAL_WAIT_ON_MASK */ - if (status == STATUS_PENDING) + if (status == RD_STATUS_PENDING) { if (add_async_iorequest (device, file, id, major, length, fns, 0, 0, NULL, 0)) { - status = STATUS_PENDING; + status = RD_STATUS_PENDING; break; } } +#ifdef WITH_SCARD + else if (status == (RD_STATUS_PENDING | 0xC0000000)) + status = RD_STATUS_PENDING; +#endif break; @@ -691,7 +711,7 @@ if (g_rdpdr_device[device].device_type != DEVICE_TYPE_DISK) { - status = STATUS_INVALID_HANDLE; + status = RD_STATUS_INVALID_HANDLE; break; } @@ -701,7 +721,7 @@ out.size = sizeof(buffer); /* FIXME: Perhaps consider actually *do* something here :-) */ - status = STATUS_SUCCESS; + status = RD_STATUS_SUCCESS; result = buffer_len = out.p - out.data; break; @@ -710,7 +730,7 @@ break; } - if (status != STATUS_PENDING) + if (status != RD_STATUS_PENDING) { rdpdr_send_completion(device, id, status, result, buffer, buffer_len); } @@ -817,7 +837,7 @@ unimpl("RDPDR packet type %c%c%c%c\n", magic[0], magic[1], magic[2], magic[3]); } -BOOL +RD_BOOL rdpdr_init() { if (g_num_devices > 0) @@ -833,7 +853,7 @@ /* Add file descriptors of pending io request to select() */ void -rdpdr_add_fds(int *n, fd_set * rfds, fd_set * wfds, struct timeval *tv, BOOL * timeout) +rdpdr_add_fds(int *n, fd_set * rfds, fd_set * wfds, struct timeval *tv, RD_BOOL * timeout) { uint32 select_timeout = 0; /* Timeout value to be used for select() (in millisecons). */ struct async_iorequest *iorq; @@ -930,9 +950,9 @@ /* Check if select() returned with one of the rdpdr file descriptors, and complete io if it did */ static void -_rdpdr_check_fds(fd_set * rfds, fd_set * wfds, BOOL timed_out) +_rdpdr_check_fds(fd_set * rfds, fd_set * wfds, RD_BOOL timed_out) { - NTSTATUS status; + RD_NTSTATUS status; uint32 result = 0; DEVICE_FNS *fns; struct async_iorequest *iorq; @@ -961,7 +981,7 @@ /* iv_timeout between 2 chars, send partial_len */ /*printf("RDPDR: IVT total %u bytes read of %u\n", iorq->partial_len, iorq->length); */ rdpdr_send_completion(iorq->device, - iorq->id, STATUS_SUCCESS, + iorq->id, RD_STATUS_SUCCESS, iorq->partial_len, iorq->buffer, iorq->partial_len); iorq = rdpdr_remove_iorequest(prev, iorq); @@ -985,7 +1005,7 @@ } - rdpdr_abort_io(g_min_timeout_fd, 0, STATUS_TIMEOUT); + rdpdr_abort_io(g_min_timeout_fd, 0, RD_STATUS_TIMEOUT); return; } @@ -1089,7 +1109,7 @@ out.size = sizeof(buffer); out_uint32_le(&out, result); result = buffer_len = out.p - out.data; - status = STATUS_SUCCESS; + status = RD_STATUS_SUCCESS; rdpdr_send_completion(iorq->device, iorq->id, status, result, buffer, buffer_len); @@ -1125,7 +1145,7 @@ { g_notify_stamp = False; status = disk_check_notify(iorq->fd); - if (status != STATUS_PENDING) + if (status != RD_STATUS_PENDING) { rdpdr_send_completion(iorq->device, iorq->id, @@ -1151,7 +1171,7 @@ } void -rdpdr_check_fds(fd_set * rfds, fd_set * wfds, BOOL timed_out) +rdpdr_check_fds(fd_set * rfds, fd_set * wfds, RD_BOOL timed_out) { fd_set dummy; @@ -1169,8 +1189,8 @@ /* Abort a pending io request for a given handle and major */ -BOOL -rdpdr_abort_io(uint32 fd, uint32 major, NTSTATUS status) +RD_BOOL +rdpdr_abort_io(uint32 fd, uint32 major, RD_NTSTATUS status) { uint32 result; struct async_iorequest *iorq; --- rdesktop-1.5.0.orig/rdpsnd.c +++ rdesktop-1.5.0/rdpsnd.c @@ -1,7 +1,8 @@ /* -*- c-basic-offset: 8 -*- rdesktop: A Remote Desktop Protocol client. Sound Channel Process Functions - Copyright (C) Matthew Chapman 2003 + Copyright 2006-2007 Pierre Ossman <ossman@cendio.se> for Cendio AB + Copyright (C) Matthew Chapman 2003-2007 Copyright (C) GuoJunBo guojunbo@ict.ac.cn 2003 This program is free software; you can redistribute it and/or modify @@ -19,25 +20,62 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include <assert.h> + #include "rdesktop.h" +#include "rdpsnd.h" +#include "rdpsnd_dsp.h" #define RDPSND_CLOSE 1 #define RDPSND_WRITE 2 #define RDPSND_SET_VOLUME 3 #define RDPSND_UNKNOWN4 4 #define RDPSND_COMPLETION 5 -#define RDPSND_SERVERTICK 6 +#define RDPSND_PING 6 #define RDPSND_NEGOTIATE 7 +#define RDPSND_REC_NEGOTIATE 39 +#define RDPSND_REC_START 40 +#define RDPSND_REC_STOP 41 +#define RDPSND_REC_DATA 42 +#define RDPSND_REC_SET_VOLUME 43 + +#define RDPSND_FLAG_RECORD 0x00800000 + #define MAX_FORMATS 10 +#define MAX_QUEUE 50 static VCHANNEL *rdpsnd_channel; +static VCHANNEL *rdpsnddbg_channel; +static struct audio_driver *drivers = NULL; +struct audio_driver *current_driver = NULL; -static BOOL device_open; -static WAVEFORMATEX formats[MAX_FORMATS]; +static RD_BOOL device_open; +static RD_BOOL rec_device_open; + +static RD_WAVEFORMATEX formats[MAX_FORMATS]; static unsigned int format_count; static unsigned int current_format; +static RD_WAVEFORMATEX rec_formats[MAX_FORMATS]; +static unsigned int rec_format_count; + +unsigned int queue_hi, queue_lo, queue_pending; +struct audio_packet packet_queue[MAX_QUEUE]; + +static char record_buffer[8192]; +static uint32 record_buffer_size; + +static uint8 packet_opcode; +static struct stream packet; + +void (*wave_out_play) (void); + +static void rdpsnd_queue_write(STREAM s, uint16 tick, uint8 index); +static void rdpsnd_queue_init(void); +static void rdpsnd_queue_complete_pending(void); +static long rdpsnd_queue_next_completion(void); + static STREAM rdpsnd_init_packet(uint16 type, uint16 size) { @@ -52,44 +90,149 @@ static void rdpsnd_send(STREAM s) { -#ifdef RDPSND_DEBUG - printf("RDPSND send:\n"); - hexdump(s->channel_hdr + 8, s->end - s->channel_hdr - 8); -#endif - channel_send(s, rdpsnd_channel); } -void +static void rdpsnd_send_completion(uint16 tick, uint8 packet_index) { STREAM s; s = rdpsnd_init_packet(RDPSND_COMPLETION, 4); - out_uint16_le(s, tick + 50); + out_uint16_le(s, tick); out_uint8(s, packet_index); out_uint8(s, 0); s_mark_end(s); rdpsnd_send(s); + + DEBUG_SOUND(("RDPSND: -> RDPSND_COMPLETION(tick: %u, index: %u)\n", + (unsigned) tick, (unsigned) packet_index)); +} + +static void +rdpsnd_flush_record(void) +{ + STREAM s; + unsigned int chunk_size; + char *data; + + if (record_buffer_size == 0) + return; + + assert(record_buffer_size <= sizeof(record_buffer)); + + data = record_buffer; + + /* + * Microsoft's RDP server keeps dropping chunks, so we need to + * transmit everything inside one channel fragment or we risk + * making the rdpsnd server go out of sync with the byte stream. + */ + while (record_buffer_size) + { + if (record_buffer_size < 1596) + chunk_size = record_buffer_size; + else + chunk_size = 1596; + + s = rdpsnd_init_packet(RDPSND_REC_DATA, chunk_size); + out_uint8p(s, data, chunk_size); + + s_mark_end(s); + rdpsnd_send(s); + + data = data + chunk_size; + record_buffer_size -= chunk_size; + + DEBUG_SOUND(("RDPSND: -> RDPSND_REC_DATA(length: %u)\n", (unsigned) chunk_size)); + } + + record_buffer_size = 0; +} + +void +rdpsnd_record(const void *data, unsigned int size) +{ + uint32 remain; + + assert(rec_device_open); + + while (size) + { + remain = sizeof(record_buffer) - record_buffer_size; + + if (size >= remain) + { + memcpy(record_buffer + record_buffer_size, data, remain); + record_buffer_size += remain; + rdpsnd_flush_record(); + data = (const char *) data + remain; + size -= remain; + } + else + { + memcpy(record_buffer + record_buffer_size, data, size); + record_buffer_size += size; + size = 0; + } + } +} + +static RD_BOOL +rdpsnd_auto_select(void) +{ + static RD_BOOL failed = False; + + if (!failed) + { + current_driver = drivers; + while (current_driver != NULL) + { + DEBUG(("trying %s...\n", current_driver->name)); + if (current_driver->wave_out_open()) + { + DEBUG(("selected %s\n", current_driver->name)); + current_driver->wave_out_close(); + return True; + } + current_driver = current_driver->next; + } + + warning("no working audio-driver found\n"); + failed = True; + current_driver = NULL; + } + + return False; } static void rdpsnd_process_negotiate(STREAM in) { - unsigned int in_format_count, i; - WAVEFORMATEX *format; + uint16 in_format_count, i; + uint8 pad; + uint16 version; + RD_WAVEFORMATEX *format; STREAM out; - BOOL device_available = False; + RD_BOOL device_available = False; int readcnt; int discardcnt; - in_uint8s(in, 14); /* flags, volume, pitch, UDP port */ + in_uint8s(in, 14); /* initial bytes not valid from server */ in_uint16_le(in, in_format_count); - in_uint8s(in, 4); /* pad, status, pad */ + in_uint8(in, pad); + in_uint16_le(in, version); + in_uint8s(in, 1); /* padding */ - if (wave_out_open()) + DEBUG_SOUND(("RDPSND: RDPSND_NEGOTIATE(formats: %d, pad: 0x%02x, version: %x)\n", + (int) in_format_count, (unsigned) pad, (unsigned) version)); + + if (!current_driver) + device_available = rdpsnd_auto_select(); + + if (current_driver && !device_available && current_driver->wave_out_open()) { - wave_out_close(); + current_driver->wave_out_close(); device_available = True; } @@ -120,7 +263,7 @@ in_uint8a(in, format->cb, readcnt); in_uint8s(in, discardcnt); - if (device_available && wave_out_format_supported(format)) + if (current_driver && current_driver->wave_out_format_supported(format)) { format_count++; if (format_count == MAX_FORMATS) @@ -130,15 +273,15 @@ } out = rdpsnd_init_packet(RDPSND_NEGOTIATE | 0x200, 20 + 18 * format_count); - out_uint32_le(out, 3); /* flags */ + out_uint32_le(out, 0x00800003); /* flags */ out_uint32(out, 0xffffffff); /* volume */ out_uint32(out, 0); /* pitch */ out_uint16(out, 0); /* UDP port */ out_uint16_le(out, format_count); - out_uint8(out, 0x95); /* pad? */ - out_uint16_le(out, 2); /* status */ - out_uint8(out, 0x77); /* pad? */ + out_uint8(out, 0); /* padding */ + out_uint16_le(out, 2); /* version */ + out_uint8(out, 0); /* padding */ for (i = 0; i < format_count; i++) { @@ -153,112 +296,595 @@ } s_mark_end(out); + + DEBUG_SOUND(("RDPSND: -> RDPSND_NEGOTIATE(formats: %d)\n", (int) format_count)); + rdpsnd_send(out); } static void -rdpsnd_process_servertick(STREAM in) +rdpsnd_process_ping(STREAM in) { - uint16 tick1, tick2; + uint16 tick; STREAM out; - /* in_uint8s(in, 4); unknown */ - in_uint16_le(in, tick1); - in_uint16_le(in, tick2); - - out = rdpsnd_init_packet(RDPSND_SERVERTICK | 0x2300, 4); - out_uint16_le(out, tick1); - out_uint16_le(out, tick2); + in_uint16_le(in, tick); + + DEBUG_SOUND(("RDPSND: RDPSND_PING(tick: 0x%04x)\n", (unsigned) tick)); + + out = rdpsnd_init_packet(RDPSND_PING | 0x2300, 4); + out_uint16_le(out, tick); + out_uint16_le(out, 0); s_mark_end(out); rdpsnd_send(out); + + DEBUG_SOUND(("RDPSND: -> (tick: 0x%04x)\n", (unsigned) tick)); } static void -rdpsnd_process(STREAM s) +rdpsnd_process_rec_negotiate(STREAM in) { - uint8 type; - uint16 datalen; - uint32 volume; - static uint16 tick, format; - static uint8 packet_index; - static BOOL awaiting_data_packet; + uint16 in_format_count, i; + uint16 version; + RD_WAVEFORMATEX *format; + STREAM out; + RD_BOOL device_available = False; + int readcnt; + int discardcnt; -#ifdef RDPSND_DEBUG - printf("RDPSND recv:\n"); - hexdump(s->p, s->end - s->p); -#endif + in_uint8s(in, 8); /* initial bytes not valid from server */ + in_uint16_le(in, in_format_count); + in_uint16_le(in, version); + + DEBUG_SOUND(("RDPSND: RDPSND_REC_NEGOTIATE(formats: %d, version: %x)\n", + (int) in_format_count, (unsigned) version)); - if (awaiting_data_packet) + if (!current_driver) + device_available = rdpsnd_auto_select(); + + if (current_driver && !device_available && current_driver->wave_in_open + && current_driver->wave_in_open()) { - if (format >= MAX_FORMATS) - { - error("RDPSND: Invalid format index\n"); - return; - } + current_driver->wave_in_close(); + device_available = True; + } - if (!device_open || (format != current_format)) + rec_format_count = 0; + if (s_check_rem(in, 18 * in_format_count)) + { + for (i = 0; i < in_format_count; i++) { - if (!device_open && !wave_out_open()) + format = &rec_formats[rec_format_count]; + in_uint16_le(in, format->wFormatTag); + in_uint16_le(in, format->nChannels); + in_uint32_le(in, format->nSamplesPerSec); + in_uint32_le(in, format->nAvgBytesPerSec); + in_uint16_le(in, format->nBlockAlign); + in_uint16_le(in, format->wBitsPerSample); + in_uint16_le(in, format->cbSize); + + /* read in the buffer of unknown use */ + readcnt = format->cbSize; + discardcnt = 0; + if (format->cbSize > MAX_CBSIZE) { - rdpsnd_send_completion(tick, packet_index); - return; + fprintf(stderr, "cbSize too large for buffer: %d\n", + format->cbSize); + readcnt = MAX_CBSIZE; + discardcnt = format->cbSize - MAX_CBSIZE; } - if (!wave_out_set_format(&formats[format])) + in_uint8a(in, format->cb, readcnt); + in_uint8s(in, discardcnt); + + if (current_driver && current_driver->wave_in_format_supported(format)) { - rdpsnd_send_completion(tick, packet_index); - wave_out_close(); - device_open = False; - return; + rec_format_count++; + if (rec_format_count == MAX_FORMATS) + break; } - device_open = True; - current_format = format; } + } - wave_out_write(s, tick, packet_index); - awaiting_data_packet = False; - return; + out = rdpsnd_init_packet(RDPSND_REC_NEGOTIATE, 12 + 18 * rec_format_count); + out_uint32_le(out, 0x00000000); /* flags */ + out_uint32_le(out, 0xffffffff); /* volume */ + out_uint16_le(out, rec_format_count); + out_uint16_le(out, 1); /* version */ + + for (i = 0; i < rec_format_count; i++) + { + format = &rec_formats[i]; + out_uint16_le(out, format->wFormatTag); + out_uint16_le(out, format->nChannels); + out_uint32_le(out, format->nSamplesPerSec); + out_uint32_le(out, format->nAvgBytesPerSec); + out_uint16_le(out, format->nBlockAlign); + out_uint16_le(out, format->wBitsPerSample); + out_uint16(out, 0); /* cbSize */ } - in_uint8(s, type); - in_uint8s(s, 1); /* unknown? */ - in_uint16_le(s, datalen); + s_mark_end(out); + + DEBUG_SOUND(("RDPSND: -> RDPSND_REC_NEGOTIATE(formats: %d)\n", (int) rec_format_count)); + + rdpsnd_send(out); +} - switch (type) +static void +rdpsnd_process_packet(uint8 opcode, STREAM s) +{ + uint16 vol_left, vol_right; + static uint16 tick, format; + static uint8 packet_index; + + switch (opcode) { case RDPSND_WRITE: in_uint16_le(s, tick); in_uint16_le(s, format); in_uint8(s, packet_index); - awaiting_data_packet = True; + in_uint8s(s, 3); + DEBUG_SOUND(("RDPSND: RDPSND_WRITE(tick: %u, format: %u, index: %u, data: %u bytes)\n", (unsigned) tick, (unsigned) format, (unsigned) packet_index, (unsigned) s->size - 8)); + + if (format >= MAX_FORMATS) + { + error("RDPSND: Invalid format index\n"); + break; + } + + if (!device_open || (format != current_format)) + { + /* + * If we haven't selected a device by now, then either + * we've failed to find a working device, or the server + * is sending bogus RDPSND_WRITE. + */ + if (!current_driver) + { + rdpsnd_send_completion(tick, packet_index); + break; + } + if (!device_open && !current_driver->wave_out_open()) + { + rdpsnd_send_completion(tick, packet_index); + break; + } + if (!current_driver->wave_out_set_format(&formats[format])) + { + rdpsnd_send_completion(tick, packet_index); + current_driver->wave_out_close(); + device_open = False; + break; + } + device_open = True; + current_format = format; + } + + rdpsnd_queue_write(rdpsnd_dsp_process + (s->p, s->end - s->p, current_driver, + &formats[current_format]), tick, packet_index); + return; break; case RDPSND_CLOSE: - wave_out_close(); + DEBUG_SOUND(("RDPSND: RDPSND_CLOSE()\n")); + if (device_open) + current_driver->wave_out_close(); device_open = False; break; case RDPSND_NEGOTIATE: rdpsnd_process_negotiate(s); break; - case RDPSND_SERVERTICK: - rdpsnd_process_servertick(s); + case RDPSND_PING: + rdpsnd_process_ping(s); break; case RDPSND_SET_VOLUME: - in_uint32(s, volume); + in_uint16_le(s, vol_left); + in_uint16_le(s, vol_right); + DEBUG_SOUND(("RDPSND: RDPSND_VOLUME(left: 0x%04x (%u %%), right: 0x%04x (%u %%))\n", (unsigned) vol_left, (unsigned) vol_left / 655, (unsigned) vol_right, (unsigned) vol_right / 655)); if (device_open) + current_driver->wave_out_volume(vol_left, vol_right); + break; + case RDPSND_REC_NEGOTIATE: + rdpsnd_process_rec_negotiate(s); + break; + case RDPSND_REC_START: + in_uint16_le(s, format); + DEBUG_SOUND(("RDPSND: RDPSND_REC_START(format: %u)\n", (unsigned) format)); + + if (format >= MAX_FORMATS) { - wave_out_volume((volume & 0xffff), (volume & 0xffff0000) >> 16); + error("RDPSND: Invalid format index\n"); + break; } + + if (rec_device_open) + { + error("RDPSND: Multiple RDPSND_REC_START\n"); + break; + } + + if (!current_driver->wave_in_open()) + break; + + if (!current_driver->wave_in_set_format(&rec_formats[format])) + { + error("RDPSND: Device not accepting format\n"); + current_driver->wave_in_close(); + break; + } + rec_device_open = True; + break; + case RDPSND_REC_STOP: + DEBUG_SOUND(("RDPSND: RDPSND_REC_STOP()\n")); + rdpsnd_flush_record(); + if (rec_device_open) + current_driver->wave_in_close(); + rec_device_open = False; + break; + case RDPSND_REC_SET_VOLUME: + in_uint16_le(s, vol_left); + in_uint16_le(s, vol_right); + DEBUG_SOUND(("RDPSND: RDPSND_REC_VOLUME(left: 0x%04x (%u %%), right: 0x%04x (%u %%))\n", (unsigned) vol_left, (unsigned) vol_left / 655, (unsigned) vol_right, (unsigned) vol_right / 655)); + if (rec_device_open) + current_driver->wave_in_volume(vol_left, vol_right); break; default: - unimpl("RDPSND packet type %d\n", type); + unimpl("RDPSND packet type %x\n", opcode); break; } } -BOOL -rdpsnd_init(void) +static void +rdpsnd_process(STREAM s) +{ + uint16 len; + + while (!s_check_end(s)) + { + /* New packet */ + if (packet.size == 0) + { + if ((s->end - s->p) < 4) + { + error("RDPSND: Split at packet header. Things will go south from here...\n"); + return; + } + in_uint8(s, packet_opcode); + in_uint8s(s, 1); /* Padding */ + in_uint16_le(s, len); + + DEBUG_SOUND(("RDPSND: == Opcode %x Length: %d ==\n", + (int) packet_opcode, (int) len)); + + packet.p = packet.data; + packet.end = packet.data + len; + packet.size = len; + } + else + { + len = MIN(s->end - s->p, packet.end - packet.p); + + /* Microsoft's server is so broken it's not even funny... */ + if (packet_opcode == RDPSND_WRITE) + { + if ((packet.p - packet.data) < 12) + len = MIN(len, 12 - (packet.p - packet.data)); + else if ((packet.p - packet.data) == 12) + { + DEBUG_SOUND(("RDPSND: Eating 4 bytes of %d bytes...\n", + len)); + in_uint8s(s, 4); + len -= 4; + } + } + + in_uint8a(s, packet.p, len); + packet.p += len; + } + + /* Packet fully assembled */ + if (packet.p == packet.end) + { + packet.p = packet.data; + rdpsnd_process_packet(packet_opcode, &packet); + packet.size = 0; + } + } +} + +static RD_BOOL +rdpsnddbg_line_handler(const char *line, void *data) +{ +#ifdef WITH_DEBUG_SOUND + fprintf(stderr, "SNDDBG: %s\n", line); +#endif + return True; +} + +static void +rdpsnddbg_process(STREAM s) { + unsigned int pkglen; + static char *rest = NULL; + char *buf; + + pkglen = s->end - s->p; + /* str_handle_lines requires null terminated strings */ + buf = (char *) xmalloc(pkglen + 1); + STRNCPY(buf, (char *) s->p, pkglen + 1); + + str_handle_lines(buf, &rest, rdpsnddbg_line_handler, NULL); + + xfree(buf); +} + +static void +rdpsnd_register_drivers(char *options) +{ + struct audio_driver **reg; + + /* The order of registrations define the probe-order + when opening the device for the first time */ + reg = &drivers; +#if defined(RDPSND_ALSA) + *reg = alsa_register(options); + assert(*reg); + reg = &((*reg)->next); +#endif +#if defined(RDPSND_SUN) + *reg = sun_register(options); + assert(*reg); + reg = &((*reg)->next); +#endif +#if defined(RDPSND_OSS) + *reg = oss_register(options); + assert(*reg); + reg = &((*reg)->next); +#endif +#if defined(RDPSND_SGI) + *reg = sgi_register(options); + assert(*reg); + reg = &((*reg)->next); +#endif +#if defined(RDPSND_LIBAO) + *reg = libao_register(options); + assert(*reg); + reg = &((*reg)->next); +#endif + *reg = NULL; +} + +RD_BOOL +rdpsnd_init(char *optarg) +{ + struct audio_driver *pos; + char *driver = NULL, *options = NULL; + + drivers = NULL; + + packet.data = (uint8 *) xmalloc(65536); + packet.p = packet.end = packet.data; + packet.size = 0; + rdpsnd_channel = channel_register("rdpsnd", CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_ENCRYPT_RDP, rdpsnd_process); - return (rdpsnd_channel != NULL); + + rdpsnddbg_channel = + channel_register("snddbg", CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_ENCRYPT_RDP, + rdpsnddbg_process); + + if ((rdpsnd_channel == NULL) || (rdpsnddbg_channel == NULL)) + { + error("channel_register\n"); + return False; + } + + rdpsnd_queue_init(); + + if (optarg != NULL && strlen(optarg) > 0) + { + driver = options = optarg; + + while (*options != '\0' && *options != ':') + options++; + + if (*options == ':') + { + *options = '\0'; + options++; + } + + if (*options == '\0') + options = NULL; + } + + rdpsnd_register_drivers(options); + + if (!driver) + return True; + + pos = drivers; + while (pos != NULL) + { + if (!strcmp(pos->name, driver)) + { + DEBUG(("selected %s\n", pos->name)); + current_driver = pos; + return True; + } + pos = pos->next; + } + return False; +} + +void +rdpsnd_show_help(void) +{ + struct audio_driver *pos; + + rdpsnd_register_drivers(NULL); + + pos = drivers; + while (pos != NULL) + { + fprintf(stderr, " %s:\t%s\n", pos->name, pos->description); + pos = pos->next; + } +} + +void +rdpsnd_add_fds(int *n, fd_set * rfds, fd_set * wfds, struct timeval *tv) +{ + long next_pending; + + if (device_open || rec_device_open) + current_driver->add_fds(n, rfds, wfds, tv); + + next_pending = rdpsnd_queue_next_completion(); + if (next_pending >= 0) + { + long cur_timeout; + + cur_timeout = tv->tv_sec * 1000000 + tv->tv_usec; + if (cur_timeout > next_pending) + { + tv->tv_sec = next_pending / 1000000; + tv->tv_usec = next_pending % 1000000; + } + } +} + +void +rdpsnd_check_fds(fd_set * rfds, fd_set * wfds) +{ + rdpsnd_queue_complete_pending(); + + if (device_open || rec_device_open) + current_driver->check_fds(rfds, wfds); +} + +static void +rdpsnd_queue_write(STREAM s, uint16 tick, uint8 index) +{ + struct audio_packet *packet = &packet_queue[queue_hi]; + unsigned int next_hi = (queue_hi + 1) % MAX_QUEUE; + + if (next_hi == queue_pending) + { + error("No space to queue audio packet\n"); + return; + } + + queue_hi = next_hi; + + packet->s = *s; + packet->tick = tick; + packet->index = index; + + gettimeofday(&packet->arrive_tv, NULL); +} + +struct audio_packet * +rdpsnd_queue_current_packet(void) +{ + return &packet_queue[queue_lo]; +} + +RD_BOOL +rdpsnd_queue_empty(void) +{ + return (queue_lo == queue_hi); +} + +static void +rdpsnd_queue_init(void) +{ + queue_pending = queue_lo = queue_hi = 0; +} + +void +rdpsnd_queue_next(unsigned long completed_in_us) +{ + struct audio_packet *packet; + + assert(!rdpsnd_queue_empty()); + + packet = &packet_queue[queue_lo]; + + gettimeofday(&packet->completion_tv, NULL); + + packet->completion_tv.tv_usec += completed_in_us; + packet->completion_tv.tv_sec += packet->completion_tv.tv_usec / 1000000; + packet->completion_tv.tv_usec %= 1000000; + + queue_lo = (queue_lo + 1) % MAX_QUEUE; + + rdpsnd_queue_complete_pending(); +} + +int +rdpsnd_queue_next_tick(void) +{ + if (((queue_lo + 1) % MAX_QUEUE) != queue_hi) + { + return packet_queue[(queue_lo + 1) % MAX_QUEUE].tick; + } + else + { + return (packet_queue[queue_lo].tick + 65535) % 65536; + } +} + +static void +rdpsnd_queue_complete_pending(void) +{ + struct timeval now; + long elapsed; + struct audio_packet *packet; + + gettimeofday(&now, NULL); + + while (queue_pending != queue_lo) + { + packet = &packet_queue[queue_pending]; + + if (now.tv_sec < packet->completion_tv.tv_sec) + break; + + if ((now.tv_sec == packet->completion_tv.tv_sec) && + (now.tv_usec < packet->completion_tv.tv_usec)) + break; + + elapsed = (packet->completion_tv.tv_sec - packet->arrive_tv.tv_sec) * 1000000 + + (packet->completion_tv.tv_usec - packet->arrive_tv.tv_usec); + elapsed /= 1000; + + xfree(packet->s.data); + rdpsnd_send_completion((packet->tick + elapsed) % 65536, packet->index); + queue_pending = (queue_pending + 1) % MAX_QUEUE; + } +} + +static long +rdpsnd_queue_next_completion(void) +{ + struct audio_packet *packet; + long remaining; + struct timeval now; + + if (queue_pending == queue_lo) + return -1; + + gettimeofday(&now, NULL); + + packet = &packet_queue[queue_pending]; + + remaining = (packet->completion_tv.tv_sec - now.tv_sec) * 1000000 + + (packet->completion_tv.tv_usec - now.tv_usec); + + if (remaining < 0) + return 0; + + return remaining; } --- rdesktop-1.5.0.orig/rdpsnd.h +++ rdesktop-1.5.0/rdpsnd.h @@ -0,0 +1,60 @@ +/* + rdesktop: A Remote Desktop Protocol client. + Sound infrastructure + Copyright (C) Michael Gernoth 2006-2007 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 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., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +struct audio_packet +{ + struct stream s; + uint16 tick; + uint8 index; + + struct timeval arrive_tv; + struct timeval completion_tv; +}; + +struct audio_driver +{ + void (*add_fds) (int *n, fd_set * rfds, fd_set * wfds, struct timeval * tv); + void (*check_fds) (fd_set * rfds, fd_set * wfds); + + RD_BOOL(*wave_out_open) (void); + void (*wave_out_close) (void); + RD_BOOL(*wave_out_format_supported) (RD_WAVEFORMATEX * pwfx); + RD_BOOL(*wave_out_set_format) (RD_WAVEFORMATEX * pwfx); + void (*wave_out_volume) (uint16 left, uint16 right); + + RD_BOOL(*wave_in_open) (void); + void (*wave_in_close) (void); + RD_BOOL(*wave_in_format_supported) (RD_WAVEFORMATEX * pwfx); + RD_BOOL(*wave_in_set_format) (RD_WAVEFORMATEX * pwfx); + void (*wave_in_volume) (uint16 left, uint16 right); + + char *name; + char *description; + int need_byteswap_on_be; + int need_resampling; + struct audio_driver *next; +}; + +/* Driver register functions */ +struct audio_driver *alsa_register(char *options); +struct audio_driver *libao_register(char *options); +struct audio_driver *oss_register(char *options); +struct audio_driver *sgi_register(char *options); +struct audio_driver *sun_register(char *options); --- rdesktop-1.5.0.orig/rdpsnd_alsa.c +++ rdesktop-1.5.0/rdpsnd_alsa.c @@ -0,0 +1,509 @@ +/* -*- c-basic-offset: 8 -*- + rdesktop: A Remote Desktop Protocol client. + Sound Channel Process Functions - alsa-driver + Copyright (C) Matthew Chapman 2003-2007 + Copyright (C) GuoJunBo guojunbo@ict.ac.cn 2003 + Copyright (C) Michael Gernoth mike@zerfleddert.de 2006-2007 + Copyright 2006-2007 Pierre Ossman <ossman@cendio.se> for Cendio AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 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., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "rdesktop.h" +#include "rdpsnd.h" +#include "rdpsnd_dsp.h" +#include <unistd.h> +#include <fcntl.h> +#include <errno.h> +#include <alsa/asoundlib.h> +#include <sys/time.h> + +#define DEFAULTDEVICE "default" +#define MAX_FRAMES 32 + +static struct pollfd pfds_out[32]; +static int num_fds_out; + +static struct pollfd pfds_in[32]; +static int num_fds_in; + +static snd_pcm_t *out_handle = NULL; +static snd_pcm_t *in_handle = NULL; + +static RD_BOOL reopened; + +static short samplewidth_out; +static int audiochannels_out; +static unsigned int rate_out; + +static short samplewidth_in; +static int audiochannels_in; +static unsigned int rate_in; + +static char *pcm_name; + +void alsa_play(void); +void alsa_record(void); + +void +alsa_add_fds(int *n, fd_set * rfds, fd_set * wfds, struct timeval *tv) +{ + int err; + struct pollfd *f; + + if (out_handle && !rdpsnd_queue_empty()) + { + num_fds_out = snd_pcm_poll_descriptors_count(out_handle); + + if (num_fds_out > sizeof(pfds_out) / sizeof(*pfds_out)) + return; + + err = snd_pcm_poll_descriptors(out_handle, pfds_out, num_fds_out); + if (err < 0) + return; + + for (f = pfds_out; f < &pfds_out[num_fds_out]; f++) + { + if (f->events & POLLIN) + FD_SET(f->fd, rfds); + if (f->events & POLLOUT) + FD_SET(f->fd, wfds); + if (f->fd > *n && (f->events & (POLLIN | POLLOUT))) + *n = f->fd; + } + } + + if (in_handle) + { + num_fds_in = snd_pcm_poll_descriptors_count(in_handle); + + if (num_fds_in > sizeof(pfds_in) / sizeof(*pfds_in)) + return; + + err = snd_pcm_poll_descriptors(in_handle, pfds_in, num_fds_in); + if (err < 0) + return; + + for (f = pfds_in; f < &pfds_in[num_fds_in]; f++) + { + if (f->events & POLLIN) + FD_SET(f->fd, rfds); + if (f->events & POLLOUT) + FD_SET(f->fd, wfds); + if (f->fd > *n && (f->events & (POLLIN | POLLOUT))) + *n = f->fd; + } + } +} + +void +alsa_check_fds(fd_set * rfds, fd_set * wfds) +{ + struct pollfd *f; + int err; + unsigned short revents; + + if (out_handle && !rdpsnd_queue_empty()) + { + for (f = pfds_out; f < &pfds_out[num_fds_out]; f++) + { + f->revents = 0; + if (f->fd != -1) + { + /* Fixme: This doesn't properly deal with things like POLLHUP */ + if (FD_ISSET(f->fd, rfds)) + f->revents |= POLLIN; + if (FD_ISSET(f->fd, wfds)) + f->revents |= POLLOUT; + } + } + + err = snd_pcm_poll_descriptors_revents(out_handle, pfds_out, num_fds_out, &revents); + if (err < 0) + return; + + if (revents & POLLOUT) + alsa_play(); + } + + + if (in_handle) + { + for (f = pfds_in; f < &pfds_in[num_fds_in]; f++) + { + f->revents = 0; + if (f->fd != -1) + { + /* Fixme: This doesn't properly deal with things like POLLHUP */ + if (FD_ISSET(f->fd, rfds)) + f->revents |= POLLIN; + if (FD_ISSET(f->fd, wfds)) + f->revents |= POLLOUT; + } + } + + err = snd_pcm_poll_descriptors_revents(in_handle, pfds_in, num_fds_in, &revents); + if (err < 0) + return; + + if (revents & POLLIN) + alsa_record(); + } +} + +static RD_BOOL +alsa_set_format(snd_pcm_t * pcm, RD_WAVEFORMATEX * pwfx) +{ + snd_pcm_hw_params_t *hwparams = NULL; + int err; + unsigned int buffertime; + short samplewidth; + int audiochannels; + unsigned int rate; + + samplewidth = pwfx->wBitsPerSample / 8; + + if ((err = snd_pcm_hw_params_malloc(&hwparams)) < 0) + { + error("snd_pcm_hw_params_malloc: %s\n", snd_strerror(err)); + return False; + } + + if ((err = snd_pcm_hw_params_any(pcm, hwparams)) < 0) + { + error("snd_pcm_hw_params_any: %s\n", snd_strerror(err)); + return False; + } + + if ((err = snd_pcm_hw_params_set_access(pcm, hwparams, SND_PCM_ACCESS_RW_INTERLEAVED)) < 0) + { + error("snd_pcm_hw_params_set_access: %s\n", snd_strerror(err)); + return False; + } + + if (pwfx->wBitsPerSample == 16) + { + if ((err = snd_pcm_hw_params_set_format(pcm, hwparams, SND_PCM_FORMAT_S16_LE)) < 0) + { + error("snd_pcm_hw_params_set_format: %s\n", snd_strerror(err)); + return False; + } + } + else + { + if ((err = snd_pcm_hw_params_set_format(pcm, hwparams, SND_PCM_FORMAT_S8)) < 0) + { + error("snd_pcm_hw_params_set_format: %s\n", snd_strerror(err)); + return False; + } + } + +#if 0 + if ((err = snd_pcm_hw_params_set_rate_resample(pcm, hwparams, 1)) < 0) + { + error("snd_pcm_hw_params_set_rate_resample: %s\n", snd_strerror(err)); + return False; + } +#endif + + rate = pwfx->nSamplesPerSec; + if ((err = snd_pcm_hw_params_set_rate_near(pcm, hwparams, &rate, 0)) < 0) + { + error("snd_pcm_hw_params_set_rate_near: %s\n", snd_strerror(err)); + return False; + } + + audiochannels = pwfx->nChannels; + if ((err = snd_pcm_hw_params_set_channels(pcm, hwparams, pwfx->nChannels)) < 0) + { + error("snd_pcm_hw_params_set_channels: %s\n", snd_strerror(err)); + return False; + } + + + buffertime = 500000; /* microseconds */ + if ((err = snd_pcm_hw_params_set_buffer_time_near(pcm, hwparams, &buffertime, 0)) < 0) + { + error("snd_pcm_hw_params_set_buffer_time_near: %s\n", snd_strerror(err)); + return False; + } + + if ((err = snd_pcm_hw_params(pcm, hwparams)) < 0) + { + error("snd_pcm_hw_params: %s\n", snd_strerror(err)); + return False; + } + + snd_pcm_hw_params_free(hwparams); + + if ((err = snd_pcm_prepare(pcm)) < 0) + { + error("snd_pcm_prepare: %s\n", snd_strerror(err)); + return False; + } + + reopened = True; + + return True; +} + +RD_BOOL +alsa_open_out(void) +{ + int err; + + if ((err = snd_pcm_open(&out_handle, pcm_name, SND_PCM_STREAM_PLAYBACK, 0)) < 0) + { + error("snd_pcm_open: %s\n", snd_strerror(err)); + return False; + } + + reopened = True; + + return True; +} + +void +alsa_close_out(void) +{ + /* Ack all remaining packets */ + while (!rdpsnd_queue_empty()) + rdpsnd_queue_next(0); + + if (out_handle) + { + snd_pcm_close(out_handle); + out_handle = NULL; + } +} + +RD_BOOL +alsa_format_supported(RD_WAVEFORMATEX * pwfx) +{ +#if 0 + int err; + snd_pcm_hw_params_t *hwparams = NULL; + + if ((err = snd_pcm_hw_params_malloc(&hwparams)) < 0) + { + error("snd_pcm_hw_params_malloc: %s\n", snd_strerror(err)); + return False; + } + + if ((err = snd_pcm_hw_params_any(pcm_handle, hwparams)) < 0) + { + error("snd_pcm_hw_params_malloc: %s\n", snd_strerror(err)); + return False; + } + snd_pcm_hw_params_free(hwparams); +#endif + + if (pwfx->wFormatTag != WAVE_FORMAT_PCM) + return False; + if ((pwfx->nChannels != 1) && (pwfx->nChannels != 2)) + return False; + if ((pwfx->wBitsPerSample != 8) && (pwfx->wBitsPerSample != 16)) + return False; + if ((pwfx->nSamplesPerSec != 44100) && (pwfx->nSamplesPerSec != 22050)) + return False; + + return True; +} + +RD_BOOL +alsa_set_format_out(RD_WAVEFORMATEX * pwfx) +{ + if (!alsa_set_format(out_handle, pwfx)) + return False; + + samplewidth_out = pwfx->wBitsPerSample / 8; + audiochannels_out = pwfx->nChannels; + rate_out = pwfx->nSamplesPerSec; + + return True; +} + +void +alsa_play(void) +{ + struct audio_packet *packet; + STREAM out; + int len; + static long prev_s, prev_us; + unsigned int duration; + struct timeval tv; + int next_tick; + + if (reopened) + { + reopened = False; + gettimeofday(&tv, NULL); + prev_s = tv.tv_sec; + prev_us = tv.tv_usec; + } + + /* We shouldn't be called if the queue is empty, but still */ + if (rdpsnd_queue_empty()) + return; + + packet = rdpsnd_queue_current_packet(); + out = &packet->s; + + next_tick = rdpsnd_queue_next_tick(); + + len = (out->end - out->p) / (samplewidth_out * audiochannels_out); + if ((len = snd_pcm_writei(out_handle, out->p, ((MAX_FRAMES < len) ? MAX_FRAMES : len))) < 0) + { + printf("Fooo!\n"); + snd_pcm_prepare(out_handle); + len = 0; + } + out->p += (len * samplewidth_out * audiochannels_out); + + gettimeofday(&tv, NULL); + + duration = ((tv.tv_sec - prev_s) * 1000000 + (tv.tv_usec - prev_us)) / 1000; + + if (packet->tick > next_tick) + next_tick += 65536; + + if ((out->p == out->end) || duration > next_tick - packet->tick + 500) + { + snd_pcm_sframes_t delay_frames; + unsigned long delay_us; + + prev_s = tv.tv_sec; + prev_us = tv.tv_usec; + + if (abs((next_tick - packet->tick) - duration) > 20) + { + DEBUG(("duration: %d, calc: %d, ", duration, next_tick - packet->tick)); + DEBUG(("last: %d, is: %d, should: %d\n", packet->tick, + (packet->tick + duration) % 65536, next_tick % 65536)); + } + + if (snd_pcm_delay(out_handle, &delay_frames) < 0) + delay_frames = out->size / (samplewidth_out * audiochannels_out); + if (delay_frames < 0) + delay_frames = 0; + + delay_us = delay_frames * (1000000 / rate_out); + + rdpsnd_queue_next(delay_us); + } +} + +RD_BOOL +alsa_open_in(void) +{ + int err; + + if ((err = + snd_pcm_open(&in_handle, pcm_name, SND_PCM_STREAM_CAPTURE, SND_PCM_NONBLOCK)) < 0) + { + error("snd_pcm_open: %s\n", snd_strerror(err)); + return False; + } + + return True; +} + +void +alsa_close_in(void) +{ + if (in_handle) + { + snd_pcm_close(in_handle); + in_handle = NULL; + } +} + +RD_BOOL +alsa_set_format_in(RD_WAVEFORMATEX * pwfx) +{ + int err; + + if (!alsa_set_format(in_handle, pwfx)) + return False; + + if ((err = snd_pcm_start(in_handle)) < 0) + { + error("snd_pcm_start: %s\n", snd_strerror(err)); + return False; + } + + samplewidth_in = pwfx->wBitsPerSample / 8; + audiochannels_in = pwfx->nChannels; + rate_in = pwfx->nSamplesPerSec; + + return True; +} + +void +alsa_record(void) +{ + int len; + char buffer[32768]; + + len = snd_pcm_readi(in_handle, buffer, + sizeof(buffer) / (samplewidth_in * audiochannels_in)); + if (len < 0) + { + snd_pcm_prepare(in_handle); + len = 0; + } + + rdpsnd_record(buffer, len * samplewidth_in * audiochannels_in); +} + +struct audio_driver * +alsa_register(char *options) +{ + static struct audio_driver alsa_driver; + + memset(&alsa_driver, 0, sizeof(alsa_driver)); + + alsa_driver.name = "alsa"; + alsa_driver.description = "ALSA output driver, default device: " DEFAULTDEVICE; + + alsa_driver.add_fds = alsa_add_fds; + alsa_driver.check_fds = alsa_check_fds; + + alsa_driver.wave_out_open = alsa_open_out; + alsa_driver.wave_out_close = alsa_close_out; + alsa_driver.wave_out_format_supported = alsa_format_supported; + alsa_driver.wave_out_set_format = alsa_set_format_out; + alsa_driver.wave_out_volume = rdpsnd_dsp_softvol_set; + + alsa_driver.wave_in_open = alsa_open_in; + alsa_driver.wave_in_close = alsa_close_in; + alsa_driver.wave_in_format_supported = alsa_format_supported; + alsa_driver.wave_in_set_format = alsa_set_format_in; + alsa_driver.wave_in_volume = NULL; /* FIXME */ + + alsa_driver.need_byteswap_on_be = 0; + alsa_driver.need_resampling = 0; + + if (options) + { + pcm_name = xstrdup(options); + } + else + { + pcm_name = DEFAULTDEVICE; + } + + return &alsa_driver; +} --- rdesktop-1.5.0.orig/rdpsnd_dsp.c +++ rdesktop-1.5.0/rdpsnd_dsp.c @@ -0,0 +1,422 @@ +/* + rdesktop: A Remote Desktop Protocol client. + Sound DSP routines + Copyright (C) Michael Gernoth 2006-2007 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 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., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include <strings.h> + +#include "rdesktop.h" +#include "rdpsnd.h" +#include "rdpsnd_dsp.h" + +#ifdef HAVE_LIBSAMPLERATE +#include <samplerate.h> + +#define SRC_CONVERTER SRC_SINC_MEDIUM_QUALITY +#endif + +#define MAX_VOLUME 65535 + +static uint16 softvol_left = MAX_VOLUME; +static uint16 softvol_right = MAX_VOLUME; +static uint32 resample_to_srate = 44100; +static uint16 resample_to_bitspersample = 16; +static uint16 resample_to_channels = 2; +#ifdef HAVE_LIBSAMPLERATE +static SRC_STATE *src_converter = NULL; +#endif + +void +rdpsnd_dsp_softvol_set(uint16 left, uint16 right) +{ + softvol_left = left; + softvol_right = right; + DEBUG(("rdpsnd_dsp_softvol_set: left: %u, right: %u\n", left, right)); +} + +void +rdpsnd_dsp_softvol(unsigned char *buffer, unsigned int size, RD_WAVEFORMATEX * format) +{ + unsigned int factor_left, factor_right; + unsigned char *posin = buffer; + unsigned char *posout = buffer; + + if ((softvol_left == MAX_VOLUME) && (softvol_right == MAX_VOLUME)) + return; + + factor_left = (softvol_left * 256) / MAX_VOLUME; + factor_right = (softvol_right * 256) / MAX_VOLUME; + + if (format->nChannels == 1) + { + factor_left = factor_right = (factor_left + factor_right) / 2; + } + + if (format->wBitsPerSample == 8) + { + sint8 val; + + while (posout < buffer + size) + { + /* Left */ + val = *posin++; + val = (val * factor_left) >> 8; + *posout++ = val; + + /* Right */ + val = *posin++; + val = (val * factor_right) >> 8; + *posout++ = val; + } + } + else + { + sint16 val; + + while (posout < buffer + size) + { + /* Left */ + val = *posin++; + val |= *posin++ << 8; + val = (val * factor_left) >> 8; + *posout++ = val & 0xff; + *posout++ = val >> 8; + + /* Right */ + val = *posin++; + val |= *posin++ << 8; + val = (val * factor_right) >> 8; + *posout++ = val & 0xff; + *posout++ = val >> 8; + } + } + + DEBUG(("using softvol with factors left: %d, right: %d (%d/%d)\n", factor_left, + factor_right, format->wBitsPerSample, format->nChannels)); +} + +void +rdpsnd_dsp_swapbytes(unsigned char *buffer, unsigned int size, RD_WAVEFORMATEX * format) +{ + int i; + uint8 swap; + + if (format->wBitsPerSample == 8) + return; + + for (i = 0; i < (int) size; i += 2) + { + swap = *(buffer + i); + *(buffer + i) = *(buffer + i + 1); + *(buffer + i + 1) = swap; + } +} + +RD_BOOL +rdpsnd_dsp_resample_set(uint32 device_srate, uint16 device_bitspersample, uint16 device_channels) +{ +#ifdef HAVE_LIBSAMPLERATE + int err; +#endif + + if (device_bitspersample != 16 && device_bitspersample != 8) + return False; + + if (device_channels != 1 && device_channels != 2) + return False; + + resample_to_srate = device_srate; + resample_to_bitspersample = device_bitspersample; + resample_to_channels = device_channels; + +#ifdef HAVE_LIBSAMPLERATE + if (src_converter != NULL) + src_converter = src_delete(src_converter); + + if ((src_converter = src_new(SRC_CONVERTER, device_channels, &err)) == NULL) + { + warning("src_new failed: %d!\n", err); + return False; + } +#endif + + return True; +} + +RD_BOOL +rdpsnd_dsp_resample_supported(RD_WAVEFORMATEX * format) +{ + if (format->wFormatTag != WAVE_FORMAT_PCM) + return False; + if ((format->nChannels != 1) && (format->nChannels != 2)) + return False; + if ((format->wBitsPerSample != 8) && (format->wBitsPerSample != 16)) + return False; + + return True; +} + +uint32 +rdpsnd_dsp_resample(unsigned char **out, unsigned char *in, unsigned int size, + RD_WAVEFORMATEX * format, RD_BOOL stream_be) +{ +#ifdef HAVE_LIBSAMPLERATE + SRC_DATA resample_data; + float *infloat, *outfloat; + int err; +#else + int ratio1k = (resample_to_srate * 1000) / format->nSamplesPerSec; +#endif + int innum, outnum; + unsigned char *tmpdata = NULL, *tmp = NULL; + int samplewidth = format->wBitsPerSample / 8; + int outsize = 0; + int i; + + if ((resample_to_bitspersample == format->wBitsPerSample) && + (resample_to_channels == format->nChannels) && + (resample_to_srate == format->nSamplesPerSec)) + return 0; + +#ifdef B_ENDIAN + if (!stream_be) + rdpsnd_dsp_swapbytes(in, size, format); +#endif + + if (resample_to_channels != format->nChannels) + { + int newsize = (size / format->nChannels) * resample_to_channels; + tmpdata = (unsigned char *) xmalloc(newsize); + + for (i = 0; i < newsize / samplewidth; i++) + { + if (format->nChannels > resample_to_channels) + memcpy(tmpdata + (i * samplewidth), + in + + (((i * format->nChannels) / resample_to_channels) * + samplewidth), samplewidth); + else + memcpy(tmpdata + (i * samplewidth), + in + + (((i / resample_to_channels) * format->nChannels + + (i % format->nChannels)) * samplewidth), samplewidth); + + } + + in = tmpdata; + size = newsize; + } + + + /* Expand 8bit input-samples to 16bit */ +#ifndef HAVE_LIBSAMPLERATE /* libsamplerate needs 16bit samples */ + if (format->wBitsPerSample != resample_to_bitspersample) +#endif + { + /* source: 8 bit, dest: 16bit */ + if (format->wBitsPerSample == 8) + { + tmp = tmpdata; + tmpdata = (unsigned char *) xmalloc(size * 2); + for (i = 0; i < (int) size; i++) + { + tmpdata[i * 2] = in[i]; + tmpdata[(i * 2) + 1] = 0x00; + } + in = tmpdata; + samplewidth = 16 / 2; + size *= 2; + + if (tmp != NULL) + xfree(tmp); + } + } + + innum = size / samplewidth; + + /* Do the resampling */ +#ifdef HAVE_LIBSAMPLERATE + if (src_converter == NULL) + { + warning("no samplerate converter available!!\n"); + return 0; + } + + outnum = ((float) innum * ((float) resample_to_srate / (float) format->nSamplesPerSec)) + 1; + + infloat = (float *) xmalloc(sizeof(float) * innum); + outfloat = (float *) xmalloc(sizeof(float) * outnum); + + src_short_to_float_array((short *) in, infloat, innum); + + bzero(&resample_data, sizeof(resample_data)); + resample_data.data_in = infloat; + resample_data.data_out = outfloat; + resample_data.input_frames = innum / resample_to_channels; + resample_data.output_frames = outnum / resample_to_channels; + resample_data.src_ratio = (double) resample_to_srate / (double) format->nSamplesPerSec; + resample_data.end_of_input = 0; + + if ((err = src_process(src_converter, &resample_data)) != 0) + error("src_process: %s", src_strerror(err)); + + xfree(infloat); + + outsize = resample_data.output_frames_gen * resample_to_channels * samplewidth; + *out = (unsigned char *) xmalloc(outsize); + src_float_to_short_array(outfloat, (short *) *out, + resample_data.output_frames_gen * resample_to_channels); + xfree(outfloat); + +#else + /* Michaels simple linear resampler */ + if (resample_to_srate < format->nSamplesPerSec) + { + warning("downsampling currently not supported!\n"); + return 0; + } + + outnum = (innum * ratio1k) / 1000; + + outsize = outnum * samplewidth; + *out = (unsigned char *) xmalloc(outsize); + bzero(*out, outsize); + + for (i = 0; i < outsize / (resample_to_channels * samplewidth); i++) + { + int source = (i * 1000) / ratio1k; +#if 0 /* Partial for linear resampler */ + int part = (i * 100000) / ratio1k - source * 100; +#endif + int j; + + if (source * resample_to_channels + samplewidth > (int) size) + break; + +#if 0 /* Linear resampling, TODO: soundquality fixes (LP filter) */ + if (samplewidth == 1) + { + sint8 cval1, cval2; + for (j = 0; j < resample_to_channels; j++) + { + memcpy(&cval1, + in + (source * resample_to_channels * samplewidth) + + (samplewidth * j), samplewidth); + memcpy(&cval2, + in + ((source + 1) * resample_to_channels * samplewidth) + + (samplewidth * j), samplewidth); + + cval1 += (sint8) (cval2 * part) / 100; + + memcpy(*out + (i * resample_to_channels * samplewidth) + + (samplewidth * j), &cval1, samplewidth); + } + } + else + { + sint16 sval1, sval2; + for (j = 0; j < resample_to_channels; j++) + { + memcpy(&sval1, + in + (source * resample_to_channels * samplewidth) + + (samplewidth * j), samplewidth); + memcpy(&sval2, + in + ((source + 1) * resample_to_channels * samplewidth) + + (samplewidth * j), samplewidth); + + sval1 += (sint16) (sval2 * part) / 100; + + memcpy(*out + (i * resample_to_channels * samplewidth) + + (samplewidth * j), &sval1, samplewidth); + } + } +#else /* Nearest neighbor search */ + for (j = 0; j < resample_to_channels; j++) + { + memcpy(*out + (i * resample_to_channels * samplewidth) + (samplewidth * j), + in + (source * resample_to_channels * samplewidth) + + (samplewidth * j), samplewidth); + } +#endif + } + outsize = i * resample_to_channels * samplewidth; +#endif + + if (tmpdata != NULL) + xfree(tmpdata); + + /* Shrink 16bit output-samples to 8bit */ +#ifndef HAVE_LIBSAMPLERATE /* libsamplerate produces 16bit samples */ + if (format->wBitsPerSample != resample_to_bitspersample) +#endif + { + /* source: 16 bit, dest: 8 bit */ + if (resample_to_bitspersample == 8) + { + for (i = 0; i < outsize; i++) + { + *out[i] = *out[i * 2]; + } + outsize /= 2; + } + } + +#ifdef B_ENDIAN + if (!stream_be) + rdpsnd_dsp_swapbytes(*out, outsize, format); +#endif + return outsize; +} + +STREAM +rdpsnd_dsp_process(unsigned char *data, unsigned int size, struct audio_driver * current_driver, + RD_WAVEFORMATEX * format) +{ + static struct stream out; + RD_BOOL stream_be = False; + + /* softvol and byteswap do not change the amount of data they + return, so they can operate on the input-stream */ + if (current_driver->wave_out_volume == rdpsnd_dsp_softvol_set) + rdpsnd_dsp_softvol(data, size, format); + +#ifdef B_ENDIAN + if (current_driver->need_byteswap_on_be) + { + rdpsnd_dsp_swapbytes(data, size, format); + stream_be = True; + } +#endif + + out.data = NULL; + + if (current_driver->need_resampling) + out.size = rdpsnd_dsp_resample(&out.data, data, size, format, stream_be); + + if (out.data == NULL) + { + out.data = (unsigned char *) xmalloc(size); + memcpy(out.data, data, size); + out.size = size; + } + + out.p = out.data; + out.end = out.p + out.size; + + return &out; +} --- rdesktop-1.5.0.orig/rdpsnd_dsp.h +++ rdesktop-1.5.0/rdpsnd_dsp.h @@ -0,0 +1,30 @@ +/* + rdesktop: A Remote Desktop Protocol client. + Sound DSP routines + Copyright (C) Michael Gernoth 2006-2007 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 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., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +/* Software volume control */ +void rdpsnd_dsp_softvol_set(uint16 left, uint16 right); + +/* Resample control */ +RD_BOOL rdpsnd_dsp_resample_set(uint32 device_srate, uint16 device_bitspersample, + uint16 device_channels); +RD_BOOL rdpsnd_dsp_resample_supported(RD_WAVEFORMATEX * pwfx); + +STREAM rdpsnd_dsp_process(unsigned char *data, unsigned int size, + struct audio_driver *current_driver, RD_WAVEFORMATEX * format); --- rdesktop-1.5.0.orig/rdpsnd_libao.c +++ rdesktop-1.5.0/rdpsnd_libao.c @@ -1,9 +1,9 @@ /* -*- c-basic-offset: 8 -*- rdesktop: A Remote Desktop Protocol client. Sound Channel Process Functions - libao-driver - Copyright (C) Matthew Chapman 2003 + Copyright (C) Matthew Chapman 2003-2007 Copyright (C) GuoJunBo guojunbo@ict.ac.cn 2003 - Copyright (C) Michael Gernoth mike@zerfleddert.de 2005 + Copyright (C) Michael Gernoth mike@zerfleddert.de 2005-2007 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,46 +21,61 @@ */ #include "rdesktop.h" +#include "rdpsnd.h" +#include "rdpsnd_dsp.h" #include <unistd.h> #include <fcntl.h> #include <errno.h> #include <ao/ao.h> #include <sys/time.h> -#define MAX_QUEUE 10 -#define WAVEOUTBUF 16 +#define WAVEOUTLEN 16 -int g_dsp_fd; -BOOL g_dsp_busy = False; static ao_device *o_device = NULL; static int default_driver; -static int samplerate; -static int audiochannels; -static BOOL reopened; -static short samplewidth; +static RD_BOOL reopened; +static char *libao_device = NULL; -static struct audio_packet +void libao_play(void); + +void +libao_add_fds(int *n, fd_set * rfds, fd_set * wfds, struct timeval *tv) +{ + /* We need to be called rather often... */ + FD_SET(0, wfds); +} + +void +libao_check_fds(fd_set * rfds, fd_set * wfds) { - struct stream s; - uint16 tick; - uint8 index; -} packet_queue[MAX_QUEUE]; -static unsigned int queue_hi, queue_lo; + if (o_device == NULL) + return; + + if (!rdpsnd_queue_empty()) + libao_play(); +} -BOOL -wave_out_open(void) +RD_BOOL +libao_open(void) { ao_sample_format format; ao_initialize(); - default_driver = ao_default_driver_id(); + + if (libao_device) + { + default_driver = ao_driver_id(libao_device); + } + else + { + default_driver = ao_default_driver_id(); + } format.bits = 16; format.channels = 2; - audiochannels = 2; format.rate = 44100; - samplerate = 44100; - format.byte_format = AO_FMT_LITTLE; + format.byte_format = AO_FMT_NATIVE; + o_device = ao_open_live(default_driver, &format, NULL); if (o_device == NULL) @@ -68,61 +83,37 @@ return False; } - g_dsp_fd = 0; - queue_lo = queue_hi = 0; - reopened = True; return True; } void -wave_out_close(void) +libao_close(void) { /* Ack all remaining packets */ - while (queue_lo != queue_hi) + while (!rdpsnd_queue_empty()) { - rdpsnd_send_completion(packet_queue[queue_lo].tick, packet_queue[queue_lo].index); - free(packet_queue[queue_lo].s.data); - queue_lo = (queue_lo + 1) % MAX_QUEUE; + rdpsnd_queue_next(0); } if (o_device != NULL) ao_close(o_device); - ao_shutdown(); -} + o_device = NULL; -BOOL -wave_out_format_supported(WAVEFORMATEX * pwfx) -{ - if (pwfx->wFormatTag != WAVE_FORMAT_PCM) - return False; - if ((pwfx->nChannels != 1) && (pwfx->nChannels != 2)) - return False; - if ((pwfx->wBitsPerSample != 8) && (pwfx->wBitsPerSample != 16)) - return False; - /* The only common denominator between libao output drivers is a sample-rate of - 44100, we need to upsample 22050 to it */ - if ((pwfx->nSamplesPerSec != 44100) && (pwfx->nSamplesPerSec != 22050)) - return False; - - return True; + ao_shutdown(); } -BOOL -wave_out_set_format(WAVEFORMATEX * pwfx) +RD_BOOL +libao_set_format(RD_WAVEFORMATEX * pwfx) { ao_sample_format format; format.bits = pwfx->wBitsPerSample; format.channels = pwfx->nChannels; - audiochannels = pwfx->nChannels; format.rate = 44100; - samplerate = pwfx->nSamplesPerSec; - format.byte_format = AO_FMT_LITTLE; - - samplewidth = pwfx->wBitsPerSample / 8; + format.byte_format = AO_FMT_NATIVE; if (o_device != NULL) ao_close(o_device); @@ -133,50 +124,22 @@ return False; } - reopened = True; - - return True; -} - -void -wave_out_volume(uint16 left, uint16 right) -{ - warning("volume changes not supported with libao-output\n"); -} - -void -wave_out_write(STREAM s, uint16 tick, uint8 index) -{ - struct audio_packet *packet = &packet_queue[queue_hi]; - unsigned int next_hi = (queue_hi + 1) % MAX_QUEUE; - - if (next_hi == queue_lo) + if (rdpsnd_dsp_resample_set(44100, pwfx->wBitsPerSample, pwfx->nChannels) == False) { - error("No space to queue audio packet\n"); - return; + return False; } - queue_hi = next_hi; - - packet->s = *s; - packet->tick = tick; - packet->index = index; - packet->s.p += 4; - - /* we steal the data buffer from s, give it a new one */ - s->data = malloc(s->size); + reopened = True; - if (!g_dsp_busy) - wave_out_play(); + return True; } void -wave_out_play(void) +libao_play(void) { struct audio_packet *packet; STREAM out; - char outbuf[WAVEOUTBUF]; - int offset, len, i; + int len; static long prev_s, prev_us; unsigned int duration; struct timeval tv; @@ -190,57 +153,18 @@ prev_us = tv.tv_usec; } - if (queue_lo == queue_hi) - { - g_dsp_busy = 0; + /* We shouldn't be called if the queue is empty, but still */ + if (rdpsnd_queue_empty()) return; - } - packet = &packet_queue[queue_lo]; + packet = rdpsnd_queue_current_packet(); out = &packet->s; - if (((queue_lo + 1) % MAX_QUEUE) != queue_hi) - { - next_tick = packet_queue[(queue_lo + 1) % MAX_QUEUE].tick; - } - else - { - next_tick = (packet->tick + 65535) % 65536; - } + next_tick = rdpsnd_queue_next_tick(); - len = 0; - - if (samplerate == 22050) - { - /* Resample to 44100 */ - for (i = 0; (i < ((WAVEOUTBUF / 4) * (3 - samplewidth))) && (out->p < out->end); - i++) - { - /* On a stereo-channel we must make sure that left and right - does not get mixed up, so we need to expand the sample- - data with channels in mind: 1234 -> 12123434 - If we have a mono-channel, we can expand the data by simply - doubling the sample-data: 1234 -> 11223344 */ - if (audiochannels == 2) - offset = ((i * 2) - (i & 1)) * samplewidth; - else - offset = (i * 2) * samplewidth; - - memcpy(&outbuf[offset], out->p, samplewidth); - memcpy(&outbuf[audiochannels * samplewidth + offset], out->p, samplewidth); - - out->p += samplewidth; - len += 2 * samplewidth; - } - } - else - { - len = (WAVEOUTBUF > (out->end - out->p)) ? (out->end - out->p) : WAVEOUTBUF; - memcpy(outbuf, out->p, len); - out->p += len; - } - - ao_play(o_device, outbuf, len); + len = (WAVEOUTLEN > (out->end - out->p)) ? (out->end - out->p) : WAVEOUTLEN; + ao_play(o_device, (char *) out->p, len); + out->p += len; gettimeofday(&tv, NULL); @@ -251,6 +175,8 @@ if ((out->p == out->end) || duration > next_tick - packet->tick + 500) { + unsigned int delay_us; + prev_s = tv.tv_sec; prev_us = tv.tv_usec; @@ -261,13 +187,38 @@ (packet->tick + duration) % 65536, next_tick % 65536)); } - /* Until all drivers are using the windows sound-ticks, we need to - substract the 50 ticks added later by rdpsnd.c */ - rdpsnd_send_completion(((packet->tick + duration) % 65536) - 50, packet->index); - free(out->data); - queue_lo = (queue_lo + 1) % MAX_QUEUE; + delay_us = ((out->size / 4) * (1000000 / 44100)); + + rdpsnd_queue_next(delay_us); + } +} + +struct audio_driver * +libao_register(char *options) +{ + static struct audio_driver libao_driver; + + memset(&libao_driver, 0, sizeof(libao_driver)); + + libao_driver.name = "libao"; + libao_driver.description = "libao output driver, default device: system dependent"; + + libao_driver.add_fds = libao_add_fds; + libao_driver.check_fds = libao_check_fds; + + libao_driver.wave_out_open = libao_open; + libao_driver.wave_out_close = libao_close; + libao_driver.wave_out_format_supported = rdpsnd_dsp_resample_supported; + libao_driver.wave_out_set_format = libao_set_format; + libao_driver.wave_out_volume = rdpsnd_dsp_softvol_set; + + libao_driver.need_byteswap_on_be = 1; + libao_driver.need_resampling = 1; + + if (options) + { + libao_device = xstrdup(options); } - g_dsp_busy = 1; - return; + return &libao_driver; } --- rdesktop-1.5.0.orig/rdpsnd_oss.c +++ rdesktop-1.5.0/rdpsnd_oss.c @@ -1,8 +1,9 @@ /* -*- c-basic-offset: 8 -*- rdesktop: A Remote Desktop Protocol client. Sound Channel Process Functions - Open Sound System - Copyright (C) Matthew Chapman 2003 + Copyright (C) Matthew Chapman 2003-2007 Copyright (C) GuoJunBo guojunbo@ict.ac.cn 2003 + Copyright 2006-2007 Pierre Ossman <ossman@cendio.se> for Cendio AB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -28,56 +29,199 @@ #endif #include "rdesktop.h" +#include "rdpsnd.h" +#include "rdpsnd_dsp.h" #include <unistd.h> #include <fcntl.h> #include <errno.h> +#include <unistd.h> #include <sys/time.h> #include <sys/ioctl.h> #include <sys/soundcard.h> +#include <sys/types.h> +#include <sys/stat.h> +#define DEFAULTDEVICE "/dev/dsp" #define MAX_LEN 512 -#define MAX_QUEUE 10 -int g_dsp_fd; -BOOL g_dsp_busy = False; -static int snd_rate; +static int dsp_fd = -1; +static int dsp_mode; +static int dsp_refs; + +static RD_BOOL dsp_configured; +static RD_BOOL dsp_broken; + +static RD_BOOL dsp_out; +static RD_BOOL dsp_in; + +static int stereo; +static int format; +static uint32 snd_rate; static short samplewidth; +static char *dsp_dev; +static RD_BOOL in_esddsp; + +/* This is a just a forward declaration */ +static struct audio_driver oss_driver; + +void oss_play(void); +void oss_record(void); + +void +oss_add_fds(int *n, fd_set * rfds, fd_set * wfds, struct timeval *tv) +{ + if (dsp_fd == -1) + return; -static struct audio_packet + if (dsp_out && !rdpsnd_queue_empty()) + FD_SET(dsp_fd, wfds); + if (dsp_in) + FD_SET(dsp_fd, rfds); + if (dsp_fd > *n) + *n = dsp_fd; +} + +void +oss_check_fds(fd_set * rfds, fd_set * wfds) { - struct stream s; - uint16 tick; - uint8 index; -} packet_queue[MAX_QUEUE]; -static unsigned int queue_hi, queue_lo; + if (FD_ISSET(dsp_fd, wfds)) + oss_play(); + if (FD_ISSET(dsp_fd, rfds)) + oss_record(); +} + +static RD_BOOL +detect_esddsp(void) +{ + struct stat s; + char *preload; + + if (fstat(dsp_fd, &s) == -1) + return False; + + if (S_ISCHR(s.st_mode) || S_ISBLK(s.st_mode)) + return False; + + preload = getenv("LD_PRELOAD"); + if (preload == NULL) + return False; -BOOL -wave_out_open(void) + if (strstr(preload, "esddsp") == NULL) + return False; + + return True; +} + +RD_BOOL +oss_open(int fallback) { - char *dsp_dev = getenv("AUDIODEV"); + int caps; - if (dsp_dev == NULL) + if (dsp_fd != -1) { - dsp_dev = xstrdup("/dev/dsp"); + dsp_refs++; + + if (dsp_mode == O_RDWR) + return True; + + if (dsp_mode == fallback) + return True; + + dsp_refs--; + return False; } - if ((g_dsp_fd = open(dsp_dev, O_WRONLY)) == -1) + dsp_configured = False; + dsp_broken = False; + + dsp_mode = O_RDWR; + dsp_fd = open(dsp_dev, O_RDWR | O_NONBLOCK); + if (dsp_fd != -1) { - perror(dsp_dev); - return False; + ioctl(dsp_fd, SNDCTL_DSP_SETDUPLEX, 0); + + if ((ioctl(dsp_fd, SNDCTL_DSP_GETCAPS, &caps) < 0) || !(caps & DSP_CAP_DUPLEX)) + { + close(dsp_fd); + dsp_fd = -1; + } + } + + if (dsp_fd == -1) + { + dsp_mode = fallback; + + dsp_fd = open(dsp_dev, dsp_mode | O_NONBLOCK); + if (dsp_fd == -1) + { + perror(dsp_dev); + return False; + } } + dsp_refs++; + + in_esddsp = detect_esddsp(); + + return True; +} + +void +oss_close(void) +{ + dsp_refs--; + + if (dsp_refs != 0) + return; + + close(dsp_fd); + dsp_fd = -1; +} + +RD_BOOL +oss_open_out(void) +{ + if (!oss_open(O_WRONLY)) + return False; + + dsp_out = True; + + return True; +} + +void +oss_close_out(void) +{ + oss_close(); + + /* Ack all remaining packets */ + while (!rdpsnd_queue_empty()) + rdpsnd_queue_next(0); + + dsp_out = False; +} + +RD_BOOL +oss_open_in(void) +{ + if (!oss_open(O_RDONLY)) + return False; + + dsp_in = True; + return True; } void -wave_out_close(void) +oss_close_in(void) { - close(g_dsp_fd); + oss_close(); + + dsp_in = False; } -BOOL -wave_out_format_supported(WAVEFORMATEX * pwfx) +RD_BOOL +oss_format_supported(RD_WAVEFORMATEX * pwfx) { if (pwfx->wFormatTag != WAVE_FORMAT_PCM) return False; @@ -89,14 +233,30 @@ return True; } -BOOL -wave_out_set_format(WAVEFORMATEX * pwfx) +RD_BOOL +oss_set_format(RD_WAVEFORMATEX * pwfx) { - int stereo, format, fragments; - static BOOL driver_broken = False; + int fragments; + static RD_BOOL driver_broken = False; + + if (dsp_configured) + { + if ((pwfx->wBitsPerSample == 8) && (format != AFMT_U8)) + return False; + if ((pwfx->wBitsPerSample == 16) && (format != AFMT_S16_LE)) + return False; + + if ((pwfx->nChannels == 2) != !!stereo) + return False; - ioctl(g_dsp_fd, SNDCTL_DSP_RESET, NULL); - ioctl(g_dsp_fd, SNDCTL_DSP_SYNC, NULL); + if (pwfx->nSamplesPerSec != snd_rate) + return False; + + return True; + } + + ioctl(dsp_fd, SNDCTL_DSP_RESET, NULL); + ioctl(dsp_fd, SNDCTL_DSP_SYNC, NULL); if (pwfx->wBitsPerSample == 8) format = AFMT_U8; @@ -105,10 +265,10 @@ samplewidth = pwfx->wBitsPerSample / 8; - if (ioctl(g_dsp_fd, SNDCTL_DSP_SETFMT, &format) == -1) + if (ioctl(dsp_fd, SNDCTL_DSP_SETFMT, &format) == -1) { perror("SNDCTL_DSP_SETFMT"); - close(g_dsp_fd); + oss_close(); return False; } @@ -122,34 +282,61 @@ stereo = 0; } - if (ioctl(g_dsp_fd, SNDCTL_DSP_STEREO, &stereo) == -1) + if (ioctl(dsp_fd, SNDCTL_DSP_STEREO, &stereo) == -1) { perror("SNDCTL_DSP_CHANNELS"); - close(g_dsp_fd); + oss_close(); return False; } + oss_driver.need_resampling = 0; snd_rate = pwfx->nSamplesPerSec; - if (ioctl(g_dsp_fd, SNDCTL_DSP_SPEED, &snd_rate) == -1) + if (ioctl(dsp_fd, SNDCTL_DSP_SPEED, &snd_rate) == -1) { - perror("SNDCTL_DSP_SPEED"); - close(g_dsp_fd); - return False; + uint32 rates[] = { 44100, 48000, 0 }; + uint32 *prates = rates; + + while (*prates != 0) + { + if ((pwfx->nSamplesPerSec != *prates) + && (ioctl(dsp_fd, SNDCTL_DSP_SPEED, prates) != -1)) + { + oss_driver.need_resampling = 1; + snd_rate = *prates; + if (rdpsnd_dsp_resample_set + (snd_rate, pwfx->wBitsPerSample, pwfx->nChannels) == False) + { + error("rdpsnd_dsp_resample_set failed"); + oss_close(); + return False; + } + + break; + } + prates++; + } + + if (*prates == 0) + { + perror("SNDCTL_DSP_SPEED"); + oss_close(); + return False; + } } /* try to get 12 fragments of 2^12 bytes size */ fragments = (12 << 16) + 12; - ioctl(g_dsp_fd, SNDCTL_DSP_SETFRAGMENT, &fragments); + ioctl(dsp_fd, SNDCTL_DSP_SETFRAGMENT, &fragments); if (!driver_broken) { audio_buf_info info; memset(&info, 0, sizeof(info)); - if (ioctl(g_dsp_fd, SNDCTL_DSP_GETOSPACE, &info) == -1) + if (ioctl(dsp_fd, SNDCTL_DSP_GETOSPACE, &info) == -1) { perror("SNDCTL_DSP_GETOSPACE"); - close(g_dsp_fd); + oss_close(); return False; } @@ -162,132 +349,161 @@ } } + dsp_configured = True; + return True; } void -wave_out_volume(uint16 left, uint16 right) +oss_volume(uint16 left, uint16 right) { - static BOOL use_dev_mixer = False; uint32 volume; - int fd_mix = -1; volume = left / (65536 / 100); volume |= right / (65536 / 100) << 8; - if (use_dev_mixer) - { - if ((fd_mix = open("/dev/mixer", O_RDWR | O_NONBLOCK)) == -1) - { - perror("open /dev/mixer"); - return; - } - - if (ioctl(fd_mix, MIXER_WRITE(SOUND_MIXER_PCM), &volume) == -1) - { - perror("MIXER_WRITE(SOUND_MIXER_PCM)"); - return; - } - - close(fd_mix); - } - - if (ioctl(g_dsp_fd, MIXER_WRITE(SOUND_MIXER_PCM), &volume) == -1) + if (ioctl(dsp_fd, MIXER_WRITE(SOUND_MIXER_PCM), &volume) == -1) { - perror("MIXER_WRITE(SOUND_MIXER_PCM)"); - use_dev_mixer = True; + warning("hardware volume control unavailable, falling back to software volume control!\n"); + oss_driver.wave_out_volume = rdpsnd_dsp_softvol_set; + rdpsnd_dsp_softvol_set(left, right); return; } } void -wave_out_write(STREAM s, uint16 tick, uint8 index) +oss_play(void) { - struct audio_packet *packet = &packet_queue[queue_hi]; - unsigned int next_hi = (queue_hi + 1) % MAX_QUEUE; + struct audio_packet *packet; + ssize_t len; + STREAM out; + + /* We shouldn't be called if the queue is empty, but still */ + if (rdpsnd_queue_empty()) + return; + + packet = rdpsnd_queue_current_packet(); + out = &packet->s; - if (next_hi == queue_lo) + len = out->end - out->p; + + len = write(dsp_fd, out->p, (len > MAX_LEN) ? MAX_LEN : len); + if (len == -1) { - error("No space to queue audio packet\n"); + if (errno != EWOULDBLOCK) + { + if (!dsp_broken) + perror("RDPSND: write()"); + dsp_broken = True; + rdpsnd_queue_next(0); + } return; } - queue_hi = next_hi; + dsp_broken = False; + + out->p += len; + + if (out->p == out->end) + { + int delay_bytes; + unsigned long delay_us; + audio_buf_info info; - packet->s = *s; - packet->tick = tick; - packet->index = index; - packet->s.p += 4; + if (in_esddsp) + { + /* EsounD has no way of querying buffer status, so we have to + * go with a fixed size. */ + delay_bytes = out->size; + } + else + { +#ifdef SNDCTL_DSP_GETODELAY + delay_bytes = 0; + if (ioctl(dsp_fd, SNDCTL_DSP_GETODELAY, &delay_bytes) == -1) + delay_bytes = -1; +#else + delay_bytes = -1; +#endif - /* we steal the data buffer from s, give it a new one */ - s->data = (uint8 *) malloc(s->size); + if (delay_bytes == -1) + { + if (ioctl(dsp_fd, SNDCTL_DSP_GETOSPACE, &info) != -1) + delay_bytes = info.fragstotal * info.fragsize - info.bytes; + else + delay_bytes = out->size; + } + } - if (!g_dsp_busy) - wave_out_play(); + delay_us = delay_bytes * (1000000 / (samplewidth * snd_rate)); + rdpsnd_queue_next(delay_us); + } } void -wave_out_play(void) +oss_record(void) { - struct audio_packet *packet; - ssize_t len; - STREAM out; - static long startedat_us; - static long startedat_s; - static BOOL started = False; - struct timeval tv; + char buffer[32768]; + int len; - if (queue_lo == queue_hi) + len = read(dsp_fd, buffer, sizeof(buffer)); + if (len == -1) { - g_dsp_busy = 0; + if (errno != EWOULDBLOCK) + { + if (!dsp_broken) + perror("RDPSND: read()"); + dsp_broken = True; + rdpsnd_queue_next(0); + } return; } - packet = &packet_queue[queue_lo]; - out = &packet->s; + dsp_broken = False; - if (!started) - { - gettimeofday(&tv, NULL); - startedat_us = tv.tv_usec; - startedat_s = tv.tv_sec; - started = True; - } + rdpsnd_record(buffer, len); +} - len = out->end - out->p; +struct audio_driver * +oss_register(char *options) +{ + memset(&oss_driver, 0, sizeof(oss_driver)); - len = write(g_dsp_fd, out->p, (len > MAX_LEN) ? MAX_LEN : len); - if (len == -1) + oss_driver.name = "oss"; + oss_driver.description = + "OSS output driver, default device: " DEFAULTDEVICE " or $AUDIODEV"; + + oss_driver.add_fds = oss_add_fds; + oss_driver.check_fds = oss_check_fds; + + oss_driver.wave_out_open = oss_open_out; + oss_driver.wave_out_close = oss_close_out; + oss_driver.wave_out_format_supported = oss_format_supported; + oss_driver.wave_out_set_format = oss_set_format; + oss_driver.wave_out_volume = oss_volume; + + oss_driver.wave_in_open = oss_open_in; + oss_driver.wave_in_close = oss_close_in; + oss_driver.wave_in_format_supported = oss_format_supported; + oss_driver.wave_in_set_format = oss_set_format; + oss_driver.wave_in_volume = NULL; /* FIXME */ + + oss_driver.need_byteswap_on_be = 0; + oss_driver.need_resampling = 0; + + if (options) { - if (errno != EWOULDBLOCK) - perror("write audio"); - g_dsp_busy = 1; - return; + dsp_dev = xstrdup(options); } - - out->p += len; - if (out->p == out->end) + else { - long long duration; - long elapsed; + dsp_dev = getenv("AUDIODEV"); - gettimeofday(&tv, NULL); - duration = (out->size * (1000000 / (samplewidth * snd_rate))); - elapsed = (tv.tv_sec - startedat_s) * 1000000 + (tv.tv_usec - startedat_us); - - if (elapsed >= (duration * 85) / 100) - { - rdpsnd_send_completion(packet->tick, packet->index); - free(out->data); - queue_lo = (queue_lo + 1) % MAX_QUEUE; - started = False; - } - else + if (dsp_dev == NULL) { - g_dsp_busy = 1; - return; + dsp_dev = DEFAULTDEVICE; } } - g_dsp_busy = 1; - return; + + return &oss_driver; } --- rdesktop-1.5.0.orig/rdpsnd_sgi.c +++ rdesktop-1.5.0/rdpsnd_sgi.c @@ -1,7 +1,7 @@ /* -*- c-basic-offset: 8 -*- rdesktop: A Remote Desktop Protocol client. Sound Channel Process Functions - SGI/IRIX - Copyright (C) Matthew Chapman 2003 + Copyright (C) Matthew Chapman 2003-2007 Copyright (C) GuoJunBo guojunbo@ict.ac.cn 2003 Copyright (C) Jeremy Meng void.foo@gmail.com 2004, 2005 @@ -28,101 +28,107 @@ #define IRIX_MAX_VOL 65535 -#define MAX_QUEUE 10 - -int g_dsp_fd; ALconfig audioconfig; ALport output_port; -BOOL g_dsp_busy = False; -static BOOL g_swapaudio; static int g_snd_rate; -static BOOL g_swapaudio; static int width = AL_SAMPLE_16; +static char *sgi_output_device = NULL; double min_volume, max_volume, volume_range; int resource, maxFillable; int combinedFrameSize; -static struct audio_packet +void sgi_play(void); + +void +sgi_add_fds(int *n, fd_set * rfds, fd_set * wfds, struct timeval *tv) { - struct stream s; - uint16 tick; - uint8 index; -} packet_queue[MAX_QUEUE]; -static unsigned int queue_hi, queue_lo; + /* We need to be called rather often... */ + FD_SET(0, wfds); +} -BOOL -wave_out_open(void) +void +sgi_check_fds(fd_set * rfds, fd_set * wfds) +{ + if (output_port == (ALport) 0) + return; + + if (!rdpsnd_queue_empty()) + sgi_play(); +} + +RD_BOOL +sgi_open(void) { ALparamInfo pinfo; + static int warned = 0; #if (defined(IRIX_DEBUG)) - fprintf(stderr, "wave_out_open: begin\n"); + fprintf(stderr, "sgi_open: begin\n"); #endif + if (!warned && sgi_output_device) + { + warning("device-options not supported for libao-driver\n"); + warned = 1; + } + if (alGetParamInfo(AL_DEFAULT_OUTPUT, AL_GAIN, &pinfo) < 0) { - fprintf(stderr, "wave_out_open: alGetParamInfo failed: %s\n", + fprintf(stderr, "sgi_open: alGetParamInfo failed: %s\n", alGetErrorString(oserror())); } min_volume = alFixedToDouble(pinfo.min.ll); max_volume = alFixedToDouble(pinfo.max.ll); volume_range = (max_volume - min_volume); #if (defined(IRIX_DEBUG)) - fprintf(stderr, "wave_out_open: minvol = %lf, maxvol= %lf, range = %lf.\n", + fprintf(stderr, "sgi_open: minvol = %lf, maxvol= %lf, range = %lf.\n", min_volume, max_volume, volume_range); #endif - queue_lo = queue_hi = 0; - audioconfig = alNewConfig(); if (audioconfig == (ALconfig) 0) { - fprintf(stderr, "wave_out_open: alNewConfig failed: %s\n", - alGetErrorString(oserror())); + fprintf(stderr, "sgi_open: alNewConfig failed: %s\n", alGetErrorString(oserror())); return False; } output_port = alOpenPort("rdpsnd", "w", 0); if (output_port == (ALport) 0) { - fprintf(stderr, "wave_out_open: alOpenPort failed: %s\n", - alGetErrorString(oserror())); + fprintf(stderr, "sgi_open: alOpenPort failed: %s\n", alGetErrorString(oserror())); return False; } #if (defined(IRIX_DEBUG)) - fprintf(stderr, "wave_out_open: returning\n"); + fprintf(stderr, "sgi_open: returning\n"); #endif return True; } void -wave_out_close(void) +sgi_close(void) { /* Ack all remaining packets */ #if (defined(IRIX_DEBUG)) - fprintf(stderr, "wave_out_close: begin\n"); + fprintf(stderr, "sgi_close: begin\n"); #endif - while (queue_lo != queue_hi) - { - rdpsnd_send_completion(packet_queue[queue_lo].tick, packet_queue[queue_lo].index); - free(packet_queue[queue_lo].s.data); - queue_lo = (queue_lo + 1) % MAX_QUEUE; - } + while (!rdpsnd_queue_empty()) + rdpsnd_queue_next(0); alDiscardFrames(output_port, 0); alClosePort(output_port); + output_port = (ALport) 0; alFreeConfig(audioconfig); #if (defined(IRIX_DEBUG)) - fprintf(stderr, "wave_out_close: returning\n"); + fprintf(stderr, "sgi_close: returning\n"); #endif } -BOOL -wave_out_format_supported(WAVEFORMATEX * pwfx) +RD_BOOL +sgi_format_supported(RD_WAVEFORMATEX * pwfx) { if (pwfx->wFormatTag != WAVE_FORMAT_PCM) return False; @@ -134,30 +140,21 @@ return True; } -BOOL -wave_out_set_format(WAVEFORMATEX * pwfx) +RD_BOOL +sgi_set_format(RD_WAVEFORMATEX * pwfx) { int channels; int frameSize, channelCount; ALpv params; #if (defined(IRIX_DEBUG)) - fprintf(stderr, "wave_out_set_format: init...\n"); + fprintf(stderr, "sgi_set_format: init...\n"); #endif - g_swapaudio = False; if (pwfx->wBitsPerSample == 8) width = AL_SAMPLE_8; else if (pwfx->wBitsPerSample == 16) - { width = AL_SAMPLE_16; - /* Do we need to swap the 16bit values? (Are we BigEndian) */ -#if (defined(B_ENDIAN)) - g_swapaudio = 1; -#else - g_swapaudio = 0; -#endif - } /* Limited support to configure an opened audio port in IRIX. The number of channels is a static setting and can not be changed after @@ -178,7 +175,7 @@ if (output_port == (ALport) 0) { - fprintf(stderr, "wave_out_set_format: alOpenPort failed: %s\n", + fprintf(stderr, "sgi_set_format: alOpenPort failed: %s\n", alGetErrorString(oserror())); return False; } @@ -192,7 +189,7 @@ if (frameSize == 0 || channelCount == 0) { - fprintf(stderr, "wave_out_set_format: bad frameSize or channelCount\n"); + fprintf(stderr, "sgi_set_format: bad frameSize or channelCount\n"); return False; } combinedFrameSize = frameSize * channelCount; @@ -213,20 +210,20 @@ } #if (defined(IRIX_DEBUG)) - fprintf(stderr, "wave_out_set_format: returning...\n"); + fprintf(stderr, "sgi_set_format: returning...\n"); #endif return True; } void -wave_out_volume(uint16 left, uint16 right) +sgi_volume(uint16 left, uint16 right) { double gainleft, gainright; ALpv pv[1]; ALfixed gain[8]; #if (defined(IRIX_DEBUG)) - fprintf(stderr, "wave_out_volume: begin\n"); + fprintf(stderr, "sgi_volume: begin\n"); fprintf(stderr, "left='%d', right='%d'\n", left, right); #endif @@ -241,76 +238,33 @@ pv[0].sizeIn = 8; if (alSetParams(AL_DEFAULT_OUTPUT, pv, 1) < 0) { - fprintf(stderr, "wave_out_volume: alSetParams failed: %s\n", + fprintf(stderr, "sgi_volume: alSetParams failed: %s\n", alGetErrorString(oserror())); return; } #if (defined(IRIX_DEBUG)) - fprintf(stderr, "wave_out_volume: returning\n"); + fprintf(stderr, "sgi_volume: returning\n"); #endif } void -wave_out_write(STREAM s, uint16 tick, uint8 index) -{ - struct audio_packet *packet = &packet_queue[queue_hi]; - unsigned int next_hi = (queue_hi + 1) % MAX_QUEUE; - - if (next_hi == queue_lo) - { - fprintf(stderr, "No space to queue audio packet\n"); - return; - } - - queue_hi = next_hi; - - packet->s = *s; - packet->tick = tick; - packet->index = index; - packet->s.p += 4; - - /* we steal the data buffer from s, give it a new one */ - s->data = malloc(s->size); - - if (!g_dsp_busy) - wave_out_play(); -} - -void -wave_out_play(void) +sgi_play(void) { struct audio_packet *packet; ssize_t len; unsigned int i; - uint8 swap; STREAM out; - static BOOL swapped = False; int gf; while (1) { - if (queue_lo == queue_hi) - { - g_dsp_busy = False; + if (rdpsnd_queue_empty()) return; - } - packet = &packet_queue[queue_lo]; + packet = rdpsnd_queue_current_packet(); out = &packet->s; - /* Swap the current packet, but only once */ - if (g_swapaudio && !swapped) - { - for (i = 0; i < out->end - out->p; i += 2) - { - swap = *(out->p + i); - *(out->p + i) = *(out->p + i + 1); - *(out->p + i + 1) = swap; - } - swapped = True; - } - len = out->end - out->p; alWriteFrames(output_port, out->p, len / combinedFrameSize); @@ -321,20 +275,45 @@ gf = alGetFilled(output_port); if (gf < (4 * maxFillable / 10)) { - rdpsnd_send_completion(packet->tick, packet->index); - free(out->data); - queue_lo = (queue_lo + 1) % MAX_QUEUE; - swapped = False; + rdpsnd_queue_next(0); } else { #if (defined(IRIX_DEBUG)) /* fprintf(stderr,"Busy playing...\n"); */ #endif - g_dsp_busy = True; usleep(10); return; } } } } + +struct audio_driver * +sgi_register(char *options) +{ + static struct audio_driver sgi_driver; + + memset(&sgi_driver, 0, sizeof(sgi_driver)); + + sgi_driver.name = "sgi"; + sgi_driver.description = "SGI output driver"; + + sgi_driver.add_fds = sgi_add_fds; + sgi_driver.check_fds = sgi_check_fds; + + sgi_driver.wave_out_open = sgi_open; + sgi_driver.wave_out_close = sgi_close; + sgi_driver.wave_out_format_supported = sgi_format_supported; + sgi_driver.wave_out_set_format = sgi_set_format; + sgi_driver.wave_out_volume = sgi_volume; + + sgi_driver.need_byteswap_on_be = 1; + sgi_driver.need_resampling = 0; + + if (options) + { + sgi_output_device = xstrdup(options); + } + return &sgi_driver; +} --- rdesktop-1.5.0.orig/rdpsnd_sun.c +++ rdesktop-1.5.0/rdpsnd_sun.c @@ -1,9 +1,9 @@ /* -*- c-basic-offset: 8 -*- rdesktop: A Remote Desktop Protocol client. Sound Channel Process Functions - Sun - Copyright (C) Matthew Chapman 2003 + Copyright (C) Matthew Chapman 2003-2007 Copyright (C) GuoJunBo guojunbo@ict.ac.cn 2003 - Copyright (C) Michael Gernoth mike@zerfleddert.de 2003 + Copyright (C) Michael Gernoth mike@zerfleddert.de 2003-2007 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,6 +21,7 @@ */ #include "rdesktop.h" +#include "rdpsnd.h" #include <unistd.h> #include <fcntl.h> #include <errno.h> @@ -31,70 +32,75 @@ #include <stropts.h> #endif -#define MAX_QUEUE 10 +#define DEFAULTDEVICE "/dev/audio" -int g_dsp_fd; -BOOL g_dsp_busy = False; -static BOOL g_reopened; -static BOOL g_swapaudio; +static int dsp_fd = -1; +static RD_BOOL dsp_busy; + +static RD_BOOL g_reopened; static short g_samplewidth; +static char *dsp_dev; -static struct audio_packet -{ - struct stream s; - uint16 tick; - uint8 index; -} packet_queue[MAX_QUEUE]; -static unsigned int queue_hi, queue_lo; +void sun_play(void); -BOOL -wave_out_open(void) +void +sun_add_fds(int *n, fd_set * rfds, fd_set * wfds, struct timeval *tv) { - char *dsp_dev = getenv("AUDIODEV"); + if (dsp_fd == -1) + return; - if (dsp_dev == NULL) - { - dsp_dev = xstrdup("/dev/audio"); - } + if (rdpsnd_queue_empty()) + return; - if ((g_dsp_fd = open(dsp_dev, O_WRONLY | O_NONBLOCK)) == -1) + FD_SET(dsp_fd, wfds); + if (dsp_fd > *n) + *n = dsp_fd; +} + +void +sun_check_fds(fd_set * rfds, fd_set * wfds) +{ + if (FD_ISSET(dsp_fd, wfds)) + sun_play(); +} + +RD_BOOL +sun_open(void) +{ + if ((dsp_fd = open(dsp_dev, O_WRONLY | O_NONBLOCK)) == -1) { perror(dsp_dev); return False; } /* Non-blocking so that user interface is responsive */ - fcntl(g_dsp_fd, F_SETFL, fcntl(g_dsp_fd, F_GETFL) | O_NONBLOCK); + fcntl(dsp_fd, F_SETFL, fcntl(dsp_fd, F_GETFL) | O_NONBLOCK); - queue_lo = queue_hi = 0; g_reopened = True; return True; } void -wave_out_close(void) +sun_close(void) { /* Ack all remaining packets */ - while (queue_lo != queue_hi) - { - rdpsnd_send_completion(packet_queue[queue_lo].tick, packet_queue[queue_lo].index); - free(packet_queue[queue_lo].s.data); - queue_lo = (queue_lo + 1) % MAX_QUEUE; - } + while (!rdpsnd_queue_empty()) + rdpsnd_queue_next(0); #if defined I_FLUSH && defined FLUSHW /* Flush the audiobuffer */ - ioctl(g_dsp_fd, I_FLUSH, FLUSHW); + ioctl(dsp_fd, I_FLUSH, FLUSHW); #endif #if defined AUDIO_FLUSH - ioctl(g_dsp_fd, AUDIO_FLUSH, NULL); + ioctl(dsp_fd, AUDIO_FLUSH, NULL); #endif - close(g_dsp_fd); + close(dsp_fd); + dsp_fd = -1; } -BOOL -wave_out_format_supported(WAVEFORMATEX * pwfx) +RD_BOOL +sun_format_supported(RD_WAVEFORMATEX * pwfx) { if (pwfx->wFormatTag != WAVE_FORMAT_PCM) return False; @@ -106,13 +112,12 @@ return True; } -BOOL -wave_out_set_format(WAVEFORMATEX * pwfx) +RD_BOOL +sun_set_format(RD_WAVEFORMATEX * pwfx) { audio_info_t info; - ioctl(g_dsp_fd, AUDIO_DRAIN, 0); - g_swapaudio = False; + ioctl(dsp_fd, AUDIO_DRAIN, 0); AUDIO_INITINFO(&info); @@ -123,12 +128,6 @@ else if (pwfx->wBitsPerSample == 16) { info.play.encoding = AUDIO_ENCODING_LINEAR; - /* Do we need to swap the 16bit values? (Are we BigEndian) */ -#ifdef B_ENDIAN - g_swapaudio = 1; -#else - g_swapaudio = 0; -#endif } g_samplewidth = pwfx->wBitsPerSample / 8; @@ -150,10 +149,10 @@ info.play.error = 0; g_reopened = True; - if (ioctl(g_dsp_fd, AUDIO_SETINFO, &info) == -1) + if (ioctl(dsp_fd, AUDIO_SETINFO, &info) == -1) { perror("AUDIO_SETINFO"); - close(g_dsp_fd); + sun_close(); return False; } @@ -161,7 +160,7 @@ } void -wave_out_volume(uint16 left, uint16 right) +sun_volume(uint16 left, uint16 right) { audio_info_t info; uint balance; @@ -185,7 +184,7 @@ info.play.gain = volume / (65536 / AUDIO_MAX_GAIN); info.play.balance = balance; - if (ioctl(g_dsp_fd, AUDIO_SETINFO, &info) == -1) + if (ioctl(dsp_fd, AUDIO_SETINFO, &info) == -1) { perror("AUDIO_SETINFO"); return; @@ -193,42 +192,14 @@ } void -wave_out_write(STREAM s, uint16 tick, uint8 index) -{ - struct audio_packet *packet = &packet_queue[queue_hi]; - unsigned int next_hi = (queue_hi + 1) % MAX_QUEUE; - - if (next_hi == queue_lo) - { - error("No space to queue audio packet\n"); - return; - } - - queue_hi = next_hi; - - packet->s = *s; - packet->tick = tick; - packet->index = index; - packet->s.p += 4; - - /* we steal the data buffer from s, give it a new one */ - s->data = malloc(s->size); - - if (!g_dsp_busy) - wave_out_play(); -} - -void -wave_out_play(void) +sun_play(void) { struct audio_packet *packet; audio_info_t info; ssize_t len; unsigned int i; - uint8 swap; STREAM out; - static BOOL swapped = False; - static BOOL sentcompletion = True; + static RD_BOOL sentcompletion = True; static uint32 samplecnt = 0; static uint32 numsamples; @@ -238,32 +209,16 @@ { /* Device was just (re)openend */ samplecnt = 0; - swapped = False; sentcompletion = True; g_reopened = False; } - if (queue_lo == queue_hi) - { - g_dsp_busy = 0; + if (rdpsnd_queue_empty()) return; - } - packet = &packet_queue[queue_lo]; + packet = rdpsnd_queue_current_packet(); out = &packet->s; - /* Swap the current packet, but only once */ - if (g_swapaudio && !swapped) - { - for (i = 0; i < out->end - out->p; i += 2) - { - swap = *(out->p + i); - *(out->p + i) = *(out->p + i + 1); - *(out->p + i + 1) = swap; - } - swapped = True; - } - if (sentcompletion) { sentcompletion = False; @@ -274,12 +229,11 @@ if (out->end != out->p) { - len = write(g_dsp_fd, out->p, out->end - out->p); + len = write(dsp_fd, out->p, out->end - out->p); if (len == -1) { if (errno != EWOULDBLOCK) perror("write audio"); - g_dsp_busy = 1; return; } } @@ -287,7 +241,7 @@ out->p += len; if (out->p == out->end) { - if (ioctl(g_dsp_fd, AUDIO_GETINFO, &info) == -1) + if (ioctl(dsp_fd, AUDIO_GETINFO, &info) == -1) { perror("AUDIO_GETINFO"); return; @@ -297,17 +251,55 @@ if (info.play.samples >= samplecnt + ((numsamples * 7) / 10)) { samplecnt += numsamples; - rdpsnd_send_completion(packet->tick, packet->index); - free(out->data); - queue_lo = (queue_lo + 1) % MAX_QUEUE; - swapped = False; + /* We need to add 50 to tell windows that time has passed while + * playing this packet */ + rdpsnd_queue_next(50); sentcompletion = True; } else { - g_dsp_busy = 1; return; } } } } + +struct audio_driver * +sun_register(char *options) +{ + static struct audio_driver sun_driver; + + memset(&sun_driver, 0, sizeof(sun_driver)); + + sun_driver.name = "sun"; + sun_driver.description = + "SUN/BSD output driver, default device: " DEFAULTDEVICE " or $AUDIODEV"; + + sun_driver.add_fds = sun_add_fds; + sun_driver.check_fds = sun_check_fds; + + sun_driver.wave_out_open = sun_open; + sun_driver.wave_out_close = sun_close; + sun_driver.wave_out_format_supported = sun_format_supported; + sun_driver.wave_out_set_format = sun_set_format; + sun_driver.wave_out_volume = sun_volume; + + sun_driver.need_byteswap_on_be = 1; + sun_driver.need_resampling = 0; + + if (options) + { + dsp_dev = xstrdup(options); + } + else + { + dsp_dev = getenv("AUDIODEV"); + + if (dsp_dev == NULL) + { + dsp_dev = DEFAULTDEVICE; + } + } + + return &sun_driver; +} --- rdesktop-1.5.0.orig/scard.c +++ rdesktop-1.5.0/scard.c @@ -0,0 +1,2575 @@ +/* + rdesktop: A Remote Desktop Protocol client. + Smart Card support + Copyright (C) Alexi Volkov <alexi@myrealbox.com> 2006 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 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., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include <stdio.h> +#include <unistd.h> +#include <fcntl.h> +#include <strings.h> +#include <sys/types.h> +#include <time.h> +#ifndef MAKE_PROTO +#ifdef PCSC_OSX +#include <PCSC/wintypes.h> +#include <PCSC/pcsclite.h> +#include <PCSC/winscard.h> +#else +#include <wintypes.h> +#include <pcsclite.h> +#include <winscard.h> +#endif /* PCSC_OSX */ +#include "rdesktop.h" +#include "scard.h" + +/* variable segment */ + +#define SCARD_MAX_MEM 102400 +#define SCARD_AUTOALLOCATE -1 +#define OUT_STREAM_SIZE 4096 + +static pthread_mutex_t **scard_mutex = NULL; + +static uint32 curDevice = 0, curId = 0, curBytesOut = 0; +static PSCNameMapRec nameMapList = NULL; +static int nameMapCount = 0; + +static pthread_t queueHandler; +static pthread_mutex_t queueAccess; +static pthread_mutex_t queueEmpty; +static pthread_mutex_t hcardAccess; + +static PMEM_HANDLE threadListHandle = NULL; +static PThreadListElement threadList = NULL; + + +static PSCThreadData queueFirst = NULL, queueLast = NULL; +static int threadCount = 0; + +static PSCHCardRec hcardFirst = NULL; + +static void *queue_handler_function(void *data); + +/* code segment */ + +#endif /* MAKE_PROTO */ +void +scardSetInfo(uint32 device, uint32 id, uint32 bytes_out) +{ + curDevice = device; + curId = id; + curBytesOut = bytes_out; +} + +#ifndef MAKE_PROTO + +static RD_NTSTATUS +scard_create(uint32 device_id, uint32 accessmask, uint32 sharemode, uint32 create_disposition, + uint32 flags_and_attributes, char *filename, RD_NTHANDLE * phandle) +{ + return RD_STATUS_SUCCESS; +} + +static RD_NTSTATUS +scard_close(RD_NTHANDLE handle) +{ + return RD_STATUS_SUCCESS; +} + +static RD_NTSTATUS +scard_read(RD_NTHANDLE handle, uint8 * data, uint32 length, uint32 offset, uint32 * result) +{ + return RD_STATUS_SUCCESS; +} + +static RD_NTSTATUS +scard_write(RD_NTHANDLE handle, uint8 * data, uint32 length, uint32 offset, uint32 * result) +{ + return RD_STATUS_SUCCESS; +} +#endif /* MAKE_PROTO */ + +/* Enumeration of devices from rdesktop.c */ +/* returns numer of units found and initialized. */ +/* optarg looks like ':"ReaderName=ReaderAlias"' */ +/* when it arrives to this function. */ + +int +scard_enum_devices(uint32 * id, char *optarg) +{ + char *name = optarg + 1; + char *alias; + int count = 0; + PSCNameMapRec tmpMap; + + MYPCSC_DWORD rv; + SCARDCONTEXT hContext; + + /* code segment */ + rv = SCardEstablishContext(SCARD_SCOPE_SYSTEM, NULL, NULL, &hContext); + if (rv != SCARD_S_SUCCESS) + { + error("scard_enum_devices: PCSC service not available\n"); + return 0; + } + else + rv = SCardReleaseContext(hContext); + + count = 0; + + if (0 != pthread_mutex_init(&queueAccess, NULL)) + { + error("scard_enum_devices: Can't initialize queue access mutex\n"); + return 0; + } + + if (0 != pthread_mutex_init(&queueEmpty, NULL)) + { + error("scard_enum_devices: Can't initialize queue control mutex\n"); + return 0; + } + + if (0 != pthread_mutex_init(&hcardAccess, NULL)) + { + error("scard_enum_devices: Can't initialize hcard list access mutex\n"); + return 0; + } + + if (0 != + pthread_create(&queueHandler, NULL, (void *(*)(void *)) queue_handler_function, NULL)) + { + error("scard_enum_devices: Can't create queue handling Thread\n"); + return 0; + } + + strncpy(g_rdpdr_device[*id].name, "SCARD\0\0\0", 8); + toupper_str(g_rdpdr_device[*id].name); + g_rdpdr_device[*id].local_path = "/dev/scard"; + g_rdpdr_device[*id].pdevice_data = NULL; + g_rdpdr_device[*id].handle = 0; + g_rdpdr_device[*id].device_type = DEVICE_TYPE_SCARD; + count++; + (*id)++; + + if (*optarg == ':') + { + while ((optarg = next_arg(name, ',')) && *id < RDPDR_MAX_DEVICES) + { + int len; + char *vendor = NULL; + alias = next_arg(name, '='); + vendor = next_arg(alias, ';'); + + if (strlen(name) > 0) + { + if (!strlen(alias)) + { + alias = name; + vendor = "\0"; + } + + printf("Static/aliased Device:\n"); + printf(" Lin name: [%s]\n", name); + printf(" Win name: [%s]\n", alias); + printf(" Vendor : [%s]\n", vendor); + nameMapCount++; + + if (nameMapList == NULL) + nameMapList = xmalloc(nameMapCount * sizeof(TSCNameMapRec)); + else + nameMapList = + xrealloc(nameMapList, + nameMapCount * sizeof(TSCNameMapRec)); + + tmpMap = nameMapList + nameMapCount - 1; + + len = strlen(alias); + strncpy(tmpMap->alias, alias, (len > 127) ? (127) : (len)); + len = strlen(name); + strncpy(tmpMap->name, name, (len > 127) ? (127) : (len)); + + if (vendor) + { + len = strlen(vendor); + if (len > 0) + { + memset(tmpMap->vendor, 0, 128); + strncpy(tmpMap->vendor, vendor, + (len > 127) ? (127) : (len)); + } + else + tmpMap->vendor[0] = '\0'; + } + else + tmpMap->vendor[0] = '\0'; + } + name = optarg; + } + } + + return count; +} + +#ifndef MAKE_PROTO +/* ---------------------------------- */ + +/* These two functions depend heavily on the actual implementation of the smart + * card handle in PC/SC Lite 1.3.1. Here are the salient bits: + * + * From winscard.c:331, in SCardConnect: + * *phCard = RFCreateReaderHandle(rContext); + * + * RFCreateReaderHandle (readerfactory.c:1161) creates a random short (16-bit + * integer) and makes sure it's unique. Then it adds it to + * rContext->dwIdentity. + * + * From readerfactory.c:173, in RFAddReader: + * (sReadersContexts[dwContext])->dwIdentity = + * (dwContext + 1) << (sizeof(DWORD) / 2) * 8; + * + * dwContext must be less than PCSCLITE_MAX_READERS_CONTEXTS, which is defined + * to be 16 in the 1.3.1 release. + * + * The use of "(sizeof(DWORD) / 2) * 8" is what makes conversion necessary in + * order to use 64-bit card handles when talking to PC/SC Lite, and 32-bit card + * handles when talking with the server, without losing any data: a card handle + * made by a 32-bit PC/SC Lite looks like 0x00014d32, where the 4d32 is the + * random 16 bits, 01 is the reader context index + 1, and it's left-shifted by + * 16 bits (sizeof(DWORD) == 4, divided by 2 is 2, times 8 is 16.) But a 64-bit + * PC/SC Lite makes a card handle that looks like 0x0000000100004d32. The + * reader context index+1 is left-shifted 32 bits because sizeof(DWORD) is 8, + * not 4. This means the handle won't fit in 32 bits. (The multiplication by 8 + * is because sizeofs are in bytes, but saying how many places to left-shift is + * speaking in bits.) + * + * So then. Maximum value of dwContext+1 is 17; we'll say this fits in a byte + * to be loose and have plenty of room. This is then left-shifted by + * sizeof(DWORD) / 2 * 8 - which in this file is sizeof(MYPCSC_DWORD) / 2 * 8. + * + * At any rate, if we take the handle as passed from PC/SC Lite, right-shift by + * sizeof(MYPCSC_DWORD) / 2, left-shift by sizeof(SERVER_DWORD) / 2, and add + * the lower two bytes of the value (the random number), we can fit all the + * information into 32 bits without losing any. Of course, any time we want to + * hand that back to PC/SC Lite, we'll have to expand it again. (And if + * sizeof(MYPCSC_DWORD) == sizeof(SERVER_DWORD), we're essentially doing + * nothing, which will not break anything.) + * + * + * - jared.jennings@eglin.af.mil, 2 Aug 2006 + */ + + +static MYPCSC_SCARDHANDLE +scHandleToMyPCSC(SERVER_SCARDHANDLE server) +{ + return (((MYPCSC_SCARDHANDLE) server >> (sizeof(SERVER_DWORD) * 8 / 2) & 0xffff) + << (sizeof(MYPCSC_DWORD) * 8 / 2)) + (server & 0xffff); +} + +static SERVER_SCARDHANDLE +scHandleToServer(MYPCSC_SCARDHANDLE mypcsc) +{ + return ((mypcsc >> (sizeof(MYPCSC_DWORD) * 8 / 2) & 0xffff) + << (sizeof(SERVER_DWORD) * 8 / 2)) + (mypcsc & 0xffff); +} + +/* ---------------------------------- */ + +static void * +SC_xmalloc(PMEM_HANDLE * memHandle, unsigned int size) +{ + PMEM_HANDLE handle = NULL; + if (size > 0 && memHandle) + { + handle = xmalloc(size + sizeof(MEM_HANDLE)); + if (handle) + { + handle->prevHandle = NULL; + handle->nextHandle = NULL; + handle->dataSize = size; + if (*memHandle) + { + handle->prevHandle = *memHandle; + (*memHandle)->nextHandle = handle; + } + *memHandle = handle; + return handle + 1; + } + else + return NULL; + } + else + return NULL; +} + +static void +SC_xfree(PMEM_HANDLE * handle, void *memptr) +{ + if (memptr != NULL) + { + PMEM_HANDLE lcHandle = (PMEM_HANDLE) memptr - 1; + if (lcHandle->dataSize > 0) + { + memset(memptr, 0, lcHandle->dataSize); + if (lcHandle->nextHandle) + lcHandle->nextHandle->prevHandle = lcHandle->prevHandle; + if (lcHandle->prevHandle) + lcHandle->prevHandle->nextHandle = lcHandle->nextHandle; + if (*handle == lcHandle) + { + if (lcHandle->prevHandle) + *handle = lcHandle->prevHandle; + else + *handle = lcHandle->nextHandle; + } + xfree(lcHandle); + } + } +} + +static void +SC_xfreeallmemory(PMEM_HANDLE * handle) +{ + if (handle && (*handle)) + { + if ((*handle)->prevHandle) + { + (*handle)->prevHandle->nextHandle = NULL; + SC_xfreeallmemory(&((*handle)->prevHandle)); + } + if ((*handle)->nextHandle) + { + (*handle)->nextHandle->prevHandle = NULL; + SC_xfreeallmemory(&((*handle)->nextHandle)); + } + memset(*handle, 0, (*handle)->dataSize + sizeof(MEM_HANDLE)); + xfree(*handle); + *handle = NULL; + } +} + +/* ---------------------------------- */ + +static char * +getName(char *alias) +{ + int i; + PSCNameMapRec tmpMap; + for (i = 0, tmpMap = nameMapList; i < nameMapCount; i++, tmpMap++) + { + if (strcmp(tmpMap->alias, alias) == 0) + return tmpMap->name; + } + return alias; +} + +static char * +getVendor(char *name) +{ + int i; + PSCNameMapRec tmpMap; + for (i = 0, tmpMap = nameMapList; i < nameMapCount; i++, tmpMap++) + { + if (strcmp(tmpMap->name, name) == 0) + return tmpMap->vendor; + } + return NULL; +} + + +static char * +getAlias(char *name) +{ + int i; + PSCNameMapRec tmpMap; + for (i = 0, tmpMap = nameMapList; i < nameMapCount; i++, tmpMap++) + { + if (strcmp(tmpMap->name, name) == 0) + return tmpMap->alias; + } + return name; +} + +static int +hasAlias(char *name) +{ + int i; + PSCNameMapRec tmpMap; + for (i = 0, tmpMap = nameMapList; i < nameMapCount; i++, tmpMap++) + { + if (strcmp(tmpMap->name, name) == 0) + return 1; + } + return 0; +} + +static void +inRepos(STREAM in, unsigned int read) +{ + SERVER_DWORD add = 4 - read % 4; + if (add < 4 && add > 0) + { + in_uint8s(in, add); + } +} + +static void +outRepos(STREAM out, unsigned int written) +{ + SERVER_DWORD add = (4 - written % 4) % 4; + if (add > 0) + { + out_uint8s(out, add); + } +} + + +static void +outBufferStartWithLimit(STREAM out, int length, int highLimit) +{ + int header = (length < 0) ? (0) : ((length > highLimit) ? (highLimit) : (length)); + out_uint32_le(out, header); + out_uint32_le(out, 0x00000001); /* Magic DWORD - any non zero */ +} + + +static void +outBufferStart(STREAM out, int length) +{ + outBufferStartWithLimit(out, length, 0x7FFFFFFF); +} + +static void +outBufferFinishWithLimit(STREAM out, char *buffer, unsigned int length, unsigned int highLimit) +{ + int header = (length < 0) ? (0) : ((length > highLimit) ? (highLimit) : (length)); + out_uint32_le(out, header); + + if (length <= 0) + { + out_uint32_le(out, 0x00000000); + } + else + { + if (header < length) + length = header; + out_uint8p(out, buffer, length); + outRepos(out, length); + } +} + +static void +outBufferFinish(STREAM out, char *buffer, unsigned int length) +{ + outBufferFinishWithLimit(out, buffer, length, 0x7FFFFFFF); +} + +static void +outForceAlignment(STREAM out, unsigned int seed) +{ + SERVER_DWORD add = (seed - (out->p - out->data) % seed) % seed; + if (add > 0) + out_uint8s(out, add); +} + +static unsigned int +inString(PMEM_HANDLE * handle, STREAM in, char **destination, SERVER_DWORD dataLength, RD_BOOL wide) +{ + unsigned int Result = (wide) ? (2 * dataLength) : (dataLength); + PMEM_HANDLE lcHandle = NULL; + char *buffer = SC_xmalloc(&lcHandle, Result + 2); + char *reader; + + /* code segment */ + + if (wide) + { + int i; + in_uint8a(in, buffer, 2 * dataLength); + for (i = 0; i < dataLength; i++) + if ((buffer[2 * i] < 0) || (buffer[2 * i + 1] != 0)) + buffer[i] = '?'; + else + buffer[i] = buffer[2 * i]; + } + else + { + in_uint8a(in, buffer, dataLength); + } + + buffer[dataLength] = '\0'; + reader = getName(buffer); + *destination = SC_xmalloc(handle, strlen(reader) + 1); + strcpy(*destination, reader); + + SC_xfreeallmemory(&lcHandle); + return Result; +} + +static unsigned int +outString(STREAM out, char *source, RD_BOOL wide) +{ + PMEM_HANDLE lcHandle = NULL; + char *reader = getAlias(source); + unsigned int dataLength = strlen(reader) + 1; + unsigned int Result = (wide) ? (2 * dataLength) : (dataLength); + + /* code segment */ + + if (wide) + { + int i; + char *buffer = SC_xmalloc(&lcHandle, Result); + + for (i = 0; i < dataLength; i++) + { + if (source[i] < 0) + buffer[2 * i] = '?'; + else + buffer[2 * i] = reader[i]; + buffer[2 * i + 1] = '\0'; + } + out_uint8p(out, buffer, 2 * dataLength); + } + else + { + out_uint8p(out, reader, dataLength); + } + + SC_xfreeallmemory(&lcHandle); + return Result; +} + +static void +inReaderName(PMEM_HANDLE * handle, STREAM in, char **destination, RD_BOOL wide) +{ + SERVER_DWORD dataLength; + in->p += 0x08; + in_uint32_le(in, dataLength); + inRepos(in, inString(handle, in, destination, dataLength, wide)); +} + +static void +inSkipLinked(STREAM in) +{ + SERVER_DWORD len; + in_uint32_le(in, len); + if (len > 0) + { + in_uint8s(in, len); + inRepos(in, len); + } +} + +/* ---------------------------------- */ +/* Smart Card processing functions: */ +/* ---------------------------------- */ + +static MYPCSC_DWORD +SC_returnCode(MYPCSC_DWORD rc, PMEM_HANDLE * handle, STREAM in, STREAM out) +{ + SC_xfreeallmemory(handle); + out_uint8s(out, 256); + return rc; +} + +static MYPCSC_DWORD +SC_returnNoMemoryError(PMEM_HANDLE * handle, STREAM in, STREAM out) +{ + return SC_returnCode(SCARD_E_NO_MEMORY, handle, in, out); +} + +static MYPCSC_DWORD +TS_SCardEstablishContext(STREAM in, STREAM out) +{ + MYPCSC_DWORD rv; + MYPCSC_SCARDCONTEXT hContext; + /* code segment */ + + DEBUG_SCARD(("SCARD: SCardEstablishContext()\n")); + rv = SCardEstablishContext(SCARD_SCOPE_SYSTEM, NULL, NULL, &hContext); + if (rv) + { + DEBUG_SCARD(("SCARD: -> Failure: %s (0x%08x)\n", + pcsc_stringify_error(rv), (unsigned int) rv)); + } + else + { + DEBUG_SCARD(("SCARD: -> Success (context: 0x%08x)\n", (unsigned) hContext)); + } + + out_uint32_le(out, 0x00000004); + out_uint32_le(out, (SERVER_DWORD) hContext); /* must not be 0 (Seems to be pointer), don't know what is this (I use hContext as value) */ + /* i hope it's not a pointer because i just downcasted it - jlj */ + out_uint32_le(out, 0x00000004); + out_uint32_le(out, (SERVER_DWORD) hContext); + return rv; +} + +static MYPCSC_DWORD +TS_SCardReleaseContext(STREAM in, STREAM out) +{ + MYPCSC_DWORD rv; + SERVER_SCARDCONTEXT hContext; + + in->p += 0x1C; + in_uint32_le(in, hContext); + DEBUG_SCARD(("SCARD: SCardReleaseContext(context: 0x%08x)\n", (unsigned) hContext)); + rv = SCardReleaseContext((MYPCSC_SCARDCONTEXT) hContext); + + if (rv) + { + DEBUG_SCARD(("SCARD: -> Failure: %s (0x%08x)\n", + pcsc_stringify_error(rv), (unsigned int) rv)); + } + else + { + DEBUG_SCARD(("SCARD: -> Success\n")); + } + + return rv; +} + +static MYPCSC_DWORD +TS_SCardIsValidContext(STREAM in, STREAM out) +{ + MYPCSC_DWORD rv; + SERVER_SCARDCONTEXT hContext; + char *readers; + DWORD readerCount = 1024; + PMEM_HANDLE lcHandle = NULL; + + in->p += 0x1C; + in_uint32_le(in, hContext); + DEBUG_SCARD(("SCARD: SCardIsValidContext(context: 0x%08x)\n", (unsigned) hContext)); + /* There is no realization of SCardIsValidContext in PC/SC Lite so we call SCardListReaders */ + + readers = SC_xmalloc(&lcHandle, 1024); + if (!readers) + return SC_returnNoMemoryError(&lcHandle, in, out); + + rv = SCardListReaders((MYPCSC_SCARDCONTEXT) hContext, NULL, readers, &readerCount); + + if (rv) + { + DEBUG_SCARD(("SCARD: -> Failure: %s (0x%08x)\n", + pcsc_stringify_error(rv), (unsigned int) rv)); + rv = SCARD_E_INVALID_HANDLE; + } + else + { + DEBUG_SCARD(("SCARD: -> Success\n")); + } + + outForceAlignment(out, 8); + SC_xfreeallmemory(&lcHandle); + return rv; +} + + +static MYPCSC_DWORD +TS_SCardListReaders(STREAM in, STREAM out, RD_BOOL wide) +{ +#define readerArraySize 1024 + MYPCSC_DWORD rv; + SERVER_SCARDCONTEXT hContext; + SERVER_DWORD dataLength; + MYPCSC_DWORD cchReaders = readerArraySize; + unsigned char *plen1, *plen2, *pend; + char *readers, *cur; + PMEM_HANDLE lcHandle = NULL; + + in->p += 0x2C; + in_uint32_le(in, hContext); + DEBUG_SCARD(("SCARD: SCardListReaders(context: 0x%08x)\n", (unsigned) hContext)); + plen1 = out->p; + out_uint32_le(out, 0x00000000); /* Temp value for data length as 0x0 */ + out_uint32_le(out, 0x01760650); + plen2 = out->p; + out_uint32_le(out, 0x00000000); /* Temp value for data length as 0x0 */ + + dataLength = 0; + readers = SC_xmalloc(&lcHandle, readerArraySize); + if (!readers) + return SC_returnNoMemoryError(&lcHandle, in, out); + + + readers[0] = '\0'; + readers[1] = '\0'; + rv = SCardListReaders((MYPCSC_SCARDCONTEXT) hContext, NULL, readers, &cchReaders); + cur = readers; + if (rv != SCARD_S_SUCCESS) + { + DEBUG_SCARD(("SCARD: -> Failure: %s (0x%08x)\n", + pcsc_stringify_error(rv), (unsigned int) rv)); + } + else + { + int i; + PSCNameMapRec tmpMap; + DEBUG_SCARD(("SCARD: -> Success\n")); + for (i = 0, tmpMap = nameMapList; i < nameMapCount; i++, tmpMap++) + { + dataLength += outString(out, tmpMap->alias, wide); + } + + int lenSC = strlen(cur); + if (lenSC == 0) + dataLength += outString(out, "\0", wide); + else + while (lenSC > 0) + { + if (!hasAlias(cur)) + { + DEBUG_SCARD(("SCARD: \"%s\"\n", cur)); + dataLength += outString(out, cur, wide); + } + cur = (void *) ((unsigned char *) cur + lenSC + 1); + lenSC = strlen(cur); + } + } + + dataLength += outString(out, "\0", wide); + outRepos(out, dataLength); + + pend = out->p; + out->p = plen1; + out_uint32_le(out, dataLength); + out->p = plen2; + out_uint32_le(out, dataLength); + out->p = pend; + + outForceAlignment(out, 8); + SC_xfreeallmemory(&lcHandle); + return rv; +} + + +static MYPCSC_DWORD +TS_SCardConnect(STREAM in, STREAM out, RD_BOOL wide) +{ + MYPCSC_DWORD rv; + SCARDCONTEXT hContext; + char *szReader; + SERVER_DWORD dwShareMode; + SERVER_DWORD dwPreferredProtocol; + MYPCSC_SCARDHANDLE myHCard; + SERVER_SCARDHANDLE hCard; + + MYPCSC_DWORD dwActiveProtocol; + PMEM_HANDLE lcHandle = NULL; + + in->p += 0x1C; + in_uint32_le(in, dwShareMode); + in_uint32_le(in, dwPreferredProtocol); + inReaderName(&lcHandle, in, &szReader, wide); + in->p += 0x04; + in_uint32_le(in, hContext); + DEBUG_SCARD(("SCARD: SCardConnect(context: 0x%08x, share: 0x%08x, proto: 0x%08x, reader: \"%s\")\n", (unsigned) hContext, (unsigned) dwShareMode, (unsigned) dwPreferredProtocol, szReader ? szReader : "NULL")); + rv = SCardConnect(hContext, szReader, (MYPCSC_DWORD) dwShareMode, + (MYPCSC_DWORD) dwPreferredProtocol, &myHCard, &dwActiveProtocol); + hCard = scHandleToServer(myHCard); + if (rv != SCARD_S_SUCCESS) + { + DEBUG_SCARD(("SCARD: -> Failure: %s (0x%08x)\n", + pcsc_stringify_error(rv), (unsigned int) rv)); + } + else + { + char *szVendor = getVendor(szReader); + DEBUG_SCARD(("SCARD: -> Success (hcard: 0x%08x [0x%08lx])\n", + (unsigned) hCard, (unsigned long) myHCard)); + if (szVendor && (strlen(szVendor) > 0)) + { + DEBUG_SCARD(("SCARD: Set Attribute ATTR_VENDOR_NAME\n")); + pthread_mutex_lock(&hcardAccess); + PSCHCardRec hcard = xmalloc(sizeof(TSCHCardRec)); + if (hcard) + { + hcard->hCard = hCard; + hcard->vendor = szVendor; + hcard->next = NULL; + hcard->prev = NULL; + + if (hcardFirst) + { + hcardFirst->prev = hcard; + hcard->next = hcardFirst; + } + hcardFirst = hcard; + } + pthread_mutex_unlock(&hcardAccess); + } + } + + out_uint32_le(out, 0x00000000); + out_uint32_le(out, 0x00000000); + out_uint32_le(out, 0x00000004); + out_uint32_le(out, 0x016Cff34); + /* if the active protocol > 4 billion, this is trouble. odds are low */ + out_uint32_le(out, (SERVER_DWORD) dwActiveProtocol); + out_uint32_le(out, 0x00000004); + out_uint32_le(out, hCard); + + outForceAlignment(out, 8); + SC_xfreeallmemory(&lcHandle); + return rv; +} + +static MYPCSC_DWORD +TS_SCardReconnect(STREAM in, STREAM out) +{ + MYPCSC_DWORD rv; + SCARDCONTEXT hContext; + SERVER_SCARDHANDLE hCard; + MYPCSC_SCARDHANDLE myHCard; + SERVER_DWORD dwShareMode; + SERVER_DWORD dwPreferredProtocol; + SERVER_DWORD dwInitialization; + MYPCSC_DWORD dwActiveProtocol; + + in->p += 0x20; + in_uint32_le(in, dwShareMode); + in_uint32_le(in, dwPreferredProtocol); + in_uint32_le(in, dwInitialization); + in->p += 0x04; + in_uint32_le(in, hContext); + in->p += 0x04; + in_uint32_le(in, hCard); + myHCard = scHandleToMyPCSC(hCard); + DEBUG_SCARD(("SCARD: SCardReconnect(context: 0x%08x, hcard: 0x%08x [0x%08lx], share: 0x%08x, proto: 0x%08x, init: 0x%08x)\n", (unsigned) hContext, (unsigned) hCard, (unsigned long) myHCard, (unsigned) dwShareMode, (unsigned) dwPreferredProtocol, (unsigned) dwInitialization)); + rv = SCardReconnect(myHCard, (MYPCSC_DWORD) dwShareMode, (MYPCSC_DWORD) dwPreferredProtocol, + (MYPCSC_DWORD) dwInitialization, &dwActiveProtocol); + if (rv != SCARD_S_SUCCESS) + { + DEBUG_SCARD(("SCARD: -> Failure: %s (0x%08x)\n", + pcsc_stringify_error(rv), (unsigned int) rv)); + } + else + { + DEBUG_SCARD(("SCARD: -> Success (proto: 0x%08x)\n", (unsigned) dwActiveProtocol)); + } + + outForceAlignment(out, 8); + out_uint32_le(out, (SERVER_DWORD) dwActiveProtocol); + return rv; +} + +static MYPCSC_DWORD +TS_SCardDisconnect(STREAM in, STREAM out) +{ + MYPCSC_DWORD rv; + SERVER_SCARDCONTEXT hContext; + SERVER_SCARDHANDLE hCard; + MYPCSC_SCARDHANDLE myHCard; + SERVER_DWORD dwDisposition; + + in->p += 0x20; + in_uint32_le(in, dwDisposition); + in->p += 0x04; + in_uint32_le(in, hContext); + in->p += 0x04; + in_uint32_le(in, hCard); + + DEBUG_SCARD(("SCARD: SCardDisconnect(context: 0x%08x, hcard: 0x%08x, disposition: 0x%08x)\n", (unsigned) hContext, (unsigned) hCard, (unsigned) dwDisposition)); + + pthread_mutex_lock(&hcardAccess); + PSCHCardRec hcard = hcardFirst; + while (hcard) + { + if (hcard->hCard == hCard) + { + if (hcard->prev) + hcard->prev->next = hcard->next; + if (hcard->next) + hcard->next->prev = hcard->prev; + if (hcardFirst == hcard) + hcardFirst = hcard->next; + xfree(hcard); + break; + } + hcard = hcard->next; + } + pthread_mutex_unlock(&hcardAccess); + + myHCard = scHandleToMyPCSC(hCard); + rv = SCardDisconnect(myHCard, (MYPCSC_DWORD) dwDisposition); + + if (rv != SCARD_S_SUCCESS) + { + DEBUG_SCARD(("SCARD: -> Failure: %s (0x%08x)\n", + pcsc_stringify_error(rv), (unsigned int) rv)); + } + else + { + DEBUG_SCARD(("SCARD: -> Success\n")); + } + + outForceAlignment(out, 8); + return rv; +} + +static int +needStatusRecheck(MYPCSC_DWORD rv, MYPCSC_LPSCARD_READERSTATE_A rsArray, SERVER_DWORD dwCount) +{ + int i, recall = 0; + if (rv == SCARD_S_SUCCESS) + { + MYPCSC_LPSCARD_READERSTATE_A cur; + for (i = 0, cur = rsArray; i < dwCount; i++, cur++) + { + if (cur->dwEventState & SCARD_STATE_UNKNOWN) + { + cur->dwCurrentState = cur->dwEventState; + recall++; + } + } + } + return recall; +} + +static RD_BOOL +mappedStatus(MYPCSC_DWORD code) +{ + code >>= 16; + code &= 0x0000FFFF; + return (code % 2); +} + +static MYPCSC_DWORD +incStatus(MYPCSC_DWORD code, RD_BOOL mapped) +{ + if (mapped || (code & SCARD_STATE_CHANGED)) + { + MYPCSC_DWORD count = (code >> 16) & 0x0000FFFF; + count++; + if (mapped && !(count % 2)) + count++; + return (code & 0x0000FFFF) | (count << 16); + } + else + return code; +} + +static void +copyReaderState_MyPCSCToServer(MYPCSC_LPSCARD_READERSTATE_A src, SERVER_LPSCARD_READERSTATE_A dst, + MYPCSC_DWORD readerCount) +{ + MYPCSC_LPSCARD_READERSTATE_A srcIter; + SERVER_LPSCARD_READERSTATE_A dstIter; + MYPCSC_DWORD i; + + for (i = 0, srcIter = src, dstIter = dst; i < readerCount; i++, srcIter++, dstIter++) + { + dstIter->szReader = srcIter->szReader; + dstIter->pvUserData = srcIter->pvUserData; + dstIter->dwCurrentState = srcIter->dwCurrentState; + dstIter->dwEventState = srcIter->dwEventState; + dstIter->cbAtr = srcIter->cbAtr; + memcpy(dstIter->rgbAtr, srcIter->rgbAtr, MAX_ATR_SIZE * sizeof(unsigned char)); + } +} + +static void +copyReaderState_ServerToMyPCSC(SERVER_LPSCARD_READERSTATE_A src, MYPCSC_LPSCARD_READERSTATE_A dst, + SERVER_DWORD readerCount) +{ + SERVER_LPSCARD_READERSTATE_A srcIter; + MYPCSC_LPSCARD_READERSTATE_A dstIter; + SERVER_DWORD i; + + for (i = 0, srcIter = src, dstIter = dst; i < readerCount; i++, srcIter++, dstIter++) + { + dstIter->szReader = srcIter->szReader; + dstIter->pvUserData = srcIter->pvUserData; + dstIter->dwCurrentState = srcIter->dwCurrentState; + dstIter->dwEventState = srcIter->dwEventState; + dstIter->cbAtr = srcIter->cbAtr; + memcpy(dstIter->rgbAtr, srcIter->rgbAtr, MAX_ATR_SIZE * sizeof(unsigned char)); + } +} + + +static MYPCSC_DWORD +TS_SCardGetStatusChange(STREAM in, STREAM out, RD_BOOL wide) +{ + MYPCSC_DWORD rv; + SERVER_SCARDCONTEXT hContext; + SERVER_DWORD dwTimeout; + SERVER_DWORD dwCount; + SERVER_LPSCARD_READERSTATE_A rsArray, cur; + SERVER_DWORD *stateArray = NULL, *curState; + MYPCSC_LPSCARD_READERSTATE_A myRsArray; + long i; + PMEM_HANDLE lcHandle = NULL; +#if 0 + RD_BOOL mapped = False; +#endif + + in->p += 0x18; + in_uint32_le(in, dwTimeout); + in_uint32_le(in, dwCount); + in->p += 0x08; + in_uint32_le(in, hContext); + in->p += 0x04; + + DEBUG_SCARD(("SCARD: SCardGetStatusChange(context: 0x%08x, timeout: 0x%08x, count: %d)\n", + (unsigned) hContext, (unsigned) dwTimeout, (int) dwCount)); + + if (dwCount > 0) + { + rsArray = SC_xmalloc(&lcHandle, dwCount * sizeof(SERVER_SCARD_READERSTATE_A)); + if (!rsArray) + return SC_returnNoMemoryError(&lcHandle, in, out); + memset(rsArray, 0, dwCount * sizeof(SERVER_SCARD_READERSTATE_A)); + stateArray = SC_xmalloc(&lcHandle, dwCount * sizeof(MYPCSC_DWORD)); + if (!stateArray) + return SC_returnNoMemoryError(&lcHandle, in, out); + /* skip two pointers at beginning of struct */ + for (i = 0, cur = (SERVER_LPSCARD_READERSTATE_A) ((unsigned char **) rsArray + 2); + i < dwCount; i++, cur++) + { + in->p += 0x04; + in_uint8a(in, cur, SERVER_SCARDSTATESIZE); + } + + for (i = 0, cur = rsArray, curState = stateArray; + i < dwCount; i++, cur++, curState++) + { + SERVER_DWORD dataLength; + + /* reset Current state hign bytes; */ + *curState = cur->dwCurrentState; + cur->dwCurrentState &= 0x0000FFFF; + cur->dwEventState &= 0x0000FFFF; + +#if 0 + if (cur->dwCurrentState == (SCARD_STATE_CHANGED | SCARD_STATE_PRESENT)) + { + cur->dwCurrentState = 0x00000000; + mapped = True; + } + + if (mappedStatus(*curState)) + { + cur->dwCurrentState &= ~SCARD_STATE_INUSE; + cur->dwEventState &= ~SCARD_STATE_INUSE; + + if (cur->dwCurrentState & SCARD_STATE_EMPTY) + { + cur->dwCurrentState &= ~SCARD_STATE_EMPTY; + cur->dwCurrentState |= SCARD_STATE_UNKNOWN; + } + } +#endif + + in->p += 0x08; + in_uint32_le(in, dataLength); + inRepos(in, + inString(&lcHandle, in, (char **) &(cur->szReader), dataLength, + wide)); + + if (strcmp(cur->szReader, "\\\\?PnP?\\Notification") == 0) + cur->dwCurrentState |= SCARD_STATE_IGNORE; + + DEBUG_SCARD(("SCARD: \"%s\"\n", cur->szReader ? cur->szReader : "NULL")); + DEBUG_SCARD(("SCARD: user: 0x%08x, state: 0x%08x, event: 0x%08x\n", + (unsigned) cur->pvUserData, (unsigned) cur->dwCurrentState, + (unsigned) cur->dwEventState)); + DEBUG_SCARD(("SCARD: current state: 0x%08x\n", + (unsigned) *curState)); + } + } + else + { + rsArray = NULL; + stateArray = NULL; + } + + myRsArray = SC_xmalloc(&lcHandle, dwCount * sizeof(MYPCSC_SCARD_READERSTATE_A)); + if (!rsArray) + return SC_returnNoMemoryError(&lcHandle, in, out); + memset(myRsArray, 0, dwCount * sizeof(SERVER_SCARD_READERSTATE_A)); + copyReaderState_ServerToMyPCSC(rsArray, myRsArray, (SERVER_DWORD) dwCount); + + rv = SCardGetStatusChange((MYPCSC_SCARDCONTEXT) hContext, (MYPCSC_DWORD) dwTimeout, + myRsArray, (MYPCSC_DWORD) dwCount); + copyReaderState_MyPCSCToServer(myRsArray, rsArray, (MYPCSC_DWORD) dwCount); + + if (rv != SCARD_S_SUCCESS) + { + DEBUG_SCARD(("SCARD: -> Failure: %s (0x%08x)\n", + pcsc_stringify_error(rv), (unsigned int) rv)); + } + else + { + DEBUG_SCARD(("SCARD: -> Success\n")); + } + + out_uint32_le(out, dwCount); + out_uint32_le(out, 0x00084dd8); + out_uint32_le(out, dwCount); + + for (i = 0, cur = rsArray, curState = stateArray; i < dwCount; i++, cur++, curState++) + { + + cur->dwCurrentState = (*curState); + cur->dwEventState |= (*curState) & 0xFFFF0000; + +#if 0 + if (mapped && (cur->dwCurrentState & SCARD_STATE_PRESENT) + && (cur->dwCurrentState & SCARD_STATE_CHANGED) + && (cur->dwEventState & SCARD_STATE_PRESENT) + && (cur->dwEventState & SCARD_STATE_CHANGED)) + { + cur->dwEventState |= SCARD_STATE_INUSE; + } + else if (cur->dwEventState & SCARD_STATE_UNKNOWN) + { + cur->dwEventState &= ~SCARD_STATE_UNKNOWN; + cur->dwEventState |= SCARD_STATE_EMPTY; + mapped = True; + } + else if ((!mapped) && (cur->dwEventState & SCARD_STATE_INUSE)) + { + mapped = True; + cur->dwEventState &= ~SCARD_STATE_INUSE; + } + + cur->dwEventState = incStatus(cur->dwEventState, mapped); +#endif + cur->dwEventState = incStatus(cur->dwEventState, False); + + DEBUG_SCARD(("SCARD: \"%s\"\n", cur->szReader ? cur->szReader : "NULL")); + DEBUG_SCARD(("SCARD: user: 0x%08x, state: 0x%08x, event: 0x%08x\n", + (unsigned) cur->pvUserData, (unsigned) cur->dwCurrentState, + (unsigned) cur->dwEventState)); + + out_uint8p(out, (void *) ((unsigned char **) cur + 2), + sizeof(SERVER_SCARD_READERSTATE_A) - 2 * sizeof(unsigned char *)); + } + outForceAlignment(out, 8); + SC_xfreeallmemory(&lcHandle); + return rv; +} + +static MYPCSC_DWORD +TS_SCardCancel(STREAM in, STREAM out) +{ + MYPCSC_DWORD rv; + SERVER_SCARDCONTEXT hContext; + + in->p += 0x1C; + in_uint32_le(in, hContext); + DEBUG_SCARD(("SCARD: SCardCancel(context: 0x%08x)\n", (unsigned) hContext)); + rv = SCardCancel((MYPCSC_SCARDCONTEXT) hContext); + if (rv != SCARD_S_SUCCESS) + { + DEBUG_SCARD(("SCARD: -> Failure: %s (0x%08x)\n", + pcsc_stringify_error(rv), (unsigned int) rv)); + } + else + { + DEBUG_SCARD(("SCARD: -> Success\n")); + } + outForceAlignment(out, 8); + return rv; +} + +static MYPCSC_DWORD +TS_SCardLocateCardsByATR(STREAM in, STREAM out, RD_BOOL wide) +{ + int i, j, k; + MYPCSC_DWORD rv; + SERVER_SCARDCONTEXT hContext; + /* The SCARD_ATRMASK_L struct doesn't contain any longs or DWORDs - + no need to split into SERVER_ and MYPCSC_ */ + LPSCARD_ATRMASK_L pAtrMasks, cur; + SERVER_DWORD atrMaskCount = 0; + SERVER_DWORD readerCount = 0; + SERVER_LPSCARD_READERSTATE_A rsArray, ResArray, rsCur; + MYPCSC_LPSCARD_READERSTATE_A myRsArray; + PMEM_HANDLE lcHandle = NULL; + + in->p += 0x2C; + in_uint32_le(in, hContext); + in_uint32_le(in, atrMaskCount); + pAtrMasks = SC_xmalloc(&lcHandle, atrMaskCount * sizeof(SCARD_ATRMASK_L)); + if (!pAtrMasks) + return SC_returnNoMemoryError(&lcHandle, in, out); + in_uint8a(in, pAtrMasks, atrMaskCount * sizeof(SCARD_ATRMASK_L)); + + in_uint32_le(in, readerCount); + rsArray = SC_xmalloc(&lcHandle, readerCount * sizeof(SCARD_READERSTATE_A)); + if (!rsArray) + return SC_returnNoMemoryError(&lcHandle, in, out); + memset(rsArray, 0, readerCount * sizeof(SCARD_READERSTATE_A)); + + DEBUG_SCARD(("SCARD: SCardLocateCardsByATR(context: 0x%08x, atrs: %d, readers: %d)\n", + (unsigned) hContext, (int) atrMaskCount, (int) readerCount)); + + for (i = 0, cur = pAtrMasks; i < atrMaskCount; i++, cur++) + { + DEBUG_SCARD(("SCARD: ATR: ")); + for (j = 0; j < pAtrMasks->cbAtr; j++) + { + DEBUG_SCARD(("%02x%c", + (unsigned) (unsigned char) cur->rgbAtr[j], + (j == pAtrMasks->cbAtr - 1) ? ' ' : ':'))} + DEBUG_SCARD(("\n")); + DEBUG_SCARD(("SCARD: ")); + for (j = 0; j < pAtrMasks->cbAtr; j++) + { + DEBUG_SCARD(("%02x%c", + (unsigned) (unsigned char) cur->rgbMask[j], + (j == pAtrMasks->cbAtr - 1) ? ' ' : ':'))} + DEBUG_SCARD(("\n")); + } + + for (i = 0, rsCur = (SERVER_LPSCARD_READERSTATE_A) ((unsigned char **) rsArray + 2); + i < readerCount; i++, rsCur++) + { + in_uint8s(in, 4); + in_uint8a(in, rsCur, SERVER_SCARDSTATESIZE); + } + + ResArray = SC_xmalloc(&lcHandle, readerCount * sizeof(SERVER_SCARD_READERSTATE_A)); + if (!ResArray) + return SC_returnNoMemoryError(&lcHandle, in, out); + memcpy(ResArray, rsArray, readerCount * sizeof(SERVER_SCARD_READERSTATE_A)); + + for (i = 0, rsCur = rsArray; i < readerCount; i++, rsCur++) + { + inReaderName(&lcHandle, in, (char **) &rsCur->szReader, wide); + DEBUG_SCARD(("SCARD: \"%s\"\n", rsCur->szReader ? rsCur->szReader : "NULL")); + DEBUG_SCARD(("SCARD: user: 0x%08x, state: 0x%08x, event: 0x%08x\n", + (unsigned) rsCur->pvUserData, (unsigned) rsCur->dwCurrentState, + (unsigned) rsCur->dwEventState)); + } + + /* FIXME segfault here. */ + myRsArray = SC_xmalloc(&lcHandle, readerCount * sizeof(MYPCSC_SCARD_READERSTATE_A)); + if (!myRsArray) + return SC_returnNoMemoryError(&lcHandle, in, out); + copyReaderState_ServerToMyPCSC(rsArray, myRsArray, readerCount); + rv = SCardGetStatusChange((MYPCSC_SCARDCONTEXT) hContext, 0x00000001, myRsArray, + readerCount); + copyReaderState_MyPCSCToServer(myRsArray, rsArray, readerCount); + if (rv != SCARD_S_SUCCESS) + { + DEBUG_SCARD(("SCARD: -> Failure: %s (0x%08x)\n", + pcsc_stringify_error(rv), (unsigned int) rv)); + } + else + { + DEBUG_SCARD(("SCARD: -> Success\n")); + cur = pAtrMasks; + for (i = 0, cur = pAtrMasks; i < atrMaskCount; i++, cur++) + { + for (j = 0, rsCur = rsArray; j < readerCount; j++, rsCur++) + { + RD_BOOL equal = 1; + for (k = 0; k < cur->cbAtr; k++) + { + if ((cur->rgbAtr[k] & cur->rgbMask[k]) != + (rsCur->rgbAtr[k] & cur->rgbMask[k])) + { + equal = 0; + break; + } + } + if (equal) + { + rsCur->dwEventState |= 0x00000040; /* SCARD_STATE_ATRMATCH 0x00000040 */ + memcpy(ResArray + j, rsCur, sizeof(SCARD_READERSTATE_A)); + DEBUG_SCARD(("SCARD: \"%s\"\n", + rsCur->szReader ? rsCur->szReader : "NULL")); + DEBUG_SCARD(("SCARD: user: 0x%08x, state: 0x%08x, event: 0x%08x\n", (unsigned) rsCur->pvUserData, (unsigned) rsCur->dwCurrentState, (unsigned) rsCur->dwEventState)); + } + } + } + } + + out_uint32_le(out, readerCount); + out_uint32_le(out, 0x00084dd8); + out_uint32_le(out, readerCount); + + for (i = 0, rsCur = rsArray; i < readerCount; i++, rsCur++) + { + out_uint8p(out, (void *) ((unsigned char **) rsCur + 2), + sizeof(SCARD_READERSTATE_A) - 2 * sizeof(unsigned char *)); + } + + outForceAlignment(out, 8); + SC_xfreeallmemory(&lcHandle); + return rv; +} + +static DWORD +TS_SCardBeginTransaction(STREAM in, STREAM out) +{ + MYPCSC_DWORD rv; + SERVER_SCARDCONTEXT hCard; + MYPCSC_SCARDCONTEXT myHCard; + + in->p += 0x30; + in_uint32_le(in, hCard); + myHCard = scHandleToMyPCSC(hCard); + DEBUG_SCARD(("SCARD: SCardBeginTransaction(hcard: 0x%08x [0x%08lx])\n", + (unsigned) hCard, (unsigned long) myHCard)); + rv = SCardBeginTransaction(myHCard); + if (rv != SCARD_S_SUCCESS) + { + DEBUG_SCARD(("SCARD: -> Failure: %s (0x%08x)\n", + pcsc_stringify_error(rv), (unsigned int) rv)); + } + else + { + DEBUG_SCARD(("SCARD: -> Success\n")); + } + outForceAlignment(out, 8); + return rv; +} + +static DWORD +TS_SCardEndTransaction(STREAM in, STREAM out) +{ + MYPCSC_DWORD rv; + SERVER_SCARDCONTEXT hCard; + MYPCSC_SCARDCONTEXT myHCard; + SERVER_DWORD dwDisposition = 0; + + in->p += 0x20; + in_uint32_le(in, dwDisposition); + in->p += 0x0C; + in_uint32_le(in, hCard); + myHCard = scHandleToMyPCSC(hCard); + + DEBUG_SCARD(("[hCard = 0x%.8x]\n", (unsigned int) hCard)); + DEBUG_SCARD(("[myHCard = 0x%016lx]\n", (unsigned long) myHCard)); + DEBUG_SCARD(("[dwDisposition = 0x%.8x]\n", (unsigned int) dwDisposition)); + + DEBUG_SCARD(("SCARD: SCardEndTransaction(hcard: 0x%08x [0x%08lx], disposition: 0x%08x)\n", + (unsigned) hCard, (unsigned long) myHCard, (unsigned) dwDisposition)); + rv = SCardEndTransaction(myHCard, (MYPCSC_DWORD) dwDisposition); + if (rv != SCARD_S_SUCCESS) + { + DEBUG_SCARD(("SCARD: -> Failure: %s (0x%08x)\n", + pcsc_stringify_error(rv), (unsigned int) rv)); + } + else + { + DEBUG_SCARD(("SCARD: -> Success\n")); + } + outForceAlignment(out, 8); + return rv; +} + + +static void +copyIORequest_MyPCSCToServer(MYPCSC_LPSCARD_IO_REQUEST src, SERVER_LPSCARD_IO_REQUEST dst) +{ + unsigned char *srcBytes, *dstBytes; + size_t bytesToCopy = src->cbPciLength - sizeof(MYPCSC_SCARD_IO_REQUEST); + srcBytes = ((unsigned char *) src + sizeof(MYPCSC_SCARD_IO_REQUEST)); + dstBytes = ((unsigned char *) dst + sizeof(SERVER_SCARD_IO_REQUEST)); + dst->dwProtocol = src->dwProtocol; + dst->cbPciLength = src->cbPciLength + - sizeof(MYPCSC_SCARD_IO_REQUEST) + sizeof(SERVER_SCARD_IO_REQUEST); + memcpy(dstBytes, srcBytes, bytesToCopy); +} + +static void +copyIORequest_ServerToMyPCSC(SERVER_LPSCARD_IO_REQUEST src, MYPCSC_LPSCARD_IO_REQUEST dst) +{ + unsigned char *srcBytes, *dstBytes; + size_t bytesToCopy = src->cbPciLength - sizeof(SERVER_SCARD_IO_REQUEST); + srcBytes = ((unsigned char *) src + sizeof(SERVER_SCARD_IO_REQUEST)); + dstBytes = ((unsigned char *) dst + sizeof(MYPCSC_SCARD_IO_REQUEST)); + dst->dwProtocol = src->dwProtocol; + dst->cbPciLength = src->cbPciLength + - sizeof(SERVER_SCARD_IO_REQUEST) + sizeof(MYPCSC_SCARD_IO_REQUEST); + memcpy(dstBytes, srcBytes, bytesToCopy); +} + + +static DWORD +TS_SCardTransmit(STREAM in, STREAM out) +{ + MYPCSC_DWORD rv; + SERVER_DWORD map[7], linkedLen; + void *tmp; + SERVER_SCARDCONTEXT hCard; + MYPCSC_SCARDCONTEXT myHCard; + SERVER_LPSCARD_IO_REQUEST pioSendPci, pioRecvPci; + MYPCSC_LPSCARD_IO_REQUEST myPioSendPci, myPioRecvPci; + unsigned char *sendBuf = NULL, *recvBuf = NULL; + SERVER_DWORD cbSendLength, cbRecvLength; + MYPCSC_DWORD myCbRecvLength; + PMEM_HANDLE lcHandle = NULL; + + in->p += 0x14; + in_uint32_le(in, map[0]); + in->p += 0x04; + in_uint32_le(in, map[1]); + pioSendPci = SC_xmalloc(&lcHandle, sizeof(SERVER_SCARD_IO_REQUEST)); + if (!pioSendPci) + return SC_returnNoMemoryError(&lcHandle, in, out); + in_uint8a(in, pioSendPci, sizeof(SERVER_SCARD_IO_REQUEST)); + in_uint32_le(in, map[2]); + in_uint32_le(in, cbSendLength); + in_uint32_le(in, map[3]); + in_uint32_le(in, map[4]); + in_uint32_le(in, map[5]); + in_uint32_le(in, cbRecvLength); + if (map[0] & INPUT_LINKED) + inSkipLinked(in); + + in->p += 0x04; + in_uint32_le(in, hCard); + myHCard = scHandleToMyPCSC(hCard); + + if (map[2] & INPUT_LINKED) + { + in_uint32_le(in, linkedLen); + pioSendPci->cbPciLength = linkedLen + sizeof(SERVER_SCARD_IO_REQUEST); + tmp = SC_xmalloc(&lcHandle, pioSendPci->cbPciLength); + if (!tmp) + return SC_returnNoMemoryError(&lcHandle, in, out); + in_uint8a(in, (void *) ((unsigned char *) tmp + sizeof(SERVER_SCARD_IO_REQUEST)), + linkedLen); + memcpy(tmp, pioSendPci, sizeof(SERVER_SCARD_IO_REQUEST)); + SC_xfree(&lcHandle, pioSendPci); + pioSendPci = tmp; + tmp = NULL; + } + else + pioSendPci->cbPciLength = sizeof(SERVER_SCARD_IO_REQUEST); + + if (map[3] & INPUT_LINKED) + { + in_uint32_le(in, linkedLen); + sendBuf = SC_xmalloc(&lcHandle, linkedLen); + if (!sendBuf) + return SC_returnNoMemoryError(&lcHandle, in, out); + in_uint8a(in, sendBuf, linkedLen); + inRepos(in, linkedLen); + } + else + sendBuf = NULL; + + if (cbRecvLength) + { + recvBuf = SC_xmalloc(&lcHandle, cbRecvLength); + if (!recvBuf) + return SC_returnNoMemoryError(&lcHandle, in, out); + } + + if (map[4] & INPUT_LINKED) + { + pioRecvPci = SC_xmalloc(&lcHandle, sizeof(SERVER_SCARD_IO_REQUEST)); + if (!pioRecvPci) + return SC_returnNoMemoryError(&lcHandle, in, out); + in_uint8a(in, pioRecvPci, sizeof(SERVER_SCARD_IO_REQUEST)); + in_uint32_le(in, map[6]); + if (map[6] & INPUT_LINKED) + { + in_uint32_le(in, linkedLen); + pioRecvPci->cbPciLength = linkedLen + sizeof(SERVER_SCARD_IO_REQUEST); + tmp = SC_xmalloc(&lcHandle, pioRecvPci->cbPciLength); + if (!tmp) + return SC_returnNoMemoryError(&lcHandle, in, out); + in_uint8a(in, + (void *) ((unsigned char *) tmp + + sizeof(SERVER_SCARD_IO_REQUEST)), linkedLen); + memcpy(tmp, pioRecvPci, sizeof(SERVER_SCARD_IO_REQUEST)); + SC_xfree(&lcHandle, pioRecvPci); + pioRecvPci = tmp; + tmp = NULL; + } + else + pioRecvPci->cbPciLength = sizeof(SERVER_SCARD_IO_REQUEST); + } + else + pioRecvPci = NULL; + + DEBUG_SCARD(("SCARD: SCardTransmit(hcard: 0x%08x [0x%08lx], send: %d bytes, recv: %d bytes)\n", (unsigned) hCard, (unsigned long) myHCard, (int) cbSendLength, (int) cbRecvLength)); + + myCbRecvLength = cbRecvLength; + myPioSendPci = SC_xmalloc(&lcHandle, + sizeof(MYPCSC_SCARD_IO_REQUEST) + + pioSendPci->cbPciLength - sizeof(SERVER_SCARD_IO_REQUEST)); + if (!myPioSendPci) + return SC_returnNoMemoryError(&lcHandle, in, out); + copyIORequest_ServerToMyPCSC(pioSendPci, myPioSendPci); + /* always a send, not always a recv */ + if (pioRecvPci) + { + myPioRecvPci = SC_xmalloc(&lcHandle, + sizeof(MYPCSC_SCARD_IO_REQUEST) + + pioRecvPci->cbPciLength + - sizeof(SERVER_SCARD_IO_REQUEST)); + if (!myPioRecvPci) + return SC_returnNoMemoryError(&lcHandle, in, out); + copyIORequest_ServerToMyPCSC(pioRecvPci, myPioRecvPci); + } + else + { + myPioRecvPci = NULL; + } + rv = SCardTransmit(myHCard, myPioSendPci, sendBuf, (MYPCSC_DWORD) cbSendLength, + myPioRecvPci, recvBuf, &myCbRecvLength); + cbRecvLength = myCbRecvLength; + + /* FIXME: handle responses with length > 448 bytes */ + if (cbRecvLength > 448) + { + warning("Card response limited from %d to 448 bytes!\n", cbRecvLength); + DEBUG_SCARD(("SCARD: Truncated %d to %d\n", (unsigned int) cbRecvLength, 448)); + cbRecvLength = 448; + } + + if (pioRecvPci) + { + /* + * pscs-lite mishandles this structure in some cases. + * make sure we only copy it if it is valid. + */ + if (myPioRecvPci->cbPciLength >= sizeof(MYPCSC_SCARD_IO_REQUEST)) + copyIORequest_MyPCSCToServer(myPioRecvPci, pioRecvPci); + } + + if (rv != SCARD_S_SUCCESS) + { + DEBUG_SCARD(("SCARD: -> Failure: %s (0x%08x)\n", + pcsc_stringify_error(rv), (unsigned int) rv)); + } + else + { + DEBUG_SCARD(("SCARD: -> Success (%d bytes)\n", (int) cbRecvLength)); +#if 0 + if ((pioRecvPci != NULL) && (pioRecvPci->cbPciLength > 0)) + { + out_uint32_le(out, (DWORD) pioRecvPci); /* if not NULL, this 4 bytes indicates that pioRecvPci is present */ + } + else +#endif + out_uint32_le(out, 0); /* pioRecvPci 0x00; */ + + outBufferStart(out, cbRecvLength); /* start of recvBuf output */ + +#if 0 + if ((pioRecvPci) && (pioRecvPci->cbPciLength > 0)) + { + out_uint32_le(out, pioRecvPci->dwProtocol); + int len = pioRecvPci->cbPciLength - sizeof(pioRecvPci); + outBufferStartWithLimit(out, len, 12); + outBufferFinishWithLimit(out, + (char *) ((DWORD) pioRecvPci + sizeof(pioRecvPci)), + len, 12); + } +#endif + + outBufferFinish(out, (char *) recvBuf, cbRecvLength); + } + outForceAlignment(out, 8); + SC_xfreeallmemory(&lcHandle); + return rv; +} + +static MYPCSC_DWORD +TS_SCardStatus(STREAM in, STREAM out, RD_BOOL wide) +{ + MYPCSC_DWORD rv; + SERVER_SCARDCONTEXT hCard; + MYPCSC_SCARDCONTEXT myHCard; + SERVER_DWORD dwState = 0, dwProtocol = 0, dwReaderLen, dwAtrLen; + MYPCSC_DWORD state, protocol, readerLen, atrLen; + SERVER_DWORD dataLength; + PMEM_HANDLE lcHandle = NULL; + char *readerName; + unsigned char *atr; + + in->p += 0x24; + in_uint32_le(in, dwReaderLen); + in_uint32_le(in, dwAtrLen); + in->p += 0x0C; + in_uint32_le(in, hCard); + in->p += 0x04; + myHCard = scHandleToMyPCSC(hCard); + + DEBUG_SCARD(("SCARD: SCardStatus(hcard: 0x%08x [0x%08lx], reader len: %d bytes, atr len: %d bytes)\n", (unsigned) hCard, (unsigned long) myHCard, (int) dwReaderLen, (int) dwAtrLen)); + + if (dwReaderLen <= 0 || dwReaderLen == SCARD_AUTOALLOCATE || dwReaderLen > SCARD_MAX_MEM) + dwReaderLen = SCARD_MAX_MEM; + if (dwAtrLen <= 0 || dwAtrLen == SCARD_AUTOALLOCATE || dwAtrLen > SCARD_MAX_MEM) + dwAtrLen = SCARD_MAX_MEM; + + readerName = SC_xmalloc(&lcHandle, dwReaderLen + 2); + if (!readerName) + return SC_returnNoMemoryError(&lcHandle, in, out); + + atr = SC_xmalloc(&lcHandle, dwAtrLen + 1); + if (!atr) + return SC_returnNoMemoryError(&lcHandle, in, out); + + state = dwState; + protocol = dwProtocol; + readerLen = dwReaderLen; + atrLen = dwAtrLen; + rv = SCardStatus(myHCard, readerName, &readerLen, &state, &protocol, atr, &atrLen); + dwAtrLen = atrLen; + dwReaderLen = readerLen; + dwProtocol = protocol; + dwState = state; + + + if (rv != SCARD_S_SUCCESS) + { + DEBUG_SCARD(("SCARD: -> Failure: %s (0x%08x)\n", + pcsc_stringify_error(rv), (unsigned int) rv)); + return SC_returnCode(rv, &lcHandle, in, out); + } + else + { + int i; + + DEBUG_SCARD(("SCARD: -> Success (state: 0x%08x, proto: 0x%08x)\n", + (unsigned) dwState, (unsigned) dwProtocol)); + DEBUG_SCARD(("SCARD: Reader: \"%s\"\n", readerName ? readerName : "NULL")); + DEBUG_SCARD(("SCARD: ATR: ")); + for (i = 0; i < dwAtrLen; i++) + { + DEBUG_SCARD(("%02x%c", atr[i], (i == dwAtrLen - 1) ? ' ' : ':')); + } + DEBUG_SCARD(("\n")); + + if (dwState & (SCARD_SPECIFIC | SCARD_NEGOTIABLE)) + dwState = 0x00000006; + else +#if 0 + if (dwState & SCARD_SPECIFIC) + dwState = 0x00000006; + else if (dwState & SCARD_NEGOTIABLE) + dwState = 0x00000005; + else +#endif + if (dwState & SCARD_POWERED) + dwState = 0x00000004; + else if (dwState & SCARD_SWALLOWED) + dwState = 0x00000003; + else if (dwState & SCARD_PRESENT) + dwState = 0x00000002; + else if (dwState & SCARD_ABSENT) + dwState = 0x00000001; + else + dwState = 0x00000000; + + void *p_len1 = out->p; + out_uint32_le(out, dwReaderLen); + out_uint32_le(out, 0x00020000); + out_uint32_le(out, dwState); + out_uint32_le(out, dwProtocol); + out_uint8p(out, atr, dwAtrLen); + if (dwAtrLen < 32) + { + out_uint8s(out, 32 - dwAtrLen); + } + out_uint32_le(out, dwAtrLen); + + void *p_len2 = out->p; + out_uint32_le(out, dwReaderLen); + dataLength = outString(out, readerName, wide); + dataLength += outString(out, "\0", wide); + outRepos(out, dataLength); + void *psave = out->p; + out->p = p_len1; + out_uint32_le(out, dataLength); + out->p = p_len2; + out_uint32_le(out, dataLength); + out->p = psave; + } + outForceAlignment(out, 8); + SC_xfreeallmemory(&lcHandle); + return rv; +} + +static MYPCSC_DWORD +TS_SCardState(STREAM in, STREAM out) +{ + MYPCSC_DWORD rv; + SERVER_SCARDCONTEXT hCard; + MYPCSC_SCARDCONTEXT myHCard; + SERVER_DWORD dwState = 0, dwProtocol = 0, dwReaderLen, dwAtrLen; + MYPCSC_DWORD state, protocol, readerLen, atrLen; + PMEM_HANDLE lcHandle = NULL; + char *readerName; + unsigned char *atr; + + in->p += 0x24; + in_uint32_le(in, dwAtrLen); + in->p += 0x0C; + in_uint32_le(in, hCard); + in->p += 0x04; + myHCard = scHandleToMyPCSC(hCard); + + DEBUG_SCARD(("SCARD: SCardState(hcard: 0x%08x [0x%08lx], atr len: %d bytes)\n", + (unsigned) hCard, (unsigned long) myHCard, (int) dwAtrLen)); + + dwReaderLen = SCARD_MAX_MEM; + if (dwAtrLen <= 0 || dwAtrLen == SCARD_AUTOALLOCATE || dwAtrLen > SCARD_MAX_MEM) + dwAtrLen = SCARD_MAX_MEM; + + readerName = SC_xmalloc(&lcHandle, dwReaderLen + 2); + if (!readerName) + return SC_returnNoMemoryError(&lcHandle, in, out); + + atr = SC_xmalloc(&lcHandle, dwAtrLen + 1); + if (!atr) + return SC_returnNoMemoryError(&lcHandle, in, out); + + state = dwState; + protocol = dwProtocol; + readerLen = dwReaderLen; + atrLen = dwAtrLen; + rv = SCardStatus(myHCard, readerName, &readerLen, &state, &protocol, atr, &atrLen); + dwAtrLen = atrLen; + dwReaderLen = readerLen; + dwProtocol = protocol; + dwState = state; + + if (rv != SCARD_S_SUCCESS) + { + DEBUG_SCARD(("SCARD: -> Failure: %s (0x%08x)\n", + pcsc_stringify_error(rv), (unsigned int) rv)); + return SC_returnCode(rv, &lcHandle, in, out); + } + else + { + int i; + + DEBUG_SCARD(("SCARD: -> Success (state: 0x%08x, proto: 0x%08x)\n", + (unsigned) dwState, (unsigned) dwProtocol)); + DEBUG_SCARD(("SCARD: ATR: ")); + for (i = 0; i < dwAtrLen; i++) + { + DEBUG_SCARD(("%02x%c", atr[i], (i == dwAtrLen - 1) ? ' ' : ':')); + } + DEBUG_SCARD(("\n")); + + if (dwState & (SCARD_SPECIFIC | SCARD_NEGOTIABLE)) + dwState = 0x00000006; + else +#if 0 + if (dwState & SCARD_SPECIFIC) + dwState = 0x00000006; + else if (dwState & SCARD_NEGOTIABLE) + dwState = 0x00000005; + else +#endif + if (dwState & SCARD_POWERED) + dwState = 0x00000004; + else if (dwState & SCARD_SWALLOWED) + dwState = 0x00000003; + else if (dwState & SCARD_PRESENT) + dwState = 0x00000002; + else if (dwState & SCARD_ABSENT) + dwState = 0x00000001; + else + dwState = 0x00000000; + + out_uint32_le(out, dwState); + out_uint32_le(out, dwProtocol); + out_uint32_le(out, dwAtrLen); + out_uint32_le(out, 0x00000001); + out_uint32_le(out, dwAtrLen); + out_uint8p(out, atr, dwAtrLen); + outRepos(out, dwAtrLen); + } + outForceAlignment(out, 8); + SC_xfreeallmemory(&lcHandle); + return rv; +} + + + +#ifndef WITH_PCSC120 + +static MYPCSC_DWORD +TS_SCardListReaderGroups(STREAM in, STREAM out) +{ + MYPCSC_DWORD rv; + SERVER_SCARDCONTEXT hContext; + SERVER_DWORD dwGroups; + MYPCSC_DWORD groups; + char *szGroups; + PMEM_HANDLE lcHandle = NULL; + + in->p += 0x20; + in_uint32_le(in, dwGroups); + in->p += 0x04; + in_uint32_le(in, hContext); + + DEBUG_SCARD(("SCARD: SCardListReaderGroups(context: 0x%08x, groups: %d)\n", + (unsigned) hContext, (int) dwGroups)); + + if (dwGroups <= 0 || dwGroups == SCARD_AUTOALLOCATE || dwGroups > SCARD_MAX_MEM) + dwGroups = SCARD_MAX_MEM; + + szGroups = SC_xmalloc(&lcHandle, dwGroups); + if (!szGroups) + return SC_returnNoMemoryError(&lcHandle, in, out); + + groups = dwGroups; + rv = SCardListReaderGroups((MYPCSC_SCARDCONTEXT) hContext, szGroups, &groups); + dwGroups = groups; + + if (rv) + { + DEBUG_SCARD(("SCARD: -> Failure: %s (0x%08x)\n", + pcsc_stringify_error(rv), (unsigned int) rv)); + return SC_returnCode(rv, &lcHandle, in, out); + } + else + { + int i; + char *cur; + + DEBUG_SCARD(("SCARD: -> Success\n")); + for (i = 0, cur = szGroups; i < dwGroups; i++, cur += strlen(cur) + 1) + { + DEBUG_SCARD(("SCARD: %s\n", cur)); + } + } + + + out_uint32_le(out, dwGroups); + out_uint32_le(out, 0x00200000); + out_uint32_le(out, dwGroups); + out_uint8a(out, szGroups, dwGroups); + outRepos(out, dwGroups); + out_uint32_le(out, 0x00000000); + + outForceAlignment(out, 8); + SC_xfreeallmemory(&lcHandle); + return rv; +} + +static MYPCSC_DWORD +TS_SCardGetAttrib(STREAM in, STREAM out) +{ + MYPCSC_DWORD rv; + SERVER_SCARDCONTEXT hCard; + MYPCSC_SCARDCONTEXT myHCard; + SERVER_DWORD dwAttrId, dwAttrLen; + MYPCSC_DWORD attrLen; + unsigned char *pbAttr; + PMEM_HANDLE lcHandle = NULL; + + in->p += 0x20; + in_uint32_le(in, dwAttrId); + in->p += 0x04; + in_uint32_le(in, dwAttrLen); + in->p += 0x0C; + in_uint32_le(in, hCard); + myHCard = scHandleToMyPCSC(hCard); + + dwAttrId = dwAttrId & 0x0000FFFF; + + DEBUG_SCARD(("SCARD: SCardGetAttrib(hcard: 0x%08x [0x%08lx], attrib: 0x%08x (%d bytes))\n", + (unsigned) hCard, (unsigned long) myHCard, + (unsigned) dwAttrId, (int) dwAttrLen)); + + if (dwAttrLen > MAX_BUFFER_SIZE) + dwAttrLen = MAX_BUFFER_SIZE; + + + if (dwAttrLen > SCARD_AUTOALLOCATE) + pbAttr = NULL; + else if ((dwAttrLen < 0) || (dwAttrLen > SCARD_MAX_MEM)) + { + dwAttrLen = SCARD_AUTOALLOCATE; + pbAttr = NULL; + } + else + { + pbAttr = SC_xmalloc(&lcHandle, dwAttrLen); + if (!pbAttr) + return SC_returnNoMemoryError(&lcHandle, in, out); + } + + attrLen = dwAttrLen; + rv = SCardGetAttrib(myHCard, (MYPCSC_DWORD) dwAttrId, pbAttr, &attrLen); + dwAttrLen = attrLen; + + if (dwAttrId == 0x00000100 && rv != SCARD_S_SUCCESS) + { + DEBUG_SCARD(("SCARD: Faking attribute ATTR_VENDOR_NAME\n")); + pthread_mutex_lock(&hcardAccess); + PSCHCardRec hcard = hcardFirst; + while (hcard) + { + if (hcard->hCard == hCard) + { + dwAttrLen = strlen(hcard->vendor); + memcpy(pbAttr, hcard->vendor, dwAttrLen); + rv = SCARD_S_SUCCESS; + break; + } + hcard = hcard->next; + } + pthread_mutex_unlock(&hcardAccess); + DEBUG_SCARD(("[0x%.8x]\n", (unsigned int) rv)); + } + + if (rv != SCARD_S_SUCCESS) + { + DEBUG_SCARD(("SCARD: -> Failure: %s (0x%08x)\n", + pcsc_stringify_error(rv), (unsigned int) rv)); + return SC_returnCode(rv, &lcHandle, in, out); + } + else + { + DEBUG_SCARD(("SCARD: -> Success (%d bytes)\n", (int) dwAttrLen)); + + out_uint32_le(out, dwAttrLen); + out_uint32_le(out, 0x00000200); + out_uint32_le(out, dwAttrLen); + if (!pbAttr) + { + out_uint8s(out, dwAttrLen); + } + else + { + out_uint8p(out, pbAttr, dwAttrLen); + } + outRepos(out, dwAttrLen); + out_uint32_le(out, 0x00000000); + } + outForceAlignment(out, 8); + return rv; +} + +static MYPCSC_DWORD +TS_SCardSetAttrib(STREAM in, STREAM out) +{ + MYPCSC_DWORD rv; + SERVER_SCARDCONTEXT hCard; + MYPCSC_SCARDCONTEXT myHCard; + SERVER_DWORD dwAttrId; + SERVER_DWORD dwAttrLen; + unsigned char *pbAttr; + PMEM_HANDLE lcHandle = NULL; + + in->p += 0x20; + in_uint32_le(in, dwAttrId); + in->p += 0x04; + in_uint32_le(in, dwAttrLen); + in->p += 0x0C; + in_uint32_le(in, hCard); + myHCard = scHandleToMyPCSC(hCard); + + dwAttrId = dwAttrId & 0x0000FFFF; + + DEBUG_SCARD(("SCARD: SCardSetAttrib(hcard: 0x%08x [0x%08lx], attrib: 0x%08x (%d bytes))\n", + (unsigned) hCard, (unsigned long) myHCard, + (unsigned) dwAttrId, (int) dwAttrLen)); + + if (dwAttrLen > MAX_BUFFER_SIZE) + dwAttrLen = MAX_BUFFER_SIZE; + + pbAttr = SC_xmalloc(&lcHandle, dwAttrLen); + if (!pbAttr) + return SC_returnNoMemoryError(&lcHandle, in, out); + + in_uint8a(in, pbAttr, dwAttrLen); + rv = SCardSetAttrib(myHCard, (MYPCSC_DWORD) dwAttrId, pbAttr, (MYPCSC_DWORD) dwAttrLen); + + if (rv != SCARD_S_SUCCESS) + { + DEBUG_SCARD(("SCARD: -> Failure: %s (0x%08x)\n", + pcsc_stringify_error(rv), (unsigned int) rv)); + } + else + { + DEBUG_SCARD(("SCARD: -> Success\n")); + } + + out_uint32_le(out, 0x00000000); + out_uint32_le(out, 0x00000200); + out_uint32_le(out, 0x00000000); + out_uint32_le(out, 0x00000000); + outForceAlignment(out, 8); + SC_xfreeallmemory(&lcHandle); + return rv; +} + +#endif + +static MYPCSC_DWORD +TS_SCardControl(STREAM in, STREAM out) +{ + MYPCSC_DWORD rv; + SERVER_SCARDCONTEXT hContext; + SERVER_SCARDHANDLE hCard; + MYPCSC_SCARDHANDLE myHCard; + SERVER_DWORD map[3]; + SERVER_DWORD dwControlCode; + unsigned char *pInBuffer, *pOutBuffer; + SERVER_DWORD nInBufferSize, nOutBufferSize, nOutBufferRealSize, nBytesReturned; + MYPCSC_DWORD sc_nBytesReturned; + PMEM_HANDLE lcHandle = NULL; + + pInBuffer = NULL; + pOutBuffer = NULL; + + in->p += 0x14; + in_uint32_le(in, map[0]); + in->p += 0x04; + in_uint32_le(in, map[1]); + in_uint32_le(in, dwControlCode); + in_uint32_le(in, nInBufferSize); + in_uint32_le(in, map[2]); + in->p += 0x04; + in_uint32_le(in, nOutBufferSize); + in->p += 0x04; + in_uint32_le(in, hContext); + in->p += 0x04; + in_uint32_le(in, hCard); + if (map[2] & INPUT_LINKED) + { + /* read real input size */ + in_uint32_le(in, nInBufferSize); + pInBuffer = SC_xmalloc(&lcHandle, nInBufferSize); + if (!pInBuffer) + return SC_returnNoMemoryError(&lcHandle, in, out); + in_uint8a(in, pInBuffer, nInBufferSize); + } + +#if 0 + if (nOutBufferSize > 0) + { + nOutBufferRealSize = nOutBufferSize; + } + else +#endif + nOutBufferRealSize = 1024; + + nBytesReturned = nOutBufferRealSize; + + nBytesReturned = nOutBufferRealSize; + pOutBuffer = SC_xmalloc(&lcHandle, nOutBufferRealSize); + if (!pOutBuffer) + return SC_returnNoMemoryError(&lcHandle, in, out); + + DEBUG_SCARD(("SCARD: SCardControl(context: 0x%08x, hcard: 0x%08x, code: 0x%08x, in: %d bytes, out: %d bytes)\n", (unsigned) hContext, (unsigned) hCard, (unsigned) dwControlCode, (int) nInBufferSize, (int) nOutBufferSize)); + + sc_nBytesReturned = nBytesReturned; + myHCard = scHandleToMyPCSC(hCard); +#ifdef WITH_PCSC120 + rv = SCardControl(myHCard, pInBuffer, (MYPCSC_DWORD) nInBufferSize, pOutBuffer, + &sc_nBytesReturned); +#else + rv = SCardControl(myHCard, (MYPCSC_DWORD) dwControlCode, pInBuffer, + (MYPCSC_DWORD) nInBufferSize, pOutBuffer, + (MYPCSC_DWORD) nOutBufferRealSize, &sc_nBytesReturned); +#endif + nBytesReturned = sc_nBytesReturned; + + if (rv != SCARD_S_SUCCESS) + { + DEBUG_SCARD(("SCARD: -> Failure: %s (0x%08x)\n", + pcsc_stringify_error(rv), (unsigned int) rv)); + } + else + { + DEBUG_SCARD(("SCARD: -> Success (out: %d bytes)\n", (int) nBytesReturned)); + } + + out_uint32_le(out, nBytesReturned); + out_uint32_le(out, 0x00000004); + out_uint32_le(out, nBytesReturned); + if (nBytesReturned > 0) + { + out_uint8p(out, pOutBuffer, nBytesReturned); + outRepos(out, nBytesReturned); + } + + outForceAlignment(out, 8); + SC_xfreeallmemory(&lcHandle); + return rv; +} + +static MYPCSC_DWORD +TS_SCardAccessStartedEvent(STREAM in, STREAM out) +{ + DEBUG_SCARD(("SCARD: SCardAccessStartedEvent()\n")); + out_uint8s(out, 8); + return SCARD_S_SUCCESS; +} + + +static RD_NTSTATUS +scard_device_control(RD_NTHANDLE handle, uint32 request, STREAM in, STREAM out) +{ + SERVER_DWORD Result = 0x00000000; + unsigned char *psize, *pend, *pStatusCode; + SERVER_DWORD addToEnd = 0; + + /* Processing request */ + + out_uint32_le(out, 0x00081001); /* Header lines */ + out_uint32_le(out, 0xCCCCCCCC); + psize = out->p; + out_uint32_le(out, 0x00000000); /* Size of data portion */ + out_uint32_le(out, 0x00000000); /* Zero bytes (may be usefull) */ + pStatusCode = out->p; + out_uint32_le(out, 0x00000000); /* Status Code */ + + switch (request) + { + /* SCardEstablishContext */ + case SC_ESTABLISH_CONTEXT: + { + Result = (SERVER_DWORD) TS_SCardEstablishContext(in, out); + break; + } + /* SCardReleaseContext */ + case SC_RELEASE_CONTEXT: + { + Result = (SERVER_DWORD) TS_SCardReleaseContext(in, out); + break; + } + /* SCardIsValidContext */ + case SC_IS_VALID_CONTEXT: + { + Result = (SERVER_DWORD) TS_SCardIsValidContext(in, out); + break; + } + /* SCardListReaders */ + case SC_LIST_READERS: /* SCardListReadersA */ + case SC_LIST_READERS + 4: /* SCardListReadersW */ + { + RD_BOOL wide = request != SC_LIST_READERS; + Result = (SERVER_DWORD) TS_SCardListReaders(in, out, wide); + break; + } + /* ScardConnect */ + case SC_CONNECT: /* ScardConnectA */ + case SC_CONNECT + 4: /* SCardConnectW */ + { + RD_BOOL wide = request != SC_CONNECT; + Result = (SERVER_DWORD) TS_SCardConnect(in, out, wide); + break; + } + /* ScardReconnect */ + case SC_RECONNECT: + { + Result = (SERVER_DWORD) TS_SCardReconnect(in, out); + break; + } + /* ScardDisconnect */ + case SC_DISCONNECT: + { + Result = (SERVER_DWORD) TS_SCardDisconnect(in, out); + break; + } + /* ScardGetStatusChange */ + case SC_GET_STATUS_CHANGE: /* SCardGetStatusChangeA */ + case SC_GET_STATUS_CHANGE + 4: /* SCardGetStatusChangeW */ + { + RD_BOOL wide = request != SC_GET_STATUS_CHANGE; + Result = (SERVER_DWORD) TS_SCardGetStatusChange(in, out, wide); + break; + } + /* SCardCancel */ + case SC_CANCEL: + { + Result = (SERVER_DWORD) TS_SCardCancel(in, out); + break; + } + /* SCardLocateCardsByATR */ + case SC_LOCATE_CARDS_BY_ATR: /* SCardLocateCardsByATRA */ + case SC_LOCATE_CARDS_BY_ATR + 4: /* SCardLocateCardsByATRW */ + { + RD_BOOL wide = request != SC_LOCATE_CARDS_BY_ATR; + Result = (SERVER_DWORD) TS_SCardLocateCardsByATR(in, out, wide); + break; + } + /* SCardBeginTransaction */ + case SC_BEGIN_TRANSACTION: + { + Result = (SERVER_DWORD) TS_SCardBeginTransaction(in, out); + break; + } + /* SCardBeginTransaction */ + case SC_END_TRANSACTION: + { + Result = (SERVER_DWORD) TS_SCardEndTransaction(in, out); + break; + } + /* ScardTransmit */ + case SC_TRANSMIT: + { + Result = (SERVER_DWORD) TS_SCardTransmit(in, out); + break; + } + /* SCardControl */ + case SC_CONTROL: + { + Result = (SERVER_DWORD) TS_SCardControl(in, out); + break; + } + /* SCardGetAttrib */ +#ifndef WITH_PCSC120 + case SC_GETATTRIB: + { + Result = (SERVER_DWORD) TS_SCardGetAttrib(in, out); + break; + } +#endif + case SC_ACCESS_STARTED_EVENT: + { + Result = (SERVER_DWORD) TS_SCardAccessStartedEvent(in, out); + break; + } + case SC_STATUS: /* SCardStatusA */ + case SC_STATUS + 4: /* SCardStatusW */ + { + RD_BOOL wide = request != SC_STATUS; + Result = (SERVER_DWORD) TS_SCardStatus(in, out, wide); + break; + } + case SC_STATE: /* SCardState */ + { + Result = (SERVER_DWORD) TS_SCardState(in, out); + break; + } + default: + { + warning("SCARD: Unknown function %d\n", (int) request); + Result = 0x80100014; + out_uint8s(out, 256); + break; + } + } + +#if 0 + out_uint32_le(out, 0x00000000); +#endif + /* Setting modified variables */ + pend = out->p; + /* setting data size */ + out->p = psize; + out_uint32_le(out, pend - psize - 16); + /* setting status code */ + out->p = pStatusCode; + out_uint32_le(out, Result); + /* finish */ + out->p = pend; + + addToEnd = (pend - pStatusCode) % 16; + if (addToEnd < 16 && addToEnd > 0) + { + out_uint8s(out, addToEnd); + } + + return RD_STATUS_SUCCESS; +} + +/* Thread functions */ + +static STREAM +duplicateStream(PMEM_HANDLE * handle, STREAM s, uint32 buffer_size, RD_BOOL isInputStream) +{ + STREAM d = SC_xmalloc(handle, sizeof(struct stream)); + if (d != NULL) + { + if (isInputStream) + d->size = (size_t) (s->end) - (size_t) (s->data); + else if (buffer_size < s->size) + d->size = s->size; + else + d->size = buffer_size; + + d->data = SC_xmalloc(handle, d->size); + + d->end = (void *) ((size_t) (d->data) + (size_t) (s->end) - (size_t) (s->data)); + d->p = (void *) ((size_t) (d->data) + (size_t) (s->p) - (size_t) (s->data)); + d->iso_hdr = + (void *) ((size_t) (d->data) + (size_t) (s->iso_hdr) - (size_t) (s->data)); + d->mcs_hdr = + (void *) ((size_t) (d->data) + (size_t) (s->mcs_hdr) - (size_t) (s->data)); + d->sec_hdr = + (void *) ((size_t) (d->data) + (size_t) (s->sec_hdr) - (size_t) (s->data)); + d->sec_hdr = + (void *) ((size_t) (d->data) + (size_t) (s->sec_hdr) - (size_t) (s->data)); + d->rdp_hdr = + (void *) ((size_t) (d->data) + (size_t) (s->rdp_hdr) - (size_t) (s->data)); + d->channel_hdr = + (void *) ((size_t) (d->data) + (size_t) (s->channel_hdr) - + (size_t) (s->data)); + if (isInputStream) + memcpy(d->data, s->data, (size_t) (s->end) - (size_t) (s->data)); + else + memcpy(d->data, s->data, (size_t) (s->p) - (size_t) (s->data)); + } + return d; +} + +static void +freeStream(PMEM_HANDLE * handle, STREAM s) +{ + if (s != NULL) + { + if (s->data != NULL) + SC_xfree(handle, s->data); + SC_xfree(handle, s); + } +} + +static PSCThreadData +SC_addToQueue(RD_NTHANDLE handle, uint32 request, STREAM in, STREAM out) +{ + PMEM_HANDLE lcHandle = NULL; + PSCThreadData data = SC_xmalloc(&lcHandle, sizeof(TSCThreadData)); + + if (!data) + return NULL; + else + { + data->memHandle = lcHandle; + data->device = curDevice; + data->id = curId; + data->handle = handle; + data->request = request; + data->in = duplicateStream(&(data->memHandle), in, 0, SC_TRUE); + if (data->in == NULL) + { + SC_xfreeallmemory(&(data->memHandle)); + return NULL; + } + data->out = + duplicateStream(&(data->memHandle), out, OUT_STREAM_SIZE + curBytesOut, + SC_FALSE); + if (data->out == NULL) + { + SC_xfreeallmemory(&(data->memHandle)); + return NULL; + } + data->next = NULL; + + pthread_mutex_lock(&queueAccess); + + if (queueLast) + queueLast->next = data; + queueLast = data; + if (!queueFirst) + queueFirst = data; + + pthread_mutex_unlock(&queueEmpty); + pthread_mutex_unlock(&queueAccess); + } + return data; +} + +static void +SC_destroyThreadData(PSCThreadData data) +{ + if (data) + { + PMEM_HANDLE handle = data->memHandle; + SC_xfreeallmemory(&handle); + } +} + +static PSCThreadData +SC_getNextInQueue() +{ + PSCThreadData Result = NULL; + pthread_mutex_lock(&queueAccess); + if (queueFirst != NULL) + { + Result = queueFirst; + queueFirst = queueFirst->next; + if (!queueFirst) + { + queueLast = NULL; + pthread_mutex_trylock(&queueEmpty); + } + Result->next = NULL; + } + pthread_mutex_unlock(&queueAccess); + return Result; +} + +static void +SC_deviceControl(PSCThreadData data) +{ + size_t buffer_len = 0; + scard_device_control(data->handle, data->request, data->in, data->out); + buffer_len = (size_t) data->out->p - (size_t) data->out->data; + rdpdr_send_completion(data->device, data->id, 0, buffer_len, data->out->data, buffer_len); + SC_destroyThreadData(data); +} + + +static void * +thread_function(PThreadListElement listElement) +{ + if ((listElement != NULL) && (listElement->data != NULL)) + { + while (1) + { + pthread_mutex_lock(&listElement->nodata); + SC_deviceControl(listElement->data); + listElement->data = NULL; + pthread_mutex_unlock(&listElement->busy); + } + } + pthread_exit(NULL); + return NULL; +} + +static void +SC_handleRequest(PSCThreadData data) +{ + int Result = 0; + PThreadListElement cur = threadList, last = threadList; + + while (cur) + { + if (0 == pthread_mutex_trylock(&cur->busy)) + { + cur->data = data; + pthread_mutex_unlock(&cur->nodata); + return; + } + else + { + last = cur; + cur = cur->next; + } + } + + cur = SC_xmalloc(&threadListHandle, sizeof(TThreadListElement)); + if (!cur) + return; + + threadCount++; + + cur->next = NULL; + pthread_mutex_init(&cur->busy, NULL); + pthread_mutex_init(&cur->nodata, NULL); + pthread_mutex_trylock(&cur->busy); + cur->data = data; + pthread_mutex_unlock(&cur->nodata); + + Result = pthread_create(&cur->thread, NULL, (void *(*)(void *)) thread_function, cur); + if (0 != Result) + { + error("[THREAD CREATE ERROR 0x%.8x]\n", Result); + SC_xfree(&threadListHandle, cur); + SC_destroyThreadData(data); + data = NULL; + } + else if (last) + last->next = cur; + else + threadList = cur; +} + +static void * +queue_handler_function(void *data) +{ + PSCThreadData cur_data = NULL; + while (1) + { + cur_data = SC_getNextInQueue(); + if (cur_data != NULL) + { + switch (cur_data->request) + { + case SC_ESTABLISH_CONTEXT: + case SC_RELEASE_CONTEXT: + { + SC_deviceControl(cur_data); + break; + } + default: + { + SC_handleRequest(cur_data); + break; + } + } + cur_data = NULL; + } + else + pthread_mutex_lock(&queueEmpty); + } + return NULL; +} + +static RD_NTSTATUS +thread_wrapper(RD_NTHANDLE handle, uint32 request, STREAM in, STREAM out) +{ + if (SC_addToQueue(handle, request, in, out)) + return RD_STATUS_PENDING | 0xC0000000; + else + return RD_STATUS_NO_SUCH_FILE; +} + +DEVICE_FNS scard_fns = { + scard_create, + scard_close, + scard_read, + scard_write, + thread_wrapper +}; +#endif /* MAKE_PROTO */ + +void +scard_lock(int lock) +{ + if (!scard_mutex) + { + int i; + + scard_mutex = + (pthread_mutex_t **) xmalloc(sizeof(pthread_mutex_t *) * SCARD_LOCK_LAST); + + for (i = 0; i < SCARD_LOCK_LAST; i++) + { + scard_mutex[i] = NULL; + } + } + + if (!scard_mutex[lock]) + { + scard_mutex[lock] = (pthread_mutex_t *) xmalloc(sizeof(pthread_mutex_t)); + pthread_mutex_init(scard_mutex[lock], NULL); + } + + pthread_mutex_lock(scard_mutex[lock]); +} + +void +scard_unlock(int lock) +{ + pthread_mutex_unlock(scard_mutex[lock]); +} --- rdesktop-1.5.0.orig/scard.h +++ rdesktop-1.5.0/scard.h @@ -0,0 +1,176 @@ +/* + rdesktop: A Remote Desktop Protocol client. + Smart Card support + Copyright (C) Alexi Volkov <alexi@myrealbox.com> 2006 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 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., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include <pthread.h> +#include "proto.h" + +/*************************************************************************/ +/* these are the additional types needed to split out 64-vs-32-bit APIs */ +/* */ + +/* The point of all of this is to avoid patching the existing smartcard + * infrastructure (PC/SC Lite, libmusclecard+libmusclepkcs11 or CoolKey, any + * other apps linking against any of these) because the need for patches + * spreads without limit. The alternative is to patch the heck out of rdesktop, + * which is already being done anyway. + * + * - jared.jennings@eglin.af.mil, 2 Aug 2006 + */ + +#ifdef HAVE_STDINT_H +#include <stdint.h> +#endif +#ifdef HAVE_INTTYPES_H +#include <inttypes.h> +#endif + +/* A DWORD when dealing with the smartcard stuff. Could be 32 bits or 64. */ +typedef DWORD MYPCSC_DWORD; +/* A DWORD when talking to the server. Must be exactly 32 bits all the time.*/ +typedef uint32_t SERVER_DWORD; + +typedef SCARDCONTEXT MYPCSC_SCARDCONTEXT; +typedef SCARDHANDLE MYPCSC_SCARDHANDLE; +typedef uint32_t SERVER_SCARDCONTEXT; +typedef uint32_t SERVER_SCARDHANDLE; + +typedef SCARD_READERSTATE_A MYPCSC_SCARD_READERSTATE_A; +typedef LPSCARD_READERSTATE_A MYPCSC_LPSCARD_READERSTATE_A; + +typedef struct +{ + const char *szReader; + void *pvUserData; + SERVER_DWORD dwCurrentState; + SERVER_DWORD dwEventState; + SERVER_DWORD cbAtr; + unsigned char rgbAtr[MAX_ATR_SIZE]; +} +SERVER_SCARD_READERSTATE_A; + +typedef SERVER_SCARD_READERSTATE_A *SERVER_LPSCARD_READERSTATE_A; + +#define SERVER_SCARDSTATESIZE (sizeof(SERVER_SCARD_READERSTATE_A) - sizeof(const char *) - sizeof(void *)) +#define MYPCSC_SCARDSTATESIZE (sizeof(MYPCSC_SCARD_READERSTATE_A) - sizeof(const char *) - sizeof(void *)) + +typedef struct _SERVER_SCARD_IO_REQUEST +{ + SERVER_DWORD dwProtocol; /* Protocol identifier */ + SERVER_DWORD cbPciLength; /* Protocol Control Inf Length */ +} +SERVER_SCARD_IO_REQUEST, *SERVER_LPSCARD_IO_REQUEST; + +typedef SCARD_IO_REQUEST MYPCSC_SCARD_IO_REQUEST; +typedef LPSCARD_IO_REQUEST MYPCSC_LPSCARD_IO_REQUEST; + + +/* */ +/* */ +/*************************************************************************/ + + +#define SC_TRUE 1 +#define SC_FALSE 0 + +#define SC_ESTABLISH_CONTEXT 0x00090014 /* EstablishContext */ +#define SC_RELEASE_CONTEXT 0x00090018 /* ReleaseContext */ +#define SC_IS_VALID_CONTEXT 0x0009001C /* IsValidContext */ +#define SC_LIST_READER_GROUPS 0x00090020 /* ListReaderGroups */ +#define SC_LIST_READERS 0x00090028 /* ListReadersA */ +#define SC_INTRODUCE_READER_GROUP 0x00090050 /* IntroduceReaderGroup */ +#define SC_FORGET_READER_GROUP 0x00090058 /* ForgetReader */ +#define SC_INTRODUCE_READER 0x00090060 /* IntroduceReader */ +#define SC_FORGET_READER 0x00090068 /* IntroduceReader */ +#define SC_ADD_READER_TO_GROUP 0x00090070 /* AddReaderToGroup */ +#define SC_REMOVE_READER_FROM_GROUP 0x00090078 /* RemoveReaderFromGroup */ +#define SC_CONNECT 0x000900AC /* ConnectA */ +#define SC_RECONNECT 0x000900B4 /* Reconnect */ +#define SC_DISCONNECT 0x000900B8 /* Disconnect */ +#define SC_GET_STATUS_CHANGE 0x000900A0 /* GetStatusChangeA */ +#define SC_CANCEL 0x000900A8 /* Cancel */ +#define SC_BEGIN_TRANSACTION 0x000900BC /* BeginTransaction */ +#define SC_END_TRANSACTION 0x000900C0 /* EndTransaction */ +#define SC_STATE 0x000900C4 /* State */ +#define SC_STATUS 0x000900C8 /* StatusA */ +#define SC_TRANSMIT 0x000900D0 /* Transmit */ +#define SC_CONTROL 0x000900D4 /* Control */ +#define SC_GETATTRIB 0x000900D8 /* GetAttrib */ +#define SC_SETATTRIB 0x000900DC /* SetAttrib */ +#define SC_ACCESS_STARTED_EVENT 0x000900E0 /* SCardAccessStartedEvent */ +#define SC_LOCATE_CARDS_BY_ATR 0x000900E8 /* LocateCardsByATR */ + +/* #define INPUT_LINKED 0x00020000 */ +#define INPUT_LINKED 0xFFFFFFFF + +#define SC_THREAD_FUNCTION(f) void *(*f)(void *) + +extern RDPDR_DEVICE g_rdpdr_device[]; + +typedef struct _MEM_HANDLE +{ + struct _MEM_HANDLE *prevHandle; + struct _MEM_HANDLE *nextHandle; + int dataSize; +} MEM_HANDLE, *PMEM_HANDLE; + +typedef struct _SCARD_ATRMASK_L +{ + unsigned int cbAtr; + unsigned char rgbAtr[36]; + unsigned char rgbMask[36]; +} SCARD_ATRMASK_L, *PSCARD_ATRMASK_L, *LPSCARD_ATRMASK_L; + +typedef struct _TSCNameMapRec +{ + char alias[128]; + char name[128]; + char vendor[128]; +} TSCNameMapRec, *PSCNameMapRec; + +typedef struct _TSCHCardRec +{ + DWORD hCard; + char *vendor; + struct _TSCHCardRec *next; + struct _TSCHCardRec *prev; +} TSCHCardRec, *PSCHCardRec; + +typedef struct _TSCThreadData +{ + uint32 device; + uint32 id; + RD_NTHANDLE handle; + uint32 request; + STREAM in; + STREAM out; + PMEM_HANDLE memHandle; + struct _TSCThreadData *next; +} TSCThreadData, *PSCThreadData; + +typedef struct _TThreadListElement +{ + pthread_t thread; + pthread_mutex_t busy; + pthread_mutex_t nodata; + PSCThreadData data; + struct _TThreadListElement *next; +} TThreadListElement, *PThreadListElement; + +int scard_enum_devices(uint32 * id, char *optarg); --- rdesktop-1.5.0.orig/seamless.c +++ rdesktop-1.5.0/seamless.c @@ -1,18 +1,19 @@ /* -*- c-basic-offset: 8 -*- rdesktop: A Remote Desktop Protocol client. Seamless Windows support - Copyright (C) Peter Astrand <astrand@cendio.se> 2005-2006 - + Copyright 2005-2007 Peter Astrand <astrand@cendio.se> for Cendio AB + Copyright 2007 Pierre Ossman <ossman@cendio.se> for Cendio AB + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 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., 675 Mass Ave, Cambridge, MA 02139, USA. @@ -22,17 +23,16 @@ #include <stdarg.h> #include <assert.h> -/* #define WITH_DEBUG_SEAMLESS */ - #ifdef WITH_DEBUG_SEAMLESS #define DEBUG_SEAMLESS(args) printf args; #else #define DEBUG_SEAMLESS(args) #endif -extern BOOL g_seamless_rdp; +extern RD_BOOL g_seamless_rdp; static VCHANNEL *seamless_channel; static unsigned int seamless_serial; +static char icon_buf[1024]; static char * seamless_get_token(char **s) @@ -58,7 +58,7 @@ } -static BOOL +static RD_BOOL seamless_process_line(const char *line, void *data) { char *p, *l; @@ -137,7 +137,65 @@ } else if (!strcmp("SETICON", tok1)) { - unimpl("SeamlessRDP SETICON1\n"); + int chunk, width, height, len; + char byte[3]; + + if (!tok8) + return False; + + id = strtoul(tok3, &endptr, 0); + if (*endptr) + return False; + + chunk = strtoul(tok4, &endptr, 0); + if (*endptr) + return False; + + width = strtoul(tok6, &endptr, 0); + if (*endptr) + return False; + + height = strtoul(tok7, &endptr, 0); + if (*endptr) + return False; + + byte[2] = '\0'; + len = 0; + while (*tok8 != '\0') + { + byte[0] = *tok8; + tok8++; + if (*tok8 == '\0') + return False; + byte[1] = *tok8; + tok8++; + + icon_buf[len] = strtol(byte, NULL, 16); + len++; + } + + ui_seamless_seticon(id, tok5, width, height, chunk, icon_buf, len); + } + else if (!strcmp("DELICON", tok1)) + { + int width, height; + + if (!tok6) + return False; + + id = strtoul(tok3, &endptr, 0); + if (*endptr) + return False; + + width = strtoul(tok5, &endptr, 0); + if (*endptr) + return False; + + height = strtoul(tok6, &endptr, 0); + if (*endptr) + return False; + + ui_seamless_delicon(id, tok4, width, height); } else if (!strcmp("POSITION", tok1)) { @@ -300,7 +358,7 @@ } -static BOOL +static RD_BOOL seamless_line_handler(const char *line, void *data) { if (!seamless_process_line(line, data)) @@ -333,7 +391,7 @@ } -BOOL +RD_BOOL seamless_init(void) { if (!g_seamless_rdp) --- rdesktop-1.5.0.orig/seamless.h +++ rdesktop-1.5.0/seamless.h @@ -1,18 +1,18 @@ /* rdesktop: A Remote Desktop Protocol client. Seamless Windows support - Copyright (C) Peter Astrand <astrand@cendio.se> 2005-2006 - + Copyright (C) Peter Astrand <astrand@cendio.se> 2005-2007 + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 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., 675 Mass Ave, Cambridge, MA 02139, USA. --- rdesktop-1.5.0.orig/secure.c +++ rdesktop-1.5.0/secure.c @@ -1,7 +1,7 @@ /* -*- c-basic-offset: 8 -*- rdesktop: A Remote Desktop Protocol client. Protocol services - RDP encryption and licensing - Copyright (C) Matthew Chapman 1999-2005 + Copyright (C) Matthew Chapman 1999-2007 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,12 +19,7 @@ */ #include "rdesktop.h" - -#include <openssl/rc4.h> -#include <openssl/md5.h> -#include <openssl/sha.h> -#include <openssl/bn.h> -#include <openssl/x509v3.h> +#include "ssl.h" extern char g_hostname[16]; extern int g_width; @@ -33,33 +28,31 @@ extern int g_keyboard_type; extern int g_keyboard_subtype; extern int g_keyboard_functionkeys; -extern BOOL g_encryption; -extern BOOL g_licence_issued; -extern BOOL g_use_rdp5; -extern BOOL g_console_session; +extern RD_BOOL g_encryption; +extern RD_BOOL g_licence_issued; +extern RD_BOOL g_use_rdp5; +extern RD_BOOL g_console_session; extern int g_server_depth; -extern uint16 mcs_userid; extern VCHANNEL g_channels[]; extern unsigned int g_num_channels; -static int rc4_key_len; -static RC4_KEY rc4_decrypt_key; -static RC4_KEY rc4_encrypt_key; -static RSA *server_public_key; -static uint32 server_public_key_len; - -static uint8 sec_sign_key[16]; -static uint8 sec_decrypt_key[16]; -static uint8 sec_encrypt_key[16]; -static uint8 sec_decrypt_update_key[16]; -static uint8 sec_encrypt_update_key[16]; -static uint8 sec_crypted_random[SEC_MAX_MODULUS_SIZE]; +static int g_rc4_key_len; +static SSL_RC4 g_rc4_decrypt_key; +static SSL_RC4 g_rc4_encrypt_key; +static uint32 g_server_public_key_len; + +static uint8 g_sec_sign_key[16]; +static uint8 g_sec_decrypt_key[16]; +static uint8 g_sec_encrypt_key[16]; +static uint8 g_sec_decrypt_update_key[16]; +static uint8 g_sec_encrypt_update_key[16]; +static uint8 g_sec_crypted_random[SEC_MAX_MODULUS_SIZE]; uint16 g_server_rdp_version = 0; /* These values must be available to reset state - Session Directory */ -static int sec_encrypt_use_count = 0; -static int sec_decrypt_use_count = 0; +static int g_sec_encrypt_use_count = 0; +static int g_sec_decrypt_use_count = 0; /* * I believe this is based on SSLv3 with the following differences: @@ -80,25 +73,25 @@ { uint8 shasig[20]; uint8 pad[4]; - SHA_CTX sha; - MD5_CTX md5; + SSL_SHA1 sha1; + SSL_MD5 md5; int i; for (i = 0; i < 3; i++) { memset(pad, salt + i, i + 1); - SHA1_Init(&sha); - SHA1_Update(&sha, pad, i + 1); - SHA1_Update(&sha, in, 48); - SHA1_Update(&sha, salt1, 32); - SHA1_Update(&sha, salt2, 32); - SHA1_Final(shasig, &sha); - - MD5_Init(&md5); - MD5_Update(&md5, in, 48); - MD5_Update(&md5, shasig, 20); - MD5_Final(&out[i * 16], &md5); + ssl_sha1_init(&sha1); + ssl_sha1_update(&sha1, pad, i + 1); + ssl_sha1_update(&sha1, in, 48); + ssl_sha1_update(&sha1, salt1, 32); + ssl_sha1_update(&sha1, salt2, 32); + ssl_sha1_final(&sha1, shasig); + + ssl_md5_init(&md5); + ssl_md5_update(&md5, in, 48); + ssl_md5_update(&md5, shasig, 20); + ssl_md5_final(&md5, &out[i * 16]); } } @@ -108,13 +101,13 @@ void sec_hash_16(uint8 * out, uint8 * in, uint8 * salt1, uint8 * salt2) { - MD5_CTX md5; + SSL_MD5 md5; - MD5_Init(&md5); - MD5_Update(&md5, in, 16); - MD5_Update(&md5, salt1, 32); - MD5_Update(&md5, salt2, 32); - MD5_Final(out, &md5); + ssl_md5_init(&md5); + ssl_md5_update(&md5, in, 16); + ssl_md5_update(&md5, salt1, 32); + ssl_md5_update(&md5, salt2, 32); + ssl_md5_final(&md5, out); } /* Reduce key entropy from 64 to 40 bits */ @@ -143,33 +136,33 @@ sec_hash_48(key_block, master_secret, client_random, server_random, 'X'); /* First 16 bytes of key material is MAC secret */ - memcpy(sec_sign_key, key_block, 16); + memcpy(g_sec_sign_key, key_block, 16); /* Generate export keys from next two blocks of 16 bytes */ - sec_hash_16(sec_decrypt_key, &key_block[16], client_random, server_random); - sec_hash_16(sec_encrypt_key, &key_block[32], client_random, server_random); + sec_hash_16(g_sec_decrypt_key, &key_block[16], client_random, server_random); + sec_hash_16(g_sec_encrypt_key, &key_block[32], client_random, server_random); if (rc4_key_size == 1) { DEBUG(("40-bit encryption enabled\n")); - sec_make_40bit(sec_sign_key); - sec_make_40bit(sec_decrypt_key); - sec_make_40bit(sec_encrypt_key); - rc4_key_len = 8; + sec_make_40bit(g_sec_sign_key); + sec_make_40bit(g_sec_decrypt_key); + sec_make_40bit(g_sec_encrypt_key); + g_rc4_key_len = 8; } else { DEBUG(("rc_4_key_size == %d, 128-bit encryption enabled\n", rc4_key_size)); - rc4_key_len = 16; + g_rc4_key_len = 16; } /* Save initial RC4 keys as update keys */ - memcpy(sec_decrypt_update_key, sec_decrypt_key, 16); - memcpy(sec_encrypt_update_key, sec_encrypt_key, 16); + memcpy(g_sec_decrypt_update_key, g_sec_decrypt_key, 16); + memcpy(g_sec_encrypt_update_key, g_sec_encrypt_key, 16); /* Initialise RC4 state arrays */ - RC4_set_key(&rc4_decrypt_key, rc4_key_len, sec_decrypt_key); - RC4_set_key(&rc4_encrypt_key, rc4_key_len, sec_encrypt_key); + ssl_rc4_set_key(&g_rc4_decrypt_key, g_sec_decrypt_key, g_rc4_key_len); + ssl_rc4_set_key(&g_rc4_encrypt_key, g_sec_encrypt_key, g_rc4_key_len); } static uint8 pad_54[40] = { @@ -203,23 +196,23 @@ uint8 shasig[20]; uint8 md5sig[16]; uint8 lenhdr[4]; - SHA_CTX sha; - MD5_CTX md5; + SSL_SHA1 sha1; + SSL_MD5 md5; buf_out_uint32(lenhdr, datalen); - SHA1_Init(&sha); - SHA1_Update(&sha, session_key, keylen); - SHA1_Update(&sha, pad_54, 40); - SHA1_Update(&sha, lenhdr, 4); - SHA1_Update(&sha, data, datalen); - SHA1_Final(shasig, &sha); - - MD5_Init(&md5); - MD5_Update(&md5, session_key, keylen); - MD5_Update(&md5, pad_92, 48); - MD5_Update(&md5, shasig, 20); - MD5_Final(md5sig, &md5); + ssl_sha1_init(&sha1); + ssl_sha1_update(&sha1, session_key, keylen); + ssl_sha1_update(&sha1, pad_54, 40); + ssl_sha1_update(&sha1, lenhdr, 4); + ssl_sha1_update(&sha1, data, datalen); + ssl_sha1_final(&sha1, shasig); + + ssl_md5_init(&md5); + ssl_md5_update(&md5, session_key, keylen); + ssl_md5_update(&md5, pad_92, 48); + ssl_md5_update(&md5, shasig, 20); + ssl_md5_final(&md5, md5sig); memcpy(signature, md5sig, siglen); } @@ -229,26 +222,26 @@ sec_update(uint8 * key, uint8 * update_key) { uint8 shasig[20]; - SHA_CTX sha; - MD5_CTX md5; - RC4_KEY update; - - SHA1_Init(&sha); - SHA1_Update(&sha, update_key, rc4_key_len); - SHA1_Update(&sha, pad_54, 40); - SHA1_Update(&sha, key, rc4_key_len); - SHA1_Final(shasig, &sha); - - MD5_Init(&md5); - MD5_Update(&md5, update_key, rc4_key_len); - MD5_Update(&md5, pad_92, 48); - MD5_Update(&md5, shasig, 20); - MD5_Final(key, &md5); + SSL_SHA1 sha1; + SSL_MD5 md5; + SSL_RC4 update; + + ssl_sha1_init(&sha1); + ssl_sha1_update(&sha1, update_key, g_rc4_key_len); + ssl_sha1_update(&sha1, pad_54, 40); + ssl_sha1_update(&sha1, key, g_rc4_key_len); + ssl_sha1_final(&sha1, shasig); + + ssl_md5_init(&md5); + ssl_md5_update(&md5, update_key, g_rc4_key_len); + ssl_md5_update(&md5, pad_92, 48); + ssl_md5_update(&md5, shasig, 20); + ssl_md5_final(&md5, key); - RC4_set_key(&update, rc4_key_len, key); - RC4(&update, rc4_key_len, key, key); + ssl_rc4_set_key(&update, key, g_rc4_key_len); + ssl_rc4_crypt(&update, key, key, g_rc4_key_len); - if (rc4_key_len == 8) + if (g_rc4_key_len == 8) sec_make_40bit(key); } @@ -256,44 +249,30 @@ static void sec_encrypt(uint8 * data, int length) { - if (sec_encrypt_use_count == 4096) + if (g_sec_encrypt_use_count == 4096) { - sec_update(sec_encrypt_key, sec_encrypt_update_key); - RC4_set_key(&rc4_encrypt_key, rc4_key_len, sec_encrypt_key); - sec_encrypt_use_count = 0; + sec_update(g_sec_encrypt_key, g_sec_encrypt_update_key); + ssl_rc4_set_key(&g_rc4_encrypt_key, g_sec_encrypt_key, g_rc4_key_len); + g_sec_encrypt_use_count = 0; } - RC4(&rc4_encrypt_key, length, data, data); - sec_encrypt_use_count++; + ssl_rc4_crypt(&g_rc4_encrypt_key, data, data, length); + g_sec_encrypt_use_count++; } /* Decrypt data using RC4 */ void sec_decrypt(uint8 * data, int length) { - if (sec_decrypt_use_count == 4096) + if (g_sec_decrypt_use_count == 4096) { - sec_update(sec_decrypt_key, sec_decrypt_update_key); - RC4_set_key(&rc4_decrypt_key, rc4_key_len, sec_decrypt_key); - sec_decrypt_use_count = 0; + sec_update(g_sec_decrypt_key, g_sec_decrypt_update_key); + ssl_rc4_set_key(&g_rc4_decrypt_key, g_sec_decrypt_key, g_rc4_key_len); + g_sec_decrypt_use_count = 0; } - RC4(&rc4_decrypt_key, length, data, data); - sec_decrypt_use_count++; -} - -static void -reverse(uint8 * p, int len) -{ - int i, j; - uint8 temp; - - for (i = 0, j = len - 1; i < j; i++, j--) - { - temp = p[i]; - p[i] = p[j]; - p[j] = temp; - } + ssl_rc4_crypt(&g_rc4_decrypt_key, data, data, length); + g_sec_decrypt_use_count++; } /* Perform an RSA public key encryption operation */ @@ -301,36 +280,7 @@ sec_rsa_encrypt(uint8 * out, uint8 * in, int len, uint32 modulus_size, uint8 * modulus, uint8 * exponent) { - BN_CTX *ctx; - BIGNUM mod, exp, x, y; - uint8 inr[SEC_MAX_MODULUS_SIZE]; - int outlen; - - reverse(modulus, modulus_size); - reverse(exponent, SEC_EXPONENT_SIZE); - memcpy(inr, in, len); - reverse(inr, len); - - ctx = BN_CTX_new(); - BN_init(&mod); - BN_init(&exp); - BN_init(&x); - BN_init(&y); - - BN_bin2bn(modulus, modulus_size, &mod); - BN_bin2bn(exponent, SEC_EXPONENT_SIZE, &exp); - BN_bin2bn(inr, len, &x); - BN_mod_exp(&y, &x, &exp, &mod, ctx); - outlen = BN_bn2bin(&y, out); - reverse(out, outlen); - if (outlen < modulus_size) - memset(out + outlen, 0, modulus_size - outlen); - - BN_free(&y); - BN_clear_free(&x); - BN_free(&exp); - BN_free(&mod); - BN_CTX_free(ctx); + ssl_rsa_encrypt(out, in, len, modulus_size, modulus, exponent); } /* Initialise secure transport packet */ @@ -356,6 +306,10 @@ { int datalen; +#ifdef WITH_SCARD + scard_lock(SCARD_LOCK_SEC); +#endif + s_pop_layer(s, sec_hdr); if (!g_licence_issued || (flags & SEC_ENCRYPT)) out_uint32_le(s, flags); @@ -370,11 +324,15 @@ hexdump(s->p + 8, datalen); #endif - sec_sign(s->p, 8, sec_sign_key, rc4_key_len, s->p + 8, datalen); + sec_sign(s->p, 8, g_sec_sign_key, g_rc4_key_len, s->p + 8, datalen); sec_encrypt(s->p + 8, datalen); } mcs_send_to_channel(s, channel); + +#ifdef WITH_SCARD + scard_unlock(SCARD_LOCK_SEC); +#endif } /* Transmit secure transport packet */ @@ -390,14 +348,14 @@ static void sec_establish_key(void) { - uint32 length = server_public_key_len + SEC_PADDING_SIZE; + uint32 length = g_server_public_key_len + SEC_PADDING_SIZE; uint32 flags = SEC_CLIENT_RANDOM; STREAM s; s = sec_init(flags, length + 4); out_uint32_le(s, length); - out_uint8p(s, sec_crypted_random, server_public_key_len); + out_uint8p(s, g_sec_crypted_random, g_server_public_key_len); out_uint8s(s, SEC_PADDING_SIZE); s_mark_end(s); @@ -496,8 +454,8 @@ } /* Parse a public key structure */ -static BOOL -sec_parse_public_key(STREAM s, uint8 ** modulus, uint8 ** exponent) +static RD_BOOL +sec_parse_public_key(STREAM s, uint8 * modulus, uint8 * exponent) { uint32 magic, modulus_len; @@ -510,65 +468,48 @@ in_uint32_le(s, modulus_len); modulus_len -= SEC_PADDING_SIZE; - if ((modulus_len < 64) || (modulus_len > SEC_MAX_MODULUS_SIZE)) + if ((modulus_len < SEC_MODULUS_SIZE) || (modulus_len > SEC_MAX_MODULUS_SIZE)) { error("Bad server public key size (%u bits)\n", modulus_len * 8); return False; } in_uint8s(s, 8); /* modulus_bits, unknown */ - in_uint8p(s, *exponent, SEC_EXPONENT_SIZE); - in_uint8p(s, *modulus, modulus_len); + in_uint8a(s, exponent, SEC_EXPONENT_SIZE); + in_uint8a(s, modulus, modulus_len); in_uint8s(s, SEC_PADDING_SIZE); - server_public_key_len = modulus_len; + g_server_public_key_len = modulus_len; return s_check(s); } -static BOOL -sec_parse_x509_key(X509 * cert) -{ - EVP_PKEY *epk = NULL; - /* By some reason, Microsoft sets the OID of the Public RSA key to - the oid for "MD5 with RSA Encryption" instead of "RSA Encryption" - - Kudos to Richard Levitte for the following (. intiutive .) - lines of code that resets the OID and let's us extract the key. */ - if (OBJ_obj2nid(cert->cert_info->key->algor->algorithm) == NID_md5WithRSAEncryption) - { - DEBUG_RDP5(("Re-setting algorithm type to RSA in server certificate\n")); - ASN1_OBJECT_free(cert->cert_info->key->algor->algorithm); - cert->cert_info->key->algor->algorithm = OBJ_nid2obj(NID_rsaEncryption); - } - epk = X509_get_pubkey(cert); - if (NULL == epk) - { - error("Failed to extract public key from certificate\n"); - return False; - } - - server_public_key = RSAPublicKey_dup((RSA *) epk->pkey.ptr); - EVP_PKEY_free(epk); - - server_public_key_len = RSA_size(server_public_key); - if ((server_public_key_len < 64) || (server_public_key_len > SEC_MAX_MODULUS_SIZE)) - { - error("Bad server public key size (%u bits)\n", server_public_key_len * 8); - return False; - } - - return True; +/* Parse a public signature structure */ +static RD_BOOL +sec_parse_public_sig(STREAM s, uint32 len, uint8 * modulus, uint8 * exponent) +{ + uint8 signature[SEC_MAX_MODULUS_SIZE]; + uint32 sig_len; + + if (len != 72) + { + return True; + } + memset(signature, 0, sizeof(signature)); + sig_len = len - 8; + in_uint8a(s, signature, sig_len); + return ssl_sig_ok(exponent, SEC_EXPONENT_SIZE, modulus, g_server_public_key_len, + signature, sig_len); } - /* Parse a crypto information structure */ -static BOOL +static RD_BOOL sec_parse_crypt_info(STREAM s, uint32 * rc4_key_size, - uint8 ** server_random, uint8 ** modulus, uint8 ** exponent) + uint8 ** server_random, uint8 * modulus, uint8 * exponent) { uint32 crypt_level, random_len, rsa_info_len; uint32 cacert_len, cert_len, flags; - X509 *cacert, *server_cert; + SSL_CERT *cacert, *server_cert; + SSL_RKEY *server_public_key; uint16 tag, length; uint8 *next_tag, *end; @@ -615,10 +556,8 @@ break; case SEC_TAG_KEYSIG: - /* Is this a Microsoft key that we just got? */ - /* Care factor: zero! */ - /* Actually, it would probably be a good idea to check if the public key is signed with this key, and then store this - key as a known key of the hostname. This would prevent some MITM-attacks. */ + if (!sec_parse_public_sig(s, length, modulus, exponent)) + return False; break; default: @@ -634,24 +573,21 @@ DEBUG_RDP5(("We're going for the RDP5-style encryption\n")); in_uint32_le(s, certcount); /* Number of certificates */ - if (certcount < 2) { error("Server didn't send enough X509 certificates\n"); return False; } - for (; certcount > 2; certcount--) { /* ignore all the certificates between the root and the signing CA */ uint32 ignorelen; - X509 *ignorecert; + SSL_CERT *ignorecert; DEBUG_RDP5(("Ignored certs left: %d\n", certcount)); - in_uint32_le(s, ignorelen); DEBUG_RDP5(("Ignored Certificate length is %d\n", ignorelen)); - ignorecert = d2i_X509(NULL, &(s->p), ignorelen); - + ignorecert = ssl_cert_read(s->p, ignorelen); + in_uint8s(s, ignorelen); if (ignorecert == NULL) { /* XXX: error out? */ DEBUG_RDP5(("got a bad cert: this will probably screw up the rest of the communication\n")); @@ -659,11 +595,10 @@ #ifdef WITH_DEBUG_RDP5 DEBUG_RDP5(("cert #%d (ignored):\n", certcount)); - X509_print_fp(stdout, ignorecert); + ssl_cert_print_fp(stdout, ignorecert); #endif } - - /* Do da funky X.509 stuffy + /* Do da funky X.509 stuffy "How did I find out about this? I looked up and saw a bright light and when I came to I had a scar on my forehead @@ -671,52 +606,58 @@ - Peter Gutman in a early version of http://www.cs.auckland.ac.nz/~pgut001/pubs/x509guide.txt */ - in_uint32_le(s, cacert_len); DEBUG_RDP5(("CA Certificate length is %d\n", cacert_len)); - cacert = d2i_X509(NULL, &(s->p), cacert_len); - /* Note: We don't need to move s->p here - d2i_X509 is - "kind" enough to do it for us */ + cacert = ssl_cert_read(s->p, cacert_len); + in_uint8s(s, cacert_len); if (NULL == cacert) { error("Couldn't load CA Certificate from server\n"); return False; } - - /* Currently, we don't use the CA Certificate. - FIXME: - *) Verify the server certificate (server_cert) with the - CA certificate. - *) Store the CA Certificate with the hostname of the - server we are connecting to as key, and compare it - when we connect the next time, in order to prevent - MITM-attacks. - */ - - X509_free(cacert); - in_uint32_le(s, cert_len); DEBUG_RDP5(("Certificate length is %d\n", cert_len)); - server_cert = d2i_X509(NULL, &(s->p), cert_len); + server_cert = ssl_cert_read(s->p, cert_len); + in_uint8s(s, cert_len); if (NULL == server_cert) { + ssl_cert_free(cacert); error("Couldn't load Certificate from server\n"); return False; } - + if (!ssl_certs_ok(server_cert, cacert)) + { + ssl_cert_free(server_cert); + ssl_cert_free(cacert); + error("Security error CA Certificate invalid\n"); + return False; + } + ssl_cert_free(cacert); in_uint8s(s, 16); /* Padding */ - - /* Note: Verifying the server certificate must be done here, - before sec_parse_public_key since we'll have to apply - serious violence to the key after this */ - - if (!sec_parse_x509_key(server_cert)) + server_public_key = ssl_cert_to_rkey(server_cert, &g_server_public_key_len); + if (NULL == server_public_key) { DEBUG_RDP5(("Didn't parse X509 correctly\n")); - X509_free(server_cert); + ssl_cert_free(server_cert); return False; } - X509_free(server_cert); + ssl_cert_free(server_cert); + if ((g_server_public_key_len < SEC_MODULUS_SIZE) || + (g_server_public_key_len > SEC_MAX_MODULUS_SIZE)) + { + error("Bad server public key size (%u bits)\n", + g_server_public_key_len * 8); + ssl_rkey_free(server_public_key); + return False; + } + if (ssl_rkey_get_exp_mod(server_public_key, exponent, SEC_EXPONENT_SIZE, + modulus, SEC_MAX_MODULUS_SIZE) != 0) + { + error("Problem extracting RSA exponent, modulus"); + ssl_rkey_free(server_public_key); + return False; + } + ssl_rkey_free(server_public_key); return True; /* There's some garbage here we don't care about */ } return s_check_end(s); @@ -726,51 +667,23 @@ static void sec_process_crypt_info(STREAM s) { - uint8 *server_random, *modulus = NULL, *exponent = NULL; + uint8 *server_random = NULL; uint8 client_random[SEC_RANDOM_SIZE]; + uint8 modulus[SEC_MAX_MODULUS_SIZE]; + uint8 exponent[SEC_EXPONENT_SIZE]; uint32 rc4_key_size; - if (!sec_parse_crypt_info(s, &rc4_key_size, &server_random, &modulus, &exponent)) + memset(modulus, 0, sizeof(modulus)); + memset(exponent, 0, sizeof(exponent)); + if (!sec_parse_crypt_info(s, &rc4_key_size, &server_random, modulus, exponent)) { DEBUG(("Failed to parse crypt info\n")); return; } - DEBUG(("Generating client random\n")); generate_random(client_random); - - if (NULL != server_public_key) - { /* Which means we should use - RDP5-style encryption */ - uint8 inr[SEC_MAX_MODULUS_SIZE]; - uint32 padding_len = server_public_key_len - SEC_RANDOM_SIZE; - - /* This is what the MS client do: */ - memset(inr, 0, padding_len); - /* *ARIGL!* Plaintext attack, anyone? - I tried doing: - generate_random(inr); - ..but that generates connection errors now and then (yes, - "now and then". Something like 0 to 3 attempts needed before a - successful connection. Nice. Not! - */ - memcpy(inr + padding_len, client_random, SEC_RANDOM_SIZE); - reverse(inr + padding_len, SEC_RANDOM_SIZE); - - RSA_public_encrypt(server_public_key_len, - inr, sec_crypted_random, server_public_key, RSA_NO_PADDING); - - reverse(sec_crypted_random, server_public_key_len); - - RSA_free(server_public_key); - server_public_key = NULL; - } - else - { /* RDP4-style encryption */ - sec_rsa_encrypt(sec_crypted_random, - client_random, SEC_RANDOM_SIZE, server_public_key_len, modulus, - exponent); - } + sec_rsa_encrypt(g_sec_crypted_random, client_random, SEC_RANDOM_SIZE, + g_server_public_key_len, modulus, exponent); sec_generate_keys(client_random, server_random, rc4_key_size); } @@ -924,7 +837,7 @@ } /* Establish a secure connection */ -BOOL +RD_BOOL sec_connect(char *server, char *username) { struct stream mcs_data; @@ -945,7 +858,7 @@ } /* Establish a secure connection */ -BOOL +RD_BOOL sec_reconnect(char *server) { struct stream mcs_data; @@ -977,7 +890,7 @@ sec_reset_state(void) { g_server_rdp_version = 0; - sec_encrypt_use_count = 0; - sec_decrypt_use_count = 0; + g_sec_encrypt_use_count = 0; + g_sec_decrypt_use_count = 0; mcs_reset_state(); } --- rdesktop-1.5.0.orig/serial.c +++ rdesktop-1.5.0/serial.c @@ -1,13 +1,13 @@ /* -*- c-basic-offset: 8 -*- rdesktop: A Remote Desktop Protocol client. - Copyright (C) Matthew Chapman 1999-2005 - + Copyright (C) Matthew Chapman 1999-2007 + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 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 @@ -150,7 +150,7 @@ extern RDPDR_DEVICE g_rdpdr_device[]; static SERIAL_DEVICE * -get_serial_info(NTHANDLE handle) +get_serial_info(RD_NTHANDLE handle) { int index; @@ -162,8 +162,8 @@ return NULL; } -static BOOL -get_termios(SERIAL_DEVICE * pser_inf, NTHANDLE serial_fd) +static RD_BOOL +get_termios(SERIAL_DEVICE * pser_inf, RD_NTHANDLE serial_fd) { speed_t speed; struct termios *ptermios; @@ -316,7 +316,7 @@ } static void -set_termios(SERIAL_DEVICE * pser_inf, NTHANDLE serial_fd) +set_termios(SERIAL_DEVICE * pser_inf, RD_NTHANDLE serial_fd) { speed_t speed; @@ -553,11 +553,11 @@ return count; } -static NTSTATUS +static RD_NTSTATUS serial_create(uint32 device_id, uint32 access, uint32 share_mode, uint32 disposition, - uint32 flags_and_attributes, char *filename, NTHANDLE * handle) + uint32 flags_and_attributes, char *filename, RD_NTHANDLE * handle) { - NTHANDLE serial_fd; + RD_NTHANDLE serial_fd; SERIAL_DEVICE *pser_inf; struct termios *ptermios; @@ -568,14 +568,14 @@ if (serial_fd == -1) { perror("open"); - return STATUS_ACCESS_DENIED; + return RD_STATUS_ACCESS_DENIED; } if (!get_termios(pser_inf, serial_fd)) { printf("INFO: SERIAL %s access denied\n", g_rdpdr_device[device_id].name); fflush(stdout); - return STATUS_ACCESS_DENIED; + return RD_STATUS_ACCESS_DENIED; } /* Store handle for later use */ @@ -607,23 +607,23 @@ pser_inf->read_total_timeout_constant = 5; - return STATUS_SUCCESS; + return RD_STATUS_SUCCESS; } -static NTSTATUS -serial_close(NTHANDLE handle) +static RD_NTSTATUS +serial_close(RD_NTHANDLE handle) { int i = get_device_index(handle); if (i >= 0) g_rdpdr_device[i].handle = 0; - rdpdr_abort_io(handle, 0, STATUS_TIMEOUT); + rdpdr_abort_io(handle, 0, RD_STATUS_TIMEOUT); close(handle); - return STATUS_SUCCESS; + return RD_STATUS_SUCCESS; } -static NTSTATUS -serial_read(NTHANDLE handle, uint8 * data, uint32 length, uint32 offset, uint32 * result) +static RD_NTSTATUS +serial_read(RD_NTHANDLE handle, uint8 * data, uint32 length, uint32 offset, uint32 * result) { long timeout; SERIAL_DEVICE *pser_inf; @@ -678,11 +678,11 @@ hexdump(data, *result); #endif - return STATUS_SUCCESS; + return RD_STATUS_SUCCESS; } -static NTSTATUS -serial_write(NTHANDLE handle, uint8 * data, uint32 length, uint32 offset, uint32 * result) +static RD_NTSTATUS +serial_write(RD_NTHANDLE handle, uint8 * data, uint32 length, uint32 offset, uint32 * result) { SERIAL_DEVICE *pser_inf; @@ -695,11 +695,11 @@ DEBUG_SERIAL(("serial_write length %d, offset %d result %d\n", length, offset, *result)); - return STATUS_SUCCESS; + return RD_STATUS_SUCCESS; } -static NTSTATUS -serial_device_control(NTHANDLE handle, uint32 request, STREAM in, STREAM out) +static RD_NTSTATUS +serial_device_control(RD_NTHANDLE handle, uint32 request, STREAM in, STREAM out) { int flush_mask, purge_mask; uint32 result, modemstate; @@ -708,7 +708,7 @@ struct termios *ptermios; if ((request >> 16) != FILE_DEVICE_SERIAL_PORT) - return STATUS_INVALID_PARAMETER; + return RD_STATUS_INVALID_PARAMETER; pser_inf = get_serial_info(handle); ptermios = pser_inf->ptermios; @@ -904,9 +904,9 @@ if (flush_mask != 0) tcflush(handle, flush_mask); if (purge_mask & SERIAL_PURGE_TXABORT) - rdpdr_abort_io(handle, 4, STATUS_CANCELLED); + rdpdr_abort_io(handle, 4, RD_STATUS_CANCELLED); if (purge_mask & SERIAL_PURGE_RXABORT) - rdpdr_abort_io(handle, 3, STATUS_CANCELLED); + rdpdr_abort_io(handle, 3, RD_STATUS_CANCELLED); break; case SERIAL_WAIT_ON_MASK: DEBUG_SERIAL(("serial_ioctl -> SERIAL_WAIT_ON_MASK %X\n", @@ -918,7 +918,7 @@ out_uint32_le(out, result); break; } - return STATUS_PENDING; + return RD_STATUS_PENDING; break; case SERIAL_SET_BREAK_ON: DEBUG_SERIAL(("serial_ioctl -> SERIAL_SET_BREAK_ON\n")); @@ -939,19 +939,19 @@ break; default: unimpl("SERIAL IOCTL %d\n", request); - return STATUS_INVALID_PARAMETER; + return RD_STATUS_INVALID_PARAMETER; } - return STATUS_SUCCESS; + return RD_STATUS_SUCCESS; } -BOOL -serial_get_event(NTHANDLE handle, uint32 * result) +RD_BOOL +serial_get_event(RD_NTHANDLE handle, uint32 * result) { int index; SERIAL_DEVICE *pser_inf; int bytes; - BOOL ret = False; + RD_BOOL ret = False; *result = 0; index = get_device_index(handle); @@ -1043,8 +1043,8 @@ } /* Read timeout for a given file descripter (device) when adding fd's to select() */ -BOOL -serial_get_timeout(NTHANDLE handle, uint32 length, uint32 * timeout, uint32 * itv_timeout) +RD_BOOL +serial_get_timeout(RD_NTHANDLE handle, uint32 length, uint32 * timeout, uint32 * itv_timeout) { int index; SERIAL_DEVICE *pser_inf; --- rdesktop-1.5.0.orig/ssl.c +++ rdesktop-1.5.0/ssl.c @@ -0,0 +1,223 @@ +/* -*- c-basic-offset: 8 -*- + rdesktop: A Remote Desktop Protocol client. + Secure sockets abstraction layer + Copyright (C) Matthew Chapman 1999-2007 + Copyright (C) Jay Sorg 2006-2007 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 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., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "rdesktop.h" +#include "ssl.h" + +void +ssl_sha1_init(SSL_SHA1 * sha1) +{ + SHA1_Init(sha1); +} + +void +ssl_sha1_update(SSL_SHA1 * sha1, uint8 * data, uint32 len) +{ + SHA1_Update(sha1, data, len); +} + +void +ssl_sha1_final(SSL_SHA1 * sha1, uint8 * out_data) +{ + SHA1_Final(out_data, sha1); +} + +void +ssl_md5_init(SSL_MD5 * md5) +{ + MD5_Init(md5); +} + +void +ssl_md5_update(SSL_MD5 * md5, uint8 * data, uint32 len) +{ + MD5_Update(md5, data, len); +} + +void +ssl_md5_final(SSL_MD5 * md5, uint8 * out_data) +{ + MD5_Final(out_data, md5); +} + +void +ssl_rc4_set_key(SSL_RC4 * rc4, uint8 * key, uint32 len) +{ + RC4_set_key(rc4, len, key); +} + +void +ssl_rc4_crypt(SSL_RC4 * rc4, uint8 * in_data, uint8 * out_data, uint32 len) +{ + RC4(rc4, len, in_data, out_data); +} + +static void +reverse(uint8 * p, int len) +{ + int i, j; + uint8 temp; + + for (i = 0, j = len - 1; i < j; i++, j--) + { + temp = p[i]; + p[i] = p[j]; + p[j] = temp; + } +} + +void +ssl_rsa_encrypt(uint8 * out, uint8 * in, int len, uint32 modulus_size, uint8 * modulus, + uint8 * exponent) +{ + BN_CTX *ctx; + BIGNUM mod, exp, x, y; + uint8 inr[SEC_MAX_MODULUS_SIZE]; + int outlen; + + reverse(modulus, modulus_size); + reverse(exponent, SEC_EXPONENT_SIZE); + memcpy(inr, in, len); + reverse(inr, len); + + ctx = BN_CTX_new(); + BN_init(&mod); + BN_init(&exp); + BN_init(&x); + BN_init(&y); + + BN_bin2bn(modulus, modulus_size, &mod); + BN_bin2bn(exponent, SEC_EXPONENT_SIZE, &exp); + BN_bin2bn(inr, len, &x); + BN_mod_exp(&y, &x, &exp, &mod, ctx); + outlen = BN_bn2bin(&y, out); + reverse(out, outlen); + if (outlen < (int) modulus_size) + memset(out + outlen, 0, modulus_size - outlen); + + BN_free(&y); + BN_clear_free(&x); + BN_free(&exp); + BN_free(&mod); + BN_CTX_free(ctx); +} + +/* returns newly allocated SSL_CERT or NULL */ +SSL_CERT * +ssl_cert_read(uint8 * data, uint32 len) +{ + /* this will move the data pointer but we don't care, we don't use it again */ + return d2i_X509(NULL, (D2I_X509_CONST unsigned char **) &data, len); +} + +void +ssl_cert_free(SSL_CERT * cert) +{ + X509_free(cert); +} + +/* returns newly allocated SSL_RKEY or NULL */ +SSL_RKEY * +ssl_cert_to_rkey(SSL_CERT * cert, uint32 * key_len) +{ + EVP_PKEY *epk = NULL; + SSL_RKEY *lkey; + /* By some reason, Microsoft sets the OID of the Public RSA key to + the oid for "MD5 with RSA Encryption" instead of "RSA Encryption" + + Kudos to Richard Levitte for the following (. intiutive .) + lines of code that resets the OID and let's us extract the key. */ + if (OBJ_obj2nid(cert->cert_info->key->algor->algorithm) == NID_md5WithRSAEncryption) + { + DEBUG_RDP5(("Re-setting algorithm type to RSA in server certificate\n")); + ASN1_OBJECT_free(cert->cert_info->key->algor->algorithm); + cert->cert_info->key->algor->algorithm = OBJ_nid2obj(NID_rsaEncryption); + } + epk = X509_get_pubkey(cert); + if (NULL == epk) + { + error("Failed to extract public key from certificate\n"); + return NULL; + } + + lkey = RSAPublicKey_dup((RSA *) epk->pkey.ptr); + EVP_PKEY_free(epk); + *key_len = RSA_size(lkey); + return lkey; +} + +/* returns boolean */ +RD_BOOL +ssl_certs_ok(SSL_CERT * server_cert, SSL_CERT * cacert) +{ + /* Currently, we don't use the CA Certificate. + FIXME: + *) Verify the server certificate (server_cert) with the + CA certificate. + *) Store the CA Certificate with the hostname of the + server we are connecting to as key, and compare it + when we connect the next time, in order to prevent + MITM-attacks. + */ + return True; +} + +int +ssl_cert_print_fp(FILE * fp, SSL_CERT * cert) +{ + return X509_print_fp(fp, cert); +} + +void +ssl_rkey_free(SSL_RKEY * rkey) +{ + RSA_free(rkey); +} + +/* returns error */ +int +ssl_rkey_get_exp_mod(SSL_RKEY * rkey, uint8 * exponent, uint32 max_exp_len, uint8 * modulus, + uint32 max_mod_len) +{ + int len; + + if ((BN_num_bytes(rkey->e) > (int) max_exp_len) || + (BN_num_bytes(rkey->n) > (int) max_mod_len)) + { + return 1; + } + len = BN_bn2bin(rkey->e, exponent); + reverse(exponent, len); + len = BN_bn2bin(rkey->n, modulus); + reverse(modulus, len); + return 0; +} + +/* returns boolean */ +RD_BOOL +ssl_sig_ok(uint8 * exponent, uint32 exp_len, uint8 * modulus, uint32 mod_len, + uint8 * signature, uint32 sig_len) +{ + /* Currently, we don't check the signature + FIXME: + */ + return True; +} --- rdesktop-1.5.0.orig/ssl.h +++ rdesktop-1.5.0/ssl.h @@ -0,0 +1,64 @@ +/* -*- c-basic-offset: 8 -*- + rdesktop: A Remote Desktop Protocol client. + Secure sockets abstraction layer + Copyright (C) Matthew Chapman 1999-2007 + Copyright (C) Jay Sorg 2006-2007 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 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., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef _SSL_H +#define _SSL_H + +#include <openssl/rc4.h> +#include <openssl/md5.h> +#include <openssl/sha.h> +#include <openssl/bn.h> +#include <openssl/x509v3.h> + +#if defined(OPENSSL_VERSION_NUMBER) && (OPENSSL_VERSION_NUMBER >= 0x0090800f) +#define D2I_X509_CONST const +#else +#define D2I_X509_CONST +#endif + +#define SSL_RC4 RC4_KEY +#define SSL_SHA1 SHA_CTX +#define SSL_MD5 MD5_CTX +#define SSL_CERT X509 +#define SSL_RKEY RSA + +void ssl_sha1_init(SSL_SHA1 * sha1); +void ssl_sha1_update(SSL_SHA1 * sha1, uint8 * data, uint32 len); +void ssl_sha1_final(SSL_SHA1 * sha1, uint8 * out_data); +void ssl_md5_init(SSL_MD5 * md5); +void ssl_md5_update(SSL_MD5 * md5, uint8 * data, uint32 len); +void ssl_md5_final(SSL_MD5 * md5, uint8 * out_data); +void ssl_rc4_set_key(SSL_RC4 * rc4, uint8 * key, uint32 len); +void ssl_rc4_crypt(SSL_RC4 * rc4, uint8 * in_data, uint8 * out_data, uint32 len); +void ssl_rsa_encrypt(uint8 * out, uint8 * in, int len, uint32 modulus_size, uint8 * modulus, + uint8 * exponent); +SSL_CERT *ssl_cert_read(uint8 * data, uint32 len); +void ssl_cert_free(SSL_CERT * cert); +SSL_RKEY *ssl_cert_to_rkey(SSL_CERT * cert, uint32 * key_len); +RD_BOOL ssl_certs_ok(SSL_CERT * server_cert, SSL_CERT * cacert); +int ssl_cert_print_fp(FILE * fp, SSL_CERT * cert); +void ssl_rkey_free(SSL_RKEY * rkey); +int ssl_rkey_get_exp_mod(SSL_RKEY * rkey, uint8 * exponent, uint32 max_exp_len, uint8 * modulus, + uint32 max_mod_len); +RD_BOOL ssl_sig_ok(uint8 * exponent, uint32 exp_len, uint8 * modulus, uint32 mod_len, + uint8 * signature, uint32 sig_len); + +#endif --- rdesktop-1.5.0.orig/tcp.c +++ rdesktop-1.5.0/tcp.c @@ -1,13 +1,13 @@ /* -*- c-basic-offset: 8 -*- rdesktop: A Remote Desktop Protocol client. Protocol services - TCP layer - Copyright (C) Matthew Chapman 1999-2005 - + Copyright (C) Matthew Chapman 1999-2007 + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 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 @@ -18,6 +18,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#ifndef _WIN32 #include <unistd.h> /* select read write close */ #include <sys/socket.h> /* socket connect setsockopt */ #include <sys/time.h> /* timeval */ @@ -26,30 +27,81 @@ #include <netinet/tcp.h> /* TCP_NODELAY */ #include <arpa/inet.h> /* inet_addr */ #include <errno.h> /* errno */ +#endif + #include "rdesktop.h" +#ifdef _WIN32 +#define socklen_t int +#define TCP_CLOSE(_sck) closesocket(_sck) +#define TCP_STRERROR "tcp error" +#define TCP_BLOCKS (WSAGetLastError() == WSAEWOULDBLOCK) +#else +#define TCP_CLOSE(_sck) close(_sck) +#define TCP_STRERROR strerror(errno) +#define TCP_BLOCKS (errno == EWOULDBLOCK) +#endif + #ifndef INADDR_NONE #define INADDR_NONE ((unsigned long) -1) #endif -static int sock; -static struct stream in; -static struct stream out; +#ifdef WITH_SCARD +#define STREAM_COUNT 8 +#else +#define STREAM_COUNT 1 +#endif + +static int g_sock; +static struct stream g_in; +static struct stream g_out[STREAM_COUNT]; int g_tcp_port_rdp = TCP_PORT_RDP; +/* wait till socket is ready to write or timeout */ +static RD_BOOL +tcp_can_send(int sck, int millis) +{ + fd_set wfds; + struct timeval time; + int sel_count; + + time.tv_sec = millis / 1000; + time.tv_usec = (millis * 1000) % 1000000; + FD_ZERO(&wfds); + FD_SET(sck, &wfds); + sel_count = select(sck + 1, 0, &wfds, 0, &time); + if (sel_count > 0) + { + return True; + } + return False; +} + /* Initialise TCP transport data packet */ STREAM tcp_init(uint32 maxlen) { - if (maxlen > out.size) + static int cur_stream_id = 0; + STREAM result = NULL; + +#ifdef WITH_SCARD + scard_lock(SCARD_LOCK_TCP); +#endif + result = &g_out[cur_stream_id]; + cur_stream_id = (cur_stream_id + 1) % STREAM_COUNT; + + if (maxlen > result->size) { - out.data = (uint8 *) xrealloc(out.data, maxlen); - out.size = maxlen; + result->data = (uint8 *) xrealloc(result->data, maxlen); + result->size = maxlen; } - out.p = out.data; - out.end = out.data + out.size; - return &out; + result->p = result->data; + result->end = result->data + result->size; +#ifdef WITH_SCARD + scard_unlock(SCARD_LOCK_TCP); +#endif + return result; } /* Send TCP transport data packet */ @@ -59,36 +111,49 @@ int length = s->end - s->data; int sent, total = 0; +#ifdef WITH_SCARD + scard_lock(SCARD_LOCK_TCP); +#endif while (total < length) { - sent = send(sock, s->data + total, length - total, 0); + sent = send(g_sock, s->data + total, length - total, 0); if (sent <= 0) { - error("send: %s\n", strerror(errno)); - return; + if (sent == -1 && TCP_BLOCKS) + { + tcp_can_send(g_sock, 100); + sent = 0; + } + else + { + error("send: %s\n", TCP_STRERROR); + return; + } } - total += sent; } +#ifdef WITH_SCARD + scard_unlock(SCARD_LOCK_TCP); +#endif } /* Receive a message on the TCP layer */ STREAM tcp_recv(STREAM s, uint32 length) { - unsigned int new_length, end_offset, p_offset; + uint32 new_length, end_offset, p_offset; int rcvd = 0; if (s == NULL) { /* read into "new" stream */ - if (length > in.size) + if (length > g_in.size) { - in.data = (uint8 *) xrealloc(in.data, length); - in.size = length; + g_in.data = (uint8 *) xrealloc(g_in.data, length); + g_in.size = length; } - in.end = in.p = in.data; - s = ∈ + g_in.end = g_in.p = g_in.data; + s = &g_in; } else { @@ -107,15 +172,22 @@ while (length > 0) { - if (!ui_select(sock)) + if (!ui_select(g_sock)) /* User quit */ return NULL; - rcvd = recv(sock, s->end, length, 0); + rcvd = recv(g_sock, s->end, length, 0); if (rcvd < 0) { - error("recv: %s\n", strerror(errno)); - return NULL; + if (rcvd == -1 && TCP_BLOCKS) + { + rcvd = 0; + } + else + { + error("recv: %s\n", TCP_STRERROR); + return NULL; + } } else if (rcvd == 0) { @@ -131,10 +203,12 @@ } /* Establish a connection on the TCP layer */ -BOOL +RD_BOOL tcp_connect(char *server) { - int true_value = 1; + socklen_t option_len; + uint32 option_value; + int i; #ifdef IPv6 @@ -155,22 +229,22 @@ } ressave = res; - sock = -1; + g_sock = -1; while (res) { - sock = socket(res->ai_family, res->ai_socktype, res->ai_protocol); - if (!(sock < 0)) + g_sock = socket(res->ai_family, res->ai_socktype, res->ai_protocol); + if (!(g_sock < 0)) { - if (connect(sock, res->ai_addr, res->ai_addrlen) == 0) + if (connect(g_sock, res->ai_addr, res->ai_addrlen) == 0) break; - close(sock); - sock = -1; + TCP_CLOSE(g_sock); + g_sock = -1; } res = res->ai_next; } freeaddrinfo(ressave); - if (sock == -1) + if (g_sock == -1) { error("%s: unable to connect\n", server); return False; @@ -191,31 +265,47 @@ return False; } - if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) + if ((g_sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) { - error("socket: %s\n", strerror(errno)); + error("socket: %s\n", TCP_STRERROR); return False; } servaddr.sin_family = AF_INET; - servaddr.sin_port = htons(g_tcp_port_rdp); + servaddr.sin_port = htons((uint16) g_tcp_port_rdp); - if (connect(sock, (struct sockaddr *) &servaddr, sizeof(struct sockaddr)) < 0) + if (connect(g_sock, (struct sockaddr *) &servaddr, sizeof(struct sockaddr)) < 0) { - error("connect: %s\n", strerror(errno)); - close(sock); + error("connect: %s\n", TCP_STRERROR); + TCP_CLOSE(g_sock); return False; } #endif /* IPv6 */ - setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (void *) &true_value, sizeof(true_value)); + option_value = 1; + option_len = sizeof(option_value); + setsockopt(g_sock, IPPROTO_TCP, TCP_NODELAY, (void *) &option_value, option_len); + /* receive buffer must be a least 16 K */ + if (getsockopt(g_sock, SOL_SOCKET, SO_RCVBUF, (void *) &option_value, &option_len) == 0) + { + if (option_value < (1024 * 16)) + { + option_value = 1024 * 16; + option_len = sizeof(option_value); + setsockopt(g_sock, SOL_SOCKET, SO_RCVBUF, (void *) &option_value, + option_len); + } + } - in.size = 4096; - in.data = (uint8 *) xmalloc(in.size); + g_in.size = 4096; + g_in.data = (uint8 *) xmalloc(g_in.size); - out.size = 4096; - out.data = (uint8 *) xmalloc(out.size); + for (i = 0; i < STREAM_COUNT; i++) + { + g_out[i].size = 4096; + g_out[i].data = (uint8 *) xmalloc(g_out[i].size); + } return True; } @@ -224,7 +314,7 @@ void tcp_disconnect(void) { - close(sock); + TCP_CLOSE(g_sock); } char * @@ -233,9 +323,9 @@ static char ipaddr[32]; struct sockaddr_in sockaddr; socklen_t len = sizeof(sockaddr); - if (getsockname(sock, (struct sockaddr *) &sockaddr, &len) == 0) + if (getsockname(g_sock, (struct sockaddr *) &sockaddr, &len) == 0) { - unsigned char *ip = (unsigned char *) &sockaddr.sin_addr; + uint8 *ip = (uint8 *) & sockaddr.sin_addr; sprintf(ipaddr, "%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]); } else @@ -248,31 +338,36 @@ void tcp_reset_state(void) { - sock = -1; /* reset socket */ + int i; + + g_sock = -1; /* reset socket */ /* Clear the incoming stream */ - if (in.data != NULL) - xfree(in.data); - in.p = NULL; - in.end = NULL; - in.data = NULL; - in.size = 0; - in.iso_hdr = NULL; - in.mcs_hdr = NULL; - in.sec_hdr = NULL; - in.rdp_hdr = NULL; - in.channel_hdr = NULL; - - /* Clear the outgoing stream */ - if (out.data != NULL) - xfree(out.data); - out.p = NULL; - out.end = NULL; - out.data = NULL; - out.size = 0; - out.iso_hdr = NULL; - out.mcs_hdr = NULL; - out.sec_hdr = NULL; - out.rdp_hdr = NULL; - out.channel_hdr = NULL; + if (g_in.data != NULL) + xfree(g_in.data); + g_in.p = NULL; + g_in.end = NULL; + g_in.data = NULL; + g_in.size = 0; + g_in.iso_hdr = NULL; + g_in.mcs_hdr = NULL; + g_in.sec_hdr = NULL; + g_in.rdp_hdr = NULL; + g_in.channel_hdr = NULL; + + /* Clear the outgoing stream(s) */ + for (i = 0; i < STREAM_COUNT; i++) + { + if (g_out[i].data != NULL) + xfree(g_out[i].data); + g_out[i].p = NULL; + g_out[i].end = NULL; + g_out[i].data = NULL; + g_out[i].size = 0; + g_out[i].iso_hdr = NULL; + g_out[i].mcs_hdr = NULL; + g_out[i].sec_hdr = NULL; + g_out[i].rdp_hdr = NULL; + g_out[i].channel_hdr = NULL; + } } --- rdesktop-1.5.0.orig/types.h +++ rdesktop-1.5.0/types.h @@ -1,8 +1,8 @@ /* rdesktop: A Remote Desktop Protocol client. Common data types - Copyright (C) Matthew Chapman 1999-2005 - + Copyright (C) Matthew Chapman 1999-2007 + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or @@ -12,13 +12,13 @@ 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ -typedef int BOOL; +typedef int RD_BOOL; #ifndef True #define True (1) @@ -32,16 +32,16 @@ typedef unsigned int uint32; typedef signed int sint32; -typedef void *HBITMAP; -typedef void *HGLYPH; -typedef void *HCOLOURMAP; -typedef void *HCURSOR; +typedef void *RD_HBITMAP; +typedef void *RD_HGLYPH; +typedef void *RD_HCOLOURMAP; +typedef void *RD_HCURSOR; -typedef struct _POINT +typedef struct _RD_POINT { sint16 x, y; } -POINT; +RD_POINT; typedef struct _COLOURENTRY { @@ -95,7 +95,7 @@ sint16 baseline; uint16 width; uint16 height; - HBITMAP pixmap; + RD_HBITMAP pixmap; } FONTGLYPH; @@ -145,7 +145,7 @@ #define MAX_CBSIZE 256 /* RDPSND */ -typedef struct +typedef struct _RD_WAVEFORMATEX { uint16 wFormatTag; uint16 nChannels; @@ -155,7 +155,7 @@ uint16 wBitsPerSample; uint16 cbSize; uint8 cb[MAX_CBSIZE]; -} WAVEFORMATEX; +} RD_WAVEFORMATEX; typedef struct _RDPCOMP { @@ -166,20 +166,20 @@ RDPCOMP; /* RDPDR */ -typedef uint32 NTSTATUS; -typedef uint32 NTHANDLE; +typedef uint32 RD_NTSTATUS; +typedef uint32 RD_NTHANDLE; typedef struct _DEVICE_FNS { - NTSTATUS(*create) (uint32 device, uint32 desired_access, uint32 share_mode, - uint32 create_disposition, uint32 flags_and_attributes, char *filename, - NTHANDLE * handle); - NTSTATUS(*close) (NTHANDLE handle); - NTSTATUS(*read) (NTHANDLE handle, uint8 * data, uint32 length, uint32 offset, - uint32 * result); - NTSTATUS(*write) (NTHANDLE handle, uint8 * data, uint32 length, uint32 offset, - uint32 * result); - NTSTATUS(*device_control) (NTHANDLE handle, uint32 request, STREAM in, STREAM out); + RD_NTSTATUS(*create) (uint32 device, uint32 desired_access, uint32 share_mode, + uint32 create_disposition, uint32 flags_and_attributes, + char *filename, RD_NTHANDLE * handle); + RD_NTSTATUS(*close) (RD_NTHANDLE handle); + RD_NTSTATUS(*read) (RD_NTHANDLE handle, uint8 * data, uint32 length, uint32 offset, + uint32 * result); + RD_NTSTATUS(*write) (RD_NTHANDLE handle, uint8 * data, uint32 length, uint32 offset, + uint32 * result); + RD_NTSTATUS(*device_control) (RD_NTHANDLE handle, uint32 request, STREAM in, STREAM out); } DEVICE_FNS; @@ -187,7 +187,7 @@ typedef struct rdpdr_device_info { uint32 device_type; - NTHANDLE handle; + RD_NTHANDLE handle; char name[8]; char *local_path; void *pdevice_data; @@ -235,7 +235,7 @@ char *driver, *printer; uint32 bloblen; uint8 *blob; - BOOL default_printer; + RD_BOOL default_printer; } PRINTER; @@ -259,10 +259,10 @@ DIR *pdir; struct dirent *pdirent; char pattern[PATH_MAX]; - BOOL delete_on_close; + RD_BOOL delete_on_close; NOTIFY notify; uint32 info_class; } FILEINFO; -typedef BOOL(*str_handle_lines_t) (const char *line, void *data); +typedef RD_BOOL(*str_handle_lines_t) (const char *line, void *data); --- rdesktop-1.5.0.orig/uiports/makefile_nanox +++ rdesktop-1.5.0/uiports/makefile_nanox @@ -0,0 +1,25 @@ +# +# nanoxrdesktop makefile +# +# These two following lines must point to the currently installed version of +# nano-X. You can override them on the make command line to point at your +# installation without changing this file. +# +NXINCLUDES=/usr/local/nanox/src/include +NXLIBS=/usr/local/nanox/src/lib/libnano-X.a + +CC = gcc +CFLAGS = -Os -Wall -I$(NXINCLUDES) +RESTOBJ = ../tcp.o ../iso.o ../mcs.o ../secure.o ../rdp.o ../rdp5.o ../orders.o ../cache.o ../mppc.o ../licence.o ../bitmap.o ../channels.o ../pstcache.o +LDFLAGS = -lcrypto + +all: nanoxrd + +nanoxrd: $(RESTOBJ) nanoxwin.o + $(CC) -o nanoxrdesktop nanoxwin.o $(NXLIBS) $(RESTOBJ) $(LDFLAGS) + strip nanoxrdesktop + +clean: + rm -f nanoxrdesktop + rm -f *.o + rm -f ../*.o --- rdesktop-1.5.0.orig/uiports/makefile_qt +++ rdesktop-1.5.0/uiports/makefile_qt @@ -0,0 +1,86 @@ +# +# qtrdesktop makefile +# qt should be installed in /usr/local/qt or /usr/lib/qt3 +# set QTBDIR to this location + +QTBDIR = /usr/lib/qt3 + +CC = g++ +CPPFLAGS = -O2 -Wall -I$(QTBDIR)/include -I.. +# the next line is for sound +#CPPFLAGS += -DWITH_RDPSND +RESTOBJ = tcp.o iso.o mcs.o secure.o rdp.o rdp5.o +RESTOBJ += orders.o cache.o mppc.o licence.o bitmap.o +RESTOBJ += channels.o pstcache.o ssl.o +# the next line is for sound +#RESTOBJ += rdpsnd.o rdpsnd_oss.o rdpsnd_dsp.o +LD2FLAGS = -L$(QTBDIR)/lib -L/usr/X11R6/lib +LDFLAGS = -lcrypto -lqt-mt -lXext -lX11 -lm +MOCFILE = $(QTBDIR)/bin/moc + +all: qtrd + +qtrd: $(RESTOBJ) qtwin.o + $(MOCFILE) qtwin.h > moc_qtwin.cpp + $(CC) $(CPPFLAGS) -c moc_qtwin.cpp + $(CC) -o qtrdesktop $(LD2FLAGS) qtwin.o moc_qtwin.o $(RESTOBJ) $(LDFLAGS) + strip qtrdesktop + +clean: + rm -f qtrdesktop + rm -f *.o + rm -f ../*.o + rm -f moc_qtwin.cpp + +# common files + +tcp.o: ../tcp.c + $(CC) $(CPPFLAGS) -c ../tcp.c + +iso.o: ../iso.c + $(CC) $(CPPFLAGS) -c ../iso.c + +mcs.o: ../mcs.c + $(CC) $(CPPFLAGS) -c ../mcs.c + +secure.o: ../secure.c + $(CC) $(CPPFLAGS) -c ../secure.c + +rdp.o: ../rdp.c + $(CC) $(CPPFLAGS) -c ../rdp.c + +rdp5.o: ../rdp5.c + $(CC) $(CPPFLAGS) -c ../rdp5.c + +orders.o: ../orders.c + $(CC) $(CPPFLAGS) -c ../orders.c + +cache.o: ../cache.c + $(CC) $(CPPFLAGS) -c ../cache.c + +mppc.o: ../mppc.c + $(CC) $(CPPFLAGS) -c ../mppc.c + +licence.o: ../licence.c + $(CC) $(CPPFLAGS) -c ../licence.c + +bitmap.o: ../bitmap.c + $(CC) $(CPPFLAGS) -c ../bitmap.c + +channels.o: ../channels.c + $(CC) $(CPPFLAGS) -c ../channels.c + +pstcache.o: ../pstcache.c + $(CC) $(CPPFLAGS) -c ../pstcache.c + +ssl.o: ../ssl.c + $(CC) $(CPPFLAGS) -c ../ssl.c + +rdpsnd.o: ../rdpsnd.c + $(CC) $(CPPFLAGS) -c ../rdpsnd.c + +rdpsnd_oss.o: ../rdpsnd_oss.c + $(CC) $(CPPFLAGS) -c ../rdpsnd_oss.c + +rdpsnd_dsp.o: ../rdpsnd_dsp.c + $(CC) $(CPPFLAGS) -c ../rdpsnd_dsp.c --- rdesktop-1.5.0.orig/uiports/makefile_qte +++ rdesktop-1.5.0/uiports/makefile_qte @@ -0,0 +1,24 @@ +# +# qterdesktop makefile +# qt should be installed in /usr/local/qt +# +CC = g++ +CPPFLAGS = -DQWS -fno-exceptions -fno-rtti -Wall -Os -Wall -I/usr/local/qt/include -DWITH_RDPSND -DNO_DEBUG +RESTOBJ = ../tcp.o ../iso.o ../mcs.o ../secure.o ../rdp.o ../rdp5.o ../orders.o ../cache.o ../mppc.o ../licence.o ../bitmap.o ../channels.o ../pstcache.o ../rdpsnd.o ../rdpsnd_oss.o +LD2FLAGS = -L/usr/local/qt/lib +LDFLAGS = -lcrypto -lqte +MOCFILE = /usr/local/qt/bin/moc + +all: qtrd + +qtrd: $(RESTOBJ) qtewin.o + $(MOCFILE) qtewin.h > moc_qtewin.cpp + $(CC) $(CPPFLAGS) -c moc_qtewin.cpp + $(CC) -o qterdesktop $(LD2FLAGS) qtewin.o moc_qtewin.o $(RESTOBJ) $(LDFLAGS) + strip qterdesktop + +clean: + rm -f qterdesktop + rm -f *.o + rm -f ../*.o + rm -f moc_qtewin.cpp --- rdesktop-1.5.0.orig/uiports/makefile_svga +++ rdesktop-1.5.0/uiports/makefile_svga @@ -0,0 +1,36 @@ +CC = gcc +CFLAGS = -Os -DWITH_OPENSSL -DL_ENDIAN -Wall +RESTOBJ = ../tcp.o ../iso.o ../mcs.o ../secure.o ../rdp.o ../rdp5.o ../orders.o ../cache.o ../mppc.o ../licence.o ../bitmap.o ../channels.o ../pstcache.o ../ssl.o +LDFLAGS = -lvga -lcrypto + +#LDFLAGS = -lm /usr/local/lib/libvga.a /usr/lib/libcrypto.a +#LDFLAGS = -lvga /usr/lib/libcrypto.a + +all: svgard +svgard: svgawin.o $(RESTOBJ) + $(CC) -o svgardesktop svgawin.o $(RESTOBJ) $(LDFLAGS) + strip svgardesktop + +#rest: $(RESTOBJ) +#rest: tcp.o iso.o mcs.o secure.o rdp.o rdp5.o orders.o cache.o mppc.o licence.o bitmap.o channels.o pstcache.o +rest: ../tcp.c ../iso.c ../mcs.c ../secure.c ../rdp.c ../rdp5.c ../orders.c ../cache.c ../mppc.c ../licence.c ../bitmap.c ../channels.c ../pstcache.c + $(CC) $(CFLAGS) -c ../tcp.c -o ../tcp.o + $(CC) $(CFLAGS) -c ../iso.c -o ../iso.o + $(CC) $(CFLAGS) -c ../mcs.c -o ../mcs.o + $(CC) $(CFLAGS) -c ../secure.c -o ../secue.o + $(CC) $(CFLAGS) -c ../rdp.c -o ../rdp.o + $(CC) $(CFLAGS) -c ../rdp5.c -o ../rdp5.o + $(CC) $(CFLAGS) -c ../orders.c -o ../orders.o + $(CC) $(CFLAGS) -c ../cache.c -o ../cache.o + $(CC) $(CFLAGS) -c ../mppc.c -o ../mppc.o + $(CC) $(CFLAGS) -c ../licence.c -o ../licence.o + $(CC) $(CFLAGS) -c ../bitmap.c -o ../bitmap.o + $(CC) $(CFLAGS) -c ../channels.c -o ../channels.o + $(CC) $(CFLAGS) -c ../pstcache.c -o ../pstcache.o + +svgawin.o: svgawin.c + $(CC) $(CFLAGS) -c $*.c +clean: + rm -f svgardesktop + rm -f *.o + rm -f ../*.o --- rdesktop-1.5.0.orig/uiports/makefile_xxx +++ rdesktop-1.5.0/uiports/makefile_xxx @@ -0,0 +1,18 @@ +# +# xxxrdesktop makefile +# +CC = gcc +CFLAGS = -O2 -Wall +RESTOBJ = ../tcp.o ../iso.o ../mcs.o ../secure.o ../rdp.o ../rdp5.o ../orders.o ../cache.o ../mppc.o ../licence.o ../bitmap.o ../channels.o ../pstcache.o ../ssl.o +LDFLAGS = -lcrypto + +all: xxxrd + +xxxrd: $(RESTOBJ) xxxwin.o + $(CC) -o xxxrdesktop xxxwin.o $(RESTOBJ) $(LDFLAGS) + strip xxxrdesktop + +clean: + rm -f xxxrdesktop + rm -f *.o + rm -f ../*.o --- rdesktop-1.5.0.orig/uiports/nanoxreadme.txt +++ rdesktop-1.5.0/uiports/nanoxreadme.txt @@ -0,0 +1,9 @@ +This is the nanox ui port +tested with versions 0.90 + +makefile_nanox can be edited to change file localtions +run make -f makefile_nanox in this directory to compile it + +nanoxreadme.txt - notes, this file +makefile_nanox - makefile +nanoxwin.cpp - ui lib --- rdesktop-1.5.0.orig/uiports/nanoxwin.c +++ rdesktop-1.5.0/uiports/nanoxwin.c @@ -0,0 +1,1547 @@ +/* -*- c-basic-offset: 8 -*- + rdesktop: A Remote Desktop Protocol client. + User interface services - NanoX(microwindows) + Copyright (C) Jay Sorg 2004-2005 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 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., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ +/* + problems with nanox lib + opcodes don't work, can only rely on copy + stipple orgins don't work + clip seems to affect source too, it should only affect dest + in copyarea functions +*/ + +#include "../rdesktop.h" + +#include <stdarg.h> /* va_list va_start va_end */ +#include <unistd.h> /* gethostname */ +#include <pwd.h> /* getpwuid */ + +#include <nano-X.h> + +extern int g_tcp_port_rdp; +int g_use_rdp5 = 1; +char g_hostname[16]; +char g_username[64]; +int g_width = 800; +int g_height = 600; +int g_server_bpp = 16; +int g_encryption = 1; +int g_desktop_save = 0; /* todo */ +int g_polygon_ellipse_orders = 0; +int g_bitmap_cache = 1; +int g_bitmap_cache_persist_enable = 0; +int g_bitmap_cache_precache = 1; +int g_bitmap_compression = 1; +uint32 g_rdp5_performanceflags = + RDP5_NO_WALLPAPER | RDP5_NO_FULLWINDOWDRAG | RDP5_NO_MENUANIMATIONS; +int g_console_session = 0; +int g_keylayout = 0x409; /* Defaults to US keyboard layout */ +int g_keyboard_type = 0x4; /* Defaults to US keyboard layout */ +int g_keyboard_subtype = 0x0; /* Defaults to US keyboard layout */ +int g_keyboard_functionkeys = 0xc; /* Defaults to US keyboard layout */ + +static int g_sck = 0; +static char g_servername[256] = ""; +static char g_password[64] = ""; +static char g_domain[64] = ""; +static char g_shell[64] = ""; +static char g_directory[64] = ""; +static GR_WINDOW_ID g_wnd = 0; +static GR_GC_ID g_gc = 0; +static GR_GC_ID g_gc_clean = 0; +static int g_deactivated = 0; +static int g_ext_disc_reason = 0; +static GR_SCREEN_INFO g_screen_info; +static int g_bpp = 0; +static int g_Bpp = 0; +static GR_RECT g_clip; /* set in main */ +static GR_CURSOR_ID g_null_cursor; /* set in main */ +static int g_flags = RDP_LOGON_NORMAL; + +struct key +{ + int ch1; + int ch2; + int ch3; + int chs; /* shift char */ +}; + +static struct key g_keys[256]; + +/* Session Directory redirection */ +BOOL g_redirect = False; +char g_redirect_server[64]; +char g_redirect_domain[16]; +char g_redirect_password[64]; +char g_redirect_username[64]; +char g_redirect_cookie[128]; +uint32 g_redirect_flags = 0; + +#define COLOR16TO32(color) \ +( \ + ((((color >> 8) & 0xf8) | ((color >> 13) & 0x7)) << 0) | \ + ((((color >> 3) & 0xfc) | ((color >> 9) & 0x3)) << 8) | \ + ((((color << 3) & 0xf8) | ((color >> 2) & 0x7)) << 16) \ +) + +static uint32 g_ops[16] = +{ + GR_MODE_CLEAR, /* 0 */ + GR_MODE_NOR, /* ~(src | dst) */ + GR_MODE_ANDINVERTED, /* (~src) & dst */ + GR_MODE_COPYINVERTED, /* ~src */ + GR_MODE_ANDREVERSE, /* src & (~dst) */ + GR_MODE_INVERT, /* ~(dst) */ + GR_MODE_XOR, /* src ^ dst */ + GR_MODE_NAND, /* ~(src & dst) */ + GR_MODE_AND, /* src & dst */ + GR_MODE_EQUIV, /* ~(src) ^ dst or is it ~(src ^ dst) */ + GR_MODE_NOOP, /* dst */ + GR_MODE_ORINVERTED, /* (~src) | dst */ + GR_MODE_COPY, /* src */ + GR_MODE_ORREVERSE, /* src | (~dst) */ + GR_MODE_OR, /* src | dst */ + GR_MODE_SETTO1 /* ~0 */ +}; + +/*****************************************************************************/ +/* do a raster op */ +static int rop(int rop, int src, int dst) +{ + switch (rop) + { + case 0x0: return 0; + case 0x1: return ~(src | dst); + case 0x2: return (~src) & dst; + case 0x3: return ~src; + case 0x4: return src & (~dst); + case 0x5: return ~(dst); + case 0x6: return src ^ dst; + case 0x7: return ~(src & dst); + case 0x8: return src & dst; + case 0x9: return ~(src) ^ dst; + case 0xa: return dst; + case 0xb: return (~src) | dst; + case 0xc: return src; + case 0xd: return src | (~dst); + case 0xe: return src | dst; + case 0xf: return ~0; + } + return dst; +} + +/*****************************************************************************/ +static int get_pixel32(uint8 * data, int x, int y, + int width, int height) +{ + if (x >= 0 && y >= 0 && x < width && y < height) + { + return *(((int*)data) + (y * width + x)); + } + else + { + return 0; + } +} + +/*****************************************************************************/ +static void set_pixel32(uint8 * data, int x, int y, + int width, int height, int pixel) +{ + if (x >= 0 && y >= 0 && x < width && y < height) + { + *(((int*)data) + (y * width + x)) = pixel; + } +} + +/*****************************************************************************/ +static int warp_coords(int * x, int * y, int * cx, int * cy, + int * srcx, int * srcy) +{ + int dx; + int dy; + + if (g_clip.x > *x) + { + dx = g_clip.x - *x; + } + else + { + dx = 0; + } + if (g_clip.y > *y) + { + dy = g_clip.y - *y; + } + else + { + dy = 0; + } + if (*x + *cx > g_clip.x + g_clip.width) + { + *cx = (*cx - ((*x + *cx) - (g_clip.x + g_clip.width))); + } + if (*y + *cy > g_clip.y + g_clip.height) + { + *cy = (*cy - ((*y + *cy) - (g_clip.y + g_clip.height))); + } + *cx = *cx - dx; + *cy = *cy - dy; + if (*cx <= 0) + { + return 0; + } + if (*cy <= 0) + { + return 0; + } + *x = *x + dx; + *y = *y + dy; + if (srcx != 0) + { + *srcx = *srcx + dx; + } + if (srcy != 0) + { + *srcy = *srcy + dy; + } + return 1; +} + +/******************************************************************************/ +/* check if a certain pixel is set in a bitmap */ +static int is_pixel_on(uint8 * data, int x, int y, int width, int bpp) +{ + int start; + int shift; + + if (bpp == 1) + { + width = (width + 7) / 8; + start = (y * width) + x / 8; + shift = x % 8; + return (data[start] & (0x80 >> shift)) != 0; + } + else + return 0; +} + +/*****************************************************************************/ +int ui_select(int in) +{ + if (g_sck == 0) + { + g_sck = in; + } + return 1; +} + +/*****************************************************************************/ +void ui_set_clip(int x, int y, int cx, int cy) +{ + GR_REGION_ID region; + + g_clip.x = x; + g_clip.y = y; + g_clip.width = cx; + g_clip.height = cy; + region = GrNewRegion(); + GrUnionRectWithRegion(region, &g_clip); + GrSetGCRegion(g_gc, region); /* can't destroy region here, i guess gc */ + /* takes owership, if you destroy it */ + /* clip is reset, hum */ +} + +/*****************************************************************************/ +void ui_reset_clip(void) +{ + GrSetGCRegion(g_gc, 0); + g_clip.x = 0; + g_clip.y = 0; + g_clip.width = g_width; + g_clip.height = g_height; +} + +/*****************************************************************************/ +void ui_bell(void) +{ + GrBell(); +} + +/*****************************************************************************/ +/* gota convert the rdp glyph to nanox glyph */ +void * ui_create_glyph(int width, int height, uint8 * data) +{ + char * p, * q, * r; + int datasize, i, j; + + datasize = GR_BITMAP_SIZE(width, height) * sizeof(GR_BITMAP); + p = xmalloc(datasize); + q = p; + r = data; + memset(p, 0, datasize); + for (i = 0; i < height; i++) + { + j = 0; + while (j + 8 < width) + { + *q = *(r + 1); + q++; + r++; + *q = *(r - 1); + q++; + r++; + j += 16; + } + if ((width % 16) <= 8 && (width % 16) > 0) + { + q++; + *q = *r; + q++; + r++; + j += 8; + } + } + return p; +} + +/*****************************************************************************/ +void ui_destroy_glyph(void * glyph) +{ + xfree(glyph); +} + +/*****************************************************************************/ +void * ui_create_colourmap(COLOURMAP * colors) +{ + return 0; +} + +/*****************************************************************************/ +void ui_set_colourmap(void * map) +{ +} + +/*****************************************************************************/ +void * ui_create_bitmap(int width, int height, uint8 * data) +{ + GR_WINDOW_ID pixmap; + uint8 * p; + uint32 i, j, pixel; + + p = data; + pixmap = GrNewPixmap(width, height, 0); + if (g_server_bpp == 16 && g_bpp == 32) + { + p = xmalloc(width * height * g_Bpp); + for (i = 0; i < height; i++) + { + for (j = 0; j < width; j++) + { + pixel = *(((uint16 *) data) + (i * width + j)); + pixel = COLOR16TO32(pixel); + *(((uint32 *) p) + (i * width + j)) = pixel; + } + } + } + GrArea(pixmap, g_gc_clean, 0, 0, width, height, p, MWPF_RGB); + if (p != data) + { + xfree(p); + } + return (void *) pixmap; +} + +/*****************************************************************************/ +void ui_destroy_bitmap(void * bmp) +{ + GrDestroyWindow((GR_WINDOW_ID)bmp); +} + +/*****************************************************************************/ +#define DO_GLYPH(ttext,idx) \ +{ \ + glyph = cache_get_font (font, ttext[idx]); \ + if (!(flags & TEXT2_IMPLICIT_X)) \ + { \ + xyoffset = ttext[++idx]; \ + if ((xyoffset & 0x80)) \ + { \ + if (flags & TEXT2_VERTICAL) \ + { \ + y += ttext[idx+1] | (ttext[idx+2] << 8); \ + } \ + else \ + { \ + x += ttext[idx+1] | (ttext[idx+2] << 8); \ + } \ + idx += 2; \ + } \ + else \ + { \ + if (flags & TEXT2_VERTICAL) \ + { \ + y += xyoffset; \ + } \ + else \ + { \ + x += xyoffset; \ + } \ + } \ + } \ + if (glyph != NULL) \ + { \ + x1 = x + glyph->offset; \ + y1 = y + glyph->baseline; \ + GrBitmap(g_wnd, g_gc, x1, y1, glyph->width, glyph->height, glyph->pixmap); \ + if (flags & TEXT2_IMPLICIT_X) \ + { \ + x += glyph->width; \ + } \ + } \ +} + +/*****************************************************************************/ +void ui_draw_text(uint8 font, uint8 flags, uint8 opcode, int mixmode, + int x, int y, + int clipx, int clipy, int clipcx, int clipcy, + int boxx, int boxy, int boxcx, int boxcy, BRUSH * brush, + int bgcolor, int fgcolor, uint8 * text, uint8 length) +{ + FONTGLYPH * glyph; + int i, j, xyoffset, x1, y1; + DATABLOB * entry; + + GrSetGCMode(g_gc, GR_MODE_COPY); + GrSetGCUseBackground(g_gc, 0); /* this can be set when gc is created */ + if (g_server_bpp == 16 && g_bpp == 32) + { + fgcolor = COLOR16TO32(fgcolor); + bgcolor = COLOR16TO32(bgcolor); + } + GrSetGCForeground(g_gc, bgcolor); + if (boxx + boxcx > g_width) + { + boxcx = g_width - boxx; + } + if (boxcx > 1) + { + GrFillRect(g_wnd, g_gc, boxx, boxy, boxcx, boxcy); + } + else if (mixmode == MIX_OPAQUE) + { + GrFillRect(g_wnd, g_gc, clipx, clipy, clipcx, clipcy); + } + GrSetGCForeground(g_gc, fgcolor); + /* Paint text, character by character */ + for (i = 0; i < length;) + { + switch (text[i]) + { + case 0xff: + if (i + 2 < length) + { + cache_put_text(text[i + 1], text, text[i + 2]); + } + else + { + error("this shouldn't be happening\n"); + exit(1); + } + /* this will move pointer from start to first character after */ + /* FF command */ + length -= i + 3; + text = &(text[i + 3]); + i = 0; + break; + case 0xfe: + entry = cache_get_text(text[i + 1]); + if (entry != NULL) + { + if ((((uint8 *) (entry->data))[1] == 0) && + (!(flags & TEXT2_IMPLICIT_X))) + { + if (flags & TEXT2_VERTICAL) + { + y += text[i + 2]; + } + else + { + x += text[i + 2]; + } + } + for (j = 0; j < entry->size; j++) + { + DO_GLYPH(((uint8 *) (entry->data)), j); + } + } + if (i + 2 < length) + { + i += 3; + } + else + { + i += 2; + } + length -= i; + /* this will move pointer from start to first character after */ + /* FE command */ + text = &(text[i]); + i = 0; + break; + default: + DO_GLYPH(text, i); + i++; + break; + } + } +} + +/*****************************************************************************/ +void ui_line(uint8 opcode, int startx, int starty, int endx, int endy, + PEN * pen) +{ + uint32 op; + uint32 color; + + color = pen->colour; + if (opcode == 5) /* GR_MODE_INVERT, not supported so convert it */ + { /* i think x ^ -1 = ~x */ + color = 0xffffffff; + opcode = 6; /* GR_MODE_XOR */ + } + if (opcode == 12 || opcode == 6) /* nanox only supports these 2 opcode */ + { + op = g_ops[opcode]; + GrSetGCMode(g_gc, op); + if (g_server_bpp == 16 && g_bpp == 32) + { + color = COLOR16TO32(color); + } + GrSetGCForeground(g_gc, color); + GrLine(g_wnd, g_gc, startx, starty, endx, endy); + GrSetGCMode(g_gc, GR_MODE_COPY); + } + else + { + unimpl("opcode %d in ui_line\n", opcode); + } +} + +/*****************************************************************************/ +void ui_triblt(uint8 opcode, int x, int y, int cx, int cy, + void * src, int srcx, int srcy, + BRUSH * brush, int bgcolor, int fgcolor) +{ +/* not used, turned off */ +} + +/*****************************************************************************/ +void ui_memblt(uint8 opcode, int x, int y, int cx, int cy, + void * src, int srcx, int srcy) +{ + uint8 * dest; + uint8 * source; + uint8 * final; + GR_WINDOW_INFO wi; + int i, j, s, d; + GR_WINDOW_ID pixmap; + + if (opcode == 12) + { + GrCopyArea(g_wnd, g_gc, x, y, cx, cy, (GR_DRAW_ID)src, srcx, srcy, + GR_MODE_COPY); + } + else /* do opcodes ourself */ + { /* slow but its correct, ok to be slow here, these are rare */ + GrGetWindowInfo((GR_DRAW_ID)src, &wi); + dest = xmalloc(cx * cy * g_Bpp); + source = xmalloc(wi.width * wi.height * g_Bpp); + final = xmalloc(cx * cy * g_Bpp); + memset(final, 0, cx * cy * g_Bpp); + /* dest */ + GrReadArea(g_wnd, x, y, cx, cy, (GR_PIXELVAL*)dest); + /* source */ + GrReadArea((GR_DRAW_ID)src, 0, 0, + wi.width, wi.height, (GR_PIXELVAL*)source); + for (i = 0; i < cy; i++) + { + for (j = 0; j < cx; j++) + { + s = get_pixel32(source, j + srcx, i + srcy, wi.width, wi.height); + d = get_pixel32(dest, j, i, cx ,cy); + set_pixel32(final, j, i, cx, cy, rop(opcode, s, d)); + } + } + pixmap = GrNewPixmap(cx, cy, 0); + GrArea(pixmap, g_gc_clean, 0, 0, cx, cy, final, MWPF_TRUECOLOR0888); + GrCopyArea(g_wnd, g_gc, x, y, cx, cy, pixmap, 0, 0, GR_MODE_COPY); + GrDestroyWindow(pixmap); + xfree(dest); + xfree(source); + xfree(final); + } +} + +/*****************************************************************************/ +void ui_desktop_restore(uint32 offset, int x, int y, int cx, int cy) +{ +/* not used, turned off */ +} + +/*****************************************************************************/ +void ui_desktop_save(uint32 offset, int x, int y, int cx, int cy) +{ +/* not used, turned off */ +} + +/*****************************************************************************/ +void ui_rect(int x, int y, int cx, int cy, int color) +{ + if (g_server_bpp == 16 && g_bpp == 32) + { + color = COLOR16TO32(color); + } + GrSetGCForeground(g_gc, color); + GrFillRect(g_wnd, g_gc, x, y, cx, cy); +} + +/*****************************************************************************/ +/* using warp_coords cause clip seems to affect source in GrCopyArea */ +void ui_screenblt(uint8 opcode, int x, int y, int cx, int cy, + int srcx, int srcy) +{ + if (opcode == 12) + { + if (warp_coords(&x, &y, &cx, &cy, &srcx, &srcy)) + { + GrCopyArea(g_wnd, g_gc_clean, x, y, cx, cy, g_wnd, srcx, srcy, + GR_MODE_COPY); + } + } + else + { + unimpl("opcode %d in ui_screenblt\n", opcode); + } +} + +/******************************************************************************/ +/* can't use stipple cause tsorigin don't work, GrPoint too slow, + GrPoints too slow but better, using a copy from the screen, + do the pattern and copy it back */ +void ui_patblt(uint8 opcode, int x, int y, int cx, int cy, + BRUSH * brush, int bgcolor, int fgcolor) +{ + uint8 ipattern[8], * dest, * final; + uint32 op; + int i, j, s, d; + GR_WINDOW_ID pixmap; + + if (g_server_bpp == 16 && g_bpp == 32) + { + fgcolor = COLOR16TO32(fgcolor); + bgcolor = COLOR16TO32(bgcolor); + } + switch (brush->style) + { + case 0: /* Solid */ + if (opcode == 12 || opcode == 6) + { + op = g_ops[opcode]; + GrSetGCMode(g_gc, op); + GrSetGCForeground(g_gc, fgcolor); + GrFillRect(g_wnd, g_gc, x, y, cx, cy); + GrSetGCMode(g_gc, GR_MODE_COPY); + } + else + { + unimpl("opcode %d in ui_patblt solid brush\n", opcode); + } + break; + case 3: /* Pattern - all opcodes ok */ + for (i = 0; i != 8; i++) + { + ipattern[7 - i] = brush->pattern[i]; + } + dest = xmalloc(cx * cy * g_Bpp); + final = xmalloc(cx * cy * g_Bpp); + memset(final, 0, cx * cy * g_Bpp); + /* dest */ + if (opcode != 12) + { + GrReadArea(g_wnd, x, y, cx, cy, (GR_PIXELVAL*)dest); + } + for (i = 0; i < cy; i++) + { + for (j = 0; j < cx; j++) + { + if (is_pixel_on(ipattern, (x + j + brush->xorigin) % 8, + (y + i + brush->yorigin) % 8, 8, 1)) + { + s = fgcolor; + } + else + { + s = bgcolor; + } + d = get_pixel32(dest, j, i, cx ,cy); + set_pixel32(final, j, i, cx, cy, rop(opcode, s, d)); + } + } + pixmap = GrNewPixmap(cx, cy, 0); + GrArea(pixmap, g_gc_clean, 0, 0, cx, cy, final, MWPF_TRUECOLOR0888); + GrCopyArea(g_wnd, g_gc, x, y, cx, cy, pixmap, 0, 0, GR_MODE_COPY); + GrDestroyWindow(pixmap); + xfree(dest); + xfree(final); + break; + } +} + +/*****************************************************************************/ +void ui_destblt(uint8 opcode, int x, int y, int cx, int cy) +{ + uint32 op; + + if (opcode == 0) /* black */ + { + GrSetGCForeground(g_gc, 0); + opcode = 12; + } + else if (opcode == 5) /* invert */ + { + GrSetGCForeground(g_gc, 0xffffffff); + opcode = 6; + } + else if (opcode == 15) /* white */ + { + GrSetGCForeground(g_gc, 0xffffffff); + opcode = 12; + } + if (opcode == 12 || opcode == 6) + { + op = g_ops[opcode]; + GrSetGCMode(g_gc, op); + GrFillRect(g_wnd, g_gc, x, y, cx, cy); + GrSetGCMode(g_gc, GR_MODE_COPY); + } + else + { + unimpl("opcode %d in ui_destblt\n", opcode); + } +} + +/*****************************************************************************/ +void ui_paint_bitmap(int x, int y, int cx, int cy, + int width, int height, uint8 * data) +{ + void * b; + + b = ui_create_bitmap(width, height, data); + ui_memblt(12, x, y, cx, cy, b, 0, 0); + ui_destroy_bitmap(b); +} + +/*****************************************************************************/ +void ui_move_pointer(int x, int y) +{ + GrMoveCursor(x, y); +} + +/*****************************************************************************/ +void ui_set_null_cursor(void) +{ + GrSetWindowCursor(g_wnd, g_null_cursor); +} + +/*****************************************************************************/ +void ui_set_cursor(void * cursor) +{ + GrSetWindowCursor(g_wnd, (GR_CURSOR_ID)cursor); +} + +//****************************************************************************** +static int is24on(uint8 * data, int x, int y) +{ + uint8 r, g, b; + int start; + + if (data == 0) + { + return 0; + } + start = y * 32 * 3 + x * 3; + r = data[start]; + g = data[start + 1]; + b = data[start + 2]; + return !((r == 0) && (g == 0) && (b == 0)); +} + +//****************************************************************************** +static int is1on(uint8 * data, int x, int y) +{ + int start; + int shift; + + if (data == 0) + { + return 0; + } + start = (y * 32) / 8 + x / 8; + shift = x % 8; + return (data[start] & (0x80 >> shift)) == 0; +} + +//****************************************************************************** +static void set1(uint8 * data, int x, int y) +{ + int start; + int shift; + + if (data == 0) + { + return; + } + start = (y * 32) / 8 + x / 8; + shift = x % 8; + data[start] = data[start] | (0x80 >> shift); +} + +//****************************************************************************** +static void flipover(uint8 * data) +{ + uint8 adata[128]; + int index; + + if (data == 0) + { + return; + } + memcpy(adata, data, 128); + for (index = 0; index <= 31; index++) + { + data[127 - (index * 4 + 3)] = adata[index * 4]; + data[127 - (index * 4 + 2)] = adata[index * 4 + 1]; + data[127 - (index * 4 + 1)] = adata[index * 4 + 2]; + data[127 - index * 4] = adata[index * 4 + 3]; + } +} + +/*****************************************************************************/ +void * ui_create_cursor(uint32 x, uint32 y, + int width, int height, + uint8 * andmask, uint8 * xormask) +{ + uint8 adata[128]; + uint8 amask[128]; + GR_BITMAP * databitmap; + GR_BITMAP * maskbitmap; + GR_CURSOR_ID cursor; + int i1, i2, bon, mon; + + if (width != 32 || height != 32) + { + return 0; + } + memset(adata, 0, 128); + memset(amask, 0, 128); + for (i1 = 0; i1 <= 31; i1++) + { + for (i2 = 0; i2 <= 31; i2++) + { + mon = is24on(xormask, i1, i2); + bon = is1on(andmask, i1, i2); + if (bon ^ mon) // xor + { + set1(adata, i1, i2); + if (!mon) + { + set1(amask, i1, i2); + } + } + if (mon) + { + set1(amask, i1, i2); + } + } + } + flipover(adata); + flipover(amask); + databitmap = ui_create_glyph(32, 32, adata); + maskbitmap = ui_create_glyph(32, 32, amask); + cursor = GrNewCursor(32, 32, x, y, 0xffffff, 0, databitmap, maskbitmap); + ui_destroy_glyph(databitmap); + ui_destroy_glyph(maskbitmap); + return (void*)cursor; +} + +/*****************************************************************************/ +void ui_destroy_cursor(void * cursor) +{ + GrDestroyCursor((GR_CURSOR_ID)cursor); +} + +/*****************************************************************************/ +uint16 ui_get_numlock_state(uint32 state) +{ + return 0; +} + +/*****************************************************************************/ +uint32 read_keyboard_state(void) +{ + return 0; +} + +/*****************************************************************************/ +void ui_resize_window(void) +{ +} + +/*****************************************************************************/ +void ui_begin_update(void) +{ +} + +/*****************************************************************************/ +void ui_end_update(void) +{ +} + +/*****************************************************************************/ +void ui_polygon(uint8 opcode, uint8 fillmode, POINT * point, int npoints, + BRUSH * brush, int bgcolor, int fgcolor) +{ +/* not used, turned off */ +} + +/*****************************************************************************/ +void ui_polyline(uint8 opcode, POINT * points, int npoints, PEN * pen) +{ + int i, x, y, dx, dy; + + if (npoints > 0) + { + x = points[0].x; + y = points[0].y; + for (i = 1; i < npoints; i++) + { + dx = points[i].x; + dy = points[i].y; + ui_line(opcode, x, y, x + dx, y + dy, pen); + x = x + dx; + y = y + dy; + } + } +} + +/*****************************************************************************/ +void ui_ellipse(uint8 opcode, uint8 fillmode, + int x, int y, int cx, int cy, + BRUSH * brush, int bgcolor, int fgcolor) +{ +/* not used, turned off */ +} + +/*****************************************************************************/ +void generate_random(uint8 * random) +{ + memcpy(random, "12345678901234567890123456789012", 32); +} + +/*****************************************************************************/ +void save_licence(uint8 * data, int length) +{ +} + +/*****************************************************************************/ +int load_licence(uint8 ** data) +{ + return 0; +} + +/*****************************************************************************/ +void * xrealloc(void * in, int size) +{ + if (size < 1) + { + size = 1; + } + return realloc(in, size); +} + +/*****************************************************************************/ +void * xmalloc(int size) +{ + return malloc(size); +} + +/*****************************************************************************/ +void xfree(void * in) +{ + if (in != 0) + { + free(in); + } +} + +/*****************************************************************************/ +char * xstrdup(const char * s) +{ + char * mem = strdup(s); + if (mem == NULL) + { + perror("strdup"); + exit(1); + } + return mem; +} + +/*****************************************************************************/ +void warning(char * format, ...) +{ + va_list ap; + + fprintf(stderr, "WARNING: "); + va_start(ap, format); + vfprintf(stderr, format, ap); + va_end(ap); +} + +/*****************************************************************************/ +void unimpl(char * format, ...) +{ + va_list ap; + + fprintf(stderr, "NOT IMPLEMENTED: "); + va_start(ap, format); + vfprintf(stderr, format, ap); + va_end(ap); +} + +/*****************************************************************************/ +void error(char * format, ...) +{ + va_list ap; + + fprintf(stderr, "ERROR: "); + va_start(ap, format); + vfprintf(stderr, format, ap); + va_end(ap); +} + +/*****************************************************************************/ +int rd_pstcache_mkdir(void) +{ + return 0; +} + +/*****************************************************************************/ +int rd_open_file(char * filename) +{ + return 0; +} + +/*****************************************************************************/ +void rd_close_file(int fd) +{ + return; +} + +/*****************************************************************************/ +int rd_read_file(int fd, void * ptr, int len) +{ + return 0; +} + +/*****************************************************************************/ +int rd_write_file(int fd, void * ptr, int len) +{ + return 0; +} + +/*****************************************************************************/ +int rd_lseek_file(int fd, int offset) +{ + return 0; +} + +/*****************************************************************************/ +int rd_lock_file(int fd, int start, int len) +{ + return False; +} + +/*****************************************************************************/ +/*static int key(int ch, int flags) +{ + return (ch & 0xffff) | ((flags & 0xffff) << 16); +}*/ + +/*****************************************************************************/ +static void init_keys(void) +{ + memset(&g_keys, 0, sizeof(g_keys)); + g_keys[0x01].ch1 = 27; /* esc */ + g_keys[0x02].ch1 = '1'; + g_keys[0x02].chs = '!'; + g_keys[0x03].ch1 = '2'; + g_keys[0x03].chs = '@'; + g_keys[0x04].ch1 = '3'; + g_keys[0x04].chs = '#'; + g_keys[0x05].ch1 = '4'; + g_keys[0x05].chs = '$'; + g_keys[0x06].ch1 = '5'; + g_keys[0x06].chs = '%'; + g_keys[0x07].ch1 = '6'; + g_keys[0x07].chs = '^'; + g_keys[0x08].ch1 = '7'; + g_keys[0x08].chs = '&'; + g_keys[0x09].ch1 = '8'; + g_keys[0x09].chs = '*'; + g_keys[0x0a].ch1 = '9'; + g_keys[0x0a].chs = '('; + g_keys[0x0b].ch1 = '0'; + g_keys[0x0b].chs = ')'; + g_keys[0x0c].ch1 = '-'; + g_keys[0x0c].chs = '_'; + g_keys[0x0d].ch1 = '='; + g_keys[0x0d].chs = '+'; + g_keys[0x0e].ch1 = 8; /* backspace */ + g_keys[0x0f].ch1 = 9; /* tab */ + g_keys[0x10].ch1 = 'q'; + g_keys[0x10].chs = 'Q'; + g_keys[0x11].ch1 = 'w'; + g_keys[0x11].chs = 'W'; + g_keys[0x12].ch1 = 'e'; + g_keys[0x12].chs = 'E'; + g_keys[0x13].ch1 = 'r'; + g_keys[0x13].chs = 'R'; + g_keys[0x14].ch1 = 't'; + g_keys[0x14].chs = 'T'; + g_keys[0x15].ch1 = 'y'; + g_keys[0x15].chs = 'Y'; + g_keys[0x16].ch1 = 'u'; + g_keys[0x16].chs = 'U'; + g_keys[0x17].ch1 = 'i'; + g_keys[0x17].chs = 'I'; + g_keys[0x18].ch1 = 'o'; + g_keys[0x18].chs = 'O'; + g_keys[0x19].ch1 = 'p'; + g_keys[0x19].chs = 'P'; + g_keys[0x1a].ch1 = '['; + g_keys[0x1a].chs = '{'; + g_keys[0x1b].ch1 = ']'; + g_keys[0x1b].chs = '}'; + g_keys[0x1c].ch2 = 13; /* enter */ + g_keys[0x1d].ch1 = 63533; /* left control */ + g_keys[0x1d].ch2 = 63534; /* right control */ + g_keys[0x1e].ch1 = 'a'; + g_keys[0x1e].chs = 'A'; + g_keys[0x1f].ch1 = 's'; + g_keys[0x1f].chs = 'S'; + g_keys[0x20].ch1 = 'd'; + g_keys[0x20].chs = 'D'; + g_keys[0x21].ch1 = 'f'; + g_keys[0x21].chs = 'F'; + g_keys[0x22].ch1 = 'g'; + g_keys[0x22].chs = 'G'; + g_keys[0x23].ch1 = 'h'; + g_keys[0x23].chs = 'H'; + g_keys[0x24].ch1 = 'j'; + g_keys[0x24].chs = 'J'; + g_keys[0x25].ch1 = 'k'; + g_keys[0x25].chs = 'K'; + g_keys[0x26].ch1 = 'l'; + g_keys[0x26].chs = 'L'; + g_keys[0x27].ch1 = ';'; + g_keys[0x27].chs = ':'; + g_keys[0x28].ch1 = '\''; + g_keys[0x28].chs = '"'; + g_keys[0x29].ch1 = '`'; + g_keys[0x29].chs = '~'; + g_keys[0x2a].ch1 = 63531; /* left shift */ + g_keys[0x2b].ch1 = '\\'; + g_keys[0x2c].ch1 = 'z'; + g_keys[0x2c].chs = 'Z'; + g_keys[0x2d].ch1 = 'x'; + g_keys[0x2d].chs = 'X'; + g_keys[0x2e].ch1 = 'c'; + g_keys[0x2e].chs = 'C'; + g_keys[0x2f].ch1 = 'v'; + g_keys[0x2f].chs = 'V'; + g_keys[0x30].ch1 = 'b'; + g_keys[0x30].chs = 'B'; + g_keys[0x31].ch1 = 'n'; + g_keys[0x31].chs = 'N'; + g_keys[0x32].ch1 = 'm'; + g_keys[0x32].chs = 'M'; + g_keys[0x33].ch1 = ','; + g_keys[0x33].chs = '<'; + g_keys[0x34].ch1 = '.'; + g_keys[0x34].chs = '>'; + g_keys[0x35].ch1 = '/'; + g_keys[0x35].ch2 = 63509; + g_keys[0x35].chs = '?'; + g_keys[0x36].ch1 = 63532; /* right shift */ + g_keys[0x37].ch1 = '*'; /* star on keypad */ + g_keys[0x37].ch2 = 63510; /* star on keypad */ + g_keys[0x38].ch1 = 63535; /* alt */ + g_keys[0x38].ch2 = 63536; /* alt */ + g_keys[0x39].ch1 = ' '; + g_keys[0x3a].ch1 = 0; /* caps lock */ + g_keys[0x3b].ch1 = 63515; /* f1 */ + g_keys[0x3c].ch1 = 63516; /* f2 */ + g_keys[0x3d].ch1 = 63517; /* f3 */ + g_keys[0x3e].ch1 = 63518; /* f4 */ + g_keys[0x3f].ch1 = 63519; /* f5 */ + g_keys[0x40].ch1 = 63520; /* f6 */ + g_keys[0x41].ch1 = 63521; /* f7 */ + g_keys[0x42].ch1 = 63522; /* f8 */ + g_keys[0x43].ch1 = 63523; /* f9 */ + g_keys[0x44].ch1 = 63524; /* f10 */ + g_keys[0x45].ch1 = 0; /* num lock */ + g_keys[0x46].ch1 = 0; /* scroll lock */ + g_keys[0x47].ch1 = 63505; /* home */ + g_keys[0x47].ch2 = 63494; /* home */ + g_keys[0x48].ch1 = 63490; /* arrow up */ + g_keys[0x48].ch2 = 63506; /* arrow up */ + g_keys[0x49].ch1 = 63507; /* page up */ + g_keys[0x49].ch2 = 63496; /* page up */ + g_keys[0x4a].ch1 = '-'; /* -(minus) on keypad */ + g_keys[0x4a].ch2 = 63511; /* -(minus) on keypad */ + g_keys[0x4b].ch1 = 63502; /* arrow left */ + g_keys[0x4b].ch2 = 63488; /* arrow left */ + g_keys[0x4c].ch1 = 63503; /* middle(5 key) on keypad */ + g_keys[0x4d].ch1 = 63504; /* arrow right */ + g_keys[0x4d].ch2 = 63489; /* arrow right */ + g_keys[0x4e].ch1 = '+'; /* +(plus) on keypad */ + g_keys[0x4e].ch2 = 63512; /* +(plus) on keypad */ + g_keys[0x4f].ch1 = 63499; /* end */ + g_keys[0x4f].ch2 = 63495; /* end */ + g_keys[0x50].ch1 = 63500; /* arrow down */ + g_keys[0x50].ch2 = 63491; /* arrow down */ + g_keys[0x51].ch1 = 63501; /* page down */ + g_keys[0x51].ch2 = 63497; /* page down */ + g_keys[0x52].ch1 = 63498; /* insert */ + g_keys[0x52].ch2 = 63492; /* insert */ + g_keys[0x53].ch1 = 63508; /* delete */ + g_keys[0x53].ch2 = 63493; /* delete */ + g_keys[0x54].ch1 = 63525; /* f11 */ + g_keys[0x54].ch1 = 63527; /* f12 */ +} + +/*****************************************************************************/ +/* returns 0 if found key */ +static int get_sc(GR_EVENT_KEYSTROKE * event_keystroke, int * sc, int * ec) +{ + int i; + + //printf("%d %d\n", event_keystroke->ch, event_keystroke->modifiers); + *sc = 0; + *ec = 0; + for (i = 0; i < 256; i++) + { + if (event_keystroke->modifiers & 1) /* shift is down */ + { + if (event_keystroke->ch == g_keys[i].chs) + { + *sc = i; + break; + } + } + if (event_keystroke->ch == g_keys[i].ch1 || + event_keystroke->ch == g_keys[i].ch2 || + event_keystroke->ch == g_keys[i].ch3) + { + *sc = i; + break; + } + } + if (*sc == 0) + { + return 1; + } + else + { + return 0; + } +} + +/*****************************************************************************/ +void static process_keystroke(GR_EVENT_KEYSTROKE * event_keystroke, int down) +{ + int sc, ec; + + if (get_sc(event_keystroke, &sc, &ec) == 0) + { + if (down) + { + rdp_send_input(0, RDP_INPUT_SCANCODE, RDP_KEYPRESS, sc, ec); + } + else + { + rdp_send_input(0, RDP_INPUT_SCANCODE, RDP_KEYRELEASE, sc, ec); + } + } +} + +/*****************************************************************************/ +void nanox_event(GR_EVENT * ev) +{ + GR_EVENT_MOUSE * event_mouse; + GR_EVENT_BUTTON * event_button; + GR_EVENT_FDINPUT * event_fdinput; + GR_EVENT_KEYSTROKE * event_keystroke; + + do + { + if (ev->type == GR_EVENT_TYPE_FDINPUT) /* 12 */ + { + event_fdinput = (GR_EVENT_FDINPUT *) ev; + if (event_fdinput->fd == g_sck) + { + if (!rdp_loop(&g_deactivated, &g_ext_disc_reason)) + { + fprintf(stderr, "rdp_loop in nanox_event exit codes %d %d\n", + g_deactivated, g_ext_disc_reason); + exit(1); + } + } + } + else if (ev->type == GR_EVENT_TYPE_BUTTON_DOWN) /* 2 */ + { + event_button = (GR_EVENT_BUTTON *) ev; + if (event_button->changebuttons & 4) /* left */ + { + rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_DOWN | MOUSE_FLAG_BUTTON1, + event_button->x, event_button->y); + } + else if (event_button->changebuttons & 1) /* right */ + { + rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_DOWN | MOUSE_FLAG_BUTTON2, + event_button->x, event_button->y); + } + } + else if (ev->type == GR_EVENT_TYPE_BUTTON_UP) /* 3 */ + { + event_button = (GR_EVENT_BUTTON *) ev; + if (event_button->changebuttons & 4) /* left */ + { + rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_BUTTON1, + event_button->x, event_button->y); + } + else if (event_button->changebuttons & 1) /* right */ + { + rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_BUTTON2, + event_button->x, event_button->y); + } + } + else if (ev->type == GR_EVENT_TYPE_MOUSE_MOTION) /* 6 */ + { + event_mouse = (GR_EVENT_MOUSE *) ev; + rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_MOVE, + event_mouse->x, event_mouse->y); + } + else if (ev->type == GR_EVENT_TYPE_MOUSE_POSITION) /* 7 */ + { + /* use GR_EVENT_TYPE_MOUSE_MOTION */ + } + else if (ev->type == GR_EVENT_TYPE_KEY_DOWN) /* 8 */ + { + event_keystroke = (GR_EVENT_KEYSTROKE *) ev; + process_keystroke(event_keystroke, 1); + } + else if (ev->type == GR_EVENT_TYPE_KEY_UP) /* 9 */ + { + event_keystroke = (GR_EVENT_KEYSTROKE *) ev; + process_keystroke(event_keystroke, 0); + } + else if (ev->type == GR_EVENT_TYPE_FOCUS_IN) /* 10 */ + { + } + else if (ev->type == GR_EVENT_TYPE_FOCUS_OUT) /* 11 */ + { + } + else if (ev->type == GR_EVENT_TYPE_UPDATE) /* 13 */ + { + } + GrCheckNextEvent(ev); + } while (ev->type != GR_EVENT_TYPE_NONE); +} + +/*****************************************************************************/ +static void get_username_and_hostname(void) +{ + char fullhostname[64]; + char * p; + struct passwd * pw; + + STRNCPY(g_username, "unknown", sizeof(g_username)); + STRNCPY(g_hostname, "unknown", sizeof(g_hostname)); + pw = getpwuid(getuid()); + if (pw != NULL && pw->pw_name != NULL) + { + STRNCPY(g_username, pw->pw_name, sizeof(g_username)); + } + if (gethostname(fullhostname, sizeof(fullhostname)) != -1) + { + p = strchr(fullhostname, '.'); + if (p != NULL) + { + *p = 0; + } + STRNCPY(g_hostname, fullhostname, sizeof(g_hostname)); + } +} +/*****************************************************************************/ +static void out_params(void) +{ + fprintf(stderr, "rdesktop: A Remote Desktop Protocol client.\n"); + fprintf(stderr, "Version " VERSION ". Copyright (C) 1999-2005 Matt Chapman.\n"); + fprintf(stderr, "nanox uiport by Jay Sorg\n"); + fprintf(stderr, "See http://www.rdesktop.org/ for more information.\n\n"); + fprintf(stderr, "Usage: nanoxrdesktop [options] server\n"); + fprintf(stderr, " -u: user name\n"); + fprintf(stderr, " -n: client hostname\n"); + fprintf(stderr, " -p: password\n"); + fprintf(stderr, " -d: domain\n"); + fprintf(stderr, " -s: shell\n"); + fprintf(stderr, " -c: working directory\n"); + fprintf(stderr, "\n"); +} + +/*****************************************************************************/ +static int parse_parameters(int in_argc, char ** in_argv) +{ + int i; + + if (in_argc <= 1) + { + out_params(); + return 0; + } + for (i = 1; i < in_argc; i++) + { + strcpy(g_servername, in_argv[i]); + if (strcmp(in_argv[i], "-h") == 0) + { + out_params(); + return 0; + } + else if (strcmp(in_argv[i], "-n") == 0) + { + STRNCPY(g_hostname, in_argv[i + 1], sizeof(g_hostname)); + } + else if (strcmp(in_argv[i], "-u") == 0) + { + STRNCPY(g_username, in_argv[i + 1], sizeof(g_username)); + } + else if (strcmp(in_argv[i], "-p") == 0) + { + STRNCPY(g_password, in_argv[i + 1], sizeof(g_password)); + g_flags |= RDP_LOGON_AUTO; + i++; + } + else if (strcmp(in_argv[i], "-d") == 0) + { + STRNCPY(g_domain, in_argv[i + 1], sizeof(g_domain)); + i++; + } + else if (strcmp(in_argv[i], "-s") == 0) + { + STRNCPY(g_shell, in_argv[i + 1], sizeof(g_shell)); + i++; + } + else if (strcmp(in_argv[i], "-c") == 0) + { + STRNCPY(g_directory, in_argv[i + 1], sizeof(g_directory)); + i++; + } + } + return 1; +} + +/*****************************************************************************/ +int main(int in_argc, char ** in_argv) +{ + get_username_and_hostname(); + /* read command line options */ + if (!parse_parameters(in_argc, in_argv)) + { + exit(0); + } + /* connect to server */ + if (GrOpen() < 0) + { + fprintf(stderr, "Couldn't connect to Nano-X server\n"); + exit(1); + } + GrGetScreenInfo(&g_screen_info); + g_bpp = g_screen_info.bpp; + g_Bpp = (g_screen_info.bpp + 7) / 8; + g_width = g_screen_info.vs_width; + g_height = g_screen_info.vs_height; + g_clip.x = 0; + g_clip.y = 0; + g_clip.width = g_width; + g_clip.height = g_height; + if (!((g_bpp == 32 && g_server_bpp == 16) || + (g_bpp == 16 && g_server_bpp == 16))) + { + fprintf(stderr, "unsupported bpp, server = %d, client = %d\n", + g_server_bpp, g_bpp); + GrClose(); + exit(0); + } + init_keys(); + /* connect to server */ + if (!rdp_connect(g_servername, g_flags, g_domain, g_password, g_shell, + g_directory)) + { + fprintf(stderr, "Error connecting\n"); + GrClose(); + exit(1); + } + /* create window */ + g_wnd = GrNewWindow(GR_ROOT_WINDOW_ID, 0, 0, g_width, g_height, 0, 0, 0); + /* show window */ + GrMapWindow(g_wnd); + /* create graphic context */ + g_gc = GrNewGC(); + g_gc_clean = GrNewGC(); + /* clear screen */ + GrSetGCForeground(g_gc, 0); + GrFillRect(g_wnd, g_gc, 0, 0, g_width, g_height); + /* create null cursor */ + g_null_cursor = (GR_CURSOR_ID)ui_create_cursor(0, 0, 32, 32, 0, 0); + /* register callbacks, set mask, and run main loop */ + GrSelectEvents(g_wnd, -1); /* all events */ + GrRegisterInput(g_sck); + GrMainLoop(nanox_event); + /* free null cursor */ + ui_destroy_cursor((void*)g_null_cursor); + /* free graphic context */ + GrDestroyGC(g_gc); + GrDestroyGC(g_gc_clean); + /* free window */ + GrDestroyWindow(g_wnd); + /* close connection */ + GrClose(); + return 0; +} --- rdesktop-1.5.0.orig/uiports/qtereadme.txt +++ rdesktop-1.5.0/uiports/qtereadme.txt @@ -0,0 +1,12 @@ +This is the Qt/Emb ui port +qt should be installed in /usr/local/qt +you may need to have LD_LIBRARY_PATH and QTDIR defined to run qtrdesktop +tested with versions 2.3, 3.1 + +makefile_qte can be edited to change file localtions +run make -f makefile_qte in this directory to compile it + +qtereadme.txt - notes, this file +makefile_qte - makefile +qtewin.cpp - ui lib +qtewin.h - header --- rdesktop-1.5.0.orig/uiports/qtewin.cpp +++ rdesktop-1.5.0/uiports/qtewin.cpp @@ -0,0 +1,2557 @@ +/* -*- c-basic-offset: 8 -*- + rdesktop: A Remote Desktop Protocol client. + User interface services - QT Emb System + Copyright (C) Jay Sorg 2004-2005 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 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., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +//#define SHARP + +#ifdef SHARP +#include <qpe/qpeapplication.h> +#else +#include <qapplication.h> +#endif +#include <qcursor.h> +#include <qmainwindow.h> +#include <qwidget.h> +#include <qpainter.h> +#include <qimage.h> +#include <qsocketnotifier.h> +#include <qscrollview.h> +#include <qmessagebox.h> +#include <qpushbutton.h> +#include <qlineedit.h> +#include <qcombobox.h> +#include <qlabel.h> +#include <qfile.h> +#include <qcheckbox.h> +#include <qpopupmenu.h> + +#include <stdlib.h> +#include <stdarg.h> // va_list va_start va_end +#include <unistd.h> // gethostname +#include <pwd.h> // getpwuid + +#include "../rdesktop.h" +#include "qtewin.h" + +#define QT_OPTI + +extern int g_tcp_port_rdp; +int g_encryption = 1; +int g_bitmap_cache = 1; +int g_bitmap_cache_persist_enable = 0; +int g_bitmap_cache_precache = 1; +int g_use_rdp5 = 1; +int g_desktop_save = 1; +int g_bitmap_compression = 1; +int g_polygon_ellipse_orders = 0; +int g_rdp5_performanceflags = + RDP5_NO_WALLPAPER | RDP5_NO_FULLWINDOWDRAG | RDP5_NO_MENUANIMATIONS; +int g_console_session = 0; +int g_keylayout = 0x409; /* Defaults to US keyboard layout */ +int g_keyboard_type = 0x4; /* Defaults to US keyboard layout */ +int g_keyboard_subtype = 0x0; /* Defaults to US keyboard layout */ +int g_keyboard_functionkeys = 0xc; /* Defaults to US keyboard layout */ +int g_width = 640; +int g_height = 480; +int g_server_bpp = 8; +char g_hostname[16] = ""; +char g_username[100] = ""; + +#ifdef WITH_RDPSND +extern int g_dsp_busy; +extern int g_dsp_fd; +int g_rdpsnd = 0; +static QSocketNotifier * g_SoundNotifier = 0; +#endif + +/* types */ +struct QColorMap +{ + uint32 RGBColors[256]; + uint32 NumColors; +}; + +struct bitmap +{ + int w; + int h; + uint8 * data; +}; + +static int g_client_width = 640; +static int g_client_height = 480; +static uint32 g_flags = RDP_LOGON_NORMAL; +static char g_server[64] = ""; +static char g_domain[16] = ""; +static char g_password[16] = ""; +static char g_shell[128] = ""; +static char g_directory[32] = ""; +static int g_fullscreen = 0; +static int g_global_sock = 0; +static int g_deactivated = 0; +static uint32 g_ext_disc_reason = 0; + +static QSocketNotifier * g_SocketNotifier = 0; +#ifdef SHARP +static QPEApplication * g_App = 0; +#else +static QApplication * g_App = 0; +#endif +static QMyMainWindow * g_MW = 0; +static QMyScrollView * g_SV = 0; +static struct QColorMap * g_CM = 0; +static uint8 * g_BS = 0; /* the screen data */ +static int g_clipx = 0; +static int g_clipy = 0; +static int g_clipcx = 0; +static int g_clipcy = 0; + +/* Session Directory redirection */ +BOOL g_redirect = False; +char g_redirect_server[64]; +char g_redirect_domain[16]; +char g_redirect_password[64]; +char g_redirect_username[64]; +char g_redirect_cookie[128]; +uint32 g_redirect_flags = 0; + +#define BPP ((g_server_bpp + 7) / 8) +#define GETPIXEL8(d, x, y, w) (*(((uint8*)d) + ((y) * (w) + (x)))) +#define GETPIXEL16(d, x, y, w) (*(((uint16*)d) + ((y) * (w) + (x)))) +#define GETPIXEL32(d, x, y, w) (*(((uint32*)d) + ((y) * (w) + (x)))) +#define SETPIXEL8(d, x, y, w, v) *(((uint8*)d) + ((y) * (w) + (x))) = v +#define SETPIXEL16(d, x, y, w, v) *(((uint16*)d) + ((y) * (w) + (x))) = v +#define SETPIXEL32(d, x, y, w, v) *(((uint32*)d) + ((y) * (w) + (x))) = v + +/******************************************************************************/ +void CleanString(QString * Item) +{ + int i; + + i = Item->length() - 1; + while (i >= 0) + { + if (Item->at(i) == 10 || Item->at(i) == 13) + { + Item->remove(i, 1); + } + i--; + } +} + +/******************************************************************************/ +QMyDialog::QMyDialog(QWidget * parent) : QDialog(parent, "Settings", true) +{ + int i, j; + char * home; + char Text[256]; + QString Line; + QString ItemName; + QString ItemValue; + + // resize dialog + resize(230, 270); + // main list box + ListBox = new QListBox(this); + ListBox->move(10, 10); + ListBox->resize(200, 100); + connect(ListBox, SIGNAL(selectionChanged()), this, SLOT(ListBoxChanged())); + connect(ListBox, SIGNAL(selected(int)), this, SLOT(ListBoxSelected(int))); + // server + Label1 = new QLabel(this); + Label1->setText("Server Desc"); + Label1->move(10, 120); + Label1->resize(100, 20); + ServerNameEdit = new QLineEdit(this); + ServerNameEdit->move(75, 120); + ServerNameEdit->resize(100, 20); + // username + Label2 = new QLabel(this); + Label2->setText("User Name"); + Label2->move(10, 150); + Label2->resize(100, 20); + UserNameEdit = new QLineEdit(this); + UserNameEdit->move(75, 150); + UserNameEdit->resize(100, 20); + // ip + Label3 = new QLabel(this); + Label3->setText("Server IP"); + Label3->move(10, 180); + Label3->resize(100, 20); + IPEdit = new QLineEdit(this); + IPEdit->move(75, 180); + IPEdit->resize(100, 20); + // width and height + WidthHeightBox = new QComboBox(this); + WidthHeightBox->move(10, 210); + WidthHeightBox->resize(100, 20); + WidthHeightBox->insertItem("240x320"); + WidthHeightBox->insertItem("640x480"); + WidthHeightBox->insertItem("800x600"); + connect(WidthHeightBox, SIGNAL(activated(int)), this, SLOT(ComboChanged(int))); + WidthHeightBox->setCurrentItem(1); + WidthEdit = new QLineEdit(this); + WidthEdit->move(110, 210); + WidthEdit->resize(30, 20); + WidthEdit->setText("800"); + HeightEdit = new QLineEdit(this); + HeightEdit->move(140, 210); + HeightEdit->resize(30, 20); + HeightEdit->setText("600"); + // add to list button + AddButton = new QPushButton(this); + AddButton->move(180, 120); + AddButton->resize(50, 20); + AddButton->setText("Add"); + connect(AddButton, SIGNAL(clicked()), this, SLOT(AddClicked())); + // change list item button + EditButton = new QPushButton(this); + EditButton->move(180, 140); + EditButton->resize(50, 20); + EditButton->setText("Edit"); + connect(EditButton, SIGNAL(clicked()), this, SLOT(EditClicked())); + // save to file button + SaveButton = new QPushButton(this); + SaveButton->move(180, 160); + SaveButton->resize(50, 20); + SaveButton->setText("Save"); + connect(SaveButton, SIGNAL(clicked()), this, SLOT(SaveClicked())); + // remove an item button + RemoveButton = new QPushButton(this); + RemoveButton->move(180, 180); + RemoveButton->resize(50, 20); + RemoveButton->setText("Remove"); + connect(RemoveButton, SIGNAL(clicked()), this, SLOT(RemoveClicked())); + // full screen check box + FullScreenCheckBox = new QCheckBox(this, "Full Screen"); + FullScreenCheckBox->setText("Full Screen"); + FullScreenCheckBox->move(10, 230); + // ok button + OKButton = new QPushButton(this); + OKButton->setText("OK"); + OKButton->move(100, 240); + OKButton->resize(50, 20); + connect(OKButton, SIGNAL(clicked()), this, SLOT(OKClicked())); + // cancel button + CancelButton = new QPushButton(this); + CancelButton->setText("Cancel"); + CancelButton->move(160, 240); + CancelButton->resize(50, 20); + connect(CancelButton, SIGNAL(clicked()), this, SLOT(CancelClicked())); + + for (i = 0; i < 10; i++) + { + ConnectionList[i] = new QMyConnectionItem; + ConnectionList[i]->ServerName = ""; + ConnectionList[i]->UserName = ""; + ConnectionList[i]->ServerIP = ""; + ConnectionList[i]->Width = 0; + ConnectionList[i]->Height = 0; + ConnectionList[i]->FullScreen = 0; + } + home = getenv("HOME"); + if (home != NULL) + { + sprintf(Text, "%s/rdesktop.ini", home); + QFile * File = new QFile(Text); + if (File->open(IO_ReadOnly)) + { + i = -1; + while (!File->atEnd()) + { + File->readLine(Line, 255); + j = Line.find("="); + if (j > 0) + { + ItemName = Line.mid(0, j); + CleanString(&ItemName); + ItemValue = Line.mid(j + 1); + CleanString(&ItemValue); + if (ItemName == "Server") + { + i++; + ConnectionList[i]->ServerName = ItemValue; + ListBox->insertItem(ItemValue); + } + else if (ItemName == "UserName") + ConnectionList[i]->UserName = ItemValue; + else if (ItemName == "Width") + ConnectionList[i]->Width = ItemValue.toInt(); + else if (ItemName == "Height") + ConnectionList[i]->Height = ItemValue.toInt(); + else if (ItemName == "IP") + ConnectionList[i]->ServerIP = ItemValue; + else if (ItemName == "FullScreen") + ConnectionList[i]->FullScreen = (ItemValue != "0"); + } + } + } + delete File; + } +} + +/******************************************************************************/ +QMyDialog::~QMyDialog() +{ + QMyConnectionItem * Item; + int i; + + for (i = 0; i < 10; i++) + { + Item = ConnectionList[i]; + delete Item; + } +} + +/******************************************************************************/ +void QMyDialog::ComboChanged(int index) +{ + if (index == 0) + { + WidthEdit->setText("240"); + HeightEdit->setText("320"); + } + if (index == 1) + { + WidthEdit->setText("640"); + HeightEdit->setText("480"); + } + else if (index == 2) + { + WidthEdit->setText("800"); + HeightEdit->setText("600"); + } +} + +/******************************************************************************/ +void QMyDialog::OKClicked() +{ + ServerName = ServerNameEdit->text(); + UserName = UserNameEdit->text(); + Width = WidthEdit->text().toInt(); + Height = HeightEdit->text().toInt(); + ServerIP = IPEdit->text(); + FullScreen = FullScreenCheckBox->isChecked(); + done(1); +} + +/******************************************************************************/ +void QMyDialog::CancelClicked() +{ + done(0); +} + +/******************************************************************************/ +void QMyDialog::AddClicked() +{ + int i; + QMyConnectionItem * Item; + + i = ListBox->count(); + if (i < 10) + { + ListBox->insertItem(ServerNameEdit->text()); + Item = ConnectionList[i]; + Item->ServerName = ServerNameEdit->text(); + Item->UserName = UserNameEdit->text(); + Item->Width = WidthEdit->text().toInt(); + Item->Height = HeightEdit->text().toInt(); + Item->ServerIP = IPEdit->text(); + Item->FullScreen = FullScreenCheckBox->isChecked(); + } +} + +/******************************************************************************/ +void QMyDialog::EditClicked() +{ + int i; + QMyConnectionItem * Item; + + i = ListBox->currentItem(); + if (i >= 0) + { + Item = ConnectionList[i]; + Item->ServerName = ServerNameEdit->text(); + Item->UserName = UserNameEdit->text(); + Item->Width = WidthEdit->text().toInt(); + Item->Height = HeightEdit->text().toInt(); + Item->ServerIP = IPEdit->text(); + Item->FullScreen = FullScreenCheckBox->isChecked(); + ListBox->changeItem(ServerNameEdit->text(), i); + } +} + +/******************************************************************************/ +void WriteString(QFile* File, QString* Line) +{ + File->writeBlock((const char*)(*Line), Line->length()); +} + +/******************************************************************************/ +void QMyDialog::SaveClicked() +{ + int i, j; + QMyConnectionItem * Item; + QString Line; + char * home; + char Text[256]; + QFile* File; + + home = getenv("HOME"); + if (home != NULL) + { + sprintf(Text, "%s/rdesktop.ini", home); + File = new QFile(Text); + if (File->open(IO_Truncate | IO_ReadWrite)) + { + i = ListBox->count(); + for (j = 0; j < i; j++) + { + Item = ConnectionList[j]; + Line = "Server="; + Line += Item->ServerName; + Line += (char)10; + WriteString(File, &Line); + Line = "UserName="; + Line += Item->UserName; + Line += (char)10; + WriteString(File, &Line); + Line = "Width="; + sprintf(Text, "%d", Item->Width); + Line += Text; + Line += (char)10; + WriteString(File, &Line); + Line = "Height="; + sprintf(Text, "%d", Item->Height); + Line += Text; + Line += (char)10; + WriteString(File, &Line); + Line = "IP="; + Line += Item->ServerIP; + Line += (char)10; + WriteString(File, &Line); + Line = "FullScreen="; + if (Item->FullScreen) + Line += "1"; + else + Line += "0"; + Line += (char)10; + WriteString(File, &Line); + } + } + File->flush(); + File->close(); + delete File; + } +} + +/******************************************************************************/ +void QMyDialog::RemoveClicked() +{ + int i, j, c; + QMyConnectionItem * Item1; + QMyConnectionItem * Item2; + + i = ListBox->currentItem(); + if (i >= 0) + { + c = ListBox->count(); + for (j = i; j < c - 1; j++) + { + Item1 = ConnectionList[i]; + Item2 = ConnectionList[i + 1]; + Item1->ServerName = Item2->ServerName; + Item1->UserName = Item2->UserName; + Item1->Width = Item2->Width; + Item1->Height = Item2->Height; + Item1->ServerIP = Item2->ServerIP; + Item1->FullScreen = Item2->FullScreen; + } + ListBox->removeItem(i); + } +} + +/******************************************************************************/ +void QMyDialog::ListBoxChanged() +{ + int i; + QMyConnectionItem * Item; + char Text[100]; + + i = ListBox->currentItem(); + if (i >= 0 && i < 10) + { + Item = ConnectionList[i]; + ServerNameEdit->setText(Item->ServerName); + UserNameEdit->setText(Item->UserName); + sprintf(Text, "%d", Item->Width); + WidthEdit->setText(Text); + sprintf(Text, "%d", Item->Height); + HeightEdit->setText(Text); + IPEdit->setText(Item->ServerIP); + FullScreenCheckBox->setChecked(Item->FullScreen != 0); + } +} + +/******************************************************************************/ +void QMyDialog::ListBoxSelected(int /*index*/) +{ +} + +/******************************************************************************/ +void GetScanCode(QKeyEvent * e, int * ScanCode, int * code) +{ + int key; + int mod; + int ascii; + + key = e->key(); + mod = e->state(); + ascii = e->ascii(); + + *ScanCode = 0; + *code = mod; // 8 shift, 16 control, 32 alt + + switch (key) + { + case 4096: // esc + case 4097: // tab + case 4099: // backspace + case 4100: // enter + case 4101: // enter + case 4103: // delete + ascii = 0; + } + + if (ascii == 0) + { + switch (key) + { + case 4096: *ScanCode = 0x01; break; // esc + case 4097: *ScanCode = 0x0f; break; // tab + case 4099: *ScanCode = 0x0e; break; // backspace + case 4100: *ScanCode = 0x1c; break; // enter + case 4101: *ScanCode = 0x1c; break; // enter + case 4112: *ScanCode = 0xc7; break; // home + case 4113: *ScanCode = 0xcf; break; // end + case 4102: *ScanCode = 0xd2; break; // insert + case 4103: *ScanCode = 0xd3; break; // delete + case 4118: *ScanCode = 0xc9; break; // page up + case 4119: *ScanCode = 0xd1; break; // page down + case 4117: *ScanCode = 0xd0; break; // down arrow + case 4115: *ScanCode = 0xc8; break; // up arrow + case 4114: *ScanCode = 0xcb; break; // left arrow + case 4116: *ScanCode = 0xcd; break; // right arrow + case 4128: *ScanCode = 0x2a; break; // shift + case 4131: *ScanCode = 0x38; break; // alt + case 4129: *ScanCode = 0x1d; break; // ctrl + } + if (*ScanCode != 0) + return; + } + + switch (ascii) + { + // first row + case 'q': *ScanCode = 0x10; break; + case 'Q': *ScanCode = 0x10; *code |= 8; break; + case '1': *ScanCode = 0x02; break; + case 'w': *ScanCode = 0x11; break; + case 'W': *ScanCode = 0x11; *code |= 8; break; + case '2': *ScanCode = 0x03; break; + case 'e': *ScanCode = 0x12; break; + case 'E': *ScanCode = 0x12; *code |= 8; break; + case '3': *ScanCode = 0x04; break; + case 'r': *ScanCode = 0x13; break; + case 'R': *ScanCode = 0x13; *code |= 8; break; + case '4': *ScanCode = 0x05; break; + case 't': *ScanCode = 0x14; break; + case 'T': *ScanCode = 0x14; *code |= 8; break; + case '5': *ScanCode = 0x06; break; + case 'y': *ScanCode = 0x15; break; + case 'Y': *ScanCode = 0x15; *code |= 8; break; + case '6': *ScanCode = 0x07; break; + case 'u': *ScanCode = 0x16; break; + case 'U': *ScanCode = 0x16; *code |= 8; break; + case '7': *ScanCode = 0x08; break; + case 'i': *ScanCode = 0x17; break; + case 'I': *ScanCode = 0x17; *code |= 8; break; + case '8': *ScanCode = 0x09; break; + case 'o': *ScanCode = 0x18; break; + case 'O': *ScanCode = 0x18; *code |= 8; break; + case '9': *ScanCode = 0x0a; break; + case 'p': *ScanCode = 0x19; break; + case 'P': *ScanCode = 0x19; *code |= 8; break; + case '0': *ScanCode = 0x0b; break; + // second row + case 'a': *ScanCode = 0x1e; break; + case 'A': *ScanCode = 0x1e; *code |= 8; break; + case '!': *ScanCode = 0x02; *code |= 8; break; + case 's': *ScanCode = 0x1f; break; + case 'S': *ScanCode = 0x1f; *code |= 8; break; + case '@': *ScanCode = 0x03; *code |= 8; break; + case 'd': *ScanCode = 0x20; break; + case 'D': *ScanCode = 0x20; *code |= 8; break; + case '#': *ScanCode = 0x04; *code |= 8; break; + case 'f': *ScanCode = 0x21; break; + case 'F': *ScanCode = 0x21; *code |= 8; break; + case '$': *ScanCode = 0x05; *code |= 8; break; + case 'g': *ScanCode = 0x22; break; + case 'G': *ScanCode = 0x22; *code |= 8; break; + case '%': *ScanCode = 0x06; *code |= 8; break; + case 'h': *ScanCode = 0x23; break; + case 'H': *ScanCode = 0x23; *code |= 8; break; + case '_': *ScanCode = 0x0c; *code |= 8; break; + case 'j': *ScanCode = 0x24; break; + case 'J': *ScanCode = 0x24; *code |= 8; break; + case '&': *ScanCode = 0x08; *code |= 8; break; + case 'k': *ScanCode = 0x25; break; + case 'K': *ScanCode = 0x25; *code |= 8; break; + case '*': *ScanCode = 0x09; *code |= 8; break; + case 'l': *ScanCode = 0x26; break; + case 'L': *ScanCode = 0x26; *code |= 8; break; + case '(': *ScanCode = 0x0a; *code |= 8; break; +// case 8: *ScanCode = 0x0e; break; // backspace + // third row + case 'z': *ScanCode = 0x2c; break; + case 'Z': *ScanCode = 0x2c; *code |= 8; break; + case 'x': *ScanCode = 0x2d; break; + case 'X': *ScanCode = 0x2d; *code |= 8; break; + case 'c': *ScanCode = 0x2e; break; + case 'C': *ScanCode = 0x2e; *code |= 8; break; + case 'v': *ScanCode = 0x2f; break; + case 'V': *ScanCode = 0x2f; *code |= 8; break; + case 'b': *ScanCode = 0x30; break; + case 'B': *ScanCode = 0x30; *code |= 8; break; + case '-': *ScanCode = 0x0c; break; + case 'n': *ScanCode = 0x31; break; + case 'N': *ScanCode = 0x31; *code |= 8; break; + case '+': *ScanCode = 0x0d; *code |= 8; break; + case 'm': *ScanCode = 0x32; break; + case 'M': *ScanCode = 0x32; *code |= 8; break; + case '=': *ScanCode = 0x0d; break; + case ',': *ScanCode = 0x33; break; + case ';': *ScanCode = 0x27; break; + case ')': *ScanCode = 0x0b; *code |= 8; break; + // fourth row +// case 9: *ScanCode = 0x0f; break; // tab + case '/': *ScanCode = 0x35; break; + case '?': *ScanCode = 0x35; *code |= 8; break; + case ' ': *ScanCode = 0x39; break; + case '\'': *ScanCode = 0x28; break; + case '"': *ScanCode = 0x28; *code |= 8; break; + case '~': *ScanCode = 0x29; *code |= 8; break; + case '.': *ScanCode = 0x34; break; + case ':': *ScanCode = 0x27; *code |= 8; break; + case '<': *ScanCode = 0x33; *code |= 8; break; +// case 13: *ScanCode = 0x1c; break; // enter + case '>': *ScanCode = 0x34; *code |= 8; break; + // others +// case 27: *ScanCode = 0x01; break; // esc + case '`': *ScanCode = 0x29; break; + case '^': *ScanCode = 0x07; *code |= 8; break; + case '[': *ScanCode = 0x1a; break; + case '{': *ScanCode = 0x1a; *code |= 8; break; + case ']': *ScanCode = 0x1b; break; + case '}': *ScanCode = 0x1b; *code |= 8; break; + case '\\': *ScanCode = 0x2b; break; + case '|': *ScanCode = 0x2b; *code |= 8; break; + // ctrl keys + case 1: *ScanCode = 0x1e; *code |= 16; break; // a + case 2: *ScanCode = 0x30; *code |= 16; break; // b + } + + if (*ScanCode == 0 && key < 3000) + printf("unknown key %d mod %d ascii %d\n", key, mod, ascii); + +} + +/******************************************************************************/ +QMyScrollView::QMyScrollView() : QScrollView() +{ +} + +/******************************************************************************/ +QMyScrollView::~QMyScrollView() +{ +} + +/******************************************************************************/ +void QMyScrollView::keyPressEvent(QKeyEvent* e) +{ + int ScanCode, code; + GetScanCode(e, &ScanCode, &code); + if (ScanCode != 0) + { + if (code & 8) // send shift + rdp_send_input(0, RDP_INPUT_SCANCODE, RDP_KEYPRESS, 0x2a, 0); + if (code & 16) // send control + rdp_send_input(0, RDP_INPUT_SCANCODE, RDP_KEYPRESS, 0x1d, 0); + if (code & 32) // send alt + rdp_send_input(0, RDP_INPUT_SCANCODE, RDP_KEYPRESS, 0x38, 0); + rdp_send_input(0, RDP_INPUT_SCANCODE, RDP_KEYPRESS, ScanCode, 0); + e->accept(); + } +} + +/******************************************************************************/ +void QMyScrollView::keyReleaseEvent(QKeyEvent* e) +{ + int ScanCode, code; + GetScanCode(e, &ScanCode, &code); + if (ScanCode != 0) + { + rdp_send_input(0, RDP_INPUT_SCANCODE, RDP_KEYRELEASE, ScanCode, 0); + if (code & 8) // send shift + rdp_send_input(0, RDP_INPUT_SCANCODE, RDP_KEYRELEASE, 0x2a, 0); + if (code & 16) // send control + rdp_send_input(0, RDP_INPUT_SCANCODE, RDP_KEYRELEASE, 0x1d, 0); + if (code & 32) // send alt + rdp_send_input(0, RDP_INPUT_SCANCODE, RDP_KEYRELEASE, 0x38, 0); + e->accept(); + } +} + +/******************************************************************************/ +void QMyScrollView::showEvent(QShowEvent* e) +{ + QScrollView::showEvent(e); +} + +/******************************************************************************/ +void QMyScrollView::show() +{ + QScrollView::show(); +} + +/******************************************************************************/ +void QMyScrollView::polish() +{ + QScrollView::polish(); +} + +/******************************************************************************/ +void QMyScrollView::timerEvent(QTimerEvent * e) +{ + QMyDialog * d; + QWidget * Desktop; + int dw; + int dh; + + QScrollView::timerEvent(e); + killTimer(timer_id); + d = new QMyDialog(this); + if (d->exec() == 1) // ok clicked + { + g_width = d->Width; + g_height = d->Height; + g_client_width = g_width; + g_client_height = g_height; + g_fullscreen = d->FullScreen; + sprintf(g_server, "%s", (const char*)d->ServerIP); + sprintf(g_username, "%s", (const char*)d->UserName); +#ifdef WITH_RDPSND + // init sound + if (g_rdpsnd) + { + rdpsnd_init(); + } +#endif + if (!rdp_connect(g_server, g_flags, g_domain, g_password, g_shell, + g_directory)) + { + delete d; + g_SV->close(); + return; + } + g_BS = (uint8*)xmalloc(g_width * g_height * 4); + memset(g_BS, 0, g_width * g_height * 4); + g_clipx = 0; + g_clipy = 0; + g_clipcx = g_width; + g_clipcy = g_height; + g_CM = (QColorMap*)xmalloc(sizeof(struct QColorMap)); + memset(g_CM, 0, sizeof(struct QColorMap)); + g_CM->NumColors = 256; + g_MW = new QMyMainWindow(); + g_MW->resize(g_client_width, g_client_height); + g_MW->show(); + g_SV->addChild(g_MW); + g_MW->setMouseTracking(true); + g_MW->setCursor((int)10); /* Qt::BlankCursor */ + g_SocketNotifier = new QSocketNotifier(g_global_sock, + QSocketNotifier::Read, + g_MW); + g_MW->connect(g_SocketNotifier, SIGNAL(activated(int)), g_MW, + SLOT(dataReceived())); + if (g_fullscreen) + { + Desktop = g_App->desktop(); + dw = Desktop->width(); + dh = Desktop->height(); + if (dw == g_client_width && dh == g_client_height) + { + g_MW->resize(g_client_width - 4, g_client_height - 4); + } + g_SV->showFullScreen(); + } + delete d; + } + else // cancel clicked + { + delete d; + g_SV->close(); + } +} + +/******************************************************************************/ +QMyMainWindow::QMyMainWindow() : QWidget(g_SV->viewport()) +{ + PopupMenu = new QPopupMenu(this); + PopupMenu->insertItem("Right click", 1, 0); + PopupMenu->insertItem("Toggle fullscreen", 2, 1); + PopupMenu->insertItem("Reset keyboard", 3, 2); + PopupMenu->insertItem("Double click", 4, 3); + connect(PopupMenu, SIGNAL(activated(int)), this, SLOT(MemuClicked(int))); +} + +/******************************************************************************/ +QMyMainWindow::~QMyMainWindow() +{ + delete PopupMenu; +} + +/******************************************************************************/ +int rd(double in) +{ + return (int)(in + 0.50); +} + +/******************************************************************************/ +int c2sx(int cx) +{ + double sx; + + sx = (double)g_client_width / (double)g_width; + return rd(cx / sx); +} + +/******************************************************************************/ +int c2sy(int cy) +{ + double sy; + + sy = (double)g_client_height / (double)g_height; + return rd(cy / sy); +} + +/******************************************************************************/ +void QMyMainWindow::timerEvent(QTimerEvent * e) +{ + QWidget::timerEvent(e); + if (e->timerId() == timer_id) + { + // send mouse up + rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_BUTTON1, + rd(c2sx(mx)), rd(c2sy(my))); + // if in fullscreen, take it out or the menu won't work + if (g_fullscreen) + { + g_fullscreen = 0; + g_SV->showNormal(); + g_SV->showMaximized(); + } + else + PopupMenu->popup(mapToGlobal(QPoint(mx, my))); + } + killTimer(timer_id); +} + +/******************************************************************************/ +void QMyMainWindow::MemuClicked(int MenuID) +{ + QWidget * Desktop; + int dw; + int dh; + + if (MenuID == 1) // right click + { + rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_DOWN | MOUSE_FLAG_BUTTON2, + rd(c2sx(mx)), rd(c2sy(my))); + rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_BUTTON2, + rd(c2sx(mx)), rd(c2sy(my))); + } + else if (MenuID == 2) // toggle full screen + { + g_fullscreen = ~g_fullscreen; + if (g_fullscreen) + { + Desktop = g_App->desktop(); + dw = Desktop->width(); + dh = Desktop->height(); + if (dw == g_client_width && dh == g_client_height) + g_MW->resize(g_client_width - 4, g_client_height - 4); + g_SV->showFullScreen(); + } + else + { + g_SV->showNormal(); + g_SV->showMaximized(); + g_MW->resize(g_client_width, g_client_height); + } + } + else if (MenuID == 3) // reset keyboard + { + rdp_send_input(0, RDP_INPUT_SCANCODE, RDP_KEYRELEASE, 0x2a, 0); // shift + rdp_send_input(0, RDP_INPUT_SCANCODE, RDP_KEYRELEASE, 0x1d, 0); // control + rdp_send_input(0, RDP_INPUT_SCANCODE, RDP_KEYRELEASE, 0x38, 0); // alt + } + else if (MenuID == 4) // double click + { + rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_DOWN | MOUSE_FLAG_BUTTON1, + rd(c2sx(mx)), rd(c2sy(my))); + rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_BUTTON1, + rd(c2sx(mx)), rd(c2sy(my))); + rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_DOWN | MOUSE_FLAG_BUTTON1, + rd(c2sx(mx)), rd(c2sy(my))); + rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_BUTTON1, + rd(c2sx(mx)), rd(c2sy(my))); + } +} + +/******************************************************************************/ +void QMyMainWindow::mouseMoveEvent(QMouseEvent* e) +{ + int x, y; + + x = e->x(); + y = e->y(); + if (timer_id) + { + x = x - mx; + y = y - my; + if (x < -10 || x > 10 || y < -10 || y > 10) + { + killTimer(timer_id); + timer_id = 0; + } + } + rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_MOVE, c2sx(e->x()), + c2sy(e->y())); +} + +/******************************************************************************/ +void QMyMainWindow::mousePressEvent(QMouseEvent* e) +{ + timer_id = startTimer(1000); + mx = e->x(); + my = e->y(); + if (e->button() == LeftButton) + rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_DOWN | MOUSE_FLAG_BUTTON1, + c2sx(e->x()), c2sy(e->y())); + else if (e->button() == RightButton) + rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_DOWN | MOUSE_FLAG_BUTTON2, + c2sx(e->x()), c2sy(e->y())); + else if (e->button() == MidButton) + rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_DOWN | MOUSE_FLAG_BUTTON3, + c2sx(e->x()), c2sy(e->y())); +} + +/******************************************************************************/ +void QMyMainWindow::mouseReleaseEvent(QMouseEvent* e) +{ + killTimer(timer_id); + timer_id = 0; + if (e->button() == LeftButton) + rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_BUTTON1, c2sx(e->x()), + c2sy(e->y())); + else if (e->button() == RightButton) + rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_BUTTON2, c2sx(e->x()), + c2sy(e->y())); + else if (e->button() == MidButton) + rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_BUTTON3, c2sx(e->x()), + c2sy(e->y())); +} + +/******************************************************************************/ +void QMyMainWindow::wheelEvent(QWheelEvent* e) +{ + if (e->delta() > 0) + rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_BUTTON4, c2sx(e->x()), + c2sy(e->y())); + else if (e->delta() < 0) + rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_BUTTON5, c2sx(e->x()), + c2sy(e->y())); +} + +#define NOT(x) (~x) + +/******************************************************************************/ +int rop(int rop, int src, int dst) +{ + switch (rop) + { + case 0x0: return 0; + case 0x1: return NOT (src | dst); + case 0x2: return NOT (src) & dst; + case 0x3: return NOT (src); + case 0x4: return src & NOT (dst); + case 0x5: return NOT (dst); + case 0x6: return src ^ dst; + case 0x7: return NOT (src & dst); + case 0x8: return src & dst; + case 0x9: return NOT (src) ^ dst; + case 0xa: return dst; + case 0xb: return NOT (src) | dst; + case 0xc: return src; + case 0xd: return src | NOT (dst); + case 0xe: return src | dst; + case 0xf: return NOT (0); + } + return dst; +} + +/*****************************************************************************/ +int get_pixel(int x, int y) +{ + if (x >= 0 && x < g_width && y >= 0 && y < g_height) + { + if (g_server_bpp == 8) + return GETPIXEL8(g_BS, x, y, g_width); + else if (g_server_bpp == 16) + return GETPIXEL16(g_BS, x, y, g_width); + else if (g_server_bpp == 24) + return GETPIXEL32(g_BS, x, y, g_width); + else + return 0; + } + else + return 0; +} + +/******************************************************************************/ +void set_pixel(int x, int y, int pixel, int op = 0xc) +{ + int p; + + if (x >= g_clipx && x < (g_clipx + g_clipcx) && + y >= g_clipy && y < (g_clipy + g_clipcy)) + { + if (x >= 0 && x < g_width && y >= 0 && y < g_height) + { + if (op == 0xc) + { + if (g_server_bpp == 8) + { + SETPIXEL8(g_BS, x, y, g_width, pixel); + } + else if (g_server_bpp == 16) + { + SETPIXEL16(g_BS, x, y, g_width, pixel); + } + else if (g_server_bpp == 24) + { + SETPIXEL32(g_BS, x, y, g_width, pixel); + } + } + else + { + if (g_server_bpp == 8) + { + p = GETPIXEL8(g_BS, x, y, g_width); + p = rop(op, pixel, p); + SETPIXEL8(g_BS, x, y, g_width, p); + } + else if (g_server_bpp == 16) + { + p = GETPIXEL16(g_BS, x, y, g_width); + p = rop(op, pixel, p); + SETPIXEL16(g_BS, x, y, g_width, p); + } + else if (g_server_bpp == 24) + { + p = GETPIXEL32(g_BS, x, y, g_width); + p = rop(op, pixel, p); + SETPIXEL32(g_BS, x, y, g_width, p); + } + } + } + } +} + +/******************************************************************************/ +// adjust coordinates for cliping rect +bool WarpCoords(int * x, int * y, int * cx, int * cy, int * srcx, int * srcy) +{ + int dx, dy; + QRect InRect(*x, *y, *cx, *cy); + QRect OutRect; + QRect CRect(g_clipx, g_clipy, g_clipcx, g_clipcy); + OutRect = InRect.intersect(CRect); + if (OutRect.isEmpty()) + return false; + dx = OutRect.x() - InRect.x(); + dy = OutRect.y() - InRect.y(); + *x = OutRect.x(); + *y = OutRect.y(); + *cx = OutRect.width(); + *cy = OutRect.height(); + if (srcx != NULL) + *srcx = *srcx + dx; + if (srcy != NULL) + *srcy = *srcy + dy; + return true; +} + +/******************************************************************************/ +void QMyMainWindow::paintEvent(QPaintEvent * pe) +{ + QImage * Image; + QPainter * Painter; + QRect Rect; + int i, j, w, h, l, t, pixel, r, g, b; + uint8 * data; + double sx, sy; + + Image = 0; + data = 0; + if (!testWFlags(WRepaintNoErase)) + setWFlags(WRepaintNoErase); + if (g_CM != NULL || g_server_bpp > 8) + { + sx = (double)g_client_width / (double)g_width; + sy = (double)g_client_height / (double)g_height; + Rect = pe->rect(); + l = rd(Rect.left() / sx); + t = rd(Rect.top() / sy); + w = rd(Rect.width() / sx); + h = rd(Rect.height() / sy); + if (w > 0 && h > 0) + { + if (g_server_bpp == 8 && g_CM->NumColors > 0) + { + w = (w + 3) & ~3; + data = (uint8*)xmalloc(w * h); + for (i = 0; i < h; i++) + for (j = 0; j < w; j++) + data[i * w + j] = GETPIXEL8(g_BS, l + j, t + i, g_width); + Image = new QImage(data, w, h, 8,(QRgb*)g_CM->RGBColors, + g_CM->NumColors, QImage::IgnoreEndian); + } + else if (g_server_bpp == 16) + { + w = (w + 3) & ~3; + data = (uint8*)xmalloc(w * h * 4); + for (i = 0; i < h; i++) + for (j = 0; j < w; j++) + { + pixel = GETPIXEL16(g_BS, l + j, t + i, g_width); + r = ((pixel >> 8) & 0xf8) | ((pixel >> 13) & 0x7); + g = ((pixel >> 3) & 0xfc) | ((pixel >> 9) & 0x3); + b = ((pixel << 3) & 0xf8) | ((pixel >> 2) & 0x7); + pixel = ((r << 16) | (g << 8) | b); + SETPIXEL32(data, j, i, w, pixel); + } + Image = new QImage(data, w, h, 32, NULL, + 0, QImage::IgnoreEndian); + } + else if (g_server_bpp == 24) + { + w = (w + 3) & ~3; + data = (uint8*)xmalloc(w * h * 4); + for (i = 0; i < h; i++) + for (j = 0; j < w; j++) + { + pixel = GETPIXEL32(g_BS, l + j, t + i, g_width); + r = (pixel >> 0) & 0xff; + g = (pixel >> 8) & 0xff; + b = (pixel >> 16) & 0xff; + pixel = ((r << 16) | (g << 8) | b); + SETPIXEL32(data, j, i, w, pixel); + } + Image = new QImage(data, w, h, 32, NULL, + 0, QImage::IgnoreEndian); + } + if (Image != 0) + { + Painter = new QPainter(this); + Painter->scale(sx, sy); + Painter->drawImage(l, t, *Image, 0, 0, w, h); + delete Painter; + delete Image; + } + xfree(data); + } + } +} + +/******************************************************************************/ +void QMyMainWindow::closeEvent(QCloseEvent * e) +{ + e->accept(); +} + +/******************************************************************************/ +void QMyMainWindow::dataReceived() +{ + if (!rdp_loop(&g_deactivated, &g_ext_disc_reason)) + g_SV->close(); +#ifdef WITH_RDPSND + if (g_dsp_busy) + { + if (g_SoundNotifier == 0) + { + g_SoundNotifier = new QSocketNotifier(g_dsp_fd, QSocketNotifier::Write, + g_MW); + g_MW->connect(g_SoundNotifier, SIGNAL(activated(int)), g_MW, + SLOT(soundSend())); + } + else + { + if (!g_SoundNotifier->isEnabled()) + g_SoundNotifier->setEnabled(true); + } + } +#endif +} + +/******************************************************************************/ +void QMyMainWindow::soundSend() +{ +#ifdef WITH_RDPSND + g_SoundNotifier->setEnabled(false); + wave_out_play(); + if (g_dsp_busy) + { + g_SoundNotifier->setEnabled(true); + } +#endif +} + +/******************************************************************************/ +void redraw(int x, int y, int cx, int cy) +{ + double sx, sy; + + if (WarpCoords(&x, &y, &cx, &cy, NULL, NULL)) + { + sx = (double)g_client_width / (double)g_width; + sy = (double)g_client_height / (double)g_height; + x = rd(x * sx); + y = rd(y * sy); + cx = rd(cx * sx); + cy = rd(cy * sy); + g_MW->update(x, y, cx, cy); + } +} + +/******************************************************************************/ +/* Returns 0 after user quit, 1 otherwise */ +int ui_select(int rdp_socket) +{ + if (g_global_sock == 0) + g_global_sock = rdp_socket; + return 1; +} + +/******************************************************************************/ +void ui_move_pointer(int /*x*/, int /*y*/) +{ +} + +/******************************************************************************/ +void ui_set_null_cursor(void) +{ +} + +/******************************************************************************/ +HBITMAP ui_create_bitmap(int width, int height, uint8 * data) +{ + struct bitmap * the_bitmap; + uint8 * bitmap_data; + int i, j; + int r, g, b, pixel; + + bitmap_data = (uint8*)xmalloc(width * height * 4); + the_bitmap = (struct bitmap*)xmalloc(sizeof(struct bitmap)); + the_bitmap->w = width; + the_bitmap->h = height; + the_bitmap->data = bitmap_data; + if (g_server_bpp == 8) + { + for (i = 0; i < height; i++) + for (j = 0; j < width; j++) + bitmap_data[i * width + j] = data[i * width + j]; + } + else if (g_server_bpp == 16) + { + for (i = 0; i < height; i++) + for (j = 0; j < width; j++) + *(((uint16*)bitmap_data) + (i * width + j)) = + *(((uint16*)data) + (i * width + j)); + } + else if (g_server_bpp == 24) + { + for (i = 0; i < height; i++) + for (j = 0; j < width; j++) + { + r = data[(i * width + j) * 3 + 0]; + g = data[(i * width + j) * 3 + 1]; + b = data[(i * width + j) * 3 + 2]; + pixel = (r << 16) | (g << 8) | b; + SETPIXEL32(bitmap_data, j, i, width, pixel); + } + } + return the_bitmap; +} + +/******************************************************************************/ +void ui_paint_bitmap(int x, int y, int cx, int cy, int width, + int height, uint8 * data) +{ + int i, j; + int r, g, b, pixel; + + if (g_server_bpp == 8) + { + for (i = 0; i < cy; i++) + for (j = 0; j < cx; j++) + if (i < height) + if (j < width) + set_pixel(x + j, y + i, data[i * width + j]); + } + else if (g_server_bpp == 16) + { + for (i = 0; i < cy; i++) + for (j = 0; j < cx; j++) + if (i < height) + if (j < width) + set_pixel(x + j, y + i, *(((uint16*)data) + (i * width + j))); + } + else if (g_server_bpp == 24) + { + for (i = 0; i < cy; i++) + for (j = 0; j < cx; j++) + if (i < height) + if (j < width) + { + r = data[(i * width + j) * 3 + 0]; + g = data[(i * width + j) * 3 + 1]; + b = data[(i * width + j) * 3 + 2]; + pixel = (r << 16) | (g << 8) | b; + set_pixel(x + j, y + i, pixel); + } + } + redraw(x, y, cx, cy); +} + +/******************************************************************************/ +void ui_destroy_bitmap(HBITMAP bmp) +{ + struct bitmap* the_bitmap; + + the_bitmap = (struct bitmap*)bmp; + if (the_bitmap != NULL) + { + if (the_bitmap->data != NULL) + xfree(the_bitmap->data); + xfree(the_bitmap); + } +} + +/******************************************************************************/ +bool is_pixel_on(uint8 * data, int x, int y, int width, int bpp) +{ + int start, shift; + + if (bpp == 1) + { + width = (width + 7) / 8; + start = (y * width) + x / 8; + shift = x % 8; + return (data[start] & (0x80 >> shift)) != 0; + } + else if (bpp == 8) + return data[y * width + x] != 0; + else + return false; +} + +/******************************************************************************/ +void set_pixel_on(uint8 * data, int x, int y, int width, int bpp, uint8 pixel) +{ + if (bpp == 8) + data[y * width + x] = pixel; +} + +/******************************************************************************/ +HGLYPH ui_create_glyph(int width, int height, uint8 * data) +{ + int i, j; + uint8* glyph_data; + struct bitmap* the_glyph; + + glyph_data = (uint8*)xmalloc(width * height); + the_glyph = (struct bitmap*)xmalloc(sizeof(struct bitmap)); + the_glyph->w = width; + the_glyph->h = height; + the_glyph->data = glyph_data; + memset(glyph_data, 0, width * height); + for (i = 0; i < height; i++) + for (j = 0; j < width; j++) + if (is_pixel_on(data, j, i, width, 1)) + set_pixel_on(glyph_data, j, i, width, 8, 255); + return the_glyph; +} + +/******************************************************************************/ +void ui_destroy_glyph(HGLYPH glyph) +{ + struct bitmap* the_glyph; + + the_glyph = (struct bitmap*)glyph; + if (the_glyph != NULL) + { + if (the_glyph->data != NULL) + xfree(the_glyph->data); + xfree(the_glyph); + } +} + +/******************************************************************************/ +HCURSOR ui_create_cursor(uint32 x, uint32 y, + int width, int height, + uint8 * andmask, uint8 * xormask) +{ + return (void*)1; +} + +/******************************************************************************/ +void ui_set_cursor(HCURSOR /*cursor*/) +{ +} + +/*****************************************************************************/ +uint16 ui_get_numlock_state(uint32 state) +{ + return 0; +} + +/*****************************************************************************/ +unsigned int read_keyboard_state(void) +{ + return 0; +} + +/*****************************************************************************/ +void ui_resize_window(void) +{ +} + +/*****************************************************************************/ +void ui_polygon(uint8 opcode, uint8 fillmode, POINT * point, int npoints, + BRUSH * brush, int bgcolour, int fgcolour) +{ +} + +/*****************************************************************************/ +/* todo, use qt function for this (QPainter::drawPolyline) */ +void ui_polyline(uint8 opcode, POINT * points, int npoints, PEN * pen) +{ + int i, x, y, dx, dy; + + if (npoints > 0) + { + x = points[0].x; + y = points[0].y; + for (i = 1; i < npoints; i++) + { + dx = points[i].x; + dy = points[i].y; + ui_line(opcode, x, y, x + dx, y + dy, pen); + x = x + dx; + y = y + dy; + } + } +} + +/*****************************************************************************/ +void ui_ellipse(uint8 opcode, uint8 fillmode, + int x, int y, int cx, int cy, + BRUSH * brush, int bgcolour, int fgcolour) +{ +} + +/******************************************************************************/ +void ui_destroy_cursor(HCURSOR /*cursor*/) +{ +} + +/******************************************************************************/ +HCOLOURMAP ui_create_colourmap(COLOURMAP * colours) +{ + int i; + int x; + uint8 r, g, b; + i = 0; + while (i < colours->ncolours && i < 256) + { + r = colours->colours[i].red; + g = colours->colours[i].green; + b = colours->colours[i].blue; + x = (r << 16) | (g << 8) | b; + g_CM->RGBColors[i] = x; + i++; + } + g_CM->NumColors = colours->ncolours; + return g_CM; +} + +/******************************************************************************/ +void ui_set_colourmap(HCOLOURMAP map) +{ +} + +/******************************************************************************/ +void ui_destroy_colourmap(HCOLOURMAP map) +{ +} + +/******************************************************************************/ +void ui_begin_update(void) +{ +} + +/******************************************************************************/ +void ui_end_update(void) +{ +} + +/******************************************************************************/ +void ui_set_clip(int x, int y, int cx, int cy) +{ + g_clipx = x; + g_clipy = y; + g_clipcx = cx; + g_clipcy = cy; +} + +/******************************************************************************/ +void ui_reset_clip(void) +{ + g_clipx = 0; + g_clipy = 0; + g_clipcx = g_width; + g_clipcy = g_height; +} + +/******************************************************************************/ +void ui_bell(void) +{ + g_App->beep(); +} + +/******************************************************************************/ +void ui_destblt(uint8 opcode, int x, int y, int cx, int cy) +{ + int i, j; + + + if (opcode == 0x0) /* black */ + { + for (i = 0; i < cy; i++) + for (j = 0; j < cx; j++) + set_pixel(x + j, y + i, 0, 0xc); + } + else if (opcode == 0xf) /* white */ + { + for (i = 0; i < cy; i++) + for (j = 0; j < cx; j++) + set_pixel(x + j, y + i, 0xffffff, 0xc); + } + else + { + for (i = 0; i < cy; i++) + for (j = 0; j < cx; j++) + set_pixel(x + j, y + i, get_pixel(x + j, y + i), opcode); + } + redraw(x, y, cx, cy); +} + +/******************************************************************************/ +// does not repaint +void fill_rect(int x, int y, int cx, int cy, int colour, int opcode = 0xc) +{ + int i, j; + + if (x + cx > g_width) + cx = g_width - x; + if (y + cy > g_height) + cy = g_height - y; +#ifdef QT_OPTI + if (opcode == 0xc) /* optimize */ + { + if (WarpCoords(&x, &y, &cx, &cy, 0, 0)) + { + if (g_server_bpp == 8) + { + for (i = 0; i < cy; i++) + for (j = 0; j < cx; j++) + SETPIXEL8(g_BS, x + j, y + i, g_width, colour); + } + else if (g_server_bpp == 16) + { + for (i = 0; i < cy; i++) + for (j = 0; j < cx; j++) + SETPIXEL16(g_BS, x + j, y + i, g_width, colour); + } + else if (g_server_bpp == 24) + { + for (i = 0; i < cy; i++) + for (j = 0; j < cx; j++) + SETPIXEL32(g_BS, x + j, y + i, g_width, colour); + } + } + } + else +#endif + { + for (i = 0; i < cy; i++) + for (j = 0; j < cx; j++) + set_pixel(x + j, y + i, colour, opcode); + } +} + +/******************************************************************************/ +void ui_rect(int x, int y, int cx, int cy, int colour) +{ + fill_rect(x, y, cx, cy, colour); + redraw(x, y, cx, cy); +} + +/******************************************************************************/ +void ui_patblt(uint8 opcode, int x, int y, int cx, int cy, + BRUSH * brush, int bgcolour, int fgcolour) +{ + int i, j; + uint8 ipattern[8]; + + switch (brush->style) + { + case 0: + fill_rect(x, y, cx, cy, fgcolour, opcode); + break; + case 3: + for (i = 0; i < 8; i++) + ipattern[i] = ~brush->pattern[7 - i]; + for (i = 0; i < cy; i++) + for (j = 0; j < cx; j++) + if (is_pixel_on(ipattern, (x + j + brush->xorigin) % 8, + (y + i + brush->yorigin) % 8, 8, 1)) + set_pixel(x + j, y + i, fgcolour, opcode); + else + set_pixel(x + j, y + i, bgcolour, opcode); + break; + } + redraw(x, y, cx, cy); +} + +/******************************************************************************/ +void ui_screenblt(uint8 opcode, int x, int y, int cx, int cy, + int srcx, int srcy) +{ + int i, j, pixel; + uint8 * temp; + + temp = (uint8*)xmalloc(cx * cy * 4); +#ifdef QT_OPTI + if (opcode == 0xc) + { + if (WarpCoords(&x, &y, &cx, &cy, &srcx, &srcy)) + { + if (g_server_bpp == 8) + { + for (i = 0; i < cy; i++) + for (j = 0; j < cx; j++) + { + pixel = GETPIXEL8(g_BS, srcx + j, srcy + i, g_width); + SETPIXEL8(temp, j, i, cx, pixel); + } + for (i = 0; i < cy; i++) + for (j = 0; j < cx; j++) + { + pixel = GETPIXEL8(temp, j, i, cx); + SETPIXEL8(g_BS, x + j, y + i, g_width, pixel); + } + } + else if (g_server_bpp == 16) + { + for (i = 0; i < cy; i++) + for (j = 0; j < cx; j++) + { + pixel = GETPIXEL16(g_BS, srcx + j, srcy + i, g_width); + SETPIXEL16(temp, j, i, cx, pixel); + } + for (i = 0; i < cy; i++) + for (j = 0; j < cx; j++) + { + pixel = GETPIXEL16(temp, j, i, cx); + SETPIXEL16(g_BS, x + j, y + i, g_width, pixel); + } + } + else if (g_server_bpp == 24) + { + for (i = 0; i < cy; i++) + for (j = 0; j < cx; j++) + { + pixel = GETPIXEL32(g_BS, srcx + j, srcy + i, g_width); + SETPIXEL32(temp, j, i, cx, pixel); + } + for (i = 0; i < cy; i++) + for (j = 0; j < cx; j++) + { + pixel = GETPIXEL32(temp, j, i, cx); + SETPIXEL32(g_BS, x + j, y + i, g_width, pixel); + } + } + } + } + else +#endif + { + if (g_server_bpp == 8) + { + for (i = 0; i < cy; i++) + for (j = 0; j < cx; j++) + temp[i * cx + j] = get_pixel(srcx + j, srcy + i); + for (i = 0; i < cy; i++) + for (j = 0; j < cx; j++) + set_pixel(x + j, y + i, temp[i * cx + j], opcode); + } + else if (g_server_bpp == 16) + { + for (i = 0; i < cy; i++) + for (j = 0; j < cx; j++) + { + pixel = get_pixel(srcx + j, srcy + i); + SETPIXEL16(temp, j, i, cx, pixel); + } + for (i = 0; i < cy; i++) + for (j = 0; j < cx; j++) + { + pixel = GETPIXEL16(temp, j, i, cx); + set_pixel(x + j, y + i, pixel, opcode); + } + } + else if (g_server_bpp == 24) + { + for (i = 0; i < cy; i++) + for (j = 0; j < cx; j++) + *(((uint32*)temp) + (i * cx + j)) = get_pixel(srcx + j, srcy + i); + for (i = 0; i < cy; i++) + for (j = 0; j < cx; j++) + set_pixel(x + j, y + i, *(((uint32*)temp) + (i * cx + j)), opcode); + } + } + xfree(temp); + redraw(x, y, cx, cy); +} + +/******************************************************************************/ +void ui_memblt(uint8 opcode, int x, int y, int cx, int cy, + HBITMAP src, int srcx, int srcy) +{ + int i, j, p; + struct bitmap * the_bitmap; + + the_bitmap = (struct bitmap*)src; + if (the_bitmap == NULL) + return; +#ifdef QT_OPTI + if (opcode == 0xc) /* optimize */ + { + if (WarpCoords(&x, &y, &cx, &cy, &srcx, &srcy)) + { + if (g_server_bpp == 8) + { + for (i = 0; i < cy; i++) + for (j = 0; j < cx; j++) + { + p = GETPIXEL8(the_bitmap->data, srcx + j, srcy + i, the_bitmap->w); + SETPIXEL8(g_BS, x + j, y + i, g_width, p); + } + } + else if (g_server_bpp == 16) + { + for (i = 0; i < cy; i++) + for (j = 0; j < cx; j++) + { + p = GETPIXEL16(the_bitmap->data, srcx + j, srcy + i, the_bitmap->w); + SETPIXEL16(g_BS, x + j, y + i, g_width, p); + } + } + else if (g_server_bpp == 24) + { + for (i = 0; i < cy; i++) + for (j = 0; j < cx; j++) + { + p = GETPIXEL32(the_bitmap->data, srcx + j, srcy + i, the_bitmap->w); + SETPIXEL32(g_BS, x + j, y + i, g_width, p); + } + } + } + } + else +#endif + { + if (g_server_bpp == 8) + { + for (i = 0; i < cy; i++) + for (j = 0; j < cx; j++) + if ((i + srcy) < the_bitmap->h && (j + srcx) < the_bitmap->w) + set_pixel(x + j, y + i, + the_bitmap->data[(i + srcy) * the_bitmap->w + (j + srcx)], + opcode); + } + else if (g_server_bpp == 16) + { + for (i = 0; i < cy; i++) + for (j = 0; j < cx; j++) + if ((i + srcy) < the_bitmap->h && (j + srcx) < the_bitmap->w) + set_pixel(x + j, y + i, + *(((uint16*)the_bitmap->data) + ((i + srcy) * the_bitmap->w + (j + srcx))), + opcode); + } + else if (g_server_bpp == 24) + { + for (i = 0; i < cy; i++) + for (j = 0; j < cx; j++) + if ((i + srcy) < the_bitmap->h && (j + srcx) < the_bitmap->w) + set_pixel(x + j, y + i, + *(((uint32*)the_bitmap->data) + ((i + srcy) * the_bitmap->w + (j + srcx))), + opcode); + } + } + redraw(x, y, cx, cy); +} + +/******************************************************************************/ +// not used +void ui_triblt(uint8 opcode, int x, int y, int cx, int cy, + HBITMAP src, int srcx, int srcy, BRUSH * brush, + int bgcolour, int fgcolour) +{ +} + +/******************************************************************************/ +/* Bresenham's line drawing algorithm */ +void ui_line(uint8 opcode, int startx, int starty, int endx, + int endy, PEN * pen) +{ + int dx, dy, incx, incy, dpr, dpru, p, left, top, right, bottom; + + if (startx > endx) + { + dx = startx - endx; + incx = -1; + left = endx; + right = startx; + } + else + { + dx = endx - startx; + incx = 1; + left = startx; + right = endx; + } + if (starty > endy) + { + dy = starty - endy; + incy = -1; + top = endy; + bottom = starty; + } + else + { + dy = endy - starty; + incy = 1; + top = starty; + bottom = endy; + } + if (dx >= dy) + { + dpr = dy << 1; + dpru = dpr - (dx << 1); + p = dpr - dx; + for (; dx >= 0; dx--) + { + set_pixel(startx, starty, pen->colour, opcode); + if (p > 0) + { + startx += incx; + starty += incy; + p += dpru; + } + else + { + startx += incx; + p += dpr; + } + } + } + else + { + dpr = dx << 1; + dpru = dpr - (dy << 1); + p = dpr - dy; + for (; dy >= 0; dy--) + { + set_pixel(startx, starty, pen->colour, opcode); + if (p > 0) + { + startx += incx; + starty += incy; + p += dpru; + } + else + { + starty += incy; + p += dpr; + } + } + } + redraw(left, top, (right - left) + 1, (bottom - top) + 1); +} + +/******************************************************************************/ +void draw_glyph (int x, int y, HGLYPH glyph, int fgcolour) +{ + struct bitmap *the_glyph; + int i, j; + + the_glyph = (struct bitmap*)glyph; + if (the_glyph == NULL) + return; + for (i = 0; i < the_glyph->h; i++) + for (j = 0; j < the_glyph->w; j++) + if (is_pixel_on(the_glyph->data, j, i, the_glyph->w, 8)) + set_pixel(x + j, y + i, fgcolour); +} + +#define DO_GLYPH(ttext,idx) \ +{\ + glyph = cache_get_font (font, ttext[idx]);\ + if (!(flags & TEXT2_IMPLICIT_X))\ + {\ + xyoffset = ttext[++idx];\ + if ((xyoffset & 0x80))\ + {\ + if (flags & TEXT2_VERTICAL) \ + y += ttext[idx+1] | (ttext[idx+2] << 8);\ + else\ + x += ttext[idx+1] | (ttext[idx+2] << 8);\ + idx += 2;\ + }\ + else\ + {\ + if (flags & TEXT2_VERTICAL) \ + y += xyoffset;\ + else\ + x += xyoffset;\ + }\ + }\ + if (glyph != NULL)\ + {\ + draw_glyph (x + glyph->offset, y + glyph->baseline, glyph->pixmap, fgcolour);\ + if (flags & TEXT2_IMPLICIT_X)\ + x += glyph->width;\ + }\ +} + +/******************************************************************************/ +//***************************************************************************** +void ui_draw_text(uint8 font, uint8 flags, uint8 opcode, int mixmode, + int x, int y, int clipx, int clipy, + int clipcx, int clipcy, int boxx, + int boxy, int boxcx, int boxcy, BRUSH * brush, + int bgcolour, int fgcolour, uint8 * text, uint8 length) +{ + FONTGLYPH * glyph; + int i, j, xyoffset; + DATABLOB * entry; + + if (boxx + boxcx > g_width) + boxcx = g_width - boxx; + if (boxy + boxcy > g_height) + boxcy = g_height - boxy; + + if (boxcx > 1) + fill_rect(boxx, boxy, boxcx, boxcy, bgcolour); + else if (mixmode == MIX_OPAQUE) + fill_rect(clipx, clipy, clipcx, clipcy, bgcolour); + + /* Paint text, character by character */ + for (i = 0; i < length;) + { + switch (text[i]) + { + case 0xff: + if (i + 2 < length) + cache_put_text(text[i + 1], text, text[i + 2]); + else + { + error("this shouldn't be happening\n"); + exit(1); + } + /* this will move pointer from start to first character after FF command */ + length -= i + 3; + text = &(text[i + 3]); + i = 0; + break; + + case 0xfe: + entry = cache_get_text(text[i + 1]); + if (entry != NULL) + { + if ((((uint8 *) (entry->data))[1] == 0) && (!(flags & TEXT2_IMPLICIT_X))) + { + if (flags & TEXT2_VERTICAL) + y += text[i + 2]; + else + x += text[i + 2]; + } + for (j = 0; j < entry->size; j++) + DO_GLYPH(((uint8 *) (entry->data)), j); + } + if (i + 2 < length) + i += 3; + else + i += 2; + length -= i; + /* this will move pointer from start to first character after FE command */ + text = &(text[i]); + i = 0; + break; + + default: + DO_GLYPH(text, i); + i++; + break; + } + } + if (boxcx > 1) + redraw(boxx, boxy, boxcx, boxcy); + else + redraw(clipx, clipy, clipcx, clipcy); +} + +/******************************************************************************/ +void ui_desktop_save(uint32 offset, int x, int y, int cx, int cy) +{ + uint8 * data; + int i, j, Bpp, pixel; + + Bpp = 4; + switch (g_server_bpp) + { + case 8: Bpp = 1; break; + case 15: Bpp = 2; break; + case 16: Bpp = 2; break; + } + data = (uint8*)xmalloc(cx * cy * Bpp); + if (g_server_bpp == 8) + { + for (i = 0; i < cy; i++) + for (j = 0; j < cx; j++) + { + pixel = get_pixel(x + j, y + i); + SETPIXEL8(data, j, i, cx, pixel); + } + } + else if (g_server_bpp == 16) + { + for (i = 0; i < cy; i++) + for (j = 0; j < cx; j++) + { + pixel = get_pixel(x + j, y + i); + SETPIXEL16(data, j, i, cx, pixel); + } + } + else if (g_server_bpp == 24) + { + for (i = 0; i < cy; i++) + for (j = 0; j < cx; j++) + *(((uint32*)data) + (i * cx + j)) = get_pixel(x + j, y + i); + } + offset *= Bpp; + cache_put_desktop(offset, cx, cy, cx * Bpp, Bpp, data); + xfree(data); +} + +/******************************************************************************/ +void ui_desktop_restore(uint32 offset, int x, int y, int cx, int cy) +{ + uint8 * data; + int i, j; + int Bpp; + + Bpp = 4; + switch (g_server_bpp) + { + case 8: Bpp = 1; break; + case 15: Bpp = 2; break; + case 16: Bpp = 2; break; + } + offset *= Bpp; + data = cache_get_desktop(offset, cx, cy, Bpp); + if (g_server_bpp == 8) + { + for (i = 0; i < cy; i++) + for (j = 0; j < cx; j++) + set_pixel(x + j, y + i, data[i * cx + j]); + } + else if (g_server_bpp == 16) + { + for (i = 0; i < cy; i++) + for (j = 0; j < cx; j++) + set_pixel(x + j, y + i, *(((uint16*)data) + (i * cx + j))); + } + else if (g_server_bpp == 24) + { + for (i = 0; i < cy; i++) + for (j = 0; j < cx; j++) + set_pixel(x + j, y + i, *(((uint32*)data) + (i * cx + j))); + } + redraw(x, y, cx, cy); +} + +/*****************************************************************************/ +void * xrealloc(void * in_val, int size) +{ + if (size < 1) + { + size = 1; + } + return realloc(in_val, size); +} + +/*****************************************************************************/ +void * xmalloc(int size) +{ + return malloc(size); +} + +/*****************************************************************************/ +void xfree(void * in_val) +{ + if (in_val != NULL) + { + free(in_val); + } +} + +/*****************************************************************************/ +char * xstrdup(const char * s) +{ + char * mem = strdup(s); + if (mem == NULL) + { + perror("strdup"); + exit(1); + } + return mem; +} + +/*****************************************************************************/ +void warning(char * format, ...) +{ + va_list ap; + + fprintf(stderr, "WARNING: "); + va_start(ap, format); + vfprintf(stderr, format, ap); + va_end(ap); +} + +/*****************************************************************************/ +void unimpl(char * format, ...) +{ + va_list ap; + + fprintf(stderr, "NOT IMPLEMENTED: "); + va_start(ap, format); + vfprintf(stderr, format, ap); + va_end(ap); +} + +/*****************************************************************************/ +void error(char * format, ...) +{ + va_list ap; + + fprintf(stderr, "ERROR: "); + va_start(ap, format); + vfprintf(stderr, format, ap); + va_end(ap); +} + +/*****************************************************************************/ +BOOL rd_pstcache_mkdir(void) +{ + return 0; +} + +/*****************************************************************************/ +int rd_open_file(char * filename) +{ + return 0; +} + +/*****************************************************************************/ +void rd_close_file(int fd) +{ + return; +} + +/*****************************************************************************/ +int rd_read_file(int fd, void * ptr, int len) +{ + return 0; +} + +/*****************************************************************************/ +int rd_write_file(int fd, void * ptr, int len) +{ + return 0; +} + +/*****************************************************************************/ +int rd_lseek_file(int fd, int offset) +{ + return 0; +} + +/*****************************************************************************/ +BOOL rd_lock_file(int fd, int start, int len) +{ + return False; +} + +/*****************************************************************************/ +int load_licence(uint8 ** data) +{ + return 0; +} + +/*****************************************************************************/ +void save_licence(uint8 * data, int length) +{ +} + +/*****************************************************************************/ +void generate_random(uint8 * random) +{ + QFile File("/dev/random"); + File.open(IO_ReadOnly); + if (File.readBlock((char*)random, 32) == 32) + { + return; + } + warning("no /dev/random\n"); + memcpy(random, "12345678901234567890123456789012", 32); +} + +/*****************************************************************************/ +/* produce a hex dump */ +void hexdump(uint8 * p, uint32 len) +{ + uint8 * line = p; + int i, thisline; + uint32 offset = 0; + + while (offset < len) + { + printf("%04x ", offset); + thisline = len - offset; + if (thisline > 16) + { + thisline = 16; + } + for (i = 0; i < thisline; i++) + { + printf("%02x ", line[i]); + } + for (; i < 16; i++) + { + printf(" "); + } + for (i = 0; i < thisline; i++) + { + printf("%c", (line[i] >= 0x20 && line[i] < 0x7f) ? line[i] : '.'); + } + printf("\n"); + offset += thisline; + line += thisline; + } +} + +/*****************************************************************************/ +void get_username_and_hostname(void) +{ + char fullhostname[64]; + char * p; + struct passwd * pw; + + STRNCPY(g_username, "unknown", sizeof(g_username)); + STRNCPY(g_hostname, "unknown", sizeof(g_hostname)); + pw = getpwuid(getuid()); + if (pw != NULL && pw->pw_name != NULL) + { + STRNCPY(g_username, pw->pw_name, sizeof(g_username)); + } + if (gethostname(fullhostname, sizeof(fullhostname)) != -1) + { + p = strchr(fullhostname, '.'); + if (p != NULL) + { + *p = 0; + } + STRNCPY(g_hostname, fullhostname, sizeof(g_hostname)); + } +} + +/*****************************************************************************/ +void out_params(void) +{ + fprintf(stderr, "qterdesktop: A Remote Desktop Protocol client.\n"); + fprintf(stderr, "Version " VERSION ". Copyright (C) 1999-2004 Matt Chapman.\n"); + fprintf(stderr, "See http://www.rdesktop.org/ for more information.\n\n"); + fprintf(stderr, "Usage: qterdesktop [options] server\n"); + fprintf(stderr, " -g: desktop geometry (WxH)\n"); + fprintf(stderr, " -4: use RDP version 4\n"); + fprintf(stderr, " -5: use RDP version 5 (default)\n"); + fprintf(stderr, " -t: tcp port)\n"); + fprintf(stderr, " -a: connection colour depth\n"); + fprintf(stderr, " -u: user name\n"); + fprintf(stderr, " -d: domain\n"); + fprintf(stderr, " -s: shell\n"); + fprintf(stderr, " -c: working directory\n"); + fprintf(stderr, " -p: password (- to prompt)\n"); + fprintf(stderr, " -n: client hostname\n"); + fprintf(stderr, " -f: full screen\n"); + fprintf(stderr, " -r sound: enable sound\n"); + fprintf(stderr, "\n"); +} + +/*****************************************************************************/ +int parse_parameters(int in_argc, char ** in_argv) +{ + int i; + char * p; + + for (i = 1; i < in_argc; i++) + { + strcpy(g_server, in_argv[i]); + if (strcmp(in_argv[i], "-h") == 0) + { + out_params(); + return 0; + } + else if (strcmp(in_argv[i], "-g") == 0) + { + g_width = strtol(in_argv[i + 1], &p, 10); + if (*p == 'x') + { + g_height = strtol(p + 1, &p, 10); + } + if (*p == '-') + { + g_client_width = strtol(p + 1, &p, 10); + } + else + { + g_client_width = g_width; + g_client_height = g_height; + } + if (*p == 'x') + { + g_client_height = strtol(p + 1, NULL, 10); + } + g_width = (g_width + 3) & ~3; + g_height = (g_height + 3) & ~3; + g_client_width = (g_client_width + 3) & ~3; + g_client_height = (g_client_height + 3) & ~3; + i++; + } + else if (strcmp(in_argv[i], "-4") == 0) + { + g_use_rdp5 = 0; + } + else if (strcmp(in_argv[i], "-5") == 0) + { + g_use_rdp5 = 1; + } + else if (strcmp(in_argv[i], "-a") == 0) + { + g_server_bpp = strtol(in_argv[i + 1], &p, 10); + if (g_server_bpp != 8 && + g_server_bpp != 16 && g_server_bpp != 24) + { + error("invalid bpp\n"); + return 0; + } + i++; + } + else if (strcmp(in_argv[i], "-t") == 0) + { + g_tcp_port_rdp = strtol(in_argv[i + 1], &p, 10); + i++; + } + else if (strcmp(in_argv[i], "-u") == 0) + { + STRNCPY(g_username, in_argv[i + 1], sizeof(g_username)); + i++; + } + else if (strcmp(in_argv[i], "-d") == 0) + { + STRNCPY(g_domain, in_argv[i + 1], sizeof(g_domain)); + i++; + } + else if (strcmp(in_argv[i], "-s") == 0) + { + STRNCPY(g_shell, in_argv[i + 1], sizeof(g_shell)); + i++; + } + else if (strcmp(in_argv[i], "-c") == 0) + { + STRNCPY(g_directory, in_argv[i + 1], sizeof(g_directory)); + i++; + } + else if (strcmp(in_argv[i], "-p") == 0) + { + STRNCPY(g_password, in_argv[i + 1], sizeof(g_password)); + g_flags |= RDP_LOGON_AUTO; + i++; + } + else if (strcmp(in_argv[i], "-n") == 0) + { + STRNCPY(g_hostname, in_argv[i + 1], sizeof(g_hostname)); + i++; + } + else if (strcmp(in_argv[i], "-f") == 0) + { + g_fullscreen = 1; + } + else if (strcmp(in_argv[i], "-r") == 0) + { + if (strcmp(in_argv[i + 1], "sound") == 0) + { +#ifdef WITH_RDPSND + g_rdpsnd = 1; +#endif + } + i++; + } + } + return 1; +} + +/******************************************************************************/ +int param_connect(void) +{ + QWidget * Desktop; + int dw, dh; + +#ifdef WITH_RDPSND + // init sound + if (g_rdpsnd) + { + rdpsnd_init(); + } +#endif + if (rdp_connect(g_server, g_flags, g_domain, g_password, g_shell, + g_directory)) + { + g_BS = (uint8*)xmalloc(g_width * g_height * 4); + memset(g_BS, 0, g_width * g_height * 4); + g_clipx = 0; + g_clipy = 0; + g_clipcx = g_width; + g_clipcy = g_height; + g_CM = (QColorMap*)xmalloc(sizeof(struct QColorMap)); + memset(g_CM, 0, sizeof(struct QColorMap)); + g_CM->NumColors = 256; + g_MW = new QMyMainWindow(); + g_MW->resize(g_client_width, g_client_height); + g_MW->show(); + g_SV->addChild(g_MW); + g_MW->setMouseTracking(true); + g_SocketNotifier = new QSocketNotifier(g_global_sock, + QSocketNotifier::Read, + g_MW); + g_MW->connect(g_SocketNotifier, SIGNAL(activated(int)), g_MW, + SLOT(dataReceived())); + if (g_fullscreen) + { + Desktop = g_App->desktop(); + dw = Desktop->width(); + dh = Desktop->height(); + if (dw == g_client_width && dh == g_client_height) + { + g_MW->resize(g_client_width - 4, g_client_height - 4); + } + g_SV->showFullScreen(); + } + g_MW->setCursor((int)10); /* Qt::BlankCursor */ + g_App->exec(); + } + return 0; +} + +/******************************************************************************/ +int main(int argc, char ** argv) +{ +#ifdef SHARP + g_App = new QPEApplication(argc, argv); +#else + g_App = new QApplication(argc, argv, QApplication::GuiServer); + //g_App = new QApplication(argc, argv); +#endif + g_SV = new QMyScrollView(); + g_App->setMainWidget(g_SV); + g_SV->showMaximized(); + if (argc > 1) + { + get_username_and_hostname(); + if (parse_parameters(argc, argv)) + { + param_connect(); + } + } + else + { + g_SV->timer_id = g_SV->startTimer(1000); /* one sec delay, then dialog */ + g_App->exec(); + } + delete g_SV; + delete g_App; + xfree(g_CM); + xfree(g_BS); + return 0; +} --- rdesktop-1.5.0.orig/uiports/qtewin.h +++ rdesktop-1.5.0/uiports/qtewin.h @@ -0,0 +1,107 @@ + +#include <qwidget.h> +#include <qscrollview.h> +#include <qdialog.h> +#include <qlistbox.h> +#include <qlineedit.h> +#include <qcombobox.h> +#include <qlabel.h> +#include <qcheckbox.h> +#include <qpopupmenu.h> + +class QMyConnectionItem +{ + public: + QString ServerName; + QString UserName; + QString ServerIP; + int Width; + int Height; + int FullScreen; +}; + +class QMyDialog: public QDialog +{ + Q_OBJECT + public: + QMyDialog(QWidget*); + ~QMyDialog(); + public: + QListBox* ListBox; + QPushButton* OKButton; + QPushButton* CancelButton; + QLabel* Label1; + QLineEdit* ServerNameEdit; + QLabel* Label2; + QLineEdit* UserNameEdit; + QLabel* Label3; + QLineEdit* IPEdit; + QLineEdit* WidthEdit; + QLineEdit* HeightEdit; + QComboBox* WidthHeightBox; + QPushButton* AddButton; + QPushButton* EditButton; + QPushButton* SaveButton; + QPushButton* RemoveButton; + QCheckBox* FullScreenCheckBox; + public slots: + void ComboChanged(int); + void OKClicked(); + void CancelClicked(); + void AddClicked(); + void EditClicked(); + void SaveClicked(); + void RemoveClicked(); + void ListBoxChanged(); + void ListBoxSelected(int); + public: + QString ServerName; + QString UserName; + QString ServerIP; + int Width; + int Height; + int FullScreen; + QMyConnectionItem* ConnectionList[10]; +}; + +class QMyScrollView: public QScrollView +{ + Q_OBJECT + public: + QMyScrollView(); + ~QMyScrollView(); + void keyPressEvent(QKeyEvent*); + void keyReleaseEvent(QKeyEvent*); + void showEvent(QShowEvent*); + void show(); + void polish(); + void timerEvent(QTimerEvent*); + public: + int timer_id; + int sound_timer_id; +}; + +class QMyMainWindow: public QWidget +{ + Q_OBJECT + public: + QMyMainWindow(); + ~QMyMainWindow(); + void paintEvent(QPaintEvent*); + void mouseMoveEvent(QMouseEvent*); + void mousePressEvent(QMouseEvent*); + void mouseReleaseEvent(QMouseEvent*); + void wheelEvent(QWheelEvent*); + void closeEvent(QCloseEvent*); + void timerEvent(QTimerEvent*); + public slots: + void dataReceived(); + void soundSend(); + void MemuClicked(int); + public: + QPopupMenu* PopupMenu; + int timer_id; + int mx; + int my; +}; + --- rdesktop-1.5.0.orig/uiports/qtreadme.txt +++ rdesktop-1.5.0/uiports/qtreadme.txt @@ -0,0 +1,12 @@ +This is the Qt/X11 ui port +qt should be installed in /usr/local/qt +you may need to have LD_LIBRARY_PATH defined to run qtrdesktop +tested with versions 2.3.2, 3.1.2 + +makefile_qt can be edited to change file localtions +run make -f makefile_qt in this directory to compile it + +qtreadme.txt - notes, this file +makefile_qt - makefile +qtwin.cpp - ui lib +qtwin.h - header --- rdesktop-1.5.0.orig/uiports/qtwin.cpp +++ rdesktop-1.5.0/uiports/qtwin.cpp @@ -0,0 +1,1827 @@ +/* -*- c-basic-offset: 8 -*- + rdesktop: A Remote Desktop Protocol client. + User interface services - QT Window System + Copyright (C) Jay Sorg 2004-2007 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 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., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "rdesktop.h" + +#include <qapplication.h> +#include <qmainwindow.h> +#include <qwidget.h> +#include <qpainter.h> +#include <qpixmap.h> +#include <qbrush.h> +#include <qimage.h> +#include <qbitmap.h> +#include <qcursor.h> +#include <qsocketnotifier.h> +#include <qscrollview.h> +#include <qfile.h> + +#include "qtwin.h" + +#include <unistd.h> // gethostname +#include <pwd.h> // getpwuid +#include <stdarg.h> // va_list va_start va_end + +#include <errno.h> +#include <fcntl.h> + +/* rdesktop globals */ +extern int g_tcp_port_rdp; +RD_BOOL g_use_rdp5 = True; +char g_hostname[16]; +char g_username[64]; +int g_height = 600; +int g_width = 800; +int g_server_depth = 8; +int g_encryption = 1; +int g_desktop_save = 1; +int g_polygon_ellipse_orders = 0; +int g_bitmap_cache = 1; +int g_bitmap_cache_persist_enable = False; +int g_bitmap_cache_precache = True; +int g_bitmap_compression = 1; +int g_rdp5_performanceflags = 0; +int g_console_session = 0; +int g_keylayout = 0x409; /* Defaults to US keyboard layout */ +int g_keyboard_type = 0x4; /* Defaults to US keyboard layout */ +int g_keyboard_subtype = 0x0; /* Defaults to US keyboard layout */ +int g_keyboard_functionkeys = 0xc; /* Defaults to US keyboard layout */ +int g_numlock_sync = 0; + +/* hack globals */ +static int g_argc = 0; +static char ** g_argv = 0; +static int g_UpAndRunning = 0; +static int g_sock = 0; +static int g_deactivated = 0; +static uint32 g_ext_disc_reason = 0; +static char g_servername[128]; +static char g_title[128] = ""; +static int g_flags = RDP_LOGON_NORMAL; + +#ifdef WITH_RDPSND +extern int g_dsp_busy; +extern int g_dsp_fd; +static int g_rdpsnd = 0; +static QSocketNotifier * g_SoundNotifier = 0; +#endif + +/* qt globals */ +static QSocketNotifier * g_SocketNotifier = 0; +static QApplication * g_App = 0; +static QMyMainWindow * g_MW = 0; +static QMyScrollView * g_SV = 0; +static QPixmap * g_BS = 0; +static QPixmap * g_DS = 0; +static QPainter * g_P1 = 0; +static QPainter * g_P2 = 0; +static QColor g_Color1; +static QColor g_Color2; + +struct QColorMap +{ + uint32 RGBColors[256]; + int NumColors; +}; +static struct QColorMap * g_CM = 0; +static QRegion * g_ClipRect; + +static Qt::RasterOp g_OpCodes[16] = { + Qt::ClearROP, // BLACKNESS 0 + Qt::NorROP, // NOTSRCERASE DSon + Qt::NotAndROP, // DSna + Qt::NotCopyROP, // NOTSRCCOPY Sn + Qt::AndNotROP, // SRCERASE SDna + Qt::NotROP, // DSTINVERT Dn + Qt::XorROP, // SRCINVERT DSx + Qt::NandROP, // DSan + Qt::AndROP, // SRCAND DSa + Qt::NotXorROP, // DSxn + Qt::NopROP, // D + Qt::NotOrROP, // MERGEPAINT DSno + Qt::CopyROP, // SRCCOPY S + Qt::OrNotROP, // SDno + Qt::OrROP, // SRCPAINT DSo + Qt::SetROP}; // WHITENESS 1 + +/* Session Directory redirection */ +RD_BOOL g_redirect = False; +char g_redirect_server[64]; +char g_redirect_domain[16]; +char g_redirect_password[64]; +char g_redirect_username[64]; +char g_redirect_cookie[128]; +uint32 g_redirect_flags = 0; + +//***************************************************************************** +uint32 Color15to32(uint32 InColor) +{ + uint32 r, g, b; + + r = (InColor & 0x7c00) >> 10; + r = (r * 0xff) / 0x1f; + g = (InColor & 0x03e0) >> 5; + g = (g * 0xff) / 0x1f; + b = (InColor & 0x001f); + b = (b * 0xff) / 0x1f; + return (r << 16) | (g << 8) | b; +} + +//***************************************************************************** +uint32 Color16to32(uint32 InColor) +{ + uint32 r, g, b; + + r = (InColor & 0xf800) >> 11; + r = (r * 0xff) / 0x1f; + g = (InColor & 0x07e0) >> 5; + g = (g * 0xff) / 0x3f; + b = (InColor & 0x001f); + b = (b * 0xff) / 0x1f; + return (r << 16) | (g << 8) | b; +} + +//***************************************************************************** +uint32 Color24to32(uint32 InColor) +{ + return ((InColor & 0x00ff0000) >> 16) | + ((InColor & 0x000000ff) << 16) | + (InColor & 0x0000ff00); +} + +//***************************************************************************** +void SetColorx(QColor * Color, uint32 InColor) +{ + switch (g_server_depth) + { + case 8: + if (g_CM == NULL || InColor > 255) + { + Color->setRgb(0); + return; + } + Color->setRgb(g_CM->RGBColors[InColor]); + break; + case 15: + Color->setRgb(Color15to32(InColor)); + break; + case 16: + Color->setRgb(Color16to32(InColor)); + break; + case 24: + Color->setRgb(Color24to32(InColor)); + break; + default: + Color->setRgb(0); + } +} + +//***************************************************************************** +void SetOpCode(int opcode) +{ + if (opcode >= 0 && opcode < 16) + { + Qt::RasterOp op = g_OpCodes[opcode]; + if (op != Qt::CopyROP) + { + g_P1->setRasterOp(op); + g_P2->setRasterOp(op); + } + } +} + +//***************************************************************************** +void ResetOpCode(int opcode) +{ + if (opcode >= 0 && opcode < 16) + { + Qt::RasterOp op = g_OpCodes[opcode]; + if (op != Qt::CopyROP) + { + g_P1->setRasterOp(Qt::CopyROP); + g_P2->setRasterOp(Qt::CopyROP); + } + } +} + +/*****************************************************************************/ +QMyMainWindow::QMyMainWindow(): QWidget() +{ +} + +/*****************************************************************************/ +QMyMainWindow::~QMyMainWindow() +{ +} + +//***************************************************************************** +void QMyMainWindow::mouseMoveEvent(QMouseEvent * e) +{ + if (!g_UpAndRunning) + { + return; + } + rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_MOVE, e->x(), e->y()); +} + +//***************************************************************************** +void QMyMainWindow::mousePressEvent(QMouseEvent * e) +{ + if (!g_UpAndRunning) + { + return; + } + if (e->button() == LeftButton) + { + rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_DOWN | MOUSE_FLAG_BUTTON1, + e->x(), e->y()); + } + else if (e->button() == RightButton) + { + rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_DOWN | MOUSE_FLAG_BUTTON2, + e->x(), e->y()); + } + else if (e->button() == MidButton) + { + rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_DOWN | MOUSE_FLAG_BUTTON3, + e->x(), e->y()); + } +} + +//***************************************************************************** +void QMyMainWindow::mouseReleaseEvent(QMouseEvent * e) +{ + if (!g_UpAndRunning) + { + return; + } + if (e->button() == LeftButton) + { + rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_BUTTON1, e->x(), e->y()); + } + else if (e->button() == RightButton) + { + rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_BUTTON2, e->x(), e->y()); + } + else if (e->button() == MidButton) + { + rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_BUTTON3, e->x(), e->y()); + } +} + +//***************************************************************************** +void QMyMainWindow::wheelEvent(QWheelEvent * e) +{ + if (!g_UpAndRunning) + { + return; + } + if (e->delta() > 0) + { + rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_BUTTON4, e->x(), e->y()); + } + else if (e->delta() < 0) + { + rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_BUTTON5, e->x(), e->y()); + } +} + +//***************************************************************************** +int GetScanCode(QKeyEvent* e) +{ + int Key = e->key(); + int ScanCode = 0; + Qt::ButtonState bs = e->state(); + if (!(bs & Qt::ShiftButton)) // shift is not down + { + if (Key == 42) // * + return 0x37; + if (Key == 43) // + + return 0x4e; + } + switch (Key) + { + case 4100: ScanCode = 0x1c; break; // enter + case 4101: ScanCode = 0x1c; break; + case 4117: ScanCode = 0xd0; break; // down arrow + case 4115: ScanCode = 0xc8; break; // up arrow + case 4114: ScanCode = 0xcb; break; // left arrow + case 4116: ScanCode = 0xcd; break; // right arrow + case 4112: ScanCode = 0xc7; break; // home + case 4113: ScanCode = 0xcf; break; // end + case 4102: ScanCode = 0xd2; break; // insert + case 4103: ScanCode = 0xd3; break; // delete + case 4118: ScanCode = 0xc9; break; // page up + case 4119: ScanCode = 0xd1; break; // page down + case 4143: ScanCode = 0x00; break; // num lock + case 47: ScanCode = 0x35; break; // / + case 42: ScanCode = 0x37; break; // * + case 45: ScanCode = 0x0c; break; // - + case 95: ScanCode = 0x0c; break; // _ + case 43: ScanCode = 0x0d; break; // + + case 46: ScanCode = 0x34; break; // . + case 48: ScanCode = 0x0b; break; // 0 + case 41: ScanCode = 0x0b; break; // ) + case 49: ScanCode = 0x02; break; // 1 + case 33: ScanCode = 0x02; break; // ! + case 50: ScanCode = 0x03; break; // 2 + case 64: ScanCode = 0x03; break; // @ + case 51: ScanCode = 0x04; break; // 3 + case 35: ScanCode = 0x04; break; // # + case 52: ScanCode = 0x05; break; // 4 + case 36: ScanCode = 0x05; break; // $ + case 53: ScanCode = 0x06; break; // 5 + case 37: ScanCode = 0x06; break; // % + case 54: ScanCode = 0x07; break; // 6 + case 94: ScanCode = 0x07; break; // ^ + case 55: ScanCode = 0x08; break; // 7 + case 38: ScanCode = 0x08; break; // & + case 56: ScanCode = 0x09; break; // 8 + case 57: ScanCode = 0x0a; break; // 9 + case 40: ScanCode = 0x0a; break; // ( + case 61: ScanCode = 0x0d; break; // = + case 65: ScanCode = 0x1e; break; // a + case 66: ScanCode = 0x30; break; // b + case 67: ScanCode = 0x2e; break; // c + case 68: ScanCode = 0x20; break; // d + case 69: ScanCode = 0x12; break; // e + case 70: ScanCode = 0x21; break; // f + case 71: ScanCode = 0x22; break; // g + case 72: ScanCode = 0x23; break; // h + case 73: ScanCode = 0x17; break; // i + case 74: ScanCode = 0x24; break; // j + case 75: ScanCode = 0x25; break; // k + case 76: ScanCode = 0x26; break; // l + case 77: ScanCode = 0x32; break; // m + case 78: ScanCode = 0x31; break; // n + case 79: ScanCode = 0x18; break; // o + case 80: ScanCode = 0x19; break; // p + case 81: ScanCode = 0x10; break; // q + case 82: ScanCode = 0x13; break; // r + case 83: ScanCode = 0x1f; break; // s + case 84: ScanCode = 0x14; break; // t + case 85: ScanCode = 0x16; break; // u + case 86: ScanCode = 0x2f; break; // v + case 87: ScanCode = 0x11; break; // w + case 88: ScanCode = 0x2d; break; // x + case 89: ScanCode = 0x15; break; // y + case 90: ScanCode = 0x2c; break; // z + case 32: ScanCode = 0x39; break; // space + case 44: ScanCode = 0x33; break; // , + case 60: ScanCode = 0x33; break; // < + case 62: ScanCode = 0x34; break; // > + case 63: ScanCode = 0x35; break; // ? + case 92: ScanCode = 0x2b; break; // backslash + case 124: ScanCode = 0x2b; break; // bar + case 4097: ScanCode = 0x0f; break; // tab + case 4132: ScanCode = 0x3a; break; // caps lock + case 4096: ScanCode = 0x01; break; // esc + case 59: ScanCode = 0x27; break; // ; + case 58: ScanCode = 0x27; break; // : + case 39: ScanCode = 0x28; break; // ' + case 34: ScanCode = 0x28; break; // " + case 91: ScanCode = 0x1a; break; // [ + case 123: ScanCode = 0x1a; break; // { + case 93: ScanCode = 0x1b; break; // ] + case 125: ScanCode = 0x1b; break; // } + case 4144: ScanCode = 0x3b; break; // f1 + case 4145: ScanCode = 0x3c; break; // f2 + case 4146: ScanCode = 0x3d; break; // f3 + case 4147: ScanCode = 0x3e; break; // f4 + case 4148: ScanCode = 0x3f; break; // f5 + case 4149: ScanCode = 0x40; break; // f6 + case 4150: ScanCode = 0x41; break; // f7 + case 4151: ScanCode = 0x42; break; // f8 + case 4152: ScanCode = 0x43; break; // f9 + case 4153: ScanCode = 0x44; break; // f10 + case 4154: ScanCode = 0x57; break; // f11 + case 4155: ScanCode = 0x58; break; // f12 + case 4128: ScanCode = 0x2a; break; // shift + case 4131: ScanCode = 0x38; break; // alt + case 4129: ScanCode = 0x1d; break; // ctrl + case 96: ScanCode = 0x29; break; // ` + case 126: ScanCode = 0x29; break; // ~ + case 4099: ScanCode = 0x0e; break; // backspace + } +// if (ScanCode == 0) +// printf("key %d scancode %d\n", Key, ScanCode); + return ScanCode; +} + +//***************************************************************************** +void QMyMainWindow::keyPressEvent(QKeyEvent* e) +{ + if (!g_UpAndRunning) + return; + int ScanCode = GetScanCode(e); + if (ScanCode != 0) + { + rdp_send_input(0, RDP_INPUT_SCANCODE, RDP_KEYPRESS, ScanCode, 0); + e->accept(); + } +} + +//***************************************************************************** +void QMyMainWindow::keyReleaseEvent(QKeyEvent* e) +{ + if (!g_UpAndRunning) + { + return; + } + int ScanCode = GetScanCode(e); + if (ScanCode != 0) + { + rdp_send_input(0, RDP_INPUT_SCANCODE, RDP_KEYRELEASE, ScanCode, 0); + e->accept(); + } +} + +//***************************************************************************** +void QMyMainWindow::paintEvent(QPaintEvent * pe) +{ + QRect Rect; + + Rect = pe->rect(); + bitBlt(this, Rect.left(), Rect.top(), g_BS, Rect.left(), Rect.top(), + Rect.width(), Rect.height()); +} + +//***************************************************************************** +void QMyMainWindow::closeEvent(QCloseEvent * e) +{ + e->accept(); +} + +//***************************************************************************** +bool QMyMainWindow::event(QEvent * e) +{ + return QWidget::event(e); +} + +//***************************************************************************** +void QMyMainWindow::dataReceived() +{ + if (!rdp_loop(&g_deactivated, &g_ext_disc_reason)) + { + g_SV->close(); + } +#ifdef WITH_RDPSND + if (g_dsp_busy) + { + if (g_SoundNotifier == 0) + { + g_SoundNotifier = new QSocketNotifier(g_dsp_fd, QSocketNotifier::Write, + g_MW); + g_MW->connect(g_SoundNotifier, SIGNAL(activated(int)), g_MW, + SLOT(soundSend())); + } + else + { + if (!g_SoundNotifier->isEnabled()) + { + g_SoundNotifier->setEnabled(true); + } + } + } +#endif +} + +/******************************************************************************/ +void QMyMainWindow::soundSend() +{ +#ifdef WITH_RDPSND + g_SoundNotifier->setEnabled(false); + wave_out_play(); + if (g_dsp_busy) + { + g_SoundNotifier->setEnabled(true); + } +#endif +} + +//***************************************************************************** +void QMyScrollView::keyPressEvent(QKeyEvent * e) +{ + g_MW->keyPressEvent(e); +} + +//***************************************************************************** +void QMyScrollView::keyReleaseEvent(QKeyEvent * e) +{ + g_MW->keyReleaseEvent(e); +} + + +//***************************************************************************** +void ui_begin_update(void) +{ + g_P1->begin(g_MW); + g_P2->begin(g_BS); +} + +//***************************************************************************** +void ui_end_update(void) +{ + g_P1->end(); + g_P2->end(); +} + +/*****************************************************************************/ +int ui_init(void) +{ + g_App = new QApplication(g_argc, g_argv); + return 1; +} + +/*****************************************************************************/ +void ui_deinit(void) +{ + delete g_App; +} + +/*****************************************************************************/ +int ui_create_window(void) +{ + int w, h; + QPainter * painter; + QWidget * desktop; + + g_MW = new QMyMainWindow(); + g_SV = new QMyScrollView(); + g_SV->addChild(g_MW); + g_BS = new QPixmap(g_width, g_height); + painter = new QPainter(g_BS); + painter->fillRect(0, 0, g_width, g_height, QBrush(QColor("white"))); + painter->fillRect(0, 0, g_width, g_height, QBrush(QBrush::CrossPattern)); + delete painter; + g_DS = new QPixmap(480, 480); + g_P1 = new QPainter(); + g_P2 = new QPainter(); + g_ClipRect = new QRegion(0, 0, g_width, g_height); + desktop = QApplication::desktop(); + w = desktop->width(); // returns screen width + h = desktop->height(); // returns screen height + g_MW->resize(g_width, g_height); + if (w < g_width || h < g_height) + { + g_SV->resize(w, h); + } + else + { + g_SV->resize(g_width + 4, g_height + 4); + } + g_SV->setMaximumWidth(g_width + 4); + g_SV->setMaximumHeight(g_height + 4); + g_App->setMainWidget(g_SV); + g_SV->show(); + g_MW->setMouseTracking(true); + if (g_title[0] != 0) + { + g_SV->setCaption(g_title); + } + +/* XGrayKey(0, 64, AnyModifie, SV->winId(), 0, GrabModeAsync, GrabModeAsync); + XGrayKey(0, 113, AnyModifie, SV->winId(), 0, GrabModeAsync, GrabModeAsync); + XGrayKey(0, 37, AnyModifie, SV-winId(), 0, GrabModeAsync, GrabModeAsync); + XGrayKey(0, 109, AnyModifie, SV->winId(), 0, GrabModeAsync, GrabModeAsync); + XGrayKey(0, 115, AnyModifie, SV->winId(), 0, GrabModeAsync, GrabModeAsync); + XGrayKey(0, 116, AnyModifie, SV->winId(), 0, GrabModeAsync, GrabModeAsync); + XGrayKey(0, 117, AnyModifie, SV->winId(), 0, GrabModeAsync, GrabModeAsync); + XGrayKey(0, 62, AnyModifie, SV->winId(), 0, GrabModeAsync, GrabModeAsync); + XGrayKey(0, 50, AnyModifie, SV->winId(), 0, GrabModeAsync, GrabModeAsync);*/ + + return 1; +} + +//***************************************************************************** +void ui_main_loop(void) +{ +#ifdef WITH_RDPSND + // init sound + if (g_rdpsnd) + { + rdpsnd_init(0); + } +#endif + // connect + if (!rdp_connect(g_servername, g_flags, "", "", "", "")) + { + return; + } + // start notifier + g_SocketNotifier = new QSocketNotifier(g_sock, QSocketNotifier::Read, g_MW); + g_MW->connect(g_SocketNotifier, SIGNAL(activated(int)), + g_MW, SLOT(dataReceived())); + g_UpAndRunning = 1; + // app main loop + g_App->exec(); +} + +//***************************************************************************** +void ui_destroy_window(void) +{ + delete g_MW; + delete g_SV; + delete g_BS; + delete g_DS; + delete g_P1; + delete g_P2; + delete g_ClipRect; +} + +/*****************************************************************************/ +void ui_bell(void) +{ +} + +/*****************************************************************************/ +int ui_select(int in_val) +{ + if (g_sock == 0) + { + g_sock = in_val; + } + return 1; +} + +/*****************************************************************************/ +void ui_destroy_cursor(void * cursor) +{ + QCursor * Cursor; + Cursor = (QCursor*)cursor; + if (Cursor != NULL) + { + delete Cursor; + } +} + +/*****************************************************************************/ +void* ui_create_glyph(int width, int height, uint8 * data) +{ + QBitmap * Bitmap; + Bitmap = new QBitmap(width, height, data); + Bitmap->setMask(*Bitmap); + return (RD_HGLYPH)Bitmap; +} + +/*****************************************************************************/ +void ui_destroy_glyph(void * glyph) +{ + QBitmap* Bitmap; + Bitmap = (QBitmap*)glyph; + delete Bitmap; +} + +/*****************************************************************************/ +void ui_destroy_bitmap(void * bmp) +{ + QPixmap * Pixmap; + Pixmap = (QPixmap*)bmp; + delete Pixmap; +} + +/*****************************************************************************/ +void ui_reset_clip(void) +{ + g_P1->setClipRect(0, 0, g_width, g_height); + g_P2->setClipRect(0, 0, g_width, g_height); + delete g_ClipRect; + g_ClipRect = new QRegion(0, 0, g_width, g_height); +} + +/*****************************************************************************/ +void ui_set_clip(int x, int y, int cx, int cy) +{ + g_P1->setClipRect(x, y, cx, cy); + g_P2->setClipRect(x, y, cx, cy); + delete g_ClipRect; + g_ClipRect = new QRegion(x, y, cx, cy); +} + +/*****************************************************************************/ +void * ui_create_colourmap(COLOURMAP * colours) +{ + QColorMap* LCM; + int i, r, g, b; + LCM = (QColorMap*)malloc(sizeof(QColorMap)); + memset(LCM, 0, sizeof(QColorMap)); + i = 0; + while (i < colours->ncolours && i < 256) + { + r = colours->colours[i].red; + g = colours->colours[i].green; + b = colours->colours[i].blue; + LCM->RGBColors[i] = (r << 16) | (g << 8) | b; + i++; + } + LCM->NumColors = colours->ncolours; + return LCM; +} + +//***************************************************************************** +// todo, does this leak at end of program +void ui_destroy_colourmap(RD_HCOLOURMAP map) +{ + QColorMap * LCM; + LCM = (QColorMap*)map; + if (LCM == NULL) + return; + free(LCM); +} + +/*****************************************************************************/ +void ui_set_colourmap(void * map) +{ + // destoy old colormap + ui_destroy_colourmap(g_CM); + g_CM = (QColorMap*)map; +} + +/*****************************************************************************/ +RD_HBITMAP ui_create_bitmap(int width, int height, uint8 * data) +{ + QImage * Image = NULL; + QPixmap * Pixmap; + uint32 * d = NULL; + uint16 * s; + int i; + + switch (g_server_depth) + { + case 8: + Image = new QImage(data, width, height, 8, (QRgb*)&g_CM->RGBColors, + g_CM->NumColors, QImage::IgnoreEndian); + break; + case 15: + d = (uint32*)malloc(width * height * 4); + s = (uint16*)data; + for (i = 0; i < width * height; i++) + { + d[i] = Color15to32(s[i]); + } + Image = new QImage((uint8*)d, width, height, 32, NULL, + 0, QImage::IgnoreEndian); + break; + case 16: + d = (uint32*)malloc(width * height * 4); + s = (uint16*)data; + for (i = 0; i < width * height; i++) + { + d[i] = Color16to32(s[i]); + } + Image = new QImage((uint8*)d, width, height, 32, NULL, + 0, QImage::IgnoreEndian); + break; + case 24: + d = (uint32*)malloc(width * height * 4); + memset(d, 0, width * height * 4); + for (i = 0; i < width * height; i++) + { + memcpy(d + i, data + i * 3, 3); + } + Image = new QImage((uint8*)d, width, height, 32, NULL, + 0, QImage::IgnoreEndian); + break; + } + if (Image == NULL) + { + return NULL; + } + Pixmap = new QPixmap(); + Pixmap->convertFromImage(*Image); + delete Image; + if (d != NULL) + { + free(d); + } + return (RD_HBITMAP)Pixmap; +} + +//****************************************************************************** +// adjust coordinates for cliping rect +int WarpCoords(int * x, int * y, int * cx, int * cy, int * srcx, int * srcy) +{ + int dx, dy; + QRect InRect(*x, *y, *cx, *cy); + QRect OutRect; + QRect CRect = g_ClipRect->boundingRect(); + OutRect = InRect.intersect(CRect); + if (OutRect.isEmpty()) + { + return False; + } + dx = OutRect.x() - InRect.x(); + dy = OutRect.y() - InRect.y(); + *x = OutRect.x(); + *y = OutRect.y(); + *cx = OutRect.width(); + *cy = OutRect.height(); + *srcx = *srcx + dx; + *srcy = *srcy + dy; + return True; +} + +//****************************************************************************** +// needed because bitBlt don't seem to care about clipping rects +// also has 2 dsts and src can be null +void bitBltClip(QPaintDevice * dst1, QPaintDevice * dst2, int dx, int dy, + QPaintDevice * src, int sx, int sy, int sw, int sh, + Qt::RasterOp rop, bool im) +{ + if (WarpCoords(&dx, &dy, &sw, &sh, &sx, &sy)) + { + if (dst1 != NULL) + { + if (src == NULL) + { + bitBlt(dst1, dx, dy, dst1, sx, sy, sw, sh, rop, im); + } + else + { + bitBlt(dst1, dx, dy, src, sx, sy, sw, sh, rop, im); + } + } + if (dst2 != NULL) + { + if (src == NULL) + { + bitBlt(dst2, dx, dy, dst2, sx, sy, sw, sh, rop, im); + } + else + { + bitBlt(dst2, dx, dy, src, sx, sy, sw, sh, rop, im); + } + } + } +} + +#define DO_GLYPH(ttext,idx) \ +{ \ + glyph = cache_get_font (font, ttext[idx]); \ + if (!(flags & TEXT2_IMPLICIT_X)) \ + { \ + xyoffset = ttext[++idx]; \ + if ((xyoffset & 0x80)) \ + { \ + if (flags & TEXT2_VERTICAL) \ + y += ttext[idx+1] | (ttext[idx+2] << 8); \ + else \ + x += ttext[idx+1] | (ttext[idx+2] << 8); \ + idx += 2; \ + } \ + else \ + { \ + if (flags & TEXT2_VERTICAL) \ + y += xyoffset; \ + else \ + x += xyoffset; \ + } \ + } \ + if (glyph != NULL) \ + { \ + g_P2->drawPixmap(x + glyph->offset, y + glyph->baseline, \ + *((QBitmap*)glyph->pixmap)); \ + if (flags & TEXT2_IMPLICIT_X) \ + x += glyph->width; \ + } \ +} + +//***************************************************************************** +void ui_draw_text(uint8 font, uint8 flags, uint8 opcode, int mixmode, + int x, int y, int clipx, int clipy, + int clipcx, int clipcy, int boxx, + int boxy, int boxcx, int boxcy, BRUSH * brush, + int bgcolour, int fgcolour, uint8 * text, uint8 length) +{ + FONTGLYPH * glyph; + int i, j, xyoffset; + DATABLOB * entry; + + SetColorx(&g_Color1, fgcolour); + SetColorx(&g_Color2, bgcolour); + g_P2->setBackgroundColor(g_Color2); + g_P2->setPen(g_Color1); + if (boxcx > 1) + { + g_P2->fillRect(boxx, boxy, boxcx, boxcy, QBrush(g_Color2)); + } + else if (mixmode == MIX_OPAQUE) + { + g_P2->fillRect(clipx, clipy, clipcx, clipcy, QBrush(g_Color2)); + } + + /* Paint text, character by character */ + for (i = 0; i < length;) + { + switch (text[i]) + { + case 0xff: + if (i + 2 < length) + { + cache_put_text(text[i + 1], text, text[i + 2]); + } + else + { + error("this shouldn't be happening\n"); + exit(1); + } + /* this will move pointer from start to first character after FF + command */ + length -= i + 3; + text = &(text[i + 3]); + i = 0; + break; + + case 0xfe: + entry = cache_get_text(text[i + 1]); + if (entry != NULL) + { + if ((((uint8 *) (entry->data))[1] == 0) && + (!(flags & TEXT2_IMPLICIT_X))) + { + if (flags & TEXT2_VERTICAL) + { + y += text[i + 2]; + } + else + { + x += text[i + 2]; + } + } + for (j = 0; j < entry->size; j++) + { + DO_GLYPH(((uint8 *) (entry->data)), j); + } + } + if (i + 2 < length) + { + i += 3; + } + else + { + i += 2; + } + length -= i; + /* this will move pointer from start to first character after FE + command */ + text = &(text[i]); + i = 0; + break; + + default: + DO_GLYPH(text, i); + i++; + break; + } + } + if (boxcx > 1) + { + bitBltClip(g_MW, NULL, boxx, boxy, g_BS, boxx, boxy, boxcx, boxcy, + Qt::CopyROP, true); + } + else + { + bitBltClip(g_MW, NULL, clipx, clipy, g_BS, clipx, clipy, clipcx, + clipcy, Qt::CopyROP, true); + } +} + +/*****************************************************************************/ +void ui_line(uint8 opcode, int startx, int starty, int endx, int endy, + PEN * pen) +{ + SetColorx(&g_Color1, pen->colour); + SetOpCode(opcode); + g_P1->setPen(g_Color1); + g_P1->moveTo(startx, starty); + g_P1->lineTo(endx, endy); + g_P2->setPen(g_Color1); + g_P2->moveTo(startx, starty); + g_P2->lineTo(endx, endy); + ResetOpCode(opcode); +} + +/*****************************************************************************/ +// not used +void ui_triblt(uint8 opcode, int x, int y, int cx, int cy, + RD_HBITMAP src, int srcx, int srcy, + BRUSH* brush, int bgcolour, int fgcolour) +{ +} + +/*****************************************************************************/ +void ui_memblt(uint8 opcode, int x, int y, int cx, int cy, + RD_HBITMAP src, int srcx, int srcy) +{ + QPixmap* Pixmap; + Pixmap = (QPixmap*)src; + if (Pixmap != NULL) + { + SetOpCode(opcode); + g_P1->drawPixmap(x, y, *Pixmap, srcx, srcy, cx, cy); + g_P2->drawPixmap(x, y, *Pixmap, srcx, srcy, cx, cy); + ResetOpCode(opcode); + } +} + +//****************************************************************************** +void CommonDeskSave(QPixmap* Pixmap1, QPixmap* Pixmap2, int Offset, int x, + int y, int cx, int cy, int dir) +{ + int lx; + int ly; + int x1; + int y1; + int width; + int lcx; + int right; + int bottom; + lx = Offset % 480; + ly = Offset / 480; + y1 = y; + right = x + cx; + bottom = y + cy; + while (y1 < bottom) + { + x1 = x; + lcx = cx; + while (x1 < right) + { + width = 480 - lx; + if (width > lcx) + width = lcx; + if (dir == 0) + bitBlt(Pixmap1, lx, ly, Pixmap2, x1, y1, width, 1, Qt::CopyROP, true); + else + bitBlt(Pixmap2, x1, y1, Pixmap1, lx, ly, width, 1, Qt::CopyROP, true); + lx = lx + width; + if (lx >= 480) + { + lx = 0; + ly++; + if (ly >= 480) + ly = 0; + } + lcx = lcx - width; + x1 = x1 + width; + } + y1++; + } +} + +/*****************************************************************************/ +void ui_desktop_restore(uint32 offset, int x, int y, int cx, int cy) +{ + QPixmap * Pixmap; + + Pixmap = new QPixmap(cx, cy); + CommonDeskSave(g_DS, Pixmap, offset, 0, 0, cx, cy, 1); + bitBltClip(g_MW, g_BS, x, y, Pixmap, 0, 0, cx, cy, Qt::CopyROP, true); + delete Pixmap; +} + +/*****************************************************************************/ +void ui_desktop_save(uint32 offset, int x, int y, int cx, int cy) +{ + CommonDeskSave(g_DS, g_BS, offset, x, y, cx, cy, 0); +} + +/*****************************************************************************/ +void ui_rect(int x, int y, int cx, int cy, int colour) +{ + SetColorx(&g_Color1, colour); + g_P1->fillRect(x, y, cx, cy, QBrush(g_Color1)); + g_P2->fillRect(x, y, cx, cy, QBrush(g_Color1)); +} + +/*****************************************************************************/ +void ui_screenblt(uint8 opcode, int x, int y, int cx, int cy, + int srcx, int srcy) +{ + SetOpCode(opcode); + bitBltClip(g_MW, g_BS, x, y, NULL, srcx, srcy, cx, cy, Qt::CopyROP, true); + ResetOpCode(opcode); +} + +/*****************************************************************************/ +void ui_patblt(uint8 opcode, int x, int y, int cx, int cy, + BRUSH* brush, int bgcolour, int fgcolour) +{ + QBitmap* Bitmap; + QBrush* Brush; + uint8 ipattern[8], i; + SetOpCode(opcode); + switch (brush->style) + { + case 0: + SetColorx(&g_Color1, fgcolour); + g_P2->fillRect(x, y, cx, cy, QBrush(g_Color1)); + break; + case 3: + SetColorx(&g_Color1, fgcolour); + SetColorx(&g_Color2, bgcolour); + for (i = 0; i != 8; i++) + { + ipattern[7 - i] = ~brush->pattern[i]; + } + Bitmap = new QBitmap(8, 8, ipattern); + Brush = new QBrush(g_Color1, *Bitmap); + g_P2->setBackgroundMode(Qt::OpaqueMode); + g_P2->setBrushOrigin(brush->xorigin, brush->yorigin); + g_P2->setBackgroundColor(g_Color2); + g_P2->fillRect(x, y, cx, cy, *Brush); + delete Brush; + delete Bitmap; + g_P2->setBackgroundMode(Qt::TransparentMode); + g_P2->setBrushOrigin(0, 0); + break; + } + ResetOpCode(opcode); + bitBltClip(g_MW, NULL, x, y, g_BS, x, y, cx, cy, Qt::CopyROP, true); +} + +/*****************************************************************************/ +void ui_destblt(uint8 opcode, int x, int y, int cx, int cy) +{ + SetOpCode(opcode); + g_P1->fillRect(x, y, cx, cy, QBrush(QColor("black"))); + g_P2->fillRect(x, y, cx, cy, QBrush(QColor("black"))); + ResetOpCode(opcode); +} + +/*****************************************************************************/ +void ui_move_pointer(int x, int y) +{ +} + +/*****************************************************************************/ +void ui_set_null_cursor(void) +{ + g_MW->setCursor(10); // Qt::BlankCursor +} + +/*****************************************************************************/ +void ui_paint_bitmap(int x, int y, int cx, int cy, + int width, int height, uint8* data) +{ + QImage * Image = NULL; + QPixmap * Pixmap; + uint32 * d = NULL; + uint16 * s; + int i; + + switch (g_server_depth) + { + case 8: + Image = new QImage(data, width, height, 8, (QRgb*)&g_CM->RGBColors, + g_CM->NumColors, QImage::IgnoreEndian); + break; + case 15: + d = (uint32*)malloc(width * height * 4); + s = (uint16*)data; + for (i = 0; i < width * height; i++) + { + d[i] = Color15to32(s[i]); + } + Image = new QImage((uint8*)d, width, height, 32, NULL, + 0, QImage::IgnoreEndian); + break; + case 16: + d = (uint32*)malloc(width * height * 4); + s = (uint16*)data; + for (i = 0; i < width * height; i++) + { + d[i] = Color16to32(s[i]); + } + Image = new QImage((uint8*)d, width, height, 32, NULL, + 0, QImage::IgnoreEndian); + break; + case 24: + d = (uint32*)malloc(width * height * 4); + memset(d, 0, width * height * 4); + for (i = 0; i < width * height; i++) + { + memcpy(d + i, data + i * 3, 3); + } + Image = new QImage((uint8*)d, width, height, 32, NULL, + 0, QImage::IgnoreEndian); + break; + } + if (Image == NULL) + { + return; + } + Pixmap = new QPixmap(); + Pixmap->convertFromImage(*Image); + g_P1->drawPixmap(x, y, *Pixmap, 0, 0, cx, cy); + g_P2->drawPixmap(x, y, *Pixmap, 0, 0, cx, cy); + delete Image; + delete Pixmap; + if (d != NULL) + { + free(d); + } +} + +//****************************************************************************** +int Is24On(uint8* Data, int X, int Y) +{ + uint8 R, G, B; + int Start; + Start = Y * 32 * 3 + X * 3; + R = Data[Start]; + G = Data[Start + 1]; + B = Data[Start + 2]; + return !((R == 0) && (G == 0) && (B == 0)); +} + +//****************************************************************************** +int Is1On(uint8* Data, int X, int Y) +{ + int Start; + int Shift; + Start = (Y * 32) / 8 + X / 8; + Shift = X % 8; + return (Data[Start] & (0x80 >> Shift)) == 0; +} + +//****************************************************************************** +void Set1(uint8* Data, int X, int Y) +{ + int Start; + int Shift; + Start = (Y * 32) / 8 + X / 8; + Shift = X % 8; + Data[Start] = Data[Start] | (0x80 >> Shift); +} + +//****************************************************************************** +void FlipOver(uint8* Data) +{ + uint8 AData[128]; + int Index; + memcpy(AData, Data, 128); + for (Index = 0; Index <= 31; Index++) + { + Data[127 - (Index * 4 + 3)] = AData[Index * 4]; + Data[127 - (Index * 4 + 2)] = AData[Index * 4 + 1]; + Data[127 - (Index * 4 + 1)] = AData[Index * 4 + 2]; + Data[127 - Index * 4] = AData[Index * 4 + 3]; + } +} + +/*****************************************************************************/ +void ui_set_cursor(RD_HCURSOR cursor) +{ + QCursor* Cursor; + Cursor = (QCursor*)cursor; + if (Cursor != NULL) + g_MW->setCursor(*Cursor); +} + +/*****************************************************************************/ +RD_HCURSOR ui_create_cursor(unsigned int x, unsigned int y, + int width, int height, + uint8* andmask, uint8* xormask) +{ + uint8 AData[128]; + uint8 AMask[128]; + QBitmap* DataBitmap; + QBitmap* MaskBitmap; + QCursor* Cursor; + int I1, I2, BOn, MOn; + + if (width != 32 || height != 32) + { + return 0; + } + memset(AData, 0, 128); + memset(AMask, 0, 128); + for (I1 = 0; I1 <= 31; I1++) + { + for (I2 = 0; I2 <= 31; I2++) + { + MOn = Is24On(xormask, I1, I2); + BOn = Is1On(andmask, I1, I2); + if (BOn ^ MOn) // xor + { + Set1(AData, I1, I2); + if (!MOn) + { + Set1(AMask, I1, I2); + } + } + if (MOn) + { + Set1(AMask, I1, I2); + } + } + } + FlipOver(AData); + FlipOver(AMask); + DataBitmap = new QBitmap(32, 32, AData); + MaskBitmap = new QBitmap(32, 32, AMask); + Cursor = new QCursor(*DataBitmap, *MaskBitmap, x, y); + delete DataBitmap; + delete MaskBitmap; + return Cursor; +} + +/*****************************************************************************/ +uint16 ui_get_numlock_state(uint32 state) +{ + return 0; +} + +/*****************************************************************************/ +uint32 read_keyboard_state(void) +{ + return 0; +} + +/*****************************************************************************/ +void ui_resize_window(void) +{ +} + +/*****************************************************************************/ +void ui_polygon(uint8 opcode, uint8 fillmode, RD_POINT * point, int npoints, + BRUSH * brush, int bgcolour, int fgcolour) +{ +} + +/*****************************************************************************/ +/* todo, use qt function for this (QPainter::drawPolyline) */ +void ui_polyline(uint8 opcode, RD_POINT * points, int npoints, PEN * pen) +{ + int i, x, y, dx, dy; + + if (npoints > 0) + { + x = points[0].x; + y = points[0].y; + for (i = 1; i < npoints; i++) + { + dx = points[i].x; + dy = points[i].y; + ui_line(opcode, x, y, x + dx, y + dy, pen); + x = x + dx; + y = y + dy; + } + } +} + +/*****************************************************************************/ +void ui_ellipse(uint8 opcode, uint8 fillmode, + int x, int y, int cx, int cy, + BRUSH * brush, int bgcolour, int fgcolour) +{ +} + +/*****************************************************************************/ +void generate_random(uint8 * random) +{ + QFile File("/dev/random"); + File.open(IO_ReadOnly); + if (File.readBlock((char*)random, 32) == 32) + { + return; + } + warning("no /dev/random\n"); + memcpy(random, "12345678901234567890123456789012", 32); +} + +/*****************************************************************************/ +void save_licence(uint8 * data, int length) +{ + char * home, * path, * tmppath; + int fd; + + home = getenv("HOME"); + if (home == NULL) + { + return; + } + path = (char *) xmalloc(strlen(home) + strlen(g_hostname) + + sizeof("/.rdesktop/licence.")); + sprintf(path, "%s/.rdesktop", home); + if ((mkdir(path, 0700) == -1) && errno != EEXIST) + { + perror(path); + return; + } + /* write licence to licence.hostname.new, then atomically rename to + licence.hostname */ + sprintf(path, "%s/.rdesktop/licence.%s", home, g_hostname); + tmppath = (char *) xmalloc(strlen(path) + sizeof(".new")); + strcpy(tmppath, path); + strcat(tmppath, ".new"); + fd = open(tmppath, O_WRONLY | O_CREAT | O_TRUNC, 0600); + if (fd == -1) + { + perror(tmppath); + return; + } + if (write(fd, data, length) != length) + { + perror(tmppath); + unlink(tmppath); + } + else if (rename(tmppath, path) == -1) + { + perror(path); + unlink(tmppath); + } + close(fd); + xfree(tmppath); + xfree(path); +} + +/*****************************************************************************/ +int load_licence(uint8 ** data) +{ + char * home, * path; + struct stat st; + int fd, length; + + home = getenv("HOME"); + if (home == NULL) + { + return -1; + } + path = (char *) xmalloc(strlen(home) + strlen(g_hostname) + + sizeof("/.rdesktop/licence.")); + sprintf(path, "%s/.rdesktop/licence.%s", home, g_hostname); + fd = open(path, O_RDONLY); + if (fd == -1) + { + return -1; + } + if (fstat(fd, &st)) + { + return -1; + } + *data = (uint8 *) xmalloc(st.st_size); + length = read(fd, *data, st.st_size); + close(fd); + xfree(path); + return length; +} + +/*****************************************************************************/ +void* xrealloc(void * in_val, int size) +{ + return realloc(in_val, size); +} + +/*****************************************************************************/ +void* xmalloc(int size) +{ + return malloc(size); +} + +/*****************************************************************************/ +void xfree(void * in_val) +{ + if (in_val != NULL) + { + free(in_val); + } +} + +/*****************************************************************************/ +char * xstrdup(const char * s) +{ + char * mem = strdup(s); + if (mem == NULL) + { + perror("strdup"); + exit(1); + } + return mem; +} + +/*****************************************************************************/ +void warning(char * format, ...) +{ + va_list ap; + + fprintf(stderr, "WARNING: "); + va_start(ap, format); + vfprintf(stderr, format, ap); + va_end(ap); +} + +/*****************************************************************************/ +void unimpl(char * format, ...) +{ + va_list ap; + + fprintf(stderr, "NOT IMPLEMENTED: "); + va_start(ap, format); + vfprintf(stderr, format, ap); + va_end(ap); +} + +/*****************************************************************************/ +void error(char * format, ...) +{ + va_list ap; + + fprintf(stderr, "ERROR: "); + va_start(ap, format); + vfprintf(stderr, format, ap); + va_end(ap); +} + +/*****************************************************************************/ +void out_params(void) +{ + fprintf(stderr, "rdesktop: A Remote Desktop Protocol client.\n"); + fprintf(stderr, "Version " VERSION ". Copyright (C) 1999-2007 Matt Chapman.\n"); + fprintf(stderr, "QT uiport by Jay Sorg\n"); + fprintf(stderr, "See http://www.rdesktop.org/ for more information.\n\n"); + fprintf(stderr, "Usage: qtrdesktop [options] server\n"); + fprintf(stderr, " -g WxH: desktop geometry\n"); + fprintf(stderr, " -4: use RDP version 4\n"); + fprintf(stderr, " -5: use RDP version 5 (default)\n"); + fprintf(stderr, " -t 3389: tcp port)\n"); + fprintf(stderr, " -a 8|16|24: connection colour depth\n"); + fprintf(stderr, " -T title: window title\n"); + fprintf(stderr, " -P: use persistent bitmap caching\n"); + fprintf(stderr, " -0: attach to console\n"); + fprintf(stderr, " -z: enable rdp compression\n"); + fprintf(stderr, " -r sound: enable sound\n"); + fprintf(stderr, "\n"); +} + +/*****************************************************************************/ +/* produce a hex dump */ +void hexdump(uint8 * p, uint32 len) +{ + uint8 * line = p; + int i, thisline; + uint32 offset = 0; + + while (offset < len) + { + printf("%04x ", offset); + thisline = len - offset; + if (thisline > 16) + { + thisline = 16; + } + for (i = 0; i < thisline; i++) + { + printf("%02x ", line[i]); + } + for (; i < 16; i++) + { + printf(" "); + } + for (i = 0; i < thisline; i++) + { + printf("%c", (line[i] >= 0x20 && line[i] < 0x7f) ? line[i] : '.'); + } + printf("\n"); + offset += thisline; + line += thisline; + } +} + +/*****************************************************************************/ +int rd_pstcache_mkdir(void) +{ + char * home; + char bmpcache_dir[256]; + + home = getenv("HOME"); + if (home == NULL) + { + return False; + } + sprintf(bmpcache_dir, "%s/%s", home, ".rdesktop"); + if ((mkdir(bmpcache_dir, S_IRWXU) == -1) && errno != EEXIST) + { + perror(bmpcache_dir); + return False; + } + sprintf(bmpcache_dir, "%s/%s", home, ".rdesktop/cache"); + if ((mkdir(bmpcache_dir, S_IRWXU) == -1) && errno != EEXIST) + { + perror(bmpcache_dir); + return False; + } + return True; +} + +/*****************************************************************************/ +int rd_open_file(char * filename) +{ + char * home; + char fn[256]; + int fd; + + home = getenv("HOME"); + if (home == NULL) + { + return -1; + } + sprintf(fn, "%s/.rdesktop/%s", home, filename); + fd = open(fn, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR); + if (fd == -1) + { + perror(fn); + } + return fd; +} + +/*****************************************************************************/ +void rd_close_file(int fd) +{ + close(fd); +} + +/*****************************************************************************/ +int rd_read_file(int fd, void * ptr, int len) +{ + return read(fd, ptr, len); +} + +/*****************************************************************************/ +int rd_write_file(int fd, void * ptr, int len) +{ + return write(fd, ptr, len); +} + +/*****************************************************************************/ +int rd_lseek_file(int fd, int offset) +{ + return lseek(fd, offset, SEEK_SET); +} + +/*****************************************************************************/ +int rd_lock_file(int fd, int start, int len) +{ + struct flock lock; + + lock.l_type = F_WRLCK; + lock.l_whence = SEEK_SET; + lock.l_start = start; + lock.l_len = len; + if (fcntl(fd, F_SETLK, &lock) == -1) + { + return False; + } + return True; +} + +/*****************************************************************************/ +void get_username_and_hostname(void) +{ + char fullhostname[64]; + char * p; + struct passwd * pw; + + STRNCPY(g_username, "unknown", sizeof(g_username)); + STRNCPY(g_hostname, "unknown", sizeof(g_hostname)); + pw = getpwuid(getuid()); + if (pw != NULL && pw->pw_name != NULL) + { + STRNCPY(g_username, pw->pw_name, sizeof(g_username)); + } + if (gethostname(fullhostname, sizeof(fullhostname)) != -1) + { + p = strchr(fullhostname, '.'); + if (p != NULL) + { + *p = 0; + } + STRNCPY(g_hostname, fullhostname, sizeof(g_hostname)); + } +} + +/*****************************************************************************/ +int parse_parameters(int in_argc, char ** in_argv) +{ + int i; + char * p; + + if (in_argc <= 1) + { + out_params(); + return 0; + } + g_argc = in_argc; + g_argv = in_argv; + for (i = 1; i < in_argc; i++) + { + strcpy(g_servername, in_argv[i]); + if (strcmp(in_argv[i], "-g") == 0) + { + g_width = strtol(in_argv[i + 1], &p, 10); + if (g_width <= 0) + { + error("invalid geometry\n"); + return 0; + } + if (*p == 'x') + { + g_height = strtol(p + 1, NULL, 10); + } + if (g_height <= 0) + { + error("invalid geometry\n"); + return 0; + } + g_width = (g_width + 3) & ~3; + } + else if (strcmp(in_argv[i], "-T") == 0) + { + strcpy(g_title, in_argv[i + 1]); + } + else if (strcmp(in_argv[i], "-4") == 0) + { + g_use_rdp5 = 0; + } + else if (strcmp(in_argv[i], "-5") == 0) + { + g_use_rdp5 = 1; + } + else if (strcmp(in_argv[i], "-a") == 0) + { + g_server_depth = strtol(in_argv[i + 1], &p, 10); + if (g_server_depth != 8 && g_server_depth != 15 && + g_server_depth != 16 && g_server_depth != 24) + { + error("invalid bpp\n"); + return 0; + } + } + else if (strcmp(in_argv[i], "-t") == 0) + { + g_tcp_port_rdp = strtol(in_argv[i + 1], &p, 10); + } + else if (strcmp(in_argv[i], "-P") == 0) + { + g_bitmap_cache_persist_enable = 1; + } + else if (strcmp(in_argv[i], "-0") == 0) + { + g_console_session = 1; + } + else if (strcmp(in_argv[i], "-z") == 0) + { + g_flags |= (RDP_LOGON_COMPRESSION | RDP_LOGON_COMPRESSION2); + } + else if (strcmp(in_argv[i], "-r") == 0) + { + if (strcmp(in_argv[i + 1], "sound") == 0) + { +#ifdef WITH_RDPSND + g_rdpsnd = 1; +#endif + } + } + } + return 1; +} + +/*****************************************************************************/ +int main(int in_argc, char** in_argv) +{ + get_username_and_hostname(); + if (!parse_parameters(in_argc, in_argv)) + { + return 0; + } + if (!ui_init()) + { + return 1; + } + if (!ui_create_window()) + { + return 1; + } + ui_main_loop(); + ui_destroy_window(); + ui_deinit(); + return 0; +} --- rdesktop-1.5.0.orig/uiports/qtwin.h +++ rdesktop-1.5.0/uiports/qtwin.h @@ -0,0 +1,32 @@ + +#include <qwidget.h> +#include <qscrollview.h> + +class QMyScrollView: public QScrollView +{ + Q_OBJECT + public: + void keyPressEvent(QKeyEvent*); + void keyReleaseEvent(QKeyEvent*); +}; + +class QMyMainWindow: public QWidget +{ + Q_OBJECT + public: + QMyMainWindow(); + ~QMyMainWindow(); + void paintEvent(QPaintEvent*); + void mouseMoveEvent(QMouseEvent*); + void mousePressEvent(QMouseEvent*); + void mouseReleaseEvent(QMouseEvent*); + void wheelEvent(QWheelEvent*); + void keyPressEvent(QKeyEvent*); + void keyReleaseEvent(QKeyEvent*); + void closeEvent(QCloseEvent*); + bool event(QEvent*); + public slots: + void dataReceived(); + void soundSend(); +}; + --- rdesktop-1.5.0.orig/uiports/readme.txt +++ rdesktop-1.5.0/uiports/readme.txt @@ -0,0 +1,17 @@ +This directory contains information on uiports. +uiports are different graphics libraries using the same core +rdesktop files. + +This directory is provided to include information and examples +on how to do a new uiport. Not all ports of rdesktop can +be included. + +see xxxreadme.txt for info on a blank empty uiport + +see qtreadme.txt for info on the Qt/X11 uiport + +see qtereadme.txt for info on the Qt embeded uiport + +see svgareadme.txt for info on the svga uiport + +see nanoxreadme.txt for info on the nanox uiport --- rdesktop-1.5.0.orig/uiports/svgareadme.txt +++ rdesktop-1.5.0/uiports/svgareadme.txt @@ -0,0 +1,39 @@ +This is the svga ui port +send any fixes or improvments to me Jay Sorg(j@american-data.com) +svgalib should be installed +tested with versions 1.4.3, 1.9.x + +thanks to + Donald Gordon - original work + Peter Nikolow - misc fixes + +run make -f makefile_svga to compile it + +svgareadme.txt - notes, this file +makefile_svga - makefile +svgawin.c - ui lib + +svgalib has some support for acceleration but most drivers +do not support it. I hope they fix this. +The ones that do are Cirus Logic and ATI Mach 32 cards. +If running on really slow hardware(486), use one of these cards, +it improves performance alot. + +run ./svgardesktop with no parameters to see a list of +commnad line options + +You will need to modify the libvga.config file most likely. +Its in /etc/vga. +Here is what mine looks like. +BOF + mouse imps2 + mouse_fake_kbd_event 112 113 + mouse_accel_mult 1.5 + mouse_accel_type normal + HorizSync 31.5 56.0 + VertRefresh 50 90 + nosigint +EOF +The mouse_fake_kbd_event line makes the wheel mouse work. + +Jay --- rdesktop-1.5.0.orig/uiports/svgawin.c +++ rdesktop-1.5.0/uiports/svgawin.c @@ -0,0 +1,1948 @@ +/* -*- c-basic-offset: 8 -*- + rdesktop: A Remote Desktop Protocol client. + User interface services - SVGA lib + Copyright (C) Jay Sorg 2004-2007 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 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., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "../rdesktop.h" + +#include <vga.h> +#include <vgakeyboard.h> +#include <vgamouse.h> +#include <vgagl.h> + +#include <unistd.h> // gethostname +#include <pwd.h> // getpwuid +#include <stdarg.h> // va_list va_start va_end + +#include <sys/ioctl.h> +#include <linux/keyboard.h> +#include <linux/kd.h> +#include <fcntl.h> + +extern int g_tcp_port_rdp; +int g_use_rdp5 = 0; +char g_hostname[16] = ""; +char g_username[64] = ""; +int g_height = 600; +int g_width = 800; +int g_server_depth = 8; +int g_encryption = 1; +int g_desktop_save = 1; +int g_polygon_ellipse_orders = 0; +int g_bitmap_cache = 1; +int g_bitmap_cache_persist_enable = False; +int g_bitmap_cache_precache = True; +int g_bitmap_compression = 1; +int g_rdp5_performanceflags = 0; +int g_console_session = 0; +int g_keylayout = 0x409; /* Defaults to US keyboard layout */ +int g_keyboard_type = 0x4; /* Defaults to US keyboard layout */ +int g_keyboard_subtype = 0x0; /* Defaults to US keyboard layout */ +int g_keyboard_functionkeys = 0xc; /* Defaults to US keyboard layout */ +RD_BOOL g_numlock_sync = False; + +/* hack globals */ +int g_argc = 0; +char** g_argv = 0; +int UpAndRunning = 0; +int g_sock = 0; +int deactivated = 0; +uint32 ext_disc_reason = 0; +char g_servername[128] = ""; +static uint32* colmap = 0; +static uint8* desk_save = 0; +static int g_server_Bpp = 1; + +/* Keyboard LEDS */ +static int numlock; +static int capslock; +static int scrolllock; + +// this is non null if vgalib has non accel functions available +// reading from video memory is sooo slow +static uint8* sdata = 0; +static int g_save_mem = 0; // for video memory use eg sdata == 0 + +// video acceleration +static int use_accel = 1; +static int has_fill_box = 0; +static int has_screen_copy = 0; +static int has_put_image = 0; + +// clip +int clip_startx; +int clip_starty; +int clip_endx; +int clip_endy; + +// mouse +uint8 mouse_under[32 * 32 * 4]; // save area under mouse +int mousex = 0; +int mousey = 0; +int mouseb = 0; + +// mouse info +typedef struct +{ + uint8 andmask[32 * 32]; + uint8 xormask[32 * 32]; + int x; + int y; + int w; + int h; +} tcursor; + +// mouse global +static tcursor mcursor; + +static int g_draw_mouse = 1; + +/* Session Directory redirection */ +RD_BOOL g_redirect = False; +char g_redirect_server[64]; +char g_redirect_domain[16]; +char g_redirect_password[64]; +char g_redirect_username[64]; +char g_redirect_cookie[128]; +uint32 g_redirect_flags = 0; + +// bitmap +typedef struct +{ + int width; + int height; + uint8* data; + uint8 Bpp; +} bitmap; + +typedef struct +{ + int x; + int y; + int cx; + int cy; + void* prev; + void* next; +} myrect; + +myrect* head_rect = 0; + +//***************************************************************************** +// Keyboard stuff - PeterS +static void setled(int mask, int state) +{ + int fd; + long int leds; + + if (( fd=open("/dev/console", O_NOCTTY)) != -1 ) + { + if (ioctl (fd, KDGETLED, &leds) != -1) + { + leds &= 7; + if (state) + leds |= mask; + else + leds &= ~mask; + ioctl (fd, KDSETLED, leds); + } + close(fd); + } +} + + +//***************************************************************************** +// do a raster op +int rop(int rop, int src, int dst) +{ + switch (rop) + { + case 0x0: return 0; + case 0x1: return ~(src | dst); + case 0x2: return (~src) & dst; + case 0x3: return ~src; + case 0x4: return src & (~dst); + case 0x5: return ~(dst); + case 0x6: return src ^ dst; + case 0x7: return ~(src & dst); + case 0x8: return src & dst; + case 0x9: return ~(src) ^ dst; + case 0xa: return dst; + case 0xb: return (~src) | dst; + case 0xc: return src; + case 0xd: return src | (~dst); + case 0xe: return src | dst; + case 0xf: return ~0; + } + return dst; +} + +//***************************************************************************** +// get a screen pixel +int get_pixel(int x, int y) +{ + if (x >= 0 && x < g_width && y >= 0 && y < g_height) + { + if (sdata != 0) + { + if (g_server_Bpp == 1) + return sdata[y * g_width + x]; + else if (g_server_Bpp == 2) + return ((uint16*)sdata)[y * g_width + x]; + else + return 0; + } + else + return vga_getpixel(x, y); + } + else + return 0; +} + +//***************************************************************************** +// set a screen pixel +void set_pixel(int x, int y, int pixel, int op) +{ + if (x >= clip_startx && x < clip_endx && y >= clip_starty && y < clip_endy) + { + if (x >= 0 && x < g_width && y >= 0 && y < g_height) + { + if (op == 0x0) + pixel = 0; + else if (op == 0xf) + pixel = -1; + else if (op != 0xc) + pixel = rop(op, pixel, get_pixel(x, y)); + if (sdata != 0) + { + if (g_server_Bpp == 1) + sdata[y * g_width + x] = pixel; + else if (g_server_Bpp == 2) + ((uint16*)sdata)[y * g_width + x] = pixel; + } + else + { + vga_setcolor(pixel); + vga_drawpixel(x, y); + } + } + } +} + +//***************************************************************************** +// get a pixel from a bitmap +int get_pixel2(int x, int y, uint8* data, int width, int bpp) +{ + if (bpp == 8) + return data[y * width + x]; + else if (bpp == 16) + return ((uint16*)data)[y * width + x]; + else + return 0; +} + +//***************************************************************************** +// set a pixel in a bitmap +void set_pixel2(int x, int y, int pixel, uint8* data, int width, int bpp) +{ + if (bpp == 8) + data[y * width + x] = pixel; + else if (bpp == 16) + ((uint16*)data)[y * width + x] = pixel; +} + +//***************************************************************************** +// get a pointer into a bitmap +uint8* get_ptr(int x, int y, uint8* data, int width, int bpp) +{ + if (bpp == 8) + return data + (y * width + x); + else if (bpp == 16) + return data + (y * width + x) * 2; + else + return 0; +} + +//***************************************************************************** +// check if a certain pixel is set in a bitmap +RD_BOOL is_pixel_on(uint8* data, int x, int y, int width, int bpp) +{ + int start; + int shift; + + if (bpp == 1) + { + width = (width + 7) / 8; + start = (y * width) + x / 8; + shift = x % 8; + return (data[start] & (0x80 >> shift)) != 0; + } + else if (bpp == 8) + { + return data[y * width + x] != 0; + } + else if (bpp == 24) + { + return data[(y * 3) * width + (x * 3)] != 0 && + data[(y * 3) * width + (x * 3) + 1] != 0 && + data[(y * 3) * width + (x * 3) + 2] != 0; + } + else + return False; +} + +//***************************************************************************** +void set_pixel_on(uint8* data, int x, int y, int width, int bpp, int pixel) +{ + if (bpp == 8) + { + data[y * width + x] = pixel; + } +} + +/*****************************************************************************/ +int warp_coords(int* x, int* y, int* cx, int* cy, int* srcx, int* srcy) +{ + int dx; + int dy; +// int lx = *x, ly = *y, lcx = *cx, lcy = *cy; + + if (clip_startx > *x) + dx = clip_startx - *x; + else + dx = 0; + if (clip_starty > *y) + dy = clip_starty - *y; + else + dy = 0; + if (*x + *cx > clip_endx) + *cx = (*cx - ((*x + *cx) - clip_endx)) /*+ 1*/; + if (*y + *cy > clip_endy) + *cy = (*cy - ((*y + *cy) - clip_endy)) /*+ 1*/; + *cx = *cx - dx; + *cy = *cy - dy; + if (*cx <= 0) + return False; + if (*cy <= 0) + return False; + *x = *x + dx; + *y = *y + dy; + if (srcx != NULL) + *srcx = *srcx + dx; + if (srcy != NULL) + *srcy = *srcy + dy; + +// if (*x != lx || *y != ly || *cx != lcx || *cy != lcy) +// printf("%d %d %d %d to %d %d %d %d\n", lx, ly, lcx, lcy, *x, *y, *cx, *cy); + + return True; +} + +//***************************************************************************** +void copy_mem(uint8* d, uint8* s, int n) +{ + while (n & (~7)) + { + *(d++) = *(s++); + *(d++) = *(s++); + *(d++) = *(s++); + *(d++) = *(s++); + *(d++) = *(s++); + *(d++) = *(s++); + *(d++) = *(s++); + *(d++) = *(s++); + n = n - 8; + } + while (n > 0) + { + *(d++) = *(s++); + n--; + } +} + +//***************************************************************************** +void copy_memb(uint8* d, uint8* s, int n) +{ + d = (d + n) - 1; + s = (s + n) - 1; + while (n & (~7)) + { + *(d--) = *(s--); + *(d--) = *(s--); + *(d--) = *(s--); + *(d--) = *(s--); + *(d--) = *(s--); + *(d--) = *(s--); + *(d--) = *(s--); + *(d--) = *(s--); + n = n - 8; + } + while (n > 0) + { + *(d--) = *(s--); + n--; + } +} + +//***************************************************************************** +// all in pixel except line_size is in bytes +void accel_draw_box(int x, int y, int cx, int cy, uint8* data, int line_size) +{ + int i; + uint8* s; + uint8* d; + + if (sdata != 0) + { + s = data; + d = get_ptr(x, y, sdata, g_width, g_server_depth); + for (i = 0; i < cy; i++) + { + copy_mem(d, s, cx * g_server_Bpp); + s = s + line_size; + d = d + g_width * g_server_Bpp; + } + } + else if (has_put_image && line_size == cx * g_server_Bpp) + { + vga_accel(ACCEL_PUTIMAGE, x, y, cx, cy, data); + } + else + { + s = data; + for (i = 0; i < cy; i++) + { + vga_drawscansegment(s, x, y + i, cx * g_server_Bpp); + s = s + line_size; + } + } +} + +//***************************************************************************** +void accel_fill_rect(int x, int y, int cx, int cy, int color) +{ + int i; + uint8* temp; + uint8* d; + + if (sdata != 0) + { + temp = xmalloc(cx * g_server_Bpp); + if (g_server_Bpp == 1) + for (i = 0; i < cx; i++) + temp[i] = color; + else if (g_server_Bpp == 2) + for (i = 0; i < cx; i++) + ((uint16*)temp)[i] = color; + d = get_ptr(x, y, sdata, g_width, g_server_depth); + for (i = 0; i < cy; i++) + { + copy_mem(d, temp, cx * g_server_Bpp); + d = d + g_width * g_server_Bpp; + } + xfree(temp); + } + else if (has_fill_box) + { + vga_accel(ACCEL_SETFGCOLOR, color); + vga_accel(ACCEL_FILLBOX, x, y, cx, cy); + } + else + { + temp = xmalloc(cx * g_server_Bpp); + if (g_server_Bpp == 1) + for (i = 0; i < cx; i++) + temp[i] = color; + else if (g_server_Bpp == 2) + for (i = 0; i < cx; i++) + ((uint16*)temp)[i] = color; + for (i = 0; i < cy; i++) + vga_drawscansegment(temp, x, y + i, cx * g_server_Bpp); + xfree(temp); + } +} + +//***************************************************************************** +void accel_screen_copy(int x, int y, int cx, int cy, int srcx, int srcy) +{ + uint8* temp; + uint8* s; + uint8* d; + int i; + + if (sdata != 0) + { + if (srcy < y) + { // bottom to top + s = get_ptr(srcx, (srcy + cy) - 1, sdata, g_width, g_server_depth); + d = get_ptr(x, (y + cy) - 1, sdata, g_width, g_server_depth); + for (i = 0; i < cy; i++) // copy down + { + copy_mem(d, s, cx * g_server_Bpp); + s = s - g_width * g_server_Bpp; + d = d - g_width * g_server_Bpp; + } + } + else if (srcy > y || srcx > x) // copy up or left + { // top to bottom + s = get_ptr(srcx, srcy, sdata, g_width, g_server_depth); + d = get_ptr(x, y, sdata, g_width, g_server_depth); + for (i = 0; i < cy; i++) + { + copy_mem(d, s, cx * g_server_Bpp); + s = s + g_width * g_server_Bpp; + d = d + g_width * g_server_Bpp; + } + } + else // copy straight right + { + s = get_ptr(srcx, srcy, sdata, g_width, g_server_depth); + d = get_ptr(x, y, sdata, g_width, g_server_depth); + for (i = 0; i < cy; i++) + { + copy_memb(d, s, cx * g_server_Bpp); + s = s + g_width * g_server_Bpp; + d = d + g_width * g_server_Bpp; + } + } + } + else if (has_screen_copy) + { + vga_accel(ACCEL_SCREENCOPY, srcx, srcy, x, y, cx, cy); + } + else + { + // slow + temp = (uint8*)xmalloc(cx * cy * g_server_Bpp); + for (i = 0; i < cy; i++) + vga_getscansegment(get_ptr(0, i, temp, cx, g_server_depth), srcx, srcy + i, cx * g_server_Bpp); + for (i = 0; i < cy; i++) + vga_drawscansegment(get_ptr(0, i, temp, cx, g_server_depth), x, y + i, cx * g_server_Bpp); + xfree(temp); + } +} + +//***************************************************************************** +// return bool +int contains_mouse(int x, int y, int cx, int cy) +{ + if (mousex + 32 >= x && + mousey + 32 >= y && + mousex <= x + cx && + mousey <= y + cy) + return 1; + else + return 0; +} + +//***************************************************************************** +void fill_rect(int x, int y, int cx, int cy, int colour, int opcode) +{ + int i; + int j; + + if (warp_coords(&x, &y, &cx, &cy, NULL, NULL)) + { + if (opcode == 0xc) + accel_fill_rect(x, y, cx, cy, colour); + else if (opcode == 0xf) + accel_fill_rect(x, y, cx, cy, -1); + else if (opcode == 0x0) + accel_fill_rect(x, y, cx, cy, 0); + else + { + for (i = 0; i < cy; i++) + for (j = 0; j < cx; j++) + set_pixel(x + j, y + i, colour, opcode); + } + } +} + +//***************************************************************************** +void get_rect(int x, int y, int cx, int cy, uint8* p) +{ + int i; + + if (x < 0) + { + cx = cx + x; + x = 0; + } + if (y < 0) + { + cy = cy + y; + y = 0; + } + if (sdata != 0) + { + for (i = 0; i < cy; i++) + { + copy_mem(p, get_ptr(x, y + i, sdata, g_width, g_server_depth), cx * g_server_Bpp); + p = p + cx * g_server_Bpp; + } + } + else + { + for (i = 0; i < cy; i++) + { + vga_getscansegment(p, x, y + i, cx * g_server_Bpp); + p = p + cx * g_server_Bpp; + } + } +} + +/*****************************************************************************/ +// return true if r1 is contained by r2 +int is_contained_by(myrect* r1, myrect* r2) +{ + if (r1->x >= r2->x && + r1->y >= r2->y && + r1->x + r1->cx <= r2->x + r2->cx && + r1->y + r1->cy <= r2->y + r2->cy) + return 1; + else + return 0; +} + +/*****************************************************************************/ +void draw_cursor_under(int ox, int oy) +{ + int i; + int j; + int k; + uint8* ptr; + int len; + + if (ox < 0) + k = -ox; + else + k = 0; + j = g_width - ox; + if (j > 32) + j = 32; + if (j > 0) + { + for (i = 0; i < 32; i++) + { + ptr = get_ptr(k, i, mouse_under, 32, g_server_depth); + len = (j - k) * g_server_Bpp; + if (ox + k >= 0 && oy + i >= 0 && ox + k < g_width && oy + i < g_height) + vga_drawscansegment(ptr, ox + k, oy + i, len); + } + } + g_draw_mouse = 1; +} + +/*****************************************************************************/ +void draw_cursor(void) +{ + int i; + int j; + int k; + int pixel; + uint8 mouse_a[32 * 32 * 4]; + uint8* ptr; + int len; + + if (!g_draw_mouse) + return; + memset(mouse_under, 0, sizeof(mouse_under)); + for (i = 0; i < 32; i++) + { + for (j = 0; j < 32; j++) + { + pixel = get_pixel(mousex + j, mousey + i); + set_pixel2(j, i, pixel, mouse_under, 32, g_server_depth); + if (mcursor.andmask[i * 32 + j] == 0) + k = 0; + else + k = ~0; + pixel = rop(0x8, k, pixel); + if (mcursor.xormask[i * 32 + j] == 0) + k = 0; + else + k = ~0; + pixel = rop(0x6, k, pixel); + set_pixel2(j, i, pixel, mouse_a, 32, g_server_depth); + } + } + if (mousex < 0) + k = -mousex; + else + k = 0; + j = g_width - mousex; + if (j > 32) + j = 32; + if (j > 0) + { + for (i = mousey; i < mousey + 32; i++) + if (i < g_height && i >= 0) + { + ptr = get_ptr(k, i - mousey, mouse_a, 32, g_server_depth); + len = (j - k) * g_server_Bpp; + vga_drawscansegment(ptr, mousex + k, i, len); + } + } + g_draw_mouse = 0; +} + +/*****************************************************************************/ +// add a rect to cache +void cache_rect(int x, int y, int cx, int cy, int do_warp) +{ + myrect* rect; + myrect* walk_rect; + + if (sdata == 0) + { + draw_cursor(); + return; + } + if (do_warp) + if (!warp_coords(&x, &y, &cx, &cy, NULL, NULL)) + return; + rect = (myrect*)xmalloc(sizeof(myrect)); + rect->x = x; + rect->y = y; + rect->cx = cx; + rect->cy = cy; + rect->next = 0; + rect->prev = 0; + if (head_rect == 0) + head_rect = rect; + else + { + walk_rect = 0; + do + { + if (walk_rect == 0) + walk_rect = head_rect; + else + walk_rect = walk_rect->next; + if (is_contained_by(rect, walk_rect)) + { + xfree(rect); + return; + } + } + while (walk_rect->next != 0); + walk_rect->next = rect; + rect->prev = walk_rect; + } +} + +//***************************************************************************** +void draw_cache_rects(void) +{ + int i; + myrect* rect; + myrect* rect1; + uint8* p; + + // draw all the rects + rect = head_rect; + while (rect != 0) + { + p = get_ptr(rect->x, rect->y, sdata, g_width, g_server_depth); + for (i = 0; i < rect->cy; i++) + { + vga_drawscansegment(p, rect->x, rect->y + i, rect->cx * g_server_Bpp); + p = p + g_width * g_server_Bpp; + } + rect1 = rect; + rect = rect->next; + xfree(rect1); + } + head_rect = 0; +} + +/*****************************************************************************/ +void key_event(int scancode, int pressed) +{ + int rdpkey; + int ext; + + if (!UpAndRunning) + return; + rdpkey = scancode; + ext = 0; + + // Keyboard LEDS + if ((scancode == SCANCODE_CAPSLOCK) && pressed) + { + capslock = !capslock; + setled(LED_CAP, capslock); + } + if ((scancode == SCANCODE_SCROLLLOCK) && pressed) + { + scrolllock = !scrolllock; + setled(LED_SCR, scrolllock); + } + + if ((scancode == SCANCODE_NUMLOCK) && pressed) + { + numlock = !numlock; + setled(LED_NUM, numlock); + } + + switch (scancode) + { + case SCANCODE_CURSORBLOCKUP: rdpkey = 0xc8; ext = KBD_FLAG_EXT; break; // up arrow + case SCANCODE_CURSORBLOCKDOWN: rdpkey = 0xd0; ext = KBD_FLAG_EXT; break; // down arrow + case SCANCODE_CURSORBLOCKRIGHT: rdpkey = 0xcd; ext = KBD_FLAG_EXT; break; // right arrow + case SCANCODE_CURSORBLOCKLEFT: rdpkey = 0xcb; ext = KBD_FLAG_EXT; break; // left arrow + case SCANCODE_PAGEDOWN: rdpkey = 0xd1; ext = KBD_FLAG_EXT; break; // page down + case SCANCODE_PAGEUP: rdpkey = 0xc9; ext = KBD_FLAG_EXT; break; // page up + case SCANCODE_HOME: rdpkey = 0xc7; ext = KBD_FLAG_EXT; break; // home + case SCANCODE_END: rdpkey = 0xcf; ext = KBD_FLAG_EXT; break; // end + case SCANCODE_INSERT: rdpkey = 0xd2; ext = KBD_FLAG_EXT; break; // insert + case SCANCODE_REMOVE: rdpkey = 0xd3; ext = KBD_FLAG_EXT; break; // delete + case SCANCODE_KEYPADDIVIDE: rdpkey = 0x35; break; // / + case SCANCODE_KEYPADENTER: rdpkey = 0x1c; break; // enter + case SCANCODE_RIGHTCONTROL: rdpkey = 0x1d; break; // right ctrl + case SCANCODE_RIGHTALT: rdpkey = 0x38; break; // right alt + case SCANCODE_LEFTWIN: rdpkey = 0x5b; ext = KBD_FLAG_EXT; break; // left win + case SCANCODE_RIGHTWIN: rdpkey = 0x5c; ext = KBD_FLAG_EXT; break; // right win + case 127: rdpkey = 0x5d; ext = KBD_FLAG_EXT; break; // menu key + case SCANCODE_PRINTSCREEN: rdpkey = 0x37; ext = KBD_FLAG_EXT; break; // print screen + case SCANCODE_BREAK: //rdpkey = 0; break; // break + { + if (pressed) + { + ext = KBD_FLAG_EXT; + rdp_send_input(0, RDP_INPUT_SCANCODE, RDP_KEYPRESS | ext, 0x46, 0); + rdp_send_input(0, RDP_INPUT_SCANCODE, RDP_KEYPRESS | ext, 0xc6, 0); + } + rdpkey = 0; + } + case SCANCODE_SCROLLLOCK: rdpkey = 0x46; break; // scroll lock + case 112: // mouse down + { + rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_DOWN | MOUSE_FLAG_BUTTON4, + mouse_getx(), mouse_gety()); + return; + } + case 113: // mouse up + { + rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_DOWN | MOUSE_FLAG_BUTTON5, + mouse_getx(), mouse_gety()); + return; + } + } +// printf("%d %d\n", scancode, pressed); + if (pressed) + rdp_send_input(0, RDP_INPUT_SCANCODE, RDP_KEYPRESS | ext, rdpkey, 0); + else + rdp_send_input(0, RDP_INPUT_SCANCODE, RDP_KEYRELEASE | ext, rdpkey, 0); + + +} + +/*****************************************************************************/ +int ui_init(void) +{ + vga_init(); + memset(&mcursor, 0, sizeof(tcursor)); + desk_save = (uint8*)xmalloc(0x38400 * g_server_Bpp); + return 1; +} + +/*****************************************************************************/ +void ui_deinit(void) +{ + xfree(desk_save); +} + +/*****************************************************************************/ +int ui_create_window(void) +{ + int vgamode; + int i; + + vgamode = G800x600x256; + if (g_width == 640 && g_height == 480) + { + if (g_server_Bpp == 1) + vgamode = G640x480x256; + else if (g_server_Bpp == 2) + vgamode = G640x480x64K; + } + else if (g_width == 800 && g_height == 600) + { + if (g_server_Bpp == 1) + vgamode = G800x600x256; + else if (g_server_Bpp == 2) + vgamode = G800x600x64K; + } + else if (g_width == 1024 && g_height == 768) + { + if (g_server_Bpp == 1) + vgamode = G1024x768x256; + else if (g_server_Bpp == 2) + vgamode = G1024x768x64K; + } + else + { + error("Invalid width / height"); + return 0; + } + ui_reset_clip(); + if (!vga_hasmode(vgamode)) + { + error("Graphics unavailable"); + return 0; + } + vga_setmousesupport(1); + mouse_setposition(g_width / 2, g_height / 2); + vga_setmode(vgamode); + if (keyboard_init()) + { + error("Keyboard unavailable"); + return 0; + } + keyboard_seteventhandler(key_event); + if (use_accel) + { + i = vga_ext_set(VGA_EXT_AVAILABLE, VGA_AVAIL_ACCEL); + if (i & ACCELFLAG_PUTIMAGE) + has_put_image = 1; + if (i & ACCELFLAG_SCREENCOPY) + has_screen_copy = 1; + if (i & ACCELFLAG_FILLBOX) + has_fill_box = 1; + printf("accel %d\n", i); + } + if (!has_screen_copy && !g_save_mem) + sdata = xmalloc(g_width * g_height * g_server_Bpp); + return 1; +} + +/*****************************************************************************/ +void ui_destroy_window(void) +{ + keyboard_close(); /* Don't forget this! */ + vga_setmode(TEXT); + if (sdata != 0) + xfree(sdata); +} + +/*****************************************************************************/ +void process_mouse(void) +{ + int ox = mousex; + int oy = mousey; + int ob = mouseb; + + if (!UpAndRunning) + return; + mousex = mouse_getx() - mcursor.x; + mousey = mouse_gety() - mcursor.y; + mouseb = mouse_getbutton(); + + if (mouseb != ob) // button + { + // right button + if (mouseb & 1) + if (!(ob & 1)) + rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_DOWN | MOUSE_FLAG_BUTTON2, + mousex + mcursor.x, mousey + mcursor.y); + if (ob & 1) + if (!(mouseb & 1)) + rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_BUTTON2, + mousex + mcursor.x, mousey + mcursor.y); + // middle button + if (mouseb & 2) + if (!(ob & 2)) + rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_DOWN | MOUSE_FLAG_BUTTON3, + mousex + mcursor.x, mousey + mcursor.y); + if (ob & 2) + if (!(mouseb & 2)) + rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_BUTTON3, + mousex + mcursor.x, mousey + mcursor.y); + // left button + if (mouseb & 4) + if (!(ob & 4)) + rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_DOWN | MOUSE_FLAG_BUTTON1, + mousex + mcursor.x, mousey + mcursor.y); + if (ob & 4) + if (!(mouseb & 4)) + rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_BUTTON1, + mousex + mcursor.x, mousey + mcursor.y); + } + if (mousex != ox || mousey != oy) // movement + { + rdp_send_input(0, RDP_INPUT_MOUSE, MOUSE_FLAG_MOVE, + mousex + mcursor.x, mousey + mcursor.y); + draw_cursor_under(ox, oy); + draw_cursor(); + } +} + +/*****************************************************************************/ +void process_keyboard(void) +{ + if (!UpAndRunning) + return; +} + +/*****************************************************************************/ +RD_BOOL ui_main_loop(void) +{ + int sel; + fd_set rfds; + + if (!rdp_connect(g_servername, RDP_LOGON_NORMAL, "", "", "", "")) + return False; + UpAndRunning = 1; + FD_ZERO(&rfds); + FD_SET(g_sock, &rfds); + sel = vga_waitevent(3, &rfds, NULL, NULL, NULL); + while (sel >= 0) + { + if (sel & 1) /* mouse */ + { + process_mouse(); + } + else if (sel & 2) /* keyboard */ + { + process_keyboard(); + } + else + { + if (!rdp_loop(&deactivated, &ext_disc_reason)) + return True; /* ok */ + } + FD_ZERO(&rfds); + FD_SET(g_sock, &rfds); + sel = vga_waitevent(3, &rfds, NULL, NULL, NULL); + } + return True; +} + +/*****************************************************************************/ +void ui_bell(void) +{ +} + +/*****************************************************************************/ +int ui_select(int in) +{ + g_sock = in; + return 1; +} + +/*****************************************************************************/ +void* ui_create_glyph(int width, int height, uint8* data) +{ + int i, j; + uint8* glyph_data; + bitmap* the_glyph; + + glyph_data = (uint8*)xmalloc(width * height); + the_glyph = (bitmap*)xmalloc(sizeof(bitmap)); + the_glyph->width = width; + the_glyph->height = height; + the_glyph->data = glyph_data; + memset(glyph_data, 0, width * height); + for (i = 0; i < height; i++) + for (j = 0; j < width; j++) + if (is_pixel_on(data, j, i, width, 1)) + set_pixel_on(glyph_data, j, i, width, 8, 255); + return the_glyph; +} + +/*****************************************************************************/ +void ui_destroy_glyph(void* glyph) +{ + bitmap* the_glyph; + + the_glyph = (bitmap*)glyph; + if (the_glyph != NULL) + { + if (the_glyph->data != NULL) + xfree(the_glyph->data); + xfree(the_glyph); + } +} + +/*****************************************************************************/ +void ui_destroy_bitmap(void* bmp) +{ + bitmap* b; + + b = (bitmap*)bmp; + xfree(b->data); + xfree(b); +} + +/*****************************************************************************/ +void ui_reset_clip(void) +{ + clip_startx = 0; + clip_starty = 0; + clip_endx = g_width; + clip_endy = g_height; +} + +/*****************************************************************************/ +void ui_set_clip(int x, int y, int cx, int cy) +{ + clip_startx = x; + clip_starty = y; + clip_endx = x + cx; + clip_endy = y + cy; +} + +/*****************************************************************************/ +void* ui_create_colourmap(COLOURMAP * colours) +{ + int i = 0; + int n = colours->ncolours; + COLOURENTRY* c = colours->colours; + int* cmap = (int*)xmalloc(3 * 256 * sizeof (int)); + if (n > 256) + n = 256; + bzero(cmap, 256 * 3 * sizeof (int)); + for (i = 0; i < (3 * n); c++) + { + cmap[i++] = (c->red) >> 2; + cmap[i++] = (c->green) >> 2; + cmap[i++] = (c->blue) >> 2; + } + return cmap; +} + +/*****************************************************************************/ +void ui_destroy_colourmap(RD_HCOLOURMAP map) +{ + if (colmap == map) + colmap = 0; + xfree(map); +} + +/*****************************************************************************/ +void ui_set_colourmap(void* map) +{ + if (colmap != 0) + xfree(colmap); + vga_setpalvec(0, 256, (int*)map); + colmap = map; +} + +/*****************************************************************************/ +RD_HBITMAP ui_create_bitmap(int width, int height, uint8* data) +{ + bitmap* b; + + b = (bitmap*)xmalloc(sizeof(bitmap)); + b->data = (uint8*)xmalloc(width * height * g_server_Bpp); + b->width = width; + b->height = height; + b->Bpp = g_server_Bpp; + copy_mem(b->data, data, width * height * g_server_Bpp); + return (void*)b; +} + +//***************************************************************************** +void draw_glyph (int x, int y, RD_HGLYPH glyph, int fgcolour) +{ + bitmap* the_glyph; + int i, j; + + the_glyph = (bitmap*)glyph; + if (the_glyph == NULL) + return; + for (i = 0; i < the_glyph->height; i++) + for (j = 0; j < the_glyph->width; j++) + if (is_pixel_on(the_glyph->data, j, i, the_glyph->width, 8)) + set_pixel(x + j, y + i, fgcolour, 0xc); +} + +#define DO_GLYPH(ttext,idx) \ +{\ + glyph = cache_get_font (font, ttext[idx]);\ + if (!(flags & TEXT2_IMPLICIT_X))\ + {\ + xyoffset = ttext[++idx];\ + if ((xyoffset & 0x80))\ + {\ + if (flags & TEXT2_VERTICAL) \ + y += ttext[idx+1] | (ttext[idx+2] << 8);\ + else\ + x += ttext[idx+1] | (ttext[idx+2] << 8);\ + idx += 2;\ + }\ + else\ + {\ + if (flags & TEXT2_VERTICAL) \ + y += xyoffset;\ + else\ + x += xyoffset;\ + }\ + }\ + if (glyph != NULL)\ + {\ + draw_glyph (x + glyph->offset, y + glyph->baseline, glyph->pixmap, fgcolour);\ + if (flags & TEXT2_IMPLICIT_X)\ + x += glyph->width;\ + }\ +} + +/*****************************************************************************/ +void ui_draw_text(uint8 font, uint8 flags, uint8 opcode, int mixmode, + int x, int y, + int clipx, int clipy, int clipcx, int clipcy, + int boxx, int boxy, int boxcx, int boxcy, BRUSH * brush, + int bgcolour, int fgcolour, uint8* text, uint8 length) +{ + int i; + int j; + int xyoffset; + DATABLOB* entry; + FONTGLYPH* glyph; + + if (boxcx > 1) + { + if (contains_mouse(boxx, boxy, boxcx, boxcy)) + draw_cursor_under(mousex, mousey); + fill_rect(boxx, boxy, boxcx, boxcy, bgcolour, 0xc); + } + else + { + if (contains_mouse(clipx, clipy, clipcx, clipcy)) + draw_cursor_under(mousex, mousey); + if (mixmode == MIX_OPAQUE) + fill_rect(clipx, clipy, clipcx, clipcy, bgcolour, 0xc); + } + + /* Paint text, character by character */ + for (i = 0; i < length;) + { + switch (text[i]) + { + case 0xff: + if (i + 2 < length) + cache_put_text(text[i + 1], text, text[i + 2]); + else + { + error("this shouldn't be happening\n"); + exit(1); + } + /* this will move pointer from start to first character after FF command */ + length -= i + 3; + text = &(text[i + 3]); + i = 0; + break; + + case 0xfe: + entry = cache_get_text(text[i + 1]); + if (entry != NULL) + { + if ((((uint8 *) (entry->data))[1] == 0) && (!(flags & TEXT2_IMPLICIT_X))) + { + if (flags & TEXT2_VERTICAL) + y += text[i + 2]; + else + x += text[i + 2]; + } + for (j = 0; j < entry->size; j++) + DO_GLYPH(((uint8 *) (entry->data)), j); + } + if (i + 2 < length) + i += 3; + else + i += 2; + length -= i; + /* this will move pointer from start to first character after FE command */ + text = &(text[i]); + i = 0; + break; + + default: + DO_GLYPH(text, i); + i++; + break; + } + } + if (boxcx > 1) + cache_rect(boxx, boxy, boxcx, boxcy, True); + else + cache_rect(clipx, clipy, clipcx, clipcy, True); +} + +//***************************************************************************** +// Bresenham's line drawing algorithm +void ui_line(uint8 opcode, int startx, int starty, int endx, + int endy, PEN* pen) +{ + int dx; + int dy; + int incx; + int incy; + int dpr; + int dpru; + int p; + int left; + int top; + int right; + int bottom; + + if (startx > endx) + { + dx = startx - endx; + incx = -1; + left = endx; + right = startx; + } + else + { + dx = endx - startx; + incx = 1; + left = startx; + right = endx; + } + if (starty > endy) + { + dy = starty - endy; + incy = -1; + top = endy; + bottom = starty; + } + else + { + dy = endy - starty; + incy = 1; + top = starty; + bottom = endy; + } + if (contains_mouse(left, top, (right - left) + 1, (bottom - top) + 1)) + draw_cursor_under(mousex, mousey); + if (dx >= dy) + { + dpr = dy << 1; + dpru = dpr - (dx << 1); + p = dpr - dx; + for (; dx >= 0; dx--) + { + set_pixel(startx, starty, pen->colour, opcode); + if (p > 0) + { + startx += incx; + starty += incy; + p += dpru; + } + else + { + startx += incx; + p += dpr; + } + } + } + else + { + dpr = dx << 1; + dpru = dpr - (dy << 1); + p = dpr - dy; + for (; dy >= 0; dy--) + { + set_pixel(startx, starty, pen->colour, opcode); + if (p > 0) + { + startx += incx; + starty += incy; + p += dpru; + } + else + { + starty += incy; + p += dpr; + } + } + } + cache_rect(left, top, (right - left) + 1, (bottom - top) + 1, True); +} + +/*****************************************************************************/ +void ui_triblt(uint8 opcode, int x, int y, int cx, int cy, + RD_HBITMAP src, int srcx, int srcy, + BRUSH* brush, int bgcolour, int fgcolour) +{ + // non used +} + +/*****************************************************************************/ +void ui_memblt(uint8 opcode, int x, int y, int cx, int cy, + RD_HBITMAP src, int srcx, int srcy) +{ + bitmap* b; + int i; + int j; + int pixel; + + if (warp_coords(&x, &y, &cx, &cy, &srcx, &srcy)) + { + if (contains_mouse(x, y, cx, cy)) + draw_cursor_under(mousex, mousey); + b = (bitmap*)src; + if (opcode == 0xc) + accel_draw_box(x, y, cx, cy, get_ptr(srcx, srcy, b->data, b->width, g_server_depth), + b->width * g_server_Bpp); + else + { + for (i = 0; i < cy; i++) + { + for (j = 0; j < cx; j++) + { + pixel = get_pixel2(srcx + j, srcy + i, b->data, b->width, g_server_depth); + set_pixel(x + j, y + i, pixel, opcode); + } + } + } + cache_rect(x, y, cx, cy, False); + } +} + +/*****************************************************************************/ +void ui_desktop_restore(uint32 offset, int x, int y, int cx, int cy) +{ + uint8* p; + + if (offset > 0x38400) + offset = 0; + if (offset + cx * cy > 0x38400) + return; + p = desk_save + offset * g_server_Bpp; + ui_paint_bitmap(x, y, cx, cy, cx, cy, p); +} + +/*****************************************************************************/ +void ui_desktop_save(uint32 offset, int x, int y, int cx, int cy) +{ + uint8* p; + + if (offset > 0x38400) + offset = 0; + if (offset + cx * cy > 0x38400) + return; + if (contains_mouse(x, y, cx, cy)) + draw_cursor_under(mousex, mousey); + p = desk_save + offset * g_server_Bpp; + get_rect(x, y, cx, cy, p); +} + +/*****************************************************************************/ +void ui_rect(int x, int y, int cx, int cy, int colour) +{ + if (warp_coords(&x, &y, &cx, &cy, NULL, NULL)) + { + if (contains_mouse(x, y, cx, cy)) + draw_cursor_under(mousex, mousey); + accel_fill_rect(x, y, cx, cy, colour); + cache_rect(x, y, cx, cy, False); + } +} + +/*****************************************************************************/ +void ui_screenblt(uint8 opcode, int x, int y, int cx, int cy, + int srcx, int srcy) +{ + int i; + int j; + uint8* temp; + + if (x == srcx && y == srcy) + return; + if (warp_coords(&x, &y, &cx, &cy, &srcx, &srcy)) + { + if (contains_mouse(x, y, cx, cy) || contains_mouse(srcx, srcy, cx, cy)) + draw_cursor_under(mousex, mousey); + if (opcode == 0xc) /* copy */ + accel_screen_copy(x, y, cx, cy, srcx, srcy); + else + { + temp = (uint8*)xmalloc(cx * cy * g_server_Bpp); + for (i = 0; i < cy; i++) + for (j = 0; j < cx; j++) + set_pixel2(j, i, get_pixel(srcx + j, srcy + i), temp, cx, g_server_depth); + for (i = 0; i < cy; i++) + for (j = 0; j < cx; j++) + set_pixel(x + j, y + i, get_pixel2(j, i, temp, cx, g_server_depth), opcode); + xfree(temp); + } + cache_rect(x, y, cx, cy, False); + draw_cache_rects(); // draw them all so screen is not jumpy + } +} + +/*****************************************************************************/ +void ui_patblt(uint8 opcode, int x, int y, int cx, int cy, + BRUSH * brush, int bgcolour, int fgcolour) +{ + int i; + int j; + uint8 ipattern[8]; + + if (warp_coords(&x, &y, &cx, &cy, NULL, NULL)) + { + if (contains_mouse(x, y, cx, cy)) + draw_cursor_under(mousex, mousey); + switch (brush->style) + { + case 0: + fill_rect(x, y, cx, cy, fgcolour, opcode); + break; + case 3: + for (i = 0; i < 8; i++) + ipattern[i] = ~brush->pattern[7 - i]; + for (i = 0; i < cy; i++) + for (j = 0; j < cx; j++) + if (is_pixel_on(ipattern, (x + j + brush->xorigin) % 8, + (y + i + brush->yorigin) % 8, 8, 1)) + set_pixel(x + j, y + i, fgcolour, opcode); + else + set_pixel(x + j, y + i, bgcolour, opcode); + break; + } + cache_rect(x, y, cx, cy, False); + } +} + +/*****************************************************************************/ +void ui_destblt(uint8 opcode, int x, int y, int cx, int cy) +{ + if (warp_coords(&x, &y, &cx, &cy, NULL, NULL)) + { + if (contains_mouse(x, y, cx, cy)) + draw_cursor_under(mousex, mousey); + fill_rect(x, y, cx, cy, -1, opcode); + cache_rect(x, y, cx, cy, False); + } +} + +/*****************************************************************************/ +void ui_move_pointer(int x, int y) +{ +} + +/*****************************************************************************/ +void ui_set_null_cursor(void) +{ + draw_cursor_under(mousex, mousey); + mousex = mousex - mcursor.x; + mousey = mousey - mcursor.y; + memset(&mcursor, 0, sizeof(mcursor)); + memset(mcursor.andmask, 255, sizeof(mcursor.andmask)); + memset(mcursor.xormask, 0, sizeof(mcursor.xormask)); + draw_cursor(); +} + +/*****************************************************************************/ +void ui_paint_bitmap(int x, int y, int cx, int cy, + int width, int height, uint8* data) +{ + if (warp_coords(&x, &y, &cx, &cy, NULL, NULL)) + { + if (contains_mouse(x, y, cx, cy)) + draw_cursor_under(mousex, mousey); + accel_draw_box(x, y, cx, cy, data, width * g_server_Bpp); + cache_rect(x, y, cx, cy, False); + } +} + +/*****************************************************************************/ +void* ui_create_cursor(unsigned int x, unsigned int y, + int width, int height, + uint8* andmask, uint8* xormask) +{ + tcursor* c; + int i; + int j; + + c = (tcursor*)xmalloc(sizeof(tcursor)); + memset(c, 0, sizeof(tcursor)); + c->w = width; + c->h = height; + c->x = x; + c->y = y; + for (i = 0; i < 32; i++) + { + for (j = 0; j < 32; j++) + { + if (is_pixel_on(andmask, j, i, 32, 1)) + set_pixel_on(c->andmask, j, 31 - i, 32, 8, 255); + if (is_pixel_on(xormask, j, i, 32, 24)) + set_pixel_on(c->xormask, j, 31 - i, 32, 8, 255); + } + } + return (void*)c; +} + +/*****************************************************************************/ +void ui_destroy_cursor(void* cursor) +{ + if (cursor != NULL) + xfree(cursor); +} + +/*****************************************************************************/ +void ui_set_cursor(void* cursor) +{ + int x; + int y; + int ox; + int oy; + + ox = mousex; + oy = mousey; + x = mousex + mcursor.x; + y = mousey + mcursor.y; + memcpy(&mcursor, cursor, sizeof(tcursor)); + mousex = x - mcursor.x; + mousey = y - mcursor.y; + draw_cursor_under(ox, oy); + draw_cursor(); +} + +/*****************************************************************************/ +uint16 ui_get_numlock_state(unsigned int state) +{ + return 0; +} + +/*****************************************************************************/ +unsigned int read_keyboard_state(void) +{ + return 0; +} + +/*****************************************************************************/ +void ui_resize_window(void) +{ +} + +/*****************************************************************************/ +void ui_begin_update(void) +{ +} + +/*****************************************************************************/ +void ui_end_update(void) +{ + draw_cache_rects(); + draw_cursor(); +} + +/*****************************************************************************/ +void ui_polygon(uint8 opcode, uint8 fillmode, RD_POINT * point, int npoints, + BRUSH * brush, int bgcolour, int fgcolour) +{ +} + +/*****************************************************************************/ +void ui_polyline(uint8 opcode, RD_POINT * points, int npoints, PEN * pen) +{ +} + +/*****************************************************************************/ +void ui_ellipse(uint8 opcode, uint8 fillmode, + int x, int y, int cx, int cy, + BRUSH * brush, int bgcolour, int fgcolour) +{ +} + +/*****************************************************************************/ +void generate_random(uint8* random) +{ + memcpy(random, "12345678901234567890123456789012", 32); +} + +/*****************************************************************************/ +void save_licence(uint8* data, int length) +{ +} + +/*****************************************************************************/ +int load_licence(uint8** data) +{ + return 0; +} + +/*****************************************************************************/ +void* xrealloc(void* in_val, int size) +{ + return realloc(in_val, size); +} + +/*****************************************************************************/ +void* xmalloc(int size) +{ + return malloc(size); +} + +/*****************************************************************************/ +void xfree(void* in_val) +{ + free(in_val); +} + +/*****************************************************************************/ +char * xstrdup(const char * s) +{ + char * mem = strdup(s); + if (mem == NULL) + { + perror("strdup"); + exit(1); + } + return mem; +} + +/*****************************************************************************/ +void warning(char* format, ...) +{ + va_list ap; + + fprintf(stderr, "WARNING: "); + va_start(ap, format); + vfprintf(stderr, format, ap); + va_end(ap); +} + +/*****************************************************************************/ +void unimpl(char* format, ...) +{ + va_list ap; + + fprintf(stderr, "NOT IMPLEMENTED: "); + va_start(ap, format); + vfprintf(stderr, format, ap); + va_end(ap); +} + +/*****************************************************************************/ +void error(char* format, ...) +{ + va_list ap; + + fprintf(stderr, "ERROR: "); + va_start(ap, format); + vfprintf(stderr, format, ap); + va_end(ap); +} + +RD_BOOL rd_pstcache_mkdir(void) +{ + return 0; +} + +/*****************************************************************************/ +int rd_open_file(char *filename) +{ + return 0; +} + +/*****************************************************************************/ +void rd_close_file(int fd) +{ + return; +} + +/*****************************************************************************/ +int rd_read_file(int fd, void *ptr, int len) +{ + return 0; +} + +/*****************************************************************************/ +int rd_write_file(int fd, void* ptr, int len) +{ + return 0; +} + +/*****************************************************************************/ +int rd_lseek_file(int fd, int offset) +{ + return 0; +} + +/*****************************************************************************/ +RD_BOOL rd_lock_file(int fd, int start, int len) +{ + return False; +} + +/*****************************************************************************/ +void get_username_and_hostname(void) +{ + char fullhostname[64]; + char* p; + struct passwd* pw; + + STRNCPY(g_username, "unknown", sizeof(g_username)); + STRNCPY(g_hostname, "unknown", sizeof(g_hostname)); + pw = getpwuid(getuid()); + if (pw != NULL && pw->pw_name != NULL) + { + STRNCPY(g_username, pw->pw_name, sizeof(g_username)); + } + if (gethostname(fullhostname, sizeof(fullhostname)) != -1) + { + p = strchr(fullhostname, '.'); + if (p != NULL) + *p = 0; + STRNCPY(g_hostname, fullhostname, sizeof(g_hostname)); + } +} + +/*****************************************************************************/ +void out_params(void) +{ + fprintf(stderr, "rdesktop: A Remote Desktop Protocol client.\n"); + fprintf(stderr, "Version " VERSION ". Copyright (C) 1999-2003 Matt Chapman.\n"); + fprintf(stderr, "See http://www.rdesktop.org/ for more information.\n\n"); + fprintf(stderr, "Usage: svgardesktop [options] server\n"); + fprintf(stderr, " -g: desktop geometry (WxH)\n"); + fprintf(stderr, " -4: use RDP version 4\n"); + fprintf(stderr, " -5: use RDP version 5 (default)\n"); + fprintf(stderr, " -t: tcp port\n"); + fprintf(stderr, " -u: user name\n"); + fprintf(stderr, " -n: client hostname\n"); + fprintf(stderr, " -d: disable accel funcs\n"); + fprintf(stderr, " -a: connection colour depth\n"); + fprintf(stderr, " -l: low memory\n"); + fprintf(stderr, "\n"); +} + +/* produce a hex dump */ +void hexdump(uint8* p, uint32 len) +{ + uint8* line; + int i; + int thisline; + int offset; + + line = p; + offset = 0; + while (offset < len) + { + printf("%04x ", offset); + thisline = len - offset; + if (thisline > 16) + thisline = 16; + + for (i = 0; i < thisline; i++) + printf("%02x ", line[i]); + + for (; i < 16; i++) + printf(" "); + + for (i = 0; i < thisline; i++) + printf("%c", (line[i] >= 0x20 && line[i] < 0x7f) ? line[i] : '.'); + + printf("\n"); + offset += thisline; + line += thisline; + } +} + +/*****************************************************************************/ +int parse_parameters(int in_argc, char** in_argv) +{ + int i; + char* p; + + if (in_argc <= 1) + { + out_params(); + return 0; + } + g_argc = in_argc; + g_argv = in_argv; + for (i = 1; i < in_argc; i++) + { + strcpy(g_servername, in_argv[i]); + if (strcmp(in_argv[i], "-g") == 0) + { + g_width = strtol(in_argv[i + 1], &p, 10); + if (g_width <= 0) + { + error("invalid geometry\n"); + return 0; + } + if (*p == 'x') + g_height = strtol(p + 1, NULL, 10); + if (g_height <= 0) + { + error("invalid geometry\n"); + return 0; + } + g_width = (g_width + 3) & ~3; + } + else if (strcmp(in_argv[i], "-4") == 0) + g_use_rdp5 = 0; + else if (strcmp(in_argv[i], "-5") == 0) + g_use_rdp5 = 1; + else if (strcmp(in_argv[i], "-t") == 0) + g_tcp_port_rdp = strtol(in_argv[i + 1], &p, 10); + else if (strcmp(in_argv[i], "-h") == 0) + { + out_params(); + return 0; + } + else if (strcmp(in_argv[i], "-n") == 0) + { + STRNCPY(g_hostname, in_argv[i + 1], sizeof(g_hostname)); + } + else if (strcmp(in_argv[i], "-u") == 0) + { + STRNCPY(g_username, in_argv[i + 1], sizeof(g_username)); + } + else if (strcmp(in_argv[i], "-d") == 0) + { + use_accel = 0; + } + else if (strcmp(in_argv[i], "-a") == 0) + { + g_server_depth = strtol(in_argv[i + 1], NULL, 10); + if (g_server_depth != 8 && g_server_depth != 16) + { + error("invalid server bpp\n"); + return 0; + } + g_server_Bpp = (g_server_depth + 7) / 8; + } + else if (strcmp(in_argv[i], "-l") == 0) + g_save_mem = 1; + } + return 1; +} + +/*****************************************************************************/ +int main(int in_argc, char** in_argv) +{ + get_username_and_hostname(); + if (!parse_parameters(in_argc, in_argv)) + return 0; + if (!ui_init()) + return 1; + if (!ui_create_window()) + return 1; + ui_main_loop(); + ui_destroy_window(); + ui_deinit(); + return 0; +} --- rdesktop-1.5.0.orig/uiports/xxxwin.c +++ rdesktop-1.5.0/uiports/xxxwin.c @@ -0,0 +1,368 @@ +/* -*- c-basic-offset: 8 -*- + rdesktop: A Remote Desktop Protocol client. + User interface services - Generic + Copyright (C) Jay Sorg 2004-2007 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 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., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "../rdesktop.h" + +extern int g_tcp_port_rdp; /* in tcp.c */ +RD_BOOL g_use_rdp5 = False; +char g_hostname[16]; +char g_username[64]; +int g_height = 600; +int g_width = 800; +int g_server_depth = 8; +RD_BOOL g_encryption = True; +RD_BOOL g_desktop_save = True; +RD_BOOL g_polygon_ellipse_orders = False; +RD_BOOL g_bitmap_cache = True; +RD_BOOL g_bitmap_cache_persist_enable = False; +RD_BOOL g_bitmap_cache_precache = True; +RD_BOOL g_bitmap_compression = True; +uint32 g_rdp5_performanceflags = 0; +RD_BOOL g_console_session = False; +uint32 g_keylayout = 0x409; /* Defaults to US keyboard layout */ +int g_keyboard_type = 0x4; /* Defaults to US keyboard layout */ +int g_keyboard_subtype = 0x0; /* Defaults to US keyboard layout */ +int g_keyboard_functionkeys = 0xc; /* Defaults to US keyboard layout */ +/* Session Directory redirection */ +RD_BOOL g_redirect = False; +RD_BOOL g_numlock_sync = False; +char g_redirect_server[64]; +char g_redirect_domain[16]; +char g_redirect_password[64]; +char g_redirect_username[64]; +char g_redirect_cookie[128]; +uint32 g_redirect_flags = 0; +char g_codepage[16] = ""; + +/*****************************************************************************/ +void ui_bell(void) +{ +} + +/*****************************************************************************/ +int ui_select(int in) +{ + return 1; +} + +/*****************************************************************************/ +void ui_destroy_cursor(void* cursor) +{ +} + +/*****************************************************************************/ +void* ui_create_glyph(int width, int height, uint8* data) +{ + return 0; +} + +/*****************************************************************************/ +void ui_destroy_glyph(void* glyph) +{ +} + +/*****************************************************************************/ +void ui_destroy_bitmap(void* bmp) +{ +} + +/*****************************************************************************/ +void ui_reset_clip(void) +{ +} + +/*****************************************************************************/ +void ui_set_clip(int x, int y, int cx, int cy) +{ +} + +/*****************************************************************************/ +void* ui_create_colourmap(COLOURMAP * colours) +{ + return 0; +} + +/*****************************************************************************/ +void ui_set_colourmap(void* map) +{ +} + +/*****************************************************************************/ +RD_HBITMAP ui_create_bitmap(int width, int height, uint8* data) +{ + return 0; +} + +/*****************************************************************************/ +void ui_draw_text(uint8 font, uint8 flags, uint8 opcode, int mixmode, + int x, int y, + int clipx, int clipy, int clipcx, int clipcy, + int boxx, int boxy, int boxcx, int boxcy, BRUSH * brush, + int bgcolour, int fgcolour, uint8* text, uint8 length) +{ +} + +/*****************************************************************************/ +void ui_line(uint8 opcode, int startx, int starty, int endx, int endy, + PEN * pen) +{ +} + +/*****************************************************************************/ +void ui_triblt(uint8 opcode, int x, int y, int cx, int cy, + RD_HBITMAP src, int srcx, int srcy, + BRUSH* brush, int bgcolour, int fgcolour) +{ +} + +/*****************************************************************************/ +void ui_memblt(uint8 opcode, int x, int y, int cx, int cy, + RD_HBITMAP src, int srcx, int srcy) +{ +} + +/*****************************************************************************/ +void ui_desktop_restore(uint32 offset, int x, int y, int cx, int cy) +{ +} + +/*****************************************************************************/ +void ui_desktop_save(uint32 offset, int x, int y, int cx, int cy) +{ +} + +/*****************************************************************************/ +void ui_rect(int x, int y, int cx, int cy, int colour) +{ +} + +/*****************************************************************************/ +void ui_screenblt(uint8 opcode, int x, int y, int cx, int cy, + int srcx, int srcy) +{ +} + +/*****************************************************************************/ +void ui_patblt(uint8 opcode, int x, int y, int cx, int cy, + BRUSH * brush, int bgcolour, int fgcolour) +{ +} + +/*****************************************************************************/ +void ui_destblt(uint8 opcode, int x, int y, int cx, int cy) +{ +} + +/*****************************************************************************/ +void ui_move_pointer(int x, int y) +{ +} + +/*****************************************************************************/ +void ui_set_null_cursor(void) +{ +} + +/*****************************************************************************/ +void ui_paint_bitmap(int x, int y, int cx, int cy, + int width, int height, uint8* data) +{ +} + +/*****************************************************************************/ +void ui_set_cursor(RD_HCURSOR cursor) +{ +} + +/*****************************************************************************/ +RD_HCURSOR ui_create_cursor(unsigned int x, unsigned int y, + int width, int height, + uint8* andmask, uint8* xormask) +{ + return 0; +} + +/*****************************************************************************/ +uint16 ui_get_numlock_state(unsigned int state) +{ + return 0; +} + +/*****************************************************************************/ +unsigned int read_keyboard_state(void) +{ + return 0; +} + +/*****************************************************************************/ +void ui_resize_window(void) +{ +} + +/*****************************************************************************/ +void ui_begin_update(void) +{ +} + +/*****************************************************************************/ +void ui_end_update(void) +{ +} + +/*****************************************************************************/ +void ui_polygon(uint8 opcode, uint8 fillmode, RD_POINT * point, int npoints, + BRUSH * brush, int bgcolour, int fgcolour) +{ +} + +/*****************************************************************************/ +/* todo, use qt function for this (QPainter::drawPolyline) */ +void ui_polyline(uint8 opcode, RD_POINT * points, int npoints, PEN * pen) +{ + int i, x, y, dx, dy; + if (npoints > 0) + { + x = points[0].x; + y = points[0].y; + for (i = 1; i < npoints; i++) + { + dx = points[i].x; + dy = points[i].y; + ui_line(opcode, x, y, x + dx, y + dy, pen); + x = x + dx; + y = y + dy; + } + } +} + +/*****************************************************************************/ +void ui_ellipse(uint8 opcode, uint8 fillmode, + int x, int y, int cx, int cy, + BRUSH * brush, int bgcolour, int fgcolour) +{ +} + +/*****************************************************************************/ +void generate_random(uint8* random) +{ +} + +/*****************************************************************************/ +void save_licence(uint8* data, int length) +{ +} + +/*****************************************************************************/ +int load_licence(uint8** data) +{ + return 0; +} + +/*****************************************************************************/ +void* xrealloc(void* in, int size) +{ + return 0; +} + +/*****************************************************************************/ +void* xmalloc(int size) +{ + return 0; +} + +/*****************************************************************************/ +void xfree(void* in) +{ +} + +/*****************************************************************************/ +char * xstrdup(const char * s) +{ + char * mem = strdup(s); + if (mem == NULL) + { + perror("strdup"); + exit(1); + } + return mem; +} +/*****************************************************************************/ +void warning(char* format, ...) +{ +} + +/*****************************************************************************/ +void unimpl(char* format, ...) +{ +} + +/*****************************************************************************/ +void error(char* format, ...) +{ +} + +/*****************************************************************************/ +RD_BOOL rd_pstcache_mkdir(void) +{ + return 0; +} + +/*****************************************************************************/ +int rd_open_file(char *filename) +{ + return 0; +} + +/*****************************************************************************/ +void rd_close_file(int fd) +{ + return; +} + +/*****************************************************************************/ +int rd_read_file(int fd, void *ptr, int len) +{ + return 0; +} + +/*****************************************************************************/ +int rd_write_file(int fd, void* ptr, int len) +{ + return 0; +} + +/*****************************************************************************/ +int rd_lseek_file(int fd, int offset) +{ + return 0; +} + +/*****************************************************************************/ +RD_BOOL rd_lock_file(int fd, int start, int len) +{ + return False; +} + +/*****************************************************************************/ +int main(int c, char** p) +{ + return 0; +} --- rdesktop-1.5.0.orig/vnc/vnc.c +++ rdesktop-1.5.0/vnc/vnc.c @@ -0,0 +1,1376 @@ +/* + rdesktop: A Remote Desktop Protocol client. + User interface services - VNC target + Copyright (C) Matthew Chapman 1999-2000 + Copyright (C) 2000 Tim Edmonds + Copyright (C) 2001 James "Wez" Weatherall + Copyright (C) 2001 Johannes E. Schindelin + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 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., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + + +#include <stdio.h> +#include <time.h> + +#ifdef WIN32 +#define close closesocket +#define strcasecmp _strcmpi +#else +#include <unistd.h> +#include <sys/time.h> /* timeval */ +#include <sys/socket.h> +#endif + +#include "../rdesktop.h" +#undef VERSION + +#ifdef WIN32 +#define HBITMAP R_HBITMAP +#define HCURSOR R_HCURSOR +#define WORD R_WORD +#endif +#include "vnc.h" +#ifdef WIN32 +#undef HBITMAP +#undef HCURSOR +#undef WORD +#endif + +#include <errno.h> +#include <sys/socket.h> +extern int ListenOnTCPPort(int port); +extern int rfbClientSocket; + +#include <rfb/rfbregion.h> + +#define BITSPERBYTES 8 +#define TOBYTES(bits) ((bits)/BITSPERBYTES) + +extern int g_width; +extern int g_height; +extern int keylayout; +extern BOOL sendmotion; +#ifdef ENABLE_SHADOW +extern int client_counter; +#endif + + +int rfb_port = 5923; +int defer_time = 5; +int rfbClientSocket = 0; +static rfbScreenInfoPtr server = NULL; +static vncBuffer *frameBuffer = NULL; +static uint8_t reverseByte[0x100]; +BOOL g_enable_compose = False; +int g_display = 0; + +/* ignored */ +BOOL owncolmap = False; +BOOL enable_compose = False; + +void +vncHideCursor() +{ + if (server->clientHead) + rfbUndrawCursor(server); +} + +/* -=- mouseLookup + * Table converting mouse button number (0-2) to flag + */ + +int mouseLookup[3] = { + MOUSE_FLAG_BUTTON1, MOUSE_FLAG_BUTTON3, MOUSE_FLAG_BUTTON2 +}; + +int clipX, clipY, clipW, clipH; + +BOOL +vncwinClipRect(int *x, int *y, int *cx, int *cy) +{ + if (*x + *cx > clipX + clipW) + *cx = clipX + clipW - *x; + if (*y + *cy > clipY + clipH) + *cy = clipY + clipH - *y; + if (*x < clipX) + { + *cx -= clipX - *x; + *x = clipX; + } + if (*y < clipY) + { + *cy -= clipY - *y; + *y = clipY; + } + if (*cx < 0 || *cy < 0) + *cx = *cy = 0; + return (*cx > 0 && *cy > 0 && *x < server->width && *y < server->height); +} + +void +xwin_toggle_fullscreen(void) +{ +} + +static int lastbuttons = 0; + +#define FIRST_MODIFIER XK_Shift_L +#define LAST_MODIFIER XK_Hyper_R + +static BOOL keystate[LAST_MODIFIER - FIRST_MODIFIER]; + +void +init_keyboard() +{ + int i; + for (i = 0; i < LAST_MODIFIER - FIRST_MODIFIER; i++) + keystate[i] = 0; + + xkeymap_init(); +} + +BOOL +get_key_state(unsigned int state, uint32 keysym) +{ + if (keysym >= FIRST_MODIFIER && keysym <= LAST_MODIFIER) + return keystate[keysym - FIRST_MODIFIER]; + return 0; +} + +void +vncKey(rfbBool down, rfbKeySym keysym, struct _rfbClientRec *cl) +{ + uint32 ev_time = time(NULL); + key_translation tr = { 0, 0 }; + + if (keysym >= FIRST_MODIFIER && keysym <= LAST_MODIFIER) + { + /* TODO: fake local state */ + keystate[keysym - FIRST_MODIFIER] = down; + } + + if (down) + { + /* TODO: fake local state */ + if (handle_special_keys(keysym, 0, ev_time, True)) + return; + + /* TODO: fake local state */ + tr = xkeymap_translate_key(keysym, 0, 0); + + if (tr.scancode == 0) + return; + + ensure_remote_modifiers(ev_time, tr); + + rdp_send_scancode(ev_time, RDP_KEYPRESS, tr.scancode); + } + else + { + /* todO: fake local state */ + if (handle_special_keys(keysym, 0, ev_time, False)) + return; + + /* todO: fake local state */ + tr = xkeymap_translate_key(keysym, 0, 0); + + if (tr.scancode == 0) + return; + + rdp_send_scancode(ev_time, RDP_KEYRELEASE, tr.scancode); + } +} + +void +vncMouse(int buttonMask, int x, int y, struct _rfbClientRec *cl) +{ + int b; + uint32 ev_time = time(NULL); + + rdp_send_input(ev_time, RDP_INPUT_MOUSE, MOUSE_FLAG_MOVE, x, y); + + for (b = 0; b < 3; b++) + { + int bb = 1 << (b); + if (!(lastbuttons & bb) && (buttonMask & bb)) + { + rdp_send_input(ev_time, RDP_INPUT_MOUSE, + (mouseLookup[b]) | MOUSE_FLAG_DOWN, x, y); + } + else if ((lastbuttons & bb) && !(buttonMask & bb)) + { + rdp_send_input(ev_time, RDP_INPUT_MOUSE, (mouseLookup[b]), x, y); + } + } + lastbuttons = buttonMask; + + /* handle cursor */ + rfbDefaultPtrAddEvent(buttonMask, x, y, cl); +} + + +void +rdp2vnc_connect(char *server, uint32 flags, char *domain, char *password, + char *shell, char *directory) +{ + struct sockaddr addr; + fd_set fdset; + struct timeval tv; + int rfbListenSock, addrlen = sizeof(addr); + + rfbListenSock = rfbListenOnTCPPort(rfb_port); + fprintf(stderr, "Listening on VNC port %d\n", rfb_port); + if (rfbListenSock <= 0) + error("Cannot listen on port %d", rfb_port); + else + while (1) + { + FD_ZERO(&fdset); + FD_SET(rfbListenSock, &fdset); + tv.tv_sec = 5; + tv.tv_usec = 0; + if (select(rfbListenSock + 1, &fdset, NULL, NULL, &tv) > 0) + { + rfbClientSocket = accept(rfbListenSock, &addr, &addrlen); + if (rfbClientSocket < 0) + { + error("Error accepting client (%d: %s.\n", + errno, strerror(errno)); + continue; + } + ui_create_window(); + if (!rdp_connect(server, flags, domain, password, shell, directory)) + { + error("Error connecting to RDP server.\n"); + continue; + } + if (!fork()) + { + BOOL deactivated; + uint32_t ext_disc_reason; + printf("Connection successful.\n"); + rdp_main_loop(&deactivated, &ext_disc_reason); + printf("Disconnecting...\n"); + rdp_disconnect(); + ui_destroy_window(); + exit(0); + } + } + } +} + + + + + +extern char g_title[]; +BOOL +ui_create_window() +{ + int i; + + for (i = 0; i < 0x100; i++) + reverseByte[i] = + (((i >> 7) & 1)) | (((i >> 6) & 1) << 1) | (((i >> 5) & 1) << 2) | + (((i >> 4) & 1) << 3) | (((i >> 3) & 1) << 4) | (((i >> 2) & 1) << 5) | + (((i >> 1) & 1) << 6) | (((i >> 0) & 1) << 7); + + server = rfbGetScreen(0, NULL, g_width, g_height, 8, 1, 1); + server->desktopName = g_title; + server->frameBuffer = (char *) malloc(g_width * g_height); + server->ptrAddEvent = vncMouse; + server->kbdAddEvent = vncKey; +#ifdef ENABLE_SHADOW + server->httpPort = 6124 + client_counter; + server->port = 5924 + client_counter; + rfbInitSockets(server); + server->alwaysShared = TRUE; + server->neverShared = FALSE; +#else + server->port = -1; + server->alwaysShared = FALSE; + server->neverShared = FALSE; +#endif + server->inetdSock = rfbClientSocket; + server->serverFormat.trueColour = FALSE; /* activate colour maps */ + server->deferUpdateTime = defer_time; + + frameBuffer = (vncBuffer *) malloc(sizeof(vncBuffer)); + frameBuffer->w = g_width; + frameBuffer->h = g_height; + frameBuffer->linew = g_width; + frameBuffer->data = server->frameBuffer; + frameBuffer->owner = FALSE; + frameBuffer->format = &server->serverFormat; + + ui_set_clip(0, 0, g_width, g_height); + + rfbInitServer(server); +#ifndef ENABLE_SHADOW + server->port = rfb_port; +#else + fprintf(stderr, "server listening on port %d (socket %d)\n", server->port, + server->listenSock); +#endif + + init_keyboard(); + + return (server != NULL); +} + +void +ui_destroy_window() +{ + rfbCloseClient(server->clientHead); +} + + +int +ui_select(int rdpSocket) +{ + fd_set fds; + struct timeval tv; + int n, m = server->maxFd; + + if (rdpSocket > m) + m = rdpSocket; + while (1) + { + fds = server->allFds; + FD_SET(rdpSocket, &fds); + tv.tv_sec = defer_time / 1000; + tv.tv_usec = (defer_time % 1000) * 1000; + n = select(m + 1, &fds, NULL, NULL, &tv); + rfbProcessEvents(server, 0); + /* if client is gone, close connection */ + if (!server->clientHead) + close(rdpSocket); + if (FD_ISSET(rdpSocket, &fds)) + return 1; + } + return 0; +} + +void +ui_move_pointer(int x, int y) +{ + // TODO: Is there a way to send x,y even if cursor encoding is active? + rfbUndrawCursor(server); + server->cursorX = x; + server->cursorY = y; +} + +HBITMAP +ui_create_bitmap(int width, int height, uint8 * data) +{ + vncBuffer *buf; + + buf = vncNewBuffer(width, height, 8); + memcpy(buf->data, data, width * height); + + return (HBITMAP) buf; +} + +void +ui_paint_bitmap(int x, int y, int cx, int cy, int width, int height, uint8 * data) +{ + vncBuffer *buf; + buf = ui_create_bitmap(width, height, data); + vncCopyBlitFrom(server, x, y, cx, cy, buf, 0, 0); + vncDeleteBuffer(buf); +} + +void +ui_destroy_bitmap(HBITMAP bmp) +{ + vncDeleteBuffer((vncBuffer *) bmp); +} + +uint8_t +vncLookupColour(rfbColourMap * colourMap, uint8_t * p) +{ + uint8_t i, i1 = 0; + uint8_t *cm = colourMap->data.bytes; + uint32_t m, m1 = abs(cm[0] - p[0]) + abs(cm[1] - p[1]) + abs(cm[2] - p[2]); + for (i = 1; i < 255; i++) + { + m = abs(cm[i * 3] - p[0]) + abs(cm[i * 3 + 1] - p[1]) + abs(cm[i * 3 + 2] - p[2]); + if (m < m1) + { + m1 = m; + i1 = i; + } + } + return (i1); +} + +HCURSOR +ui_create_cursor(unsigned int x, unsigned int y, int width, int height, uint8 * mask, uint8 * data) +{ + int i, j; + uint8_t *d0, *d1; + uint8_t *cdata; + uint8_t white[3] = { 0xff, 0xff, 0xff }; + uint8_t black[3] = { 0, 0, 0 }; + uint8_t *cur; + rfbCursorPtr cursor; + rfbColourMap *colourMap = &server->colourMap; + + cdata = xmalloc(sizeof(uint8_t) * width * height); + d0 = xmalloc(sizeof(uint32_t) * width * height / 4); + d1 = (uint8_t *) mask; + for (j = 0; j < height; j++) + for (i = 0; i < width / 8; i++) + { + d0[j * width / 8 + i] = d1[(height - 1 - j) * width / 8 + i] ^ 0xffffffff; + } + for (j = 0; j < height; j++) + { + for (i = 0; i < width; i++) + { + //strange that the pointer is in 24bit depth when everything + //else is in 8bit palletized. + cur = data + ((height - 1 - j) * width + i) * 3; + if (cur[0] > 0x80 || cur[1] > 0x80 || cur[2] > 0x80) + { + if (!(d0[(j * width + i) / 8] & (0x80 >> (i & 7)))) + { + /* text cursor! */ + cdata[j * width + i] = vncLookupColour(colourMap, black); + d0[(j * width + i) / 8] |= 0x80 >> (i & 7); + } + else + cdata[j * width + i] = vncLookupColour(colourMap, white); + } + else + cdata[j * width + i] = vncLookupColour(colourMap, cur); + } + } + cursor = (rfbCursorPtr) xmalloc(sizeof(rfbCursor)); + cursor->width = width; + cursor->height = height; + cursor->xhot = x; + cursor->yhot = y; + cursor->mask = (char *) d0; + cursor->source = 0; + cursor->richSource = cdata; + cursor->cleanup = 0; // workaround: this produces a memleak + + cursor->backRed = cursor->backGreen = cursor->backBlue = 0xffff; + cursor->foreRed = cursor->foreGreen = cursor->foreBlue = 0; + + return (HCURSOR) cursor; +} + +void +ui_set_cursor(HCURSOR cursor) +{ + /* FALSE means: don't delete old cursor */ + rfbSetCursor(server, (rfbCursorPtr) cursor, FALSE); +} + +void +ui_destroy_cursor(HCURSOR cursor) +{ + if (cursor) + rfbFreeCursor((rfbCursorPtr) cursor); +} + +void +ui_set_null_cursor(void) +{ + rfbSetCursor(server, 0, FALSE); +} + +HGLYPH +ui_create_glyph(int width, int height, uint8 * data) +{ + int x, y; + vncBuffer *buf; + + buf = vncNewBuffer(width, height, 8); + + //data is padded to multiple of 16bit line lengths + for (y = 0; y < height; y++) + { + for (x = 0; x < width; x++) + { + int byte = x / 8 + (y * ((width + 7) / 8)); + byte = rfbEndianTest ? reverseByte[data[byte]] : data[byte]; + byte = (byte >> (x & 7)) & 0x01; + vncSetPixel(buf, x, y, byte ? 0x7f : 0x00); + } + } + + return (HGLYPH) buf; +} + +void +ui_destroy_glyph(HGLYPH glyph) +{ + ui_destroy_bitmap((HBITMAP) glyph); +} + +HCOLOURMAP +ui_create_colourmap(COLOURMAP * colours) +{ + int i; + rfbColourMap *map = vncNewColourMap(server, colours->ncolours); + for (i = 0; i < colours->ncolours; i++) + { + vncSetColourMapEntry(map, i, colours->colours[i].red, + colours->colours[i].green, colours->colours[i].blue); + } + return map; +} + +void +ui_destroy_colourmap(HCOLOURMAP map) +{ + vncDeleteColourMap(map); +} + +void +ui_set_colourmap(HCOLOURMAP map) +{ + vncSetColourMap(server, map); +} + +void +ui_set_clip(int x, int y, int cx, int cy) +{ + clipX = x; + clipY = y; + clipW = cx; + clipH = cy; +} + +void +ui_reset_clip() +{ + clipX = 0; + clipY = 0; + clipW = 64000; + clipH = 64000; +} + +void +ui_bell() +{ + rfbSendBell(server); +} + +void +ui_destblt(uint8 opcode, + /* dest */ int x, int y, int cx, int cy) +{ + int i; + vncBuffer *buf; + + switch (opcode) + { + case 0: + case 15: + ui_rect(x, y, cx, cy, 0xff); + break; + case 5: // invert + buf = vncGetRect(server, x, y, cx, cy); + for (i = 0; i < cx * cy; i++) + ((char *) (buf->data))[i] = !((char *) (buf->data))[i]; + break; + default: + unimpl("ui_destblt: opcode=%d %d,%d %dx%d\n", opcode, x, y, cx, cy); + } +} + +void +ui_patblt(uint8 opcode, + /* dest */ int x, int y, int cx, int cy, + /* brush */ BRUSH * brush, int bgcolour, int fgcolour) +{ + switch (brush->style) + { + case 0: /* Solid */ + switch (opcode) + { + case ROP2_XOR: + { + int xx, yy; + vncBuffer *fill = vncNewBuffer(cx, cy, 8); + for (yy = 0; yy < cy; yy++) + for (xx = 0; xx < cx; xx++) + vncSetPixel(fill, xx, yy, fgcolour); + if (vncwinClipRect(&x, &y, &cx, &cy)) + vncXorBlitFrom(server, x, y, cx, cy, fill, + 0, 0); + break; + } + + default: + if (vncwinClipRect(&x, &y, &cx, &cy)) + vncSetRect(server, x, y, cx, cy, fgcolour); + } + break; + + case 3: /* Pattern */ + { + int xx, yy; + vncBuffer *fill; + fill = (vncBuffer *) ui_create_glyph(8, 8, brush->pattern); + + for (yy = 0; yy < 8; yy++) + { + for (xx = 0; xx < 8; xx++) + { + vncSetPixel(fill, xx, yy, + vncGetPixel(fill, xx, + yy) ? fgcolour : bgcolour); + } + } + + if (vncwinClipRect(&x, &y, &cx, &cy)) + { + switch (opcode) + { + case ROP2_COPY: + vncCopyBlitFrom(server, x, y, cx, cy, fill, + 0, 0); + break; + case ROP2_XOR: + vncXorBlitFrom(server, x, y, cx, cy, fill, + 0, 0); + break; + default: + unimpl("pattern blit (%d,%d) opcode=%d bg=%d fg=%d\n", x, y, opcode, bgcolour, fgcolour); + vncCopyBlitFrom(server, x, y, cx, cy, fill, + 0, 0); + break; + } + } + + ui_destroy_glyph((HGLYPH) fill); + break; + + } + default: + unimpl("brush %d\n", brush->style); + } +} + +void +ui_screenblt(uint8 opcode, + /* dest */ int x, int y, int cx, int cy, + /* src */ int srcx, int srcy) +{ + int ox, oy; + + ox = x; + oy = y; + if (vncwinClipRect(&x, &y, &cx, &cy)) + { + //if we clipped top or left, we have to adjust srcx,srcy; + srcx += x - ox; + srcy += y - oy; + vncCopyBlit(server, x, y, cx, cy, srcx, srcy); + } +} + +void +ui_memblt(uint8 opcode, + /* dest */ int x, int y, int cx, int cy, + /* src */ HBITMAP src, int srcx, int srcy) +{ + int ox, oy; + ox = x; + oy = y; + + if (vncwinClipRect(&x, &y, &cx, &cy)) + { + //if we clipped top or left, we have to adjust srcx,srcy; + srcx += x - ox; + srcy += y - oy; + switch (ROP2_S(opcode)) + { + case ROP2_OR: + vncTransBlitFrom(server, x, y, cx, cy, (vncBuffer *) src, srcx, + srcy, 0x0); + break; + case ROP2_XOR: + vncXorBlitFrom(server, x, y, cx, cy, (vncBuffer *) src, srcx, srcy); + break; + case ROP2_AND: + vncAndBlitFrom(server, x, y, cx, cy, (vncBuffer *) src, srcx, srcy); + break; + case ROP2_COPY: + vncCopyBlitFrom(server, x, y, cx, cy, (vncBuffer *) src, srcx, + srcy); + break; + default: + unimpl("ui_memblt: op%d %d,%d %dx%d\n", opcode, x, y, cx, cy); + vncCopyBlitFrom(server, x, y, cx, cy, (vncBuffer *) src, srcx, + srcy); + break; + } + } +} + +void +ui_triblt(uint8 opcode, + /* dest */ int x, int y, int cx, int cy, + /* src */ HBITMAP src, int srcx, int srcy, + /* brush */ BRUSH * brush, int bgcolour, int fgcolour) +{ + /* This is potentially difficult to do in general. Until someone + comes up with a more efficient way of doing it I am using cases. */ + + switch (opcode) + { + case 0x69: /* PDSxxn */ + ui_memblt(ROP2_XOR, x, y, cx, cy, src, srcx, srcy); + ui_patblt(ROP2_NXOR, x, y, cx, cy, brush, bgcolour, fgcolour); + break; + + case 0xb8: /* PSDPxax */ + ui_patblt(ROP2_XOR, x, y, cx, cy, brush, bgcolour, fgcolour); + ui_memblt(ROP2_AND, x, y, cx, cy, src, srcx, srcy); + ui_patblt(ROP2_XOR, x, y, cx, cy, brush, bgcolour, fgcolour); + break; + + default: + unimpl("ui_triblt 1x%x\n", opcode); + ui_memblt(ROP2_COPY, x, y, cx, cy, src, srcx, srcy); + } + +} + +void +ui_line(uint8 opcode, + /* dest */ int startx, int starty, int endx, int endy, + /* pen */ PEN * pen) +{ + //vncSetRect(server,startx,starty,1+endx-startx,endy-starty,pen->colour); + //unimpl("drawline: pen colour=%d\n",pen->colour); + /* TODO: implement opcodes */ + rfbDrawLine(server, startx, starty, endx, endy, pen->colour); +} + +void +ui_rect( + /* dest */ int x, int y, int cx, int cy, + /* brush */ int colour) +{ + if (vncwinClipRect(&x, &y, &cx, &cy)) + { + vncSetRect(server, x, y, cx, cy, colour); + } +} + +void +ui_draw_glyph(int mixmode, + /* dest */ int x, int y, int cx, int cy, + /* src */ HGLYPH glyph, int srcx, int srcy, + /* colours */ int bgcolour, int fgcolour) +{ + int xx, yy; + int ox, oy; + vncBuffer *buf = vncDupBuffer(glyph); + + x &= 0xffff; + y &= 0xffff; + + /* yes, sometimes same fgcolour and bgcolour are sent, but because + * of transparency, we have to change that! */ + if (mixmode == MIX_TRANSPARENT && fgcolour == bgcolour) + bgcolour = fgcolour ^ 0xff; + + ox = x; + oy = y; + + for (yy = srcy; yy < srcy + cy; yy++) + { + for (xx = srcx; xx < srcx + cx; xx++) + { + vncSetPixel(buf, xx, yy, vncGetPixel(buf, xx, yy) ? fgcolour : bgcolour); + } + } + + switch (mixmode) + { + case MIX_TRANSPARENT: + if (vncwinClipRect(&x, &y, &cx, &cy)) + { + //if we clipped top or left, we have to adjust srcx,srcy; + srcx += x - ox; + srcy += y - oy; + vncTransBlitFrom(server, x, y, cx, cy, buf, srcx, srcy, bgcolour); + } + break; + case MIX_OPAQUE: + if (vncwinClipRect(&x, &y, &cx, &cy)) + { + //if we clipped top or left, we have to adjust srcx,srcy; + srcx += x - ox; + srcy += y - oy; + vncCopyBlitFrom(server, x, y, cx, cy, buf, srcx, srcy); + } + break; + + default: + unimpl("mix %d\n", mixmode); + } + vncDeleteBuffer(buf); +} + +#define DO_GLYPH(ttext,idx) \ +{\ + glyph = cache_get_font (font, ttext[idx]);\ + if (!(flags & TEXT2_IMPLICIT_X))\ + {\ + offset = ttext[++idx];\ + if ((offset & 0x80))\ + offset = ((offset & 0x7f) << 8) | ttext[++idx];\ + if (flags & TEXT2_VERTICAL)\ + y += offset;\ + else\ + x += offset;\ + }\ + if (glyph != NULL)\ + {\ + ui_draw_glyph (mixmode, x + (short) glyph->offset,\ + y + (short) glyph->baseline,\ + glyph->width, glyph->height,\ + glyph->pixmap, 0, 0, bgcolour, fgcolour);\ + if (flags & TEXT2_IMPLICIT_X)\ + x += glyph->width;\ + }\ +} + + +void +ui_draw_text(uint8 font, uint8 flags, int mixmode, int x, int y, + int clipx, int clipy, int clipcx, int clipcy, + int boxx, int boxy, int boxcx, int boxcy, + int bgcolour, int fgcolour, uint8 * text, uint8 length) +{ + FONTGLYPH *glyph; + int i, j, offset; + DATABLOB *entry; + + if (boxcx > 1) + { + ui_rect(boxx, boxy, boxcx, boxcy, bgcolour); + } + else if (mixmode == MIX_OPAQUE) + { + ui_rect(clipx, clipy, clipcx, clipcy, bgcolour); + } + + /* Paint text, character by character */ + for (i = 0; i < length;) + { + switch (text[i]) + { + case 0xff: + if (i + 2 < length) + cache_put_text(text[i + 1], &(text[i - text[i + 2]]), + text[i + 2]); + else + { + error("this shouldn't be happening\n"); + break; + } + /* this will move pointer from start to first character after FF command */ + length -= i + 3; + text = &(text[i + 3]); + i = 0; + break; + + case 0xfe: + entry = cache_get_text(text[i + 1]); + if (entry != NULL) + { + if ((((uint8 *) (entry->data))[1] == 0) + && (!(flags & TEXT2_IMPLICIT_X))) + { + if (flags & 0x04) /* vertical text */ + y += text[i + 2]; + else + x += text[i + 2]; + } + if (i + 2 < length) + i += 3; + else + i += 2; + length -= i; + /* this will move pointer from start to first character after FE command */ + text = &(text[i]); + i = 0; + for (j = 0; j < entry->size; j++) + DO_GLYPH(((uint8 *) (entry->data)), j); + } + break; + default: + DO_GLYPH(text, i); + i++; + break; + } + } +} + +void +ui_desktop_save(uint32 offset, int x, int y, int cx, int cy) +{ + vncBuffer *buf; + + buf = vncGetRect(server, x, y, cx, cy); + offset *= TOBYTES(server->serverFormat.bitsPerPixel); + cache_put_desktop(offset, cx, cy, cx, TOBYTES(server->serverFormat.bitsPerPixel), + (buf->data)); +} + +void +ui_desktop_restore(uint32 offset, int x, int y, int cx, int cy) +{ + uint8 *data; + vncBuffer *buf; + int ox, oy, srcx, srcy; + + srcx = srcy = 0; + ox = x; + oy = y; + + offset *= TOBYTES(server->serverFormat.bitsPerPixel); + data = cache_get_desktop(offset, cx, cy, TOBYTES(server->serverFormat.bitsPerPixel)); + if (data == NULL) + return; + + buf = vncNewBuffer(cx, cy, 8); + memcpy(buf->data, data, cx * cy * 1); + + if (vncwinClipRect(&x, &y, &cx, &cy)) + { + srcx += x - ox; + srcy += y - oy; + vncCopyBlitFrom(server, x, y, cx, cy, buf, srcx, srcy); + } + vncDeleteBuffer(buf); +} + +rfbPixelFormat vnc_formats[] = { + /* bpp, depth,BE,TC, rmax, gmax, bmax, rsh, gsh, bsh */ + {8, 8, 1, 0, 7, 7, 3, 0, 3, 6} + , + {16, 16, 1, 1, 31, 63, 31, 0, 5, 10} + , + {32, 24, 1, 1, 255, 255, 255, 0, 8, 16} + , //non-existant + {32, 32, 1, 1, 2047, 2047, 1023, 0, 11, 22} +}; + +rfbPixelFormat * +vncNewFormat(int depth) +{ + return &(vnc_formats[(depth + 1) / 8 - 1]); +} + +vncBuffer * +vncNewBuffer(int w, int h, int depth) +{ + vncBuffer *b = (vncBuffer *) xmalloc(sizeof(vncBuffer)); + b->format = vncNewFormat(depth); + b->data = (void *) xmalloc(w * h * (b->format->bitsPerPixel / 8)); + b->owner = 1; + b->w = w; + b->h = h; + b->linew = w; + return b; +} + +vncBuffer * +vncDupBuffer(vncBuffer * b) +{ + vncBuffer *buf = vncNewBuffer(b->w, b->h, b->format->depth); + memcpy(buf->data, b->data, b->linew * b->h * b->format->bitsPerPixel / 8); + return buf; +} + +void +vncPrintStats() +{ + if (server && server->clientHead) + rfbPrintStats(server->clientHead); +} + +/* blit */ + +#define GETPIXEL(buf,x,y) \ + (((uint8_t*)(buf->data))[(x)+((y)*buf->linew)]) +#define SETPIXEL(buf,x,y,p) \ + (((uint8_t*)(buf->data))[(x)+((y)*buf->linew)] = (uint8_t)p) + +void +vncCopyBlitFromNoEncode(rfbScreenInfoPtr s, int x, int y, int w, int h, + vncBuffer * src, int srcx, int srcy) +{ + int xx, yy; + + vncHideCursor(); + + if (s->serverFormat.bitsPerPixel == src->format->bitsPerPixel + && srcx + w <= src->w && srcy + h <= src->h) + { + //simple copy + uint8_t *srcdata, *dstdata; + srcdata = src->data + (srcy * src->linew + srcx); + dstdata = s->frameBuffer + (y * s->paddedWidthInBytes + x); + for (yy = 0; yy < h; yy++) + { + memcpy(dstdata, srcdata, w); + dstdata += s->paddedWidthInBytes; + srcdata += src->linew; + } + } + else + { + // xsrc,ysrc provide tiling copy support. + for (yy = y; yy < y + h; yy++) + { + int ysrc = srcy + yy - y; + while (ysrc >= src->h) + ysrc -= src->h; + for (xx = x; xx < x + w; xx++) + { + vncPixel p; + int xsrc = srcx + xx - x; + while (xsrc >= src->linew) + xsrc -= src->linew; + p = GETPIXEL(src, xsrc, ysrc); + SETPIXEL(frameBuffer, xx, yy, p); + } + } + } +} + +void +vncCopyBlit(rfbScreenInfoPtr s, int x, int y, int w, int h, int srcx, int srcy) +{ + /* LibVNCServer already knows how to copy the data. */ + rfbDoCopyRect(s, x, y, x + w, y + h, x - srcx, y - srcy); +} + +void +vncCopyBlitFrom(rfbScreenInfoPtr s, int x, int y, int w, int h, vncBuffer * src, int srcx, int srcy) +{ + vncCopyBlitFromNoEncode(s, x, y, w, h, src, srcx, srcy); + rfbMarkRectAsModified(s, x, y, x + w, y + h); +} + +void +vncTransBlitFrom(rfbScreenInfoPtr s, int x, int y, int w, int h, + vncBuffer * src, int srcx, int srcy, int bg) +{ + int xx, yy; + + vncHideCursor(); + + // xsrc,ysrc provide tiling copy support. + for (yy = y; yy < y + h; yy++) + { + int ysrc = srcy + yy - y; + while (ysrc >= src->h) + ysrc -= src->h; + for (xx = x; xx < x + w; xx++) + { + vncPixel p; + int xsrc = srcx + xx - x; + while (xsrc >= src->linew) + xsrc -= src->linew; + p = GETPIXEL(src, xsrc, ysrc); + // transparent blit! + if (p != bg) + SETPIXEL(frameBuffer, xx, yy, p); + } + } + + rfbMarkRectAsModified(s, x, y, x + w, y + h); +} + +void +vncXorBlitFrom(rfbScreenInfoPtr s, int x, int y, int w, int h, vncBuffer * src, int srcx, int srcy) +{ + int xx, yy; + + vncHideCursor(); + + // xsrc,ysrc provide tiling copy support. + for (yy = y; yy < y + h; yy++) + { + int ysrc = srcy + yy - y; + while (ysrc >= src->h) + ysrc -= src->h; + for (xx = x; xx < x + w; xx++) + { + vncPixel p, pp; + int xsrc = srcx + xx - x; + while (xsrc >= src->linew) + xsrc -= src->linew; + p = GETPIXEL(src, xsrc, ysrc); + pp = GETPIXEL(frameBuffer, xx, yy); + // xor blit! + SETPIXEL(frameBuffer, xx, yy, p ^ pp); + } + } + + rfbMarkRectAsModified(s, x, y, x + w, y + h); +} + +void +vncAndBlitFrom(rfbScreenInfoPtr s, int x, int y, int w, int h, vncBuffer * src, int srcx, int srcy) +{ + int xx, yy; + + vncHideCursor(); + + // xsrc,ysrc provide tiling copy support. + for (yy = y; yy < y + h; yy++) + { + int ysrc = srcy + yy - y; + while (ysrc >= src->h) + ysrc -= src->h; + for (xx = x; xx < x + w; xx++) + { + vncPixel p, pp; + int xsrc = srcx + xx - x; + while (xsrc >= src->linew) + xsrc -= src->linew; + p = GETPIXEL(src, xsrc, ysrc); + pp = GETPIXEL(frameBuffer, xx, yy); + // and blit! + SETPIXEL(frameBuffer, xx, yy, p & pp); + } + } + + rfbMarkRectAsModified(s, x, y, x + w, y + h); +} + +void +vncDeleteBuffer(vncBuffer * b) +{ + if (b->owner) + xfree(b->data); + xfree(b); +} + +/* cursor */ +rfbCursorPtr +vncNewCursor(vncBuffer * mask, vncBuffer * pointer, int hotx, int hoty) +{ + int i, j, w = (mask->w + 7) / 8, mask_size = w * mask->h, + pointer_size = pointer->w * pointer->h; + rfbCursorPtr c = (rfbCursorPtr) xmalloc(sizeof(rfbCursor)); + + if (mask->w != pointer->w || mask->h != pointer->h) + error("ERROR! Mask is %dx%d, Pointer is %dx%d\n", + mask->w, mask->h, pointer->w, pointer->h); + + c->xhot = hotx; + c->yhot = hoty; + c->width = mask->w; + c->height = mask->h; + + c->mask = (char *) xmalloc(mask_size); + for (j = 0; j < c->height; j++) + for (i = 0; i < w; i++) + c->mask[j * w + i] = + reverseByte[((unsigned char *) mask->data)[(j) * w + i]]; + vncDeleteBuffer(mask); + + c->source = 0; + c->richSource = (char *) xmalloc(pointer_size); + memcpy(c->richSource, pointer->data, pointer_size); + vncDeleteBuffer(pointer); + + return c; +} + +/* No FreeCursor, because the cursors are buffered. We only get a "HANDLE" */ +void +vncSetCursor(rfbScreenInfoPtr s, rfbCursorPtr c) +{ + rfbSetCursor(s, c, FALSE); +} + +/* these functions work even if vncBuffer's pixel format is not 1 byte/pixel */ +vncPixel +vncGetPixel(vncBuffer * b, int x, int y) +{ + unsigned long offset = (x + (y * (b->linew))) * (b->format->bitsPerPixel >> 3); + return ((uint8_t *) (b->data))[offset]; +} + +void +vncSetPixel(vncBuffer * b, int x, int y, vncPixel c) +{ + unsigned long offset = (x + (y * (b->linew))) * (b->format->bitsPerPixel >> 3); + ((uint8_t *) (b->data))[offset] = c; +} + +void +vncSetRect(rfbScreenInfoPtr s, int x, int y, int w, int h, vncPixel c) +{ + int xx, yy; + + if (x + w > s->width) + w = s->width - x; + if (y + h > s->height) + h = s->height - y; + if (w <= 0 || h <= 0) + return; + + vncHideCursor(); + + // - Fill the rect in the local framebuffer + if (s->serverFormat.bitsPerPixel == 8) + { + // - Simple 8-bit fill + uint8_t *dstdata; + dstdata = s->frameBuffer + (y * s->paddedWidthInBytes + x); + for (yy = 0; yy < h; yy++) + { + memset(dstdata, c, w); + dstdata += s->paddedWidthInBytes; + } + } + else + { + for (yy = y; yy < y + h; yy++) + { + for (xx = x; xx < x + w; xx++) + { + SETPIXEL(frameBuffer, xx, yy, c); + } + } + } + + rfbMarkRectAsModified(s, x, y, x + w, y + h); +} + +vncBuffer * +vncGetRect(rfbScreenInfoPtr s, int x, int y, int w, int h) +{ + int xx, yy; + vncBuffer *b = vncNewBuffer(w, h, s->serverFormat.depth); + + vncHideCursor(); + + if (s->serverFormat.bitsPerPixel == 8) + { + //simple copy + int srcstep, dststep; + char *srcdata, *dstdata; + srcstep = s->paddedWidthInBytes * s->serverFormat.bitsPerPixel / 8; + dststep = w * s->serverFormat.bitsPerPixel / 8; + dstdata = b->data; + srcdata = s->frameBuffer + (y * srcstep + x * s->serverFormat.bitsPerPixel / 8); + for (yy = 0; yy < h; yy++) + { + memcpy(dstdata, srcdata, dststep); + dstdata += dststep; + srcdata += srcstep; + } + } + else + { + for (yy = y; yy < y + h; yy++) + { + for (xx = x; xx < x + w; xx++) + { + SETPIXEL(b, xx - x, yy - y, GETPIXEL(frameBuffer, xx, yy)); + } + } + } + + return b; +} + +/* colourmap */ + +rfbColourMap * +vncNewColourMap(rfbScreenInfoPtr s, int n) +{ + rfbColourMap *m = (rfbColourMap *) xmalloc(sizeof(rfbColourMap)); + m->is16 = FALSE; + m->count = n; + m->data.bytes = (uint8_t *) xmalloc(n * 3); + return m; +} + +void +vncSetColourMapEntry(rfbColourMap * m, int i, vncPixel r, vncPixel g, vncPixel b) +{ + if (i < m->count) + { + m->data.bytes[3 * i + 0] = r; + m->data.bytes[3 * i + 1] = g; + m->data.bytes[3 * i + 2] = b; + } +} + +void +vncDeleteColourMap(rfbColourMap * m) +{ + if (m->data.bytes) + free(m->data.bytes); + m->count = 0; +} + +void +vncSetColourMap(rfbScreenInfoPtr s, rfbColourMap * m) +{ + vncDeleteColourMap(&s->colourMap); + s->colourMap = *m; + rfbSetClientColourMaps(s, 0, 0); +} + +void +ui_begin_update() +{ +} + +void +ui_end_update() +{ +} + +void +ui_resize_window() +{ + rfbClientIteratorPtr iter; + rfbClientPtr cl; + + server->width = g_width; + server->height = g_height; + server->frameBuffer = (char *) realloc(server->frameBuffer, g_width * g_height); + server->paddedWidthInBytes = g_width; + + iter = rfbGetClientIterator(server); + while ((cl = rfbClientIteratorNext(iter))) + if (cl->useNewFBSize) + cl->newFBSizePending = TRUE; + else + rfbLog("Warning: Client %s does not support NewFBSize!\n ", cl->host); + rfbReleaseClientIterator(iter); +} --- rdesktop-1.5.0.orig/vnc/vnc.h +++ rdesktop-1.5.0/vnc/vnc.h @@ -0,0 +1,68 @@ +#ifndef VNC_H +#define VNC_H + +#define BOOL rfb_BOOL +#include <rfb/rfb.h> +#undef BOOL + +typedef unsigned int vncPixel; + +typedef struct +{ + uint16_t w, h; + uint16_t linew; + rfbPixelFormat *format; + char *data; + BOOL owner; +} +vncBuffer; + +extern int vncPreparedClientSocket; +extern int vncPreparedServerSocket; + +/* - Buffer management */ +extern vncBuffer *vncNewBuffer(int w, int h, int depth); +extern vncBuffer *vncDupBuffer(vncBuffer * b); +extern void vncDeleteBuffer(vncBuffer * b); + +/* - Colourmaps */ +typedef struct +{ + uint8_t r, g, b; +} +vncColour; + +extern void vncSetColourMap(rfbScreenInfoPtr s, rfbColourMap * m); +extern rfbColourMap *vncNewColourMap(rfbScreenInfoPtr s, int n); +extern void vncSetColourMapEntry(rfbColourMap * m, int i, vncPixel r, vncPixel g, vncPixel b); +extern void vncDeleteColourMap(rfbColourMap * m); + +/* - Simple pixel manipulation */ +extern vncPixel vncGetPixel(vncBuffer * b, int x, int y); +extern void vncSetPixel(vncBuffer * b, int x, int y, vncPixel c); + +/* - Drawing primitives */ +extern void vncSetRect(rfbScreenInfoPtr s, int x, int y, int w, int h, vncPixel c); +extern void vncCopyBlit(rfbScreenInfoPtr s, int x, int y, int w, int h, int srcx, int srcy); +extern void vncCopyBlitFrom(rfbScreenInfoPtr s, int x, int y, int w, int h, + vncBuffer * b, int srcx, int srcy); +extern void vncTransBlitFrom(rfbScreenInfoPtr s, int x, int y, int w, int h, + vncBuffer * b, int srcx, int srcy, int bg); +extern void vncXorBlitFrom(rfbScreenInfoPtr s, int x, int y, int w, int h, + vncBuffer * b, int srcx, int srcy); +extern void vncAndBlitFrom(rfbScreenInfoPtr s, int x, int y, int w, int h, + vncBuffer * b, int srcx, int srcy); +extern vncBuffer *vncGetRect(rfbScreenInfoPtr s, int x, int y, int w, int h); + +// - Low level VNC update primitives upon which the rest are based +extern void vncQueueCopyRect(rfbScreenInfoPtr s, int x, int y, int w, int h, int src_x, int src_y); +extern void vncQueueUpdate(rfbScreenInfoPtr s, int x, int y, int w, int h); + +/* cursor */ +extern rfbCursorPtr vncNewCursor(vncBuffer * mask, vncBuffer * pointer, int hotx, int hoty); +extern void vncSetCursor(rfbScreenInfoPtr s, rfbCursorPtr c); + +int vncListenAtTcpAddr(unsigned short port); +void vncPrintStats(); + +#endif --- rdesktop-1.5.0.orig/vnc/x11stubs.c +++ rdesktop-1.5.0/vnc/x11stubs.c @@ -0,0 +1,1405 @@ +/* + +This file fakes some of X11's key handling for the special purpose of running +a standalone rdp2vnc (without linking to X11) + +*/ + +#include "x11stubs.h" +#include <string.h> + +/* ignored */ +int *display; + +typedef struct +{ + const char *string; + KeySym keysym; +} +StringToKeysym_t; + +StringToKeysym_t StringToKeysym[] = { +#ifndef KEYSYMFAKE_H + {"VoidSymbol", XK_VoidSymbol}, +#ifdef XK_MISCELLANY + {"BackSpace", XK_BackSpace}, + {"Tab", XK_Tab}, + {"Linefeed", XK_Linefeed}, + {"Clear", XK_Clear}, + {"Return", XK_Return}, + {"Pause", XK_Pause}, + {"Scroll_Lock", XK_Scroll_Lock}, + {"Sys_Req", XK_Sys_Req}, + {"Escape", XK_Escape}, + {"Delete", XK_Delete}, + {"Multi_key", XK_Multi_key}, + {"SingleCandidate", XK_SingleCandidate}, + {"MultipleCandidate", XK_MultipleCandidate}, + {"PreviousCandidate", XK_PreviousCandidate}, + {"Kanji", XK_Kanji}, + {"Muhenkan", XK_Muhenkan}, + {"Henkan_Mode", XK_Henkan_Mode}, + {"Henkan", XK_Henkan}, + {"Romaji", XK_Romaji}, + {"Hiragana", XK_Hiragana}, + {"Katakana", XK_Katakana}, + {"Hiragana_Katakana", XK_Hiragana_Katakana}, + {"Zenkaku", XK_Zenkaku}, + {"Hankaku", XK_Hankaku}, + {"Zenkaku_Hankaku", XK_Zenkaku_Hankaku}, + {"Touroku", XK_Touroku}, + {"Massyo", XK_Massyo}, + {"Kana_Lock", XK_Kana_Lock}, + {"Kana_Shift", XK_Kana_Shift}, + {"Eisu_Shift", XK_Eisu_Shift}, + {"Eisu_toggle", XK_Eisu_toggle}, + {"Zen_Koho", XK_Zen_Koho}, + {"Mae_Koho", XK_Mae_Koho}, + {"Home", XK_Home}, + {"Left", XK_Left}, + {"Up", XK_Up}, + {"Right", XK_Right}, + {"Down", XK_Down}, + {"Prior", XK_Prior}, + {"Page_Up", XK_Page_Up}, + {"Next", XK_Next}, + {"Page_Down", XK_Page_Down}, + {"End", XK_End}, + {"Begin", XK_Begin}, + {"Select", XK_Select}, + {"Print", XK_Print}, + {"Execute", XK_Execute}, + {"Insert", XK_Insert}, + {"Undo", XK_Undo}, + {"Redo", XK_Redo}, + {"Menu", XK_Menu}, + {"Find", XK_Find}, + {"Cancel", XK_Cancel}, + {"Help", XK_Help}, + {"Break", XK_Break}, + {"Mode_switch", XK_Mode_switch}, + {"script_switch", XK_script_switch}, + {"Num_Lock", XK_Num_Lock}, + {"KP_Space", XK_KP_Space}, + {"KP_Tab", XK_KP_Tab}, + {"KP_Enter", XK_KP_Enter}, + {"KP_F1", XK_KP_F1}, + {"KP_F2", XK_KP_F2}, + {"KP_F3", XK_KP_F3}, + {"KP_F4", XK_KP_F4}, + {"KP_Home", XK_KP_Home}, + {"KP_Left", XK_KP_Left}, + {"KP_Up", XK_KP_Up}, + {"KP_Right", XK_KP_Right}, + {"KP_Down", XK_KP_Down}, + {"KP_Prior", XK_KP_Prior}, + {"KP_Page_Up", XK_KP_Page_Up}, + {"KP_Next", XK_KP_Next}, + {"KP_Page_Down", XK_KP_Page_Down}, + {"KP_End", XK_KP_End}, + {"KP_Begin", XK_KP_Begin}, + {"KP_Insert", XK_KP_Insert}, + {"KP_Delete", XK_KP_Delete}, + {"KP_Equal", XK_KP_Equal}, + {"KP_Multiply", XK_KP_Multiply}, + {"KP_Add", XK_KP_Add}, + {"KP_Separator", XK_KP_Separator}, + {"KP_Subtract", XK_KP_Subtract}, + {"KP_Decimal", XK_KP_Decimal}, + {"KP_Divide", XK_KP_Divide}, + {"KP_0", XK_KP_0}, + {"KP_1", XK_KP_1}, + {"KP_2", XK_KP_2}, + {"KP_3", XK_KP_3}, + {"KP_4", XK_KP_4}, + {"KP_5", XK_KP_5}, + {"KP_6", XK_KP_6}, + {"KP_7", XK_KP_7}, + {"KP_8", XK_KP_8}, + {"KP_9", XK_KP_9}, + {"F1", XK_F1}, + {"F2", XK_F2}, + {"F3", XK_F3}, + {"F4", XK_F4}, + {"F5", XK_F5}, + {"F6", XK_F6}, + {"F7", XK_F7}, + {"F8", XK_F8}, + {"F9", XK_F9}, + {"F10", XK_F10}, + {"F11", XK_F11}, + {"L1", XK_L1}, + {"F12", XK_F12}, + {"L2", XK_L2}, + {"F13", XK_F13}, + {"L3", XK_L3}, + {"F14", XK_F14}, + {"L4", XK_L4}, + {"F15", XK_F15}, + {"L5", XK_L5}, + {"F16", XK_F16}, + {"L6", XK_L6}, + {"F17", XK_F17}, + {"L7", XK_L7}, + {"F18", XK_F18}, + {"L8", XK_L8}, + {"F19", XK_F19}, + {"L9", XK_L9}, + {"F20", XK_F20}, + {"L10", XK_L10}, + {"F21", XK_F21}, + {"R1", XK_R1}, + {"F22", XK_F22}, + {"R2", XK_R2}, + {"F23", XK_F23}, + {"R3", XK_R3}, + {"F24", XK_F24}, + {"R4", XK_R4}, + {"F25", XK_F25}, + {"R5", XK_R5}, + {"F26", XK_F26}, + {"R6", XK_R6}, + {"F27", XK_F27}, + {"R7", XK_R7}, + {"F28", XK_F28}, + {"R8", XK_R8}, + {"F29", XK_F29}, + {"R9", XK_R9}, + {"F30", XK_F30}, + {"R10", XK_R10}, + {"F31", XK_F31}, + {"R11", XK_R11}, + {"F32", XK_F32}, + {"R12", XK_R12}, + {"F33", XK_F33}, + {"R13", XK_R13}, + {"F34", XK_F34}, + {"R14", XK_R14}, + {"F35", XK_F35}, + {"R15", XK_R15}, + {"Shift_L", XK_Shift_L}, + {"Shift_R", XK_Shift_R}, + {"Control_L", XK_Control_L}, + {"Control_R", XK_Control_R}, + {"Caps_Lock", XK_Caps_Lock}, + {"Shift_Lock", XK_Shift_Lock}, + {"Meta_L", XK_Meta_L}, + {"Meta_R", XK_Meta_R}, + {"Alt_L", XK_Alt_L}, + {"Alt_R", XK_Alt_R}, + {"Super_L", XK_Super_L}, + {"Super_R", XK_Super_R}, + {"Hyper_L", XK_Hyper_L}, + {"Hyper_R", XK_Hyper_R}, +#endif /* XK_MISCELLANY */ +#ifdef XK_XKB_KEYS + {"ISO_Lock", XK_ISO_Lock}, + {"ISO_Level2_Latch", XK_ISO_Level2_Latch}, + {"ISO_Level3_Shift", XK_ISO_Level3_Shift}, + {"ISO_Level3_Latch", XK_ISO_Level3_Latch}, + {"ISO_Level3_Lock", XK_ISO_Level3_Lock}, + {"ISO_Group_Shift", XK_ISO_Group_Shift}, + {"ISO_Group_Latch", XK_ISO_Group_Latch}, + {"ISO_Group_Lock", XK_ISO_Group_Lock}, + {"ISO_Next_Group", XK_ISO_Next_Group}, + {"ISO_Next_Group_Lock", XK_ISO_Next_Group_Lock}, + {"ISO_Prev_Group", XK_ISO_Prev_Group}, + {"ISO_Prev_Group_Lock", XK_ISO_Prev_Group_Lock}, + {"ISO_First_Group", XK_ISO_First_Group}, + {"ISO_First_Group_Lock", XK_ISO_First_Group_Lock}, + {"ISO_Last_Group", XK_ISO_Last_Group}, + {"ISO_Last_Group_Lock", XK_ISO_Last_Group_Lock}, + {"ISO_Left_Tab", XK_ISO_Left_Tab}, + {"ISO_Move_Line_Up", XK_ISO_Move_Line_Up}, + {"ISO_Move_Line_Down", XK_ISO_Move_Line_Down}, + {"ISO_Partial_Line_Up", XK_ISO_Partial_Line_Up}, + {"ISO_Partial_Line_Down", XK_ISO_Partial_Line_Down}, + {"ISO_Partial_Space_Left", XK_ISO_Partial_Space_Left}, + {"ISO_Partial_Space_Right", XK_ISO_Partial_Space_Right}, + {"ISO_Set_Margin_Left", XK_ISO_Set_Margin_Left}, + {"ISO_Set_Margin_Right", XK_ISO_Set_Margin_Right}, + {"ISO_Release_Margin_Left", XK_ISO_Release_Margin_Left}, + {"ISO_Release_Margin_Right", XK_ISO_Release_Margin_Right}, + {"ISO_Release_Both_Margins", XK_ISO_Release_Both_Margins}, + {"ISO_Fast_Cursor_Left", XK_ISO_Fast_Cursor_Left}, + {"ISO_Fast_Cursor_Right", XK_ISO_Fast_Cursor_Right}, + {"ISO_Fast_Cursor_Up", XK_ISO_Fast_Cursor_Up}, + {"ISO_Fast_Cursor_Down", XK_ISO_Fast_Cursor_Down}, + {"ISO_Continuous_Underline", XK_ISO_Continuous_Underline}, + {"ISO_Discontinuous_Underline", XK_ISO_Discontinuous_Underline}, + {"ISO_Emphasize", XK_ISO_Emphasize}, + {"ISO_Center_Object", XK_ISO_Center_Object}, + {"ISO_Enter", XK_ISO_Enter}, + {"dead_grave", XK_dead_grave}, + {"dead_acute", XK_dead_acute}, + {"dead_circumflex", XK_dead_circumflex}, + {"dead_tilde", XK_dead_tilde}, + {"dead_macron", XK_dead_macron}, + {"dead_breve", XK_dead_breve}, + {"dead_abovedot", XK_dead_abovedot}, + {"dead_diaeresis", XK_dead_diaeresis}, + {"dead_abovering", XK_dead_abovering}, + {"dead_doubleacute", XK_dead_doubleacute}, + {"dead_caron", XK_dead_caron}, + {"dead_cedilla", XK_dead_cedilla}, + {"dead_ogonek", XK_dead_ogonek}, + {"dead_iota", XK_dead_iota}, + {"dead_voiced_sound", XK_dead_voiced_sound}, + {"dead_semivoiced_sound", XK_dead_semivoiced_sound}, + {"dead_belowdot", XK_dead_belowdot}, + {"First_Virtual_Screen", XK_First_Virtual_Screen}, + {"Prev_Virtual_Screen", XK_Prev_Virtual_Screen}, + {"Next_Virtual_Screen", XK_Next_Virtual_Screen}, + {"Last_Virtual_Screen", XK_Last_Virtual_Screen}, + {"Terminate_Server", XK_Terminate_Server}, + {"AccessX_Enable", XK_AccessX_Enable}, + {"AccessX_Feedback_Enable", XK_AccessX_Feedback_Enable}, + {"RepeatKeys_Enable", XK_RepeatKeys_Enable}, + {"SlowKeys_Enable", XK_SlowKeys_Enable}, + {"BounceKeys_Enable", XK_BounceKeys_Enable}, + {"StickyKeys_Enable", XK_StickyKeys_Enable}, + {"MouseKeys_Enable", XK_MouseKeys_Enable}, + {"MouseKeys_Accel_Enable", XK_MouseKeys_Accel_Enable}, + {"Overlay1_Enable", XK_Overlay1_Enable}, + {"Overlay2_Enable", XK_Overlay2_Enable}, + {"AudibleBell_Enable", XK_AudibleBell_Enable}, + {"Pointer_Left", XK_Pointer_Left}, + {"Pointer_Right", XK_Pointer_Right}, + {"Pointer_Up", XK_Pointer_Up}, + {"Pointer_Down", XK_Pointer_Down}, + {"Pointer_UpLeft", XK_Pointer_UpLeft}, + {"Pointer_UpRight", XK_Pointer_UpRight}, + {"Pointer_DownLeft", XK_Pointer_DownLeft}, + {"Pointer_DownRight", XK_Pointer_DownRight}, + {"Pointer_Button_Dflt", XK_Pointer_Button_Dflt}, + {"Pointer_Button1", XK_Pointer_Button1}, + {"Pointer_Button2", XK_Pointer_Button2}, + {"Pointer_Button3", XK_Pointer_Button3}, + {"Pointer_Button4", XK_Pointer_Button4}, + {"Pointer_Button5", XK_Pointer_Button5}, + {"Pointer_DblClick_Dflt", XK_Pointer_DblClick_Dflt}, + {"Pointer_DblClick1", XK_Pointer_DblClick1}, + {"Pointer_DblClick2", XK_Pointer_DblClick2}, + {"Pointer_DblClick3", XK_Pointer_DblClick3}, + {"Pointer_DblClick4", XK_Pointer_DblClick4}, + {"Pointer_DblClick5", XK_Pointer_DblClick5}, + {"Pointer_Drag_Dflt", XK_Pointer_Drag_Dflt}, + {"Pointer_Drag1", XK_Pointer_Drag1}, + {"Pointer_Drag2", XK_Pointer_Drag2}, + {"Pointer_Drag3", XK_Pointer_Drag3}, + {"Pointer_Drag4", XK_Pointer_Drag4}, + {"Pointer_Drag5", XK_Pointer_Drag5}, + {"Pointer_EnableKeys", XK_Pointer_EnableKeys}, + {"Pointer_Accelerate", XK_Pointer_Accelerate}, + {"Pointer_DfltBtnNext", XK_Pointer_DfltBtnNext}, + {"Pointer_DfltBtnPrev", XK_Pointer_DfltBtnPrev}, +#endif +#ifdef XK_3270 + {"3270_Duplicate", XK_3270_Duplicate}, + {"3270_FieldMark", XK_3270_FieldMark}, + {"3270_Right2", XK_3270_Right2}, + {"3270_Left2", XK_3270_Left2}, + {"3270_BackTab", XK_3270_BackTab}, + {"3270_EraseEOF", XK_3270_EraseEOF}, + {"3270_EraseInput", XK_3270_EraseInput}, + {"3270_Reset", XK_3270_Reset}, + {"3270_Quit", XK_3270_Quit}, + {"3270_PA1", XK_3270_PA1}, + {"3270_PA2", XK_3270_PA2}, + {"3270_PA3", XK_3270_PA3}, + {"3270_Test", XK_3270_Test}, + {"3270_Attn", XK_3270_Attn}, + {"3270_CursorBlink", XK_3270_CursorBlink}, + {"3270_AltCursor", XK_3270_AltCursor}, + {"3270_KeyClick", XK_3270_KeyClick}, + {"3270_Jump", XK_3270_Jump}, + {"3270_Ident", XK_3270_Ident}, + {"3270_Rule", XK_3270_Rule}, + {"3270_Copy", XK_3270_Copy}, + {"3270_Play", XK_3270_Play}, + {"3270_Setup", XK_3270_Setup}, + {"3270_Record", XK_3270_Record}, + {"3270_ChangeScreen", XK_3270_ChangeScreen}, + {"3270_DeleteWord", XK_3270_DeleteWord}, + {"3270_ExSelect", XK_3270_ExSelect}, + {"3270_CursorSelect", XK_3270_CursorSelect}, + {"3270_PrintScreen", XK_3270_PrintScreen}, + {"3270_Enter", XK_3270_Enter}, +#endif +#ifdef XK_LATIN1 + {"space", XK_space}, + {"exclam", XK_exclam}, + {"quotedbl", XK_quotedbl}, + {"numbersign", XK_numbersign}, + {"dollar", XK_dollar}, + {"percent", XK_percent}, + {"ampersand", XK_ampersand}, + {"apostrophe", XK_apostrophe}, + {"quoteright", XK_quoteright}, + {"parenleft", XK_parenleft}, + {"parenright", XK_parenright}, + {"asterisk", XK_asterisk}, + {"plus", XK_plus}, + {"comma", XK_comma}, + {"minus", XK_minus}, + {"period", XK_period}, + {"slash", XK_slash}, + {"0", XK_0}, + {"1", XK_1}, + {"2", XK_2}, + {"3", XK_3}, + {"4", XK_4}, + {"5", XK_5}, + {"6", XK_6}, + {"7", XK_7}, + {"8", XK_8}, + {"9", XK_9}, + {"colon", XK_colon}, + {"semicolon", XK_semicolon}, + {"less", XK_less}, + {"equal", XK_equal}, + {"greater", XK_greater}, + {"question", XK_question}, + {"at", XK_at}, + {"A", XK_A}, + {"B", XK_B}, + {"C", XK_C}, + {"D", XK_D}, + {"E", XK_E}, + {"F", XK_F}, + {"G", XK_G}, + {"H", XK_H}, + {"I", XK_I}, + {"J", XK_J}, + {"K", XK_K}, + {"L", XK_L}, + {"M", XK_M}, + {"N", XK_N}, + {"O", XK_O}, + {"P", XK_P}, + {"Q", XK_Q}, + {"R", XK_R}, + {"S", XK_S}, + {"T", XK_T}, + {"U", XK_U}, + {"V", XK_V}, + {"W", XK_W}, + {"X", XK_X}, + {"Y", XK_Y}, + {"Z", XK_Z}, + {"bracketleft", XK_bracketleft}, + {"backslash", XK_backslash}, + {"bracketright", XK_bracketright}, + {"asciicircum", XK_asciicircum}, + {"underscore", XK_underscore}, + {"grave", XK_grave}, + {"quoteleft", XK_quoteleft}, + {"a", XK_a}, + {"b", XK_b}, + {"c", XK_c}, + {"d", XK_d}, + {"e", XK_e}, + {"f", XK_f}, + {"g", XK_g}, + {"h", XK_h}, + {"i", XK_i}, + {"j", XK_j}, + {"k", XK_k}, + {"l", XK_l}, + {"m", XK_m}, + {"n", XK_n}, + {"o", XK_o}, + {"p", XK_p}, + {"q", XK_q}, + {"r", XK_r}, + {"s", XK_s}, + {"t", XK_t}, + {"u", XK_u}, + {"v", XK_v}, + {"w", XK_w}, + {"x", XK_x}, + {"y", XK_y}, + {"z", XK_z}, + {"braceleft", XK_braceleft}, + {"bar", XK_bar}, + {"braceright", XK_braceright}, + {"asciitilde", XK_asciitilde}, + {"nobreakspace", XK_nobreakspace}, + {"exclamdown", XK_exclamdown}, + {"cent", XK_cent}, + {"sterling", XK_sterling}, + {"currency", XK_currency}, + {"yen", XK_yen}, + {"brokenbar", XK_brokenbar}, + {"section", XK_section}, + {"diaeresis", XK_diaeresis}, + {"copyright", XK_copyright}, + {"ordfeminine", XK_ordfeminine}, + {"guillemotleft", XK_guillemotleft}, + {"notsign", XK_notsign}, + {"hyphen", XK_hyphen}, + {"registered", XK_registered}, + {"macron", XK_macron}, + {"degree", XK_degree}, + {"plusminus", XK_plusminus}, + {"twosuperior", XK_twosuperior}, + {"threesuperior", XK_threesuperior}, + {"acute", XK_acute}, + {"mu", XK_mu}, + {"paragraph", XK_paragraph}, + {"periodcentered", XK_periodcentered}, + {"cedilla", XK_cedilla}, + {"onesuperior", XK_onesuperior}, + {"masculine", XK_masculine}, + {"guillemotright", XK_guillemotright}, + {"onequarter", XK_onequarter}, + {"onehalf", XK_onehalf}, + {"threequarters", XK_threequarters}, + {"questiondown", XK_questiondown}, + {"Agrave", XK_Agrave}, + {"Aacute", XK_Aacute}, + {"Acircumflex", XK_Acircumflex}, + {"Atilde", XK_Atilde}, + {"Adiaeresis", XK_Adiaeresis}, + {"Aring", XK_Aring}, + {"AE", XK_AE}, + {"Ccedilla", XK_Ccedilla}, + {"Egrave", XK_Egrave}, + {"Eacute", XK_Eacute}, + {"Ecircumflex", XK_Ecircumflex}, + {"Ediaeresis", XK_Ediaeresis}, + {"Igrave", XK_Igrave}, + {"Iacute", XK_Iacute}, + {"Icircumflex", XK_Icircumflex}, + {"Idiaeresis", XK_Idiaeresis}, + {"ETH", XK_ETH}, + {"Eth", XK_Eth}, + {"Ntilde", XK_Ntilde}, + {"Ograve", XK_Ograve}, + {"Oacute", XK_Oacute}, + {"Ocircumflex", XK_Ocircumflex}, + {"Otilde", XK_Otilde}, + {"Odiaeresis", XK_Odiaeresis}, + {"multiply", XK_multiply}, + {"Ooblique", XK_Ooblique}, + {"Ugrave", XK_Ugrave}, + {"Uacute", XK_Uacute}, + {"Ucircumflex", XK_Ucircumflex}, + {"Udiaeresis", XK_Udiaeresis}, + {"Yacute", XK_Yacute}, + {"THORN", XK_THORN}, + {"Thorn", XK_Thorn}, + {"ssharp", XK_ssharp}, + {"agrave", XK_agrave}, + {"aacute", XK_aacute}, + {"acircumflex", XK_acircumflex}, + {"atilde", XK_atilde}, + {"adiaeresis", XK_adiaeresis}, + {"aring", XK_aring}, + {"ae", XK_ae}, + {"ccedilla", XK_ccedilla}, + {"egrave", XK_egrave}, + {"eacute", XK_eacute}, + {"ecircumflex", XK_ecircumflex}, + {"ediaeresis", XK_ediaeresis}, + {"igrave", XK_igrave}, + {"iacute", XK_iacute}, + {"icircumflex", XK_icircumflex}, + {"idiaeresis", XK_idiaeresis}, + {"eth", XK_eth}, + {"ntilde", XK_ntilde}, + {"ograve", XK_ograve}, + {"oacute", XK_oacute}, + {"ocircumflex", XK_ocircumflex}, + {"otilde", XK_otilde}, + {"odiaeresis", XK_odiaeresis}, + {"division", XK_division}, + {"oslash", XK_oslash}, + {"ugrave", XK_ugrave}, + {"uacute", XK_uacute}, + {"ucircumflex", XK_ucircumflex}, + {"udiaeresis", XK_udiaeresis}, + {"yacute", XK_yacute}, + {"thorn", XK_thorn}, + {"ydiaeresis", XK_ydiaeresis}, +#endif /* XK_LATIN1 */ +#ifdef XK_LATIN2 + {"Aogonek", XK_Aogonek}, + {"breve", XK_breve}, + {"Lstroke", XK_Lstroke}, + {"Lcaron", XK_Lcaron}, + {"Sacute", XK_Sacute}, + {"Scaron", XK_Scaron}, + {"Scedilla", XK_Scedilla}, + {"Tcaron", XK_Tcaron}, + {"Zacute", XK_Zacute}, + {"Zcaron", XK_Zcaron}, + {"Zabovedot", XK_Zabovedot}, + {"aogonek", XK_aogonek}, + {"ogonek", XK_ogonek}, + {"lstroke", XK_lstroke}, + {"lcaron", XK_lcaron}, + {"sacute", XK_sacute}, + {"caron", XK_caron}, + {"scaron", XK_scaron}, + {"scedilla", XK_scedilla}, + {"tcaron", XK_tcaron}, + {"zacute", XK_zacute}, + {"doubleacute", XK_doubleacute}, + {"zcaron", XK_zcaron}, + {"zabovedot", XK_zabovedot}, + {"Racute", XK_Racute}, + {"Abreve", XK_Abreve}, + {"Lacute", XK_Lacute}, + {"Cacute", XK_Cacute}, + {"Ccaron", XK_Ccaron}, + {"Eogonek", XK_Eogonek}, + {"Ecaron", XK_Ecaron}, + {"Dcaron", XK_Dcaron}, + {"Dstroke", XK_Dstroke}, + {"Nacute", XK_Nacute}, + {"Ncaron", XK_Ncaron}, + {"Odoubleacute", XK_Odoubleacute}, + {"Rcaron", XK_Rcaron}, + {"Uring", XK_Uring}, + {"Udoubleacute", XK_Udoubleacute}, + {"Tcedilla", XK_Tcedilla}, + {"racute", XK_racute}, + {"abreve", XK_abreve}, + {"lacute", XK_lacute}, + {"cacute", XK_cacute}, + {"ccaron", XK_ccaron}, + {"eogonek", XK_eogonek}, + {"ecaron", XK_ecaron}, + {"dcaron", XK_dcaron}, + {"dstroke", XK_dstroke}, + {"nacute", XK_nacute}, + {"ncaron", XK_ncaron}, + {"odoubleacute", XK_odoubleacute}, + {"udoubleacute", XK_udoubleacute}, + {"rcaron", XK_rcaron}, + {"uring", XK_uring}, + {"tcedilla", XK_tcedilla}, + {"abovedot", XK_abovedot}, +#endif /* XK_LATIN2 */ +#ifdef XK_LATIN3 + {"Hstroke", XK_Hstroke}, + {"Hcircumflex", XK_Hcircumflex}, + {"Iabovedot", XK_Iabovedot}, + {"Gbreve", XK_Gbreve}, + {"Jcircumflex", XK_Jcircumflex}, + {"hstroke", XK_hstroke}, + {"hcircumflex", XK_hcircumflex}, + {"idotless", XK_idotless}, + {"gbreve", XK_gbreve}, + {"jcircumflex", XK_jcircumflex}, + {"Cabovedot", XK_Cabovedot}, + {"Ccircumflex", XK_Ccircumflex}, + {"Gabovedot", XK_Gabovedot}, + {"Gcircumflex", XK_Gcircumflex}, + {"Ubreve", XK_Ubreve}, + {"Scircumflex", XK_Scircumflex}, + {"cabovedot", XK_cabovedot}, + {"ccircumflex", XK_ccircumflex}, + {"gabovedot", XK_gabovedot}, + {"gcircumflex", XK_gcircumflex}, + {"ubreve", XK_ubreve}, + {"scircumflex", XK_scircumflex}, +#endif /* XK_LATIN3 */ +#ifdef XK_LATIN4 + {"kra", XK_kra}, + {"kappa", XK_kappa}, + {"Rcedilla", XK_Rcedilla}, + {"Itilde", XK_Itilde}, + {"Lcedilla", XK_Lcedilla}, + {"Emacron", XK_Emacron}, + {"Gcedilla", XK_Gcedilla}, + {"Tslash", XK_Tslash}, + {"rcedilla", XK_rcedilla}, + {"itilde", XK_itilde}, + {"lcedilla", XK_lcedilla}, + {"emacron", XK_emacron}, + {"gcedilla", XK_gcedilla}, + {"tslash", XK_tslash}, + {"ENG", XK_ENG}, + {"eng", XK_eng}, + {"Amacron", XK_Amacron}, + {"Iogonek", XK_Iogonek}, + {"Eabovedot", XK_Eabovedot}, + {"Imacron", XK_Imacron}, + {"Ncedilla", XK_Ncedilla}, + {"Omacron", XK_Omacron}, + {"Kcedilla", XK_Kcedilla}, + {"Uogonek", XK_Uogonek}, + {"Utilde", XK_Utilde}, + {"Umacron", XK_Umacron}, + {"amacron", XK_amacron}, + {"iogonek", XK_iogonek}, + {"eabovedot", XK_eabovedot}, + {"imacron", XK_imacron}, + {"ncedilla", XK_ncedilla}, + {"omacron", XK_omacron}, + {"kcedilla", XK_kcedilla}, + {"uogonek", XK_uogonek}, + {"utilde", XK_utilde}, + {"umacron", XK_umacron}, +#endif /* XK_LATIN4 */ +#ifdef XK_KATAKANA + {"overline", XK_overline}, + {"kana_fullstop", XK_kana_fullstop}, + {"kana_openingbracket", XK_kana_openingbracket}, + {"kana_closingbracket", XK_kana_closingbracket}, + {"kana_comma", XK_kana_comma}, + {"kana_conjunctive", XK_kana_conjunctive}, + {"kana_middledot", XK_kana_middledot}, + {"kana_WO", XK_kana_WO}, + {"kana_a", XK_kana_a}, + {"kana_i", XK_kana_i}, + {"kana_u", XK_kana_u}, + {"kana_e", XK_kana_e}, + {"kana_o", XK_kana_o}, + {"kana_ya", XK_kana_ya}, + {"kana_yu", XK_kana_yu}, + {"kana_yo", XK_kana_yo}, + {"kana_tsu", XK_kana_tsu}, + {"kana_tu", XK_kana_tu}, + {"prolongedsound", XK_prolongedsound}, + {"kana_A", XK_kana_A}, + {"kana_I", XK_kana_I}, + {"kana_U", XK_kana_U}, + {"kana_E", XK_kana_E}, + {"kana_O", XK_kana_O}, + {"kana_KA", XK_kana_KA}, + {"kana_KI", XK_kana_KI}, + {"kana_KU", XK_kana_KU}, + {"kana_KE", XK_kana_KE}, + {"kana_KO", XK_kana_KO}, + {"kana_SA", XK_kana_SA}, + {"kana_SHI", XK_kana_SHI}, + {"kana_SU", XK_kana_SU}, + {"kana_SE", XK_kana_SE}, + {"kana_SO", XK_kana_SO}, + {"kana_TA", XK_kana_TA}, + {"kana_CHI", XK_kana_CHI}, + {"kana_TI", XK_kana_TI}, + {"kana_TSU", XK_kana_TSU}, + {"kana_TU", XK_kana_TU}, + {"kana_TE", XK_kana_TE}, + {"kana_TO", XK_kana_TO}, + {"kana_NA", XK_kana_NA}, + {"kana_NI", XK_kana_NI}, + {"kana_NU", XK_kana_NU}, + {"kana_NE", XK_kana_NE}, + {"kana_NO", XK_kana_NO}, + {"kana_HA", XK_kana_HA}, + {"kana_HI", XK_kana_HI}, + {"kana_FU", XK_kana_FU}, + {"kana_HU", XK_kana_HU}, + {"kana_HE", XK_kana_HE}, + {"kana_HO", XK_kana_HO}, + {"kana_MA", XK_kana_MA}, + {"kana_MI", XK_kana_MI}, + {"kana_MU", XK_kana_MU}, + {"kana_ME", XK_kana_ME}, + {"kana_MO", XK_kana_MO}, + {"kana_YA", XK_kana_YA}, + {"kana_YU", XK_kana_YU}, + {"kana_YO", XK_kana_YO}, + {"kana_RA", XK_kana_RA}, + {"kana_RI", XK_kana_RI}, + {"kana_RU", XK_kana_RU}, + {"kana_RE", XK_kana_RE}, + {"kana_RO", XK_kana_RO}, + {"kana_WA", XK_kana_WA}, + {"kana_N", XK_kana_N}, + {"voicedsound", XK_voicedsound}, + {"semivoicedsound", XK_semivoicedsound}, + {"kana_switch", XK_kana_switch}, +#endif /* XK_KATAKANA */ +#ifdef XK_ARABIC + {"Arabic_comma", XK_Arabic_comma}, + {"Arabic_semicolon", XK_Arabic_semicolon}, + {"Arabic_question_mark", XK_Arabic_question_mark}, + {"Arabic_hamza", XK_Arabic_hamza}, + {"Arabic_maddaonalef", XK_Arabic_maddaonalef}, + {"Arabic_hamzaonalef", XK_Arabic_hamzaonalef}, + {"Arabic_hamzaonwaw", XK_Arabic_hamzaonwaw}, + {"Arabic_hamzaunderalef", XK_Arabic_hamzaunderalef}, + {"Arabic_hamzaonyeh", XK_Arabic_hamzaonyeh}, + {"Arabic_alef", XK_Arabic_alef}, + {"Arabic_beh", XK_Arabic_beh}, + {"Arabic_tehmarbuta", XK_Arabic_tehmarbuta}, + {"Arabic_teh", XK_Arabic_teh}, + {"Arabic_theh", XK_Arabic_theh}, + {"Arabic_jeem", XK_Arabic_jeem}, + {"Arabic_hah", XK_Arabic_hah}, + {"Arabic_khah", XK_Arabic_khah}, + {"Arabic_dal", XK_Arabic_dal}, + {"Arabic_thal", XK_Arabic_thal}, + {"Arabic_ra", XK_Arabic_ra}, + {"Arabic_zain", XK_Arabic_zain}, + {"Arabic_seen", XK_Arabic_seen}, + {"Arabic_sheen", XK_Arabic_sheen}, + {"Arabic_sad", XK_Arabic_sad}, + {"Arabic_dad", XK_Arabic_dad}, + {"Arabic_tah", XK_Arabic_tah}, + {"Arabic_zah", XK_Arabic_zah}, + {"Arabic_ain", XK_Arabic_ain}, + {"Arabic_ghain", XK_Arabic_ghain}, + {"Arabic_tatweel", XK_Arabic_tatweel}, + {"Arabic_feh", XK_Arabic_feh}, + {"Arabic_qaf", XK_Arabic_qaf}, + {"Arabic_kaf", XK_Arabic_kaf}, + {"Arabic_lam", XK_Arabic_lam}, + {"Arabic_meem", XK_Arabic_meem}, + {"Arabic_noon", XK_Arabic_noon}, + {"Arabic_ha", XK_Arabic_ha}, + {"Arabic_heh", XK_Arabic_heh}, + {"Arabic_waw", XK_Arabic_waw}, + {"Arabic_alefmaksura", XK_Arabic_alefmaksura}, + {"Arabic_yeh", XK_Arabic_yeh}, + {"Arabic_fathatan", XK_Arabic_fathatan}, + {"Arabic_dammatan", XK_Arabic_dammatan}, + {"Arabic_kasratan", XK_Arabic_kasratan}, + {"Arabic_fatha", XK_Arabic_fatha}, + {"Arabic_damma", XK_Arabic_damma}, + {"Arabic_kasra", XK_Arabic_kasra}, + {"Arabic_shadda", XK_Arabic_shadda}, + {"Arabic_sukun", XK_Arabic_sukun}, + {"Arabic_switch", XK_Arabic_switch}, +#endif /* XK_ARABIC */ +#ifdef XK_CYRILLIC + {"Serbian_dje", XK_Serbian_dje}, + {"Macedonia_gje", XK_Macedonia_gje}, + {"Cyrillic_io", XK_Cyrillic_io}, + {"Ukrainian_ie", XK_Ukrainian_ie}, + {"Ukranian_je", XK_Ukranian_je}, + {"Macedonia_dse", XK_Macedonia_dse}, + {"Ukrainian_i", XK_Ukrainian_i}, + {"Ukranian_i", XK_Ukranian_i}, + {"Ukrainian_yi", XK_Ukrainian_yi}, + {"Ukranian_yi", XK_Ukranian_yi}, + {"Cyrillic_je", XK_Cyrillic_je}, + {"Serbian_je", XK_Serbian_je}, + {"Cyrillic_lje", XK_Cyrillic_lje}, + {"Serbian_lje", XK_Serbian_lje}, + {"Cyrillic_nje", XK_Cyrillic_nje}, + {"Serbian_nje", XK_Serbian_nje}, + {"Serbian_tshe", XK_Serbian_tshe}, + {"Macedonia_kje", XK_Macedonia_kje}, + {"Byelorussian_shortu", XK_Byelorussian_shortu}, + {"Cyrillic_dzhe", XK_Cyrillic_dzhe}, + {"Serbian_dze", XK_Serbian_dze}, + {"numerosign", XK_numerosign}, + {"Serbian_DJE", XK_Serbian_DJE}, + {"Macedonia_GJE", XK_Macedonia_GJE}, + {"Cyrillic_IO", XK_Cyrillic_IO}, + {"Ukrainian_IE", XK_Ukrainian_IE}, + {"Ukranian_JE", XK_Ukranian_JE}, + {"Macedonia_DSE", XK_Macedonia_DSE}, + {"Ukrainian_I", XK_Ukrainian_I}, + {"Ukranian_I", XK_Ukranian_I}, + {"Ukrainian_YI", XK_Ukrainian_YI}, + {"Ukranian_YI", XK_Ukranian_YI}, + {"Cyrillic_JE", XK_Cyrillic_JE}, + {"Serbian_JE", XK_Serbian_JE}, + {"Cyrillic_LJE", XK_Cyrillic_LJE}, + {"Serbian_LJE", XK_Serbian_LJE}, + {"Cyrillic_NJE", XK_Cyrillic_NJE}, + {"Serbian_NJE", XK_Serbian_NJE}, + {"Serbian_TSHE", XK_Serbian_TSHE}, + {"Macedonia_KJE", XK_Macedonia_KJE}, + {"Byelorussian_SHORTU", XK_Byelorussian_SHORTU}, + {"Cyrillic_DZHE", XK_Cyrillic_DZHE}, + {"Serbian_DZE", XK_Serbian_DZE}, + {"Cyrillic_yu", XK_Cyrillic_yu}, + {"Cyrillic_a", XK_Cyrillic_a}, + {"Cyrillic_be", XK_Cyrillic_be}, + {"Cyrillic_tse", XK_Cyrillic_tse}, + {"Cyrillic_de", XK_Cyrillic_de}, + {"Cyrillic_ie", XK_Cyrillic_ie}, + {"Cyrillic_ef", XK_Cyrillic_ef}, + {"Cyrillic_ghe", XK_Cyrillic_ghe}, + {"Cyrillic_ha", XK_Cyrillic_ha}, + {"Cyrillic_i", XK_Cyrillic_i}, + {"Cyrillic_shorti", XK_Cyrillic_shorti}, + {"Cyrillic_ka", XK_Cyrillic_ka}, + {"Cyrillic_el", XK_Cyrillic_el}, + {"Cyrillic_em", XK_Cyrillic_em}, + {"Cyrillic_en", XK_Cyrillic_en}, + {"Cyrillic_o", XK_Cyrillic_o}, + {"Cyrillic_pe", XK_Cyrillic_pe}, + {"Cyrillic_ya", XK_Cyrillic_ya}, + {"Cyrillic_er", XK_Cyrillic_er}, + {"Cyrillic_es", XK_Cyrillic_es}, + {"Cyrillic_te", XK_Cyrillic_te}, + {"Cyrillic_u", XK_Cyrillic_u}, + {"Cyrillic_zhe", XK_Cyrillic_zhe}, + {"Cyrillic_ve", XK_Cyrillic_ve}, + {"Cyrillic_softsign", XK_Cyrillic_softsign}, + {"Cyrillic_yeru", XK_Cyrillic_yeru}, + {"Cyrillic_ze", XK_Cyrillic_ze}, + {"Cyrillic_sha", XK_Cyrillic_sha}, + {"Cyrillic_e", XK_Cyrillic_e}, + {"Cyrillic_shcha", XK_Cyrillic_shcha}, + {"Cyrillic_che", XK_Cyrillic_che}, + {"Cyrillic_hardsign", XK_Cyrillic_hardsign}, + {"Cyrillic_YU", XK_Cyrillic_YU}, + {"Cyrillic_A", XK_Cyrillic_A}, + {"Cyrillic_BE", XK_Cyrillic_BE}, + {"Cyrillic_TSE", XK_Cyrillic_TSE}, + {"Cyrillic_DE", XK_Cyrillic_DE}, + {"Cyrillic_IE", XK_Cyrillic_IE}, + {"Cyrillic_EF", XK_Cyrillic_EF}, + {"Cyrillic_GHE", XK_Cyrillic_GHE}, + {"Cyrillic_HA", XK_Cyrillic_HA}, + {"Cyrillic_I", XK_Cyrillic_I}, + {"Cyrillic_SHORTI", XK_Cyrillic_SHORTI}, + {"Cyrillic_KA", XK_Cyrillic_KA}, + {"Cyrillic_EL", XK_Cyrillic_EL}, + {"Cyrillic_EM", XK_Cyrillic_EM}, + {"Cyrillic_EN", XK_Cyrillic_EN}, + {"Cyrillic_O", XK_Cyrillic_O}, + {"Cyrillic_PE", XK_Cyrillic_PE}, + {"Cyrillic_YA", XK_Cyrillic_YA}, + {"Cyrillic_ER", XK_Cyrillic_ER}, + {"Cyrillic_ES", XK_Cyrillic_ES}, + {"Cyrillic_TE", XK_Cyrillic_TE}, + {"Cyrillic_U", XK_Cyrillic_U}, + {"Cyrillic_ZHE", XK_Cyrillic_ZHE}, + {"Cyrillic_VE", XK_Cyrillic_VE}, + {"Cyrillic_SOFTSIGN", XK_Cyrillic_SOFTSIGN}, + {"Cyrillic_YERU", XK_Cyrillic_YERU}, + {"Cyrillic_ZE", XK_Cyrillic_ZE}, + {"Cyrillic_SHA", XK_Cyrillic_SHA}, + {"Cyrillic_E", XK_Cyrillic_E}, + {"Cyrillic_SHCHA", XK_Cyrillic_SHCHA}, + {"Cyrillic_CHE", XK_Cyrillic_CHE}, + {"Cyrillic_HARDSIGN", XK_Cyrillic_HARDSIGN}, +#endif /* XK_CYRILLIC */ +#ifdef XK_GREEK + {"Greek_ALPHAaccent", XK_Greek_ALPHAaccent}, + {"Greek_EPSILONaccent", XK_Greek_EPSILONaccent}, + {"Greek_ETAaccent", XK_Greek_ETAaccent}, + {"Greek_IOTAaccent", XK_Greek_IOTAaccent}, + {"Greek_IOTAdieresis", XK_Greek_IOTAdieresis}, + {"Greek_OMICRONaccent", XK_Greek_OMICRONaccent}, + {"Greek_UPSILONaccent", XK_Greek_UPSILONaccent}, + {"Greek_UPSILONdieresis", XK_Greek_UPSILONdieresis}, + {"Greek_OMEGAaccent", XK_Greek_OMEGAaccent}, + {"Greek_accentdieresis", XK_Greek_accentdieresis}, + {"Greek_horizbar", XK_Greek_horizbar}, + {"Greek_alphaaccent", XK_Greek_alphaaccent}, + {"Greek_epsilonaccent", XK_Greek_epsilonaccent}, + {"Greek_etaaccent", XK_Greek_etaaccent}, + {"Greek_iotaaccent", XK_Greek_iotaaccent}, + {"Greek_iotadieresis", XK_Greek_iotadieresis}, + {"Greek_iotaaccentdieresis", XK_Greek_iotaaccentdieresis}, + {"Greek_omicronaccent", XK_Greek_omicronaccent}, + {"Greek_upsilonaccent", XK_Greek_upsilonaccent}, + {"Greek_upsilondieresis", XK_Greek_upsilondieresis}, + {"Greek_upsilonaccentdieresis", XK_Greek_upsilonaccentdieresis}, + {"Greek_omegaaccent", XK_Greek_omegaaccent}, + {"Greek_ALPHA", XK_Greek_ALPHA}, + {"Greek_BETA", XK_Greek_BETA}, + {"Greek_GAMMA", XK_Greek_GAMMA}, + {"Greek_DELTA", XK_Greek_DELTA}, + {"Greek_EPSILON", XK_Greek_EPSILON}, + {"Greek_ZETA", XK_Greek_ZETA}, + {"Greek_ETA", XK_Greek_ETA}, + {"Greek_THETA", XK_Greek_THETA}, + {"Greek_IOTA", XK_Greek_IOTA}, + {"Greek_KAPPA", XK_Greek_KAPPA}, + {"Greek_LAMDA", XK_Greek_LAMDA}, + {"Greek_LAMBDA", XK_Greek_LAMBDA}, + {"Greek_MU", XK_Greek_MU}, + {"Greek_NU", XK_Greek_NU}, + {"Greek_XI", XK_Greek_XI}, + {"Greek_OMICRON", XK_Greek_OMICRON}, + {"Greek_PI", XK_Greek_PI}, + {"Greek_RHO", XK_Greek_RHO}, + {"Greek_SIGMA", XK_Greek_SIGMA}, + {"Greek_TAU", XK_Greek_TAU}, + {"Greek_UPSILON", XK_Greek_UPSILON}, + {"Greek_PHI", XK_Greek_PHI}, + {"Greek_CHI", XK_Greek_CHI}, + {"Greek_PSI", XK_Greek_PSI}, + {"Greek_OMEGA", XK_Greek_OMEGA}, + {"Greek_alpha", XK_Greek_alpha}, + {"Greek_beta", XK_Greek_beta}, + {"Greek_gamma", XK_Greek_gamma}, + {"Greek_delta", XK_Greek_delta}, + {"Greek_epsilon", XK_Greek_epsilon}, + {"Greek_zeta", XK_Greek_zeta}, + {"Greek_eta", XK_Greek_eta}, + {"Greek_theta", XK_Greek_theta}, + {"Greek_iota", XK_Greek_iota}, + {"Greek_kappa", XK_Greek_kappa}, + {"Greek_lamda", XK_Greek_lamda}, + {"Greek_lambda", XK_Greek_lambda}, + {"Greek_mu", XK_Greek_mu}, + {"Greek_nu", XK_Greek_nu}, + {"Greek_xi", XK_Greek_xi}, + {"Greek_omicron", XK_Greek_omicron}, + {"Greek_pi", XK_Greek_pi}, + {"Greek_rho", XK_Greek_rho}, + {"Greek_sigma", XK_Greek_sigma}, + {"Greek_finalsmallsigma", XK_Greek_finalsmallsigma}, + {"Greek_tau", XK_Greek_tau}, + {"Greek_upsilon", XK_Greek_upsilon}, + {"Greek_phi", XK_Greek_phi}, + {"Greek_chi", XK_Greek_chi}, + {"Greek_psi", XK_Greek_psi}, + {"Greek_omega", XK_Greek_omega}, + {"Greek_switch", XK_Greek_switch}, +#endif /* XK_GREEK */ +#ifdef XK_TECHNICAL + {"leftradical", XK_leftradical}, + {"topleftradical", XK_topleftradical}, + {"horizconnector", XK_horizconnector}, + {"topintegral", XK_topintegral}, + {"botintegral", XK_botintegral}, + {"vertconnector", XK_vertconnector}, + {"topleftsqbracket", XK_topleftsqbracket}, + {"botleftsqbracket", XK_botleftsqbracket}, + {"toprightsqbracket", XK_toprightsqbracket}, + {"botrightsqbracket", XK_botrightsqbracket}, + {"topleftparens", XK_topleftparens}, + {"botleftparens", XK_botleftparens}, + {"toprightparens", XK_toprightparens}, + {"botrightparens", XK_botrightparens}, + {"leftmiddlecurlybrace", XK_leftmiddlecurlybrace}, + {"rightmiddlecurlybrace", XK_rightmiddlecurlybrace}, + {"topleftsummation", XK_topleftsummation}, + {"botleftsummation", XK_botleftsummation}, + {"topvertsummationconnector", XK_topvertsummationconnector}, + {"botvertsummationconnector", XK_botvertsummationconnector}, + {"toprightsummation", XK_toprightsummation}, + {"botrightsummation", XK_botrightsummation}, + {"rightmiddlesummation", XK_rightmiddlesummation}, + {"lessthanequal", XK_lessthanequal}, + {"notequal", XK_notequal}, + {"greaterthanequal", XK_greaterthanequal}, + {"integral", XK_integral}, + {"therefore", XK_therefore}, + {"variation", XK_variation}, + {"infinity", XK_infinity}, + {"nabla", XK_nabla}, + {"approximate", XK_approximate}, + {"similarequal", XK_similarequal}, + {"ifonlyif", XK_ifonlyif}, + {"implies", XK_implies}, + {"identical", XK_identical}, + {"radical", XK_radical}, + {"includedin", XK_includedin}, + {"includes", XK_includes}, + {"intersection", XK_intersection}, + {"union", XK_union}, + {"logicaland", XK_logicaland}, + {"logicalor", XK_logicalor}, + {"partialderivative", XK_partialderivative}, + {"function", XK_function}, + {"leftarrow", XK_leftarrow}, + {"uparrow", XK_uparrow}, + {"rightarrow", XK_rightarrow}, + {"downarrow", XK_downarrow}, +#endif /* XK_TECHNICAL */ +#ifdef XK_SPECIAL + {"blank", XK_blank}, + {"soliddiamond", XK_soliddiamond}, + {"checkerboard", XK_checkerboard}, + {"ht", XK_ht}, + {"ff", XK_ff}, + {"cr", XK_cr}, + {"lf", XK_lf}, + {"nl", XK_nl}, + {"vt", XK_vt}, + {"lowrightcorner", XK_lowrightcorner}, + {"uprightcorner", XK_uprightcorner}, + {"upleftcorner", XK_upleftcorner}, + {"lowleftcorner", XK_lowleftcorner}, + {"crossinglines", XK_crossinglines}, + {"horizlinescan1", XK_horizlinescan1}, + {"horizlinescan3", XK_horizlinescan3}, + {"horizlinescan5", XK_horizlinescan5}, + {"horizlinescan7", XK_horizlinescan7}, + {"horizlinescan9", XK_horizlinescan9}, + {"leftt", XK_leftt}, + {"rightt", XK_rightt}, + {"bott", XK_bott}, + {"topt", XK_topt}, + {"vertbar", XK_vertbar}, +#endif /* XK_SPECIAL */ +#ifdef XK_PUBLISHING + {"emspace", XK_emspace}, + {"enspace", XK_enspace}, + {"em3space", XK_em3space}, + {"em4space", XK_em4space}, + {"digitspace", XK_digitspace}, + {"punctspace", XK_punctspace}, + {"thinspace", XK_thinspace}, + {"hairspace", XK_hairspace}, + {"emdash", XK_emdash}, + {"endash", XK_endash}, + {"signifblank", XK_signifblank}, + {"ellipsis", XK_ellipsis}, + {"doubbaselinedot", XK_doubbaselinedot}, + {"onethird", XK_onethird}, + {"twothirds", XK_twothirds}, + {"onefifth", XK_onefifth}, + {"twofifths", XK_twofifths}, + {"threefifths", XK_threefifths}, + {"fourfifths", XK_fourfifths}, + {"onesixth", XK_onesixth}, + {"fivesixths", XK_fivesixths}, + {"careof", XK_careof}, + {"figdash", XK_figdash}, + {"leftanglebracket", XK_leftanglebracket}, + {"decimalpoint", XK_decimalpoint}, + {"rightanglebracket", XK_rightanglebracket}, + {"marker", XK_marker}, + {"oneeighth", XK_oneeighth}, + {"threeeighths", XK_threeeighths}, + {"fiveeighths", XK_fiveeighths}, + {"seveneighths", XK_seveneighths}, + {"trademark", XK_trademark}, + {"signaturemark", XK_signaturemark}, + {"trademarkincircle", XK_trademarkincircle}, + {"leftopentriangle", XK_leftopentriangle}, + {"rightopentriangle", XK_rightopentriangle}, + {"emopencircle", XK_emopencircle}, + {"emopenrectangle", XK_emopenrectangle}, + {"leftsinglequotemark", XK_leftsinglequotemark}, + {"rightsinglequotemark", XK_rightsinglequotemark}, + {"leftdoublequotemark", XK_leftdoublequotemark}, + {"rightdoublequotemark", XK_rightdoublequotemark}, + {"prescription", XK_prescription}, + {"minutes", XK_minutes}, + {"seconds", XK_seconds}, + {"latincross", XK_latincross}, + {"hexagram", XK_hexagram}, + {"filledrectbullet", XK_filledrectbullet}, + {"filledlefttribullet", XK_filledlefttribullet}, + {"filledrighttribullet", XK_filledrighttribullet}, + {"emfilledcircle", XK_emfilledcircle}, + {"emfilledrect", XK_emfilledrect}, + {"enopencircbullet", XK_enopencircbullet}, + {"enopensquarebullet", XK_enopensquarebullet}, + {"openrectbullet", XK_openrectbullet}, + {"opentribulletup", XK_opentribulletup}, + {"opentribulletdown", XK_opentribulletdown}, + {"openstar", XK_openstar}, + {"enfilledcircbullet", XK_enfilledcircbullet}, + {"enfilledsqbullet", XK_enfilledsqbullet}, + {"filledtribulletup", XK_filledtribulletup}, + {"filledtribulletdown", XK_filledtribulletdown}, + {"leftpointer", XK_leftpointer}, + {"rightpointer", XK_rightpointer}, + {"club", XK_club}, + {"diamond", XK_diamond}, + {"heart", XK_heart}, + {"maltesecross", XK_maltesecross}, + {"dagger", XK_dagger}, + {"doubledagger", XK_doubledagger}, + {"checkmark", XK_checkmark}, + {"ballotcross", XK_ballotcross}, + {"musicalsharp", XK_musicalsharp}, + {"musicalflat", XK_musicalflat}, + {"malesymbol", XK_malesymbol}, + {"femalesymbol", XK_femalesymbol}, + {"telephone", XK_telephone}, + {"telephonerecorder", XK_telephonerecorder}, + {"phonographcopyright", XK_phonographcopyright}, + {"caret", XK_caret}, + {"singlelowquotemark", XK_singlelowquotemark}, + {"doublelowquotemark", XK_doublelowquotemark}, + {"cursor", XK_cursor}, +#endif /* XK_PUBLISHING */ +#ifdef XK_APL + {"leftcaret", XK_leftcaret}, + {"rightcaret", XK_rightcaret}, + {"downcaret", XK_downcaret}, + {"upcaret", XK_upcaret}, + {"overbar", XK_overbar}, + {"downtack", XK_downtack}, + {"upshoe", XK_upshoe}, + {"downstile", XK_downstile}, + {"underbar", XK_underbar}, + {"jot", XK_jot}, + {"quad", XK_quad}, + {"uptack", XK_uptack}, + {"circle", XK_circle}, + {"upstile", XK_upstile}, + {"downshoe", XK_downshoe}, + {"rightshoe", XK_rightshoe}, + {"leftshoe", XK_leftshoe}, + {"lefttack", XK_lefttack}, + {"righttack", XK_righttack}, +#endif /* XK_APL */ +#ifdef XK_HEBREW + {"hebrew_doublelowline", XK_hebrew_doublelowline}, + {"hebrew_aleph", XK_hebrew_aleph}, + {"hebrew_bet", XK_hebrew_bet}, + {"hebrew_beth", XK_hebrew_beth}, + {"hebrew_gimel", XK_hebrew_gimel}, + {"hebrew_gimmel", XK_hebrew_gimmel}, + {"hebrew_dalet", XK_hebrew_dalet}, + {"hebrew_daleth", XK_hebrew_daleth}, + {"hebrew_he", XK_hebrew_he}, + {"hebrew_waw", XK_hebrew_waw}, + {"hebrew_zain", XK_hebrew_zain}, + {"hebrew_zayin", XK_hebrew_zayin}, + {"hebrew_chet", XK_hebrew_chet}, + {"hebrew_het", XK_hebrew_het}, + {"hebrew_tet", XK_hebrew_tet}, + {"hebrew_teth", XK_hebrew_teth}, + {"hebrew_yod", XK_hebrew_yod}, + {"hebrew_finalkaph", XK_hebrew_finalkaph}, + {"hebrew_kaph", XK_hebrew_kaph}, + {"hebrew_lamed", XK_hebrew_lamed}, + {"hebrew_finalmem", XK_hebrew_finalmem}, + {"hebrew_mem", XK_hebrew_mem}, + {"hebrew_finalnun", XK_hebrew_finalnun}, + {"hebrew_nun", XK_hebrew_nun}, + {"hebrew_samech", XK_hebrew_samech}, + {"hebrew_samekh", XK_hebrew_samekh}, + {"hebrew_ayin", XK_hebrew_ayin}, + {"hebrew_finalpe", XK_hebrew_finalpe}, + {"hebrew_pe", XK_hebrew_pe}, + {"hebrew_finalzade", XK_hebrew_finalzade}, + {"hebrew_finalzadi", XK_hebrew_finalzadi}, + {"hebrew_zade", XK_hebrew_zade}, + {"hebrew_zadi", XK_hebrew_zadi}, + {"hebrew_qoph", XK_hebrew_qoph}, + {"hebrew_kuf", XK_hebrew_kuf}, + {"hebrew_resh", XK_hebrew_resh}, + {"hebrew_shin", XK_hebrew_shin}, + {"hebrew_taw", XK_hebrew_taw}, + {"hebrew_taf", XK_hebrew_taf}, + {"Hebrew_switch", XK_Hebrew_switch}, +#endif /* XK_HEBREW */ +#ifdef XK_THAI + {"Thai_kokai", XK_Thai_kokai}, + {"Thai_khokhai", XK_Thai_khokhai}, + {"Thai_khokhuat", XK_Thai_khokhuat}, + {"Thai_khokhwai", XK_Thai_khokhwai}, + {"Thai_khokhon", XK_Thai_khokhon}, + {"Thai_khorakhang", XK_Thai_khorakhang}, + {"Thai_ngongu", XK_Thai_ngongu}, + {"Thai_chochan", XK_Thai_chochan}, + {"Thai_choching", XK_Thai_choching}, + {"Thai_chochang", XK_Thai_chochang}, + {"Thai_soso", XK_Thai_soso}, + {"Thai_chochoe", XK_Thai_chochoe}, + {"Thai_yoying", XK_Thai_yoying}, + {"Thai_dochada", XK_Thai_dochada}, + {"Thai_topatak", XK_Thai_topatak}, + {"Thai_thothan", XK_Thai_thothan}, + {"Thai_thonangmontho", XK_Thai_thonangmontho}, + {"Thai_thophuthao", XK_Thai_thophuthao}, + {"Thai_nonen", XK_Thai_nonen}, + {"Thai_dodek", XK_Thai_dodek}, + {"Thai_totao", XK_Thai_totao}, + {"Thai_thothung", XK_Thai_thothung}, + {"Thai_thothahan", XK_Thai_thothahan}, + {"Thai_thothong", XK_Thai_thothong}, + {"Thai_nonu", XK_Thai_nonu}, + {"Thai_bobaimai", XK_Thai_bobaimai}, + {"Thai_popla", XK_Thai_popla}, + {"Thai_phophung", XK_Thai_phophung}, + {"Thai_fofa", XK_Thai_fofa}, + {"Thai_phophan", XK_Thai_phophan}, + {"Thai_fofan", XK_Thai_fofan}, + {"Thai_phosamphao", XK_Thai_phosamphao}, + {"Thai_moma", XK_Thai_moma}, + {"Thai_yoyak", XK_Thai_yoyak}, + {"Thai_rorua", XK_Thai_rorua}, + {"Thai_ru", XK_Thai_ru}, + {"Thai_loling", XK_Thai_loling}, + {"Thai_lu", XK_Thai_lu}, + {"Thai_wowaen", XK_Thai_wowaen}, + {"Thai_sosala", XK_Thai_sosala}, + {"Thai_sorusi", XK_Thai_sorusi}, + {"Thai_sosua", XK_Thai_sosua}, + {"Thai_hohip", XK_Thai_hohip}, + {"Thai_lochula", XK_Thai_lochula}, + {"Thai_oang", XK_Thai_oang}, + {"Thai_honokhuk", XK_Thai_honokhuk}, + {"Thai_paiyannoi", XK_Thai_paiyannoi}, + {"Thai_saraa", XK_Thai_saraa}, + {"Thai_maihanakat", XK_Thai_maihanakat}, + {"Thai_saraaa", XK_Thai_saraaa}, + {"Thai_saraam", XK_Thai_saraam}, + {"Thai_sarai", XK_Thai_sarai}, + {"Thai_saraii", XK_Thai_saraii}, + {"Thai_saraue", XK_Thai_saraue}, + {"Thai_sarauee", XK_Thai_sarauee}, + {"Thai_sarau", XK_Thai_sarau}, + {"Thai_sarauu", XK_Thai_sarauu}, + {"Thai_phinthu", XK_Thai_phinthu}, + {"Thai_maihanakat_maitho", XK_Thai_maihanakat_maitho}, + {"Thai_baht", XK_Thai_baht}, + {"Thai_sarae", XK_Thai_sarae}, + {"Thai_saraae", XK_Thai_saraae}, + {"Thai_sarao", XK_Thai_sarao}, + {"Thai_saraaimaimuan", XK_Thai_saraaimaimuan}, + {"Thai_saraaimaimalai", XK_Thai_saraaimaimalai}, + {"Thai_lakkhangyao", XK_Thai_lakkhangyao}, + {"Thai_maiyamok", XK_Thai_maiyamok}, + {"Thai_maitaikhu", XK_Thai_maitaikhu}, + {"Thai_maiek", XK_Thai_maiek}, + {"Thai_maitho", XK_Thai_maitho}, + {"Thai_maitri", XK_Thai_maitri}, + {"Thai_maichattawa", XK_Thai_maichattawa}, + {"Thai_thanthakhat", XK_Thai_thanthakhat}, + {"Thai_nikhahit", XK_Thai_nikhahit}, + {"Thai_leksun", XK_Thai_leksun}, + {"Thai_leknung", XK_Thai_leknung}, + {"Thai_leksong", XK_Thai_leksong}, + {"Thai_leksam", XK_Thai_leksam}, + {"Thai_leksi", XK_Thai_leksi}, + {"Thai_lekha", XK_Thai_lekha}, + {"Thai_lekhok", XK_Thai_lekhok}, + {"Thai_lekchet", XK_Thai_lekchet}, + {"Thai_lekpaet", XK_Thai_lekpaet}, + {"Thai_lekkao", XK_Thai_lekkao}, +#endif /* XK_THAI */ +#ifdef XK_KOREAN + {"Hangul", XK_Hangul}, + {"Hangul_Start", XK_Hangul_Start}, + {"Hangul_End", XK_Hangul_End}, + {"Hangul_Hanja", XK_Hangul_Hanja}, + {"Hangul_Jamo", XK_Hangul_Jamo}, + {"Hangul_Romaja", XK_Hangul_Romaja}, + {"Hangul_Codeinput", XK_Hangul_Codeinput}, + {"Hangul_Jeonja", XK_Hangul_Jeonja}, + {"Hangul_Banja", XK_Hangul_Banja}, + {"Hangul_PreHanja", XK_Hangul_PreHanja}, + {"Hangul_PostHanja", XK_Hangul_PostHanja}, + {"Hangul_SingleCandidate", XK_Hangul_SingleCandidate}, + {"Hangul_MultipleCandidate", XK_Hangul_MultipleCandidate}, + {"Hangul_PreviousCandidate", XK_Hangul_PreviousCandidate}, + {"Hangul_Special", XK_Hangul_Special}, + {"Hangul_switch", XK_Hangul_switch}, + {"Hangul_Kiyeog", XK_Hangul_Kiyeog}, + {"Hangul_SsangKiyeog", XK_Hangul_SsangKiyeog}, + {"Hangul_KiyeogSios", XK_Hangul_KiyeogSios}, + {"Hangul_Nieun", XK_Hangul_Nieun}, + {"Hangul_NieunJieuj", XK_Hangul_NieunJieuj}, + {"Hangul_NieunHieuh", XK_Hangul_NieunHieuh}, + {"Hangul_Dikeud", XK_Hangul_Dikeud}, + {"Hangul_SsangDikeud", XK_Hangul_SsangDikeud}, + {"Hangul_Rieul", XK_Hangul_Rieul}, + {"Hangul_RieulKiyeog", XK_Hangul_RieulKiyeog}, + {"Hangul_RieulMieum", XK_Hangul_RieulMieum}, + {"Hangul_RieulPieub", XK_Hangul_RieulPieub}, + {"Hangul_RieulSios", XK_Hangul_RieulSios}, + {"Hangul_RieulTieut", XK_Hangul_RieulTieut}, + {"Hangul_RieulPhieuf", XK_Hangul_RieulPhieuf}, + {"Hangul_RieulHieuh", XK_Hangul_RieulHieuh}, + {"Hangul_Mieum", XK_Hangul_Mieum}, + {"Hangul_Pieub", XK_Hangul_Pieub}, + {"Hangul_SsangPieub", XK_Hangul_SsangPieub}, + {"Hangul_PieubSios", XK_Hangul_PieubSios}, + {"Hangul_Sios", XK_Hangul_Sios}, + {"Hangul_SsangSios", XK_Hangul_SsangSios}, + {"Hangul_Ieung", XK_Hangul_Ieung}, + {"Hangul_Jieuj", XK_Hangul_Jieuj}, + {"Hangul_SsangJieuj", XK_Hangul_SsangJieuj}, + {"Hangul_Cieuc", XK_Hangul_Cieuc}, + {"Hangul_Khieuq", XK_Hangul_Khieuq}, + {"Hangul_Tieut", XK_Hangul_Tieut}, + {"Hangul_Phieuf", XK_Hangul_Phieuf}, + {"Hangul_Hieuh", XK_Hangul_Hieuh}, + {"Hangul_A", XK_Hangul_A}, + {"Hangul_AE", XK_Hangul_AE}, + {"Hangul_YA", XK_Hangul_YA}, + {"Hangul_YAE", XK_Hangul_YAE}, + {"Hangul_EO", XK_Hangul_EO}, + {"Hangul_E", XK_Hangul_E}, + {"Hangul_YEO", XK_Hangul_YEO}, + {"Hangul_YE", XK_Hangul_YE}, + {"Hangul_O", XK_Hangul_O}, + {"Hangul_WA", XK_Hangul_WA}, + {"Hangul_WAE", XK_Hangul_WAE}, + {"Hangul_OE", XK_Hangul_OE}, + {"Hangul_YO", XK_Hangul_YO}, + {"Hangul_U", XK_Hangul_U}, + {"Hangul_WEO", XK_Hangul_WEO}, + {"Hangul_WE", XK_Hangul_WE}, + {"Hangul_WI", XK_Hangul_WI}, + {"Hangul_YU", XK_Hangul_YU}, + {"Hangul_EU", XK_Hangul_EU}, + {"Hangul_YI", XK_Hangul_YI}, + {"Hangul_I", XK_Hangul_I}, + {"Hangul_J_Kiyeog", XK_Hangul_J_Kiyeog}, + {"Hangul_J_SsangKiyeog", XK_Hangul_J_SsangKiyeog}, + {"Hangul_J_KiyeogSios", XK_Hangul_J_KiyeogSios}, + {"Hangul_J_Nieun", XK_Hangul_J_Nieun}, + {"Hangul_J_NieunJieuj", XK_Hangul_J_NieunJieuj}, + {"Hangul_J_NieunHieuh", XK_Hangul_J_NieunHieuh}, + {"Hangul_J_Dikeud", XK_Hangul_J_Dikeud}, + {"Hangul_J_Rieul", XK_Hangul_J_Rieul}, + {"Hangul_J_RieulKiyeog", XK_Hangul_J_RieulKiyeog}, + {"Hangul_J_RieulMieum", XK_Hangul_J_RieulMieum}, + {"Hangul_J_RieulPieub", XK_Hangul_J_RieulPieub}, + {"Hangul_J_RieulSios", XK_Hangul_J_RieulSios}, + {"Hangul_J_RieulTieut", XK_Hangul_J_RieulTieut}, + {"Hangul_J_RieulPhieuf", XK_Hangul_J_RieulPhieuf}, + {"Hangul_J_RieulHieuh", XK_Hangul_J_RieulHieuh}, + {"Hangul_J_Mieum", XK_Hangul_J_Mieum}, + {"Hangul_J_Pieub", XK_Hangul_J_Pieub}, + {"Hangul_J_PieubSios", XK_Hangul_J_PieubSios}, + {"Hangul_J_Sios", XK_Hangul_J_Sios}, + {"Hangul_J_SsangSios", XK_Hangul_J_SsangSios}, + {"Hangul_J_Ieung", XK_Hangul_J_Ieung}, + {"Hangul_J_Jieuj", XK_Hangul_J_Jieuj}, + {"Hangul_J_Cieuc", XK_Hangul_J_Cieuc}, + {"Hangul_J_Khieuq", XK_Hangul_J_Khieuq}, + {"Hangul_J_Tieut", XK_Hangul_J_Tieut}, + {"Hangul_J_Phieuf", XK_Hangul_J_Phieuf}, + {"Hangul_J_Hieuh", XK_Hangul_J_Hieuh}, + {"Hangul_RieulYeorinHieuh", XK_Hangul_RieulYeorinHieuh}, + {"Hangul_SunkyeongeumMieum", XK_Hangul_SunkyeongeumMieum}, + {"Hangul_SunkyeongeumPieub", XK_Hangul_SunkyeongeumPieub}, + {"Hangul_PanSios", XK_Hangul_PanSios}, + {"Hangul_KkogjiDalrinIeung", XK_Hangul_KkogjiDalrinIeung}, + {"Hangul_SunkyeongeumPhieuf", XK_Hangul_SunkyeongeumPhieuf}, + {"Hangul_YeorinHieuh", XK_Hangul_YeorinHieuh}, + {"Hangul_AraeA", XK_Hangul_AraeA}, + {"Hangul_AraeAE", XK_Hangul_AraeAE}, + {"Hangul_J_PanSios", XK_Hangul_J_PanSios}, + {"Hangul_J_KkogjiDalrinIeung", XK_Hangul_J_KkogjiDalrinIeung}, + {"Hangul_J_YeorinHieuh", XK_Hangul_J_YeorinHieuh}, + {"Korean_Won", XK_Korean_Won}, +#endif /* XK_KOREAN */ + {"EuroSign", XK_EuroSign}, +#endif + {"NoSymbol", NoSymbol} +}; + +KeySym +XStringToKeysym(const char *str) +{ + int i; + for (i = 0; StringToKeysym[i].keysym != NoSymbol + && strcmp(StringToKeysym[i].string, str); i++); + return StringToKeysym[i].keysym; +} + +const char * +XKeysymToString(KeySym keysym) +{ + int i; + for (i = 0; StringToKeysym[i].keysym != NoSymbol + && StringToKeysym[i].keysym != keysym; i++); + return StringToKeysym[i].string; +} + +void +XDisplayKeycodes(Display * display, int *min_keycode, int *max_keycode) +{ + /* VNC keycodes are non-existant */ + *min_keycode = 0xffff; + *max_keycode = 0; +} --- rdesktop-1.5.0.orig/vnc/x11stubs.h +++ rdesktop-1.5.0/vnc/x11stubs.h @@ -0,0 +1,33 @@ +#ifndef NOXKEYMAP_H +#define NOXKEYMAP_H + +/* Fake a few X11 calls */ + +#define XK_MISCELLANY +#include <rfb/rfb.h> +#include <rfb/keysym.h> + +#define NoSymbol 0L +#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) +#define Button1 1 +#define Button2 2 +#define Button3 3 +#define Button4 4 +#define Button5 5 + +typedef int Display; +typedef int Window; +typedef rfbKeySym KeySym; + +KeySym XStringToKeysym(const char *str); +const char *XKeysymToString(KeySym keysym); +void XDisplayKeycodes(Display * display, int *min_keycode, int *max_keycode); + +#endif --- rdesktop-1.5.0.orig/xclip.c +++ rdesktop-1.5.0/xclip.c @@ -1,8 +1,8 @@ /* -*- c-basic-offset: 8 -*- rdesktop: A Remote Desktop Protocol client. Protocol services - Clipboard functions - Copyright (C) Erik Forsberg <forsberg@cendio.se> 2003 - Copyright (C) Matthew Chapman 2003 + Copyright (C) Erik Forsberg <forsberg@cendio.se> 2003-2007 + Copyright (C) Matthew Chapman 2003-2007 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -53,12 +53,12 @@ extern Display *g_display; extern Window g_wnd; extern Time g_last_gesturetime; -extern BOOL g_rdpclip; +extern RD_BOOL g_rdpclip; /* Mode of operation. - Auto: Look at both PRIMARY and CLIPBOARD and use the most recent. - Non-auto: Look at just CLIPBOARD. */ -static BOOL auto_mode = True; +static RD_BOOL auto_mode = True; /* Atoms of the two X selections we're dealing with: CLIPBOARD (explicit-copy) and PRIMARY (selection-copy) */ static Atom clipboard_atom, primary_atom; /* Atom of the TARGETS clipboard target */ @@ -92,7 +92,7 @@ /* State variables that indicate if we're currently probing the targets of the selection owner. reprobe_selections indicate that the ownership changed in the middle of the current probe so it should be restarted. */ -static BOOL probing_selections, reprobe_selections; +static RD_BOOL probing_selections, reprobe_selections; /* Atoms _RDESKTOP_PRIMARY_OWNER and _RDESKTOP_CLIPBOARD_OWNER. Used as properties on the root window to indicate which selections that are owned by rdesktop. */ static Atom rdesktop_primary_owner_atom, rdesktop_clipboard_owner_atom; @@ -105,7 +105,7 @@ the context to proceed. */ static XSelectionRequestEvent selection_request; /* Denotes we have a pending selection request. */ -static Bool has_selection_request; +static RD_BOOL has_selection_request; /* Stores the clipboard format (CF_TEXT, CF_UNICODETEXT etc.) requested in the last CLIPDR_DATA_REQUEST (= the RDP server requesting clipboard data from us). When we receive this data from whatever X client offering it, this variable gives us @@ -117,7 +117,7 @@ static int num_targets; /* Denotes that an rdesktop (not this rdesktop) is owning the selection, allowing us to interchange Windows native clipboard data directly. */ -static BOOL rdesktop_is_selection_owner = False; +static RD_BOOL rdesktop_is_selection_owner = False; /* Time when we acquired the selection. */ static Time acquire_time = 0; @@ -130,8 +130,8 @@ /* Denotes the size of g_clip_buffer. */ static uint32 g_clip_buflen = 0; -/* Translate LF to CR-LF. To do this, we must allocate more memory. - The returned string is null-terminated, as required by CF_TEXT. +/* Translates CR-LF to LF. + Changes the string in-place. Does not stop on embedded nulls. The length is updated. */ static void @@ -157,7 +157,7 @@ { uint8 *result; uint16 *inptr, *outptr; - Bool swap_endianess; + RD_BOOL swap_endianess; /* Worst case: Every char is LF */ result = xmalloc((*size * 2) + 2); @@ -170,13 +170,15 @@ /* Check for a reversed BOM */ swap_endianess = (*inptr == 0xfffe); + uint16 uvalue_previous = 0; /* Kept so we'll avoid translating CR-LF to CR-CR-LF */ while ((uint8 *) inptr < data + *size) { uint16 uvalue = *inptr; if (swap_endianess) uvalue = ((uvalue << 8) & 0xff00) + (uvalue >> 8); - if (uvalue == 0x0a) + if ((uvalue == 0x0a) && (uvalue_previous != 0x0d)) *outptr++ = swap_endianess ? 0x0d00 : 0x0d; + uvalue_previous = uvalue; *outptr++ = *inptr++; } *outptr++ = 0; /* null termination */ @@ -198,10 +200,12 @@ p = data; o = result; + uint8 previous = '\0'; /* Kept to avoid translating CR-LF to CR-CR-LF */ while (p < data + *length) { - if (*p == '\x0a') + if ((*p == '\x0a') && (previous != '\x0d')) *o++ = '\x0d'; + previous = *p; *o++ = *p++; } *length = o - result; @@ -283,7 +287,7 @@ /* Replies with clipboard data to RDP, converting it from the target format to the expected RDP format as necessary. Returns true if data was sent. */ -static Bool +static RD_BOOL xclip_send_data_with_convert(uint8 * source, size_t source_size, Atom target) { DEBUG_CLIPBOARD(("xclip_send_data_with_convert: target=%s, size=%u\n", @@ -713,7 +717,7 @@ rdesktop_is_selection_owner = True; cliprdr_send_native_format_announce(data, nitems); } - else if (!xclip_send_data_with_convert(data, nitems, event->target)) + else if ((!nitems) || (!xclip_send_data_with_convert(data, nitems, event->target))) { goto fail; } @@ -754,7 +758,7 @@ xclip_handle_SelectionRequest(XSelectionRequestEvent * event) { unsigned long nitems, bytes_left; - unsigned char *prop_return; + unsigned char *prop_return = NULL; int format, res; Atom type; @@ -796,7 +800,7 @@ event->property, 0, 1, True, XA_INTEGER, &type, &format, &nitems, &bytes_left, &prop_return); - if (res != Success) + if (res != Success || (!prop_return)) { DEBUG_CLIPBOARD(("Requested native format but didn't specifiy which.\n")); xclip_refuse_selection(event); @@ -958,7 +962,7 @@ void ui_clip_handle_data(uint8 * data, uint32 length) { - BOOL free_data = False; + RD_BOOL free_data = False; if (length == 0) { @@ -1006,6 +1010,8 @@ free_data = True; data = (uint8 *) utf8_data; length = utf8_length - utf8_length_remaining; + /* translate linebreaks (works just as well on UTF-8) */ + crlf2lf(data, &length); } } else if (selection_request.target == format_unicode_atom) --- rdesktop-1.5.0.orig/xkeymap.c +++ rdesktop-1.5.0/xkeymap.c @@ -2,14 +2,14 @@ rdesktop: A Remote Desktop Protocol client. User interface services - X keyboard mapping - Copyright (C) Matthew Chapman 1999-2005 - Copyright (C) Peter Astrand <peter@cendio.se> 2003 - + Copyright (C) Matthew Chapman 1999-2007 + Copyright (C) Peter Astrand <astrand@cendio.se> 2003-2007 + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 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 @@ -46,17 +46,17 @@ extern int g_keyboard_subtype; extern int g_keyboard_functionkeys; extern int g_win_button_size; -extern BOOL g_enable_compose; -extern BOOL g_use_rdp5; -extern BOOL g_numlock_sync; +extern RD_BOOL g_enable_compose; +extern RD_BOOL g_use_rdp5; +extern RD_BOOL g_numlock_sync; -static BOOL keymap_loaded; +static RD_BOOL keymap_loaded; static key_translation *keymap[KEYMAP_SIZE]; static int min_keycode; static uint16 remote_modifier_state = 0; static uint16 saved_remote_modifier_state = 0; -static void update_modifier_state(uint8 scancode, BOOL pressed); +static void update_modifier_state(uint8 scancode, RD_BOOL pressed); /* Free key_translation structure, including linked list */ static void @@ -159,7 +159,7 @@ DEBUG_KBD(("\n")); } -BOOL +RD_BOOL xkeymap_from_locale(const char *locale) { char *str, *ptr; @@ -275,7 +275,7 @@ return NULL; } -static BOOL +static RD_BOOL xkeymap_read(char *mapname) { FILE *fp; @@ -455,7 +455,7 @@ } static void -send_winkey(uint32 ev_time, BOOL pressed, BOOL leftkey) +send_winkey(uint32 ev_time, RD_BOOL pressed, RD_BOOL leftkey) { uint8 winkey; @@ -504,8 +504,8 @@ } /* Handle special key combinations */ -BOOL -handle_special_keys(uint32 keysym, unsigned int state, uint32 ev_time, BOOL pressed) +RD_BOOL +handle_special_keys(uint32 keysym, unsigned int state, uint32 ev_time, RD_BOOL pressed) { switch (keysym) { @@ -679,9 +679,39 @@ return tr; } +static RD_BOOL +is_modifier(uint8 scancode) +{ + switch (scancode) + { + case SCANCODE_CHAR_LSHIFT: + case SCANCODE_CHAR_RSHIFT: + case SCANCODE_CHAR_LCTRL: + case SCANCODE_CHAR_RCTRL: + case SCANCODE_CHAR_LALT: + case SCANCODE_CHAR_RALT: + case SCANCODE_CHAR_LWIN: + case SCANCODE_CHAR_RWIN: + case SCANCODE_CHAR_NUMLOCK: + return True; + default: + break; + } + return False; +} + +static void +save_remote_modifiers_if_modifier(uint8 scancode) +{ + if (!is_modifier(scancode)) + return; + + saved_remote_modifier_state = remote_modifier_state; +} + void xkeymap_send_keys(uint32 keysym, unsigned int keycode, unsigned int state, uint32 ev_time, - BOOL pressed, uint8 nesting) + RD_BOOL pressed, uint8 nesting) { key_translation tr, *ptr; tr = xkeymap_translate_key(keysym, keycode, state); @@ -697,11 +727,12 @@ save_remote_modifiers(tr.scancode); ensure_remote_modifiers(ev_time, tr); rdp_send_scancode(ev_time, RDP_KEYPRESS, tr.scancode); - restore_remote_modifiers(ev_time, tr.scancode); } else { rdp_send_scancode(ev_time, RDP_KEYRELEASE, tr.scancode); + restore_remote_modifiers(ev_time, tr.scancode); + save_remote_modifiers_if_modifier(tr.scancode); } return; } @@ -762,27 +793,6 @@ return ksname; } -static BOOL -is_modifier(uint8 scancode) -{ - switch (scancode) - { - case SCANCODE_CHAR_LSHIFT: - case SCANCODE_CHAR_RSHIFT: - case SCANCODE_CHAR_LCTRL: - case SCANCODE_CHAR_RCTRL: - case SCANCODE_CHAR_LALT: - case SCANCODE_CHAR_RALT: - case SCANCODE_CHAR_LWIN: - case SCANCODE_CHAR_RWIN: - case SCANCODE_CHAR_NUMLOCK: - return True; - default: - break; - } - return False; -} - void save_remote_modifiers(uint8 scancode) { @@ -956,7 +966,7 @@ static void -update_modifier_state(uint8 scancode, BOOL pressed) +update_modifier_state(uint8 scancode, RD_BOOL pressed) { #ifdef WITH_DEBUG_KBD uint16 old_modifier_state; @@ -995,7 +1005,7 @@ modifier state only on Keypress */ if (pressed && !g_numlock_sync) { - BOOL newNumLockState; + RD_BOOL newNumLockState; newNumLockState = (MASK_HAS_BITS (remote_modifier_state, MapNumLockMask) == False); --- rdesktop-1.5.0.orig/xproto.h +++ rdesktop-1.5.0/xproto.h @@ -9,3 +9,5 @@ void ewmh_set_wm_name(Window wnd, const char *title); int ewmh_set_window_popup(Window wnd); int ewmh_set_window_modal(Window wnd); +void ewmh_set_icon(Window wnd, int width, int height, const char *rgba_data); +void ewmh_del_icon(Window wnd, int width, int height); --- rdesktop-1.5.0.orig/xwin.c +++ rdesktop-1.5.0/xwin.c @@ -1,7 +1,8 @@ /* -*- c-basic-offset: 8 -*- rdesktop: A Remote Desktop Protocol client. User interface services - X Window System - Copyright (C) Matthew Chapman 1999-2005 + Copyright (C) Matthew Chapman 1999-2007 + Copyright 2007 Pierre Ossman <ossman@cendio.se> for Cendio AB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,6 +21,7 @@ #include <X11/Xlib.h> #include <X11/Xutil.h> +#include <X11/Xproto.h> #include <unistd.h> #include <sys/time.h> #include <time.h> @@ -28,18 +30,15 @@ #include "rdesktop.h" #include "xproto.h" -/* We can't include Xproto.h because of conflicting defines for BOOL */ -#define X_ConfigureWindow 12 - extern int g_width; extern int g_height; extern int g_xpos; extern int g_ypos; extern int g_pos; -extern BOOL g_sendmotion; -extern BOOL g_fullscreen; -extern BOOL g_grab_keyboard; -extern BOOL g_hide_decorations; +extern RD_BOOL g_sendmotion; +extern RD_BOOL g_fullscreen; +extern RD_BOOL g_grab_keyboard; +extern RD_BOOL g_hide_decorations; extern char g_title[]; /* Color depth of the RDP session. As of RDP 5.1, it may be 8, 15, 16 or 24. */ @@ -71,23 +70,27 @@ unsigned int desktop; struct timeval *position_timer; - BOOL outstanding_position; + RD_BOOL outstanding_position; unsigned int outpos_serial; int outpos_xoffset, outpos_yoffset; int outpos_width, outpos_height; + unsigned int icon_size; + unsigned int icon_offset; + char icon_buffer[32 * 32 * 4]; + struct _seamless_window *next; } seamless_window; static seamless_window *g_seamless_windows = NULL; static unsigned long g_seamless_focused = 0; -static BOOL g_seamless_started = False; /* Server end is up and running */ -static BOOL g_seamless_active = False; /* We are currently in seamless mode */ -static BOOL g_seamless_hidden = False; /* Desktop is hidden on server */ -extern BOOL g_seamless_rdp; +static RD_BOOL g_seamless_started = False; /* Server end is up and running */ +static RD_BOOL g_seamless_active = False; /* We are currently in seamless mode */ +static RD_BOOL g_seamless_hidden = False; /* Desktop is hidden on server */ +extern RD_BOOL g_seamless_rdp; extern uint32 g_embed_wnd; -BOOL g_enable_compose = False; -BOOL g_Unobscured; /* used for screenblt */ +RD_BOOL g_enable_compose = False; +RD_BOOL g_Unobscured; /* used for screenblt */ static GC g_gc = NULL; static GC g_create_bitmap_gc = NULL; static GC g_create_glyph_gc = NULL; @@ -104,20 +107,23 @@ static XIM g_IM; static XIC g_IC; static XModifierKeymap *g_mod_map; +/* Maps logical (xmodmap -pp) pointing device buttons (0-based) back + to physical (1-based) indices. */ +static unsigned char g_pointer_log_to_phys_map[16]; static Cursor g_current_cursor; -static HCURSOR g_null_cursor = NULL; +static RD_HCURSOR g_null_cursor = NULL; static Atom g_protocol_atom, g_kill_atom; extern Atom g_net_wm_state_atom; extern Atom g_net_wm_desktop_atom; -static BOOL g_focused; -static BOOL g_mouse_in_wnd; +static RD_BOOL g_focused; +static RD_BOOL g_mouse_in_wnd; /* Indicates that: 1) visual has 15, 16 or 24 depth and the same color channel masks as its RDP equivalent (implies X server is LE), 2) host is LE This will trigger an optimization whose real value is questionable. */ -static BOOL g_compatible_arch; +static RD_BOOL g_compatible_arch; /* Indicates whether RDP's bitmaps and our XImages have the same binary format. If so, we can avoid an expensive translation. Note that this can be true when g_compatible_arch is false, @@ -128,28 +134,26 @@ ('host' is the machine running rdesktop; the host simply memcpy's so its endianess doesn't matter) */ -static BOOL g_no_translate_image = False; +static RD_BOOL g_no_translate_image = False; /* endianness */ -static BOOL g_host_be; -static BOOL g_xserver_be; +static RD_BOOL g_host_be; +static RD_BOOL g_xserver_be; static int g_red_shift_r, g_blue_shift_r, g_green_shift_r; static int g_red_shift_l, g_blue_shift_l, g_green_shift_l; /* software backing store */ -extern BOOL g_ownbackstore; +extern RD_BOOL g_ownbackstore; static Pixmap g_backstore = 0; /* Moving in single app mode */ -static BOOL g_moving_wnd; +static RD_BOOL g_moving_wnd; static int g_move_x_offset = 0; static int g_move_y_offset = 0; -static BOOL g_using_full_workarea = False; +static RD_BOOL g_using_full_workarea = False; #ifdef WITH_RDPSND -extern int g_dsp_fd; -extern BOOL g_dsp_busy; -extern BOOL g_rdpsnd; +extern RD_BOOL g_rdpsnd; #endif /* MWM decorations */ @@ -250,7 +254,7 @@ } /* colour maps */ -extern BOOL g_owncolmap; +extern RD_BOOL g_owncolmap; static Colormap g_xcolmap; static uint32 *g_colmap = NULL; @@ -474,7 +478,7 @@ static seamless_group * -sw_find_group(unsigned long id, BOOL dont_create) +sw_find_group(unsigned long id, RD_BOOL dont_create) { seamless_window *sw; seamless_group *sg; @@ -579,6 +583,7 @@ SPLITCOLOUR16(colour, pc); break; case 24: + case 32: SPLITCOLOUR24(colour, pc); break; default: @@ -1187,6 +1192,13 @@ is only set for compatible depths, but the RDP depth might've changed during connection negotiations. */ + + /* todo */ + if (g_server_depth == 32 && g_depth == 24) + { + return data; + } + if (g_no_translate_image) { if ((g_depth == 15 && g_server_depth == 15) || @@ -1264,7 +1276,26 @@ return out; } -BOOL +static void +xwin_refresh_pointer_map(void) +{ + unsigned char phys_to_log_map[sizeof(g_pointer_log_to_phys_map)]; + int i, pointer_buttons; + + pointer_buttons = XGetPointerMapping(g_display, phys_to_log_map, sizeof(phys_to_log_map)); + if (pointer_buttons > sizeof(g_pointer_log_to_phys_map)) + pointer_buttons = sizeof(g_pointer_log_to_phys_map); + + for (i = 0; i < pointer_buttons; ++i) + { + /* This might produce multiple logical buttons mapping + to a single physical one, but hey, that's + life... */ + g_pointer_log_to_phys_map[phys_to_log_map[i] - 1] = i + 1; + } +} + +RD_BOOL get_key_state(unsigned int state, uint32 keysym) { int modifierpos, key, keysymMask = 0; @@ -1312,7 +1343,7 @@ return weight; } -static BOOL +static RD_BOOL select_visual(int screen_num) { XPixmapFormatValues *pfm; @@ -1351,7 +1382,7 @@ for (i = 0; i < visuals_count; ++i) { XVisualInfo *visual_info = &vmatches[i]; - BOOL can_translate_to_bpp = False; + RD_BOOL can_translate_to_bpp = False; int j; /* Try to find a no-translation visual that'll @@ -1523,7 +1554,7 @@ return g_old_error_handler(dpy, eev); } -BOOL +RD_BOOL ui_init(void) { int screen_num; @@ -1537,7 +1568,7 @@ { uint16 endianess_test = 1; - g_host_be = !(BOOL) (*(uint8 *) (&endianess_test)); + g_host_be = !(RD_BOOL) (*(uint8 *) (&endianess_test)); } g_old_error_handler = XSetErrorHandler(error_handler); @@ -1618,6 +1649,7 @@ g_width = (g_width + 3) & ~3; g_mod_map = XGetModifierMapping(g_display); + xwin_refresh_pointer_map(); xkeymap_init(); @@ -1689,7 +1721,7 @@ *input_mask |= LeaveWindowMask; } -BOOL +RD_BOOL ui_create_window(void) { uint8 null_pointer_mask[1] = { 0x80 }; @@ -1737,6 +1769,7 @@ } XStoreName(g_display, g_wnd, g_title); + ewmh_set_wm_name(g_wnd, g_title); if (g_hide_decorations) mwm_hide_decorations(g_wnd); @@ -1876,10 +1909,16 @@ } static void -handle_button_event(XEvent xevent, BOOL down) +handle_button_event(XEvent xevent, RD_BOOL down) { uint16 button, flags = 0; g_last_gesturetime = xevent.xbutton.time; + /* Reverse the pointer button mapping, e.g. in the case of + "left-handed mouse mode"; the RDP session expects to + receive physical buttons (true in mstsc as well) and + logical button behavior depends on the remote desktop's own + mouse settings */ + xevent.xbutton.button = g_pointer_log_to_phys_map[xevent.xbutton.button - 1]; button = xkeymap_translate_button(xevent.xbutton.button); if (button == 0) return; @@ -2167,6 +2206,12 @@ XFreeModifiermap(g_mod_map); g_mod_map = XGetModifierMapping(g_display); } + + if (xevent.xmapping.request == MappingPointer) + { + xwin_refresh_pointer_map(); + } + break; /* clipboard stuff */ @@ -2250,7 +2295,7 @@ int n; fd_set rfds, wfds; struct timeval tv; - BOOL s_timeout = False; + RD_BOOL s_timeout = False; while (True) { @@ -2268,18 +2313,14 @@ FD_SET(rdp_socket, &rfds); FD_SET(g_x_socket, &rfds); -#ifdef WITH_RDPSND - /* FIXME: there should be an API for registering fds */ - if (g_dsp_busy) - { - FD_SET(g_dsp_fd, &wfds); - n = (g_dsp_fd > n) ? g_dsp_fd : n; - } -#endif /* default timeout */ tv.tv_sec = 60; tv.tv_usec = 0; +#ifdef WITH_RDPSND + rdpsnd_add_fds(&n, &rfds, &wfds, &tv); +#endif + /* add redirection handles */ rdpdr_add_fds(&n, &rfds, &wfds, &tv, &s_timeout); seamless_select_timeout(&tv); @@ -2292,21 +2333,25 @@ error("select: %s\n", strerror(errno)); case 0: +#ifdef WITH_RDPSND + rdpsnd_check_fds(&rfds, &wfds); +#endif + /* Abort serial read calls */ if (s_timeout) - rdpdr_check_fds(&rfds, &wfds, (BOOL) True); + rdpdr_check_fds(&rfds, &wfds, (RD_BOOL) True); continue; } - rdpdr_check_fds(&rfds, &wfds, (BOOL) False); +#ifdef WITH_RDPSND + rdpsnd_check_fds(&rfds, &wfds); +#endif + + rdpdr_check_fds(&rfds, &wfds, (RD_BOOL) False); if (FD_ISSET(rdp_socket, &rfds)) return 1; -#ifdef WITH_RDPSND - if (g_dsp_busy && FD_ISSET(g_dsp_fd, &wfds)) - wave_out_play(); -#endif } } @@ -2316,7 +2361,7 @@ XWarpPointer(g_display, g_wnd, g_wnd, 0, 0, 0, 0, x, y); } -HBITMAP +RD_HBITMAP ui_create_bitmap(int width, int height, uint8 * data) { XImage *image; @@ -2346,7 +2391,7 @@ XFree(image); if (tdata != data) xfree(tdata); - return (HBITMAP) bitmap; + return (RD_HBITMAP) bitmap; } void @@ -2394,12 +2439,12 @@ } void -ui_destroy_bitmap(HBITMAP bmp) +ui_destroy_bitmap(RD_HBITMAP bmp) { XFreePixmap(g_display, (Pixmap) bmp); } -HGLYPH +RD_HGLYPH ui_create_glyph(int width, int height, uint8 * data) { XImage *image; @@ -2421,20 +2466,20 @@ XPutImage(g_display, bitmap, g_create_glyph_gc, image, 0, 0, 0, 0, width, height); XFree(image); - return (HGLYPH) bitmap; + return (RD_HGLYPH) bitmap; } void -ui_destroy_glyph(HGLYPH glyph) +ui_destroy_glyph(RD_HGLYPH glyph) { XFreePixmap(g_display, (Pixmap) glyph); } -HCURSOR +RD_HCURSOR ui_create_cursor(unsigned int x, unsigned int y, int width, int height, uint8 * andmask, uint8 * xormask) { - HGLYPH maskglyph, cursorglyph; + RD_HGLYPH maskglyph, cursorglyph; XColor bg, fg; Cursor xcursor; uint8 *cursor, *pcursor; @@ -2498,11 +2543,11 @@ ui_destroy_glyph(cursorglyph); xfree(mask); xfree(cursor); - return (HCURSOR) xcursor; + return (RD_HCURSOR) xcursor; } void -ui_set_cursor(HCURSOR cursor) +ui_set_cursor(RD_HCURSOR cursor) { g_current_cursor = (Cursor) cursor; XDefineCursor(g_display, g_wnd, g_current_cursor); @@ -2510,7 +2555,7 @@ } void -ui_destroy_cursor(HCURSOR cursor) +ui_destroy_cursor(RD_HCURSOR cursor) { XFreeCursor(g_display, (Cursor) cursor); } @@ -2528,7 +2573,7 @@ (xc)->flags = DoRed | DoGreen | DoBlue; -HCOLOURMAP +RD_HCOLOURMAP ui_create_colourmap(COLOURMAP * colours) { COLOURENTRY *entry; @@ -2624,12 +2669,12 @@ XStoreColors(g_display, map, xcolours, ncolours); xfree(xcolours); - return (HCOLOURMAP) map; + return (RD_HCOLOURMAP) map; } } void -ui_destroy_colourmap(HCOLOURMAP map) +ui_destroy_colourmap(RD_HCOLOURMAP map) { if (!g_owncolmap) xfree(map); @@ -2638,7 +2683,7 @@ } void -ui_set_colourmap(HCOLOURMAP map) +ui_set_colourmap(RD_HCOLOURMAP map) { if (!g_owncolmap) { @@ -2726,7 +2771,7 @@ FILL_RECTANGLE_BACKSTORE(x, y, cx, cy); XSetFillStyle(g_display, g_gc, FillSolid); XSetTSOrigin(g_display, g_gc, 0, 0); - ui_destroy_glyph((HGLYPH) fill); + ui_destroy_glyph((RD_HGLYPH) fill); break; case 3: /* Pattern */ @@ -2741,7 +2786,7 @@ FILL_RECTANGLE_BACKSTORE(x, y, cx, cy); XSetFillStyle(g_display, g_gc, FillSolid); XSetTSOrigin(g_display, g_gc, 0, 0); - ui_destroy_glyph((HGLYPH) fill); + ui_destroy_glyph((RD_HGLYPH) fill); break; default: @@ -2784,7 +2829,7 @@ void ui_memblt(uint8 opcode, /* dest */ int x, int y, int cx, int cy, - /* src */ HBITMAP src, int srcx, int srcy) + /* src */ RD_HBITMAP src, int srcx, int srcy) { SET_FUNCTION(opcode); XCopyArea(g_display, (Pixmap) src, g_wnd, g_gc, srcx, srcy, cx, cy, x, y); @@ -2799,7 +2844,7 @@ void ui_triblt(uint8 opcode, /* dest */ int x, int y, int cx, int cy, - /* src */ HBITMAP src, int srcx, int srcy, + /* src */ RD_HBITMAP src, int srcx, int srcy, /* brush */ BRUSH * brush, int bgcolour, int fgcolour) { /* This is potentially difficult to do in general. Until someone @@ -2857,7 +2902,7 @@ void ui_polygon(uint8 opcode, /* mode */ uint8 fillmode, - /* dest */ POINT * point, int npoints, + /* dest */ RD_POINT * point, int npoints, /* brush */ BRUSH * brush, int bgcolour, int fgcolour) { uint8 style, i, ipattern[8]; @@ -2900,7 +2945,7 @@ FILL_POLYGON((XPoint *) point, npoints); XSetFillStyle(g_display, g_gc, FillSolid); XSetTSOrigin(g_display, g_gc, 0, 0); - ui_destroy_glyph((HGLYPH) fill); + ui_destroy_glyph((RD_HGLYPH) fill); break; case 3: /* Pattern */ @@ -2915,7 +2960,7 @@ FILL_POLYGON((XPoint *) point, npoints); XSetFillStyle(g_display, g_gc, FillSolid); XSetTSOrigin(g_display, g_gc, 0, 0); - ui_destroy_glyph((HGLYPH) fill); + ui_destroy_glyph((RD_HGLYPH) fill); break; default: @@ -2927,7 +2972,7 @@ void ui_polyline(uint8 opcode, - /* dest */ POINT * points, int npoints, + /* dest */ RD_POINT * points, int npoints, /* pen */ PEN * pen) { /* TODO: set join style */ @@ -2978,7 +3023,7 @@ DRAW_ELLIPSE(x, y, cx, cy, fillmode); XSetFillStyle(g_display, g_gc, FillSolid); XSetTSOrigin(g_display, g_gc, 0, 0); - ui_destroy_glyph((HGLYPH) fill); + ui_destroy_glyph((RD_HGLYPH) fill); break; case 3: /* Pattern */ @@ -2993,7 +3038,7 @@ DRAW_ELLIPSE(x, y, cx, cy, fillmode); XSetFillStyle(g_display, g_gc, FillSolid); XSetTSOrigin(g_display, g_gc, 0, 0); - ui_destroy_glyph((HGLYPH) fill); + ui_destroy_glyph((RD_HGLYPH) fill); break; default: @@ -3007,7 +3052,7 @@ void ui_draw_glyph(int mixmode, /* dest */ int x, int y, int cx, int cy, - /* src */ HGLYPH glyph, int srcx, int srcy, + /* src */ RD_HGLYPH glyph, int srcx, int srcy, int bgcolour, int fgcolour) { SET_FOREGROUND(fgcolour); @@ -3192,12 +3237,14 @@ if (g_ownbackstore) { image = XGetImage(g_display, g_backstore, x, y, cx, cy, AllPlanes, ZPixmap); + exit_if_null(image); } else { pix = XCreatePixmap(g_display, g_wnd, cx, cy, g_depth); XCopyArea(g_display, g_wnd, pix, g_gc, x, y, cx, cy, 0, 0); image = XGetImage(g_display, pix, 0, 0, cx, cy, AllPlanes, ZPixmap); + exit_if_null(image); XFreePixmap(g_display, pix); } @@ -3219,7 +3266,7 @@ return; image = XCreateImage(g_display, g_visual, g_depth, ZPixmap, 0, - (char *) data, cx, cy, BitmapPad(g_display), cx * g_bpp / 8); + (char *) data, cx, cy, g_bpp, 0); if (g_ownbackstore) { @@ -3253,7 +3300,7 @@ void -ui_seamless_begin(BOOL hidden) +ui_seamless_begin(RD_BOOL hidden) { if (!g_seamless_rdp) return; @@ -3421,15 +3468,13 @@ XSetWMProtocols(g_display, wnd, &g_kill_atom, 1); sw = xmalloc(sizeof(seamless_window)); + + memset(sw, 0, sizeof(seamless_window)); + sw->wnd = wnd; sw->id = id; - sw->behind = 0; sw->group = sw_find_group(group, False); sw->group->refcnt++; - sw->xoffset = 0; - sw->yoffset = 0; - sw->width = 0; - sw->height = 0; sw->state = SEAMLESSRDP_NOTYETMAPPED; sw->desktop = 0; sw->position_timer = xmalloc(sizeof(struct timeval)); @@ -3497,6 +3542,93 @@ void +ui_seamless_seticon(unsigned long id, const char *format, int width, int height, int chunk, + const char *data, int chunk_len) +{ + seamless_window *sw; + + if (!g_seamless_active) + return; + + sw = sw_get_window_by_id(id); + if (!sw) + { + warning("ui_seamless_seticon: No information for window 0x%lx\n", id); + return; + } + + if (chunk == 0) + { + if (sw->icon_size) + warning("ui_seamless_seticon: New icon started before previous completed\n"); + + if (strcmp(format, "RGBA") != 0) + { + warning("ui_seamless_seticon: Uknown icon format \"%s\"\n", format); + return; + } + + sw->icon_size = width * height * 4; + if (sw->icon_size > 32 * 32 * 4) + { + warning("ui_seamless_seticon: Icon too large (%d bytes)\n", sw->icon_size); + sw->icon_size = 0; + return; + } + + sw->icon_offset = 0; + } + else + { + if (!sw->icon_size) + return; + } + + if (chunk_len > (sw->icon_size - sw->icon_offset)) + { + warning("ui_seamless_seticon: Too large chunk received (%d bytes > %d bytes)\n", + chunk_len, sw->icon_size - sw->icon_offset); + sw->icon_size = 0; + return; + } + + memcpy(sw->icon_buffer + sw->icon_offset, data, chunk_len); + sw->icon_offset += chunk_len; + + if (sw->icon_offset == sw->icon_size) + { + ewmh_set_icon(sw->wnd, width, height, sw->icon_buffer); + sw->icon_size = 0; + } +} + + +void +ui_seamless_delicon(unsigned long id, const char *format, int width, int height) +{ + seamless_window *sw; + + if (!g_seamless_active) + return; + + sw = sw_get_window_by_id(id); + if (!sw) + { + warning("ui_seamless_seticon: No information for window 0x%lx\n", id); + return; + } + + if (strcmp(format, "RGBA") != 0) + { + warning("ui_seamless_seticon: Uknown icon format \"%s\"\n", format); + return; + } + + ewmh_del_icon(sw->wnd, width, height); +} + + +void ui_seamless_move_window(unsigned long id, int x, int y, int width, int height, unsigned long flags) { seamless_window *sw;