diff --git a/reactos/base/applications/tsclient/rdesktop/current/COPYING b/reactos/base/applications/tsclient/rdesktop/current/COPYING new file mode 100644 index 00000000000..15fb334c821 --- /dev/null +++ b/reactos/base/applications/tsclient/rdesktop/current/COPYING @@ -0,0 +1,346 @@ +This software is released under the GNU General Public License +(reproduced below) with the additional exemption that compiling, +linking, and/or using OpenSSL together with this software is +allowed. + +--- + + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 675 Mass Ave, Cambridge, MA 02139, USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + Appendix: How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) 19yy + + 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. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/reactos/base/applications/tsclient/rdesktop/current/Makefile.in b/reactos/base/applications/tsclient/rdesktop/current/Makefile.in new file mode 100644 index 00000000000..b2edc5d063d --- /dev/null +++ b/reactos/base/applications/tsclient/rdesktop/current/Makefile.in @@ -0,0 +1,158 @@ +# +# rdesktop: A Remote Desktop Protocol client +# Makefile.in +# Copyright (C) Matthew Chapman 1999-2005 +# + +prefix = @prefix@ +exec_prefix = @exec_prefix@ +bindir = @bindir@ +mandir = @mandir@ +datadir = @datadir@ + +VERSION = @PACKAGE_VERSION@ +KEYMAP_PATH = $(datadir)/rdesktop/keymaps/ + +CC = @CC@ +INSTALL = @INSTALL@ +CFLAGS = @CFLAGS@ @X_CFLAGS@ @DEFS@ -DKEYMAP_PATH=\"$(KEYMAP_PATH)\" +LDFLAGS = @LDFLAGS@ @LIBS@ @X_LIBS@ @X_EXTRA_LIBS@ +STRIP = @STRIP@ + +TARGETS = rdesktop @RDP2VNCTARGET@ +VNCINC = @VNCINC@ +LDVNC = @LDVNC@ +VNCLINK = @VNCLINK@ +SOUNDOBJ = @SOUNDOBJ@ + +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 +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 + +rdp2vnc: $(VNCOBJ) $(SOUNDOBJ) $(RDPOBJ) + $(VNCLINK) $(CFLAGS) -o rdp2vnc $(VNCOBJ) $(SOUNDOBJ) $(RDPOBJ) $(LDFLAGS) $(LDVNC) + +vnc/rdp2vnc.o: rdesktop.c + $(CC) $(CFLAGS) $(VNCINC) -DRDP2VNC -o vnc/rdp2vnc.o -c rdesktop.c + +vnc/vnc.o: vnc/vnc.c + $(CC) $(CFLAGS) $(VNCINC) -DRDP2VNC -o vnc/vnc.o -c vnc/vnc.c + +vnc/xkeymap.o: xkeymap.c + $(CC) $(CFLAGS) $(VNCINC) -DRDP2VNC -o vnc/xkeymap.o -c xkeymap.c + +vnc/x11stubs.o: vnc/x11stubs.c + $(CC) $(CFLAGS) $(VNCINC) -o vnc/x11stubs.o -c vnc/x11stubs.c + +.PHONY: install +install: installbin installkeymaps installman + +.PHONY: installbin +installbin: rdesktop + mkdir -p $(DESTDIR)$(bindir) + $(INSTALL) rdesktop $(DESTDIR)$(bindir) + $(STRIP) $(DESTDIR)$(bindir)/rdesktop + chmod 755 $(DESTDIR)$(bindir)/rdesktop + +.PHONY: installman +installman: doc/rdesktop.1 + mkdir -p $(DESTDIR)$(mandir)/man1 + cp doc/rdesktop.1 $(DESTDIR)$(mandir)/man1 + chmod 644 $(DESTDIR)$(mandir)/man1/rdesktop.1 + +.PHONY: installkeymaps +installkeymaps: + mkdir -p $(DESTDIR)$(KEYMAP_PATH) +# Prevent copying the CVS directory + cp keymaps/?? keymaps/??-?? $(DESTDIR)$(KEYMAP_PATH) + cp keymaps/common $(DESTDIR)$(KEYMAP_PATH) + cp keymaps/modifiers $(DESTDIR)$(KEYMAP_PATH) + chmod 644 $(DESTDIR)$(KEYMAP_PATH)/* + +.PHONY: proto +proto: + cat proto.head > proto.h + 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 + cat proto.tail >> proto.h + +.PHONY: clean +clean: + rm -f *.o *~ vnc/*.o vnc/*~ rdesktop rdp2vnc + +.PHONY: distclean +distclean: clean + rm -rf autom4te.cache config.log config.status Makefile + +.PHONY: dist +dist: rdesktop-$(VERSION).tar.gz + +rdesktop-$(VERSION).tar.gz: Makefile configure + mkdir -p /tmp/rdesktop-make-dist-dir + ln -sf `pwd` /tmp/rdesktop-make-dist-dir/rdesktop-$(VERSION) + (cd /tmp/rdesktop-make-dist-dir; \ + tar zcvf rdesktop-$(VERSION)/rdesktop-$(VERSION).tar.gz \ + rdesktop-$(VERSION)/COPYING \ + rdesktop-$(VERSION)/README \ + rdesktop-$(VERSION)/configure \ + rdesktop-$(VERSION)/configure.ac \ + rdesktop-$(VERSION)/config.sub \ + rdesktop-$(VERSION)/config.guess \ + rdesktop-$(VERSION)/bootstrap \ + rdesktop-$(VERSION)/install-sh \ + rdesktop-$(VERSION)/Makefile.in \ + rdesktop-$(VERSION)/rdesktop.spec \ + rdesktop-$(VERSION)/*.c \ + rdesktop-$(VERSION)/*.h \ + rdesktop-$(VERSION)/proto.head \ + rdesktop-$(VERSION)/proto.tail \ + rdesktop-$(VERSION)/keymaps/?? \ + rdesktop-$(VERSION)/keymaps/??-?? \ + rdesktop-$(VERSION)/keymaps/common \ + rdesktop-$(VERSION)/keymaps/modifiers \ + rdesktop-$(VERSION)/keymaps/convert-map \ + rdesktop-$(VERSION)/doc/HACKING \ + rdesktop-$(VERSION)/doc/AUTHORS \ + rdesktop-$(VERSION)/doc/TODO \ + rdesktop-$(VERSION)/doc/ChangeLog \ + rdesktop-$(VERSION)/doc/keymapping.txt \ + rdesktop-$(VERSION)/doc/keymap-names.txt \ + rdesktop-$(VERSION)/doc/ipv6.txt \ + rdesktop-$(VERSION)/doc/licensing.txt \ + rdesktop-$(VERSION)/doc/patches.txt \ + rdesktop-$(VERSION)/doc/redirection.txt \ + rdesktop-$(VERSION)/doc/rdesktop.1 ) + rm -rf /tmp/rdesktop-make-dist-dir + +.PHONY: dist-noversion +dist-noversion: rdesktop.tar.gz + +rdesktop.tar.gz: rdesktop-$(VERSION).tar.gz + mkdir -p /tmp/rdesktop-make-dist-dir + tar zxvf $< -C /tmp/rdesktop-make-dist-dir + mv /tmp/rdesktop-make-dist-dir/rdesktop-$(VERSION) /tmp/rdesktop-make-dist-dir/rdesktop + ls /tmp/rdesktop-make-dist-dir/rdesktop + tar zcvf $@ -C /tmp/rdesktop-make-dist-dir rdesktop + rm -rf /tmp/rdesktop-make-dist-dir + +Makefile: Makefile.in configure + ./config.status + +configure: configure.ac + ./bootstrap + +.SUFFIXES: +.SUFFIXES: .c .o + +.c.o: + $(CC) $(CFLAGS) -o $@ -c $< + diff --git a/reactos/base/applications/tsclient/rdesktop/current/README b/reactos/base/applications/tsclient/rdesktop/current/README new file mode 100644 index 00000000000..11a5c8faac5 --- /dev/null +++ b/reactos/base/applications/tsclient/rdesktop/current/README @@ -0,0 +1,32 @@ +=========================================== +rdesktop: A Remote Desktop Protocol client. +=========================================== + +rdesktop is a client for Microsoft Windows NT Terminal Server, Windows 2000 +Terminal Services, Windows 2003 Terminal Services/Remote Desktop, Windows XP +Remote Desktop, and possibly other Terminal Services products. +rdesktop currently implements the RDP version 4 and 5 protocols. + +Installation +------------ +rdesktop uses a typical GNU-style build procedure: + + % ./configure [options] + % make + % make install + +where documentation for [options] can be found by running "./configure --help". +Usually no options are necessary. The default is to install under /usr/local, +this can be changed with --prefix=directory. + +Invocation +---------- + + % rdesktop [options] server + +where server is the name of the Terminal Services machine. Note: if you +receive "Connection refused", this probably means that the server does not have +Terminal Services enabled, or there is a firewall blocking access. + +The rdesktop manual page lists the possible options ("man rdesktop"). + diff --git a/reactos/base/applications/tsclient/rdesktop/current/bitmap.c b/reactos/base/applications/tsclient/rdesktop/current/bitmap.c new file mode 100644 index 00000000000..5ea484a4d99 --- /dev/null +++ b/reactos/base/applications/tsclient/rdesktop/current/bitmap.c @@ -0,0 +1,1021 @@ +/* -*- c-basic-offset: 8 -*- + rdesktop: A Remote Desktop Protocol client. + Bitmap decompression routines + Copyright (C) Matthew Chapman 1999-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. +*/ + +/* 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 + +/* indent is confused by this file */ +/* *INDENT-OFF* */ + +#include "rdesktop.h" + +#define CVAL(p) (*(p++)) +#ifdef NEED_ALIGN +#ifdef L_ENDIAN +#define CVAL2(p, v) { v = (*(p++)); v |= (*(p++)) << 8; } +#else +#define CVAL2(p, v) { v = (*(p++)) << 8; v |= (*(p++)); } +#endif /* L_ENDIAN */ +#else +#define CVAL2(p, v) { v = (*((uint16*)p)); p += 2; } +#endif /* NEED_ALIGN */ + +#define UNROLL8(exp) { exp exp exp exp exp exp exp exp } + +#define REPEAT(statement) \ +{ \ + while((count & ~0x7) && ((x+8) < width)) \ + UNROLL8( statement; count--; x++; ); \ + \ + while((count > 0) && (x < width)) \ + { \ + statement; \ + count--; \ + x++; \ + } \ +} + +#define MASK_UPDATE() \ +{ \ + mixmask <<= 1; \ + if (mixmask == 0) \ + { \ + mask = fom_mask ? fom_mask : CVAL(input); \ + mixmask = 1; \ + } \ +} + +#ifdef BITMAP_SPEED_OVER_SIZE + +/* 1 byte bitmap decompress */ +static BOOL +bitmap_decompress1(uint8 * output, int width, int height, uint8 * input, int size) +{ + 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; + uint8 colour1 = 0, colour2 = 0; + uint8 mixmask, mask = 0; + uint8 mix = 0xff; + int fom_mask = 0; + + while (input < end) + { + 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) + { + count = CVAL(input); + count |= CVAL(input) << 8; + } + else + { + count = (opcode < 0xb) ? 8 : 1; + } + 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 = CVAL(input); + case 3: /* Colour */ + colour2 = CVAL(input); + break; + case 6: /* SetMix/Mix */ + case 7: /* SetMix/FillOrMix */ + mix = CVAL(input); + 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) + { + if (x >= width) + { + if (height <= 0) + return False; + x = 0; + height--; + prevline = line; + line = output + height * width; + } + switch (opcode) + { + case 0: /* Fill */ + if (insertmix) + { + if (prevline == NULL) + line[x] = mix; + else + line[x] = prevline[x] ^ mix; + insertmix = False; + count--; + x++; + } + if (prevline == NULL) + { + REPEAT(line[x] = 0) + } + else + { + REPEAT(line[x] = prevline[x]) + } + break; + case 1: /* Mix */ + if (prevline == NULL) + { + REPEAT(line[x] = mix) + } + else + { + REPEAT(line[x] = prevline[x] ^ mix) + } + break; + case 2: /* Fill or Mix */ + if (prevline == NULL) + { + REPEAT + ( + MASK_UPDATE(); + if (mask & mixmask) + line[x] = mix; + else + line[x] = 0; + ) + } + else + { + REPEAT + ( + MASK_UPDATE(); + if (mask & mixmask) + line[x] = prevline[x] ^ mix; + else + line[x] = prevline[x]; + ) + } + break; + case 3: /* Colour */ + REPEAT(line[x] = colour2) + break; + case 4: /* Copy */ + REPEAT(line[x] = CVAL(input)) + break; + case 8: /* Bicolour */ + REPEAT + ( + if (bicolour) + { + line[x] = colour2; + bicolour = False; + } + else + { + line[x] = colour1; + bicolour = True; count++; + } + ) + break; + case 0xd: /* White */ + REPEAT(line[x] = 0xff) + break; + case 0xe: /* Black */ + REPEAT(line[x] = 0) + break; + default: + unimpl("bitmap opcode 0x%x\n", opcode); + return False; + } + } + } + return True; +} + +/* 2 byte bitmap decompress */ +static BOOL +bitmap_decompress2(uint8 * output, int width, int height, uint8 * input, int size) +{ + uint8 *end = input + size; + uint16 *prevline = NULL, *line = NULL; + int opcode, count, offset, isfillormix, x = width; + int lastopcode = -1, insertmix = False, bicolour = False; + uint8 code; + uint16 colour1 = 0, colour2 = 0; + uint8 mixmask, mask = 0; + uint16 mix = 0xffff; + int fom_mask = 0; + + while (input < end) + { + 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) + { + count = CVAL(input); + count |= CVAL(input) << 8; + } + else + { + count = (opcode < 0xb) ? 8 : 1; + } + 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 */ + CVAL2(input, colour1); + case 3: /* Colour */ + CVAL2(input, colour2); + break; + case 6: /* SetMix/Mix */ + case 7: /* SetMix/FillOrMix */ + CVAL2(input, mix); + 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) + { + if (x >= width) + { + if (height <= 0) + return False; + x = 0; + height--; + prevline = line; + line = ((uint16 *) output) + height * width; + } + switch (opcode) + { + case 0: /* Fill */ + if (insertmix) + { + if (prevline == NULL) + line[x] = mix; + else + line[x] = prevline[x] ^ mix; + insertmix = False; + count--; + x++; + } + if (prevline == NULL) + { + REPEAT(line[x] = 0) + } + else + { + REPEAT(line[x] = prevline[x]) + } + break; + case 1: /* Mix */ + if (prevline == NULL) + { + REPEAT(line[x] = mix) + } + else + { + REPEAT(line[x] = prevline[x] ^ mix) + } + break; + case 2: /* Fill or Mix */ + if (prevline == NULL) + { + REPEAT + ( + MASK_UPDATE(); + if (mask & mixmask) + line[x] = mix; + else + line[x] = 0; + ) + } + else + { + REPEAT + ( + MASK_UPDATE(); + if (mask & mixmask) + line[x] = prevline[x] ^ mix; + else + line[x] = prevline[x]; + ) + } + break; + case 3: /* Colour */ + REPEAT(line[x] = colour2) + break; + case 4: /* Copy */ + REPEAT(CVAL2(input, line[x])) + break; + case 8: /* Bicolour */ + REPEAT + ( + if (bicolour) + { + line[x] = colour2; + bicolour = False; + } + else + { + line[x] = colour1; + bicolour = True; + count++; + } + ) + break; + case 0xd: /* White */ + REPEAT(line[x] = 0xffff) + break; + case 0xe: /* Black */ + REPEAT(line[x] = 0) + break; + default: + unimpl("bitmap opcode 0x%x\n", opcode); + return False; + } + } + } + return True; +} + +/* 3 byte bitmap decompress */ +static BOOL +bitmap_decompress3(uint8 * output, int width, int height, uint8 * input, int size) +{ + 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; + uint8 colour1[3] = {0, 0, 0}, colour2[3] = {0, 0, 0}; + uint8 mixmask, mask = 0; + uint8 mix[3] = {0xff, 0xff, 0xff}; + int fom_mask = 0; + + while (input < end) + { + 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) + { + count = CVAL(input); + count |= CVAL(input) << 8; + } + else + { + count = (opcode < + 0xb) ? 8 : 1; + } + 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[0] = CVAL(input); + colour1[1] = CVAL(input); + colour1[2] = CVAL(input); + case 3: /* Colour */ + colour2[0] = CVAL(input); + colour2[1] = CVAL(input); + colour2[2] = CVAL(input); + break; + case 6: /* SetMix/Mix */ + case 7: /* SetMix/FillOrMix */ + mix[0] = CVAL(input); + mix[1] = CVAL(input); + mix[2] = CVAL(input); + 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) + { + if (x >= width) + { + if (height <= 0) + return False; + x = 0; + height--; + prevline = line; + line = output + height * (width * 3); + } + switch (opcode) + { + case 0: /* Fill */ + if (insertmix) + { + if (prevline == NULL) + { + line[x * 3] = mix[0]; + line[x * 3 + 1] = mix[1]; + line[x * 3 + 2] = mix[2]; + } + else + { + line[x * 3] = + prevline[x * 3] ^ mix[0]; + line[x * 3 + 1] = + prevline[x * 3 + 1] ^ mix[1]; + line[x * 3 + 2] = + prevline[x * 3 + 2] ^ mix[2]; + } + insertmix = False; + count--; + x++; + } + if (prevline == NULL) + { + REPEAT + ( + line[x * 3] = 0; + line[x * 3 + 1] = 0; + line[x * 3 + 2] = 0; + ) + } + else + { + REPEAT + ( + line[x * 3] = prevline[x * 3]; + line[x * 3 + 1] = prevline[x * 3 + 1]; + line[x * 3 + 2] = prevline[x * 3 + 2]; + ) + } + break; + case 1: /* Mix */ + if (prevline == NULL) + { + REPEAT + ( + line[x * 3] = mix[0]; + line[x * 3 + 1] = mix[1]; + line[x * 3 + 2] = mix[2]; + ) + } + else + { + REPEAT + ( + line[x * 3] = + prevline[x * 3] ^ mix[0]; + line[x * 3 + 1] = + prevline[x * 3 + 1] ^ mix[1]; + line[x * 3 + 2] = + prevline[x * 3 + 2] ^ mix[2]; + ) + } + break; + case 2: /* Fill or Mix */ + if (prevline == NULL) + { + REPEAT + ( + MASK_UPDATE(); + if (mask & mixmask) + { + line[x * 3] = mix[0]; + line[x * 3 + 1] = mix[1]; + line[x * 3 + 2] = mix[2]; + } + else + { + line[x * 3] = 0; + line[x * 3 + 1] = 0; + line[x * 3 + 2] = 0; + } + ) + } + else + { + REPEAT + ( + MASK_UPDATE(); + if (mask & mixmask) + { + line[x * 3] = + prevline[x * 3] ^ mix [0]; + line[x * 3 + 1] = + prevline[x * 3 + 1] ^ mix [1]; + line[x * 3 + 2] = + prevline[x * 3 + 2] ^ mix [2]; + } + else + { + line[x * 3] = + prevline[x * 3]; + line[x * 3 + 1] = + prevline[x * 3 + 1]; + line[x * 3 + 2] = + prevline[x * 3 + 2]; + } + ) + } + break; + case 3: /* Colour */ + REPEAT + ( + line[x * 3] = colour2 [0]; + line[x * 3 + 1] = colour2 [1]; + line[x * 3 + 2] = colour2 [2]; + ) + break; + case 4: /* Copy */ + REPEAT + ( + line[x * 3] = CVAL(input); + line[x * 3 + 1] = CVAL(input); + line[x * 3 + 2] = CVAL(input); + ) + break; + case 8: /* Bicolour */ + REPEAT + ( + if (bicolour) + { + line[x * 3] = colour2[0]; + line[x * 3 + 1] = colour2[1]; + line[x * 3 + 2] = colour2[2]; + bicolour = False; + } + else + { + line[x * 3] = colour1[0]; + line[x * 3 + 1] = colour1[1]; + line[x * 3 + 2] = colour1[2]; + bicolour = True; + count++; + } + ) + break; + case 0xd: /* White */ + REPEAT + ( + line[x * 3] = 0xff; + line[x * 3 + 1] = 0xff; + line[x * 3 + 2] = 0xff; + ) + break; + case 0xe: /* Black */ + REPEAT + ( + line[x * 3] = 0; + line[x * 3 + 1] = 0; + line[x * 3 + 2] = 0; + ) + break; + default: + unimpl("bitmap opcode 0x%x\n", opcode); + return False; + } + } + } + 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) +{ + 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) + { + 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) + { + count = CVAL(input); + count |= CVAL(input) << 8; + } + else + { + count = (opcode < 0xb) ? 8 : 1; + } + 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) + { + if (x >= width) + { + if (height <= 0) + return False; + + x = 0; + height--; + + prevline = line; + line = output + height * width * Bpp; + } + + switch (opcode) + { + 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) + { + REPEAT(MASK_UPDATE(); + if (mask & mixmask) setli(line, x, mix, Bpp); + else + setli(line, x, 0, Bpp);); + } + 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);); + } + 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; + } + } + } + + return True; +} + +#endif + +/* main decompress function */ +BOOL +bitmap_decompress(uint8 * output, int width, int height, uint8 * input, int size, int Bpp) +{ +#ifdef BITMAP_SPEED_OVER_SIZE + BOOL rv = False; + switch (Bpp) + { + case 1: + rv = bitmap_decompress1(output, width, height, input, size); + break; + case 2: + rv = bitmap_decompress2(output, width, height, input, size); + break; + case 3: + rv = bitmap_decompress3(output, width, height, input, size); + break; + } +#else + BOOL rv; + rv = bitmap_decompressx(output, width, height, input, size, Bpp); +#endif + return rv; +} + +/* *INDENT-ON* */ diff --git a/reactos/base/applications/tsclient/rdesktop/current/bootstrap b/reactos/base/applications/tsclient/rdesktop/current/bootstrap new file mode 100644 index 00000000000..c640c1de4e2 --- /dev/null +++ b/reactos/base/applications/tsclient/rdesktop/current/bootstrap @@ -0,0 +1,3 @@ +#!/bin/sh +rm -rf autom4te.cache +autoreconf -i diff --git a/reactos/base/applications/tsclient/rdesktop/current/cache.c b/reactos/base/applications/tsclient/rdesktop/current/cache.c new file mode 100644 index 00000000000..fe2d9227e2b --- /dev/null +++ b/reactos/base/applications/tsclient/rdesktop/current/cache.c @@ -0,0 +1,432 @@ +/* -*- c-basic-offset: 8 -*- + rdesktop: A Remote Desktop Protocol client. + Cache routines + Copyright (C) Matthew Chapman 1999-2005 + Copyright (C) Jeroen Meijer 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. +*/ + +#include "rdesktop.h" + +/* BITMAP CACHE */ +extern int g_pstcache_fd[]; + +#define NUM_ELEMENTS(array) (sizeof(array) / sizeof(array[0])) +#define IS_PERSISTENT(id) (g_pstcache_fd[id] > 0) +#define TO_TOP -1 +#define NOT_SET -1 +#define IS_SET(idx) (idx >= 0) + +/* + * TODO: Test for optimal value of BUMP_COUNT. TO_TOP gives lowest cpu utilisation but using + * a positive value will hopefully result in less frequently used bitmaps having a greater chance + * of being evicted from the cache, and therby reducing the need to load bitmaps from disk. + * (Jeroen) + */ +#define BUMP_COUNT 40 + +struct bmpcache_entry +{ + HBITMAP bitmap; + sint16 previous; + sint16 next; +}; + +static struct bmpcache_entry g_bmpcache[3][0xa00]; +static 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 }; +static int g_bmpcache_count[3]; + +/* Setup the bitmap cache lru/mru linked list */ +void +cache_rebuild_bmpcache_linked_list(uint8 id, sint16 * idx, int count) +{ + int n = count, c = 0; + sint16 n_idx; + + /* find top, skip evicted bitmaps */ + while (--n >= 0 && g_bmpcache[id][idx[n]].bitmap == NULL); + if (n < 0) + { + g_bmpcache_mru[id] = g_bmpcache_lru[id] = NOT_SET; + return; + } + + g_bmpcache_mru[id] = idx[n]; + g_bmpcache[id][idx[n]].next = NOT_SET; + n_idx = idx[n]; + c++; + + /* link list */ + while (n >= 0) + { + /* skip evicted bitmaps */ + while (--n >= 0 && g_bmpcache[id][idx[n]].bitmap == NULL); + + if (n < 0) + break; + + g_bmpcache[id][n_idx].previous = idx[n]; + g_bmpcache[id][idx[n]].next = n_idx; + n_idx = idx[n]; + c++; + } + + g_bmpcache[id][n_idx].previous = NOT_SET; + g_bmpcache_lru[id] = n_idx; + + if (c != g_bmpcache_count[id]) + { + error("Oops. %d in bitmap cache linked list, %d in ui cache...\n", c, + g_bmpcache_count[id]); + exit(1); + } +} + +/* Move a bitmap to a new position in the linked list. */ +void +cache_bump_bitmap(uint8 id, uint16 idx, int bump) +{ + int p_idx, n_idx, n; + + if (!IS_PERSISTENT(id)) + return; + + if (g_bmpcache_mru[id] == idx) + return; + + DEBUG_RDP5(("bump bitmap: id=%d, idx=%d, bump=%d\n", id, idx, bump)); + + n_idx = g_bmpcache[id][idx].next; + p_idx = g_bmpcache[id][idx].previous; + + if (IS_SET(n_idx)) + { + /* remove */ + --g_bmpcache_count[id]; + if (IS_SET(p_idx)) + g_bmpcache[id][p_idx].next = n_idx; + else + g_bmpcache_lru[id] = n_idx; + if (IS_SET(n_idx)) + g_bmpcache[id][n_idx].previous = p_idx; + else + g_bmpcache_mru[id] = p_idx; + } + else + { + p_idx = NOT_SET; + n_idx = g_bmpcache_lru[id]; + } + + if (bump >= 0) + { + for (n = 0; n < bump && IS_SET(n_idx); n++) + { + p_idx = n_idx; + n_idx = g_bmpcache[id][p_idx].next; + } + } + else + { + p_idx = g_bmpcache_mru[id]; + n_idx = NOT_SET; + } + + /* insert */ + ++g_bmpcache_count[id]; + g_bmpcache[id][idx].previous = p_idx; + g_bmpcache[id][idx].next = n_idx; + + if (p_idx >= 0) + g_bmpcache[id][p_idx].next = idx; + else + g_bmpcache_lru[id] = idx; + + if (n_idx >= 0) + g_bmpcache[id][n_idx].previous = idx; + else + g_bmpcache_mru[id] = idx; +} + +/* Evict the least-recently used bitmap from the cache */ +void +cache_evict_bitmap(uint8 id) +{ + uint16 idx; + int n_idx; + + if (!IS_PERSISTENT(id)) + return; + + idx = g_bmpcache_lru[id]; + n_idx = g_bmpcache[id][idx].next; + DEBUG_RDP5(("evict bitmap: id=%d idx=%d n_idx=%d bmp=0x%x\n", id, idx, n_idx, + g_bmpcache[id][idx].bitmap)); + + ui_destroy_bitmap(g_bmpcache[id][idx].bitmap); + --g_bmpcache_count[id]; + g_bmpcache[id][idx].bitmap = 0; + + g_bmpcache_lru[id] = n_idx; + g_bmpcache[id][n_idx].previous = NOT_SET; + + pstcache_touch_bitmap(id, idx, 0); +} + +/* Retrieve a bitmap from the cache */ +HBITMAP +cache_get_bitmap(uint8 id, uint16 idx) +{ + if ((id < NUM_ELEMENTS(g_bmpcache)) && (idx < NUM_ELEMENTS(g_bmpcache[0]))) + { + if (g_bmpcache[id][idx].bitmap || pstcache_load_bitmap(id, idx)) + { + if (IS_PERSISTENT(id)) + cache_bump_bitmap(id, idx, BUMP_COUNT); + + return g_bmpcache[id][idx].bitmap; + } + } + else if ((id < NUM_ELEMENTS(g_volatile_bc)) && (idx == 0x7fff)) + { + return g_volatile_bc[id]; + } + + error("get bitmap %d:%d\n", id, idx); + return NULL; +} + +/* Store a bitmap in the cache */ +void +cache_put_bitmap(uint8 id, uint16 idx, HBITMAP bitmap) +{ + HBITMAP old; + + if ((id < NUM_ELEMENTS(g_bmpcache)) && (idx < NUM_ELEMENTS(g_bmpcache[0]))) + { + old = g_bmpcache[id][idx].bitmap; + if (old != NULL) + ui_destroy_bitmap(old); + g_bmpcache[id][idx].bitmap = bitmap; + + if (IS_PERSISTENT(id)) + { + if (old == NULL) + g_bmpcache[id][idx].previous = g_bmpcache[id][idx].next = NOT_SET; + + cache_bump_bitmap(id, idx, TO_TOP); + if (g_bmpcache_count[id] > BMPCACHE2_C2_CELLS) + cache_evict_bitmap(id); + } + } + else if ((id < NUM_ELEMENTS(g_volatile_bc)) && (idx == 0x7fff)) + { + old = g_volatile_bc[id]; + if (old != NULL) + ui_destroy_bitmap(old); + g_volatile_bc[id] = bitmap; + } + else + { + error("put bitmap %d:%d\n", id, idx); + } +} + +/* Updates the persistent bitmap cache MRU information on exit */ +void +cache_save_state(void) +{ + uint32 id = 0, t = 0; + int idx; + + for (id = 0; id < NUM_ELEMENTS(g_bmpcache); id++) + if (IS_PERSISTENT(id)) + { + DEBUG_RDP5(("Saving cache state for bitmap cache %d...", id)); + idx = g_bmpcache_lru[id]; + while (idx >= 0) + { + pstcache_touch_bitmap(id, idx, ++t); + idx = g_bmpcache[id][idx].next; + } + DEBUG_RDP5((" %d stamps written.\n", t)); + } +} + + +/* FONT CACHE */ +static FONTGLYPH g_fontcache[12][256]; + +/* Retrieve a glyph from the font cache */ +FONTGLYPH * +cache_get_font(uint8 font, uint16 character) +{ + FONTGLYPH *glyph; + + if ((font < NUM_ELEMENTS(g_fontcache)) && (character < NUM_ELEMENTS(g_fontcache[0]))) + { + glyph = &g_fontcache[font][character]; + if (glyph->pixmap != NULL) + return glyph; + } + + error("get font %d:%d\n", font, character); + return NULL; +} + +/* 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) +{ + FONTGLYPH *glyph; + + if ((font < NUM_ELEMENTS(g_fontcache)) && (character < NUM_ELEMENTS(g_fontcache[0]))) + { + glyph = &g_fontcache[font][character]; + if (glyph->pixmap != NULL) + ui_destroy_glyph(glyph->pixmap); + + glyph->offset = offset; + glyph->baseline = baseline; + glyph->width = width; + glyph->height = height; + glyph->pixmap = pixmap; + } + else + { + error("put font %d:%d\n", font, character); + } +} + + +/* TEXT CACHE */ +static DATABLOB g_textcache[256]; + +/* Retrieve a text item from the cache */ +DATABLOB * +cache_get_text(uint8 cache_id) +{ + DATABLOB *text; + + text = &g_textcache[cache_id]; + return text; +} + +/* Store a text item in the cache */ +void +cache_put_text(uint8 cache_id, void *data, int length) +{ + DATABLOB *text; + + text = &g_textcache[cache_id]; + if (text->data != NULL) + xfree(text->data); + text->data = xmalloc(length); + text->size = length; + memcpy(text->data, data, length); +} + + +/* DESKTOP CACHE */ +static uint8 g_deskcache[0x38400 * 4]; + +/* Retrieve desktop data from the cache */ +uint8 * +cache_get_desktop(uint32 offset, int cx, int cy, int bytes_per_pixel) +{ + int length = cx * cy * bytes_per_pixel; + + if (offset > sizeof(g_deskcache)) + offset = 0; + + if ((offset + length) <= sizeof(g_deskcache)) + { + return &g_deskcache[offset]; + } + + error("get desktop %d:%d\n", offset, length); + return NULL; +} + +/* Store desktop data in the cache */ +void +cache_put_desktop(uint32 offset, int cx, int cy, int scanline, int bytes_per_pixel, uint8 * data) +{ + int length = cx * cy * bytes_per_pixel; + + if (offset > sizeof(g_deskcache)) + offset = 0; + + if ((offset + length) <= sizeof(g_deskcache)) + { + cx *= bytes_per_pixel; + while (cy--) + { + memcpy(&g_deskcache[offset], data, cx); + data += scanline; + offset += cx; + } + } + else + { + error("put desktop %d:%d\n", offset, length); + } +} + + +/* CURSOR CACHE */ +static HCURSOR g_cursorcache[0x20]; + +/* Retrieve cursor from cache */ +HCURSOR +cache_get_cursor(uint16 cache_idx) +{ + HCURSOR cursor; + + if (cache_idx < NUM_ELEMENTS(g_cursorcache)) + { + cursor = g_cursorcache[cache_idx]; + if (cursor != NULL) + return cursor; + } + + error("get cursor %d\n", cache_idx); + return NULL; +} + +/* Store cursor in cache */ +void +cache_put_cursor(uint16 cache_idx, HCURSOR cursor) +{ + HCURSOR old; + + if (cache_idx < NUM_ELEMENTS(g_cursorcache)) + { + old = g_cursorcache[cache_idx]; + if (old != NULL) + ui_destroy_cursor(old); + + g_cursorcache[cache_idx] = cursor; + } + else + { + error("put cursor %d\n", cache_idx); + } +} diff --git a/reactos/base/applications/tsclient/rdesktop/current/channels.c b/reactos/base/applications/tsclient/rdesktop/current/channels.c new file mode 100644 index 00000000000..850648b0a71 --- /dev/null +++ b/reactos/base/applications/tsclient/rdesktop/current/channels.c @@ -0,0 +1,181 @@ +/* -*- c-basic-offset: 8 -*- + rdesktop: A Remote Desktop Protocol client. + Protocol services - Virtual channels + Copyright (C) Erik Forsberg 2003 + Copyright (C) Matthew Chapman 2003-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. +*/ + +#include "rdesktop.h" + +#define MAX_CHANNELS 6 +#define CHANNEL_CHUNK_LENGTH 1600 +#define CHANNEL_FLAG_FIRST 0x01 +#define CHANNEL_FLAG_LAST 0x02 +#define CHANNEL_FLAG_SHOW_PROTOCOL 0x10 + +extern BOOL g_use_rdp5; +extern BOOL g_encryption; + +VCHANNEL g_channels[MAX_CHANNELS]; +unsigned int g_num_channels; + +/* FIXME: We should use the information in TAG_SRV_CHANNELS to map RDP5 + channels to MCS channels. + + The format of TAG_SRV_CHANNELS seems to be + + global_channel_no (uint16le) + number_of_other_channels (uint16le) + ..followed by uint16les for the other channels. +*/ + +VCHANNEL * +channel_register(char *name, uint32 flags, void (*callback) (STREAM)) +{ + VCHANNEL *channel; + + if (!g_use_rdp5) + return NULL; + + if (g_num_channels >= MAX_CHANNELS) + { + error("Channel table full, increase MAX_CHANNELS\n"); + return NULL; + } + + channel = &g_channels[g_num_channels]; + channel->mcs_id = MCS_GLOBAL_CHANNEL + 1 + g_num_channels; + strncpy(channel->name, name, 8); + channel->flags = flags; + channel->process = callback; + g_num_channels++; + return channel; +} + +STREAM +channel_init(VCHANNEL * channel, uint32 length) +{ + STREAM s; + + s = sec_init(g_encryption ? SEC_ENCRYPT : 0, length + 8); + s_push_layer(s, channel_hdr, 8); + return s; +} + +void +channel_send(STREAM s, VCHANNEL * channel) +{ + uint32 length, flags; + uint32 thislength, remaining; + uint8 *data; + + /* first fragment sent in-place */ + s_pop_layer(s, channel_hdr); + length = s->end - s->p - 8; + + DEBUG_CHANNEL(("channel_send, length = %d\n", length)); + + thislength = MIN(length, CHANNEL_CHUNK_LENGTH); +/* Note: In the original clipboard implementation, this number was + 1592, not 1600. However, I don't remember the reason and 1600 seems + to work so.. This applies only to *this* length, not the length of + continuation or ending packets. */ + remaining = length - thislength; + flags = (remaining == 0) ? CHANNEL_FLAG_FIRST | CHANNEL_FLAG_LAST : CHANNEL_FLAG_FIRST; + if (channel->flags & CHANNEL_OPTION_SHOW_PROTOCOL) + flags |= CHANNEL_FLAG_SHOW_PROTOCOL; + + out_uint32_le(s, length); + out_uint32_le(s, flags); + data = s->end = s->p + thislength; + DEBUG_CHANNEL(("Sending %d bytes with FLAG_FIRST\n", thislength)); + sec_send_to_channel(s, g_encryption ? SEC_ENCRYPT : 0, channel->mcs_id); + + /* subsequent segments copied (otherwise would have to generate headers backwards) */ + while (remaining > 0) + { + thislength = MIN(remaining, CHANNEL_CHUNK_LENGTH); + remaining -= thislength; + flags = (remaining == 0) ? CHANNEL_FLAG_LAST : 0; + if (channel->flags & CHANNEL_OPTION_SHOW_PROTOCOL) + flags |= CHANNEL_FLAG_SHOW_PROTOCOL; + + DEBUG_CHANNEL(("Sending %d bytes with flags %d\n", thislength, flags)); + + s = sec_init(g_encryption ? SEC_ENCRYPT : 0, thislength + 8); + out_uint32_le(s, length); + out_uint32_le(s, flags); + out_uint8p(s, data, thislength); + s_mark_end(s); + sec_send_to_channel(s, g_encryption ? SEC_ENCRYPT : 0, channel->mcs_id); + + data += thislength; + } +} + +void +channel_process(STREAM s, uint16 mcs_channel) +{ + uint32 length, flags; + uint32 thislength; + VCHANNEL *channel = NULL; + unsigned int i; + STREAM in; + + for (i = 0; i < g_num_channels; i++) + { + channel = &g_channels[i]; + if (channel->mcs_id == mcs_channel) + break; + } + + if (i >= g_num_channels) + return; + + in_uint32_le(s, length); + in_uint32_le(s, flags); + if ((flags & CHANNEL_FLAG_FIRST) && (flags & CHANNEL_FLAG_LAST)) + { + /* single fragment - pass straight up */ + channel->process(s); + } + else + { + /* add fragment to defragmentation buffer */ + in = &channel->in; + if (flags & CHANNEL_FLAG_FIRST) + { + if (length > in->size) + { + in->data = (uint8 *) xrealloc(in->data, length); + in->size = length; + } + in->p = in->data; + } + + thislength = MIN(s->end - s->p, in->data + in->size - in->p); + memcpy(in->p, s->p, thislength); + in->p += thislength; + + if (flags & CHANNEL_FLAG_LAST) + { + in->end = in->p; + in->p = in->data; + channel->process(in); + } + } +} diff --git a/reactos/base/applications/tsclient/rdesktop/current/cliprdr.c b/reactos/base/applications/tsclient/rdesktop/current/cliprdr.c new file mode 100644 index 00000000000..3b2bcfeaab5 --- /dev/null +++ b/reactos/base/applications/tsclient/rdesktop/current/cliprdr.c @@ -0,0 +1,187 @@ +/* -*- c-basic-offset: 8 -*- + rdesktop: A Remote Desktop Protocol client. + Protocol services - Clipboard functions + Copyright (C) Erik Forsberg 2003 + Copyright (C) Matthew Chapman 2003 + + 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" + +#define CLIPRDR_CONNECT 1 +#define CLIPRDR_FORMAT_ANNOUNCE 2 +#define CLIPRDR_FORMAT_ACK 3 +#define CLIPRDR_DATA_REQUEST 4 +#define CLIPRDR_DATA_RESPONSE 5 + +#define CLIPRDR_REQUEST 0 +#define CLIPRDR_RESPONSE 1 +#define CLIPRDR_ERROR 2 + +static VCHANNEL *cliprdr_channel; + +static uint8 *last_formats = NULL; +static uint32 last_formats_length = 0; + +static void +cliprdr_send_packet(uint16 type, uint16 status, uint8 * data, uint32 length) +{ + STREAM s; + + DEBUG_CLIPBOARD(("CLIPRDR send: type=%d, status=%d, length=%d\n", type, status, length)); + + s = channel_init(cliprdr_channel, length + 12); + out_uint16_le(s, type); + out_uint16_le(s, status); + out_uint32_le(s, length); + out_uint8p(s, data, length); + out_uint32(s, 0); /* pad? */ + s_mark_end(s); + channel_send(s, cliprdr_channel); +} + +/* Helper which announces our readiness to supply clipboard data + in a single format (such as CF_TEXT) to the RDP side. + To announce more than one format at a time, use + cliprdr_send_native_format_announce. + */ +void +cliprdr_send_simple_native_format_announce(uint32 format) +{ + uint8 buffer[36]; + + DEBUG_CLIPBOARD(("cliprdr_send_simple_native_format_announce\n")); + + buf_out_uint32(buffer, format); + memset(buffer + 4, 0, sizeof(buffer) - 4); /* description */ + cliprdr_send_native_format_announce(buffer, sizeof(buffer)); +} + +/* Announces our readiness to supply clipboard data in multiple + formats, each denoted by a 36-byte format descriptor of + [ uint32 format + 32-byte description ]. + */ +void +cliprdr_send_native_format_announce(uint8 * formats_data, uint32 formats_data_length) +{ + DEBUG_CLIPBOARD(("cliprdr_send_native_format_announce\n")); + + cliprdr_send_packet(CLIPRDR_FORMAT_ANNOUNCE, CLIPRDR_REQUEST, formats_data, + formats_data_length); + + if (formats_data != last_formats) + { + if (last_formats) + xfree(last_formats); + + last_formats = xmalloc(formats_data_length); + memcpy(last_formats, formats_data, formats_data_length); + last_formats_length = formats_data_length; + } +} + +void +cliprdr_send_data_request(uint32 format) +{ + uint8 buffer[4]; + + DEBUG_CLIPBOARD(("cliprdr_send_data_request\n")); + buf_out_uint32(buffer, format); + cliprdr_send_packet(CLIPRDR_DATA_REQUEST, CLIPRDR_REQUEST, buffer, sizeof(buffer)); +} + +void +cliprdr_send_data(uint8 * data, uint32 length) +{ + DEBUG_CLIPBOARD(("cliprdr_send_data\n")); + cliprdr_send_packet(CLIPRDR_DATA_RESPONSE, CLIPRDR_RESPONSE, data, length); +} + +static void +cliprdr_process(STREAM s) +{ + uint16 type, status; + uint32 length, format; + uint8 *data; + + in_uint16_le(s, type); + in_uint16_le(s, status); + in_uint32_le(s, length); + data = s->p; + + DEBUG_CLIPBOARD(("CLIPRDR recv: type=%d, status=%d, length=%d\n", type, status, length)); + + if (status == CLIPRDR_ERROR) + { + switch (type) + { + case CLIPRDR_FORMAT_ACK: + /* FIXME: We seem to get this when we send an announce while the server is + still processing a paste. Try sending another announce. */ + cliprdr_send_native_format_announce(last_formats, + last_formats_length); + break; + case CLIPRDR_DATA_RESPONSE: + ui_clip_request_failed(); + break; + default: + DEBUG_CLIPBOARD(("CLIPRDR error (type=%d)\n", type)); + } + + return; + } + + switch (type) + { + case CLIPRDR_CONNECT: + ui_clip_sync(); + break; + case CLIPRDR_FORMAT_ANNOUNCE: + ui_clip_format_announce(data, length); + cliprdr_send_packet(CLIPRDR_FORMAT_ACK, CLIPRDR_RESPONSE, NULL, 0); + return; + case CLIPRDR_FORMAT_ACK: + break; + case CLIPRDR_DATA_REQUEST: + in_uint32_le(s, format); + ui_clip_request_data(format); + break; + case CLIPRDR_DATA_RESPONSE: + ui_clip_handle_data(data, length); + break; + case 7: /* TODO: W2K3 SP1 sends this on connect with a value of 1 */ + break; + default: + unimpl("CLIPRDR packet type %d\n", type); + } +} + +void +cliprdr_set_mode(const char *optarg) +{ + ui_clip_set_mode(optarg); +} + +BOOL +cliprdr_init(void) +{ + cliprdr_channel = + channel_register("cliprdr", + CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_ENCRYPT_RDP | + CHANNEL_OPTION_COMPRESS_RDP | CHANNEL_OPTION_SHOW_PROTOCOL, + cliprdr_process); + return (cliprdr_channel != NULL); +} diff --git a/reactos/base/applications/tsclient/rdesktop/current/config.guess b/reactos/base/applications/tsclient/rdesktop/current/config.guess new file mode 100644 index 00000000000..654648f1711 --- /dev/null +++ b/reactos/base/applications/tsclient/rdesktop/current/config.guess @@ -0,0 +1,1411 @@ +#! /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. + +timestamp='2003-06-17' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Originally written by Per Bothner . +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# The plan is that this can be called by configure scripts if you +# don't specify an explicit build system type. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + +trap 'exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +# Portable tmp directory creation inspired by the Autoconf team. + +set_cc_for_build=' +trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; +: ${TMPDIR=/tmp} ; + { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; +dummy=$tmp/dummy ; +tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > $dummy.c ; + for c in cc gcc c89 c99 ; do + if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac ;' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +## 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 + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + sysctl="sysctl -n hw.machine_arch" + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + case "${UNAME_MACHINE_ARCH}" in + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE_ARCH}" in + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case "${UNAME_VERSION}" in + Debian*) + release='-gnu' + ;; + *) + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + ;; + esac + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit 0 ;; + 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 ;; + *:OpenBSD:*:*) + echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + alpha:OSF1:*:*) + if test $UNAME_RELEASE = "V4.0"; then + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + fi + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case "$ALPHA_CPU_TYPE" in + "EV4 (21064)") + UNAME_MACHINE="alpha" ;; + "EV4.5 (21064)") + UNAME_MACHINE="alpha" ;; + "LCA4 (21066/21068)") + UNAME_MACHINE="alpha" ;; + "EV5 (21164)") + UNAME_MACHINE="alphaev5" ;; + "EV5.6 (21164A)") + UNAME_MACHINE="alphaev56" ;; + "EV5.6 (21164PC)") + UNAME_MACHINE="alphapca56" ;; + "EV5.7 (21164PC)") + UNAME_MACHINE="alphapca57" ;; + "EV6 (21264)") + UNAME_MACHINE="alphaev6" ;; + "EV6.7 (21264A)") + UNAME_MACHINE="alphaev67" ;; + "EV6.8CB (21264C)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8AL (21264B)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8CX (21264D)") + UNAME_MACHINE="alphaev68" ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE="alphaev69" ;; + "EV7 (21364)") + UNAME_MACHINE="alphaev7" ;; + "EV7.9 (21364A)") + UNAME_MACHINE="alphaev79" ;; + esac + # A 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 ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit 0 ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit 0 ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit 0;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit 0 ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos + exit 0 ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit 0 ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit 0;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit 0;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit 0 ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit 0 ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit 0 ;; + DRS?6000:UNIX_SV:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7 && exit 0 ;; + esac ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + i86pc:SunOS:5.*:*) + echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit 0 ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit 0 ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit 0 ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit 0 ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit 0 ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit 0 ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit 0 ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit 0 ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit 0 ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit 0 ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c \ + && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ + && exit 0 + echo mips-mips-riscos${UNAME_RELEASE} + exit 0 ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit 0 ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit 0 ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax + exit 0 ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit 0 ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit 0 ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit 0 ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit 0 ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit 0 ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit 0 ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit 0 ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit 0 ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit 0 ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit 0 ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit 0 ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 + echo rs6000-ibm-aix3.2.5 + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit 0 ;; + *:AIX:*:[45]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit 0 ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit 0 ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit 0 ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit 0 ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit 0 ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit 0 ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit 0 ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + esac ;; + esac + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + test -z "$HP_ARCH" && HP_ARCH=hppa + fi ;; + esac + if [ ${HP_ARCH} = "hppa2.0w" ] + then + # avoid double evaluation of $set_cc_for_build + test -n "$CC_FOR_BUILD" || eval $set_cc_for_build + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null + then + HP_ARCH="hppa2.0w" + else + HP_ARCH="hppa64" + fi + fi + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit 0 ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit 0 ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 + echo unknown-hitachi-hiuxwe2 + exit 0 ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit 0 ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit 0 ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit 0 ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit 0 ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit 0 ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit 0 ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit 0 ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit 0 ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit 0 ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit 0 ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit 0 ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + *:UNICOS/mp:*:*) + echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit 0 ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit 0 ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:FreeBSD:*:*|*: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 ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit 0 ;; + i*:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit 0 ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit 0 ;; + x86:Interix*:[34]*) + echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//' + exit 0 ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks + exit 0 ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i586-pc-interix + exit 0 ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit 0 ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit 0 ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + *:GNU:*:*) + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit 0 ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit 0 ;; + arm*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + cris:Linux:*:*) + echo cris-axis-linux-gnu + exit 0 ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-${VENDOR:-unknown}-linux-gnu + exit 0 ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + mips:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips + #undef mipsel + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mipsel + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips + #else + CPU= + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` + test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 + ;; + mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips64 + #undef mips64el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mips64el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips64 + #else + CPU= + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` + test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 + ;; + ppc:Linux:*:*) + echo powerpc-${VENDOR:-unknown}-linux-gnu + exit 0 ;; + ppc64:Linux:*:*) + echo powerpc64-${VENDOR:-unknown}-linux-gnu + exit 0 ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit 0 ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit 0 ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit 0 ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-${VENDOR:-ibm}-linux-gnu + exit 0 ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + x86_64:Linux:*:*) + echo x86_64-${VENDOR:-unknown}-linux-gnu + exit 0 ;; + i*86:Linux:*:*) + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. + # Set LC_ALL=C to ensure ld outputs messages in English. + ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ + | sed -ne '/supported targets:/!d + s/[ ][ ]*/ /g + s/.*supported targets: *// + s/ .*// + p'` + case "$ld_supported_targets" in + elf32-i386) + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + ;; + a.out-i386-linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit 0 ;; + coff-i386) + echo "${UNAME_MACHINE}-pc-linux-gnucoff" + exit 0 ;; + "") + # Either a pre-BFD a.out linker (linux-gnuoldld) or + # one that does not give us useful --help. + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + exit 0 ;; + esac + # Determine whether the default compiler is a.out or elf + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + #ifdef __ELF__ + # ifdef __GLIBC__ + # if __GLIBC__ >= 2 + LIBC=gnu + # else + LIBC=gnulibc1 + # endif + # else + LIBC=gnulibc1 + # endif + #else + #ifdef __INTEL_COMPILER + LIBC=gnu + #else + LIBC=gnuaout + #endif + #endif +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 + ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit 0 ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit 0 ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit 0 ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit 0 ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit 0 ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit 0 ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit 0 ;; + i*86:*:5:[78]*) + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit 0 ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit 0 ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i386. + echo i386-pc-msdosdjgpp + exit 0 ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit 0 ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit 0 ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit 0 ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit 0 ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit 0 ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix + exit 0 ;; + M68*:*:R3V[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) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4.3${OS_REL} && exit 0 + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4 && exit 0 ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit 0 ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit 0 ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit 0 ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit 0 ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit 0 ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit 0 ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit 0 ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit 0 ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit 0 ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit 0 ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit 0 ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit 0 ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit 0 ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit 0 ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit 0 ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} + exit 0 ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Darwin:*:*) + case `uname -p` in + *86) UNAME_PROCESSOR=i686 ;; + powerpc) UNAME_PROCESSOR=powerpc ;; + esac + echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} + exit 0 ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = "x86"; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} + exit 0 ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit 0 ;; + NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit 0 ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit 0 ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit 0 ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit 0 ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit 0 ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit 0 ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit 0 ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit 0 ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit 0 ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit 0 ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit 0 ;; + SEI:*:*:SEIUX) + echo mips-sei-seiux${UNAME_RELEASE} + exit 0 ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +eval $set_cc_for_build +cat >$dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0 + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit 0 ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + c34*) + echo c34-convex-bsd + exit 0 ;; + c38*) + echo c38-convex-bsd + exit 0 ;; + c4*) + echo c4-convex-bsd + exit 0 ;; + esac +fi + +cat >&2 < in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/reactos/base/applications/tsclient/rdesktop/current/config.sub b/reactos/base/applications/tsclient/rdesktop/current/config.sub new file mode 100644 index 00000000000..3ec9d2845b3 --- /dev/null +++ b/reactos/base/applications/tsclient/rdesktop/current/config.sub @@ -0,0 +1,1500 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + +timestamp='2003-06-18' + +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit 0;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu* | freebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis) + os= + basic_machine=$1 + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ + | c4x | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | ip2k \ + | m32r | m68000 | m68k | m88k | mcore \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64vr | mips64vrel \ + | mips64orion | mips64orionel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | msp430 \ + | ns16k | ns32k \ + | openrisc | 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 \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \ + | strongarm \ + | tahoe | thumb | tic4x | tic80 | tron \ + | v850 | v850e \ + | we32k \ + | x86 | xscale | xstormy16 | xtensa \ + | z8k) + basic_machine=$basic_machine-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* \ + | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ + | clipper-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* \ + | m32r-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | mcore-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipstx39-* | mipstx39el-* \ + | msp430-* \ + | none-* | np1-* | nv1-* | 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-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ + | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ + | tahoe-* | thumb-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | tron-* \ + | v850-* | v850e-* | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ + | xtensa-* \ + | ymp-* \ + | z8k-*) + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amd64) + basic_machine=x86_64-pc + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | j90) + basic_machine=j90-cray + os=-unicos + ;; + crds | unos) + basic_machine=m68k-crds + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + decsystem10* | dec10*) + basic_machine=pdp10-dec + os=-tops10 + ;; + decsystem20* | dec20*) + basic_machine=pdp10-dec + os=-tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + mmix*) + basic_machine=mmix-knuth + os=-mmixware + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + morphos) + basic_machine=powerpc-unknown + os=-morphos + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + nv1) + basic_machine=nv1-cray + os=-unicosmp + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + or32 | or32-*) + basic_machine=or32-unknown + os=-coff + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon | athlon_*) + basic_machine=i686-pc + ;; + pentiumii | pentium2 | pentiumiii | pentium3) + basic_machine=i686-pc + ;; + pentium4) + basic_machine=i786-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium4-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sb1) + basic_machine=mipsisa64sb1-unknown + ;; + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparclite-wrs | simso-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray + os=-unicos + ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; + tic55x | c55x*) + basic_machine=tic55x-unknown + os=-coff + ;; + tic6x | c6x*) + basic_machine=tic6x-unknown + os=-coff + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + toad1) + basic_machine=pdp10-xkl + os=-tops20 + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + romp) + basic_machine=romp-ibm + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele) + basic_machine=sh-unknown + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparc | sparcv9 | sparcv9b) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -netbsd* | -openbsd* | -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* \ + | -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*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto-qnx*) + ;; + -nto*) + os=`echo $os | sed -e 's|nto|nto-qnx|'` + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -atheos*) + os=-atheos + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -nova*) + os=-rtmk-nova + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -aros*) + os=-aros + ;; + -kaos*) + os=-kaos + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + c4x-* | tic4x-*) + os=-coff + ;; + # This must come before the *-dec entry. + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + or32-*) + os=-coff + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-ibm) + os=-aix + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -vxsim* | -vxworks* | -windiss*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + -vos*) + vendor=stratus + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/reactos/base/applications/tsclient/rdesktop/current/configure.ac b/reactos/base/applications/tsclient/rdesktop/current/configure.ac new file mode 100644 index 00000000000..91c993f5378 --- /dev/null +++ b/reactos/base/applications/tsclient/rdesktop/current/configure.ac @@ -0,0 +1,727 @@ +AC_INIT(rdesktop, 1.4.1) + +AC_CONFIG_SRCDIR([rdesktop.c]) + +AC_PROG_CC +if test "$GCC" = yes; then + CFLAGS="$CFLAGS -Wall" +fi + +AC_PROG_INSTALL +AC_LANG_C +AC_HEADER_STDC +AC_C_BIGENDIAN([AC_DEFINE(B_ENDIAN)], [AC_DEFINE(L_ENDIAN)]) +AC_PATH_XTRA + +AC_SEARCH_LIBS(socket, socket) +AC_SEARCH_LIBS(inet_aton, resolv) + +AC_CHECK_HEADER(sys/select.h, AC_DEFINE(HAVE_SYS_SELECT_H)) +AC_CHECK_HEADER(sys/modem.h, AC_DEFINE(HAVE_SYS_MODEM_H)) +AC_CHECK_HEADER(sys/filio.h, AC_DEFINE(HAVE_SYS_FILIO_H)) +AC_CHECK_HEADER(sys/strtio.h, AC_DEFINE(HAVE_SYS_STRTIO_H)) +AC_CHECK_HEADER(locale.h, AC_DEFINE(HAVE_LOCALE_H)) +AC_CHECK_HEADER(langinfo.h, AC_DEFINE(HAVE_LANGINFO_H)) + +AC_CHECK_TOOL(STRIP, strip, :) + +rpath="" + +# +# OpenSSL detection borrowed from stunnel +# +checkssldir() { : + if test -f "$1/include/openssl/ssl.h"; then + ssldir="$1" + return 0 + fi + return 1 +} +AC_MSG_CHECKING([for OpenSSL directory]) +AC_ARG_WITH(openssl, + [ --with-openssl=DIR look for OpenSSL at DIR/include, DIR/lib], + [ + dnl Check the specified location only + checkssldir "$withval" + ], + [ + dnl Search default locations of OpenSSL library + for maindir in /usr/local /usr/lib /usr/pkg /usr /var/ssl /opt; do + for dir in $maindir $maindir/openssl $maindir/ssl; do + checkssldir $dir && break 2 + done + done + ] +) +if test -z "$ssldir"; then + AC_MSG_RESULT([Not found]) + echo + echo "Couldn't find your OpenSSL library installation dir" + echo "Use --with-openssl option to fix this problem" + echo + exit 1 +fi +AC_MSG_RESULT([$ssldir]) +AC_SUBST(ssldir) +AC_DEFINE_UNQUOTED(ssldir, "$ssldir") + +dnl Add OpenSSL includes and libraries +CFLAGS="$CFLAGS -I$ssldir/include" +AC_ARG_ENABLE(static-openssl, + [ --enable-static-openssl link OpenSSL statically], + [ +LIBS="$LIBS $ssldir/lib/libcrypto.a" + ], + [ +LIBS="$LIBS -L$ssldir/lib -lcrypto" +rpath="$rpath:$ssldir/lib" + ]) + + +# +# Alignment +# +AC_MSG_CHECKING([if architecture needs alignment]) +AC_TRY_RUN([ +#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_MSG_RESULT(no)], + [AC_MSG_RESULT(yes) + AC_DEFINE(NEED_ALIGN)], + [AC_MSG_RESULT(assuming yes) + AC_DEFINE(NEED_ALIGN)]) + + +# +# EGD +# +AC_ARG_WITH(egd-socket, + [ --with-egd-socket=PATH look for Entropy Gathering Daemon socket at PATH], + [EGD_SOCKET="$withval"], + [EGD_SOCKET="/var/run/egd-pool"] +) +AC_DEFINE_UNQUOTED(EGD_SOCKET, "$EGD_SOCKET") + + +# +# rdp2vnc +# +vncserverconfig=libvncserver-config +AC_ARG_WITH(libvncserver-config, + [ --with-libvncserver-config=CMD use CMD as libvncserver-config], + [vncserverconfig="$withval"] +) +AC_ARG_WITH(libvncserver, + [ --with-libvncserver make rdp2vnc], + [ + VNCINC=`$vncserverconfig --cflags` + AC_SUBST(VNCINC) + LDVNC=`$vncserverconfig --libs` + AC_SUBST(LDVNC) + VNCLINK=`$vncserverconfig --link` + AC_SUBST(VNCLINK) + RDP2VNCTARGET="rdp2vnc" + AC_SUBST(RDP2VNCTARGET) + ] +) + +# +# 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") ], + [ + 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]) +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" + 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 +AC_SUBST(SOUNDOBJ) + +# +# dirfd +# +dnl Find out how to get the file descriptor associated with an open DIR*. +dnl From Jim Meyering + +AC_DEFUN([UTILS_FUNC_DIRFD], +[ + + AC_HEADER_DIRENT + dirfd_headers=' +#if HAVE_DIRENT_H +# include +#else /* not HAVE_DIRENT_H */ +# define dirent direct +# if HAVE_SYS_NDIR_H +# include +# endif /* HAVE_SYS_NDIR_H */ +# if HAVE_SYS_DIR_H +# include +# endif /* HAVE_SYS_DIR_H */ +# if HAVE_NDIR_H +# include +# endif /* HAVE_NDIR_H */ +#endif /* HAVE_DIRENT_H */ +' + AC_CHECK_FUNCS(dirfd) + AC_CHECK_DECLS([dirfd], , , $dirfd_headers) + + AC_CACHE_CHECK([whether dirfd is a macro], + jm_cv_func_dirfd_macro, + [AC_EGREP_CPP([dirent_header_defines_dirfd], [$dirfd_headers +#ifdef dirfd + dirent_header_defines_dirfd +#endif], + jm_cv_func_dirfd_macro=yes, + jm_cv_func_dirfd_macro=no)]) + + # Use the replacement only if we have no function, macro, + # or declaration with that name. + if test $ac_cv_func_dirfd,$ac_cv_have_decl_dirfd,$jm_cv_func_dirfd_macro \ + = no,no,no; then + AC_REPLACE_FUNCS([dirfd]) + AC_CACHE_CHECK( + [how to get the file descriptor associated with an open DIR*], + gl_cv_sys_dir_fd_member_name, + [ + dirfd_save_CFLAGS=$CFLAGS + for ac_expr in d_fd dd_fd; do + + CFLAGS="$CFLAGS -DDIR_FD_MEMBER_NAME=$ac_expr" + AC_TRY_COMPILE( + [$dirfd_headers + ], + [DIR *dir_p = opendir("."); (void) dir_p->DIR_FD_MEMBER_NAME;], + dir_fd_found=yes + ) + CFLAGS=$dirfd_save_CFLAGS + test "$dir_fd_found" = yes && break + done + test "$dir_fd_found" = yes || ac_expr=no_such_member + + gl_cv_sys_dir_fd_member_name=$ac_expr + ] + ) + if test $gl_cv_sys_dir_fd_member_name != no_such_member; then + AC_DEFINE_UNQUOTED(DIR_FD_MEMBER_NAME, + $gl_cv_sys_dir_fd_member_name, + [the name of the file descriptor member of DIR]) + fi + AH_VERBATIM(DIR_TO_FD, + [#ifdef DIR_FD_MEMBER_NAME +# define DIR_TO_FD(Dir_p) ((Dir_p)->DIR_FD_MEMBER_NAME) +#else +# define DIR_TO_FD(Dir_p) -1 +#endif +] + ) + fi +]) + +UTILS_FUNC_DIRFD + +# +# iconv +# + +dnl This macros shamelessly stolen from +dnl http://gcc.gnu.org/ml/gcc-bugs/2001-06/msg01398.html. +dnl Written by Bruno Haible. + +AC_DEFUN([UTILS_FUNC_ICONV], +[ + dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and + dnl those with the standalone portable GNU libiconv installed). + + AC_ARG_WITH([libiconv-prefix], +[ --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib], [ + 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 + ]) + AC_CHECK_HEADER(iconv.h, AC_DEFINE(HAVE_ICONV_H)) + + AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [ + am_cv_func_iconv="no, consider installing GNU libiconv" + am_cv_lib_iconv=no + AC_TRY_LINK([#include +#include ], + [iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);], + am_cv_func_iconv=yes) + if test "$am_cv_func_iconv" != yes; then + am_save_LIBS="$LIBS" + LIBS="$LIBS -liconv" + AC_TRY_LINK([#include +#include ], + [iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);], + am_cv_lib_iconv=yes + am_cv_func_iconv=yes) + LIBS="$am_save_LIBS" + fi + ]) + if test "$am_cv_func_iconv" = yes; then + AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.]) + AC_MSG_CHECKING([for iconv declaration]) + AC_CACHE_VAL(am_cv_proto_iconv, [ + AC_TRY_COMPILE([ +#include +#include +extern +#ifdef __cplusplus +"C" +#endif +#if defined(__STDC__) || defined(__cplusplus) +size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); +#else +size_t iconv(); +#endif +], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const") + 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);"]) + am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` + AC_MSG_RESULT([$]{ac_t:- + }[$]am_cv_proto_iconv) + AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1, + [Define as const if the declaration of iconv() needs const.]) + fi + LIBICONV= + if test "$am_cv_lib_iconv" = yes; then + LIBICONV="-liconv" + fi + AC_SUBST(LIBICONV) +]) + +UTILS_FUNC_ICONV +LIBS="$LIBS $LIBICONV" + +# +# socklen_t +# from curl + +dnl Check for socklen_t: historically on BSD it is an int, and in +dnl POSIX 1g it is a type of its own, but some platforms use different +dnl types for the argument to getsockopt, getpeername, etc. So we +dnl have to test to find something that will work. +AC_DEFUN([TYPE_SOCKLEN_T], +[ + AC_CHECK_TYPE([socklen_t], ,[ + AC_MSG_CHECKING([for socklen_t equivalent]) + AC_CACHE_VAL([socklen_t_equiv], + [ + # Systems have either "struct sockaddr *" or + # "void *" as the second argument to getpeername + socklen_t_equiv= + for arg2 in "struct sockaddr" void; do + for t in int size_t unsigned long "unsigned long"; do + AC_TRY_COMPILE([ + #include + #include + + int getpeername (int, $arg2 *, $t *); + ],[ + $t len; + getpeername(0,0,&len); + ],[ + socklen_t_equiv="$t" + break + ]) + done + done + + if test "x$socklen_t_equiv" = x; then + AC_MSG_ERROR([Cannot find a type to use in place of socklen_t]) + fi + ]) + AC_MSG_RESULT($socklen_t_equiv) + AC_DEFINE_UNQUOTED(socklen_t, $socklen_t_equiv, + [type to use in place of socklen_t if not defined])], + [#include +#include ]) +]) + +TYPE_SOCKLEN_T + +# +# statfs stuff +# +AC_CHECK_HEADERS(sys/vfs.h) +AC_CHECK_HEADERS(sys/statvfs.h) +AC_CHECK_HEADERS(sys/statfs.h) +AC_CHECK_HEADERS(sys/param.h) + +mount_includes="\ + $ac_includes_default + #if HAVE_SYS_PARAM_H + # include + #endif + " + +AC_CHECK_HEADERS(sys/mount.h,,,[$mount_includes]) + +################################################# +# these tests are taken from the GNU fileutils package +AC_CHECKING(how to get filesystem space usage) +space=no + +# Test for statvfs64. +if test $space = no; then + # SVR4 + AC_CACHE_CHECK([statvfs64 function (SVR4)], fu_cv_sys_stat_statvfs64, + [AC_TRY_RUN([ +#if defined(HAVE_UNISTD_H) +#include +#endif +#include +#include + main () + { + struct statvfs64 fsd; + exit (statvfs64 (".", &fsd)); + }], + fu_cv_sys_stat_statvfs64=yes, + fu_cv_sys_stat_statvfs64=no, + fu_cv_sys_stat_statvfs64=cross)]) + if test $fu_cv_sys_stat_statvfs64 = yes; then + space=yes + AC_DEFINE(STAT_STATVFS64,1,[Whether statvfs64() is available]) + fi +fi + +# Perform only the link test since it seems there are no variants of the +# statvfs function. This check is more than just AC_CHECK_FUNCS(statvfs) +# because that got a false positive on SCO OSR5. Adding the declaration +# of a `struct statvfs' causes this test to fail (as it should) on such +# systems. That system is reported to work fine with STAT_STATFS4 which +# is what it gets when this test fails. +if test $space = no; then + # SVR4 + AC_CACHE_CHECK([statvfs function (SVR4)], fu_cv_sys_stat_statvfs, + [AC_TRY_LINK([#include +#include ], + [struct statvfs fsd; statvfs (0, &fsd);], + fu_cv_sys_stat_statvfs=yes, + fu_cv_sys_stat_statvfs=no)]) + if test $fu_cv_sys_stat_statvfs = yes; then + space=yes + AC_DEFINE(STAT_STATVFS,1,[Whether statvfs() is available]) + fi +fi + +if test $space = no; then + # DEC Alpha running OSF/1 + AC_MSG_CHECKING([for 3-argument statfs function (DEC OSF/1)]) + AC_CACHE_VAL(fu_cv_sys_stat_statfs3_osf1, + [AC_TRY_RUN([ +#include +#include +#include + main () + { + struct statfs fsd; + fsd.f_fsize = 0; + exit (statfs (".", &fsd, sizeof (struct statfs))); + }], + fu_cv_sys_stat_statfs3_osf1=yes, + fu_cv_sys_stat_statfs3_osf1=no, + fu_cv_sys_stat_statfs3_osf1=no)]) + + +#C_MSG_RESULT($fu_cv_sys_stat_statfs3_osf1) + if test $fu_cv_sys_stat_statfs3_osf1 = yes; then + space=yes + AC_DEFINE(STAT_STATFS3_OSF1,1,[Whether statfs requires 3 arguments]) + fi +fi + +if test $space = no; then +# AIX + AC_MSG_CHECKING([for two-argument statfs with statfs.bsize dnl +member (AIX, 4.3BSD)]) + AC_CACHE_VAL(fu_cv_sys_stat_statfs2_bsize, + [AC_TRY_RUN([ +#ifdef HAVE_SYS_PARAM_H +#include +#endif +#ifdef HAVE_SYS_MOUNT_H +#include +#endif +#ifdef HAVE_SYS_VFS_H +#include +#endif + main () + { + struct statfs fsd; + fsd.f_bsize = 0; + exit (statfs (".", &fsd)); + }], + fu_cv_sys_stat_statfs2_bsize=yes, + fu_cv_sys_stat_statfs2_bsize=no, + fu_cv_sys_stat_statfs2_bsize=no)]) + AC_MSG_RESULT($fu_cv_sys_stat_statfs2_bsize) + if test $fu_cv_sys_stat_statfs2_bsize = yes; then + space=yes + AC_DEFINE(STAT_STATFS2_BSIZE,1,[Whether statfs requires two arguments and struct statfs has bsize property]) + fi +fi + +if test $space = no; then +# SVR3 + AC_MSG_CHECKING([for four-argument statfs (AIX-3.2.5, SVR3)]) + AC_CACHE_VAL(fu_cv_sys_stat_statfs4, + [AC_TRY_RUN([#include +#include + main () + { + struct statfs fsd; + exit (statfs (".", &fsd, sizeof fsd, 0)); + }], + fu_cv_sys_stat_statfs4=yes, + fu_cv_sys_stat_statfs4=no, + fu_cv_sys_stat_statfs4=no)]) + AC_MSG_RESULT($fu_cv_sys_stat_statfs4) + if test $fu_cv_sys_stat_statfs4 = yes; then + space=yes + AC_DEFINE(STAT_STATFS4,1,[Whether statfs requires 4 arguments]) + fi +fi + +if test $space = no; then +# 4.4BSD and NetBSD + AC_MSG_CHECKING([for two-argument statfs with statfs.fsize dnl +member (4.4BSD and NetBSD)]) + AC_CACHE_VAL(fu_cv_sys_stat_statfs2_fsize, + [AC_TRY_RUN([#include +#ifdef HAVE_SYS_PARAM_H +#include +#endif +#ifdef HAVE_SYS_MOUNT_H +#include +#endif + main () + { + struct statfs fsd; + fsd.f_fsize = 0; + exit (statfs (".", &fsd)); + }], + fu_cv_sys_stat_statfs2_fsize=yes, + fu_cv_sys_stat_statfs2_fsize=no, + fu_cv_sys_stat_statfs2_fsize=no)]) + AC_MSG_RESULT($fu_cv_sys_stat_statfs2_fsize) + if test $fu_cv_sys_stat_statfs2_fsize = yes; then + space=yes + AC_DEFINE(STAT_STATFS2_FSIZE,1,[Whether statfs requires 2 arguments and struct statfs has fsize]) + fi +fi + +if test $space = no; then + # Ultrix + AC_MSG_CHECKING([for two-argument statfs with struct fs_data (Ultrix)]) + AC_CACHE_VAL(fu_cv_sys_stat_fs_data, + [AC_TRY_RUN([#include +#ifdef HAVE_SYS_PARAM_H +#include +#endif +#ifdef HAVE_SYS_MOUNT_H +#include +#endif +#ifdef HAVE_SYS_FS_TYPES_H +#include +#endif + main () + { + struct fs_data fsd; + /* Ultrix's statfs returns 1 for success, + 0 for not mounted, -1 for failure. */ + exit (statfs (".", &fsd) != 1); + }], + fu_cv_sys_stat_fs_data=yes, + fu_cv_sys_stat_fs_data=no, + fu_cv_sys_stat_fs_data=no)]) + AC_MSG_RESULT($fu_cv_sys_stat_fs_data) + if test $fu_cv_sys_stat_fs_data = yes; then + space=yes + AC_DEFINE(STAT_STATFS2_FS_DATA,1,[Whether statfs requires 2 arguments and struct fs_data is available]) + fi +fi + + statxfs_includes="\ +$ac_includes_default +#if HAVE_SYS_STATVFS_H +# include +#endif +#if HAVE_SYS_VFS_H +# include +#endif +#if !HAVE_SYS_STATVFS_H && !HAVE_SYS_VFS_H +# if HAVE_SYS_MOUNT_H && HAVE_SYS_PARAM_H +/* NetBSD 1.5.2 needs these, for the declaration of struct statfs. */ +# include +# include +# elif HAVE_NETINET_IN_H && HAVE_NFS_NFS_CLNT_H && HAVE_NFS_VFS_H +/* Ultrix 4.4 needs these for the declaration of struct statfs. */ +# include +# include +# include +# endif +#endif +" + +AC_CHECK_MEMBERS([struct statfs.f_namemax],,,[$statxfs_includes]) +AC_CHECK_MEMBERS([struct statvfs.f_namemax],,,[$statxfs_includes]) +AC_CHECK_MEMBERS([struct statfs.f_namelen],,,[$statxfs_includes]) +AC_CHECK_MEMBERS([struct statvfs.f_namelen],,,[$statxfs_includes]) + +# +# Large file support +# +AC_SYS_LARGEFILE + +# +# mntent +# +AC_CHECK_HEADER(mntent.h, AC_DEFINE(HAVE_MNTENT_H)) +AC_CHECK_FUNCS(setmntent) + +# +# IPv6 +# +AC_ARG_WITH(ipv6, + [ --with-ipv6 enable IPv6-support], + [ + if test $withval != "no"; + then + AC_DEFINE(IPv6,1) + fi + ]) + + +# +# debugging +# +AC_ARG_WITH(debug, + [ --with-debug enable protocol debugging output], + [ + if test $withval != "no"; + then + AC_DEFINE(WITH_DEBUG,1) + fi + ]) + +AC_ARG_WITH(debug-kbd, + [ --with-debug-kbd enable debugging of keyboard handling], + [ + if test $withval != "no"; + then + AC_DEFINE(WITH_DEBUG_KBD,1) + fi + ]) + +AC_ARG_WITH(debug-rdp5, + [ --with-debug-rdp5 enable debugging of RDP5 code], + [ + if test $withval != "no"; + then + AC_DEFINE(WITH_DEBUG_RDP5,1) + fi + ]) + +AC_ARG_WITH(debug-clipboard, + [ --with-debug-clipboard enable debugging of clipboard code], + [ + if test $withval != "no"; + then + AC_DEFINE(WITH_DEBUG_CLIPBOARD,1) + fi + ]) + +AC_ARG_WITH(debug-channel, + [ --with-debug-channel enable debugging of virtual channel code], + [ + if test $withval != "no"; + then + AC_DEFINE(WITH_DEBUG_CHANNEL,1) + fi + ]) + + +# +# target-specific stuff +# +# strip leading colon from rpath +rpath=`echo $rpath |sed 's/^://'` +AC_CANONICAL_HOST +case "$host" in +*-*-solaris*) + LDFLAGS="$LDFLAGS -R$rpath" + ;; +*-dec-osf*) + LDFLAGS="$LDFLAGS -Wl,-rpath,$rpath" + ;; +*-*-hpux*) + CFLAGS="$CFLAGS -D_XOPEN_SOURCE_EXTENDED" + ;; +*-*-irix6.5*) + LIBS="$LIBS -L$ssldir/lib32 -lcrypto" + CFLAGS="$CFLAGS -D__SGI_IRIX__" + ;; +esac + + +AC_OUTPUT(Makefile) + +dnl Local Variables: +dnl comment-start: "dnl " +dnl comment-end: "" +dnl comment-start-skip: "\\bdnl\\b\\s *" +dnl compile-command: "autoconf" +dnl End: diff --git a/reactos/base/applications/tsclient/rdesktop/current/constants.h b/reactos/base/applications/tsclient/rdesktop/current/constants.h new file mode 100644 index 00000000000..703c823140e --- /dev/null +++ b/reactos/base/applications/tsclient/rdesktop/current/constants.h @@ -0,0 +1,427 @@ +/* + rdesktop: A Remote Desktop Protocol client. + Miscellaneous protocol constants + Copyright (C) Matthew Chapman 1999-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. +*/ + +/* TCP port for Remote Desktop Protocol */ +#define TCP_PORT_RDP 3389 + +#define DEFAULT_CODEPAGE "UTF-8" +#define WINDOWS_CODEPAGE "UTF-16LE" + +/* ISO PDU codes */ +enum ISO_PDU_CODE +{ + ISO_PDU_CR = 0xE0, /* Connection Request */ + ISO_PDU_CC = 0xD0, /* Connection Confirm */ + ISO_PDU_DR = 0x80, /* Disconnect Request */ + ISO_PDU_DT = 0xF0, /* Data */ + ISO_PDU_ER = 0x70 /* Error */ +}; + +/* MCS PDU codes */ +enum MCS_PDU_TYPE +{ + MCS_EDRQ = 1, /* Erect Domain Request */ + MCS_DPUM = 8, /* Disconnect Provider Ultimatum */ + MCS_AURQ = 10, /* Attach User Request */ + MCS_AUCF = 11, /* Attach User Confirm */ + MCS_CJRQ = 14, /* Channel Join Request */ + MCS_CJCF = 15, /* Channel Join Confirm */ + MCS_SDRQ = 25, /* Send Data Request */ + MCS_SDIN = 26 /* Send Data Indication */ +}; + +#define MCS_CONNECT_INITIAL 0x7f65 +#define MCS_CONNECT_RESPONSE 0x7f66 + +#define BER_TAG_BOOLEAN 1 +#define BER_TAG_INTEGER 2 +#define BER_TAG_OCTET_STRING 4 +#define BER_TAG_RESULT 10 +#define MCS_TAG_DOMAIN_PARAMS 0x30 + +#define MCS_GLOBAL_CHANNEL 1003 +#define MCS_USERCHANNEL_BASE 1001 + +/* RDP secure transport constants */ +#define SEC_RANDOM_SIZE 32 +#define SEC_MODULUS_SIZE 64 +#define SEC_MAX_MODULUS_SIZE 256 +#define SEC_PADDING_SIZE 8 +#define SEC_EXPONENT_SIZE 4 + +#define SEC_CLIENT_RANDOM 0x0001 +#define SEC_ENCRYPT 0x0008 +#define SEC_LOGON_INFO 0x0040 +#define SEC_LICENCE_NEG 0x0080 +#define SEC_REDIRECT_ENCRYPT 0x0C00 + +#define SEC_TAG_SRV_INFO 0x0c01 +#define SEC_TAG_SRV_CRYPT 0x0c02 +#define SEC_TAG_SRV_CHANNELS 0x0c03 + +#define SEC_TAG_CLI_INFO 0xc001 +#define SEC_TAG_CLI_CRYPT 0xc002 +#define SEC_TAG_CLI_CHANNELS 0xc003 +#define SEC_TAG_CLI_4 0xc004 + +#define SEC_TAG_PUBKEY 0x0006 +#define SEC_TAG_KEYSIG 0x0008 + +#define SEC_RSA_MAGIC 0x31415352 /* RSA1 */ + +/* RDP licensing constants */ +#define LICENCE_TOKEN_SIZE 10 +#define LICENCE_HWID_SIZE 20 +#define LICENCE_SIGNATURE_SIZE 16 + +#define LICENCE_TAG_DEMAND 0x01 +#define LICENCE_TAG_AUTHREQ 0x02 +#define LICENCE_TAG_ISSUE 0x03 +#define LICENCE_TAG_REISSUE 0x04 +#define LICENCE_TAG_PRESENT 0x12 +#define LICENCE_TAG_REQUEST 0x13 +#define LICENCE_TAG_AUTHRESP 0x15 +#define LICENCE_TAG_RESULT 0xff + +#define LICENCE_TAG_USER 0x000f +#define LICENCE_TAG_HOST 0x0010 + +/* RDP PDU codes */ +enum RDP_PDU_TYPE +{ + RDP_PDU_DEMAND_ACTIVE = 1, + RDP_PDU_CONFIRM_ACTIVE = 3, + RDP_PDU_REDIRECT = 4, /* MS Server 2003 Session Redirect */ + RDP_PDU_DEACTIVATE = 6, + RDP_PDU_DATA = 7 +}; + +enum RDP_DATA_PDU_TYPE +{ + RDP_DATA_PDU_UPDATE = 2, + RDP_DATA_PDU_CONTROL = 20, + RDP_DATA_PDU_POINTER = 27, + RDP_DATA_PDU_INPUT = 28, + RDP_DATA_PDU_SYNCHRONISE = 31, + RDP_DATA_PDU_BELL = 34, + RDP_DATA_PDU_CLIENT_WINDOW_STATUS = 35, + RDP_DATA_PDU_LOGON = 38, + RDP_DATA_PDU_FONT2 = 39, + RDP_DATA_PDU_KEYBOARD_INDICATORS = 41, + RDP_DATA_PDU_DISCONNECT = 47 +}; + +enum RDP_CONTROL_PDU_TYPE +{ + RDP_CTL_REQUEST_CONTROL = 1, + RDP_CTL_GRANT_CONTROL = 2, + RDP_CTL_DETACH = 3, + RDP_CTL_COOPERATE = 4 +}; + +enum RDP_UPDATE_PDU_TYPE +{ + RDP_UPDATE_ORDERS = 0, + RDP_UPDATE_BITMAP = 1, + RDP_UPDATE_PALETTE = 2, + RDP_UPDATE_SYNCHRONIZE = 3 +}; + +enum RDP_POINTER_PDU_TYPE +{ + RDP_POINTER_SYSTEM = 1, + RDP_POINTER_MOVE = 3, + RDP_POINTER_COLOR = 6, + RDP_POINTER_CACHED = 7 +}; + +enum RDP_SYSTEM_POINTER_TYPE +{ + RDP_NULL_POINTER = 0, + RDP_DEFAULT_POINTER = 0x7F00 +}; + +enum RDP_INPUT_DEVICE +{ + RDP_INPUT_SYNCHRONIZE = 0, + RDP_INPUT_CODEPOINT = 1, + RDP_INPUT_VIRTKEY = 2, + RDP_INPUT_SCANCODE = 4, + RDP_INPUT_MOUSE = 0x8001 +}; + +/* Device flags */ +#define KBD_FLAG_RIGHT 0x0001 +#define KBD_FLAG_EXT 0x0100 +#define KBD_FLAG_QUIET 0x1000 +#define KBD_FLAG_DOWN 0x4000 +#define KBD_FLAG_UP 0x8000 + +/* These are for synchronization; not for keystrokes */ +#define KBD_FLAG_SCROLL 0x0001 +#define KBD_FLAG_NUMLOCK 0x0002 +#define KBD_FLAG_CAPITAL 0x0004 + +/* See T.128 */ +#define RDP_KEYPRESS 0 +#define RDP_KEYRELEASE (KBD_FLAG_DOWN | KBD_FLAG_UP) + +#define MOUSE_FLAG_MOVE 0x0800 +#define MOUSE_FLAG_BUTTON1 0x1000 +#define MOUSE_FLAG_BUTTON2 0x2000 +#define MOUSE_FLAG_BUTTON3 0x4000 +#define MOUSE_FLAG_BUTTON4 0x0280 +#define MOUSE_FLAG_BUTTON5 0x0380 +#define MOUSE_FLAG_DOWN 0x8000 + +/* Raster operation masks */ +#define ROP2_S(rop3) (rop3 & 0xf) +#define ROP2_P(rop3) ((rop3 & 0x3) | ((rop3 & 0x30) >> 2)) + +#define ROP2_COPY 0xc +#define ROP2_XOR 0x6 +#define ROP2_AND 0x8 +#define ROP2_NXOR 0x9 +#define ROP2_OR 0xe + +#define MIX_TRANSPARENT 0 +#define MIX_OPAQUE 1 + +#define TEXT2_VERTICAL 0x04 +#define TEXT2_IMPLICIT_X 0x20 + +#define ALTERNATE 1 +#define WINDING 2 + +/* RDP bitmap cache (version 2) constants */ +#define BMPCACHE2_C0_CELLS 0x78 +#define BMPCACHE2_C1_CELLS 0x78 +#define BMPCACHE2_C2_CELLS 0x150 +#define BMPCACHE2_NUM_PSTCELLS 0x9f6 + +#define PDU_FLAG_FIRST 0x01 +#define PDU_FLAG_LAST 0x02 + +/* RDP capabilities */ +#define RDP_CAPSET_GENERAL 1 /* Maps to generalCapabilitySet in T.128 page 138 */ +#define RDP_CAPLEN_GENERAL 0x18 +#define OS_MAJOR_TYPE_UNIX 4 +#define OS_MINOR_TYPE_XSERVER 7 + +#define RDP_CAPSET_BITMAP 2 +#define RDP_CAPLEN_BITMAP 0x1C + +#define RDP_CAPSET_ORDER 3 +#define RDP_CAPLEN_ORDER 0x58 +#define ORDER_CAP_NEGOTIATE 2 +#define ORDER_CAP_NOSUPPORT 4 + +#define RDP_CAPSET_BMPCACHE 4 +#define RDP_CAPLEN_BMPCACHE 0x28 + +#define RDP_CAPSET_CONTROL 5 +#define RDP_CAPLEN_CONTROL 0x0C + +#define RDP_CAPSET_ACTIVATE 7 +#define RDP_CAPLEN_ACTIVATE 0x0C + +#define RDP_CAPSET_POINTER 8 +#define RDP_CAPLEN_POINTER 0x08 + +#define RDP_CAPSET_SHARE 9 +#define RDP_CAPLEN_SHARE 0x08 + +#define RDP_CAPSET_COLCACHE 10 +#define RDP_CAPLEN_COLCACHE 0x08 + +#define RDP_CAPSET_BMPCACHE2 19 +#define RDP_CAPLEN_BMPCACHE2 0x28 +#define BMPCACHE2_FLAG_PERSIST ((uint32)1<<31) + +#define RDP_SOURCE "MSTSC" + +/* Logon flags */ +#define RDP_LOGON_AUTO 0x0008 +#define RDP_LOGON_NORMAL 0x0033 +#define RDP_LOGON_COMPRESSION 0x0080 /* mppc compression with 8kB histroy buffer */ +#define RDP_LOGON_BLOB 0x0100 +#define RDP_LOGON_COMPRESSION2 0x0200 /* rdp5 mppc compression with 64kB history buffer */ +#define RDP_LOGON_LEAVE_AUDIO 0x2000 + +#define RDP5_DISABLE_NOTHING 0x00 +#define RDP5_NO_WALLPAPER 0x01 +#define RDP5_NO_FULLWINDOWDRAG 0x02 +#define RDP5_NO_MENUANIMATIONS 0x04 +#define RDP5_NO_THEMING 0x08 +#define RDP5_NO_CURSOR_SHADOW 0x20 +#define RDP5_NO_CURSORSETTINGS 0x40 /* disables cursor blinking */ + +/* compression types */ +#define RDP_MPPC_BIG 0x01 +#define RDP_MPPC_COMPRESSED 0x20 +#define RDP_MPPC_RESET 0x40 +#define RDP_MPPC_FLUSH 0x80 +#define RDP_MPPC_DICT_SIZE 65536 + +#define RDP5_COMPRESSED 0x80 + +/* Keymap flags */ +#define MapRightShiftMask (1<<0) +#define MapLeftShiftMask (1<<1) +#define MapShiftMask (MapRightShiftMask | MapLeftShiftMask) + +#define MapRightAltMask (1<<2) +#define MapLeftAltMask (1<<3) +#define MapAltGrMask MapRightAltMask + +#define MapRightCtrlMask (1<<4) +#define MapLeftCtrlMask (1<<5) +#define MapCtrlMask (MapRightCtrlMask | MapLeftCtrlMask) + +#define MapRightWinMask (1<<6) +#define MapLeftWinMask (1<<7) +#define MapWinMask (MapRightWinMask | MapLeftWinMask) + +#define MapNumLockMask (1<<8) +#define MapCapsLockMask (1<<9) + +#define MapLocalStateMask (1<<10) + +#define MapInhibitMask (1<<11) + +#define MASK_ADD_BITS(var, mask) (var |= mask) +#define MASK_REMOVE_BITS(var, mask) (var &= ~mask) +#define MASK_HAS_BITS(var, mask) ((var & mask)>0) +#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 */ + +#define CF_TEXT 1 +#define CF_BITMAP 2 +#define CF_METAFILEPICT 3 +#define CF_SYLK 4 +#define CF_DIF 5 +#define CF_TIFF 6 +#define CF_OEMTEXT 7 +#define CF_DIB 8 +#define CF_PALETTE 9 +#define CF_PENDATA 10 +#define CF_RIFF 11 +#define CF_WAVE 12 +#define CF_UNICODETEXT 13 +#define CF_ENHMETAFILE 14 +#define CF_HDROP 15 +#define CF_LOCALE 16 +#define CF_MAX 17 +#define CF_OWNERDISPLAY 128 +#define CF_DSPTEXT 129 +#define CF_DSPBITMAP 130 +#define CF_DSPMETAFILEPICT 131 +#define CF_DSPENHMETAFILE 142 +#define CF_PRIVATEFIRST 512 +#define CF_PRIVATELAST 767 +#define CF_GDIOBJFIRST 768 +#define CF_GDIOBJLAST 1023 + +/* Sound format constants */ +#define WAVE_FORMAT_PCM 1 +#define WAVE_FORMAT_ADPCM 2 +#define WAVE_FORMAT_ALAW 6 +#define WAVE_FORMAT_MULAW 7 + +/* Virtual channel options */ +#define CHANNEL_OPTION_INITIALIZED 0x80000000 +#define CHANNEL_OPTION_ENCRYPT_RDP 0x40000000 +#define CHANNEL_OPTION_COMPRESS_RDP 0x00800000 +#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 + + +/* RDPDR constants */ +#define RDPDR_MAX_DEVICES 0x10 +#define DEVICE_TYPE_SERIAL 0x01 +#define DEVICE_TYPE_PARALLEL 0x02 +#define DEVICE_TYPE_PRINTER 0x04 +#define DEVICE_TYPE_DISK 0x08 +#define DEVICE_TYPE_SCARD 0x20 + +#define FILE_DIRECTORY_FILE 0x00000001 +#define FILE_NON_DIRECTORY_FILE 0x00000040 +#define FILE_COMPLETE_IF_OPLOCKED 0x00000100 +#define FILE_DELETE_ON_CLOSE 0x00001000 +#define FILE_OPEN_FOR_FREE_SPACE_QUERY 0x00800000 + +/* RDP5 disconnect PDU */ +#define exDiscReasonNoInfo 0x0000 +#define exDiscReasonAPIInitiatedDisconnect 0x0001 +#define exDiscReasonAPIInitiatedLogoff 0x0002 +#define exDiscReasonServerIdleTimeout 0x0003 +#define exDiscReasonServerLogonTimeout 0x0004 +#define exDiscReasonReplacedByOtherConnection 0x0005 +#define exDiscReasonOutOfMemory 0x0006 +#define exDiscReasonServerDeniedConnection 0x0007 +#define exDiscReasonServerDeniedConnectionFips 0x0008 +#define exDiscReasonLicenseInternal 0x0100 +#define exDiscReasonLicenseNoLicenseServer 0x0101 +#define exDiscReasonLicenseNoLicense 0x0102 +#define exDiscReasonLicenseErrClientMsg 0x0103 +#define exDiscReasonLicenseHwidDoesntMatchLicense 0x0104 +#define exDiscReasonLicenseErrClientLicense 0x0105 +#define exDiscReasonLicenseCantFinishProtocol 0x0106 +#define exDiscReasonLicenseClientEndedProtocol 0x0107 +#define exDiscReasonLicenseErrClientEncryption 0x0108 +#define exDiscReasonLicenseCantUpgradeLicense 0x0109 +#define exDiscReasonLicenseNoRemoteConnections 0x010a + +/* SeamlessRDP constants */ +#define SEAMLESSRDP_NOTYETMAPPED -1 +#define SEAMLESSRDP_NORMAL 0 +#define SEAMLESSRDP_MINIMIZED 1 +#define SEAMLESSRDP_MAXIMIZED 2 +#define SEAMLESSRDP_POSITION_TIMER 200000 + +#define SEAMLESSRDP_CREATE_MODAL 0x0001 + +#define SEAMLESSRDP_HELLO_RECONNECT 0x0001 +#define SEAMLESSRDP_HELLO_HIDDEN 0x0002 diff --git a/reactos/base/applications/tsclient/rdesktop/current/disk.c b/reactos/base/applications/tsclient/rdesktop/current/disk.c new file mode 100644 index 00000000000..9c9170c8040 --- /dev/null +++ b/reactos/base/applications/tsclient/rdesktop/current/disk.c @@ -0,0 +1,1251 @@ +/* -*- c-basic-offset: 8 -*- + rdesktop: A Remote Desktop Protocol client. + Disk Redirection + Copyright (C) Jeroen Meijer 2003 + + 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 "disk.h" + +#include +#include +#include +#include /* open, close */ +#include /* opendir, closedir, readdir */ +#include +#include /* errno */ +#include + +#include +#include /* ctime */ + +#if (defined(HAVE_DIRFD) || (HAVE_DECL_DIRFD == 1)) +#define DIRFD(a) (dirfd(a)) +#else +#define DIRFD(a) ((a)->DIR_FD_MEMBER_NAME) +#endif + +/* TODO: Fix mntent-handling for solaris + * #include */ +#if (defined(HAVE_MNTENT_H) && defined(HAVE_SETMNTENT)) +#include +#define MNTENT_PATH "/etc/mtab" +#define USE_SETMNTENT +#endif + +#ifdef HAVE_SYS_VFS_H +#include +#endif + +#ifdef HAVE_SYS_STATVFS_H +#include +#endif + +#ifdef HAVE_SYS_STATFS_H +#include +#endif + +#ifdef HAVE_SYS_PARAM_H +#include +#endif + +#ifdef HAVE_SYS_MOUNT_H +#include +#endif + +#include "rdesktop.h" + +#ifdef STAT_STATFS3_OSF1 +#define STATFS_FN(path, buf) (statfs(path,buf,sizeof(buf))) +#define STATFS_T statfs +#define USE_STATFS +#endif + +#ifdef STAT_STATVFS +#define STATFS_FN(path, buf) (statvfs(path,buf)) +#define STATFS_T statvfs +#define USE_STATVFS +#endif + +#ifdef STAT_STATVFS64 +#define STATFS_FN(path, buf) (statvfs64(path,buf)) +#define STATFS_T statvfs64 +#define USE_STATVFS +#endif + +#if (defined(STAT_STATFS2_FS_DATA) || defined(STAT_STATFS2_BSIZE) || defined(STAT_STATFS2_FSIZE)) +#define STATFS_FN(path, buf) (statfs(path,buf)) +#define STATFS_T statfs +#define USE_STATFS +#endif + +#ifdef STAT_STATFS4 +#define STATFS_FN(path, buf) (statfs(path,buf,sizeof(buf),0)) +#define STATFS_T statfs +#define USE_STATFS +#endif + +#if ((defined(USE_STATFS) && defined(HAVE_STRUCT_STATFS_F_NAMEMAX)) || (defined(USE_STATVFS) && defined(HAVE_STRUCT_STATVFS_F_NAMEMAX))) +#define F_NAMELEN(buf) ((buf).f_namemax) +#endif + +#if ((defined(USE_STATFS) && defined(HAVE_STRUCT_STATFS_F_NAMELEN)) || (defined(USE_STATVFS) && defined(HAVE_STRUCT_STATVFS_F_NAMELEN))) +#define F_NAMELEN(buf) ((buf).f_namelen) +#endif + +#ifndef F_NAMELEN +#define F_NAMELEN(buf) (255) +#endif + +/* Dummy statfs fallback */ +#ifndef STATFS_T +struct dummy_statfs_t +{ + long f_bfree; + long f_bsize; + long f_blocks; + int f_namelen; + int f_namemax; +}; + +static int +dummy_statfs(struct dummy_statfs_t *buf) +{ + buf->f_blocks = 262144; + buf->f_bfree = 131072; + buf->f_bsize = 512; + buf->f_namelen = 255; + buf->f_namemax = 255; + + return 0; +} + +#define STATFS_T dummy_statfs_t +#define STATFS_FN(path,buf) (dummy_statfs(buf)) +#endif + +extern RDPDR_DEVICE g_rdpdr_device[]; + +FILEINFO g_fileinfo[MAX_OPEN_FILES]; +BOOL g_notify_stamp = False; + +typedef struct +{ + char name[PATH_MAX]; + char label[PATH_MAX]; + unsigned long serial; + char type[PATH_MAX]; +} FsInfoType; + +static NTSTATUS NotifyInfo(NTHANDLE handle, uint32 info_class, NOTIFY * p); + +static time_t +get_create_time(struct stat *st) +{ + time_t ret, ret1; + + ret = MIN(st->st_ctime, st->st_mtime); + ret1 = MIN(ret, st->st_atime); + + if (ret1 != (time_t) 0) + return ret1; + + return ret; +} + +/* Convert seconds since 1970 to a filetime */ +static void +seconds_since_1970_to_filetime(time_t seconds, uint32 * high, uint32 * low) +{ + unsigned long long ticks; + + ticks = (seconds + 11644473600LL) * 10000000; + *low = (uint32) ticks; + *high = (uint32) (ticks >> 32); +} + +/* Convert seconds since 1970 back to filetime */ +static time_t +convert_1970_to_filetime(uint32 high, uint32 low) +{ + unsigned long long ticks; + time_t val; + + ticks = low + (((unsigned long long) high) << 32); + ticks /= 10000000; + ticks -= 11644473600LL; + + val = (time_t) ticks; + return (val); + +} + +/* A wrapper for ftruncate which supports growing files, even if the + native ftruncate doesn't. This is needed on Linux FAT filesystems, + for example. */ +static int +ftruncate_growable(int fd, off_t length) +{ + int ret; + off_t pos; + static const char zero = 0; + + /* Try the simple method first */ + if ((ret = ftruncate(fd, length)) != -1) + { + return ret; + } + + /* + * Some kind of error. Perhaps we were trying to grow. Retry + * in a safe way. + */ + + /* Get current position */ + if ((pos = lseek(fd, 0, SEEK_CUR)) == -1) + { + perror("lseek"); + return -1; + } + + /* Seek to new size */ + if (lseek(fd, length, SEEK_SET) == -1) + { + perror("lseek"); + return -1; + } + + /* Write a zero */ + if (write(fd, &zero, 1) == -1) + { + perror("write"); + return -1; + } + + /* Truncate. This shouldn't fail. */ + if (ftruncate(fd, length) == -1) + { + perror("ftruncate"); + return -1; + } + + /* Restore position */ + if (lseek(fd, pos, SEEK_SET) == -1) + { + perror("lseek"); + return -1; + } + + return 0; +} + +/* Just like open(2), but if a open with O_EXCL fails, retry with + GUARDED semantics. This might be necessary because some filesystems + (such as NFS filesystems mounted from a unfsd server) doesn't + support O_EXCL. GUARDED semantics are subject to race conditions, + but we can live with that. +*/ +static int +open_weak_exclusive(const char *pathname, int flags, mode_t mode) +{ + int ret; + struct stat statbuf; + + ret = open(pathname, flags, mode); + if (ret != -1 || !(flags & O_EXCL)) + { + /* Success, or not using O_EXCL */ + return ret; + } + + /* An error occured, and we are using O_EXCL. In case the FS + doesn't support O_EXCL, some kind of error will be + returned. Unfortunately, we don't know which one. Linux + 2.6.8 seems to return 524, but I cannot find a documented + #define for this case. So, we'll return only on errors that + we know aren't related to O_EXCL. */ + switch (errno) + { + case EACCES: + case EEXIST: + case EINTR: + case EISDIR: + case ELOOP: + case ENAMETOOLONG: + case ENOENT: + case ENOTDIR: + return ret; + } + + /* Retry with GUARDED semantics */ + if (stat(pathname, &statbuf) != -1) + { + /* File exists */ + errno = EEXIST; + return -1; + } + else + { + return open(pathname, flags & ~O_EXCL, mode); + } +} + +/* Enumeration of devices from rdesktop.c */ +/* returns numer of units found and initialized. */ +/* optarg looks like ':h=/mnt/floppy,b=/mnt/usbdevice1' */ +/* when it arrives to this function. */ +int +disk_enum_devices(uint32 * id, char *optarg) +{ + char *pos = optarg; + char *pos2; + int count = 0; + + /* skip the first colon */ + optarg++; + while ((pos = next_arg(optarg, ',')) && *id < RDPDR_MAX_DEVICES) + { + pos2 = next_arg(optarg, '='); + + strncpy(g_rdpdr_device[*id].name, optarg, sizeof(g_rdpdr_device[*id].name) - 1); + if (strlen(optarg) > (sizeof(g_rdpdr_device[*id].name) - 1)) + fprintf(stderr, "share name %s truncated to %s\n", optarg, + g_rdpdr_device[*id].name); + + g_rdpdr_device[*id].local_path = (char *) xmalloc(strlen(pos2) + 1); + strcpy(g_rdpdr_device[*id].local_path, pos2); + g_rdpdr_device[*id].device_type = DEVICE_TYPE_DISK; + count++; + (*id)++; + + optarg = pos; + } + return count; +} + +/* Opens or creates a file or directory */ +static NTSTATUS +disk_create(uint32 device_id, uint32 accessmask, uint32 sharemode, uint32 create_disposition, + uint32 flags_and_attributes, char *filename, NTHANDLE * phandle) +{ + NTHANDLE handle; + DIR *dirp; + int flags, mode; + char path[PATH_MAX]; + struct stat filestat; + + handle = 0; + dirp = NULL; + flags = 0; + mode = S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH; + + if (*filename && filename[strlen(filename) - 1] == '/') + filename[strlen(filename) - 1] = 0; + sprintf(path, "%s%s", g_rdpdr_device[device_id].local_path, filename); + + switch (create_disposition) + { + case CREATE_ALWAYS: + + /* Delete existing file/link. */ + unlink(path); + flags |= O_CREAT; + break; + + case CREATE_NEW: + + /* If the file already exists, then fail. */ + flags |= O_CREAT | O_EXCL; + break; + + case OPEN_ALWAYS: + + /* Create if not already exists. */ + flags |= O_CREAT; + break; + + case OPEN_EXISTING: + + /* Default behaviour */ + break; + + case TRUNCATE_EXISTING: + + /* If the file does not exist, then fail. */ + flags |= O_TRUNC; + break; + } + + /*printf("Open: \"%s\" flags: %X, accessmask: %X sharemode: %X create disp: %X\n", path, flags_and_attributes, accessmask, sharemode, create_disposition); */ + + /* Get information about file and set that flag ourselfs */ + if ((stat(path, &filestat) == 0) && (S_ISDIR(filestat.st_mode))) + { + if (flags_and_attributes & FILE_NON_DIRECTORY_FILE) + return STATUS_FILE_IS_A_DIRECTORY; + else + flags_and_attributes |= FILE_DIRECTORY_FILE; + } + + if (flags_and_attributes & FILE_DIRECTORY_FILE) + { + if (flags & O_CREAT) + { + mkdir(path, mode); + } + + dirp = opendir(path); + if (!dirp) + { + switch (errno) + { + case EACCES: + + return STATUS_ACCESS_DENIED; + + case ENOENT: + + return STATUS_NO_SUCH_FILE; + + default: + + perror("opendir"); + return STATUS_NO_SUCH_FILE; + } + } + handle = DIRFD(dirp); + } + else + { + + if (accessmask & GENERIC_ALL + || (accessmask & GENERIC_READ && accessmask & GENERIC_WRITE)) + { + flags |= O_RDWR; + } + else if ((accessmask & GENERIC_WRITE) && !(accessmask & GENERIC_READ)) + { + flags |= O_WRONLY; + } + else + { + flags |= O_RDONLY; + } + + handle = open_weak_exclusive(path, flags, mode); + if (handle == -1) + { + switch (errno) + { + case EISDIR: + + return STATUS_FILE_IS_A_DIRECTORY; + + case EACCES: + + return STATUS_ACCESS_DENIED; + + case ENOENT: + + return STATUS_NO_SUCH_FILE; + case EEXIST: + + return STATUS_OBJECT_NAME_COLLISION; + default: + + perror("open"); + return STATUS_NO_SUCH_FILE; + } + } + + /* all read and writes of files should be non blocking */ + if (fcntl(handle, F_SETFL, O_NONBLOCK) == -1) + perror("fcntl"); + } + + if (handle >= MAX_OPEN_FILES) + { + error("Maximum number of open files (%s) reached. Increase MAX_OPEN_FILES!\n", + handle); + exit(1); + } + + if (dirp) + g_fileinfo[handle].pdir = dirp; + else + g_fileinfo[handle].pdir = NULL; + + g_fileinfo[handle].device_id = device_id; + g_fileinfo[handle].flags_and_attributes = flags_and_attributes; + 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; + + *phandle = handle; + return STATUS_SUCCESS; +} + +static NTSTATUS +disk_close(NTHANDLE handle) +{ + struct fileinfo *pfinfo; + + pfinfo = &(g_fileinfo[handle]); + + g_notify_stamp = True; + + rdpdr_abort_io(handle, 0, STATUS_CANCELLED); + + if (pfinfo->pdir) + { + if (closedir(pfinfo->pdir) < 0) + { + perror("closedir"); + return STATUS_INVALID_HANDLE; + } + + if (pfinfo->delete_on_close) + if (rmdir(pfinfo->path) < 0) + { + perror(pfinfo->path); + return STATUS_ACCESS_DENIED; + } + pfinfo->delete_on_close = False; + } + else + { + if (close(handle) < 0) + { + perror("close"); + return STATUS_INVALID_HANDLE; + } + if (pfinfo->delete_on_close) + if (unlink(pfinfo->path) < 0) + { + perror(pfinfo->path); + return STATUS_ACCESS_DENIED; + } + + pfinfo->delete_on_close = False; + } + + return STATUS_SUCCESS; +} + +static NTSTATUS +disk_read(NTHANDLE handle, uint8 * data, uint32 length, uint32 offset, uint32 * result) +{ + int n; + +#if 0 + /* browsing dir ???? */ + /* each request is 24 bytes */ + if (g_fileinfo[handle].flags_and_attributes & FILE_DIRECTORY_FILE) + { + *result = 0; + return STATUS_SUCCESS; + } +#endif + + lseek(handle, offset, SEEK_SET); + + n = read(handle, data, length); + + if (n < 0) + { + *result = 0; + switch (errno) + { + case EISDIR: + /* Implement 24 Byte directory read ?? + with STATUS_NOT_IMPLEMENTED server doesn't read again */ + /* return STATUS_FILE_IS_A_DIRECTORY; */ + return STATUS_NOT_IMPLEMENTED; + default: + perror("read"); + return STATUS_INVALID_PARAMETER; + } + } + + *result = n; + + return STATUS_SUCCESS; +} + +static NTSTATUS +disk_write(NTHANDLE handle, uint8 * data, uint32 length, uint32 offset, uint32 * result) +{ + int n; + + lseek(handle, offset, SEEK_SET); + + n = write(handle, data, length); + + if (n < 0) + { + perror("write"); + *result = 0; + switch (errno) + { + case ENOSPC: + return STATUS_DISK_FULL; + default: + return STATUS_ACCESS_DENIED; + } + } + + *result = n; + + return STATUS_SUCCESS; +} + +NTSTATUS +disk_query_information(NTHANDLE handle, uint32 info_class, STREAM out) +{ + uint32 file_attributes, ft_high, ft_low; + struct stat filestat; + char *path, *filename; + + path = g_fileinfo[handle].path; + + /* Get information about file */ + if (fstat(handle, &filestat) != 0) + { + perror("stat"); + out_uint8(out, 0); + return STATUS_ACCESS_DENIED; + } + + /* Set file attributes */ + file_attributes = 0; + if (S_ISDIR(filestat.st_mode)) + file_attributes |= FILE_ATTRIBUTE_DIRECTORY; + + filename = 1 + strrchr(path, '/'); + if (filename && filename[0] == '.') + file_attributes |= FILE_ATTRIBUTE_HIDDEN; + + if (!file_attributes) + file_attributes |= FILE_ATTRIBUTE_NORMAL; + + if (!(filestat.st_mode & S_IWUSR)) + file_attributes |= FILE_ATTRIBUTE_READONLY; + + /* Return requested data */ + switch (info_class) + { + case FileBasicInformation: + seconds_since_1970_to_filetime(get_create_time(&filestat), &ft_high, + &ft_low); + out_uint32_le(out, ft_low); /* create_access_time */ + out_uint32_le(out, ft_high); + + 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(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(filestat.st_ctime, &ft_high, &ft_low); + out_uint32_le(out, ft_low); /* last_change_time */ + out_uint32_le(out, ft_high); + + out_uint32_le(out, file_attributes); + break; + + case FileStandardInformation: + + out_uint32_le(out, filestat.st_size); /* Allocation size */ + out_uint32_le(out, 0); + out_uint32_le(out, filestat.st_size); /* End of file */ + out_uint32_le(out, 0); + out_uint32_le(out, filestat.st_nlink); /* Number of links */ + out_uint8(out, 0); /* Delete pending */ + out_uint8(out, S_ISDIR(filestat.st_mode) ? 1 : 0); /* Directory */ + break; + + case FileObjectIdInformation: + + out_uint32_le(out, file_attributes); /* File Attributes */ + out_uint32_le(out, 0); /* Reparse Tag */ + break; + + default: + + unimpl("IRP Query (File) Information class: 0x%x\n", info_class); + return STATUS_INVALID_PARAMETER; + } + return STATUS_SUCCESS; +} + +NTSTATUS +disk_set_information(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]; + struct fileinfo *pfinfo; + int mode; + struct stat filestat; + time_t write_time, change_time, access_time, mod_time; + struct utimbuf tvs; + struct STATFS_T stat_fs; + + pfinfo = &(g_fileinfo[handle]); + g_notify_stamp = True; + + switch (info_class) + { + case FileBasicInformation: + write_time = change_time = access_time = 0; + + in_uint8s(in, 4); /* Handle of root dir? */ + in_uint8s(in, 24); /* unknown */ + + /* CreationTime */ + in_uint32_le(in, ft_low); + in_uint32_le(in, ft_high); + + /* AccessTime */ + in_uint32_le(in, ft_low); + in_uint32_le(in, ft_high); + if (ft_low || ft_high) + access_time = convert_1970_to_filetime(ft_high, ft_low); + + /* WriteTime */ + in_uint32_le(in, ft_low); + in_uint32_le(in, ft_high); + if (ft_low || ft_high) + write_time = convert_1970_to_filetime(ft_high, ft_low); + + /* ChangeTime */ + in_uint32_le(in, ft_low); + in_uint32_le(in, ft_high); + if (ft_low || ft_high) + change_time = convert_1970_to_filetime(ft_high, ft_low); + + in_uint32_le(in, file_attributes); + + if (fstat(handle, &filestat)) + return STATUS_ACCESS_DENIED; + + tvs.modtime = filestat.st_mtime; + tvs.actime = filestat.st_atime; + if (access_time) + tvs.actime = access_time; + + + if (write_time || change_time) + mod_time = MIN(write_time, change_time); + else + mod_time = write_time ? write_time : change_time; + + if (mod_time) + tvs.modtime = mod_time; + + + if (access_time || write_time || change_time) + { +#if WITH_DEBUG_RDP5 + printf("FileBasicInformation access time %s", + ctime(&tvs.actime)); + printf("FileBasicInformation modification time %s", + ctime(&tvs.modtime)); +#endif + if (utime(pfinfo->path, &tvs) && errno != EPERM) + return STATUS_ACCESS_DENIED; + } + + if (!file_attributes) + break; /* not valid */ + + mode = filestat.st_mode; + + if (file_attributes & FILE_ATTRIBUTE_READONLY) + mode &= ~(S_IWUSR | S_IWGRP | S_IWOTH); + else + mode |= S_IWUSR; + + mode &= 0777; +#if WITH_DEBUG_RDP5 + printf("FileBasicInformation set access mode 0%o", mode); +#endif + + if (fchmod(handle, mode)) + return STATUS_ACCESS_DENIED; + + break; + + case FileRenameInformation: + + in_uint8s(in, 4); /* Handle of root dir? */ + in_uint8s(in, 0x1a); /* unknown */ + in_uint32_le(in, length); + + if (length && (length / 2) < 256) + { + rdp_in_unistr(in, newname, length); + convert_to_unix_filename(newname); + } + else + { + return STATUS_INVALID_PARAMETER; + } + + sprintf(fullpath, "%s%s", g_rdpdr_device[pfinfo->device_id].local_path, + newname); + + if (rename(pfinfo->path, fullpath) != 0) + { + perror("rename"); + return STATUS_ACCESS_DENIED; + } + break; + + case FileDispositionInformation: + /* As far as I understand it, the correct + thing to do here is to *schedule* a delete, + so it will be deleted when the file is + closed. Subsequent + FileDispositionInformation requests with + DeleteFile set to FALSE should unschedule + the delete. See + http://www.osronline.com/article.cfm?article=245. */ + + in_uint32_le(in, delete_on_close); + + if (delete_on_close || + (pfinfo-> + accessmask & (FILE_DELETE_ON_CLOSE | FILE_COMPLETE_IF_OPLOCKED))) + { + pfinfo->delete_on_close = True; + } + + break; + + case FileAllocationInformation: + /* Fall through to FileEndOfFileInformation, + which uses ftrunc. This is like Samba with + "strict allocation = false", and means that + we won't detect out-of-quota errors, for + example. */ + + case FileEndOfFileInformation: + in_uint8s(in, 28); /* unknown */ + in_uint32_le(in, length); /* file size */ + + /* 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; + + if (ftruncate_growable(handle, length) != 0) + { + return STATUS_DISK_FULL; + } + + break; + default: + + unimpl("IRP Set File Information class: 0x%x\n", info_class); + return STATUS_INVALID_PARAMETER; + } + return STATUS_SUCCESS; +} + +NTSTATUS +disk_check_notify(NTHANDLE handle) +{ + struct fileinfo *pfinfo; + NTSTATUS status = STATUS_PENDING; + + NOTIFY notify; + + pfinfo = &(g_fileinfo[handle]); + if (!pfinfo->pdir) + return STATUS_INVALID_DEVICE_REQUEST; + + + + status = NotifyInfo(handle, pfinfo->info_class, ¬ify); + + if (status != 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; + } + + return status; + + +} + +NTSTATUS +disk_create_notify(NTHANDLE handle, uint32 info_class) +{ + + struct fileinfo *pfinfo; + NTSTATUS ret = STATUS_PENDING; + + /* printf("start disk_create_notify info_class %X\n", info_class); */ + + pfinfo = &(g_fileinfo[handle]); + pfinfo->info_class = info_class; + + ret = NotifyInfo(handle, info_class, &pfinfo->notify); + + if (info_class & 0x1000) + { /* ???? */ + if (ret == STATUS_PENDING) + return STATUS_SUCCESS; + } + + /* printf("disk_create_notify: num_entries %d\n", pfinfo->notify.num_entries); */ + + + return ret; + +} + +static NTSTATUS +NotifyInfo(NTHANDLE handle, uint32 info_class, NOTIFY * p) +{ + struct fileinfo *pfinfo; + struct stat buf; + struct dirent *dp; + char *fullname; + DIR *dpr; + + pfinfo = &(g_fileinfo[handle]); + if (fstat(handle, &buf) < 0) + { + perror("NotifyInfo"); + return STATUS_ACCESS_DENIED; + } + p->modify_time = buf.st_mtime; + p->status_time = buf.st_ctime; + p->num_entries = 0; + p->total_time = 0; + + + dpr = opendir(pfinfo->path); + if (!dpr) + { + perror("NotifyInfo"); + return STATUS_ACCESS_DENIED; + } + + + while ((dp = readdir(dpr))) + { + if (!strcmp(dp->d_name, ".") || !strcmp(dp->d_name, "..")) + continue; + p->num_entries++; + fullname = (char *) xmalloc(strlen(pfinfo->path) + strlen(dp->d_name) + 2); + sprintf(fullname, "%s/%s", pfinfo->path, dp->d_name); + + if (!stat(fullname, &buf)) + { + p->total_time += (buf.st_mtime + buf.st_ctime); + } + + xfree(fullname); + } + closedir(dpr); + + return STATUS_PENDING; +} + +static FsInfoType * +FsVolumeInfo(char *fpath) +{ + + static FsInfoType info; +#ifdef USE_SETMNTENT + FILE *fdfs; + struct mntent *e; +#endif + + /* initialize */ + memset(&info, 0, sizeof(info)); + strcpy(info.label, "RDESKTOP"); + strcpy(info.type, "RDPFS"); + +#ifdef USE_SETMNTENT + fdfs = setmntent(MNTENT_PATH, "r"); + if (!fdfs) + return &info; + + while ((e = getmntent(fdfs))) + { + if (str_startswith(e->mnt_dir, fpath)) + { + strcpy(info.type, e->mnt_type); + strcpy(info.name, e->mnt_fsname); + if (strstr(e->mnt_opts, "vfat") || strstr(e->mnt_opts, "iso9660")) + { + int fd = open(e->mnt_fsname, O_RDONLY); + if (fd >= 0) + { + unsigned char buf[512]; + memset(buf, 0, sizeof(buf)); + if (strstr(e->mnt_opts, "vfat")) + /*FAT*/ + { + strcpy(info.type, "vfat"); + read(fd, buf, sizeof(buf)); + info.serial = + (buf[42] << 24) + (buf[41] << 16) + + (buf[40] << 8) + buf[39]; + strncpy(info.label, buf + 43, 10); + info.label[10] = '\0'; + } + else if (lseek(fd, 32767, SEEK_SET) >= 0) /* ISO9660 */ + { + read(fd, buf, sizeof(buf)); + strncpy(info.label, buf + 41, 32); + info.label[32] = '\0'; + /* info.Serial = (buf[128]<<24)+(buf[127]<<16)+(buf[126]<<8)+buf[125]; */ + } + close(fd); + } + } + } + } + endmntent(fdfs); +#else + /* initialize */ + memset(&info, 0, sizeof(info)); + strcpy(info.label, "RDESKTOP"); + strcpy(info.type, "RDPFS"); + +#endif + return &info; +} + + +NTSTATUS +disk_query_volume_information(NTHANDLE handle, uint32 info_class, STREAM out) +{ + struct STATFS_T stat_fs; + struct fileinfo *pfinfo; + FsInfoType *fsinfo; + + pfinfo = &(g_fileinfo[handle]); + + if (STATFS_FN(pfinfo->path, &stat_fs) != 0) + { + perror("statfs"); + return STATUS_ACCESS_DENIED; + } + + fsinfo = FsVolumeInfo(pfinfo->path); + + switch (info_class) + { + case FileFsVolumeInformation: + + out_uint32_le(out, 0); /* volume creation time low */ + out_uint32_le(out, 0); /* volume creation time high */ + out_uint32_le(out, fsinfo->serial); /* serial */ + + out_uint32_le(out, 2 * strlen(fsinfo->label)); /* length of string */ + + out_uint8(out, 0); /* support objects? */ + rdp_out_unistr(out, fsinfo->label, 2 * strlen(fsinfo->label) - 2); + break; + + case FileFsSizeInformation: + + out_uint32_le(out, stat_fs.f_blocks); /* Total allocation units low */ + out_uint32_le(out, 0); /* Total allocation high units */ + out_uint32_le(out, stat_fs.f_bfree); /* Available allocation units */ + out_uint32_le(out, 0); /* Available allowcation units */ + out_uint32_le(out, stat_fs.f_bsize / 0x200); /* Sectors per allocation unit */ + out_uint32_le(out, 0x200); /* Bytes per sector */ + break; + + case FileFsAttributeInformation: + + out_uint32_le(out, FS_CASE_SENSITIVE | FS_CASE_IS_PRESERVED); /* fs attributes */ + out_uint32_le(out, F_NAMELEN(stat_fs)); /* max length of filename */ + + out_uint32_le(out, 2 * strlen(fsinfo->type)); /* length of fs_type */ + rdp_out_unistr(out, fsinfo->type, 2 * strlen(fsinfo->type) - 2); + break; + + case FileFsLabelInformation: + case FileFsDeviceInformation: + case FileFsControlInformation: + case FileFsFullSizeInformation: + case FileFsObjectIdInformation: + case FileFsMaximumInformation: + + default: + + unimpl("IRP Query Volume Information class: 0x%x\n", info_class); + return STATUS_INVALID_PARAMETER; + } + return STATUS_SUCCESS; +} + +NTSTATUS +disk_query_directory(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 fileinfo *pfinfo; + + pfinfo = &(g_fileinfo[handle]); + pdir = pfinfo->pdir; + dirname = pfinfo->path; + file_attributes = 0; + + switch (info_class) + { + case FileBothDirectoryInformation: + + /* If a search pattern is received, remember this pattern, and restart search */ + if (pattern[0] != 0) + { + strncpy(pfinfo->pattern, 1 + strrchr(pattern, '/'), PATH_MAX - 1); + rewinddir(pdir); + } + + /* find next dirent matching pattern */ + pdirent = readdir(pdir); + while (pdirent && fnmatch(pfinfo->pattern, pdirent->d_name, 0) != 0) + pdirent = readdir(pdir); + + if (pdirent == NULL) + return STATUS_NO_MORE_FILES; + + /* Get information for directory entry */ + sprintf(fullpath, "%s/%s", dirname, pdirent->d_name); + + if (stat(fullpath, &fstat)) + { + switch (errno) + { + case ENOENT: + case ELOOP: + case EACCES: + /* These are non-fatal errors. */ + memset(&fstat, 0, sizeof(fstat)); + 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; + } + } + + if (S_ISDIR(fstat.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)) + 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); + 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); + 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); + 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); + 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, 0); /* filesize high */ + out_uint32_le(out, fstat.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 */ + out_uint8s(out, 7); /* pad? */ + out_uint8(out, 0); /* 8.3 file length */ + out_uint8s(out, 2 * 12); /* 8.3 unicode length */ + rdp_out_unistr(out, pdirent->d_name, 2 * strlen(pdirent->d_name)); + break; + + default: + /* FIXME: Support FileDirectoryInformation, + FileFullDirectoryInformation, and + FileNamesInformation */ + + unimpl("IRP Query Directory sub: 0x%x\n", info_class); + return STATUS_INVALID_PARAMETER; + } + + return STATUS_SUCCESS; +} + + + +static NTSTATUS +disk_device_control(NTHANDLE handle, uint32 request, STREAM in, STREAM out) +{ + if (((request >> 16) != 20) || ((request >> 16) != 9)) + return STATUS_INVALID_PARAMETER; + + /* extract operation */ + request >>= 2; + request &= 0xfff; + + printf("DISK IOCTL %d\n", request); + + switch (request) + { + case 25: /* ? */ + case 42: /* ? */ + default: + unimpl("DISK IOCTL %d\n", request); + return STATUS_INVALID_PARAMETER; + } + + return STATUS_SUCCESS; +} + +DEVICE_FNS disk_fns = { + disk_create, + disk_close, + disk_read, + disk_write, + disk_device_control /* device_control */ +}; diff --git a/reactos/base/applications/tsclient/rdesktop/current/disk.h b/reactos/base/applications/tsclient/rdesktop/current/disk.h new file mode 100644 index 00000000000..70cab91c1ee --- /dev/null +++ b/reactos/base/applications/tsclient/rdesktop/current/disk.h @@ -0,0 +1,141 @@ +/* + rdesktop: A Remote Desktop Protocol client. + Disk Redirection definitions + Copyright (C) Jeroen Meijer 2003 + Copyright (C) Peter Astrand 2004 + + 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 FILE_ATTRIBUTE_READONLY 0x00000001 +#define FILE_ATTRIBUTE_HIDDEN 0x00000002 +#define FILE_ATTRIBUTE_SYSTEM 0x00000004 +#define FILE_ATTRIBUTE_DIRECTORY 0x00000010 +#define FILE_ATTRIBUTE_ARCHIVE 0x00000020 +#define FILE_ATTRIBUTE_DEVICE 0x00000040 +#define FILE_ATTRIBUTE_UNKNOWNXXX0 0x00000060 /* ??? ACTION i.e. 0x860 == compress this file ? */ +#define FILE_ATTRIBUTE_NORMAL 0x00000080 +#define FILE_ATTRIBUTE_TEMPORARY 0x00000100 +#define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200 +#define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400 +#define FILE_ATTRIBUTE_COMPRESSED 0x00000800 +#define FILE_ATTRIBUTE_OFFLINE 0x00001000 +#define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000 +#define FILE_ATTRIBUTE_ENCRYPTED 0x00004000 + +#define FILE_FLAG_OPEN_NO_RECALL 0x00100000 +#define FILE_FLAG_OPEN_REPARSE_POINT 0x00200000 +#define FILE_FLAG_POSIX_SEMANTICS 0x01000000 +#define FILE_FLAG_BACKUP_SEMANTICS 0x02000000 /* sometimes used to create a directory */ +#define FILE_FLAG_DELETE_ON_CLOSE 0x04000000 +#define FILE_FLAG_SEQUENTIAL_SCAN 0x08000000 +#define FILE_FLAG_RANDOM_ACCESS 0x10000000 +#define FILE_FLAG_NO_BUFFERING 0x20000000 +#define FILE_FLAG_OVERLAPPED 0x40000000 +#define FILE_FLAG_WRITE_THROUGH 0x80000000 + +#define FILE_SHARE_READ 0x01 +#define FILE_SHARE_WRITE 0x02 +#define FILE_SHARE_DELETE 0x04 + +#define FILE_BASIC_INFORMATION 0x04 +#define FILE_STANDARD_INFORMATION 0x05 + +#define FS_CASE_SENSITIVE 0x00000001 +#define FS_CASE_IS_PRESERVED 0x00000002 +#define FS_UNICODE_STORED_ON_DISK 0x00000004 +#define FS_PERSISTENT_ACLS 0x00000008 +#define FS_FILE_COMPRESSION 0x00000010 +#define FS_VOLUME_QUOTAS 0x00000020 +#define FS_SUPPORTS_SPARSE_FILES 0x00000040 +#define FS_SUPPORTS_REPARSE_POINTS 0x00000080 +#define FS_SUPPORTS_REMOTE_STORAGE 0X00000100 +#define FS_VOL_IS_COMPRESSED 0x00008000 +#define FILE_READ_ONLY_VOLUME 0x00080000 + +#define OPEN_EXISTING 1 +#define CREATE_NEW 2 +#define OPEN_ALWAYS 3 +#define TRUNCATE_EXISTING 4 +#define CREATE_ALWAYS 5 + +#define GENERIC_READ 0x80000000 +#define GENERIC_WRITE 0x40000000 +#define GENERIC_EXECUTE 0x20000000 +#define GENERIC_ALL 0x10000000 + +#define ERROR_FILE_NOT_FOUND 2L +#define ERROR_ALREADY_EXISTS 183L + +#define MAX_OPEN_FILES 0x100 + +typedef enum _FILE_INFORMATION_CLASS +{ + FileDirectoryInformation = 1, + FileFullDirectoryInformation, + FileBothDirectoryInformation, + FileBasicInformation, + FileStandardInformation, + FileInternalInformation, + FileEaInformation, + FileAccessInformation, + FileNameInformation, + FileRenameInformation, + FileLinkInformation, + FileNamesInformation, + FileDispositionInformation, + FilePositionInformation, + FileFullEaInformation, + FileModeInformation, + FileAlignmentInformation, + FileAllInformation, + FileAllocationInformation, + FileEndOfFileInformation, + FileAlternateNameInformation, + FileStreamInformation, + FilePipeInformation, + FilePipeLocalInformation, + FilePipeRemoteInformation, + FileMailslotQueryInformation, + FileMailslotSetInformation, + FileCompressionInformation, + FileCopyOnWriteInformation, + FileCompletionInformation, + FileMoveClusterInformation, + FileOleClassIdInformation, + FileOleStateBitsInformation, + FileNetworkOpenInformation, + FileObjectIdInformation, + FileOleAllInformation, + FileOleDirectoryInformation, + FileContentIndexInformation, + FileInheritContentIndexInformation, + FileOleInformation, + FileMaximumInformation +} FILE_INFORMATION_CLASS, *PFILE_INFORMATION_CLASS; + +typedef enum _FSINFOCLASS +{ + FileFsVolumeInformation = 1, + FileFsLabelInformation, + FileFsSizeInformation, + FileFsDeviceInformation, + FileFsAttributeInformation, + FileFsControlInformation, + FileFsFullSizeInformation, + FileFsObjectIdInformation, + FileFsDriverPathInformation, + FileFsMaximumInformation +} FS_INFORMATION_CLASS, *PFS_INFORMATION_CLASS; diff --git a/reactos/base/applications/tsclient/rdesktop/current/doc/AUTHORS b/reactos/base/applications/tsclient/rdesktop/current/doc/AUTHORS new file mode 100644 index 00000000000..047cd0fc18d --- /dev/null +++ b/reactos/base/applications/tsclient/rdesktop/current/doc/AUTHORS @@ -0,0 +1,14 @@ +This is an attempt at a list of people who have made significant +contributions to the code. If you have been unintentionally omitted +please let one of the team members know. + +Matt Chapman +Peter Kallden +Hugo Trippaers +Jay Sorg +Peter Åstrand +Michal Mihalik +Norbert Federa +Erik Forsberg +Michael Gernoth +Jeroen Meijer diff --git a/reactos/base/applications/tsclient/rdesktop/current/doc/ChangeLog b/reactos/base/applications/tsclient/rdesktop/current/doc/ChangeLog new file mode 100644 index 00000000000..4119619d462 --- /dev/null +++ b/reactos/base/applications/tsclient/rdesktop/current/doc/ChangeLog @@ -0,0 +1,86 @@ +rdesktop (1.?.?) + * SeamlessRDP - seamless windows support + * Keymap fixes + * Fix connection issues with Windows XP RTM + * Keyboard handling improvements and fixes + * SGI/Irix sound-driver fixes + * Support for clipboard INCR protocol + * Session Directory support (patch from Brian Chapeau ) + * Support for long filenames on redirected drives + * XOR ellipse drawing fix + * Clipboard unicode support (Ilya Konstantinov) + * Refactoring of color depth code (Ilya Konstantinov) + +rdesktop (1.4.1) + * persistent bitmap cache optimisations + * support for more RDP-orders (ellipse, polygon) + * libao sound-driver (for Mac OSX and others) + * Unicode support for transmitted strings/filenames + * Added korean keymap + * Xembed fixes to work with krdc correctly + * Portability fixes + * Support for RDP-compression (all bpps) + * process RDP recv queue if send queue is full (Debian bug #246461) + * SGI/Irix sound-driver fixes + + -- Michael Gernoth Sun, 8 May 2005 19:55:35 +0200 (CEST) + +rdesktop (1.4.0) + * Basic disk-, parallel-, printer- and serial-redirection + * Fix timezone-redirection + * Backing-store fixes + * Fix client-IP sent to TS + * XEmbed support for embedding rdesktop in other applications (KRDC) + * Support for setting the RDP5 experience + * Keyboard and keymap fixes + * Performance improvements + * Report disconnect-reason + * Support for RDP-compression (currently only for 8bpp) + * Support for persistent bitmap caching + * Sound-driver for SGI/Irix + + -- Michael Gernoth Sun, 6 Mar 2005 22:09:55 +0100 (CET) + +rdesktop (1.3.1) + * Crypto fixes for RDP5 + * Keyboard and keymap fixes + * some endianess fixes for high color + * portability enhancements + + -- Matthew Chapman Tue, 21 Jan 2004 20:34 + +rdesktop (1.3.0) + + * RDP5 + * 15, 16 and 24 bit color depths + * Basic clipboard redirection + * Sound + * IPv6 + * Attaching to console on Windows 2003 + + -- Peter Astrand Wed, 29 Oct 2003 16:40:58 +0100 (CET) + +rdesktop (1.2.0) + + * 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 + + -- Matthew Chapman Thu, 30 Jan 2003 04:29 + +rdesktop (1.1.0) + + * solves arith.c licensing issue by taking big number routines from + OpenSSL + * keyboard support not merged from unified patches yet + * still no manpage + + -- Matthew Chapman Mon, 17 Sep 2001 23:14:28 +1000 (AEST) + +rdesktop (1.0.0) + + * initial release + + -- Matthew Chapman diff --git a/reactos/base/applications/tsclient/rdesktop/current/doc/HACKING b/reactos/base/applications/tsclient/rdesktop/current/doc/HACKING new file mode 100644 index 00000000000..bb5ec669678 --- /dev/null +++ b/reactos/base/applications/tsclient/rdesktop/current/doc/HACKING @@ -0,0 +1,28 @@ + +Code style / indentation +------------------------ +The file indent-all.sh contains information about the current code +style. Run this script before commits. + + +Variable argument macros +------------------------ +Variable argument macros are non-portable in general, and should be +avoided. Either use a second set of parentheses like DEBUG, or create +a variable argument function like error. + + +Structure +--------- +The core protocol stack should be system-independent (i.e. ANSI C +only) so that it is easy to port. This currently applies to the +following files: + +bitmap.c licence.c orders.c rdp.c rdp5.c cache.c iso.c mcs.c +secure.c mppc.c channels.c +rdesktop.c + + +RDP resources +------------- +http://dev.remotenetworktechnology.com/refdata.htm diff --git a/reactos/base/applications/tsclient/rdesktop/current/doc/TODO b/reactos/base/applications/tsclient/rdesktop/current/doc/TODO new file mode 100644 index 00000000000..8b9c852bd33 --- /dev/null +++ b/reactos/base/applications/tsclient/rdesktop/current/doc/TODO @@ -0,0 +1,89 @@ + +* Clipboard: + + * Support other data types than plain text. + + * Conversion between different character sets. + + +* Drive Redirection: + + * Real support for file locking + + * Handle reconnections correctly. + + * Various deficiencies; see FIXMEs in source code. + + +* Serial Port Redirection: + + * More testing needed. + + +* Printer Redirection: + + * More testing needed. + + +* Keymapping: + + +* Sound redirection + + * Use timestamps in audio packets. + + * Add resampling to supported samplerates of audio-hardware. + + * Lower CPU-usage with an audio thread. + + +* Smartcard redirection + + * Merge patches currently implementing sc-redirection. + + +* Miscellaneous + + * Clean up header files. The current "proto.h" and "xproto.h" is far + from optimal. + + * Go through the many trackers (bugs/patches/RFEs) at SourceForge. + + * More fancy homepage. + + * Enhance documentation. Write a FAQ. + + +* SeamlessRDP mode + + * Add a client to server message for starting additional + applications. + + * Support cmd.exe. + + * Support for Input Contexts. + + * Enhanced support for WM_DELETE_WINDOW: Instead of terminating + rdesktop, close the window on the server side. + + * Systray support. + + * Support for transferring the application taskbar icon. + + * Better support for non-EWMH window managers. + + * Support for non-rectangular windows. + + * The focus handling of menus is a bit crude. + + * Support for sending focus information from client to server. + + * Implement something similiar to explhook.dll - support for running + explorer.exe in non-shell mode. + + * Better compatibility with Task Manager. + + * XINERAMA support. + + * When enumerating windows, make sure to send info about windows + that are transient for other windows after the referred window. diff --git a/reactos/base/applications/tsclient/rdesktop/current/doc/ipv6.txt b/reactos/base/applications/tsclient/rdesktop/current/doc/ipv6.txt new file mode 100644 index 00000000000..d96d173eee1 --- /dev/null +++ b/reactos/base/applications/tsclient/rdesktop/current/doc/ipv6.txt @@ -0,0 +1,29 @@ + +IPv6 support in rdesktop +======================== +The IPv6 support was developed by Mike Dawson : + + Attached is a patch to tcp.c to enable IPv6 support. Build with + 'IPv6' defined to enable it. It's so far only been tested on + Linux 2.4.21 connecting to Windows XP SP1. + + Since terminal services doesn't seem to bind to the ipv6 interface + on XP I had to run 'netsh interface portproxy add v6tov4 + listenport=3389 connectport=3389' from the windows command prompt + to get it to work. + + +rdesktop now supports numeric IPv6 addresses: + + It checks for two or more colons in an address to decide what it's + dealing with so you can now do: + + rdesktop 2001:1:2:3::4 + + without it getting confused with an ipv4:port specification. I've + also followed the square bracket convention used by browsers + (http://www.ietf.org/rfc/rfc2732.txt) so if you want to specify a + non-standard port with an ipv6 address you can use the format: + + rdesktop [2001:1:2:3::4]:3390 + diff --git a/reactos/base/applications/tsclient/rdesktop/current/doc/keymap-names.txt b/reactos/base/applications/tsclient/rdesktop/current/doc/keymap-names.txt new file mode 100644 index 00000000000..44614cd85d5 --- /dev/null +++ b/reactos/base/applications/tsclient/rdesktop/current/doc/keymap-names.txt @@ -0,0 +1,124 @@ + +0x0436 af Afrikaans +0x041C sq Albanian +0x0001 ar Arabic +0x0401 ar-sa Arabic (Saudi Arabia) +0x0801 ar-iq Arabic (Iraq) +0x0C01 ar-eg Arabic (Egypt) +0x1001 ar-ly Arabic (Libya) +0x1401 ar-dz Arabic (Algeria) +0x1801 ar-ma Arabic (Morocco) +0x1C01 ar-tn Arabic (Tunisia) +0x2001 ar-om Arabic (Oman) +0x2401 ar-ye Arabic (Yemen) +0x2801 ar-sy Arabic (Syria) +0x2C01 ar-jo Arabic (Jordan) +0x3001 ar-lb Arabic (Lebanon) +0x3401 ar-kw Arabic (Kuwait) +0x3801 ar-ae Arabic (U.A.E.) +0x3C01 ar-bh Arabic (Bahrain) +0x4001 ar-qa Arabic (Qatar) +0x042D eu Basque +0x0402 bg Bulgarian +0x0423 be Belarusian +0x0403 ca Catalan +0x0004 zh Chinese +0x0404 zh-tw Chinese (Taiwan) +0x0804 zh-cn Chinese (China) +0x0C04 zh-hk Chinese (Hong Kong SAR) +0x1004 zh-sg Chinese (Singapore) +0x041A hr Croatian +0x0405 cs Czech +0x0406 da Danish +0x0413 nl Dutch (Netherlands) +0x0813 nl-be Dutch (Belgium) +0x0009 en English +0x0409 en-us English (United States) +0x0809 en-gb English (United Kingdom) +0x0C09 en-au English (Australia) +0x1009 en-ca English (Canada) +0x1409 en-nz English (New Zealand) +0x1809 en-ie English (Ireland) +0x1C09 en-za English (South Africa) +0x2009 en-jm English (Jamaica) +0x2809 en-bz English (Belize) +0x2C09 en-tt English (Trinidad) +0x0425 et Estonian +0x0438 fo Faeroese +0x0429 fa Farsi +0x040B fi Finnish +0x040C fr French (France) +0x080C fr-be French (Belgium) +0x0C0C fr-ca French (Canada) +0x100C fr-ch French (Switzerland) +0x140C fr-lu French (Luxembourg) +0x043C gd Gaelic +0x0407 de German (Germany) +0x0807 de-ch German (Switzerland) +0x0C07 de-at German (Austria) +0x1007 de-lu German (Luxembourg) +0x1407 de-li German (Liechtenstein) +0x0408 el Greek +0x040D he Hebrew +0x0439 hi Hindi +0x040E hu Hungarian +0x040F is Icelandic +0x0421 in Indonesian +0x0410 it Italian (Italy) +0x0810 it-ch Italian (Switzerland) +0x0411 ja Japanese +0x0412 ko Korean +0x0426 lv Latvian +0x0427 lt Lithuanian +0x042F mk FYRO Macedonian +0x043E ms Malay (Malaysia) +0x043A mt Maltese +0x0414 no Norwegian (Bokmal) +0x0814 no Norwegian (Nynorsk) +0x0415 pl Polish +0x0416 pt-br Portuguese (Brazil) +0x0816 pt Portuguese (Portugal) +0x0417 rm Rhaeto-Romanic +0x0418 ro Romanian +0x0818 ro-mo Romanian (Moldova) +0x0419 ru Russian +0x0819 ru-mo Russian (Moldova) +0x0C1A sr Serbian (Cyrillic) +0x081A sr Serbian (Latin) +0x041B sk Slovak +0x0424 sl Slovenian +0x042E sb Sorbian +0x040A es Spanish (Traditional Sort) +0x080A es-mx Spanish (Mexico) +0x0C0A es Spanish (International Sort) +0x100A es-gt Spanish (Guatemala) +0x140A es-cr Spanish (Costa Rica) +0x180A es-pa Spanish (Panama) +0x1C0A es-do Spanish (Dominican Republic) +0x200A es-ve Spanish (Venezuela) +0x240A es-co Spanish (Colombia) +0x280A es-pe Spanish (Peru) +0x2C0A es-ar Spanish (Argentina) +0x300A es-ec Spanish (Ecuador) +0x340A es-cl Spanish (Chile) +0x380A es-uy Spanish (Uruguay) +0x3C0A es-py Spanish (Paraguay) +0x400A es-bo Spanish (Bolivia) +0x440A es-sv Spanish (El Salvador) +0x480A es-hn Spanish (Honduras) +0x4C0A es-ni Spanish (Nicaragua) +0x500A es-pr Spanish (Puerto Rico) +0x0430 sx Sutu +0x041D sv Swedish +0x081D sv-fi Swedish (Finland) +0x041E th Thai +0x0431 ts Tsonga +0x0432 tn Tswana +0x041F tr Turkish +0x0422 uk Ukrainian +0x0420 ur Urdu +0x042A vi Vietnamese +0x0434 xh Xhosa +0x043D ji Yiddish +0x0435 zu Zulu + diff --git a/reactos/base/applications/tsclient/rdesktop/current/doc/keymapping.txt b/reactos/base/applications/tsclient/rdesktop/current/doc/keymapping.txt new file mode 100644 index 00000000000..27b70640c5b --- /dev/null +++ b/reactos/base/applications/tsclient/rdesktop/current/doc/keymapping.txt @@ -0,0 +1,243 @@ +Keyboard mapping +================ +This release of rdesktop uses a new, portable keyboard mapping +implementation. It should hopefully work on all X11 systems. This new +implementation only looks at X11 keysyms: Not on (nonportable) +keycodes or modifier status. This means that rdesktop will obey your +local keyboard configuration. For example, if you have swapped +CapsLock and Control, rdesktop will use this mapping. + +XKB is currently not used. It seems like a good idea to me, but since +some X servers (like Xvnc) does not support XKB, we still need to use +the plain old interface as well, at least. + +There are still some small problems. + +* CapsLock: CapsLock changes are never sent to the RDP + server. rdesktop does not know which keys that are modified by + CapsLock and which are not. So, the CapsLock indicator in Wordpad + etc will always be off. + +Composing/Multi_key is supported. For more information, see: + + MIT: $SRC/xc/nls/X11/locale/Compose/iso8859-1 + XFree86: /usr/X11R6/lib/X11/locale/*/Compose + Solaris' Openwin: /usr/openwin/include/X11/Suncompose.h + /usr/openwin/lib/locale/*/Compose + Irix6: compose(5) + + +Keymap files +============ +The names of the keymaps follows RFC1766. + +(You can find a translation from Windows keyboard layout numbers to +keymap names by looking at +HKEY_LOCAL_MACHINE\SOFTWARE\Classes\MIME\Database\RFC1766 in the +registry.) + + +Contents of keymap files +======================== +The keymaps are line based. There are four different types of lines: + +1) include lines +Syntax: +include + +Example: +include common + + +2) map lines +Syntax: +map + +Example: +map 0x41d + +Map-lines specifies how the remote RDP server should interpret the +sent scancodes. + + +3) Translation lines +Syntax: + [flags..] + +Example: +onehalf 0x29 shift + +The scancode can be found in scancodes.h. Note: The scancode value for +extended keys can be calculated by OR:ing with 0x80. Example: The +Delete key have the scancode sequence 0xe0, 0x52. You can get the +scancode value to put into the map file by running: + +python -c "print hex(0x80 | 0x52)" + +If flags are "altgr", "shift", the scancode sent for this keysym will +be prefixed with AltGr, or Shift. + +If flags includes "addupper", a translation for this keysyms uppercase +name will be added as well, in addition to the non-uppercase +name. Example: + +x 2d addupper + +...will add an translation for "X" automatically, just like if you +would specify: + +X 2d shift + +If flags include "localstate", the modifier to send will be determined +by the local modifier state. + +If flags is "inhibit", nothing will be sent to the server. + +If flags is "numlock", rdesktop will make sure that the remote NumLock +state is on before generating the key event. Otherwise, it will make +sure NumLock is off. + + +4) enable_compose + +If any line starts with the keyword "enable_compose", rdesktop will +enable local Compose/Multi_key handling. Enabling this will often make +it impossible to compose characters with dead keys (on the remote +side). This is because when local compose support is enabled, dead +keys will not be sent to the remote side. + + +5) sequence lines +Syntax: +sequence ... + +Examples: +sequence eacute dead_acute e +sequence F12 f o o at e x a m p l e period c o m + +Sequence lines allows you to specify that multiple scancodes should be +sent to the RDP server, in response to one X11 keyboard event. Note: +The sequence is sent at the X11 KeyPress event. Nothing is sent at +KeyRelease. + + +6) keyboard_type lines +Syntax: +keyboard_type + +keyboard_type lines specifies the keyboard type. Default value is 0x4 +(en-us 101/104 keys keyboard). + + +7) keyboard_subtype lines +Syntax: +keyboard_subtype + +keyboard_subtype lines specifies the keyboard subtype. Default value +is 0x0 (en-us 101/104 keys keyboard). + + +8) keyboard_functionkeys lines +Syntax: +keyboard_functionkeys + +keyboard_functionkeys specifies the number of keyboard function +keys. Default value is 0xc (12, for standard 101/104 keys keyboard). + + + + +Suggested X11 keysym mapping on PCs +=================================== +Unfortunately, there is no standard for which keysyms a given key +should generate. If you have a PC-keyboard with Windows keys, I suggest this mapping: + +Keyboard keys: +CtrlLeft WinLeft AltLeft Space AltGr WinRight Menu CtrlRight + +...should generate keysyms: +Control_L Super_L Alt_L space Mode_switch Super_R Menu Control_R + +Additionally: +Shift-Alt should produce Meta_L +Shift-AltGr should produce Multi_Key. + +Use a modifier-map like this: + +shift Shift_L (0x32), Shift_R (0x3e) +lock Caps_Lock (0x25) +control Control_L (0x42), Control_R (0x6d) +mod1 Alt_L (0x40) +mod2 Num_Lock (0x4d) +mod3 Mode_switch (0x71) +mod4 Super_L (0x73), Super_R (0x74) +mod5 Scroll_Lock (0x4e) + + +Updating / writing keymap files +=============================== +When writing new or updating keymap files, please use comments and +blanks, to increase readability. The "sv" keymap is a good template. + +When you need to add a translation to a keymap file, do: + + 1. Get the "key number" for this key, by looking at keynums.png. + + 2. Take a look at scancodes.h, and look for + SCANCODE_KEY_. The scancode value is at the end of + the line. If the line contains (SCANCODE_EXTENDED | 0xsomething), + then you should OR 0x80 to this value. For example, you can do: + + python -c "print hex(0x80 | 0xsomething)" + + 3. Put the scancode (from step 2) and keysym name (found in the + error message) into the keymap file. + + +Special keys +============ + +* The combination Ctrl-Alt-Enter toggles between fullscreen and + non-fullscreen mode. + +* Meta, Hyper and Super are treated as windows keys. RDP4 does not + support the windows keys though, so if you are running RDP4, these + keys will translate to Ctrl-Esc. + + +Links +===== +http://www.win.tue.nl/~aeb/linux/kbd/scancodes.html + + +Test cases +========== +When changing the keyboard code, make sure all these tests in Notepad +works: + +1. Ctrl+f should bring up Find dialog, with CapsLock both on and off. + +2. Ctrl+Shift+arrows should mark text, with CapsLock both on and off. + +3. Test a sequence, like egrave. + +4. Test a char generated with AltGr, such as @ on a swedish keyboard. + +5. Test Ctrl-Alt-Delete. + +6. Ctrl-Alt-Enter should toggle fullscreen. + +7. Test NumLock synchronization using the -N option. Excel is able to + indicate the current NumLock state. Verify that the status is + updated correctly on reconnects. + +8. Test the Windows keys, standalone as well as in combination with, + say, E. + +9. Make sure the system menu (via Alt-space) cannot be accessed in + single app mode. + +10. Make sure keymaps can be loaded from ~/.rdesktop/keymaps, + KEYMAP_PATH, $CWD/keymaps, and from an absolute path. + + diff --git a/reactos/base/applications/tsclient/rdesktop/current/doc/keynums.png b/reactos/base/applications/tsclient/rdesktop/current/doc/keynums.png new file mode 100644 index 00000000000..401601b9e06 Binary files /dev/null and b/reactos/base/applications/tsclient/rdesktop/current/doc/keynums.png differ diff --git a/reactos/base/applications/tsclient/rdesktop/current/doc/licensing.txt b/reactos/base/applications/tsclient/rdesktop/current/doc/licensing.txt new file mode 100644 index 00000000000..10ad4ee1a1b --- /dev/null +++ b/reactos/base/applications/tsclient/rdesktop/current/doc/licensing.txt @@ -0,0 +1,56 @@ + +To be able to connect to Microsoft Windows 2000 Terminal Services (and +probably later versions), you'll need to deal with licensing. This is +complicated. This file is supposed to contain some information about +how rdesktop works with Microsofts license systems. + +There's a lot of information on the MS web site, for example, +http://support.microsoft.com/default.aspx?scid=kb;EN-US;287687. + +From the rdesktop mailing list: + +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 +> 2000 Terminal Services Client Access License", "Open" type). This can be +> verifier by using "Terminal Services Licensing". The problem is that all +> issued licenses have an expire-date. The expire date for the license issued +> to A was reached today, and no more connections could be made until we +> changed the client name (by using -n). +> +> We also have another similiar systems, with Linux machine C and W2K server +> D. This server has 200 licenses installed of the type "Select". On this +> server, the issued licenses seems to be permanent: The expire date is set +> to "-", and we have no problem with this system. +> +> The question of course is why the first system issues license with +> expiration date, while the second system issues permanent licenses. + + +Darryn Capes-Davis, 2003-02-07 + +> I have been through the problems and can tell you what is going +> on. The main difference of Machine B (Server 1) and Machine D (Server +> 2) is that from what I see Machine B has Service Pack 3 installed and +> Machine D does not. You see in Service Pack 3 there was a change made +> to TS Licencing in that Microsoft introduced a licence recovery +> mechanism. To cut to the point (I don't know the details) rdesktop 1.2 +> with SAVE_LICENCE defined works fine. In the new lic method the +> terminal server expects a valid licence to be presented to renew +> it. Otherwise it just expires it - and a day later you will see it +> actually gone (it does housekeeping once a day)! So if SAVE_LICENCE +> code is not enabled then it just expires and you can't use the licence +> until it cleans it away - and this is where a little gotcha is - if +> you move from using an rdesktop without SAVE_LICENCE to one with +> SAVE_LICENCE then it still won't recover an 'expired' licence. You +> have to wait for the daily housekeeping to clean it up - this really +> had me going for half a day or so! This is exactly what happened to +> you. +> +> The Server pre Spk 3 has the old model where licences never expire. To +> recover a licence that you never wanted to use again you have to call +> the Microsoft Clearing House. That's why they introduced the new +> method. And if you upgrade a Pre Spk3 server to Spk3 then the licences +> granted still stay with the old method - only new licences granted +> will use the new expiry method. diff --git a/reactos/base/applications/tsclient/rdesktop/current/doc/lspci-channel.txt b/reactos/base/applications/tsclient/rdesktop/current/doc/lspci-channel.txt new file mode 100644 index 00000000000..96f99e171a5 --- /dev/null +++ b/reactos/base/applications/tsclient/rdesktop/current/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 + diff --git a/reactos/base/applications/tsclient/rdesktop/current/doc/patches.txt b/reactos/base/applications/tsclient/rdesktop/current/doc/patches.txt new file mode 100644 index 00000000000..e0e7c55f81f --- /dev/null +++ b/reactos/base/applications/tsclient/rdesktop/current/doc/patches.txt @@ -0,0 +1,340 @@ +This file documents some of all patches for rdesktop, floating around +the net, and how they are related to the current (CVS) version of +rdesktop. Things left to do are marked with TBD (To Be Done). + + +URL: +http://bibl4.oru.se/projects/rdesktop/patch19/patches/Makefile.diff +Description: +Makefile changes which makes it possible to compile rdesktop on SunOS +and OSF1. +Status: +Applied (slightly modified) + + +URL: +http://bibl4.oru.se/projects/rdesktop/patch19/patches/assar_19-7-2.hostlen.patch +Description: +Fix for hostnames longer than 30 chars. +Status: +Applied (revision 1.11 of secure.c) + + +URL: +http://bibl4.oru.se/projects/rdesktop/patch19/patches/backingstore+privatecolormap-for-19-3-9.patch +Description: +This adds support for 1) Private color maps (useful for 8 bpp mode) +and 2) backingstore selection. +Status: +1) is not needed anymore; rdesktop automatically uses Private color +map in 8 bpp mode. 2) is, as far as I understand, also not +need. rdesktop automatically uses a software backing store if the +Xserver does not provide one. + + +URL: +http://bibl4.oru.se/projects/rdesktop/patch19/patches/ben_xwin.c.diff +Description: +Fixes for CapsLock and NumLock. +Status: +Not needed anymore, with the new keyboard mapping implementation. + + +URL: +http://bibl4.oru.se/projects/rdesktop/patch19/patches/ctrl1nohang.diff +Description: +Fixes problem with ctrl1 hangs. +Status: +Not needed anymore, with the new keyboard mapping implementation. + + +URL: +http://bibl4.oru.se/projects/rdesktop/patch19/patches/downkeypatch.diff +Description: +Seems to keep track of the remote modifier status. +Status: +Not needed anymore, with the new keyboard mapping implementation. + + +URL: +http://bibl4.oru.se/projects/rdesktop/patch19/patches/fasttext2+nobackpixmap.patch +Description: +(From http://mail.rdesktop.org/archive/2001/msg00218.html): + +1) Added --no-backpixmap option to disable the ugly double drawing in +xwin.c (I have a very robust backing storage in my X, so I don't need +it ;) + +2) More optimizations to text draw (previous fast-text patch was +included in 192-3-6-2). In text drawing with solid background the +glyphs are drawn with stippled fill instead of XCopyPlane (runs faster +on my S3Trio64 with XFree 3.3.6, please test it on other +configurations to validate this). The WinTach not show any improvement +with this change, it seems to use all transparent background text +draws, but with a old PC Magazine Winbench (3.1) doing the scroll text +test the speed gain is significative. + +3) My Previous patch to disable backing storage in fullscreen + +Status: +1) is not relevant any more, since rdesktop only uses backing store if +the Xserver does not provide backing store. +Need to examine if 2) and 3) are still useful. TBD. + + +URL: +http://bibl4.oru.se/projects/rdesktop/patch19/patches/francisco_fix_patblt.html +Description: +The colors in patterns drawn with "pattern blt" order was inverted (fg +& bg). (See the background of the yellow help banners) +Status: +Applied (in revision 1.29, 2002/07/14) + + +URL: +http://bibl4.oru.se/projects/rdesktop/patch19/patches/frank_1linerfix.html +Description: +ui_create_glyph was not called with ipattern. +Status: +Applied (in revision 1.29, 2002/07/14). + + +URL: +http://bibl4.oru.se/projects/rdesktop/patch19/patches/frank_fasttext.patch.txt +Description: +Some kind of performence improvements. +Status: +From what I can tell, this patch is no longer necessary. + + +URL: +http://bibl4.oru.se/projects/rdesktop/patch19/patches/hostname-patch +Description: +(From http://mail.rdesktop.org/archive/2001/msg00163.html): + +rdesktop uses gethostname to figure out the hostname, but gethostname +under linux returns an error when the hostname is longer than the +buffer. This hack gives gethostname a 64 char buffer and then strips +the first 16 chars or upto the first '.' and puts the result in +hostname[16]. + +Status: +Applied in version 1.10 of rdesktop.c. + + +URL: +http://bibl4.oru.se/projects/rdesktop/patch19/patches/hove-19-7-2endian.diff +Description: +Includes a program for testing endianness. +Status: +rdesktop determines endianness at runtime. This patch is not needed +anymore. + + +URL: +http://bibl4.oru.se/projects/rdesktop/patch19/patches/mmihalik_19-7-3-keyfix-4.patch +Description: +Some kind of new alternative keyboard mapping imlementation. +Status: +Not needed anymore, with the new keyboard mapping implementation. + + +URL: +http://bibl4.oru.se/projects/rdesktop/patch19/patches/norbert_fullscreen.patch +Description: +Fullscreen mode. +Status: +Applied. + + +URL: +http://bibl4.oru.se/projects/rdesktop/patch19/patches/norbert_percent.txt +Description: +Makes is possible to specify RDP geometry based a percent value of the +current desktop size. +Status: +Not applied. I don't think many people will need this. + + +URL: +http://bibl4.oru.se/projects/rdesktop/patch19/patches/norbert_rdp_tcp_port.diff +Description: +Command line tcp port argument. +Status: +Applied. + + +URL: +http://bibl4.oru.se/projects/rdesktop/patch19/patches/patch19-7-2.xyPos.emptyPassword.patch +Description: +This patch adds: +1) Support for empty passwords +2) Support for asking for password interactively +3) Support for ++ geometry. + +Status: +1) and 2) can be solved by the -P parameter; patch not needed. +Functionality for 3) is currently missing. + + +URL: +http://bibl4.oru.se/projects/rdesktop/patch19/patches/rdesktop-1.0.0-19-7-1-mmihalik-3.diff +Description: +Defines DO_GLYPH() etc. +Status: +As far as I understand, this patch is applied. + + +URL: +http://bibl4.oru.se/projects/rdesktop/patch19/patches/rdesktop-1.0.0-mmihalik-1.diff +Description: +Misc drawing changes. +Status: +As far as I understand, this patch is applied. + + +URL: +http://bibl4.oru.se/projects/rdesktop/patch19/patches/rdesktop-1.0.0-pl19-7-2-mmihalik-1.diff +Description: +Some kind of new alternative keyboard mapping implementation. +Status: +Not needed anymore, with the new keyboard mapping implementation. + + +URL: +http://bibl4.oru.se/projects/rdesktop/patch19/patches/rdesktop-gmp.patch +Description: +Use GMP for RSA crypto. +Status: +Not needed since rdesktop now use OpenSSL for all of the crypto. + + +URL: +http://bibl4.oru.se/projects/rdesktop/patch19/patches/rdesktop-new_kb.patch +Description: +Modifies one of the old keyboard mapping implementations in some way. +Status: +Not needed anymore, with the new keyboard mapping implementation. + + +URL: +http://bibl4.oru.se/projects/rdesktop/patch19/patches/rdesktop-openssl.patch +Description: +Support for linking rdesktop with OpenSSL. +Status: +Not needed anymore, rdesktop can optionally use system +OpenSSL. + + +URL: +http://bibl4.oru.se/projects/rdesktop/patch19/patches/rdesktop.vncviewer_patch +Description: +Hack for making the old (broken) keyboard mapping implementation work +with the VNC Xserver. +Status: +Not needed anymore, with the new keyboard mapping implementation. + + +URL: +http://bibl4.oru.se/projects/rdesktop/patch19/patches/rdesktop_keymap.patch +Description: +Some kind of new alternative keyboard mapping implementation. +Status: +Not needed anymore, with the new keyboard mapping implementation. + + +URL: +http://bibl4.oru.se/projects/rdesktop/patch19/patches/rdp-srvr-19-6-6.diff +Description: +Basic RDP server. +Status: +Not applied. + + +URL: +http://bibl4.oru.se/projects/rdesktop/patch19/patches/scroll-to-death-patch.txt +Description: +Fixes scroll-to-death problem in Excel and other applications. +Status: +Not needed; fixed in another way in recent versions of rdesktop. + + +URL: +http://bibl4.oru.se/projects/rdesktop/patch19/patches/spark-manpage-patch-19.4 +Description: +Adds a manual page. +Status: +Not needed; rdesktop contains a manual page now. + + +URL: +http://bibl4.oru.se/projects/rdesktop/patch19/patches/spark-manpage-patch-19.4-1 +Description: +Adds a manual page. +Status: +Not needed; rdesktop contains a manual page now. + + +URL: +http://bibl4.oru.se/projects/rdesktop/patch19/patches/spark_xinerama-patch2 +Description: +Adds XINERAMA support to rdesktop. +Status: +Not applied yet. TBD. + + +URL: +http://bibl4.oru.se/projects/rdesktop/patch19/patches/svenni_dis_wmkeybnds.patch +Description: +Commandline flag to disable keyboard grabbing. +Status: +Applied. + + +URL: +http://bibl4.oru.se/projects/rdesktop/patch19/patches/svenni_disable_bs_in_x-tiny-patch +Description: +Disables backing store for TinyX. +Status: +As far as I understand, this patch is not need any longer. + + +URL: +http://bibl4.oru.se/projects/rdesktop/patch19/patches/vincent_19-7-2.license.patch +Description: +TBD +Status: +Not yet examined. + + +URL: +http://bibl4.oru.se/projects/rdesktop/patch19/patches/vincent_19-7-2.secure.patch +Description: +Fixes a problem during the connection to a French NT4 TSE (a French +NT4 TSE doesn't use encryptation). +Status: +Applied. + + +URL: +http://bibl4.oru.se/projects/rdesktop/patch19/patches/vincent_19-7-3_excel.patch +Description: +Makes matrixes appear better, such as those found in Excel/toad etc. +Status: +Applied. + + +URL: +http://bibl4.oru.se/projects/rdesktop/patch19/patches/vincent_8bpp.patch +Description: +Support a 8bpp display (256 colours). +Status: +An enhanced version is included in rdesktop; this patch is not needed any more. + + +URL: +http://bibl4.oru.se/projects/rdesktop/patch19/patches/vpypatch.txt +Description: +Various changes for one of the old keyboard stuff. +Status: +Not needed anymore, with the new keyboard mapping implementation. diff --git a/reactos/base/applications/tsclient/rdesktop/current/doc/rdesktop.1 b/reactos/base/applications/tsclient/rdesktop/current/doc/rdesktop.1 new file mode 100644 index 00000000000..5a78c2f3ce3 --- /dev/null +++ b/reactos/base/applications/tsclient/rdesktop/current/doc/rdesktop.1 @@ -0,0 +1,217 @@ +.TH rdesktop 1 "November 2005" +.SH NAME +.I rdesktop +\- Remote Desktop Protocol client +.SH SYNOPSIS +.B rdesktop [options] server[:port] +.br +.SH DESCRIPTION +.I rdesktop +is a client for Remote Desktop Protocol (RDP), used in a number of Microsoft +products including Windows NT Terminal Server, Windows 2000 Server, Windows XP +and Windows 2003 Server. + +.SH OPTIONS +.TP +.BR "-u " +Username for authentication on the server. +.TP +.BR "-d " +Domain for authentication. +.TP +.BR "-s " +Startup shell for the user - starts a specific application instead of Explorer. +.TP +.BR "-c " +The initial working directory for the user. Often used in combination with -s +to set up a fixed login environment. +.TP +.BR "-p " +The password to authenticate with. Note that this may have no effect if +"Always prompt for password" is enabled on the server. WARNING: if you specify +a password on the command line it may be visible to other users when they use +tools like ps. Use -p - to make rdesktop request a password at startup (from +standard input). +.TP +.BR "-n " +Client hostname. Normally rdesktop automatically obtains the hostname of the +client. +.TP +.BR "-k " +Keyboard layout to emulate. This requires a corresponding keymap file to be +installed. The standard keymaps provided with rdesktop follow the RFC1766 +naming scheme: a language code followed by a country code if necessary - e.g. +en-us, en-gb, de, fr, sv, etc. + +The default keyboard map depends on the current locale (LC_* and LANG +environment variables). If the current locale is unknown, the default +keyboard map is en-us (a US English keyboard). + +The keyboard maps are file names, which means that they are case +sensitive. The standard keymaps are all in lowercase. + +The keyboard maps are searched relative to the directories +$HOME/.rdesktop/keymaps, KEYMAP_PATH (specified at build time), and +$CWD/keymaps, in this order. The keyboard-map argument can also be an +absolute filename. + +The special value `none' can be used instead of a keyboard map. +In this case, rdesktop will guess the scancodes from the X11 event key +codes using an internal mapping method. This method only supports the +basic alphanumeric keys and may not work properly on all platforms +so its use is discouraged. +.TP +.BR "-g " +Desktop geometry (WxH). If geometry is the special word "workarea", the geometry +will be fetched from the extended window manager hints property _NET_WORKAREA, from +the root window. The geometry can also be specified as a percentage of the whole +screen, e.g. "-g 80%". +.TP +.BR "-f" +Enable fullscreen mode. This overrides the window manager and causes the +rdesktop window to fully cover the current screen. Fullscreen mode can be +toggled at any time using Ctrl-Alt-Enter. +.TP +.BR "-b" +Force the server to send screen updates as bitmaps rather than using +higher-level drawing operations. +.TP +.BR "-A" +Enable SeamlessRDP. In this mode, rdesktop creates a X11 window for +each window on the server side. This mode requires the SeamlessRDP +server side component. When using this option, you should specify a +startup shell which launches the desired application through +SeamlessRDP. Example: rdesktop -A -s 'seamlessrdpshell notepad'. +.TP +.BR "-B" +Use the BackingStore of the Xserver instead of the integrated one in +rdesktop. +.TP +.BR "-e" +Disable encryption. This option is only needed (and will only work) if you +have a French version of NT TSE. +.TP +.BR "-E" +Disable encryption from client to server. This sends an encrypted login packet, +but everything after this is unencrypted (including interactive logins). +.TP +.BR "-m" +Do not send mouse motion events. This saves bandwidth, although some Windows +applications may rely on receiving mouse motion. +.TP +.BR "-C" +Use private colourmap. This will improve colour accuracy on an 8-bit display, +but rdesktop will appear in false colour when not focused. +.TP +.BR "-D" +Hide window manager decorations, by using MWM hints. +.TP +.BR "-K" +Do not override window manager key bindings. By default rdesktop attempts +to grab all keyboard input when it is in focus. +.TP +.BR "-S