From: Casper Hornstrup Date: Sun, 21 Nov 2004 22:33:50 +0000 (+0000) Subject: * Remove arp, finger, ipconfig, netstat, ping, telnet, and whois; Moved to reactos. X-Git-Tag: backups/ELF_support@12700~43 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=dd1feec6787cf86ee1ffe59bbf48fa941d3e2591 * Remove arp, finger, ipconfig, netstat, ping, telnet, and whois; Moved to reactos. svn path=/trunk/; revision=11774 --- diff --git a/rosapps/Makefile b/rosapps/Makefile index 10c0dee86ba..730a7d5821c 100644 --- a/rosapps/Makefile +++ b/rosapps/Makefile @@ -25,15 +25,8 @@ APPS = cmdutils \ sysutils$(SEP)kill \ sysutils$(SEP)tcat \ sysutils$(SEP)tlist \ - net$(SEP)ping \ - net$(SEP)finger \ - net$(SEP)telnet \ net$(SEP)niclist \ - net$(SEP)whois \ - net$(SEP)arp \ net$(SEP)ncftp \ - net$(SEP)netstat \ - net$(SEP)ipconfig \ sysutils$(SEP)regexpl \ tests \ welcome \ diff --git a/rosapps/net/arp/.cvsignore b/rosapps/net/arp/.cvsignore deleted file mode 100644 index 954ada33419..00000000000 --- a/rosapps/net/arp/.cvsignore +++ /dev/null @@ -1,17 +0,0 @@ -*.sys -*.exe -*.dll -*.cpl -*.a -*.o -*.d -*.coff -*.dsp -*.dsw -*.aps -*.ncb -*.opt -*.sym -*.plg -*.bak -*.map diff --git a/rosapps/net/arp/arp.c b/rosapps/net/arp/arp.c deleted file mode 100644 index 4468cac7ce7..00000000000 --- a/rosapps/net/arp/arp.c +++ /dev/null @@ -1,99 +0,0 @@ -/* - * arp - display ARP cache from the IP stack parameters. - * - * This source code is in the PUBLIC DOMAIN and has NO WARRANTY. - * - * Robert Dickenson , August 15, 2002. - */ -#include -#include -#include -#include - -#include -#include -#include -#include - -#include "trace.h" - - -VOID SNMP_FUNC_TYPE SnmpSvcInitUptime(); -DWORD SNMP_FUNC_TYPE SnmpSvcGetUptime(); - -//////////////////////////////////////////////////////////////////////////////// - -const char szUsage[] = { "\n" \ - "Displays and modifies the IP Protocol to physical address translation tables\n" \ - "used by address resolution protocol (ARP).\n" \ - "\n" \ - "ARP -s inet_addr eth_addr [if_addr]\n" \ - "ARP -d inet_addr [if_addr]\n" \ - "ARP -a [inet_addr] [-N if_addr]\n" \ - "\n" \ - " -a Displays the active ARP table by querying the current protocol\n" \ - " data. If inet_addr is specified, the IP and physical addresses\n" \ - " for the specified address are displayed. If more than one\n" \ - " network interface is using ARP, each interfaces ARP table is\n" \ - " displayed.\n" \ - " -g Indentical to -a.\n" \ - " inet_addr Specifies the IP address.\n" \ - " -N if_addr Displays the ARP table for the specified interface only\n" \ - " -d Deletes the host entry specified by inet_addr. inet_addr may be\n" \ - " wildcarded with * to delete all host entries in the ARP table.\n" \ - " -s Adds the host and associates the IP address inet_addr with the\n" \ - " physical address eth_addr. The physical address must be specified\n" \ - " as 6 hexadecimal characters delimited by hyphens. The new entry\n" \ - " will become permanent in the ARP table.\n" \ - " eth_addr Specifies the interface physical address.\n" \ - " if_addr If present, this specifies the IP address of the interface whose\n" \ - " address translation table should be modified. If not present, the\n" \ - " first applicable interface will be used.\n" \ - "Example:\n" \ - " > arp -s 192.168.0.12 55-AA-55-01-02-03 .... Static entry creation.\n" \ - " > arp -a .... ARP table display.\n" \ - " > arp -d * .... Delete all ARP table entries.\n" -}; - -void usage(void) -{ -// fprintf(stderr,"USAGE:\n"); - fputs(szUsage, stderr); -} - -int main(int argc, char *argv[]) -{ - TCHAR szComputerName[50]; - DWORD dwSize = 50; - - int nBytes = 500; - BYTE* pCache; - - if (argc > 1) { - usage(); - return 1; - } - - SnmpSvcInitUptime(); - - GetComputerName(szComputerName, &dwSize); - _tprintf(_T("ReactOS ARP cache on Computer Name: %s\n"), szComputerName); - - pCache = (BYTE*)SnmpUtilMemAlloc(nBytes); - - Sleep(2500); - - if (pCache != NULL) { - - DWORD dwUptime = SnmpSvcGetUptime(); - - _tprintf(_T("SNMP uptime: %d\n"), dwUptime); - - SnmpUtilMemFree(pCache); - } else { - _tprintf(_T("ERROR: call to SnmpUtilMemAlloc() failed\n")); - return 1; - } - return 0; -} - diff --git a/rosapps/net/arp/arp.rc b/rosapps/net/arp/arp.rc deleted file mode 100644 index 2bc49e4bb76..00000000000 --- a/rosapps/net/arp/arp.rc +++ /dev/null @@ -1,6 +0,0 @@ -/* $Id: arp.rc,v 1.3 2004/10/16 22:30:17 gvg Exp $ */ - -#define REACTOS_STR_FILE_DESCRIPTION "ReactOS TCP/IPv4 Win32 arp\0" -#define REACTOS_STR_INTERNAL_NAME "arp\0" -#define REACTOS_STR_ORIGINAL_FILENAME "arp.exe\0" -#include diff --git a/rosapps/net/arp/makefile b/rosapps/net/arp/makefile deleted file mode 100644 index 5d555b56cd8..00000000000 --- a/rosapps/net/arp/makefile +++ /dev/null @@ -1,20 +0,0 @@ - -PATH_TO_TOP = ../../../reactos - -TARGET_TYPE = program - -TARGET_APPTYPE = console - -TARGET_NAME = arp - -TARGET_CFLAGS = -D__USE_W32API - -TARGET_SDKLIBS = user32.a snmpapi.a - -TARGET_OBJECTS = $(TARGET_NAME).o - -include $(PATH_TO_TOP)/rules.mak - -include $(TOOLS_PATH)/helper.mk - -# EOF diff --git a/rosapps/net/arp/trace.c b/rosapps/net/arp/trace.c deleted file mode 100644 index d225a22984a..00000000000 --- a/rosapps/net/arp/trace.c +++ /dev/null @@ -1,53 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Diagnostic Trace -// -#include -#include -#define WIN32_LEAN_AND_MEAN -#include -#include -#include "trace.h" - - -#ifdef _DEBUG - -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; - -void _DebugBreak(void) -{ - DebugBreak(); -} - -void Trace(TCHAR* lpszFormat, ...) -{ - va_list args; - int nBuf; - TCHAR szBuffer[512]; - - va_start(args, lpszFormat); - nBuf = _vsntprintf(szBuffer, sizeof(szBuffer)/sizeof(TCHAR), lpszFormat, args); - OutputDebugString(szBuffer); - // was there an error? was the expanded string too long? - //ASSERT(nBuf >= 0); - va_end(args); -} - -void Assert(void* assert, TCHAR* file, int line, void* msg) -{ - if (msg == NULL) { - printf("ASSERT -- %s occured on line %u of file %s.\n", - assert, line, file); - } else { - printf("ASSERT -- %s occured on line %u of file %s: Message = %s.\n", - assert, line, file, msg); - } -} - -#else - -void Trace(TCHAR* lpszFormat, ...) { }; -void Assert(void* assert, TCHAR* file, int line, void* msg) { }; - -#endif //_DEBUG -///////////////////////////////////////////////////////////////////////////// diff --git a/rosapps/net/arp/trace.h b/rosapps/net/arp/trace.h deleted file mode 100644 index 7f3318e3daa..00000000000 --- a/rosapps/net/arp/trace.h +++ /dev/null @@ -1,61 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Diagnostic Trace -// -#ifndef __TRACE_H__ -#define __TRACE_H__ - -#ifdef _DEBUG - -#ifdef _X86_ -#define BreakPoint() _asm { int 3h } -#else -#define BreakPoint() _DebugBreak() -#endif - -#ifndef ASSERT -#define ASSERT(exp) \ -{ \ - if (!(exp)) { \ - Assert(#exp, __FILE__, __LINE__, NULL); \ - BreakPoint(); \ - } \ -} \ - -#define ASSERTMSG(exp, msg) \ -{ \ - if (!(exp)) { \ - Assert(#exp, __FILE__, __LINE__, msg); \ - BreakPoint(); \ - } \ -} -#endif - -//============================================================================= -// MACRO: TRACE() -//============================================================================= - -#define TRACE Trace - - -#else // _DEBUG - -//============================================================================= -// Define away MACRO's ASSERT() and TRACE() in non debug builds -//============================================================================= - -#ifndef ASSERT -#define ASSERT(exp) -#define ASSERTMSG(exp, msg) -#endif - -#define TRACE 0 ? (void)0 : Trace - -#endif // !_DEBUG - - -void Assert(void* assert, TCHAR* file, int line, void* msg); -void Trace(TCHAR* lpszFormat, ...); - - -#endif // __TRACE_H__ -///////////////////////////////////////////////////////////////////////////// diff --git a/rosapps/net/finger/.cvsignore b/rosapps/net/finger/.cvsignore deleted file mode 100644 index 954ada33419..00000000000 --- a/rosapps/net/finger/.cvsignore +++ /dev/null @@ -1,17 +0,0 @@ -*.sys -*.exe -*.dll -*.cpl -*.a -*.o -*.d -*.coff -*.dsp -*.dsw -*.aps -*.ncb -*.opt -*.sym -*.plg -*.bak -*.map diff --git a/rosapps/net/finger/LICENSE.txt b/rosapps/net/finger/LICENSE.txt deleted file mode 100644 index 3f506f74169..00000000000 --- a/rosapps/net/finger/LICENSE.txt +++ /dev/null @@ -1,23 +0,0 @@ -July 22, 1999 - -To All Licensees, Distributors of Any Version of BSD: - -As you know, certain of the Berkeley Software Distribution ("BSD") source code files -require that further distributions of products containing all or portions of the -software, acknowledge within their advertising materials that such products contain -software developed by UC Berkeley and its contributors. - -Specifically, the provision reads: - - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - -Effective immediately, licensees and distributors are no longer required to include -the acknowledgement within advertising materials. Accordingly, the foregoing paragraph -of those BSD Unix files containing it is hereby deleted in its entirety. - -William Hoskins -Director, Office of Technology Licensing -University of California, Berkeley " diff --git a/rosapps/net/finger/err.c b/rosapps/net/finger/err.c deleted file mode 100644 index 5f966687eca..00000000000 --- a/rosapps/net/finger/err.c +++ /dev/null @@ -1,180 +0,0 @@ -/*- - * Copyright (c) 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)err.c 8.1 (Berkeley) 6/4/93"; -#endif /* LIBC_SCCS and not lint */ - -#include "err.h" -#include -#include -#include -#include - -#ifdef __STDC__ -#include -#else -#include -#endif - -extern char *__progname; /* Program name, from crt0. */ - -void -#ifdef __STDC__ -err(int eval, const char *fmt, ...) -#else -err(eval, fmt, va_alist) - int eval; - const char *fmt; - va_dcl -#endif -{ - va_list ap; -#if __STDC__ - va_start(ap, fmt); -#else - va_start(ap); -#endif - verr(eval, fmt, ap); - va_end(ap); -} - -void -verr(int eval, const char *fmt, va_list ap) -{ - int sverrno; - - sverrno = errno; - (void)fprintf(stderr, "%s: ", __progname); - if (fmt != NULL) { - (void)vfprintf(stderr, fmt, ap); - (void)fprintf(stderr, ": "); - } - (void)fprintf(stderr, "%s\n", strerror(sverrno)); - exit(eval); -} - -void -#if __STDC__ -errx(int eval, const char *fmt, ...) -#else -errx(eval, fmt, va_alist) - int eval; - const char *fmt; - va_dcl -#endif -{ - va_list ap; -#if __STDC__ - va_start(ap, fmt); -#else - va_start(ap); -#endif - verrx(eval, fmt, ap); - va_end(ap); -} - -void -verrx(int eval, const char *fmt, va_list ap) -{ - (void)fprintf(stderr, "%s: ", __progname); - if (fmt != NULL) - (void)vfprintf(stderr, fmt, ap); - (void)fprintf(stderr, "\n"); - exit(eval); -} - -void -#if __STDC__ -warn(const char *fmt, ...) -#else -warn(fmt, va_alist) - const char *fmt; - va_dcl -#endif -{ - va_list ap; -#if __STDC__ - va_start(ap, fmt); -#else - va_start(ap); -#endif - vwarn(fmt, ap); - va_end(ap); -} - -void -vwarn(fmt, ap) - const char *fmt; - va_list ap; -{ - int sverrno; - - sverrno = errno; - (void)fprintf(stderr, "%s: ", __progname); - if (fmt != NULL) { - (void)vfprintf(stderr, fmt, ap); - (void)fprintf(stderr, ": "); - } - (void)fprintf(stderr, "%s\n", strerror(sverrno)); -} - -void -#ifdef __STDC__ -warnx(const char *fmt, ...) -#else -warnx(fmt, va_alist) - const char *fmt; - va_dcl -#endif -{ - va_list ap; -#ifdef __STDC__ - va_start(ap, fmt); -#else - va_start(ap); -#endif - vwarnx(fmt, ap); - va_end(ap); -} - -void -vwarnx(fmt, ap) - const char *fmt; - va_list ap; -{ - (void)fprintf(stderr, "%s: ", __progname); - if (fmt != NULL) - (void)vfprintf(stderr, fmt, ap); - (void)fprintf(stderr, "\n"); -} diff --git a/rosapps/net/finger/err.h b/rosapps/net/finger/err.h deleted file mode 100644 index bbc7397f852..00000000000 --- a/rosapps/net/finger/err.h +++ /dev/null @@ -1,60 +0,0 @@ -/*- - * Copyright (c) 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)err.h 8.1 (Berkeley) 6/2/93 - */ - -#ifndef _ERR_H_ -#define _ERR_H_ - -/* - * Don't use va_list in the err/warn prototypes. Va_list is typedef'd in two - * places ( and ), so if we include one - * of them here we may collide with the utility's includes. It's unreasonable - * for utilities to have to include one of them to include err.h, so we get - * _BSD_VA_LIST_ from and use it. - */ -/*#include */ -/*#include */ -#include "various.h" -#include - -void err __P((int, const char *, ...)); -void verr __P((int, const char *, va_list)); -void errx __P((int, const char *, ...)); -void verrx __P((int, const char *, va_list)); -void warn __P((const char *, ...)); -void vwarn __P((const char *, va_list)); -void warnx __P((const char *, ...)); -void vwarnx __P((const char *, va_list)); - -#endif /* !_ERR_H_ */ diff --git a/rosapps/net/finger/finger.c b/rosapps/net/finger/finger.c deleted file mode 100644 index 125f8786391..00000000000 --- a/rosapps/net/finger/finger.c +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Copyright (c) 1989, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Tony Nardo of the Johns Hopkins University/Applied Physics Lab. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * 8/2/97 - Ted Felix - * Ported to Win32 from 4.4BSD-LITE2 at wcarchive. - * NT Workstation already has finger, and it runs fine under - * Win95. Thought I'd do this anyways since not everyone has - * access to NT. - * Had to remove local handling. Otherwise, same as whois. - */ - -#ifndef lint -static char copyright[] = -"@(#) Copyright (c) 1989, 1993\n\ - The Regents of the University of California. All rights reserved.\n"; -#endif /* not lint */ - -#ifndef lint -static char sccsid[] = "@(#)finger.c 8.5 (Berkeley) 5/4/95"; -#endif /* not lint */ - -/* - * Finger prints out information about users. It is not portable since - * certain fields (e.g. the full user name, office, and phone numbers) are - * extracted from the gecos field of the passwd file which other UNIXes - * may not have or may use for other things. - * - * There are currently two output formats; the short format is one line - * per user and displays login name, tty, login time, real name, idle time, - * and office location/phone number. The long format gives the same - * information (in a more legible format) as well as home directory, shell, - * mail info, and .plan/.project files. - */ - -#include -#include "err.h" -#include -#include -#include -#include -#include -#include -#include "unistd.h" - -#include "various.h" -#include "getopt.h" - -char *__progname; - -time_t now; -int lflag, mflag, pplan, sflag; - -static void userlist(int, char **); -void usage(); -void netfinger(char *); - -int -main(int argc, char **argv) -{ - int ch; - - while ((ch = getopt(argc, argv, "lmps")) != EOF) - switch(ch) { - case 'l': - lflag = 1; /* long format */ - break; - case 'm': - mflag = 1; /* force exact match of names */ - break; - case 'p': - pplan = 1; /* don't show .plan/.project */ - break; - case 's': - sflag = 1; /* short format */ - break; - case '?': - default: - (void)fprintf(stderr, - "usage: finger [-lmps] login [...]\n"); - exit(1); - } - argc -= optind; - argv += optind; - - (void)time(&now); - if (!*argv) { - usage(); - } else { - userlist(argc, argv); - /* - * Assign explicit "large" format if names given and -s not - * explicitly stated. Force the -l AFTER we get names so any - * remote finger attempts specified won't be mishandled. - */ - if (!sflag) - lflag = 1; /* if -s not explicit, force -l */ - } - return 0; -} - - -static void -userlist(int argc, char **argv) -{ - int *used; - char **ap, **nargv, **np, **p; - WORD wVersionRequested; - WSADATA wsaData; - int iErr; - - - if ((nargv = malloc((argc+1) * sizeof(char *))) == NULL || - (used = calloc(argc, sizeof(int))) == NULL) - err(1, NULL); - - /* Pull out all network requests into nargv. */ - for (ap = p = argv, np = nargv; *p; ++p) - if (index(*p, '@')) - *np++ = *p; - else - *ap++ = *p; - - *np++ = NULL; - *ap++ = NULL; - - /* If there are local requests */ - if (*argv) - { - fprintf(stderr, "Warning: Can't do local finger\n"); - } - - /* Start winsock */ - wVersionRequested = MAKEWORD( 1, 1 ); - iErr = WSAStartup( wVersionRequested, &wsaData ); - if ( iErr != 0 ) - { - /* Tell the user that we couldn't find a usable */ - /* WinSock DLL. */ - fprintf(stderr, "WSAStartup failed\n"); - return; - } - - /* Handle network requests. */ - for (p = nargv; *p;) - netfinger(*p++); - - /* Bring down winsock */ - WSACleanup(); - exit(0); -} - -void usage() -{ - (void)fprintf(stderr, - "usage: finger [-lmps] login [...]\n"); - exit(1); -} - diff --git a/rosapps/net/finger/finger.rc b/rosapps/net/finger/finger.rc deleted file mode 100644 index d1e44df86a6..00000000000 --- a/rosapps/net/finger/finger.rc +++ /dev/null @@ -1,6 +0,0 @@ -/* $Id: finger.rc,v 1.3 2004/10/16 22:30:17 gvg Exp $ */ - -#define REACTOS_STR_FILE_DESCRIPTION "ReactOS TCP/IPv4 Win32 finger\0" -#define REACTOS_STR_INTERNAL_NAME "finger\0" -#define REACTOS_STR_ORIGINAL_FILENAME "finger.exe\0" -#include diff --git a/rosapps/net/finger/getopt.c b/rosapps/net/finger/getopt.c deleted file mode 100644 index eacc86e47e3..00000000000 --- a/rosapps/net/finger/getopt.c +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright (c) 1987 Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * Fri Jun 13 10:39:00 1997, tfelix@fred.net: - * Ported to Win32, changed index/rindex to strchr/strrchr - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)getopt.c 4.13 (Berkeley) 2/23/91"; -#endif /* LIBC_SCCS and not lint */ - -#include -#include -#include - -/* - * get option letter from argument vector - */ -int opterr = 1, /* if error message should be printed */ - optind = 1, /* index into parent argv vector */ - optopt; /* character checked for validity */ -char *optarg; /* argument associated with option */ - -#define BADCH (int)'?' -#define EMSG "" - -int -getopt(int nargc, char * const *nargv, const char *ostr) -{ - static char *place = EMSG; /* option letter processing */ - register char *oli; /* option letter list index */ - char *p; - - if (!*place) { /* update scanning pointer */ - if (optind >= nargc || *(place = nargv[optind]) != '-') { - place = EMSG; - return(EOF); - } - if (place[1] && *++place == '-') { /* found "--" */ - ++optind; - place = EMSG; - return(EOF); - } - } /* option letter okay? */ - if ((optopt = (int)*place++) == (int)':' || - !(oli = strchr(ostr, optopt))) { - /* - * if the user didn't specify '-' as an option, - * assume it means EOF. - */ - if (optopt == (int)'-') - return(EOF); - if (!*place) - ++optind; - if (opterr) { - if (!(p = strrchr(*nargv, '/'))) - p = *nargv; - else - ++p; - (void)fprintf(stderr, "%s: illegal option -- %c\n", - p, optopt); - } - return(BADCH); - } - if (*++oli != ':') { /* don't need argument */ - optarg = NULL; - if (!*place) - ++optind; - } - else { /* need an argument */ - if (*place) /* no white space */ - optarg = place; - else if (nargc <= ++optind) { /* no arg */ - place = EMSG; - if (!(p = strrchr(*nargv, '/'))) - p = *nargv; - else - ++p; - if (opterr) - (void)fprintf(stderr, - "%s: option requires an argument -- %c\n", - p, optopt); - return(BADCH); - } - else /* white space */ - optarg = nargv[optind]; - place = EMSG; - ++optind; - } - return(optopt); /* dump back option letter */ -} diff --git a/rosapps/net/finger/getopt.h b/rosapps/net/finger/getopt.h deleted file mode 100644 index bad5c845c6b..00000000000 --- a/rosapps/net/finger/getopt.h +++ /dev/null @@ -1,7 +0,0 @@ -/* getopt.h */ - -extern char *optarg; -extern int optind; - -int -getopt(int nargc, char * const *nargv, const char *ostr); diff --git a/rosapps/net/finger/makefile b/rosapps/net/finger/makefile deleted file mode 100644 index 4cb26ca3c96..00000000000 --- a/rosapps/net/finger/makefile +++ /dev/null @@ -1,25 +0,0 @@ - -PATH_TO_TOP=../../../reactos - -TARGET_TYPE = program - -TARGET_APPTYPE = console - -TARGET_NAME = finger - -TARGET_SDKLIBS = ws2_32.a - -TARGET_CFLAGS = -D__USE_W32_SOCKETS - -TARGET_OBJECTS = $(TARGET_NAME).o \ -err.o \ -getopt.o \ -net.o - -TARGET_GCCLIBS = iberty - -include $(PATH_TO_TOP)/rules.mak - -include $(TOOLS_PATH)/helper.mk - -# EOF diff --git a/rosapps/net/finger/net.c b/rosapps/net/finger/net.c deleted file mode 100644 index 3cf4bdb3168..00000000000 --- a/rosapps/net/finger/net.c +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (c) 1989, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Tony Nardo of the Johns Hopkins University/Applied Physics Lab. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef lint -static char sccsid[] = "@(#)net.c 8.4 (Berkeley) 4/28/95"; -#endif /* not lint */ - -#include -#include -#include "unistd.h" -#include -#include -#include - -#include "various.h" - -void -netfinger(char *name) -{ - extern int lflag; - char c, lastc; - struct in_addr defaddr; - struct hostent *hp, def; - struct servent *sp; - struct sockaddr_in sin; - int s; - char *alist[1], *host; - - /* If this is a local request */ - if (!(host = rindex(name, '@'))) - return; - - *host++ = NULL; - if (isdigit(*host) && (defaddr.s_addr = inet_addr(host)) != -1) { - def.h_name = host; - def.h_addr_list = alist; - def.h_addr = (char *)&defaddr; - def.h_length = sizeof(struct in_addr); - def.h_addrtype = AF_INET; - def.h_aliases = 0; - hp = &def; - } else if (!(hp = gethostbyname(host))) { - (void)fprintf(stderr, - "finger: unknown host: %s\n", host); - return; - } - if (!(sp = getservbyname("finger", "tcp"))) { - (void)fprintf(stderr, "finger: tcp/finger: unknown service\n"); - return; - } - sin.sin_family = hp->h_addrtype; - bcopy(hp->h_addr, (char *)&sin.sin_addr, hp->h_length); - sin.sin_port = sp->s_port; - if ((s = socket(hp->h_addrtype, SOCK_STREAM, 0)) < 0) { - perror("finger: socket"); - return; - } - - /* have network connection; identify the host connected with */ - (void)printf("[%s]\n", hp->h_name); - if (connect(s, (struct sockaddr *)&sin, sizeof(sin)) < 0) { - fprintf(stderr, "finger: connect rc = %d", WSAGetLastError()); - (void)close(s); - return; - } - - /* -l flag for remote fingerd */ - if (lflag) - send(s, "/W ", 3, 0); - /* send the name followed by */ - send(s, name, strlen(name), 0); - send(s, "\r\n", 2, 0); - - /* - * Read from the remote system; once we're connected, we assume some - * data. If none arrives, we hang until the user interrupts. - * - * If we see a or a with the high bit set, treat it as - * a newline; if followed by a newline character, only output one - * newline. - * - * Otherwise, all high bits are stripped; if it isn't printable and - * it isn't a space, we can simply set the 7th bit. Every ASCII - * character with bit 7 set is printable. - */ - lastc = 0; - while (recv(s, &c, 1, 0) == 1) { - c &= 0x7f; - if (c == 0x0d) { - if (lastc == '\r') /* ^M^M - skip dupes */ - continue; - c = '\n'; - lastc = '\r'; - } else { - if (!isprint(c) && !isspace(c)) - c |= 0x40; - if (lastc != '\r' || c != '\n') - lastc = c; - else { - lastc = '\n'; - continue; - } - } - putchar(c); - } - if (lastc != '\n') - putchar('\n'); - putchar('\n'); -} diff --git a/rosapps/net/finger/various.h b/rosapps/net/finger/various.h deleted file mode 100644 index 5ddbd8c0b89..00000000000 --- a/rosapps/net/finger/various.h +++ /dev/null @@ -1,34 +0,0 @@ -// Various things you need when porting BSD and GNU utilities to -// Win32. - -#ifndef VARIOUS_H -#define VARIOUS_H - - -typedef float f4byte_t; -typedef double f8byte_t; -typedef long uid_t; // SunOS 5.5 - -#define __P(x) x - -/* utmp.h */ -#define UT_LINESIZE 8 -#define UT_HOSTSIZE 16 - -/* stat.h */ -#define S_ISREG(mode) (((mode)&0xF000) == 0x8000) -#define S_ISDIR(mode) (((mode)&0xF000) == 0x4000) - -#undef MIN //take care of windows default -#undef MAX //take care of windows default -#define MIN(a, b) ((a) <= (b) ? (a) : (b)) -#define MAX(a, b) ((a) > (b) ? (a) : (b)) - -#define bcopy(s1, s2, n) memmove(s2, s1, n) -#define bcmp(s1, s2, n) (memcmp(s1, s2, n) != 0) -#define bzero(s, n) memset(s, 0, n) - -#define index(s, c) strchr(s, c) -#define rindex(s, c) strrchr(s, c) - -#endif diff --git a/rosapps/net/ipconfig/.cvsignore b/rosapps/net/ipconfig/.cvsignore deleted file mode 100644 index 954ada33419..00000000000 --- a/rosapps/net/ipconfig/.cvsignore +++ /dev/null @@ -1,17 +0,0 @@ -*.sys -*.exe -*.dll -*.cpl -*.a -*.o -*.d -*.coff -*.dsp -*.dsw -*.aps -*.ncb -*.opt -*.sym -*.plg -*.bak -*.map diff --git a/rosapps/net/ipconfig/ipconfig.c b/rosapps/net/ipconfig/ipconfig.c deleted file mode 100644 index c2a6563a0be..00000000000 --- a/rosapps/net/ipconfig/ipconfig.c +++ /dev/null @@ -1,299 +0,0 @@ -/* - * ipconfig - display IP stack parameters. - * - * This source code is in the PUBLIC DOMAIN and has NO WARRANTY. - * - * Robert Dickenson , August 15, 2002. - */ -#include -#include -#include -#include - -#include -#include -#include - -#ifdef _DEBUG -#include "trace.h" -#endif - -//////////////////////////////////////////////////////////////////////////////// - -/* imported from iphlpapi.dll - -GetAdapterOrderMap -GetInterfaceInfo -GetIpStatsFromStack -NhGetInterfaceNameFromGuid -NhpAllocateAndGetInterfaceInfoFromStack - - */ - -static TCHAR* GetNodeTypeName(int nNodeType) -{ - switch (nNodeType) { - case 0: return _T("zero"); - case 1: return _T("one"); - case 2: return _T("two"); - case 3: return _T("three"); - case 4: return _T("mixed"); - default: return _T("unknown"); - } -} - -static void ShowNetworkFixedInfo() -{ - FIXED_INFO* pFixedInfo = NULL; - ULONG OutBufLen = 0; - DWORD result; - - result = GetNetworkParams(NULL, &OutBufLen); - if (result == ERROR_BUFFER_OVERFLOW) { - pFixedInfo = (FIXED_INFO*)malloc(OutBufLen); - if (!pFixedInfo) { - _tprintf(_T("ERROR: failed to allocate 0x%08X bytes of memory\n"), OutBufLen); - return; - } - } else { - _tprintf(_T("ERROR: GetNetworkParams() failed to report required buffer size.\n")); - return; - } - - result = GetNetworkParams(pFixedInfo, &OutBufLen); - if (result == ERROR_SUCCESS) { - IP_ADDR_STRING* pIPAddr; - - printf("\tHostName. . . . . . . . . . . : %s\n", pFixedInfo->HostName); - printf("\tDomainName. . . . . . . . . . : %s\n", pFixedInfo->DomainName); -// - printf("\tDNS Servers . . . . . . . . . : %s\n", pFixedInfo->DnsServerList.IpAddress.String); - pIPAddr = pFixedInfo->DnsServerList.Next; - while (pIPAddr) { - printf("\t\t\t\t : %s\n", pIPAddr->IpAddress.String); - pIPAddr = pIPAddr->Next; - } -// - _tprintf(_T("\tNodeType. . . . . . . . . . . : %d (%s)\n"), pFixedInfo->NodeType, GetNodeTypeName(pFixedInfo->NodeType)); - printf("\tScopeId . . . . . . . . . . . : %s\n", pFixedInfo->ScopeId); - _tprintf(_T("\tEnableRouting . . . . . . . . : %s\n"), pFixedInfo->EnableRouting ? _T("yes") : _T("no")); - _tprintf(_T("\tEnableProxy . . . . . . . . . : %s\n"), pFixedInfo->EnableProxy ? _T("yes") : _T("no")); - _tprintf(_T("\tEnableDns . . . . . . . . . . : %s\n"), pFixedInfo->EnableDns ? _T("yes") : _T("no")); - _tprintf(_T("\n")); - //_tprintf(_T("\n"),); - //_tprintf(_T("GetNetworkParams() returned with %d\n"), pIfTable->NumAdapters); - -// _tprintf(_T("\tConnection specific DNS suffix: %s\n"), pFixedInfo->EnableDns ? _T("yes") : _T("no")); - - } else { - switch (result) { - case ERROR_BUFFER_OVERFLOW: - _tprintf(_T("The buffer size indicated by the pOutBufLen parameter is too small to hold the adapter information. The pOutBufLen parameter points to the required size\n")); - break; - case ERROR_INVALID_PARAMETER: - _tprintf(_T("The pOutBufLen parameter is NULL, or the calling process does not have read/write access to the memory pointed to by pOutBufLen, or the calling process does not have write access to the memory pointed to by the pAdapterInfo parameter\n")); - break; - case ERROR_NO_DATA: - _tprintf(_T("No adapter information exists for the local computer\n")); - break; - case ERROR_NOT_SUPPORTED: - _tprintf(_T("This function is not supported on the operating system in use on the local system\n")); - break; - default: - _tprintf(_T("0x%08X - Use FormatMessage to obtain the message string for the returned error\n"), result); - break; - } - } -} - -static void ShowNetworkInterfaces() -{ - IP_INTERFACE_INFO* pIfTable = NULL; - DWORD result; - DWORD dwNumIf; - DWORD dwOutBufLen = 0; - - if ((result = GetNumberOfInterfaces(&dwNumIf)) != NO_ERROR) { - _tprintf(_T("GetNumberOfInterfaces() failed with code 0x%08X - Use FormatMessage to obtain the message string for the returned error\n"), result); - return; - } else { - _tprintf(_T("GetNumberOfInterfaces() returned %d\n"), dwNumIf); - } - - result = GetInterfaceInfo(pIfTable, &dwOutBufLen); -// dwOutBufLen = sizeof(IP_INTERFACE_INFO) + dwNumIf * sizeof(IP_ADAPTER_INDEX_MAP); -// _tprintf(_T("GetNumberOfInterfaces() returned %d, dwOutBufLen %d\n"), dwNumIf, dwOutBufLen); -// _tprintf(_T("sizeof(IP_INTERFACE_INFO) %d, sizeof(IP_ADAPTER_INDEX_MAP) %d\n"), sizeof(IP_INTERFACE_INFO), sizeof(IP_ADAPTER_INDEX_MAP)); - - pIfTable = (IP_INTERFACE_INFO*)malloc(dwOutBufLen); - if (!pIfTable) { - _tprintf(_T("ERROR: failed to allocate 0x%08X bytes of memory\n"), dwOutBufLen); - return; - } -/* -typedef struct _IP_ADAPTER_INDEX_MAP { - ULONG Index; // adapter index - WCHAR Name[MAX_ADAPTER_NAME]; // name of the adapter -} IP_ADAPTER_INDEX_MAP, * PIP_ADAPTER_INDEX_MAP; - -typedef struct _IP_INTERFACE_INFO { - LONG NumAdapters; // number of adapters in array - IP_ADAPTER_INDEX_MAP Adapter[1]; // adapter indices and names -} IP_INTERFACE_INFO,*PIP_INTERFACE_INFO; - */ - result = GetInterfaceInfo(pIfTable, &dwOutBufLen); - if (result == NO_ERROR) { - int i; - _tprintf(_T("GetInterfaceInfo() returned with %d adaptor entries\n"), pIfTable->NumAdapters); - for (i = 0; i < pIfTable->NumAdapters; i++) { - wprintf(L"[%d] %s\n", i + 1, pIfTable->Adapter[i].Name); - //wprintf(L"[%d] %s\n", pIfTable->Adapter[i].Index, pIfTable->Adapter[i].Name); - -// \DEVICE\TCPIP_{DB0E61C1-3498-4C5F-B599-59CDE8A1E357} -// \DEVICE\TCPIP_{BD445697-0945-4591-AE7F-2AB0F383CA87} -// \DEVICE\TCPIP_{6D87DC08-6BC5-4E78-AB5F-18CAB785CFFE} - -//HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NetBT\Parameters\Interfaces\Tcpip_{DB0E61C1-3498-4C5F-B599-59CDE8A1E357} - } - } else { - switch (result) { - case ERROR_INVALID_PARAMETER: - _tprintf(_T("The dwOutBufLen parameter is NULL, or GetInterfaceInterface is unable to write to the memory pointed to by the dwOutBufLen parameter\n")); - break; - case ERROR_INSUFFICIENT_BUFFER: - _tprintf(_T("The buffer pointed to by the pIfTable parameter is not large enough. The required size is returned in the DWORD variable pointed to by the dwOutBufLen parameter\n")); - _tprintf(_T("\tdwOutBufLen: %d\n"), dwOutBufLen); - break; - case ERROR_NOT_SUPPORTED: - _tprintf(_T("This function is not supported on the operating system in use on the local system\n")); - break; - default: - _tprintf(_T("0x%08X - Use FormatMessage to obtain the message string for the returned error\n"), result); - break; - } - } - free(pIfTable); -} - -/* -typedef struct _IP_ADAPTER_INFO { - struct _IP_ADAPTER_INFO* Next; - DWORD ComboIndex; - char AdapterName[MAX_ADAPTER_NAME_LENGTH + 4]; -1 char Description[MAX_ADAPTER_DESCRIPTION_LENGTH + 4]; - UINT AddressLength; -2 BYTE Address[MAX_ADAPTER_ADDRESS_LENGTH]; - DWORD Index; - UINT Type; -3 UINT DhcpEnabled; -5 PIP_ADDR_STRING CurrentIpAddress; - IP_ADDR_STRING IpAddressList; -7 IP_ADDR_STRING GatewayList; -8 IP_ADDR_STRING DhcpServer; - BOOL HaveWins; - IP_ADDR_STRING PrimaryWinsServer; - IP_ADDR_STRING SecondaryWinsServer; -a time_t LeaseObtained; -b time_t LeaseExpires; -} IP_ADAPTER_INFO, *PIP_ADAPTER_INFO; - */ -/* -Ethernet adapter VMware Virtual Ethernet Adapter (Network Address Translation (NAT) for VMnet8): - - Connection-specific DNS Suffix . : -1 Description . . . . . . . . . . . : VMware Virtual Ethernet Adapter (Network Address Translation (NAT) for VMnet8) -2 Physical Address. . . . . . . . . : 00-50-56-C0-00-08 -3 DHCP Enabled. . . . . . . . . . . : Yes - Autoconfiguration Enabled . . . . : Yes -5 IP Address. . . . . . . . . . . . : 192.168.136.1 - Subnet Mask . . . . . . . . . . . : 255.255.255.0 -7 Default Gateway . . . . . . . . . : -8 DHCP Server . . . . . . . . . . . : 192.168.136.254 - DNS Servers . . . . . . . . . . . : -a Lease Obtained. . . . . . . . . . : Monday, 30 December 2002 5:56:53 PM -b Lease Expires . . . . . . . . . . : Monday, 30 December 2002 6:26:53 PM - */ -static void ShowAdapterInfo() -{ - IP_ADAPTER_INFO* pAdaptorInfo; - ULONG ulOutBufLen; - DWORD dwRetVal; - - _tprintf(_T("\nAdaptor Information\t\n")); - pAdaptorInfo = (IP_ADAPTER_INFO*)GlobalAlloc(GPTR, sizeof(IP_ADAPTER_INFO)); - ulOutBufLen = sizeof(IP_ADAPTER_INFO); - - if (ERROR_BUFFER_OVERFLOW == GetAdaptersInfo(pAdaptorInfo, &ulOutBufLen)) { - GlobalFree(pAdaptorInfo); - pAdaptorInfo = (IP_ADAPTER_INFO*)GlobalAlloc(GPTR, ulOutBufLen); - } - if (dwRetVal = GetAdaptersInfo(pAdaptorInfo, &ulOutBufLen)) { - _tprintf(_T("Call to GetAdaptersInfo failed. Return Value: %08x\n"), dwRetVal); - } else { - while (pAdaptorInfo) { - printf(" AdapterName: %s\n", pAdaptorInfo->AdapterName); - printf(" Description: %s\n", pAdaptorInfo->Description); - pAdaptorInfo = pAdaptorInfo->Next; - } - } -} - -const char szUsage[] = { "USAGE:\n" \ - " ipconfig [/? | /all | /release [adapter] | /renew [adapter]\n" \ - " | /flushdns | /registerdns\n" \ - " | /showclassid adapter\n" \ - " | /showclassid adapter\n" \ - " | /setclassid adapter [classidtoset] ]\n" \ - "\n" \ - "adapter Full name or pattern with '*' and '?' to 'match',\n" \ - " * matches any character, ? matches one character.\n" \ - " Options\n" \ - " /? Display this help message.\n" \ - " /all Display full configuration information.\n" \ - " /release Release the IP address for the specified adapter.\n" \ - " /renew Renew the IP address for the specified adapter.\n" \ - " /flushdns Purges the DNS Resolver cache.\n" \ - " /registerdns Refreshes all DHCP leases and re-registers DNS names\n" \ - " /displaydns Display the contents of the DNS Resolver Cache.\n" \ - " /showclassid Displays all the dhcp class IDs allowed for adapter.\n" \ - " /setclassid Modifies the dhcp class id.\n" \ - "\n" \ - "The default is to display only the IP address, subnet mask and\n" \ - "default gateway for each adapter bound to TCP/IP.\n" -}; -/* - "\n" \ - "For Release and Renew, if no adapter name is specified, then the IP address\n" \ - "leases for all adapters bound to TCP/IP will be released or renewed.\n" \ - "\n" \ - "For SetClassID, if no class id is specified, then the classid is removed.\n" \ - "\n" \ - "Examples:\n" \ - " > ipconfig ... Show information.\n" \ - " > ipconfig /all ... Show detailed information\n" \ - " > ipconfig /renew ... renew all adapaters\n" \ - " > ipconfig /renew EL* ... renew adapters named EL....\n" \ - " > ipconfig /release *ELINK?21* ... release all matching adapters,\n" \ - eg. ELINK-21, myELELINKi21adapter.\n" - */ - -static void usage(void) -{ - fputs(szUsage, stderr); -} - - -int main(int argc, char *argv[]) -{ - // 10.0.0.100 // As of build 0.0.20 this is hardcoded in the ip stack - - if (argc > 1) { - usage(); - return 1; - } - _tprintf(_T("ReactOS IP Configuration\n")); - ShowNetworkFixedInfo(); - ShowNetworkInterfaces(); - ShowAdapterInfo(); - return 0; -} diff --git a/rosapps/net/ipconfig/ipconfig.rc b/rosapps/net/ipconfig/ipconfig.rc deleted file mode 100644 index 756293bba8a..00000000000 --- a/rosapps/net/ipconfig/ipconfig.rc +++ /dev/null @@ -1,6 +0,0 @@ -/* $Id: ipconfig.rc,v 1.3 2004/10/16 22:30:17 gvg Exp $ */ - -#define REACTOS_STR_FILE_DESCRIPTION "ReactOS TCP/IPv4 Win32 ipconfig\0" -#define REACTOS_STR_INTERNAL_NAME "ipconfig\0" -#define REACTOS_STR_ORIGINAL_FILENAME "ipconfig.exe\0" -#include diff --git a/rosapps/net/ipconfig/makefile b/rosapps/net/ipconfig/makefile deleted file mode 100644 index 1ca999081db..00000000000 --- a/rosapps/net/ipconfig/makefile +++ /dev/null @@ -1,20 +0,0 @@ - -PATH_TO_TOP = ../../../reactos - -TARGET_TYPE = program - -TARGET_APPTYPE = console - -TARGET_NAME = ipconfig - -TARGET_CFLAGS = -D__USE_W32API - -TARGET_SDKLIBS = user32.a iphlpapi.a - -TARGET_OBJECTS = $(TARGET_NAME).o - -include $(PATH_TO_TOP)/rules.mak - -include $(TOOLS_PATH)/helper.mk - -# EOF diff --git a/rosapps/net/ipconfig/trace.c b/rosapps/net/ipconfig/trace.c deleted file mode 100644 index d225a22984a..00000000000 --- a/rosapps/net/ipconfig/trace.c +++ /dev/null @@ -1,53 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Diagnostic Trace -// -#include -#include -#define WIN32_LEAN_AND_MEAN -#include -#include -#include "trace.h" - - -#ifdef _DEBUG - -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; - -void _DebugBreak(void) -{ - DebugBreak(); -} - -void Trace(TCHAR* lpszFormat, ...) -{ - va_list args; - int nBuf; - TCHAR szBuffer[512]; - - va_start(args, lpszFormat); - nBuf = _vsntprintf(szBuffer, sizeof(szBuffer)/sizeof(TCHAR), lpszFormat, args); - OutputDebugString(szBuffer); - // was there an error? was the expanded string too long? - //ASSERT(nBuf >= 0); - va_end(args); -} - -void Assert(void* assert, TCHAR* file, int line, void* msg) -{ - if (msg == NULL) { - printf("ASSERT -- %s occured on line %u of file %s.\n", - assert, line, file); - } else { - printf("ASSERT -- %s occured on line %u of file %s: Message = %s.\n", - assert, line, file, msg); - } -} - -#else - -void Trace(TCHAR* lpszFormat, ...) { }; -void Assert(void* assert, TCHAR* file, int line, void* msg) { }; - -#endif //_DEBUG -///////////////////////////////////////////////////////////////////////////// diff --git a/rosapps/net/ipconfig/trace.h b/rosapps/net/ipconfig/trace.h deleted file mode 100644 index 7f3318e3daa..00000000000 --- a/rosapps/net/ipconfig/trace.h +++ /dev/null @@ -1,61 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Diagnostic Trace -// -#ifndef __TRACE_H__ -#define __TRACE_H__ - -#ifdef _DEBUG - -#ifdef _X86_ -#define BreakPoint() _asm { int 3h } -#else -#define BreakPoint() _DebugBreak() -#endif - -#ifndef ASSERT -#define ASSERT(exp) \ -{ \ - if (!(exp)) { \ - Assert(#exp, __FILE__, __LINE__, NULL); \ - BreakPoint(); \ - } \ -} \ - -#define ASSERTMSG(exp, msg) \ -{ \ - if (!(exp)) { \ - Assert(#exp, __FILE__, __LINE__, msg); \ - BreakPoint(); \ - } \ -} -#endif - -//============================================================================= -// MACRO: TRACE() -//============================================================================= - -#define TRACE Trace - - -#else // _DEBUG - -//============================================================================= -// Define away MACRO's ASSERT() and TRACE() in non debug builds -//============================================================================= - -#ifndef ASSERT -#define ASSERT(exp) -#define ASSERTMSG(exp, msg) -#endif - -#define TRACE 0 ? (void)0 : Trace - -#endif // !_DEBUG - - -void Assert(void* assert, TCHAR* file, int line, void* msg); -void Trace(TCHAR* lpszFormat, ...); - - -#endif // __TRACE_H__ -///////////////////////////////////////////////////////////////////////////// diff --git a/rosapps/net/netstat/.cvsignore b/rosapps/net/netstat/.cvsignore deleted file mode 100644 index 954ada33419..00000000000 --- a/rosapps/net/netstat/.cvsignore +++ /dev/null @@ -1,17 +0,0 @@ -*.sys -*.exe -*.dll -*.cpl -*.a -*.o -*.d -*.coff -*.dsp -*.dsw -*.aps -*.ncb -*.opt -*.sym -*.plg -*.bak -*.map diff --git a/rosapps/net/netstat/makefile b/rosapps/net/netstat/makefile deleted file mode 100644 index 0438c89966e..00000000000 --- a/rosapps/net/netstat/makefile +++ /dev/null @@ -1,23 +0,0 @@ - -PATH_TO_TOP = ../../../reactos - -TARGET_TYPE = program - -TARGET_APPTYPE = console - -TARGET_NAME = netstat - -TARGET_CFLAGS = \ - -D__USE_W32API \ - -D_WIN32_IE=0x600 \ - -D_WIN32_WINNT=0x501 - -TARGET_SDKLIBS = user32.a snmpapi.a iphlpapi.a ws2_32.a - -TARGET_OBJECTS = $(TARGET_NAME).o - -include $(PATH_TO_TOP)/rules.mak - -include $(TOOLS_PATH)/helper.mk - -# EOF diff --git a/rosapps/net/netstat/netstat.c b/rosapps/net/netstat/netstat.c deleted file mode 100644 index 666c94c6015..00000000000 --- a/rosapps/net/netstat/netstat.c +++ /dev/null @@ -1,518 +0,0 @@ -/* - * netstat - display IP stack statistics. - * - * This source code is in the PUBLIC DOMAIN and has NO WARRANTY. - * - * Robert Dickenson , August 15, 2002. - */ - -// Extensive reference made and use of source to netstatp by: -// Copyright (C) 1998-2002 Mark Russinovich -// www.sysinternals.com - -#define ANY_SIZE 1 - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include "trace.h" -#include "resource.h" - - -#define MAX_RESLEN 4000 - -// -// Possible TCP endpoint states -// -static char TcpState[][32] = { - "???", - "CLOSED", - "LISTENING", - "SYN_SENT", - "SYN_RCVD", - "ESTABLISHED", - "FIN_WAIT1", - "FIN_WAIT2", - "CLOSE_WAIT", - "CLOSING", - "LAST_ACK", - "TIME_WAIT", - "DELETE_TCB" -}; - -VOID PrintError(DWORD ErrorCode) -{ - LPVOID lpMsgBuf; - - FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, - NULL, ErrorCode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - (LPTSTR)&lpMsgBuf, 0, NULL); - printf("%s\n", lpMsgBuf); - LocalFree(lpMsgBuf); -} - -static void ShowTcpStatistics() -{ - MIB_TCPSTATS TcpStatsMIB; - GetTcpStatistics(&TcpStatsMIB); - - _tprintf(_T("TCP/IP Statistics\t\n")); - _tprintf(_T(" time-out algorithm:\t\t%d\n"), TcpStatsMIB.dwRtoAlgorithm); - _tprintf(_T(" minimum time-out:\t\t%d\n"), TcpStatsMIB.dwRtoMin); - _tprintf(_T(" maximum time-out:\t\t%d\n"), TcpStatsMIB.dwRtoMax); - _tprintf(_T(" maximum connections:\t\t%d\n"), TcpStatsMIB.dwMaxConn); - _tprintf(_T(" active opens:\t\t\t%d\n"), TcpStatsMIB.dwActiveOpens); - _tprintf(_T(" passive opens:\t\t\t%d\n"), TcpStatsMIB.dwPassiveOpens); - _tprintf(_T(" failed attempts:\t\t%d\n"), TcpStatsMIB.dwAttemptFails); - _tprintf(_T(" established connections reset:\t%d\n"), TcpStatsMIB.dwEstabResets); - _tprintf(_T(" established connections:\t%d\n"), TcpStatsMIB.dwCurrEstab); - _tprintf(_T(" segments received:\t\t%d\n"), TcpStatsMIB.dwInSegs); - _tprintf(_T(" segment sent:\t\t\t%d\n"), TcpStatsMIB.dwOutSegs); - _tprintf(_T(" segments retransmitted:\t\t%d\n"), TcpStatsMIB.dwRetransSegs); - _tprintf(_T(" incoming errors:\t\t%d\n"), TcpStatsMIB.dwInErrs); - _tprintf(_T(" outgoing resets:\t\t%d\n"), TcpStatsMIB.dwOutRsts); - _tprintf(_T(" cumulative connections:\t\t%d\n"), TcpStatsMIB.dwNumConns); -} - -static void ShowUdpStatistics() -{ - MIB_UDPSTATS UDPStatsMIB; - GetUdpStatistics(&UDPStatsMIB); - - _tprintf(_T("UDP Statistics\t\n")); - _tprintf(_T(" received datagrams:\t\t\t%d\n"), UDPStatsMIB.dwInDatagrams); - _tprintf(_T(" datagrams for which no port exists:\t%d\n"), UDPStatsMIB.dwNoPorts); - _tprintf(_T(" errors on received datagrams:\t\t%d\n"), UDPStatsMIB.dwInErrors); - _tprintf(_T(" sent datagrams:\t\t\t\t%d\n"), UDPStatsMIB.dwOutDatagrams); - _tprintf(_T(" number of entries in listener table:\t%d\n"), UDPStatsMIB.dwNumAddrs); -} - -static void ShowIpStatistics() -{ - MIB_IPSTATS IPStatsMIB; - GetIpStatistics(&IPStatsMIB); - - _tprintf(_T("IP Statistics\t\n")); - _tprintf(_T(" IP forwarding enabled or disabled:\t%d\n"), IPStatsMIB.dwForwarding); - _tprintf(_T(" default time-to-live:\t\t\t%d\n"), IPStatsMIB.dwDefaultTTL); - _tprintf(_T(" datagrams received:\t\t\t%d\n"), IPStatsMIB.dwInReceives); - _tprintf(_T(" received header errors:\t\t\t%d\n"), IPStatsMIB.dwInHdrErrors); - _tprintf(_T(" received address errors:\t\t%d\n"), IPStatsMIB.dwInAddrErrors); - _tprintf(_T(" datagrams forwarded:\t\t\t%d\n"), IPStatsMIB.dwForwDatagrams); - _tprintf(_T(" datagrams with unknown protocol:\t%d\n"), IPStatsMIB.dwInUnknownProtos); - _tprintf(_T(" received datagrams discarded:\t\t%d\n"), IPStatsMIB.dwInDiscards); - _tprintf(_T(" received datagrams delivered:\t\t%d\n"), IPStatsMIB.dwInDelivers); - _tprintf(_T(" sent datagrams discarded:\t\t%d\n"), IPStatsMIB.dwOutDiscards); - _tprintf(_T(" datagrams for which no route exists:\t%d\n"), IPStatsMIB.dwOutNoRoutes); - _tprintf(_T(" datagrams for which frags didn't arrive:%d\n"), IPStatsMIB.dwReasmTimeout); - _tprintf(_T(" datagrams requiring reassembly:\t\t%d\n"), IPStatsMIB.dwReasmReqds); - _tprintf(_T(" successful reassemblies:\t\t%d\n"), IPStatsMIB.dwReasmOks); - _tprintf(_T(" failed reassemblies:\t\t\t%d\n"), IPStatsMIB.dwReasmFails); - _tprintf(_T(" successful fragmentations:\t\t%d\n"), IPStatsMIB.dwFragOks); - _tprintf(_T(" failed fragmentations:\t\t\t%d\n"), IPStatsMIB.dwFragFails); - _tprintf(_T(" datagrams fragmented:\t\t\t%d\n"), IPStatsMIB.dwFragCreates); - _tprintf(_T(" number of interfaces on computer:\t%d\n"), IPStatsMIB.dwNumIf); - _tprintf(_T(" number of IP address on computer:\t%d\n"), IPStatsMIB.dwNumAddr); - _tprintf(_T(" number of routes in routing table:\t%d\n"), IPStatsMIB.dwNumRoutes); -} - -static void ShowNetworkParams() -{ - FIXED_INFO* FixedInfo; - IP_ADDR_STRING* pIPAddr; - ULONG ulOutBufLen; - DWORD dwRetVal; - - _tprintf(_T("Network Parameters\t\n")); - - FixedInfo = (FIXED_INFO*)GlobalAlloc(GPTR, sizeof(FIXED_INFO)); - ulOutBufLen = sizeof(FIXED_INFO); - if (ERROR_BUFFER_OVERFLOW == GetNetworkParams(FixedInfo, &ulOutBufLen)) { - GlobalFree(FixedInfo); - FixedInfo =(FIXED_INFO*)GlobalAlloc(GPTR, ulOutBufLen); - } - if (dwRetVal = GetNetworkParams(FixedInfo, &ulOutBufLen)) { - _tprintf(_T("Call to GetNetworkParams failed. Return Value: %08x\n"), dwRetVal); - } else { - printf(" Host Name: %s", FixedInfo->HostName); - printf("\n Domain Name: %s", FixedInfo->DomainName); - printf("\n DNS Servers:\t%s\n", FixedInfo->DnsServerList.IpAddress.String); - pIPAddr = FixedInfo->DnsServerList.Next; - while (pIPAddr) { - printf("\t\t\t%s\n", pIPAddr->IpAddress.String); - pIPAddr = pIPAddr->Next; - } - } -} - -static void ShowAdapterInfo() -{ - IP_ADAPTER_INFO* pAdaptorInfo; - ULONG ulOutBufLen; - DWORD dwRetVal; - - _tprintf(_T("\nAdaptor Information\t\n")); - pAdaptorInfo = (IP_ADAPTER_INFO*)GlobalAlloc(GPTR, sizeof(IP_ADAPTER_INFO)); - ulOutBufLen = sizeof(IP_ADAPTER_INFO); - - if (ERROR_BUFFER_OVERFLOW == GetAdaptersInfo(pAdaptorInfo, &ulOutBufLen)) { - GlobalFree(pAdaptorInfo); - pAdaptorInfo = (IP_ADAPTER_INFO*)GlobalAlloc(GPTR, ulOutBufLen); - } - if (dwRetVal = GetAdaptersInfo(pAdaptorInfo, &ulOutBufLen)) { - _tprintf(_T("Call to GetAdaptersInfo failed. Return Value: %08x\n"), dwRetVal); - } else { - while (pAdaptorInfo) { - printf(" AdapterName: %s\n", pAdaptorInfo->AdapterName); - printf(" Description: %s\n", pAdaptorInfo->Description); - pAdaptorInfo = pAdaptorInfo->Next; - } - } -} - -/* -typedef struct { - UINT idLength; - UINT* ids; -} AsnObjectIdentifier; - -VOID SnmpUtilPrintAsnAny(AsnAny* pAny); // pointer to value to print -VOID SnmpUtilPrintOid(AsnObjectIdentifier* Oid); // object identifier to print - - */ -void test_snmp(void) -{ - int nBytes = 500; - BYTE* pCache; - - pCache = (BYTE*)SnmpUtilMemAlloc(nBytes); - if (pCache != NULL) { - AsnObjectIdentifier* pOidSrc = NULL; - AsnObjectIdentifier AsnObId; - if (SnmpUtilOidCpy(&AsnObId, pOidSrc)) { - // - // - // - SnmpUtilOidFree(&AsnObId); - } - SnmpUtilMemFree(pCache); - } else { - _tprintf(_T("ERROR: call to SnmpUtilMemAlloc() failed\n")); - } -} - -// Maximum string lengths for ASCII ip address and port names -// -#define HOSTNAMELEN 256 -#define PORTNAMELEN 256 -#define ADDRESSLEN HOSTNAMELEN+PORTNAMELEN - -// -// Our option flags -// -#define FLAG_SHOW_ALL_ENDPOINTS 1 -#define FLAG_SHOW_ETH_STATS 2 -#define FLAG_SHOW_NUMBERS 3 -#define FLAG_SHOW_PROT_CONNECTIONS 4 -#define FLAG_SHOW_ROUTE_TABLE 5 -#define FLAG_SHOW_PROT_STATS 6 -#define FLAG_SHOW_INTERVAL 7 - - -// Undocumented extended information structures available only on XP and higher - -typedef struct { - DWORD dwState; // state of the connection - DWORD dwLocalAddr; // address on local computer - DWORD dwLocalPort; // port number on local computer - DWORD dwRemoteAddr; // address on remote computer - DWORD dwRemotePort; // port number on remote computer - DWORD dwProcessId; -} MIB_TCPEXROW, *PMIB_TCPEXROW; - -typedef struct { - DWORD dwNumEntries; - MIB_TCPEXROW table[ANY_SIZE]; -} MIB_TCPEXTABLE, *PMIB_TCPEXTABLE; - -typedef struct { - DWORD dwLocalAddr; // address on local computer - DWORD dwLocalPort; // port number on local computer - DWORD dwProcessId; -} MIB_UDPEXROW, *PMIB_UDPEXROW; - -typedef struct { - DWORD dwNumEntries; - MIB_UDPEXROW table[ANY_SIZE]; -} MIB_UDPEXTABLE, *PMIB_UDPEXTABLE; - - -// -// GetPortName -// -// Translate port numbers into their text equivalent if there is one -// -PCHAR -GetPortName(DWORD Flags, UINT port, PCHAR proto, PCHAR name, int namelen) -{ - struct servent *psrvent; - - if (Flags & FLAG_SHOW_NUMBERS) { - sprintf(name, "%d", htons((WORD)port)); - return name; - } - // Try to translate to a name - if (psrvent = getservbyport(port, proto)) { - strcpy(name, psrvent->s_name ); - } else { - sprintf(name, "%d", htons((WORD)port)); - } - return name; -} - - -// -// GetIpHostName -// -// Translate IP addresses into their name-resolved form if possible. -// -PCHAR -GetIpHostName(DWORD Flags, BOOL local, UINT ipaddr, PCHAR name, int namelen) -{ -// struct hostent *phostent; - UINT nipaddr; - - // Does the user want raw numbers? - nipaddr = htonl(ipaddr); - if (Flags & FLAG_SHOW_NUMBERS ) { - sprintf(name, "%d.%d.%d.%d", - (nipaddr >> 24) & 0xFF, - (nipaddr >> 16) & 0xFF, - (nipaddr >> 8) & 0xFF, - (nipaddr) & 0xFF); - return name; - } - - name[0] = _T('\0'); - - // Try to translate to a name - if (!ipaddr) { - if (!local) { - sprintf(name, "%d.%d.%d.%d", - (nipaddr >> 24) & 0xFF, - (nipaddr >> 16) & 0xFF, - (nipaddr >> 8) & 0xFF, - (nipaddr) & 0xFF); - } else { - //gethostname(name, namelen); - } - } else if (ipaddr == 0x0100007f) { - if (local) { - //gethostname(name, namelen); - } else { - strcpy(name, "localhost"); - } -// } else if (phostent = gethostbyaddr((char*)&ipaddr, sizeof(nipaddr), PF_INET)) { -// strcpy(name, phostent->h_name); - } else { -#if 0 - int i1, i2, i3, i4; - - i1 = (nipaddr >> 24) & 0x000000FF; - i2 = (nipaddr >> 16) & 0x000000FF; - i3 = (nipaddr >> 8) & 0x000000FF; - i4 = (nipaddr) & 0x000000FF; - - i1 = 10; - i2 = 20; - i3 = 30; - i4 = 40; - - sprintf(name, "%d.%d.%d.%d", i1,i2,i3,i4); -#else - sprintf(name, "%d.%d.%d.%d", - ((nipaddr >> 24) & 0x000000FF), - ((nipaddr >> 16) & 0x000000FF), - ((nipaddr >> 8) & 0x000000FF), - ((nipaddr) & 0x000000FF)); -#endif - } - return name; -} - -BOOLEAN usage(void) -{ - TCHAR buffer[MAX_RESLEN]; - - int length = LoadString(GetModuleHandle(NULL), IDS_APP_USAGE, buffer, sizeof(buffer)/sizeof(buffer[0])); - _fputts(buffer, stderr); - return FALSE; -} - -// -// GetOptions -// -// Parses the command line arguments. -// -BOOLEAN -GetOptions(int argc, char *argv[], PDWORD pFlags) -{ - int i, j; - BOOLEAN skipArgument; - - *pFlags = 0; - for (i = 1; i < argc; i++) { - skipArgument = FALSE; - switch (argv[i][0]) { - case '-': - case '/': - j = 1; - while (argv[i][j]) { - switch (toupper(argv[i][j])) { - case 'A': - *pFlags |= FLAG_SHOW_ALL_ENDPOINTS; - break; - case 'E': - *pFlags |= FLAG_SHOW_ETH_STATS; - break; - case 'N': - *pFlags |= FLAG_SHOW_NUMBERS; - break; - case 'P': - *pFlags |= FLAG_SHOW_PROT_CONNECTIONS; - break; - case 'R': - *pFlags |= FLAG_SHOW_ROUTE_TABLE; - break; - case 'S': - *pFlags |= FLAG_SHOW_PROT_STATS; - break; - default: - return usage(); - } - if (skipArgument) break; - j++; - } - break; - case 'i': - *pFlags |= FLAG_SHOW_INTERVAL; - break; - default: - return usage(); - } - } - return TRUE; -} - -#if 1 - - CHAR localname[HOSTNAMELEN], remotename[HOSTNAMELEN]; - CHAR remoteport[PORTNAMELEN], localport[PORTNAMELEN]; - CHAR localaddr[ADDRESSLEN], remoteaddr[ADDRESSLEN]; - -int main(int argc, char *argv[]) -{ - PMIB_TCPTABLE tcpTable; - PMIB_UDPTABLE udpTable; - DWORD error, dwSize; - DWORD i, flags; - - // Get options - if (!GetOptions(argc, argv, &flags)) { - return -1; - } else { - // Get the table of TCP endpoints - dwSize = 0; - error = GetTcpTable(NULL, &dwSize, TRUE); - if (error != ERROR_INSUFFICIENT_BUFFER) { - printf("Failed to snapshot TCP endpoints.\n"); - PrintError(error); - return -1; - } - tcpTable = (PMIB_TCPTABLE)malloc(dwSize); - error = GetTcpTable(tcpTable, &dwSize, TRUE ); - if (error) { - printf("Failed to snapshot TCP endpoints table.\n"); - PrintError(error); - return -1; - } - - // Get the table of UDP endpoints - dwSize = 0; - error = GetUdpTable(NULL, &dwSize, TRUE); - if (error != ERROR_INSUFFICIENT_BUFFER) { - printf("Failed to snapshot UDP endpoints.\n"); - PrintError(error); - return -1; - } - udpTable = (PMIB_UDPTABLE)malloc(dwSize); - error = GetUdpTable(udpTable, &dwSize, TRUE); - if (error) { - printf("Failed to snapshot UDP endpoints table.\n"); - PrintError(error); - return -1; - } - - // Dump the TCP table - for (i = 0; i < tcpTable->dwNumEntries; i++) { - if (flags & FLAG_SHOW_ALL_ENDPOINTS || - tcpTable->table[i].dwState == MIB_TCP_STATE_ESTAB) { - sprintf(localaddr, "%s:%s", - GetIpHostName(flags, TRUE, tcpTable->table[i].dwLocalAddr, localname, HOSTNAMELEN), - GetPortName(flags, tcpTable->table[i].dwLocalPort, "tcp", localport, PORTNAMELEN)); - sprintf(remoteaddr, "%s:%s", - GetIpHostName(flags, FALSE, tcpTable->table[i].dwRemoteAddr, remotename, HOSTNAMELEN), - tcpTable->table[i].dwRemoteAddr ? - GetPortName(flags, tcpTable->table[i].dwRemotePort, "tcp", remoteport, PORTNAMELEN): - "0"); - printf("%4s\tState: %s\n", "[TCP]", TcpState[tcpTable->table[i].dwState]); - printf(" Local: %s\n Remote: %s\n", localaddr, remoteaddr); - } - } - // Dump the UDP table - if (flags & FLAG_SHOW_ALL_ENDPOINTS) { - for (i = 0; i < udpTable->dwNumEntries; i++) { - sprintf(localaddr, "%s:%s", - GetIpHostName(flags, TRUE, udpTable->table[i].dwLocalAddr, localname, HOSTNAMELEN), - GetPortName(flags, udpTable->table[i].dwLocalPort, "tcp", localport, PORTNAMELEN)); - printf("%4s", "[UDP]"); - printf(" Local: %s\n Remote: %s\n", localaddr, "*.*.*.*:*"); - } - } - } - printf("\n"); - return 0; -} - -#else - -int main(int argc, char *argv[]) -{ - if (argc > 1) { - usage(); - return 1; - } - - _tprintf(_T("\nActive Connections\n\n")\ - _T(" Proto Local Address Foreign Address State\n\n")); - test_snmp(); - - ShowTcpStatistics(); - ShowUdpStatistics(); - ShowIpStatistics(); - ShowNetworkParams(); - ShowAdapterInfo(); - - return 0; -} - -#endif diff --git a/rosapps/net/netstat/netstat.rc b/rosapps/net/netstat/netstat.rc deleted file mode 100644 index 475396ae3d2..00000000000 --- a/rosapps/net/netstat/netstat.rc +++ /dev/null @@ -1,40 +0,0 @@ -/* $Id: netstat.rc,v 1.3 2004/10/16 22:30:17 gvg Exp $ */ - -#include -#include "resource.h" - -#define REACTOS_STR_FILE_DESCRIPTION "ReactOS TCP/IPv4 Win32 netstat\0" -#define REACTOS_STR_INTERNAL_NAME "netstat\0" -#define REACTOS_STR_ORIGINAL_FILENAME "netstat.exe\0" -#include - -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -#ifdef __GNUC__ -STRINGTABLE DISCARDABLE -BEGIN - IDS_APP_TITLE "ReactOS netstat" - IDS_APP_USAGE "\n"\ - "Displays current TCP/IP protocol statistics and network connections.\n\n"\ - "NETSTAT [-a] [-e] [-n] [-s] [-p proto] [-r] [interval]\n\n"\ - " -a Displays all connections and listening ports.\n"\ - " -e Displays Ethernet statistics. May be combined with -s\n"\ - " -n Displays address and port numbers in numeric form.\n"\ - " -p proto Shows connections for protocol 'proto' TCP or UDP.\n"\ - " If used with the -s option to display\n"\ - " per-protocol statistics, 'proto' may be TCP, UDP, or IP.\n"\ - " -r Displays the current routing table.\n"\ - " -s Displays per-protocol statistics. Statistics are shown for\n"\ - " TCP, UDP and IP by default; use -p option to display\n"\ - " information about a subset of the protocols only.\n"\ - " interval Redisplays selected statistics every 'interval' seconds.\n"\ - " Press CTRL+C to stop redisplaying. By default netstat will\n"\ - " print the current information only once.\n" -END -#endif - diff --git a/rosapps/net/netstat/resource.h b/rosapps/net/netstat/resource.h deleted file mode 100644 index 16f0156e0a5..00000000000 --- a/rosapps/net/netstat/resource.h +++ /dev/null @@ -1,7 +0,0 @@ - -#define RES_FIRST_INDEX 1 -#define RES_LAST_INDEX 25 - -#define IDS_APP_TITLE 100 -#define IDS_APP_USAGE 101 - diff --git a/rosapps/net/netstat/trace.c b/rosapps/net/netstat/trace.c deleted file mode 100644 index d225a22984a..00000000000 --- a/rosapps/net/netstat/trace.c +++ /dev/null @@ -1,53 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Diagnostic Trace -// -#include -#include -#define WIN32_LEAN_AND_MEAN -#include -#include -#include "trace.h" - - -#ifdef _DEBUG - -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; - -void _DebugBreak(void) -{ - DebugBreak(); -} - -void Trace(TCHAR* lpszFormat, ...) -{ - va_list args; - int nBuf; - TCHAR szBuffer[512]; - - va_start(args, lpszFormat); - nBuf = _vsntprintf(szBuffer, sizeof(szBuffer)/sizeof(TCHAR), lpszFormat, args); - OutputDebugString(szBuffer); - // was there an error? was the expanded string too long? - //ASSERT(nBuf >= 0); - va_end(args); -} - -void Assert(void* assert, TCHAR* file, int line, void* msg) -{ - if (msg == NULL) { - printf("ASSERT -- %s occured on line %u of file %s.\n", - assert, line, file); - } else { - printf("ASSERT -- %s occured on line %u of file %s: Message = %s.\n", - assert, line, file, msg); - } -} - -#else - -void Trace(TCHAR* lpszFormat, ...) { }; -void Assert(void* assert, TCHAR* file, int line, void* msg) { }; - -#endif //_DEBUG -///////////////////////////////////////////////////////////////////////////// diff --git a/rosapps/net/netstat/trace.h b/rosapps/net/netstat/trace.h deleted file mode 100644 index 7f3318e3daa..00000000000 --- a/rosapps/net/netstat/trace.h +++ /dev/null @@ -1,61 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Diagnostic Trace -// -#ifndef __TRACE_H__ -#define __TRACE_H__ - -#ifdef _DEBUG - -#ifdef _X86_ -#define BreakPoint() _asm { int 3h } -#else -#define BreakPoint() _DebugBreak() -#endif - -#ifndef ASSERT -#define ASSERT(exp) \ -{ \ - if (!(exp)) { \ - Assert(#exp, __FILE__, __LINE__, NULL); \ - BreakPoint(); \ - } \ -} \ - -#define ASSERTMSG(exp, msg) \ -{ \ - if (!(exp)) { \ - Assert(#exp, __FILE__, __LINE__, msg); \ - BreakPoint(); \ - } \ -} -#endif - -//============================================================================= -// MACRO: TRACE() -//============================================================================= - -#define TRACE Trace - - -#else // _DEBUG - -//============================================================================= -// Define away MACRO's ASSERT() and TRACE() in non debug builds -//============================================================================= - -#ifndef ASSERT -#define ASSERT(exp) -#define ASSERTMSG(exp, msg) -#endif - -#define TRACE 0 ? (void)0 : Trace - -#endif // !_DEBUG - - -void Assert(void* assert, TCHAR* file, int line, void* msg); -void Trace(TCHAR* lpszFormat, ...); - - -#endif // __TRACE_H__ -///////////////////////////////////////////////////////////////////////////// diff --git a/rosapps/net/ping/.cvsignore b/rosapps/net/ping/.cvsignore deleted file mode 100644 index 954ada33419..00000000000 --- a/rosapps/net/ping/.cvsignore +++ /dev/null @@ -1,17 +0,0 @@ -*.sys -*.exe -*.dll -*.cpl -*.a -*.o -*.d -*.coff -*.dsp -*.dsw -*.aps -*.ncb -*.opt -*.sym -*.plg -*.bak -*.map diff --git a/rosapps/net/ping/makefile b/rosapps/net/ping/makefile deleted file mode 100644 index 5f8d29ed6f4..00000000000 --- a/rosapps/net/ping/makefile +++ /dev/null @@ -1,21 +0,0 @@ -# $Id: makefile,v 1.3 2004/01/16 04:43:19 mtempel Exp $ - -PATH_TO_TOP=../../../reactos - -TARGET_TYPE = program - -TARGET_APPTYPE = console - -TARGET_NAME = ping - -TARGET_CFLAGS = -D__USE_W32_SOCKETS - -TARGET_SDKLIBS = ntdll.a ws2_32.a - -TARGET_OBJECTS = $(TARGET_NAME).o - -include $(PATH_TO_TOP)/rules.mak - -include $(TOOLS_PATH)/helper.mk - -# EOF diff --git a/rosapps/net/ping/ping.c b/rosapps/net/ping/ping.c deleted file mode 100644 index 26f397f2269..00000000000 --- a/rosapps/net/ping/ping.c +++ /dev/null @@ -1,633 +0,0 @@ -/* $Id: ping.c,v 1.3 2004/01/16 04:43:19 mtempel Exp $ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS ping utility - * FILE: apps/net/ping/ping.c - * PURPOSE: Network test utility - * PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net) - * REVISIONS: - * CSH 01/09/2000 Created - */ -//#include -#include -#include -#include -#include -#include -#ifndef _MSC_VER - -//#define DBG - -/* FIXME: Where should this be? */ -#ifdef CopyMemory -#undef CopyMemory -#endif -#define CopyMemory(Destination, Source, Length) memcpy(Destination, Source, Length); - -/* Should be in the header files somewhere (exported by ntdll.dll) */ -long atol(const char *str); - -#ifndef __int64 -typedef long long __int64; -#endif - -char * _i64toa(__int64 value, char *string, int radix); - -#endif - - -/* General ICMP constants */ -#define ICMP_MINSIZE 8 /* Minimum ICMP packet size */ -#define ICMP_MAXSIZE 65535 /* Maximum ICMP packet size */ - -/* ICMP message types */ -#define ICMPMSG_ECHOREQUEST 8 /* ICMP ECHO request message */ -#define ICMPMSG_ECHOREPLY 0 /* ICMP ECHO reply message */ - -#pragma pack(4) - -/* IPv4 header structure */ -typedef struct _IPv4_HEADER { - unsigned char IHL:4; - unsigned char Version:4; - unsigned char TOS; - unsigned short Length; - unsigned short Id; - unsigned short FragFlags; - unsigned char TTL; - unsigned char Protocol; - unsigned short Checksum; - unsigned int SrcAddress; - unsigned int DstAddress; -} IPv4_HEADER, *PIPv4_HEADER; - -/* ICMP echo request/reply header structure */ -typedef struct _ICMP_HEADER { - unsigned char Type; - unsigned char Code; - unsigned short Checksum; - unsigned short Id; - unsigned short SeqNum; -} ICMP_HEADER, *PICMP_HEADER; - -typedef struct _ICMP_ECHO_PACKET { - ICMP_HEADER Icmp; - LARGE_INTEGER Timestamp; -} ICMP_ECHO_PACKET, *PICMP_ECHO_PACKET; - -#pragma pack(1) - -BOOL InvalidOption; -BOOL NeverStop; -BOOL ResolveAddresses; -UINT PingCount; -UINT DataSize; /* ICMP echo request data size */ -BOOL DontFragment; -ULONG TTLValue; -ULONG TOSValue; -ULONG Timeout; -CHAR TargetName[256]; -SOCKET IcmpSock; -SOCKADDR_IN Target; -LPSTR TargetIP; -FD_SET Fds; -TIMEVAL Timeval; -UINT CurrentSeqNum; -UINT SentCount; -UINT LostCount; -BOOL MinRTTSet; -LARGE_INTEGER MinRTT; /* Minimum round trip time in microseconds */ -LARGE_INTEGER MaxRTT; -LARGE_INTEGER SumRTT; -LARGE_INTEGER AvgRTT; -LARGE_INTEGER TicksPerMs; /* Ticks per millisecond */ -LARGE_INTEGER TicksPerUs; /* Ticks per microsecond */ -BOOL UsePerformanceCounter; - - -/* Display the contents of a buffer */ -VOID DisplayBuffer( - PVOID Buffer, - DWORD Size) -{ - UINT i; - PCHAR p; - - printf("Buffer (0x%X) Size (0x%X).\n", Buffer, Size); - - p = (PCHAR)Buffer; - for (i = 0; i < Size; i++) { - if (i % 16 == 0) { - printf("\n"); - } - printf("%02X ", (p[i]) & 0xFF); - } -} - -/* Display usage information on screen */ -VOID Usage(VOID) -{ - printf("\nUsage: ping [-t] [-n count] [-l size] [-w timeout] destination-host\n\n"); - printf("Options:\n"); - printf(" -t Ping the specified host until stopped.\n"); - printf(" To stop - type Control-C.\n"); - printf(" -n count Number of echo requests to send.\n"); - printf(" -l size Send buffer size.\n"); - printf(" -w timeout Timeout in milliseconds to wait for each reply.\n\n"); -} - -/* Reset configuration to default values */ -VOID Reset(VOID) -{ - LARGE_INTEGER PerformanceCounterFrequency; - - NeverStop = FALSE; - ResolveAddresses = FALSE; - PingCount = 4; - DataSize = 32; - DontFragment = FALSE; - TTLValue = 128; - TOSValue = 0; - Timeout = 1000; - UsePerformanceCounter = QueryPerformanceFrequency(&PerformanceCounterFrequency); - - if (UsePerformanceCounter) { - /* Performance counters may return incorrect results on some multiprocessor - platforms so we restrict execution on the first processor. This may fail - on Windows NT so we fall back to GetCurrentTick() for timing */ - if (SetThreadAffinityMask (GetCurrentThread(), 1) == 0) { - UsePerformanceCounter = FALSE; - } - - /* Convert frequency to ticks per millisecond */ - TicksPerMs.QuadPart = PerformanceCounterFrequency.QuadPart / 1000; - /* And to ticks per microsecond */ - TicksPerUs.QuadPart = PerformanceCounterFrequency.QuadPart / 1000000; - } - if (!UsePerformanceCounter) { - /* 1 tick per millisecond for GetCurrentTick() */ - TicksPerMs.QuadPart = 1; - /* GetCurrentTick() cannot handle microseconds */ - TicksPerUs.QuadPart = 1; - } -} - -/* Return ULONG in a string */ -ULONG GetULONG(LPSTR String) -{ - UINT i, Length; - ULONG Value; - - i = 0; - Length = strlen(String); - while ((i < Length) && ((String[i] < '0') || (String[i] > '9'))) i++; - if ((i >= Length) || ((String[i] < '0') || (String[i] > '9'))) { - InvalidOption = TRUE; - return 0; - } - Value = (ULONG)atol(&String[i]); - - return Value; -} - -/* Return ULONG in a string. Try next paramter if not successful */ -ULONG GetULONG2(LPSTR String1, LPSTR String2, PINT i) -{ - ULONG Value; - - Value = GetULONG(String1); - if (InvalidOption) { - InvalidOption = FALSE; - if (String2[0] != '-') { - Value = GetULONG(String2); - if (!InvalidOption) - *i += 1; - } - } - - return Value; -} - -/* Parse command line parameters */ -BOOL ParseCmdline(int argc, char* argv[]) -{ - INT i; - BOOL ShowUsage; - BOOL FoundTarget; -//#if 1 -// lstrcpy(TargetName, "127.0.0.1"); -// PingCount = 1; -// return TRUE; -//#endif - if (argc < 2) { - ShowUsage = TRUE; - } else { - ShowUsage = FALSE; - } - FoundTarget = FALSE; - InvalidOption = FALSE; - - for (i = 1; i < argc; i++) { - if (argv[i][0] == '-') { - switch (argv[i][1]) { - case 't': NeverStop = TRUE; break; - case 'a': ResolveAddresses = TRUE; break; - case 'n': PingCount = GetULONG2(&argv[i][2], argv[i + 1], &i); break; - case 'l': - DataSize = GetULONG2(&argv[i][2], argv[i + 1], &i); - if ((DataSize < 0) || (DataSize > ICMP_MAXSIZE - sizeof(ICMP_ECHO_PACKET))) { - printf("Bad value for option -l, valid range is from 0 to %d.\n", - ICMP_MAXSIZE - sizeof(ICMP_ECHO_PACKET)); - return FALSE; - } - break; - case 'f': DontFragment = TRUE; break; - case 'i': TTLValue = GetULONG2(&argv[i][2], argv[i + 1], &i); break; - case 'v': TOSValue = GetULONG2(&argv[i][2], argv[i + 1], &i); break; - case 'w': Timeout = GetULONG2(&argv[i][2], argv[i + 1], &i); break; - default: - printf("Bad option %s.\n", argv[i]); - Usage(); - return FALSE; - } - if (InvalidOption) { - printf("Bad option format %s.\n", argv[i]); - return FALSE; - } - } else { - if (FoundTarget) { - printf("Bad parameter %s.\n", argv[i]); - return FALSE; - } else { - lstrcpy(TargetName, argv[i]); - FoundTarget = TRUE; - } - } - } - - if ((!ShowUsage) && (!FoundTarget)) { - printf("Name or IP address of destination host must be specified.\n"); - return FALSE; - } - - if (ShowUsage) { - Usage(); - return FALSE; - } - return TRUE; -} - -/* Calculate checksum of data */ -WORD Checksum(PUSHORT data, UINT size) -{ - ULONG sum = 0; - - while (size > 1) { - sum += *data++; - size -= sizeof(USHORT); - } - - if (size) - sum += *(UCHAR*)data; - - sum = (sum >> 16) + (sum & 0xFFFF); - sum += (sum >> 16); - - return (USHORT)(~sum); -} - -/* Prepare to ping target */ -BOOL Setup(VOID) -{ - WORD wVersionRequested; - WSADATA WsaData; - INT Status; - ULONG Addr; - PHOSTENT phe; - - wVersionRequested = MAKEWORD(2, 2); - - Status = WSAStartup(wVersionRequested, &WsaData); - if (Status != 0) { - printf("Could not initialize winsock dll.\n"); - return FALSE; - } - - IcmpSock = WSASocket(AF_INET, SOCK_RAW, IPPROTO_ICMP, NULL, 0, 0); - if (IcmpSock == INVALID_SOCKET) { - printf("Could not create socket (#%d).\n", WSAGetLastError()); - return FALSE; - } - - ZeroMemory(&Target, sizeof(Target)); - phe = NULL; - Addr = inet_addr(TargetName); - if (Addr == INADDR_NONE) { - phe = gethostbyname(TargetName); - if (phe == NULL) { - printf("Unknown host %s.\n", TargetName); - return FALSE; - } - } - - if (phe != NULL) { - CopyMemory(&Target.sin_addr, phe->h_addr_list, phe->h_length); - } else { - Target.sin_addr.s_addr = Addr; - } - - if (phe != NULL) { - Target.sin_family = phe->h_addrtype; - } else { - Target.sin_family = AF_INET; - } - - TargetIP = inet_ntoa(Target.sin_addr); - CurrentSeqNum = 0; - SentCount = 0; - LostCount = 0; - MinRTT.QuadPart = 0; - MaxRTT.QuadPart = 0; - SumRTT.QuadPart = 0; - MinRTTSet = FALSE; - return TRUE; -} - -/* Close socket */ -VOID Cleanup(VOID) -{ - if (IcmpSock != INVALID_SOCKET) - closesocket(IcmpSock); - - WSACleanup(); -} - -VOID QueryTime(PLARGE_INTEGER Time) -{ - if (UsePerformanceCounter) { - if (QueryPerformanceCounter(Time) == 0) { - /* This should not happen, but we fall - back to GetCurrentTick() if it does */ - Time->u.LowPart = (ULONG)GetTickCount(); - Time->u.HighPart = 0; - - /* 1 tick per millisecond for GetCurrentTick() */ - TicksPerMs.QuadPart = 1; - /* GetCurrentTick() cannot handle microseconds */ - TicksPerUs.QuadPart = 1; - - UsePerformanceCounter = FALSE; - } - } else { - Time->u.LowPart = (ULONG)GetTickCount(); - Time->u.HighPart = 0; - } -} - -VOID TimeToMsString(LPSTR String, LARGE_INTEGER Time) -{ - UINT i, Length; - CHAR Convstr[40]; - LARGE_INTEGER LargeTime; - - LargeTime.QuadPart = Time.QuadPart / TicksPerMs.QuadPart; - _i64toa(LargeTime.QuadPart, Convstr, 10); - strcpy(String, Convstr); - strcat(String, ","); - - LargeTime.QuadPart = (Time.QuadPart % TicksPerMs.QuadPart) / TicksPerUs.QuadPart; - _i64toa(LargeTime.QuadPart, Convstr, 10); - Length = strlen(Convstr); - if (Length < 4) { - for (i = 0; i < 4 - Length; i++) - strcat(String, "0"); - } - - strcat(String, Convstr); - strcat(String, "ms"); -} - -/* Locate the ICMP data and print it. Returns TRUE if the packet was good, - FALSE if not */ -BOOL DecodeResponse(PCHAR buffer, UINT size, PSOCKADDR_IN from) -{ - PIPv4_HEADER IpHeader; - PICMP_ECHO_PACKET Icmp; - UINT IphLength; - CHAR Time[100]; - LARGE_INTEGER RelativeTime; - LARGE_INTEGER LargeTime; - - IpHeader = (PIPv4_HEADER)buffer; - - IphLength = IpHeader->IHL * 4; - - if (size < IphLength + ICMP_MINSIZE) { -#ifdef DBG - printf("Bad size (0x%X < 0x%X)\n", size, IphLength + ICMP_MINSIZE); -#endif /* DBG */ - return FALSE; - } - - Icmp = (PICMP_ECHO_PACKET)(buffer + IphLength); - - if (Icmp->Icmp.Type != ICMPMSG_ECHOREPLY) { -#ifdef DBG - printf("Bad ICMP type (0x%X should be 0x%X)\n", Icmp->Icmp.Type, ICMPMSG_ECHOREPLY); -#endif /* DBG */ - return FALSE; - } - - if (Icmp->Icmp.Id != (USHORT)GetCurrentProcessId()) { -#ifdef DBG - printf("Bad ICMP id (0x%X should be 0x%X)\n", Icmp->Icmp.Id, (USHORT)GetCurrentProcessId()); -#endif /* DBG */ - return FALSE; - } - - QueryTime(&LargeTime); - - RelativeTime.QuadPart = (LargeTime.QuadPart - Icmp->Timestamp.QuadPart); - - TimeToMsString(Time, RelativeTime); - - printf("Reply from %s: bytes=%d time=%s TTL=%d\n", inet_ntoa(from->sin_addr), - size - IphLength - sizeof(ICMP_ECHO_PACKET), Time, IpHeader->TTL); - if (RelativeTime.QuadPart < MinRTT.QuadPart) { - MinRTT.QuadPart = RelativeTime.QuadPart; - MinRTTSet = TRUE; - } - if (RelativeTime.QuadPart > MaxRTT.QuadPart) - MaxRTT.QuadPart = RelativeTime.QuadPart; - SumRTT.QuadPart += RelativeTime.QuadPart; - - return TRUE; -} - -/* Send and receive one ping */ -BOOL Ping(VOID) -{ - INT Status; - SOCKADDR From; - UINT Length; - PVOID Buffer; - UINT Size; - PICMP_ECHO_PACKET Packet; - - /* Account for extra space for IP header when packet is received */ - Size = DataSize + 128; - Buffer = GlobalAlloc(0, Size); - if (!Buffer) { - printf("Not enough free resources available.\n"); - return FALSE; - } - - ZeroMemory(Buffer, Size); - Packet = (PICMP_ECHO_PACKET)Buffer; - - /* Assemble ICMP echo request packet */ - Packet->Icmp.Type = ICMPMSG_ECHOREQUEST; - Packet->Icmp.Code = 0; - Packet->Icmp.Id = (USHORT)GetCurrentProcessId(); - Packet->Icmp.SeqNum = (USHORT)CurrentSeqNum; - Packet->Icmp.Checksum = 0; - - /* Timestamp is part of data area */ - QueryTime(&Packet->Timestamp); - - CopyMemory(Buffer, &Packet->Icmp, sizeof(ICMP_ECHO_PACKET) + DataSize); - /* Calculate checksum for ICMP header and data area */ - Packet->Icmp.Checksum = Checksum((PUSHORT)&Packet->Icmp, sizeof(ICMP_ECHO_PACKET) + DataSize); - - CurrentSeqNum++; - - /* Send ICMP echo request */ - - FD_ZERO(&Fds); - FD_SET(IcmpSock, &Fds); - Timeval.tv_sec = Timeout / 1000; - Timeval.tv_usec = Timeout % 1000; - Status = select(0, NULL, &Fds, NULL, &Timeval); - if ((Status != SOCKET_ERROR) && (Status != 0)) { - -#ifdef DBG - printf("Sending packet\n"); - DisplayBuffer(Buffer, sizeof(ICMP_ECHO_PACKET) + DataSize); - printf("\n"); -#endif /* DBG */ - - Status = sendto(IcmpSock, Buffer, sizeof(ICMP_ECHO_PACKET) + DataSize, - 0, (SOCKADDR*)&Target, sizeof(Target)); - SentCount++; - } - if (Status == SOCKET_ERROR) { - if (WSAGetLastError() == WSAEHOSTUNREACH) { - printf("Destination host unreachable.\n"); - } else { - printf("Could not transmit data (%d).\n", WSAGetLastError()); - } - GlobalFree(Buffer); - return FALSE; - } - - /* Expect to receive ICMP echo reply */ - FD_ZERO(&Fds); - FD_SET(IcmpSock, &Fds); - Timeval.tv_sec = Timeout / 1000; - Timeval.tv_usec = Timeout % 1000; - - Status = select(0, &Fds, NULL, NULL, &Timeval); - if ((Status != SOCKET_ERROR) && (Status != 0)) { - Length = sizeof(From); - Status = recvfrom(IcmpSock, Buffer, Size, 0, &From, &Length); - -#ifdef DBG - printf("Received packet\n"); - DisplayBuffer(Buffer, Status); - printf("\n"); -#endif /* DBG */ - } - if (Status == SOCKET_ERROR) { - if (WSAGetLastError() != WSAETIMEDOUT) { - printf("Could not receive data (%d).\n", WSAGetLastError()); - GlobalFree(Buffer); - return FALSE; - } - Status = 0; - } - - if (Status == 0) { - printf("Request timed out.\n"); - LostCount++; - GlobalFree(Buffer); - return TRUE; - } - - if (!DecodeResponse(Buffer, Status, (PSOCKADDR_IN)&From)) { - /* FIXME: Wait again as it could be another ICMP message type */ - printf("Request timed out (incomplete datagram received).\n"); - LostCount++; - } - - GlobalFree(Buffer); - return TRUE; -} - - -/* Program entry point */ -int main(int argc, char* argv[]) -{ - UINT Count; - CHAR MinTime[20]; - CHAR MaxTime[20]; - CHAR AvgTime[20]; - - Reset(); - - if ((ParseCmdline(argc, argv)) && (Setup())) { - - printf("\nPinging %s [%s] with %d bytes of data:\n\n", - TargetName, TargetIP, DataSize); - - Count = 0; - while ((NeverStop) || (Count < PingCount)) { - Ping(); - Sleep(Timeout); - Count++; - }; - - Cleanup(); - - /* Calculate avarage round trip time */ - if ((SentCount - LostCount) > 0) { - AvgRTT.QuadPart = SumRTT.QuadPart / (SentCount - LostCount); - } else { - AvgRTT.QuadPart = 0; - } - - /* Calculate loss percent */ - if (LostCount > 0) { - Count = (SentCount * 100) / LostCount; - } else { - Count = 0; - } - - if (!MinRTTSet) - MinRTT = MaxRTT; - - TimeToMsString(MinTime, MinRTT); - TimeToMsString(MaxTime, MaxRTT); - TimeToMsString(AvgTime, AvgRTT); - - /* Print statistics */ - printf("\nPing statistics for %s:\n", TargetIP); - printf(" Packets: Sent = %d, Received = %d, Lost = %d (%d%% loss),\n", - SentCount, SentCount - LostCount, LostCount, Count); - printf("Approximate round trip times in milli-seconds:\n"); - printf(" Minimum = %s, Maximum = %s, Average = %s\n", - MinTime, MaxTime, AvgTime); - } - return 0; -} - -/* EOF */ diff --git a/rosapps/net/ping/ping.rc b/rosapps/net/ping/ping.rc deleted file mode 100644 index ba9dd84db9a..00000000000 --- a/rosapps/net/ping/ping.rc +++ /dev/null @@ -1,7 +0,0 @@ -/* $Id: ping.rc,v 1.3 2004/10/16 22:30:17 gvg Exp $ */ - -#define REACTOS_STR_FILE_DESCRIPTION "ReactOS TCP/IPv4 Win32 Ping\0" -#define REACTOS_STR_INTERNAL_NAME "ping\0" -#define REACTOS_STR_ORIGINAL_FILENAME "ping.exe\0" -#define REACTOS_STR_ORIGINAL_COPYRIGHT "Casper S. Hornstrup (chorns@users.sourceforge.net)\0" -#include diff --git a/rosapps/net/telnet/.cvsignore b/rosapps/net/telnet/.cvsignore deleted file mode 100644 index 954ada33419..00000000000 --- a/rosapps/net/telnet/.cvsignore +++ /dev/null @@ -1,17 +0,0 @@ -*.sys -*.exe -*.dll -*.cpl -*.a -*.o -*.d -*.coff -*.dsp -*.dsw -*.aps -*.ncb -*.opt -*.sym -*.plg -*.bak -*.map diff --git a/rosapps/net/telnet/Makefile b/rosapps/net/telnet/Makefile deleted file mode 100644 index dce43a92de5..00000000000 --- a/rosapps/net/telnet/Makefile +++ /dev/null @@ -1,43 +0,0 @@ -# $Id: Makefile,v 1.5 2004/03/10 18:57:35 sedwards Exp $ - -PATH_TO_TOP=../../../reactos - -TARGET_TYPE = program - -TARGET_APPTYPE = console - -TARGET_NAME = telnet - -TARGET_SDKLIBS = ws2_32.a - -TARGET_CPPFLAGS = -D__REACTOS__ -D__USE_W32API -Wall - -TARGET_GCCLIBS = stdc++ - -TARGET_OBJECTS = \ - src/ansiprsr.o \ - src/keytrans.o \ - src/tcharmap.o \ - src/tconsole.o \ - src/tkeydef.o \ - src/tkeymap.o \ - src/tmapldr.o \ - src/tmouse.o \ - src/tnclass.o \ - src/tnclip.o \ - src/tncon.o \ - src/tnconfig.o \ - src/tnerror.o \ - src/tnetwork.o \ - src/tnmain.o \ - src/tnmisc.o \ - src/tscript.o \ - src/tscroll.o \ - src/ttelhndl.o - - -include $(PATH_TO_TOP)/rules.mak - -include $(TOOLS_PATH)/helper.mk - -# EOF diff --git a/rosapps/net/telnet/Makefile.mingw b/rosapps/net/telnet/Makefile.mingw deleted file mode 100644 index 9aab1f581c4..00000000000 --- a/rosapps/net/telnet/Makefile.mingw +++ /dev/null @@ -1,142 +0,0 @@ -# -# Makefile for Console Telnet -# Last modified 4/15/2000 by Paul Brannan -# - -SRCDIR=./src -OBJDIR=src -RESDIR=resource - -SRC=$(wildcard $(SRCDIR)/*.cpp) -RESOURCES=$(wildcard $(RESDIR)/*.rc) -OBJ1=$(SRC:.c=.o) -OBJ=$(OBJ1:.cpp=.o) $(RESOURCES:.rc=.o) - -INCLUDES=-I$(RESDIR) - -OUT=telnet.exe - -# Modify these for your system if necessary -# Note: DJGPP+RDXNTDJ configuration is untested. - -# --CYGWIN-- -#CC=gcc -#CCC=g++ -#LDFLAGS=-lwsock32 -lmsvcrt -#CFLAGS=-O2 -Wall -mwindows -mno-cygwin -D__CYGWIN__ -#CCFLAGS=$(CFLAGS) -#RES= -#RC=windres -#RCFLAGS=-O coff - -# --MINGW32(+EGCS)-- -CC=gcc -CCC=g++ -LDFLAGS=-lkernel32 -luser32 -lgdi32 -lshell32 -lwsock32 -CFLAGS=-O2 -Wall -CCFLAGS=$(CFLAGS) -RES= -RC=windres -RCFLAGS= - -# --DJGPP+RSXNTDJ-- -#CC=gcc -Zwin32 -Zmt -Zcrtdll -#CCC=$(CC) -#LDFLAGS= -#CFLAGS= -g -#CCFLAGS=$(CFLAGS) -#RES=rsrc -#RC=grc -#RCFLAGS=-r - - -# You should not have to modify anything below this line - -all: dep $(OUT) - -.SUFFIXES: .c .cpp .rc - -.c.o: - $(CC) $(INCLUDES) $(CFLAGS) -c $< -o $@ - -.cpp.o: - $(CCC) $(INCLUDES) $(CCFLAGS) -c $< -o $@ - -.rc.o: - $(RC) -i $< $(RCFLAGS) -o $@ - -$(OUT): $(OBJ) - $(CCC) $(OBJ) $(LDFLAGS) $(LIBS) -o $(OUT) - strip $(OUT) - -depend: dep - -dep: - start /min makedepend -- $(CFLAGS) -- $(INCLUDES) $(SRC) - -clean: - del $(OBJDIR)\*.o - del $(OUT) - -# DO NOT DELETE - -./src/ansiprsr.o: ./src/ansiprsr.h ./src/tnconfig.h ./src/tnerror.h -./src/ansiprsr.o: ./src/tnmsg.h ./src/tparser.h ./src/tconsole.h -./src/ansiprsr.o: ./src/keytrans.h ./src/tkeydef.h ./src/tkeymap.h -./src/ansiprsr.o: ./src/stl_bids.h ./src/tscroll.h ./src/tmouse.h -./src/ansiprsr.o: ./src/tnclip.h ./src/tnetwork.h ./src/tcharmap.h -./src/keytrans.o: ./src/keytrans.h ./src/tkeydef.h ./src/tkeymap.h -./src/keytrans.o: ./src/stl_bids.h ./src/tnerror.h ./src/tnmsg.h -./src/tcharmap.o: ./src/tcharmap.h ./src/tnconfig.h ./src/tnerror.h -./src/tcharmap.o: ./src/tnmsg.h -./src/tconsole.o: ./src/tconsole.h ./src/tnconfig.h ./src/tnerror.h -./src/tconsole.o: ./src/tnmsg.h -./src/tkeydef.o: ./src/tkeydef.h -./src/tkeymap.o: ./src/tkeymap.h ./src/stl_bids.h ./src/tkeydef.h -./src/tmapldr.o: ./src/tmapldr.h ./src/keytrans.h ./src/tkeydef.h -./src/tmapldr.o: ./src/tkeymap.h ./src/stl_bids.h ./src/tcharmap.h -./src/tmapldr.o: ./src/tnerror.h ./src/tnmsg.h ./src/tnconfig.h -./src/tmouse.o: ./src/tmouse.h ./src/tnclip.h ./src/tnetwork.h -./src/tmouse.o: ./src/tconsole.h ./src/tnconfig.h ./src/tnerror.h -./src/tmouse.o: ./src/tnmsg.h -./src/tnclass.o: ./src/tnclass.h ./src/tnconfig.h ./src/tnerror.h -./src/tnclass.o: ./src/tnmsg.h ./src/ttelhndl.h ./src/tparser.h -./src/tnclass.o: ./src/tconsole.h ./src/keytrans.h ./src/tkeydef.h -./src/tnclass.o: ./src/tkeymap.h ./src/stl_bids.h ./src/tscroll.h -./src/tnclass.o: ./src/tmouse.h ./src/tnclip.h ./src/tnetwork.h -./src/tnclass.o: ./src/tcharmap.h ./src/tncon.h ./src/tparams.h -./src/tnclass.o: ./src/ansiprsr.h ./src/tmapldr.h ./src/tnmisc.h -./src/tnclip.o: ./src/tnclip.h ./src/tnetwork.h -./src/tncon.o: ./src/tncon.h ./src/tparams.h ./src/ttelhndl.h ./src/tparser.h -./src/tncon.o: ./src/tconsole.h ./src/tnconfig.h ./src/tnerror.h -./src/tncon.o: ./src/tnmsg.h ./src/keytrans.h ./src/tkeydef.h ./src/tkeymap.h -./src/tncon.o: ./src/stl_bids.h ./src/tscroll.h ./src/tmouse.h ./src/tnclip.h -./src/tncon.o: ./src/tnetwork.h ./src/tcharmap.h -./src/tnconfig.o: ./src/tnconfig.h ./src/tnerror.h ./src/tnmsg.h -./src/tnerror.o: ./src/tnerror.h ./src/tnmsg.h ./src/ttelhndl.h -./src/tnerror.o: ./src/tparser.h ./src/tconsole.h ./src/tnconfig.h -./src/tnerror.o: ./src/keytrans.h ./src/tkeydef.h ./src/tkeymap.h -./src/tnerror.o: ./src/stl_bids.h ./src/tscroll.h ./src/tmouse.h -./src/tnerror.o: ./src/tnclip.h ./src/tnetwork.h ./src/tcharmap.h -./src/tnetwork.o: ./src/tnetwork.h -./src/tnmain.o: ./src/tnmain.h ./src/tncon.h ./src/tparams.h ./src/ttelhndl.h -./src/tnmain.o: ./src/tparser.h ./src/tconsole.h ./src/tnconfig.h -./src/tnmain.o: ./src/tnerror.h ./src/tnmsg.h ./src/keytrans.h -./src/tnmain.o: ./src/tkeydef.h ./src/tkeymap.h ./src/stl_bids.h -./src/tnmain.o: ./src/tscroll.h ./src/tmouse.h ./src/tnclip.h -./src/tnmain.o: ./src/tnetwork.h ./src/tcharmap.h ./src/tnclass.h -./src/tnmain.o: ./src/ansiprsr.h ./src/tmapldr.h ./src/tnmisc.h -./src/tnmisc.o: ./src/tnmisc.h -./src/tscript.o: ./src/tscript.h ./src/tnetwork.h -./src/tscroll.o: ./src/tscroll.h ./src/tconsole.h ./src/tnconfig.h -./src/tscroll.o: ./src/tnerror.h ./src/tnmsg.h ./src/tmouse.h ./src/tnclip.h -./src/tscroll.o: ./src/tnetwork.h ./src/tncon.h ./src/tparams.h -./src/tscroll.o: ./src/ttelhndl.h ./src/tparser.h ./src/keytrans.h -./src/tscroll.o: ./src/tkeydef.h ./src/tkeymap.h ./src/stl_bids.h -./src/tscroll.o: ./src/tcharmap.h -./src/ttelhndl.o: ./src/ttelhndl.h ./src/tparser.h ./src/tconsole.h -./src/ttelhndl.o: ./src/tnconfig.h ./src/tnerror.h ./src/tnmsg.h -./src/ttelhndl.o: ./src/keytrans.h ./src/tkeydef.h ./src/tkeymap.h -./src/ttelhndl.o: ./src/stl_bids.h ./src/tscroll.h ./src/tmouse.h -./src/ttelhndl.o: ./src/tnclip.h ./src/tnetwork.h ./src/tcharmap.h -./src/ttelhndl.o: ./src/telnet.h ./src/tparams.h diff --git a/rosapps/net/telnet/doc/00readme.avs b/rosapps/net/telnet/doc/00readme.avs deleted file mode 100644 index fe0e2d209df..00000000000 --- a/rosapps/net/telnet/doc/00readme.avs +++ /dev/null @@ -1,261 +0,0 @@ -Hi! - -Now I come back to telnet source, and make some changes, wich you suggest -to me: - -1. telnet.rc renamed to telnet.cfg -2. I change syntax of 'keys' command (but I did'nt found a tool for edit - msg*.bin files - so it's remain unchanged). Syntax are - - keys load keymapname [file] - keys display - keys switch number - - -I fix some 'political' ;) problem with charmap, now we (citizens of xUSSR) -have koi8, koi8r and koi8u(RFC on draft) on UNIX, wich are diff's on 6 or -8 letters; cp866 and many (3 or 4) very near to cp866 on DOS. - -So, I rewrite code to able a charmap addition like a keymap done. - -And I make more smart command line processing, look at telCommandLine(). - -And last: my english is not so good :( to rewrite documentation, but there are -things, wich would be described - look on next page. I think that you will -translate my english to more understable, ok? - -and now is a list of files, wich I touch - - - old new - -ANSIPRSR.CPP 32763 05.10.97 11:09 33237 24.12.97 17:42 -ANSIPRSR.H 3311 04.09.97 0:25 3410 23.12.97 13:18 -KEYTRANS.CPP 9504 28.05.97 22:43 26547 03.02.98 21:33 -KEYTRANS.H 8020 25.01.97 16:06 8090 03.02.98 19:53 -TNCLASS.CPP 13663 17.08.97 23:55 13891 03.02.98 20:09 -TNCLASS.H 1112 01.06.97 14:19 1233 03.02.98 20:09 -TNMAIN.CPP 12668 02.10.97 20:38 16610 03.02.98 21:22 -TNNET.CPP 3445 01.06.97 14:21 3474 23.12.97 13:16 -TNPARSER.CPP 17653 05.10.97 11:09 17715 23.12.97 18:03 -TNPARSER.H 2129 01.06.97 14:22 2188 23.12.97 13:25 - -KEYS.CFG erased -TELNET.CFG new - -TELNET.IDE 65810 26.10.97 16:53 66118 03.02.98 21:34 - - -I was start my work with file telc2b4s.zip with size 132619 bytes, and now send -to you just files, wich I touch. - -with best regards -Andrei V. Smilianets - -smile@head.aval.kiev.ua -22:25 03 Feb 1998 - - - -There are all of my changes (from 2.04b), wich have to be described: - -1. command line (telnet>) processing - - a 'keys' command - - was - keys keymapname [file] - new - keys load keymapname [file] // mean unchanged - keys display // display a list of loaded keymaps - keys switch number // switch to keymap - - more smart command processing - - command might be writed shortly - - cl[ose] - op[en] - ke[ys] - qu[it] - - subcommands of 'keys' - - l[oad] - d[isplay] - s[witch] - - synonym of '?' -> h[elp] - -2. file 'keys.cfg' renamed to 'telnet.cfg' - -3. Added codepage conversion, look [charmap] - -4. completely changed conception of telnet.cfg - - Now you can define multiple keymaps, character maps, combine it in your - ways. - - file is splitted into following sections: - - [COMMENT] - ... - [END COMMENT] - - it is for comment a big part of text. can be nested. - in text also work: - - ; - first printable character in line, which is completelly - ignored. - // - like C++ comment - - [GLOBAL] - ... - [END GLOBAL] - - mean of [global] unchanged - - [KEYMAP name] - ... - [END KEYMAP] - 'name' - is a keymap name for reference. in 'name' you can use - any char exept spaces, '+', ':' and ']'. '+' and ':' reserved for - CONFIG section. - body is a sequence of key definition: - - [keymodifier[+keymodifier[+...]]] - - example: - VK_F1 RIGHT_ALT+RIGHT_CTRL this_would_print - - vk_name is an ASCII string equivalent to an entry in [GLOBAL]. - - valid keymodifiers are: - RIGHT_ALT - LEFT_ALT - RIGHT_CTRL - LEFT_CTRL - SHIFT - ENHANCED - - Undefined enhanced keys will use the non-enhanced definition. - - keytranslation is the string you want printed for the key. - The notation ^[ can be used to denote an escape character. - Any ASCII value can be represented by - - \nnn where nnn is a 3 digit decimal ASCII value or - \xhh where hh is a 2 digit hexadecimal ASCII value. - - Leading zeros may not be omitted. - A value of \000(\x00) will not be transmitted. - - note: In order to have both left and right alt have the same - action, you must create a separate def for left and right. - - - [CHARMAP name] - ... - [END CHARMAP] - 'name' - is a charmap name for reference. requirements is the same - as for keymap name. - body is a sequence of char conversion definition: - - - - where host_char is a char received from host, and console_char - is a char, which would be displayed on console. - - The main purpose of it is a conversion between differents code - pages, for example, on former USSR part of world most unix's hosts - uses 'koi8' code page, and on W95 machines - 866 code page and - (as say I.Ioannou) Greece has the same problem with 737 and 928 - code-pages. - - - Any ASCII value can be represented by - - \nnn where nnn is a 3 digit decimal ASCII value or - \xhh where hh is a 2 digit hexadecimal ASCII value. - - Leading zeros may be omitted. - A value of \000(\x00) will not be accepted. - - look for example at [charmap koi8-cp866]. - - [CONFIG name] - ... - [END CONFIG] - 'name' - is a configuration name for reference. requirements is - the same as for keymap name. - - you must define one with name 'default', which will be used as - default. - - in body of this part you can combine keymaps and set charmap, - format is: - - KEYMAP name_list [: [keymodifier[+keymodifier[+...]]] ] - - where - name_list: - keymap_name - keymap_name '+' name_list - - keymap_name is a name of [KEYMAP] - - You can specify multiple keymaps, for first (mean default) - you can not define ': ...' part, but for rests - (secondary) you must! - The ': ...' part define a key for switch to this - keymap. - - Assigning a switching key to first (default) keymap will be - ignored, but you can switch to by pressing second time switch - key of current keymap. - - If a key not found in switched keymap, a program will be look - for it in default keymap. So, you can redefine only needed keys - in secondary keymaps. - - CHARMAP name_list - - where - name_list: - charmap_name - charmap_name '+' name_list - - charmap_name is a name of [CHARMAP] - - - define wich charmap(s) is to use. - - examples: - [config default] - keymap default - [end config] - - [config linux] - keymap default + linux - [end config] - - [config default_koi8] - keymap default - keymap koi8u + koi8r : VK_/ RIGHT_ALT // russian keyboard - keymap koi8u : VK_. RIGHT_ALT // ukranian - - charmap koi8-cp866 - [end config] - - [config linux_koi8] - keymap default + linux - keymap koi8u + koi8r : VK_/ RIGHT_ALT // russian keyboard - keymap koi8u : VK_. RIGHT_ALT // ukranian - - charmap koi8-cp866 + koi8u-cp866 - [end config] - - so, for switch to russian keyboard just press RIGHT_ALT and '/'. - and, for switch back to default press it again. - - diff --git a/rosapps/net/telnet/doc/bugs.txt b/rosapps/net/telnet/doc/bugs.txt deleted file mode 100644 index 52e1794a7ab..00000000000 --- a/rosapps/net/telnet/doc/bugs.txt +++ /dev/null @@ -1,24 +0,0 @@ - ********************************************** - *** Console Telnet 2.1 beta 2. Known Bugs *** - ********************************************** - - -Wrap_Line = 0 Doesn't work very well. It works with elvis or talk on linux, - but messes up bash at last line. - -Enable_Mouse=1 Causes the display to slow in fullscreen mode, since the - mouse has to be erased and then drawn again for every - screen write. - -Term_Width or Term_Height != -1 or Wide_Enable=1 - Specifying any of these can cause display problems if - the font size is not set to auto. - -Resizing the current window while running telnet can cause problems, especially -if doing so makes the buffer smaller. This should be more of a problem on -NT/W2K than on 95/98. Part of the problem is that the telnet NAWS option -negotiation isn't done properly. On a related note, turning on scrollbars can -decrease performance. - -There are many other bugs, most of which are documented in the code. Just -grep the source for "FIX ME". diff --git a/rosapps/net/telnet/doc/changes.txt b/rosapps/net/telnet/doc/changes.txt deleted file mode 100644 index 4e03d4736c6..00000000000 --- a/rosapps/net/telnet/doc/changes.txt +++ /dev/null @@ -1,239 +0,0 @@ - ********************************************** - *** Console Telnet version 2.1 Change log *** - ********************************************** - -Version 2.1b2 -- October 16, 2000 - Redirection fix (Mark Miesfield) - Allow "o" to open a connecton on the command line - Fixed problem with special keys (ALt-[, Alt-], Alt-\, etc.) - Added MTE Support (Ziglio Frediano) - Speed improvements in ttelhndl.cpp -- may be buggy? - Wrap_line option is now modifiable via telnet command line - Lock_linewrap option added - Cleaned up console code - Fixed some color issues with nonstandard consoles - Tab setting/resetting - Fixed "telnet.exe" installer problem - Fixed miscellaneous parsing bugs - Fixed vt100-compliance - Added NAWS support, but it doesn't work (RFC 1073) - Added X Display Location support (RFC 1096) - -Version 2.1b1 -- April 5, 2000 --Bugfixes - Console code writes to bottom of buffer (W2K scrollback buffer now works) - Updated Winsock error messages (Craig Nellist) - Sleeping while thread paused, to give up CPU time (Craig Nellist) - Ctrl_Break_as_C now works properly - Restore original screen colors; use initial screen colors as default - --New features - Cursor size sequences (Jose Cesar Otero Ridriguez) - Network piping - Line mode support added - Support for telnet:// URLs - Command-line history (Craig Nellist) - Connection Aliases - --Translator updates - New code structure - Unified character map class - More configurable "special" keys: - tn_escape, tn_scrollback, tn_dial, tn_paste, tn_null, tn_cr, tn_crlf - Transmission of NUL character possible - Czech keyboard definition (Jakub Sterba) - --New INI options - Window_Width, Window_Height - Scriptname (not functional), Script_Enable (not functional) - Netpipe (functional), Iopipe (not functional) - -Version 2.0 -- July 5, 1999 --Bugfixes - Save/restore console title, character mapping fix (Pedro Gutierrez) - Telnet prompt fix, suspend telnet, string-based port (Craig Davidson) - Mutt/Lynx colors/underline fix, repeat character fix - Color display problem fixed (I.Ioannou) - Newline properly handled, added APP4_KEY, better key translation - Problem with icons not displaying properly fixed - Small bug with telnet crashing at exit (Sam Robertson, Daniel Straub) - Bug getting name of executable (Thomas Briggs) - --Updates - Better key translation - Spanish keyboard definition (Cesar Otero) - --New ini options - Set_Title (Adi Seiker) - Scroll_Enable/Scroll_Size - CtrlBreak_as_CtrlC (Bryan Montgomery) - Clear_on_Tabset removed - -Version 2.0b7.1 -- Dec. 5, 1998 --Minor changes - Fixed problems with Scrollback and Clipboard - Minor updates to terminal emulation - Keyboard init improvements (Vassili Bourdo) - Repeat sequence support, German key config (Titus von Boxberg) - -Version 2.0b7 -- Oct. 21, 1988 --To do still: - ZModem support - Update key translator/character maps - Finish scrollback - --Changes - Options added: Term_Width, Term_Height, Wide_Enable, Buffer_Size, Dial_key, - Keyboard_Paste, Status_bg, Status_fg, Input_Redir, Output_Redir - - Application keypad mode support - Numlock/scroll lock support in KEYS.CFG - Del/. key now works properly - Ctrl-break bugfixes (Thomas Briggs) - - Added suspend and fast quit to the command line (Thomas Briggs) - Error message for unable to load ini file (Thomas Briggs) - Fixed TELNET_INI environment variable (BK Oxley) - - Support for changing screen size - Support for switching to 132-column mode via ANSI sequences - - Fixed minor memory leaks - Mouse speedups/bugfixes, scrolling speedups/bugfixes - Miscellaneous ANSI parser fixes - - Added support for changing the icon in the corner of the window - Fixed bug with mIRC - Fixed "try again" error message - Input and output redirection now separate (TELNET_REDIR still supported) - Modified "set" command to operate on groups - Character mapping now works again - -Version 2.0b6 28 Jul 1998 --To Do still: - ZModem support - Finish mouse support - Fix character maps - --Changes: - ANSI Parser should be almost complete - Reorganized source - Display speedups - Preliminary mouse support - Enhanced scrollback support - Miscellaneous bug fixes - -Version 2.0b5 05 Jun 1998 --Version 2b5 released from I.Ioannou --To Do Still: - Too many to mention :-) --To Do, Maybe: - Mouse cut/paste support. - Support secure telnet options. - Real blinking attributes. - Zmodem & Kermit DL Protocols. - Any ideas acceptable :-) - - -May 1998 --Changes - Paul Brannan add telnet.ini code - improve telnet's speed, add some VT emulation, port telnet to - MSVC, rewrote the command line options processing with GNU getopt, - fix many bugs, and more. Good work Paul :-) - I.Ioannou . A few bugs fixes, and a icon. - Also I convert tnmsg files to use a resource compiler. - -December 1997 --Changes - Andrey V. Smilianets (smile@head.aval.kiev.ua) - rewrote the keys translator to support many different - keymaps, charmaps and configurations. - Also add editing support to telnet> prompt. - - -Version 2.0b4 10/6/97 --Updated by Brad Johnson who can be contacted at - http://nounname.com --Changes - Added command line history at the telnet> prompt. - Added ability to "unmap" a key by setting it equal to \000 in the key.cfg. - Added log-file option '-dFILENAME'. - Added print screen/line commands by I.Ioannou . - Added Support for running in an emacs buffer . - Added better support for international character sets - . --To Do Still: - Support for local echo. - Scrollback buffer. - Fix Scrolling bug. --To Do, Maybe: - Change the telnet options to initiate the negotiation. - Mouse cut/paste support. - Support secure telnet options. - Real blinking attributes. - Zmodem & Kermit DL Protocols. - -Version 2.0b3 12/25/96: --Updated by Brad Johnson who can be contacted at - http://nounname.com --Changes - Screen colors and buffer settings are now preserved on exit. - Fixed WindowSize height/width 255 exception :-). - Found out that the paste problem is a bug in Win 95 (not my problem)! - Fixed screen buffer problems under NT when the window - was smaller than the buffer. - Added custom key maps by I.Ioannou . --To Do Still: - Fix advance to next line error when writing past column - Extend NAWS window negotiation to include buffer size changes. - Change the telnet options to initiate the negotiation. - Add print screen/line commands. --To Do, Maybe: - Support for running in an emacs buffer. - Mouse cut/paste support. - Support secure telnet options. - Real blinking attributes. - Zmodem & Kermit DL Protocols. - -Version 2.0b2 09/29/96: --Updated by Brad Johnson who can be contacted at - http://nounname.com --Changes - Added code to move cursor to end of screen and reset attributes on close - Fixed potential IAC parsing problem - Fixed ClearScreen Last line problem - Fixed parse problem that prevented line clears on unix history - Changed scroll code to scroll the entire buffer - Removed destructive backspace. May cause problems with terminals that want - destructive backspaces. - Added binary telnet option to use 8bit. --To Do Next - Paste still doesn't work! - -Version 2.0b1 09/22/96: --Updated by Brad Johnson who can be contacted at - http://nounname.com --Changes - Added Color ANSI support. It works! - Added option for user specified port addresses on the command line. - Added ANSI keyboard mapping support for cursor keys. - Added destructive Backspace. - Added escape key 'ALT-]'. - Added TermType and WindowSize telnet options. - Added/Fixed various other ANSI codes. - Now (I hope) all ANSI codes handled correctly! - Fixed cursor left/right/save/restore commands. - Fixed clear line and clear screen command. - Expanded and altered network buffer to prevent some lockups :-). - Added Unix style telnet prompt "telnet>" with options. --To Do Next - Should parse for IAC separate from ANSI. - -Version 1.0a: -- This release fixes a bug which caused it to hang when connecting to - UNIX boxes. The program simply ignored Telnet DO instead of replying - with WON'T as required by RFC 854. - -Version 1.0: -- First release diff --git a/rosapps/net/telnet/doc/license.txt b/rosapps/net/telnet/doc/license.txt deleted file mode 100644 index 3358a7be862..00000000000 --- a/rosapps/net/telnet/doc/license.txt +++ /dev/null @@ -1,340 +0,0 @@ - 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/rosapps/net/telnet/doc/options.txt b/rosapps/net/telnet/doc/options.txt deleted file mode 100644 index fefd1541992..00000000000 --- a/rosapps/net/telnet/doc/options.txt +++ /dev/null @@ -1,187 +0,0 @@ -This file describes all the environment variables and options that are -available in TELNET.INI. If you are having problems with a terminal setting, -this is the file you want to read first. If this file does not help you, -please send a bug report to Paul Brannan . - -Environment variables ---------------------- - -Before there was a telnet.ini file, all the options were controlled -through environment variables. These have been left in for compatibility -with previous versions, and for specifying locations of files. They -override any values in telnet.ini. - -TELNET_CFG Specifies the location of the keys.cfg file -TELNET_REDIR Specifies whether file redirection needs to be supported -INPUT_REDIR Specicies only to redirect input -OUTPUT_REDIR Specifies only to redirect output -TELNET_INI Specifies the location of the telnet.ini file - -Configuration options ---------------------- - -These are the options that you can specify in telnet.ini. This file is in -the same format as any normal Windows ini file. You can also change some -of these options using the SET command at the telnet> prompt. - -[Terminal] section - -Dumpfile -Specifies the filename of a file to dump output to. (Default = "") - -Term -The name of the terminal type to send to the server. You -can use this if Telnet is sending "ANSI" but you have a -vt100 terminal. If you use this options, please read about -some of the other options below. (Default = ansi) - -EightBit_Ansi -Some machines use the ASCII characters 128 to 155 for ANSI -sequences. These are usually the newer VAX systems. Turning -this option on may cause problems with certain foreign -(non-American) character sets. (Default = FALSE) - -VT100_Mode -This option turns on VT100 mode. There are a few minor -differences between ANSI terminals and DEC VT100 terminals. -I recommend trying TERM=vt220 or TERM=vt102 before trying -this option, but if you must have true VT100 emulation, -this is the only way to get it. (Default = FALSE) - -Destructive_Backspace -This will probably cause problems with most programs, but if you need the -backspace to erase the previous character (as with some BBSes), use this -option. (Default = FALSE) - -Speaker_Beep -If you set this to true you will hear beeps through the PC speaker; setting -it to false will play the default system beep sound through your sound -card. (Default = TRUE) - -Beep -Setting this to false turns off all beeps; setting this to true turns on -all beeps. (Default = TRUE) - -Preserve_Colors -This turns on color preservation for systems that require it (like SCO). -(Default = FALSE) - -Wrap_line -This turns on/off line wrap. (Default = TRUE) - -Lock_linewrap -Turning on this option disables the ability of the remote end to control -line wrap, and "locks" it into whatever it is set to in the ini file. -(Default = FALSE) - -Fast_write -This turns on/off fast screen write. Turning it off allows you to see -control characters if your application requires it. (Default = TRUE) - -Term_width -Term_height -These options specify the size of the terminal. You can specify non-standard -sizes if you are running telnet in a window. You may want to specify -a font size if you use these (using "Auto" can cause display problems). -Specifying -1 means use the settings for the parent console. -(Default = -1, -1) - -Wide_enable -This is to allow the ANSI parser to change the screen size when sent certain -escape sequences. This is for vt100 compatibility. (Default = FALSE) - -Buffer_size -This is the size of the ANSI buffer used for parsing sequences. Increasing -this value speeds up the parser, and decreasing it allows the mouse to -respond faster. (Default = 2048) - -Input_redir -Output_redir -These are for redirecting input and output. (Default = 0, 0) -Any value greater than 0 turns redir on. Turn Output_redir on to bypass -the Console Telnet screen writing and positioning functions and simply -pass the data stream as received from the host straight through. - -Strip_redir -If enabled, this option will attempt to strip the stream before passing it on -through redirected output. This will have no effect on non-redirected output. -(Default=FALSE) - -[Colors] section - -Setting the following to -1 disables them: -Blink_bg Background color to use for blink (default = -1) -Blink_fg Foreground color to use for blink (default = -1) -Underline_bg Background color to use for underline (default = -1) -Underline_fg Foreground color to use for underline (default = -1) -UlBlink_bg Background color to use for blink+uline (default = -1) -UlBlink_fg Foreground color to use for blink+uline (default = -1) - -Setting the following to -1 uses colors detected at startup: -Normal_bg Normal text background color (default = -1) -Normal_fg Normal text foreground color (default = -1) - -Please do not set these values to -1: -Scroll_bg Background color for scrollback mode (default = 0) -Scroll_fg Foreground color for scrollback mode (default = 7) -Status_bg Bg color of status line in scrollback (default = 1) -Status_fg Fg color of status line in scrollback (default = 15) - -Here's a list of colors: -0 - black, 1 - blue, 2 - green, 3 - cyan, 4 - red, 5 - magenta, 6 - brown -7 - lt. grey (dk. white), 8 - dk. grey, 9 - bright blue, 10 - bright green, -11 - bright cyan, 12 - bright red, 13 - bright magenta, 14 - yellow -15 - bright white - -[Mouse] section - -Enable_Mouse -Turns on mouse support. (Default = TRUE) - -[Printer] section - -Printer_Name -The DOS name for the printer. (Default = LPT1) - -[Keyboard] section -Many of these options are also available from telnet.cfg. - -Escape_key -The key to break out of a telnet session. (Default = ]) - -Scrollback_key -The key for switching to scrollback mode. (Default = [) - -Dial_key -You can start a new telnet session with this key. (Default = \) - -Alt_erase -If you set this to true, it will swap backspace and delete. -(Default = FALSE) - -Keyboard_paste -This option allows pasting to the screen via shift-insert. (Default = FALSE) - -Keyfile -Selects an alternate telnet.cfg file. (Default = TELNET.CFG) - -Default_Config -Selects a different keyboard definition. All of these are defined in -telnet.cfg. - -[Scrollback] section - -Scroll_Mode -Selects the default mode for scrollback. Valid selections are: - HEX Hex dump - DUMP Dump, control characters are shown as "." - DUMPB Binary dump - TEXT Text mode -Note: you can press TAB in scrollback mode to cycle through these. -(Default = DUMP) - -Command-line Options --------------------- - --d Specifies the name of the dumpfile. --h Gives a help screen. diff --git a/rosapps/net/telnet/doc/readme.txt b/rosapps/net/telnet/doc/readme.txt deleted file mode 100644 index abebe341520..00000000000 --- a/rosapps/net/telnet/doc/readme.txt +++ /dev/null @@ -1,280 +0,0 @@ - ************************************************** - ** Console Telnet v2.1b2 README.TXT 16 Oct 2000 ** - ************************************************** - - RELEASE NOTES: - -------------- - -This release of TELNET is a beta one. This means that it is working as far -as it is tested, and has a few bugs. Hopefully this will be a stable -version. Please send comments and bug reports to me at -pbranna@clemson.edu, or to the mailing list (see below). See file -CHANGES.TXT for a detailed log of changes. See file BUGS.TXT for known -bugs. - - DESCRIPTION: - ------------ - -This is a telnet client with full color ANSI support for Windows NT/95 -console. You can use this program from the Win95 command line (MsDos) and -run it in full screen text mode. You may also redirect the telnet session -to STDIN and STDOUT for use with other programs. Telnet will communicate -the number of lines and rows to the host, and can operate in any console -mode. Most of it's options are customizable. - - - COPYRIGHT/LICENSE/WARRANTY - -------------------------- - -Telnet Win32, Copyright (C) 1996-1997, Brad Johnson -Copyright (C) 1998 I.Ioannou, Copyright (C) 1999-2000 Paul Brannan. Telnet -is a free project released under the GNU public license. This program comes -with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome -to redistribute it under the licence contitions. See LICENSE.TXT for -details. - - REQUIREMENTS: - ------------- - -This program requires a Microsoft Win32 enviroment (Windows 95/98/NT) with -Winsock TCP/IP. 16 bit Win3.x or Win32s are not supported. - - FEATURES: - --------- - -Full ANSI colors and (almost) complete ANSI emulation. -User configurable options via telnet.ini. -User configurable key bindings with alternative keyboards. -Icoming character translations. -Redirection of telnet session. -Telnet output can be dumped to a file. -Local printer support. -Basic scrollback support. -Basic VT emulation. -Mouse support. -Clipboard (cut-and-paste) support. -Support for multiple screen sizes. - - WHERE TO GET IT: - ---------------- - -Since version 2.0, Console Telnet's new home page is -http://www.musc.edu/~brannanp/telnet/. You can get the latest version from -ftp://argeas.cs-net.gr/Telnet-Win32 or from the web page. Telnet is -available as full project (sources included) or as binaries only. If you -would like to help to the development check the /devel directory on the ftp -site for a recent alpha version. - - MAILING LIST: - ------------- - -Telnet has it's own mailing list for announcements, bug reports, support, -suggestions etc. To subscribe send e-mail to majordomo@argeas.cs-net.gr -with empty Subject, and the word subscribe in the body. List's address is -telnet-win32@argeas.cs-net.gr You can find the old archives at -http://www.cs-net.gr/lists - -If you are only interested in announcements, follow the above procedures to -subscribe to telnet-win32-announce. The development list is -telnet-win32-devel. - - HOW TO HELP: - ------------ - -Telnet is a free project made from volunteers. If you know C/C++ and would -like to help in the development you are welcome :-) Just contact -pbranna@clemson.edu, and/or subscribe to the mailing list. Check -ftp://argeas.cs-net.gr/Telnet-Win32/devel for a recent alpha version. - - - INSTALLATION - ------------ - -Just copy telnet.exe, telnet.ico, telnet.ini and keys.cfg to a directory. -I prefer a directory included in the PATH (such as C:\WINDOWS, but this will -overwrite the telnet that comes with Windows -- which is not necessarily a -bad thing). If you are upgrading from a previous version please look below -(Key file definitions) : the keys.cfg file has changed a bit. Also look at -the Configuration section below, TELNET now has a ini file. - - USAGE: - ------- - - TELNET - Begins telnet and enters telnet> command line. - - TELNET [params][host [port]] - Connects to port on host. Port defaults to 23 for TELNET. - - params -d FILENAME.EXT Dumps all incoming data to FILENAME.EXT - Note lowercase 'd'. - --variable=value Overrides ini variable to be set to value. - - host Host name or IP to connect to - port Service port to open connection on - (default is telnet port 23). - - TELNET -? - Gives usage information. - -Pressing the escape key (default ALT-]) will break out of a telnet session and -return you to the telnet> prompt. Pressing return will resume your session. -All the options are available from the telnet> prompt. Type ? to get help. - -Pressing the scrollback key (default ALT-[) will give you a basic scrollback -view. Pressing ESC will resume your session. - - BUGS: - ----- - -There are :-). Hopefully this version is more stable than the previous. See -BUGS.TXT, and grep for FIX ME's in the sources. Any help ? - - NOTES: - ------ - -If the environment variable LANG has a valid value (e.g. LANG=de for German -characters) and the file LOCALE.DLL is installed somewhere along the PATH -TELNET will not ignore local characters. - -If you have problems with paste under Win 95 try unchecking the fast paste -option in the MsDos properties. The paste function works correctly under NT. -This is a Microsoft bug :-) - - CONFIGURATION - ------------- - -The configuration is made through telnet.ini and keys.cfg. These files (at -least telnet.ini) must be in the same directory which telnet.exe is. The -basic options are loaded from the file telnet.ini. If you are having problems -with a terminal setting, check the file OPTIONS.TXT for configuration -information. - - -Key file definitions (telnet.cfg) -------------------------------- - -Use the key file (telnet.cfg) to define the characters that telnet is sending -to the host. From version 2b5 you can configure the output keys (KEYMAP -sections), the input character translations (CHARMAP sections) and you can -combine all to as many configurations as you like (CONFIG sections). You -can also have alternative keymaps in a configuration, and keys to switch -between them. See the comments in keys.cfg for details. - -NOTE: if you are upgrading from a previous version you must put your old keys -in the KEYMAP sections. -Please send any national specific keymaps / charmaps / configurations to be -included to the next version. - - - HOW TO COMPILE IT - ------------------- - -Telnet compiles with a variety of compilers. You will need at least -Borland 4.x or newer compiler, or MSVC 2.0 or newer, or download a version -of gcc for Win32 (see http://www.musc.edu/~brannanp/telnet/gccwin32.html). -Copy the files from the directories BORLAND or MSVC to the main directory, -change them to fit to your system, and recompile. The project comes with -IDE files and makefiles. - -Follow the instructions for your compiler to compile telnet. A Makefile -for use with mingw32 or other gcc variants has been included, so if you have -gcc, you can just type "make" at the command line. - - SPECIAL THANKS: - --------------- - -Many people have worked for this project. Please forgive me (and let me -know!) if I have forgotten anyone. We all thank them :-) - -Igor Milavec - Original Author of version 1.1 - Igor wrote the basic telnet program and released it to public. - -Brad Johnson http://nounname.com - Author of versions 2.0b to 2b4. Brad has wrote plenty of code for - telnet like ansi colors, emulation, scrollback option, and many - others. - -Titus_Boxberg@public.uni-hamburg.de - Ansi emulation improvements - German keyboard configuration - -I.Ioannou roryt@hol.gr - KeyTranslator class (version 2b3) - Maintainer (since version 2b5) - -Andrei V. Smilianets (version 2b5) - KeyTranslator class (version 2b5) - Prompt improvments - -Paul Brannan - Telnet.ini author, MSVC port, speed improvements, VT support, - and many others. - Maintainer (since version 2b6) - -Leo Leibovici - Fixed some crashes in the ANSI parser - Wrote UK keymap - -Dmitry Lapenkov - Wrote AT386 keymaps - Improved telnet icon - -Thomas Briggs - Fixed problem with Ctrl-Break - Added suspend and fast quit options to the command line - Error messages for unable to load ini file - Fixed bug w/ getting name of executable - -BK Oxley - Fixed TELNET_INI environment variable - -Sam Robertson - Fixed compilation problems with MSVC6 - Bugfix with telnet crashing at exit - -Vassili Bourdo - Keyboard initialization improvements - -Craig Davidson - Bugfixes for telnet prompt - Added suspend telnet option - Set port number using name rather than number - -Pedro Gutierrez - Save/restore console title - Bugfix w/ character mapping - -Daniel Straub - Bugfix with telnet crashing at exit - -Jose Cesar Otero Rodriguez - Spanish Keyboard definition - Cursor size sequences - -Bryan Montgomery - Added CtrlBreak_as_CtrlC option - Added Scroll_Enable option - -Adi Seiker - Added Set_Title ini file option - -Craig Nellist - Updated Winsock error messages - Sleeping while thread paused, to give up CPU time - Command-line history - -Jakub Sterba - Czech keyboard definition - -Ziglio Frediano - MTE (Meridian Terminal) Support - -Mark Miesfield - Fixed redirection - Wrote documentation for redirection - ---- - -Paul Brannan diff --git a/rosapps/net/telnet/doc/ssh.txt b/rosapps/net/telnet/doc/ssh.txt deleted file mode 100644 index 077d79ba394..00000000000 --- a/rosapps/net/telnet/doc/ssh.txt +++ /dev/null @@ -1,22 +0,0 @@ -It should be possible to add ssh support to console telnet, as console telnet has a very modular design when it comes to the networking code. There is already support for pipes, and if there exists an ssh client for Win32 that will output to stdout, then you're in business. I'm yet to find such a client, but if one existed, an SSH session could be started like so: - -C:\> telnet -Copyright message, license.txt, stuff, etc. -telnet> set io_netpipe "C:\BIN\SSH.EXE -l username host" -telnet> open blah -login: -password: - -Unfortunately, all the ssh clients I've found don't work this way. You can output CMD.EXE to telnet this way, though, and get a very pretty ansi interpreter. If you want to try to get OpenSSH working, here's step-by-step instructions to get you started (please read them all the way though): - -1) Get Perl from http://www.activestate.com/ActivePerl/download.htm -2) Get Openssl from http://www.openssl.org/source/ - - Follow directions in INSTALL.W32 - - Copy the .LIB files from OUT32DLL to your LIB directory (C:\DevStudio\VC\LIB) - - Copy the .DLL files from OUT32DLLto your system directory (C:\Winnt\System32 or C:\Windows\System) - - Copy the .H files from INC32\OPENSSL to your include\ssl (C:\DevStudio\VC\include\ssl) - - Copy these same files to include\openssl (C:\DevStudio\VC\include\openssl) -3) Get Openssh from http://www.openssh.com -4) Modify Openssh so it will compile, and get rid of all the termios stuff - -Obviously this is a lot of work. If you need a good ssh client, try PuTTY from http://www.chiark.greenend.org.uk/~sgtatham/putty/. It may be possible to integrate PuTTY and Telnet, and that would certainly be easier than the above option. PuTTY is licensed under the MIT license, which seems to be compatible with the GPL. The primary advantage of integrating the two projects is that PuTTY would gain the key mappings that telnet has, and telnet would gain encryption. \ No newline at end of file diff --git a/rosapps/net/telnet/resource/tnmsg.h b/rosapps/net/telnet/resource/tnmsg.h deleted file mode 100644 index b46f8cba7ee..00000000000 --- a/rosapps/net/telnet/resource/tnmsg.h +++ /dev/null @@ -1,108 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by Tnmsg.rc -// -#define MSG_COPYRIGHT 0x01 -#define MSG_COPYRIGHT_1 0x02 -#define MSG_USAGE 0x03 -#define MSG_USAGE_1 0x04 -#define MSG_HELP 0x05 -#define MSG_HELP_1 0x06 -#define MSG_INVCMD 0x07 -#define MSG_ERROR 0x08 -#define MSG_INFO 0x09 -#define MSG_WARNING 0x0a -#define MSG_TRYING 0x0b -#define MSG_CONNECTED 0x0c -#define MSG_TERMBYREM 0x0d -#define MSG_KEYMAP 0x0e -#define MSG_ERRKEYMAP 0x0f -#define MSG_DUMPFILE 0x10 -#define MSG_CONFIG 0x11 -#define MSG_NOINI 0x12 -#define MSG_BADVAL 0x13 -#define MSG_NOSPAWN 0x14 -#define MSG_RESOLVING 0x15 -#define MSG_NOSERVICE 0x16 -#define MSG_SIZEALIAS 0x17 -#define MSG_ERRPIPE 0x18 -#define MSG_BADUSAGE 0x19 -#define MSG_ALREADYCONNECTED 0x1a - -#define MSG_KEYNOVAL 1001 -#define MSG_KEYBADVAL 1002 -#define MSG_KEYBADSTRUCT 1003 -#define MSG_KEYBADCHARS 1004 -#define MSG_KEYUNEXPLINE 1005 -#define MSG_KEYUNEXPEOF 1006 -#define MSG_KEYUNEXPTOK 1007 -#define MSG_KEYUNEXPTOKIN 1008 -#define MSG_KEYUNEXP 1009 -#define MSG_KEYNOGLOBAL 1010 -#define MSG_KEYNOCONFIG 1011 -#define MSG_KEYUSECONFIG 1012 -#define MSG_KEYNOSWKEY 1013 -#define MSG_KEYCANNOTDEF 1014 -#define MSG_KEYDUPSWKEY 1015 -#define MSG_KEYUNKNOWNMAP 1016 -#define MSG_KEYNOCHARMAPS 1017 -#define MSG_KEYNOKEYMAPS 1018 -#define MSG_KEYNUMMAPS 1019 -#define MSG_KEYBADMAP 1020 -#define MSG_KEYMAPSWITCHED 1021 - -#define MSG_WSAEINTR 0x2714 -#define MSG_WSAEBADF 0x2719 -#define MSG_WSAEACCESS 0x271D -#define MSG_WSAEDEFAULT 0x271E -#define MSG_WSAEINVAL 0x2726 -#define MSG_WSAEMFILE 0x2728 -#define MSG_WSAEWOULDBLOCK 0x2733 -#define MSG_WSAEINPROGRESS 0x2734 -#define MSG_WSAEALREADY 0x2735 -#define MSG_WSAENOTSOCK 0x2736 -#define MSG_WSAEDESTADDRREQ 0x2737 -#define MSG_WSAEMSGSIZE 0x2738 -#define MSG_WSAEPROTOTYPE 0x2739 -#define MSG_WSAENOPROTOOPT 0x273A -#define MSG_WSAEPROTONOTSUPPORT 0x273B -#define MSG_WSAESOCKNOTSUPPORT 0x273C -#define MSG_WSAEOPNOTSUPP 0x273D -#define MSG_WSAEPFNOTSUPPORT 0x273E -#define MSG_WSAEAFNOTSUPPORT 0x273F -#define MSG_WSAEADDRINUSE 0x2740 -#define MSG_WSAEADDRNOTAVAIL 0x2741 -#define MSG_WSAENETDOWN 0x2742 -#define MSG_WSAENETUNREACH 0x2743 -#define MSG_WSAENETRESET 0x2744 -#define MSG_WSAECONNABORTED 0x2745 -#define MSG_WSAECONNRESET 0x2746 -#define MSG_WSAENOBUFS 0x2747 -#define MSG_WSAEISCONN 0x2748 -#define MSG_WSAENOTCONN 0x2749 -#define MSG_WSAESHUTDOWN 0x274A -#define MSG_WSAETOOMANYREFS 0x274B -#define MSG_WSAETIMEDOUT 0x274C -#define MSG_WSAECONNREFUSED 0x274D -#define MSG_WSAELOOP 0x274E -#define MSG_WSAENAMETOOLONG 0x274F -#define MSG_WSAEHOSTDOWN 0x2750 -#define MSG_WSAEHOSTUNREACH 0x2751 -#define MSG_WSAESYSNOTREADY 0x276B -#define MSG_WSAVERNOTSUPPORTED 0x276C -#define MSG_WSANOTINITIALISED 0x276D -#define MSG_WSAHOST_NOT_FOUND 0x2AF9 -#define MSG_WSATRY_AGAIN 0x2AFA -#define MSG_WSANO_RECOVERY 0x2AFB -#define MSG_WSANO_DATA 0x2AFC - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 101 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1000 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/rosapps/net/telnet/resource/tnmsg.rc b/rosapps/net/telnet/resource/tnmsg.rc deleted file mode 100644 index bb8b2fdd7bd..00000000000 --- a/rosapps/net/telnet/resource/tnmsg.rc +++ /dev/null @@ -1,107 +0,0 @@ -#include "tnmsg.h" - -LANGUAGE 0,0 - -// String Table -STRINGTABLE DISCARDABLE -BEGIN - MSG_COPYRIGHT "Telnet Win32 v2.1b2, Copyright (C) 2000 Paul Brannan \nand the team. This program comes with ABSOLUTELY NO WARRANTY; for details\nread LICENSE.TXT. " - MSG_COPYRIGHT_1 "This is free software, and you are welcome to redistribute\nit under certain conditions.\n\n" - MSG_USAGE "Usage: TELNET [params][host [port]]\n\n params\n -d:FILENAME.EXT Dumps all incoming data to FILENAME.EXT.\n host Host name or IP address of the remote host to connect to.\n" - MSG_USAGE_1 " port Service port to open (default is telnet port 23).\n\n" - MSG_HELP "Commands may be abbreviated. Commands are:\n \ncl[ose] close current connection\nop[en] connect to a site\nq[uit] exit telnet\n" - MSG_HELP_1 "ke[ys] changes/displays keymaps (write keys to see the options)\nse[t] displays/alters configuration options\nz suspend\n? h[elp] print help information\n" - MSG_INVCMD "Invalid command. Type ? for help.\n" - MSG_ERROR "%1 failed.\n" - MSG_INFO "%1\n" - MSG_WARNING "%1\n" - MSG_TRYING "Trying %1.%2.%3.%4:%5...\n" - MSG_CONNECTED "Connected to %1. Escape key is ALT-%2.\n" - MSG_TERMBYREM "Connection terminated.\n" - MSG_KEYMAP "Loading %1 from %2.\n" - MSG_ERRKEYMAP "Error loading keymap.\n" - MSG_DUMPFILE "Writing output to file %1.\n" - MSG_CONFIG "Loading configuration options from %1.\n" - MSG_NOINI "Error loading configuration file %1.\nLoading default options.\n" - MSG_BADVAL "Warning: invalid variable %1.\n" - MSG_NOSPAWN "Unable to spawn process.\n" - MSG_RESOLVING "Looking up host: %1..." - MSG_NOSERVICE "Could not find TCP service %1.\n" - MSG_SIZEALIAS "Warning: size of alias %1 is too big, ignoring.\n" - MSG_ERRPIPE "Error: unable to spawn process for pipe.\n" - MSG_BADUSAGE "Error: invalid usage of command.\n" - MSG_ALREADYCONNECTED "Already connected to %1.\n" - - MSG_WSAEINTR "Interrupted function call.\n" - MSG_WSAEBADF "WSAEBADF\n" - MSG_WSAEACCESS "Permission denied.\n" - MSG_WSAEDEFAULT "WSAEDEFAULT\n" - MSG_WSAEINVAL "Invalid argument.\n" - MSG_WSAEMFILE "Too many open files.\n" - MSG_WSAEWOULDBLOCK "Resource temporalily unavailable.\n" - MSG_WSAEINPROGRESS "Operation now in progress.\n" - MSG_WSAEALREADY "Operation already in progress.\n" - MSG_WSAENOTSOCK "Socket operation on non-socket.\n" - MSG_WSAEDESTADDRREQ "Destination address required.\n" - MSG_WSAEMSGSIZE "Message too long.\n" - MSG_WSAEPROTOTYPE "Protocol wrong type for socket.\n" - MSG_WSAENOPROTOOPT "Bad protocol option.\n" - MSG_WSAEPROTONOTSUPPORT "Protocol not supported.\n" - MSG_WSAESOCKNOTSUPPORT "Socket type not supported.\n" - MSG_WSAEOPNOTSUPP "Operation not supported.\n" - MSG_WSAEPFNOTSUPPORT "Protocol family not supported.\n" - MSG_WSAEAFNOTSUPPORT "Address family not supported by protocol family.\n" - MSG_WSAEADDRINUSE "Address already in use.\n" - MSG_WSAEADDRNOTAVAIL "Cannot assign requested address.\n" - MSG_WSAENETDOWN "Network is down.\n" - MSG_WSAENETUNREACH "Network is unreachable.\n" - MSG_WSAENETRESET "Network dropped connection on reset.\n" - MSG_WSAECONNABORTED "Software caused connection abort.\n" - MSG_WSAECONNRESET "Connection reset by peer.\n" - MSG_WSAENOBUFS "No buffer space available.\n" - MSG_WSAEISCONN "Socket is already connected.\n" - MSG_WSAENOTCONN "Socket is not connected.\n" - MSG_WSAESHUTDOWN "Cannot send after socket shutdown.\n" - MSG_WSAETOOMANYREFS "WSAETOOMANYREFS\n" - MSG_WSAETIMEDOUT "Connection timed out.\n" - MSG_WSAECONNREFUSED "Connection refused.\n" - MSG_WSAELOOP "WSAELOOP\n" - MSG_WSAENAMETOOLONG "Name too long.\n" - MSG_WSAEHOSTDOWN "Host is down.\n" - MSG_WSAEHOSTUNREACH "No route to host.\n" - MSG_WSAESYSNOTREADY "Network subsystem is unavailable.\n" - MSG_WSAVERNOTSUPPORTED "WINSOCK.DLL version out of range.\n" - MSG_WSANOTINITIALISED "Successful WSAStartup not yet performed.\n" - MSG_WSAHOST_NOT_FOUND "Host not found.\n" - MSG_WSATRY_AGAIN "Non-authoritative host not found.\n" - MSG_WSANO_RECOVERY "This is a non-recoverable error.\n" - MSG_WSANO_DATA "Valid name, no data record of requested type.\n" - - MSG_KEYNOVAL "[GLOBAL]: No value for %1.\n" - MSG_KEYBADVAL "[GLOBAL]: Bad value for %1.\n" - MSG_KEYBADSTRUCT "%1: Bad structure.\n" - MSG_KEYBADCHARS "%1: Bad chars? %1 -> %3.\n" - MSG_KEYUNEXPLINE "Unexpected line ""%1"".\n" - MSG_KEYUNEXPEOF "Unexpended end of file.\n" - MSG_KEYUNEXPTOK "Unexpected token %1.\n" - MSG_KEYUNEXPTOKIN "Unexpected token in %1.\n" - MSG_KEYUNEXP "Unexpected end of file or token.\n" - MSG_KEYNOGLOBAL "No [GLOBAL] definition!\n" - MSG_KEYNOCONFIG "No [CONFIG %1].\n" - MSG_KEYUSECONFIG "Use configuration: %1.\n" - MSG_KEYNOSWKEY "No switch key for ""%1"".\n" - MSG_KEYCANNOTDEF "You cannot define switch key for default keymap - ignored.\n" - MSG_KEYDUPSWKEY "Duplicate switching key.\n" - MSG_KEYUNKNOWNMAP "Unknown keymap %1.\n" - MSG_KEYNOCHARMAPS "No charmaps loaded.\n" - MSG_KEYNOKEYMAPS "No keymaps loaded.\n" - MSG_KEYNUMMAPS "There are %1 maps.\n" - MSG_KEYBADMAP "Bad keymap number - try 'keys display'\n" - MSG_KEYMAPSWITCHED "keymap switched.\n" -END - -#if defined(__MINGW32__) || defined(__CYGWIN__) -TelnetIcon ICON "telnet.ico" -#else -TelnetIcon ICON "../telnet.ico" -#endif diff --git a/rosapps/net/telnet/src/.cvsignore b/rosapps/net/telnet/src/.cvsignore deleted file mode 100644 index 954ada33419..00000000000 --- a/rosapps/net/telnet/src/.cvsignore +++ /dev/null @@ -1,17 +0,0 @@ -*.sys -*.exe -*.dll -*.cpl -*.a -*.o -*.d -*.coff -*.dsp -*.dsw -*.aps -*.ncb -*.opt -*.sym -*.plg -*.bak -*.map diff --git a/rosapps/net/telnet/src/ansiprsr.cpp b/rosapps/net/telnet/src/ansiprsr.cpp deleted file mode 100644 index 62801477181..00000000000 --- a/rosapps/net/telnet/src/ansiprsr.cpp +++ /dev/null @@ -1,1474 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -//Telnet Win32 : an ANSI telnet client. -//Copyright (C) 1998-2000 Paul Brannan -//Copyright (C) 1998 I.Ioannou -//Copyright (C) 1997 Brad Johnson -// -//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. -// -//I.Ioannou -//roryt@hol.gr -// -/////////////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// -// Module: ansiprsr.cpp -// -// Contents: ANSI parser base class -// -// Product: telnet -// -// Revisions: August 30, 1998 Paul Brannan -// July 29, 1998 pbranna@clemson.edu -// June 15, 1998 pbranna@clemson.edu -// May 19, 1998 pbranna@clemson.edu -// 24 Dec, 1997 Andrey.V.Smilianets -// 05. Sep.1997 roryt@hol.gr (I.Ioannou) -// 11.May.1997 roryt@hol.gr (I.Ioannou) -// 6.April.1997 roryt@hol.gr (I.Ioannou) -// 5.April.1997 jbj@nounname.com -// 30.M„rz.1997 Titus_Boxberg@public.uni-hamburg.de -// 14.Sept.1996 jbj@nounname.com -// Version 2.0 -// -// 13.Jul.1995 igor.milavec@uni-lj.si -// Original code -// -/////////////////////////////////////////////////////////////////////////////// - -#include -#include -#include "ansiprsr.h" - -// The constructor now takes different arguments and initializes different -// variables (Paul Brannan 6/15/98) -TANSIParser::TANSIParser(TConsole &RefConsole, KeyTranslator &RefKeyTrans, - TScroller &RefScroller, TNetwork &RefNetwork, - TCharmap &RefCharmap): -TParser(RefConsole, RefKeyTrans, RefScroller, RefNetwork, RefCharmap) { - Init(); - iSavedAttributes = (unsigned char) 7; - // must also check to make sure the string is non-NULL - // (Paul Brannan 5/8/98) - if ((ini.get_dumpfile() != NULL) && (*ini.get_dumpfile() != '\0')){ - dumpfile = fopen(ini.get_dumpfile(), "wb"); - }else { - dumpfile = NULL; - } - InPrintMode = 0; - printfile = NULL; - - fast_write = ini.get_fast_write(); // Paul Brannan 6/28/98 - Scroller.init(&StripBuffer); -} - -TANSIParser::~TANSIParser(){ - if (dumpfile) fclose (dumpfile); - // Added I.Ioannou 06 April, 1997 - if (printfile != NULL) fclose (printfile); -} - -// Created Init() function to initialize the parser but not clear the screen -// (Paul Brannan 9/23/98) -void TANSIParser::Init() { - // Paul Brannan 6/25/98 - map_G0 = 'B'; map_G1 = 'B'; - Charmap.setmap(map_G0); - current_map = 'B'; - - ignore_margins = 0; - vt52_mode = 0; - print_ctrl = 0; - newline_mode = false; - - KeyTrans.clear_ext_mode(); - - iSavedCurY = 0; // Reset Variables - iSavedCurX = 0; - inGraphMode = 0; - Console.SetScroll(-1, -1); - Console.Normal(); // Reset Attributes - - // Set tabs stops - resetTabStops(); -} - -void TANSIParser::ResetTerminal() { - Init(); - Console.ClearScreen(); // Clear Screen - Console.SetRawCursorPosition(0,0); // Home Cursor -} -void TANSIParser::SaveCurY(int iY){ - iSavedCurY=iY; -} - -void TANSIParser::SaveCurX(int iX){ - iSavedCurX=iX; -} - -void TANSIParser::resetTabStops() { - for(int j = 0; j < MAX_TAB_POSITIONS; j++) { - tab_stops[j] = 8 + j - (j%8); - } -} - -void TANSIParser::ConSetAttribute(unsigned char TextAttrib){ - // Paul Brannan 5/8/98 - // Made this go a little bit faster by changing from switch{} to an array - // for the colors - if(TextAttrib >= 30) { - if(TextAttrib <= 37) { - Console.SetForeground(ANSIColors[TextAttrib-30]); - return; - } else if((TextAttrib >= 40) && (TextAttrib <= 47)) { - Console.SetBackground(ANSIColors[TextAttrib-40]); - return; - } - } - - switch (TextAttrib){ - // Text Attributes - case 0: Console.Normal(); break; // Normal video - case 1: Console.HighVideo(); break; // High video - case 2: Console.LowVideo(); break; // Low video - case 4: Console.UnderlineOn(); break; // Underline on (I.Ioannou) - case 5: Console.BlinkOn(); break; // Blink video - // Corrected by I.Ioannou 11 May, 1997 - case 7: Console.ReverseOn(); break; // Reverse video - case 8: break; // hidden - // All from 10 thru 27 are hacked from linux kernel - // I.Ioannou 06 April, 1997 - case 10: - // I.Ioannou 04 Sep 1997 turn on/off high bit - inGraphMode = 0; - print_ctrl = 0; - Charmap.setmap(current_map ? map_G1:map_G0); // Paul Brannan 6/25/98 - break; // ANSI X3.64-1979 (SCO-ish?) - // Select primary font, - // don't display control chars - // if defined, don't set - // bit 8 on output (normal) - case 11: - inGraphMode = 0; - print_ctrl = 1; - Charmap.setmap(0); // Paul Brannan 6/25/98 - break; // ANSI X3.64-1979 (SCO-ish?) - // Select first alternate font, - // let chars < 32 be displayed - // as ROM chars - case 12: - inGraphMode = 1; - print_ctrl = 1; - Charmap.setmap(0); // Paul Brannan 6/25/98 - break; // ANSI X3.64-1979 (SCO-ish?) - // Select second alternate font, - // toggle high bit before - // displaying as ROM char. - - case 21: // not really Low video - case 22: Console.LowVideo(); break; // but this works good also - case 24: Console.UnderlineOff(); break; // Underline off - case 25: Console.BlinkOff(); break; // blink off - // Corrected by I.Ioannou 11 May, 1997 - case 27: Console.ReverseOff(); break; //Reverse video off - - // Mutt needs this (Paul Brannan, Peter Jordan 12/31/98) - // This is from the Linux kernel source - case 38: /* ANSI X3.64-1979 (SCO-ish?) - * Enables underscore, white foreground - * with white underscore (Linux - use - * default foreground). - */ - Console.UnderlineOn(); - Console.SetForeground(ini.get_normal_fg()); - break; - case 39: /* ANSI X3.64-1979 (SCO-ish?) - * Disable underline option. - * Reset colour to default? It did this - * before... - */ - Console.UnderlineOff(); - Console.SetForeground(ini.get_normal_fg()); - break; - case 49: - Console.SetBackground(ini.get_normal_bg()); - break; - - } -} - -void TANSIParser::ConSetCursorPos(int x, int y) { - if(ignore_margins) - Console.SetRawCursorPosition(x, y); - else - Console.SetCursorPosition(x, y); -} - -char* TANSIParser::GetTerminalID() -{ - return "\033[?1;2c"; -} - -// All of the Telnet protocol stuff has been moved to TTelHndl.cpp -// This is more consistent with what OO should be -// (Paul Brannan 6/15/98) - -#ifdef __BORLANDC__ -// argsused doesn't work on MSVC++ -#pragma argsused -#endif - -// Use this for the VT100 flags (Paul Brannan 12/2/98) -#define FLAG_DOLLAR 0x0001 -#define FLAG_QMARK 0x0002 -#define FLAG_GREATER 0x0004 -#define FLAG_LESS 0x0008 -#define FLAG_EXCLAM 0x0010 -#define FLAG_AMPERSAND 0x0020 -#define FLAG_SLASH 0x0040 -#define FLAG_EQUAL 0x0080 -#define FLAG_QUOTE 0x0100 -#define FLAG_OTHER 0x8000 - -char* TANSIParser::ParseEscapeANSI(char* pszBuffer, char* pszBufferEnd) -{ - - // The buffer contains something like [pA - // where p is an optional decimal number specifying the count by which the - // appropriate action should take place. - // The pointer pszBuffer points us to the p, and [ are - // already 'consumed' - - // TITUS: Simplification of the code: Assume default count of 1 in case - // there are no parameters. - char tmpc; - const int nParam = 10; // Maximum number of parameters - int iParam[nParam] = {1, 0, 0, 0, 0}; // Assume 1 Parameter, Default 1 - int iCurrentParam = 0; - DWORD flag = 0; - int missing_param = 0; - - // Get parameters from escape sequence. - while ((tmpc = *pszBuffer) <= '?') { - - if(tmpc < '0' || tmpc > '9') { - // Check for parameter delimiter. - if(tmpc == ';') { - // This is a hack (Paul Brannan 6/27/98) - if(*(pszBuffer - 1) == '[') missing_param = iCurrentParam+1; - pszBuffer++; - continue; - } - - // It is legal to have control characters inside ANSI sequences - // (Paul Brannan 6/26/98) - if(tmpc < ' ') { - Console.WriteCtrlChar(tmpc); - pszBuffer++; - continue; - } - - // A new way of handling flags (Paul Brannan 12/2/98) - switch(tmpc) { - case '$': flag |= FLAG_DOLLAR; break; - case '?': flag |= FLAG_QMARK; break; - case '>': flag |= FLAG_GREATER; break; - case '<': flag |= FLAG_LESS; break; - case '!': flag |= FLAG_EXCLAM; break; - case '&': flag |= FLAG_AMPERSAND; break; - case '/': flag |= FLAG_SLASH; break; - case '=': flag |= FLAG_EQUAL; break; - case '\"': flag |= FLAG_QUOTE; break; - default: flag |= FLAG_OTHER; break; - } - - pszBuffer++; - } - - // Got Numerical Parameter. - iParam[iCurrentParam] = strtoul(pszBuffer, &pszBuffer, 10); - if (iCurrentParam < nParam) - iCurrentParam++; - } - - //~~~ TITUS: Apparently the digit is optional (look at termcap or terminfo) - // So: If there is no digit, assume a count of 1 - - switch ((unsigned char)*pszBuffer++) { - // Insert Character - case '@': - if(iParam[0] == 0) iParam[0] = 1; // Paul Brannan 9/1/98 - Console.InsertCharacter(iParam[0]); break; - // Move cursor up. - case 'A': - if(iParam[0] == 0) iParam[0] = 1; - Console.MoveCursorPosition(0, -iParam[0]); break; - // Move cursor down. - // Added by I.Ioannou 06 April, 1997 - case 'B': - case 'e': - if(iParam[0] == 0) iParam[0] = 1; - Console.MoveCursorPosition(0, iParam[0]); - break; - // Move cursor right. - // Added by I.Ioannou 06 April, 1997 - case 'C': - case 'a': - // Handle cursor size sequences (Jose Cesar Otero Rodriquez and - // Paul Brannan, 3/27/1999) - if(flag & FLAG_EQUAL) { - switch(iParam[0]) { - case 7: Console.SetCursorSize(50); break; - case 11: Console.SetCursorSize(6); break; - case 32: Console.SetCursorSize(0); break; - default: Console.SetCursorSize(13); - } - } else { - if(iParam[0] == 0) iParam[0] = 1; - Console.MoveCursorPosition(iParam[0], 0); - break; - } - // Move cursor left. - case 'D': - if(iParam[0] == 0) iParam[0] = 1; - Console.MoveCursorPosition(-iParam[0], 0); - break; - // Move cursor to beginning of line, p lines down. - // Added by I.Ioannou 06 April, 1997 - case 'E': - Console.MoveCursorPosition(-Console.GetCursorX(), iParam[0]); - break; - // Moves active position to beginning of line, p lines up - // Added by I.Ioannou 06 April, 1997 - // With '=' this changes the default fg color (Paul Brannan 6/27/98) - case 'F': - if(flag & FLAG_EQUAL) - Console.setDefaultFg(iParam[0]); - else - Console.MoveCursorPosition(-Console.GetCursorX(), -iParam[0]); - break; - // Go to column p - // Added by I.Ioannou 06 April, 1997 - // With '=' this changes the default bg color (Paul Brannan 6/27/98) - case '`': - case 'G': // 'G' is from Linux kernel sources - if(flag & FLAG_EQUAL) { - Console.setDefaultBg(iParam[0]); - } else { - if (iCurrentParam < 1) // Alter Default - iParam[0] = 0; - // this was backward, and we should subtract 1 from x - // (Paul Brannan 5/27/98) - ConSetCursorPos(iParam[0] - 1, Console.GetCursorY()); - } - break; - // Set cursor position. - case 'f': - case 'H': - if (iCurrentParam < 2 || iParam[1] < 1) - iParam[1] = 1; - ConSetCursorPos(iParam[1] - 1, iParam[0] - 1); - break; - // Clear screen - case 'J': - if ( iCurrentParam < 1 ) iParam[0] = 0; // Alter Default - switch (iParam[0]) { - case 0: Console.ClearEOScreen(); break; - case 1: Console.ClearBOScreen(); break; - case 2: - Console.ClearScreen(); - Console.SetRawCursorPosition(0, 0); - break; - } - break; - // Clear line - case 'K': - if (iCurrentParam < 1) // Alter Default - iParam[0] = 0; - switch (iParam[0]) { - case 0: Console.ClearEOLine(); break; - case 1: Console.ClearBOLine(); break; - case 2: Console.ClearLine(); break; - } - break; - // Insert p new, blank lines. - // Added by I.Ioannou 06 April, 1997 - case 'L': - { - // for (int i = 1; i <= iParam[0]; i++) - // This should speed things up a bit (Paul Brannan 9/2/98) - Console.ScrollDown(Console.GetRawCursorY(), -1, iParam[0]); - break; - } - // Delete p lines. - // Added by I.Ioannou 06 April, 1997 - case 'M': - { - for (int i = 1; i <= iParam[0]; i++) - // This should speed things up a bit (Paul Brannan 9/2/98) - Console.ScrollDown(Console.GetRawCursorY(), -1, -1); - break; - } - // DELETE CHAR - case 'P': - Console.DeleteCharacter(iParam[0]); - break; - // Scrolls screen up (down? -- PB) p lines, - // Added by I.Ioannou 06 April, 1997 - // ANSI X3.64-1979 references this but I didn't - // found it in any telnet implementation - // note 05 Oct 97 : but SCO terminfo uses them, so uncomment them !! - case 'S': - { - //for (int i = 1; i <= iParam[0]; i++) - // This should speed things up a bit (Paul Brannan 9/2/98) - Console.ScrollDown(-1, -1, -iParam[0]); - break; - } - // Scrolls screen up p lines, - // Added by I.Ioannou 06 April, 1997 - // ANSI X3.64-1979 references this but I didn't - // found it in any telnet implementation - // note 05 Oct 97 : but SCO terminfo uses them, so uncomment them !! - case 'T': - { - // for (int i = 1; i <= iParam[0]; i++) - // This should speed things up a bit (Paul Brannan 9/2/98) - Console.ScrollDown(-1, -1, iParam[0]); - break; - } - // Erases p characters up to the end of line - // Added by I.Ioannou 06 April, 1997 - case 'X': - { - int iKeepX = Console.GetRawCursorX(); - int iKeepY = Console.GetRawCursorY(); - if (iParam[0] > Console.GetWidth()) - iParam[0] = Console.GetWidth(); // up to the end of line - for ( int i = 1; i <= iParam[0]; i++ ) - Console.WriteString(" ", 1); - Console.SetRawCursorPosition(iKeepX , iKeepY); - break; - } - // Go back p tab stops - // Added by I.Ioannou 06 April, 1997 - // Implemented by Paul Brannan, 4/13/2000 - case 'Z': - { - int x = Console.GetCursorX(); - for(int j = 0; x > 0 && j < iParam[0]; j++) - while(x > 0 && tab_stops[j] == tab_stops[x]) x--; - Console.SetCursorPosition(x, Console.GetCursorY()); - } - break; - // Get Terminal ID - case 'c': - { - char* szTerminalId = GetTerminalID(); - Network.WriteString(szTerminalId, strlen(szTerminalId)); - break; - } - // TITUS++ 2. November 1998: Repeat Character. - case 'b': - // isprint may be causing problems (Paul Brannan 3/27/99) - // if ( isprint(last_char) ) { - char buf[150]; // at most 1 line (max 132 chars) - - if ( iParam[0] > 149 ) iParam[0] = 149; - memset(buf, last_char, iParam[0]); - buf[iParam[0]] = 0; - if ( fast_write ) - Console.WriteStringFast(buf, iParam[0]); - else - Console.WriteString(buf, iParam[0]); - // } /* IF */ - break; - // Go to line p - // Added by I.Ioannou 06 April, 1997 - case 'd': - if (iCurrentParam < 1) // Alter Default - iParam[0] = 0; - // this was backward, and we should subtract 1 from y - // (Paul Brannan 5/27/98) - ConSetCursorPos(Console.GetCursorX(), iParam[0] - 1); - break; - // iBCS2 tab erase - // Added by I.Ioannou 06 April, 1997 - case 'g': - if (iCurrentParam < 1) // Alter Default - iParam[0] = 0; - switch (iParam[0]) { - case 0: - { - // Clear the horizontal tab stop at the current active position - for(int j = 0; j < MAX_TAB_POSITIONS; j++) { - int x = Console.GetCursorX(); - if(tab_stops[j] == x) tab_stops[j] = tab_stops[x + 1]; - } - } - break; - case 2: - // I think this might be "set as default?" - break; - case 3: - { - // Clear all tab stops - for(int j = 0; j < MAX_TAB_POSITIONS; j++) - tab_stops[j] = -1; - } - break; - } - break; - // Set extended mode - case 'h': - { - for (int i = 0; i < iCurrentParam; i++) { - // Changed to a switch statement (Paul Brannan 5/27/98) - if(flag & FLAG_QMARK) { - switch(iParam[i]) { - case 1: // App cursor keys - KeyTrans.set_ext_mode(APP_KEY); - break; - case 2: // VT102 mode - vt52_mode = 0; - KeyTrans.unset_ext_mode(APP2_KEY); - break; - case 3: // 132 columns - if(ini.get_wide_enable()) { - Console.SetWindowSize(132, -1); - } - break; - case 4: // smooth scrolling - break; - case 5: // Light background - Console.Lightbg(); - break; - case 6: // Stay in margins - ignore_margins = 0; - break; - case 7: - Console.setLineWrap(true); - break; - case 8: // Auto-repeat keys - break; - case 18: // Send FF to printer - break; - case 19: // Entire screen legal for printer - break; - case 25: // Visible cursor - break; - case 66: // Application numeric keypad - break; - default: -#ifdef DEBUG - Console.Beep(); -#endif - break; - } - } else { - switch(iParam[i]) { - case 2: // Lock keyboard - break; - case 3: // Act upon control codes (PB 12/5/98) - print_ctrl = 0; - break; - case 4: // Set insert mode - Console.InsertMode(1); - break; - case 12: // Local echo off - break; - case 20: // Newline sends cr/lf - KeyTrans.set_ext_mode(APP4_KEY); - newline_mode = true; - break; - default: -#ifdef DEBUG - Console.Beep(); -#endif - break; - } - } - } - } - break; - // Print Screen - case 'i': - if (iCurrentParam < 1) - iParam[0]=0; - switch (iParam[0]){ - case 0: break; // Print Screen - case 1: break; // Print Line - // Added I.Ioannou 06 April, 1997 - case 4: - // Stop Print Log - InPrintMode = 0; - if ( printfile != NULL ) - fclose(printfile); - break; - case 5: - // Start Print Log - printfile = fopen(ini.get_printer_name(), "ab"); - if (printfile != NULL) InPrintMode = 1; - break; - } - break; - // Unset extended mode - case 'l': - { - for (int i = 0; i < iCurrentParam; i++) { - // Changed to a switch statement (Paul Brannan 5/27/98) - if(flag & FLAG_QMARK) { - switch(iParam[i]) { - case 1: // Numeric cursor keys - KeyTrans.unset_ext_mode(APP_KEY); - break; - case 2: // VT52 mode - vt52_mode = 1; - KeyTrans.set_ext_mode(APP2_KEY); - break; - case 3: // 80 columns - if(ini.get_wide_enable()) { - Console.SetWindowSize(80, -1); - } - break; - case 4: // jump scrolling - break; - case 5: // Dark background - Console.Darkbg(); - break; - case 6: // Ignore margins - ignore_margins = 1; - break; - case 7: - Console.setLineWrap(false); - break; - case 8: // Auto-repeat keys - break; - case 19: // Only send scrolling region to printer - break; - case 25: // Invisible cursor - break; - case 66: // Numeric keypad - break; - default: -#ifdef DEBUG - Console.Beep(); -#endif - break; - } - } else { - switch(iParam[i]) { - case 2: // Unlock keyboard - break; - case 3: // Display control codes (PB 12/5/98) - print_ctrl = 1; - break; - case 4: // Set overtype mode - Console.InsertMode(0); - break; - case 12: // Local echo on - break; - case 20: // sends lf only - KeyTrans.unset_ext_mode(APP4_KEY); - newline_mode = false; - break; - default: -#ifdef DEBUG - Console.Beep(); -#endif - break; - } - } - } - } - break; - // Set color - case 'm': - if(missing_param) Console.Normal(); - if(iCurrentParam == 0) { - Console.Normal(); - } else { - for(int i = 0; i < iCurrentParam; i++) - ConSetAttribute(iParam[i]); - } - break; - // report cursor position Row X Col - case 'n': - if (iCurrentParam == 1 && iParam[0]==5) { - // report the cursor position - Network.WriteString("\x1B[0n", 6); - break; - } - if (iCurrentParam == 1 && iParam[0]==6){ - // report the cursor position - // The cursor position needs to be sent as a single string - // (Paul Brannan 6/27/98) - char szCursorReport[40] = "\x1B["; - - itoa(Console.GetCursorY() + 1, - &szCursorReport[strlen(szCursorReport)], 10); - strcat(szCursorReport, ";"); - itoa(Console.GetCursorX() + 1, - &szCursorReport[strlen(szCursorReport)], 10); - strcat(szCursorReport, "R"); - - Network.WriteString(szCursorReport, strlen(szCursorReport)); - - } - break; - // Miscellaneous weird sequences (Paul Brannan 6/27/98) - case 'p': - // Set conformance level - if(flag & FLAG_QUOTE) { - break; - } - // Soft terminal reset - if(flag & FLAG_EXCLAM) { - break; - } - // Report mode settings - if(flag & FLAG_DOLLAR) { - break; - } - break; - // Scroll Screen - case 'r': - if (iCurrentParam < 1) { - // Enable scrolling for entire display - Console.SetScroll(-1, -1); - break; - } - if (iCurrentParam >1) { - // Enable scrolling from row1 to row2 - Console.SetScroll(iParam[0] - 1, iParam[1] - 1); - // If the cursor is outside the scrolling range, fix it - // (Paul Brannan 6/26/98) - // if(Console.GetRawCursorY() < iParam[0] - 1) { - // Console.SetRawCursorPosition(Console.GetCursorX(), - // iParam[0] - 1); - // } - // if(Console.GetRawCursorY() > iParam[1] - 1) { - // Console.SetRawCursorPosition(Console.GetCursorX(), - // iParam[1] - 1); - // } - } - // Move the cursor to the home position (Paul Brannan 12/2/98) - Console.SetCursorPosition(0, 0); - break; - // Save cursor position - case 's': - SaveCurY(Console.GetRawCursorY()); - SaveCurX(Console.GetRawCursorX()); - break; - // Restore cursor position - case 'u': - Console.SetRawCursorPosition(iSavedCurX, iSavedCurY); - break; - // DEC terminal report (Paul Brannan 6/28/98) - case 'x': - if(iParam[0]) - Network.WriteString("\033[3;1;1;128;128;1;0x", 20); - else - Network.WriteString("\033[2;1;1;128;128;1;0x", 20); - break; - default: -#ifdef DEBUG - Console.Beep(); -#endif - break; - } - - return pszBuffer; -} - -#ifdef MTE_SUPPORT -// Added by Frediano Ziglio, 5/31/2000 -// MTE extension -// initially copied from ParseEscapeANSI -char* TANSIParser::ParseEscapeMTE(char* pszBuffer, char* pszBufferEnd) -{ - // The buffer contains something like ~pA - // where p is an optional decimal number specifying the count by which the - // appropriate action should take place. - // The pointer pszBuffer points us to the p, and ~ are - // already 'consumed' - // TITUS: Simplification of the code: Assume default count of 1 in case - // there are no parameters. - char tmpc; - const int nParam = 10; // Maximum number of parameters - int iParam[nParam] = {1, 0, 0, 0, 0}; // Assume 1 parameter, Default 1 - int iCurrentParam = 0; - char sRepeat[2]; - - // Get parameters from escape sequence. - while ((tmpc = *pszBuffer) <= '?') { - if(tmpc < '0' || tmpc > '9') { - // Check for parameter delimiter. - if(tmpc == ';') { - pszBuffer++; - continue; - } - pszBuffer++; - } - - // Got Numerical Parameter. - iParam[iCurrentParam] = strtoul(pszBuffer, &pszBuffer, 10); - if (iCurrentParam < nParam) - iCurrentParam++; - } - - //~~~ TITUS: Apparently the digit is optional (look at termcap or terminfo) - // So: If there is no digit, assume a count of 1 - - switch ((unsigned char)*pszBuffer++) { - case 'A': - // set colors - if (iCurrentParam < 2 ) - break; - if (iParam[0] <= 15 && iParam[1] <= 15) - Console.SetAttrib( (iParam[1] << 4) | iParam[0] ); - break; - - case 'R': - // define region - mteRegionXF = -1; - if (iCurrentParam < 2 ) - break; - mteRegionXF = iParam[1]-1; - mteRegionYF = iParam[0]-1; - break; - - case 'F': - // fill with char - { - if (mteRegionXF == -1 || iCurrentParam < 1) - break; - sRepeat[0] = (char)iParam[0]; - sRepeat[1] = '\0'; - int xi = Console.GetCursorX(),yi = Console.GetCursorY(); - int xf = mteRegionXF; - int yf = mteRegionYF; - mteRegionXF = -1; - for(int y=yi;y<=yf;++y) - { - Console.SetCursorPosition(xi,y); - for(int x=xi;x<=xf;++x) - - Console.WriteStringFast(sRepeat,1); - } - } - break; - - case 'S': - // Scroll region - { - if (mteRegionXF == -1 || iCurrentParam < 2) - break; - int /*x = Console.GetCursorX(),*/y = Console.GetCursorY(); - // int xf = mteRegionXF; - int yf = mteRegionYF; - mteRegionXF = -1; - // !!! don't use x during scroll - int diff = (iParam[0]-1)-y; - if (diff<0) - Console.ScrollDown(y-1,yf,diff); - else - Console.ScrollDown(y,yf+1,diff); - } - break; - // Meridian main version ?? - case 'x': - // disable echo and line mode - Network.set_local_echo(0); - Network.set_line_mode(0); - // Meridian Server handle cursor itself - Console.SetCursorSize(0); - break; - // query ?? - case 'Q': - if (iParam[0] == 1) - Network.WriteString("\033vga.",5); - break; - default: -#ifdef DEBUG - Console.Beep(); -#endif - break; - } - - return pszBuffer; - } -#endif - -char* TANSIParser::ParseEscape(char* pszBuffer, char* pszBufferEnd) { - char *pszChar; - - // Check if we have enough characters in buffer. - if ((pszBufferEnd - pszBuffer) < 2) - return pszBuffer; - - // I.Ioannou 04 Sep 1997 - // there is no need for pszBuffer++; after each command - - // Decode the command. - pszBuffer++; - - switch (*pszBuffer++) { - case 'A': // Cursor up - Console.MoveCursorPosition(0, -1); - break; - // Cursor down - case 'B': - Console.MoveCursorPosition(0, 1); - break; - // Cursor right - case 'C': - Console.MoveCursorPosition(1, 0); - break; - // LF *or* cursor left (Paul Brannan 6/27/98) - case 'D': - if(vt52_mode) - Console.MoveCursorPosition(-1, 0); - else - Console.index(); - break; - // CR/LF (Paul Brannan 6/26/98) - case 'E': - Console.WriteCtrlString("\r\n", 2); - break; - // Special graphics char set (Paul Brannan 6/27/98) - case 'F': - Charmap.setmap('0'); - break; - // ASCII char set (Paul Brannan 6/27/98) - case 'G': - Charmap.setmap('B'); - break; - // Home cursor/tab set - case 'H': - if(ini.get_vt100_mode()) { - int x = Console.GetCursorX(); - if(x != 0) { - int t = tab_stops[x - 1]; - for(int j = x - 1; j >= 0 && tab_stops[j] == t; j--) - tab_stops[j] = x; - } - } else { - // I.Ioannou 04 Sep 1997 (0,0) not (1,1) - ConSetCursorPos(0, 0); - } - break; - // Reverse line feed (Paul Brannan 6/27/98) - // FIX ME!!! reverse_index is wrong to be calling here - // (Paul Brannan 12/2/98) - case 'I': - Console.reverse_index(); - break; - // Erase end of screen - case 'J': - Console.ClearEOScreen(); - break; - // Erase EOL - case 'K': - Console.ClearEOLine(); - break; - // Scroll Up one line //Reverse index - case 'M': - Console.reverse_index(); - break; - // Direct cursor addressing - case 'Y': - if ((pszBufferEnd - pszBuffer) >= 2){ - // if we subtract '\x1F', then we may end up with a negative - // cursor position! (Paul Brannan 6/26/98) - ConSetCursorPos(pszBuffer[1] - ' ', pszBuffer[0] - ' '); - pszBuffer+=2; - } else { - pszBuffer--; // Paul Brannan 6/26/98 - } - break; - // Terminal ID Request - case 'Z': - { - char* szTerminalId = GetTerminalID(); - Network.WriteString(szTerminalId, strlen(szTerminalId)); - break; - } - // reset terminal to defaults - case 'c': - ResetTerminal(); - break; - // Enter alternate keypad mode - case '=': - KeyTrans.set_ext_mode(APP3_KEY); - break; - // Exit alternate keypad mode - case '>': - KeyTrans.unset_ext_mode(APP3_KEY); - break; - // Enter ANSI mode - case '<': - KeyTrans.unset_ext_mode(APP2_KEY); // exit vt52 mode - break; - // Graphics processor on (See note 3) - case '1': - break; - // Line size commands - case '#': //Line size commands - // (Paul Brannan 6/26/98) - if(pszBuffer < pszBufferEnd) { - switch(*pszBuffer++) { - case '3': break; // top half of a double-height line - case '4': break; // bottom half of a double-height line - case '6': break; // current line becomes double-width - case '8': Console.ClearScreen('E'); break; - } - } else { - pszBuffer--; - } - break; - // Graphics processor off (See note 3) - case '2': - break; - // Save cursor and attribs - case '7': - SaveCurY(Console.GetRawCursorY()); - SaveCurX(Console.GetRawCursorX()); - iSavedAttributes = Console.GetAttrib(); - break; - // Restore cursor position and attribs - case '8': - Console.SetRawCursorPosition(iSavedCurX, iSavedCurY); - Console.SetAttrib(iSavedAttributes); - break; - // Set G0 map (Paul Brannan 6/25/98) - case '(': - if (pszBuffer < pszBufferEnd) { - map_G0 = *pszBuffer; - if(current_map == 0) Charmap.setmap(map_G0); - pszBuffer++; - } else { - pszBuffer--; - } - break; - // Set G1 map (Paul Brannan 6/25/98) - case ')': - if (pszBuffer < pszBufferEnd) { - map_G1 = *pszBuffer; - if(current_map == 1) Charmap.setmap(map_G1); - pszBuffer++; - } else { - pszBuffer--; - } - break; - // This doesn't do anything, as far as I can tell, but it does take - // a parameter (Paul Brannan 6/27/98) - case '%': - if (pszBuffer < pszBufferEnd) { - pszBuffer++; - } else { - pszBuffer--; - } - break; - // ANSI escape sequence - case '[': - // Check if we have whole escape sequence in buffer. - // This should not be isalpha anymore (Paul Brannan 9/1/98) - pszChar = pszBuffer; - while ((pszChar < pszBufferEnd) && (*pszChar <= '?')) - pszChar++; - if (pszChar == pszBufferEnd) - pszBuffer -= 2; - else - pszBuffer = ParseEscapeANSI(pszBuffer, pszBufferEnd); - break; -#ifdef MTE_SUPPORT - case '~': - // Frediano Ziglio, 5/31/2000 - // Meridian Terminal Emulator extension - // !!! same as ANSI - // !!! should put in MTE procedure - pszChar = pszBuffer; - while ((pszChar < pszBufferEnd) && (*pszChar <= '?')) - pszChar++; - if (pszChar == pszBufferEnd) - pszBuffer -= 2; - else - pszBuffer = ParseEscapeMTE(pszBuffer, pszBufferEnd); - break; -#endif - default: -#ifdef DEBUG - Console.Beep(); -#endif - break; - } - - return pszBuffer; -} - -// This function now only parses the ANSI buffer and does not do anything -// with IAC sequences. That code has been moved to TTelHndl.cpp. -// The scroller update routines have been moved to TScroll.cpp. -// (Paul Brannan 6/15/98) -char* TANSIParser::ParseBuffer(char* pszHead, char* pszTail){ - // copy into ANSI buffer - char * pszResult; - - // Parse the buffer for ANSI or display - while (pszHead < pszTail) { - if(!ini.get_output_redir()) { - pszResult = ParseANSIBuffer(pszHead, pszTail); - } else { - // Output is being redirected - if(ini.get_strip_redir()) { - // Skip the WriteFile() altogether and pass the buffer to a filter - // Mark Miesfield 09/24/2000 - pszResult = PrintGoodChars(pszHead, pszTail); - } else { - DWORD Result; - // Paul Brannan 7/29/98 - // Note that this has the unforunate effect of printing out - // NULL (ascii 0) characters onto the screen - if (!WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), pszHead, - pszTail - pszHead, &Result, NULL)) pszResult = pszHead; - pszResult = pszHead + Result; - } - } - if (dumpfile) - fwrite( pszHead, sizeof (char), pszResult-pszHead, dumpfile); - if(ini.get_scroll_enable()) Scroller.update(pszHead, pszResult); - if (pszResult == pszHead) break; - pszHead = pszResult; - } - // return the new head to the buffer - return pszHead; -} - -// A simple routine to strip ANSI sequences -// This isn't perfect, but it does an okay job (Paul Brannan 7/5/98) -// Fixed a line counting bug (Paul Brannan 12/4/98) -int TANSIParser::StripBuffer(char* pszHead, char* pszTail, int width) { - int lines = 0, c = 0; - char *pszBuf = pszHead; - - while(pszHead < pszTail) { - if(iscntrl(*pszHead)) { - switch(*(pszHead++)) { - case 8: - case 127: - if(c>0) { - if(!(c%width)) lines--; - c--; - pszBuf--; - } - break; - case 10: lines++; - case 13: - *(pszBuf++) = *(pszHead - 1); - c = 0; - break; - case 27: - switch(*(pszHead++)) { - case 'Y': pszHead += 2; break; - case '#': - case '(': - case ')': - case '%': pszHead++; break; - case '[': - while((pszHead < pszTail) && (*pszHead < '?')) - pszHead++; - pszHead++; - break; - } - } - } else { - *(pszBuf++) = *(pszHead++); - c++; - } - if(c != 0 && !(c%width)) - lines++; - } - - // Fill in the end of the buffer with blanks - while(pszBuf <= pszTail) *pszBuf++ = ' '; - - return lines; -} - -char* TANSIParser::ParseANSIBuffer(char* pszBuffer, char* pszBufferEnd) -{ - if(InPrintMode) { - return PrintBuffer(pszBuffer, pszBufferEnd); - } - - unsigned char tmpc = *(unsigned char *)pszBuffer; - - if(tmpc == 27) { - return ParseEscape(pszBuffer, pszBufferEnd); - } - -// if((fast_write && tmpc < 32) || -// !print_ctrl && (tmpc < 32 || (EightBit_Ansi && -// (tmpc > 128 && tmpc < 128 + ' ')))) { - - // We shouldn't print ctrl characters when fast write is enabled - // and ctrl chars are disabled (Paul Brannan 9/1/98) - if(tmpc < 32) { - // From the Linux kernel (Paul Brannan 12/5/98): - /* A bitmap for codes <32. A bit of 1 indicates that the code - * corresponding to that bit number invokes some special action - * (such as cursor movement) and should not be displayed as a - * glyph unless the disp_ctrl mode is explicitly enabled. - */ - const long CTRL_ACTION = 0x0d00ff81; - const long CTRL_ALWAYS = 0x0800f501; - if(!(((print_ctrl?CTRL_ALWAYS:CTRL_ACTION)>>tmpc)&1)) { - - Console.WriteString((char *)&tmpc, 1); - pszBuffer++; - return pszBuffer; - } - - switch (tmpc) { - case 0: - pszBuffer++; - break; - - // I.Ioannou 5/30/98 - case 7: - Console.Beep(); - pszBuffer++; - break; - - // destructive backspace - case 8: - // Added option for destructive backspace (Paul Brannan 5/13/98) - // Changed to ConWriteCtrlString so that the cursor position can be - // updated (Paul Brannan 5/25/98) - if(ini.get_dstrbksp()) { - Console.WriteCtrlChar('\b'); - Console.WriteString(" ", 1); - Console.WriteCtrlChar('\b'); - } - else Console.WriteCtrlChar('\b'); - pszBuffer++; - break; - - // horizontal tab - case 9: - { - pszBuffer++; - int x = Console.GetCursorX(); - if(x != -1) - Console.SetCursorPosition(tab_stops[x], Console.GetCursorY()); - } - break; - - // Line Feed Char - case 10: - // Test for local echo (Paul Brannan 8/25/98) - if(Network.get_local_echo() || newline_mode) // && - Console.WriteCtrlChar('\x0d'); - Console.WriteCtrlChar('\x0a'); - pszBuffer++; - break; - - // form feed - case 12: - pszBuffer++; - Console.ClearScreen(); - Console.SetRawCursorPosition(Console.GetCursorX(), 1); // changed fm 1 - break; - - case 13: - Console.WriteCtrlChar('\x0d'); - pszBuffer++; - - break; - - case 14: // shift out of alternate chararcter set - pszBuffer++; - Charmap.setmap(map_G1); // Paul Brannan 6/25/98 - current_map = 1; - break; - - case 15: // shift in - pszBuffer++; - Charmap.setmap(map_G0); // Paul Brannan 6/25/98 - current_map = 0; - break; - - // Paul Brannan 9/1/98 - Is this okay? - default: - pszBuffer++; - } - - return pszBuffer; - } - - // added by I.Ioannou 06 April, 1997 - // In 8 bit systems the server may send 0x9b instead of ESC[ - // Well, this will produce troubles in Greek 737 Code page - // which uses 0x9b as the small "delta" - and I thing that there - // is another European country with the same problem. - // If we have to stay 8-bit clean we may have to - // give the ability of ROM characters (ESC[11m), - // for striped 8'th bit (ESC[12m) as SCO does, - // or a parameter at compile (or run ?) time. - // We now check for a flag in the ini file (Paul Brannan 5/13/98) - // We also handle any 8-bit ESC sequence (Paul Brannan 6/28/98) - if(ini.get_eightbit_ansi() && (tmpc > 128 && tmpc < 128 + ' ')) { - // There's a chance the sequence might not parse. If this happens - // then pszBuffer will be one character too far back, since - // ParseEscape is expecting two characters, not one. - // In that case we must handle it. - char *pszCurrent = pszBuffer; - pszBuffer = ParseEscape(pszBuffer, pszBufferEnd); - if(pszBuffer < pszCurrent) pszBuffer = pszCurrent; - } - - char* pszCurrent = pszBuffer + 1; - // I.Ioannou 04 Sep 1997 FIXME with ESC[11m must show chars < 32 - // Fixed (Paul Brannan 6/28/98) - while ((pszCurrent < pszBufferEnd) && (!iscntrl(*pszCurrent))) { - // I.Ioannou 04 Sep 1997 strip on high bit - if ( (inGraphMode) && (*pszCurrent > (char)32) ) - *pszCurrent |= 0x80 ; - pszCurrent++; - } - - // Note that this may break dumpfiles slightly. - // If 'B' is set to anything other than ASCII, this will cause problems - // (Paul Brannan 6/28/98) - if(current_map != 'B' && Charmap.enabled) - Charmap.translate_buffer(pszBuffer, pszCurrent); - - last_char = *(pszCurrent-1); // TITUS++: Remember last char - - if(fast_write) { - pszBuffer += Console.WriteStringFast(pszBuffer, - pszCurrent - pszBuffer); - } else { - pszBuffer += Console.WriteString(pszBuffer, - pszCurrent - pszBuffer); - } - - return pszBuffer; -} - -// Added by I.Ioannou 06 April, 1997 -// Print the buffer until you reach ESC[4i -char* TANSIParser::PrintBuffer(char* pszBuffer, char* pszBufferEnd) { - // Check if we have enough characters in buffer. - if ((pszBufferEnd - pszBuffer) < 4) - return pszBuffer; - char *tmpChar; - - tmpChar = pszBuffer; - if ( *tmpChar == 27 ) { - tmpChar++; - if ( *tmpChar == '[' ) { - tmpChar++; - if ( *tmpChar == '4' ) { - tmpChar++; - if ( *tmpChar == 'i' ) { - InPrintMode = 0; // Stop Print Log - if ( printfile != NULL ) - fclose(printfile); - pszBuffer += 4; - return pszBuffer; - } - } - } - } - - if (printfile != NULL) { - fputc( *pszBuffer, printfile); - pszBuffer++; - } else - InPrintMode = 0; - - return pszBuffer; -} - -/* - PrintGoodChars( pszHead, pszTail ) - - - - - - - - - - - - - - - - - - - --* - - Mark Miesfield 09/24/2000 - - Prints the characters in a buffer, from the specified head to the specified - tail, to standard out, skipping any control characters or ANSI escape - sequences. - - Parameters on entry: - pszHead -> Starting point in buffer. - - pszTail -> Ending point in buffer. - - Returns: - Pointer to the first character in the buffer that was not output to - standard out. (Since no error checking is done, this is in effect - pszTail.) - - Side Effects: - None. -* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ -char * TANSIParser::PrintGoodChars( char * pszHead, char * pszTail ) { - - while ( pszHead < pszTail ) { - if ( iscntrl( *pszHead ) ) { - switch ( *(pszHead++) ) { - case 10 : - putc( 10, stdout ); - break; - - case 13 : - putc( 13, stdout ); - break; - - case 27: - switch ( *(pszHead++) ) { - case 'Y': - pszHead += 2; - break; - - case '#': - case '(': - case ')': - case '%': pszHead++; break; - case '[': - while ( (pszHead < pszTail) && (*pszHead < '?') ) - pszHead++; - pszHead++; - break; - - default : - break; - } - break; - - default : - break; - } - } - else - putc( *(pszHead++), stdout ); - } - return ( pszTail ); -} -// End of function: PrintGoodChars( pszHead, pszTail ) diff --git a/rosapps/net/telnet/src/ansiprsr.h b/rosapps/net/telnet/src/ansiprsr.h deleted file mode 100644 index aef43c6a079..00000000000 --- a/rosapps/net/telnet/src/ansiprsr.h +++ /dev/null @@ -1,85 +0,0 @@ -#ifndef __ANSIPRSR_H -#define __ANSIPRSR_H - -#include -#include -#include -#include -#include "tnconfig.h" -#include "tparser.h" - -// added this color table to make things go faster (Paul Branann 5/8/98) -enum Colors {BLACK=0, BLUE, GREEN, CYAN, RED, MAGENTA, YELLOW, WHITE}; -static const int ANSIColors[] = {BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE}; - -// This should be greater than the largest conceivable window size -// 200 should suffice -#define MAX_TAB_POSITIONS 200 - -// Added by Frediano Ziglio 6/2/2000 -// Include Meridian Emulator support -// undefine it to remove support -#define MTE_SUPPORT 1 - -// TANSIParser is now properly no longer a base class for TTelnetParser. -// Screen output is handled in TConsole.cpp. -// (Paul Brannan 6/15/98) -class TANSIParser : public TParser { -private: - char* ParseEscapeANSI(char* pszBuffer, char* pszBufferEnd); - char* ParseANSIBuffer(char* pszBuffer, char* pszBufferEnd); - char* ParseEscape(char* pszBuffer, char* pszBufferEnd); - // Added by I.Ioannou 06/04/97 - char* PrintBuffer(char* pszBuffer, char* pszBufferEnd); - char* PrintGoodChars(char * pszHead, char * pszTail); - -#ifdef MTE_SUPPORT - // Added by Frediano Ziglio, 5/31/2000 - char* ParseEscapeMTE(char* pszBuffer, char* pszBufferEnd); - short int mteRegionXF,mteRegionYF; -#endif - - void ConSetAttribute(unsigned char wAttr); - char *GetTerminalID(); - void ConSetCursorPos(int x, int y); - void ResetTerminal(); - void Init(); - - void SaveCurX(int iX); - void SaveCurY(int iY); - - void resetTabStops(); - - int iSavedCurX; - int iSavedCurY; - unsigned char iSavedAttributes; - FILE * dumpfile; - - // Added by I.Ioannou 06 April 1997 - FILE * printfile; - char InPrintMode; - int inGraphMode; - - char last_char; // TITUS++: 2. November 98 - - char map_G0, map_G1; - int current_map; - bool vt52_mode; - bool print_ctrl; - bool ignore_margins; - bool fast_write; - bool newline_mode; - - int tab_stops[MAX_TAB_POSITIONS]; - -public: - // Changed by Paul Brannan 5/13/98 - TANSIParser(TConsole &Console, KeyTranslator &RefKeyTrans, - TScroller &RefScroller, TNetwork &NetHandler, TCharmap &RefCharmap); - ~TANSIParser(); - - char* ParseBuffer(char* pszBuffer, char* pszBufferEnd); - static int StripBuffer(char* pszBuffer, char* pszBufferEnd, int width); -}; - -#endif diff --git a/rosapps/net/telnet/src/keytrans.cpp b/rosapps/net/telnet/src/keytrans.cpp deleted file mode 100644 index 518b96282b2..00000000000 --- a/rosapps/net/telnet/src/keytrans.cpp +++ /dev/null @@ -1,227 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -//Telnet Win32 : an ANSI telnet client. -//Copyright (C) 1998-2000 Paul Brannan -//Copyright (C) 1998 I.Ioannou -//Copyright (C) 1997 Brad Johnson -// -//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. -// -//I.Ioannou -//roryt@hol.gr -// -/////////////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////// -// Key translations - I.Ioannou (roryt@hol.gr) // -// Athens - Greece December 18, 1996 02:56am // -// Reads a .cfg file and keeps the definitions // -// modified for alternate keymap swiching // -// by Andrey V. Smilianets (smile@head.aval.kiev.ua) // -// Kiev - Ukraine, December 1997. // -// modified to work with MSVC and the Standard Template // -// library by Paul Brannan , // -// May 25, 1998 // -// updated June 7, 1998 by Paul Brannan to remove cout and // -// cerr statements // -// APP_KEY and APP2_Key added July 12, 1998 by Paul Brannan // -/////////////////////////////////////////////////////////////////// -// class KeyTranslator // -// Load : loads or replaces the keymap // -// TranslateKey : returns a char * to the key def // -// AddKeyDef : Changes or adds the key translation // -// DeleteKeyDef : Deletes a key def from the list // -/////////////////////////////////////////////////////////////////// - -#include - -// changed to make work with VC++ (Paul Brannan 5/25/98) -// FIX ME !!! Ioannou: This must be __BORLANDC__ && VERSION < 5 -// but what is the directive for Borland version ???? -// FIXED Sept. 31, 2000 (Bernard Badger) -// -#if defined(__BORLANDC__) && (__BORLANDC < 0x0500) -#include -#else -#include -#endif - -#include "keytrans.h" -#include "tnerror.h" - -///////////////////////////////////////////////////////////// -// class KeyTranslator // -// Load : loads or replaces the keymap // -// TranslateKey : returns a sz to the key def // -// AddKeyDef : Changes or adds the key translation // -// DeleteKeyDef : Deletes a key def from the list // -///////////////////////////////////////////////////////////// - - -KeyTranslator::KeyTranslator(): -mapArray(0,0,sizeof(KeyMap)), -globals(0,0,sizeof(TKeyDef)) { - ext_mode = 0; // Paul Brannan 8/28/98 - currentKeyMap = mainKeyMap = -1; -}; - -//AVS -// perform keymap switching -int KeyTranslator::switchMap(TKeyDef& tk) { - if ( mapArray.IsEmpty() ) { - return currentKeyMap = -1; - }; - int i = mapArray.Find(KeyMap(tk)); - if ( i != INT_MAX ) { - if (currentKeyMap == i) - currentKeyMap = mainKeyMap; // restore to default - else currentKeyMap = i; - return 1; - }; - return 0; -}; - -// Let the calling function interpret the error code (Paul Brannan 12/17/98) -int KeyTranslator::SwitchTo(int to) { - - int max = mapArray.GetItemsInContainer(); - if (max == 0) return -1; - if (to < 0 || to > (max-1)) return 0; - - currentKeyMap = to; - return 1; -}; - -//AVS -// rewrited to support multiple keymaps -const char *KeyTranslator::TranslateKey(WORD wVirtualKeyCode, - DWORD dwControlKeyState) -{ - if ( mapArray.IsEmpty() ) return NULL; - - TKeyDef ask(NULL, dwControlKeyState, wVirtualKeyCode); - - // if a keymap switch pressed - if ( switchMap(ask) > 0 ) return ""; - - int i = mapArray[currentKeyMap].map.Find(ask); - - if ( i != INT_MAX) return mapArray[currentKeyMap].map[i].GetszKey(); - - // if not found in current keymap - if ( currentKeyMap != mainKeyMap ) { - i = mapArray[mainKeyMap].map.Find(ask); - if ( i != INT_MAX) return mapArray[mainKeyMap].map[i].GetszKey(); - }; - return NULL; -}; - - -//AVS -// rewrited to support multiple keymaps -int KeyTranslator::AddKeyDef(WORD wVirtualKeyCode, DWORD dwControlKeyState, - char*lpzKeyDef) -{ - if ( ! mapArray[currentKeyMap].map.IsEmpty() ) { - int i = mapArray[currentKeyMap].map.Find(TKeyDef(NULL, dwControlKeyState, wVirtualKeyCode)); - if ( i != INT_MAX) { - mapArray[currentKeyMap].map[i] = lpzKeyDef; - return 1; - } - }; - return mapArray[currentKeyMap].map.Add( TKeyDef(lpzKeyDef, dwControlKeyState, wVirtualKeyCode)); -} - -// Paul Brannan Feb. 22, 1999 -int KeyTranslator::AddKeyDef(WORD wVirtualKeyCode, DWORD dwControlKeyState, - tn_ops the_op) -{ - optype op; - op.sendstr = 0; - op.the_op = the_op; - if ( ! mapArray[currentKeyMap].map.IsEmpty() ) { - int i = mapArray[currentKeyMap].map.Find(TKeyDef(NULL, dwControlKeyState, wVirtualKeyCode)); - if ( i != INT_MAX) { - mapArray[currentKeyMap].map[i] = op; - return 1; - } - }; - return mapArray[currentKeyMap].map.Add( TKeyDef(op, dwControlKeyState, wVirtualKeyCode)); -} - -// AVS -int KeyTranslator::LookOnGlobal(char* vkey) { - if ( ! globals.IsEmpty() ) { - int max = globals.GetItemsInContainer(); - for ( int i = 0; i < max ; i++ ) - if ( stricmp(globals[i].GetszKey(), vkey) == 0 ) - return i; - }; - return INT_MAX; -}; - -int KeyTranslator::AddGlobalDef(WORD wVirtualKeyCode, char*lpzKeyDef) { - if ( ! globals.IsEmpty() ) { - int max = globals.GetItemsInContainer(); - for ( int i = 0; i < max ; i++ ) { - const char *s = globals[i].GetszKey(); - if ( stricmp(s, lpzKeyDef) == 0 ) { - globals[i] = DWORD(wVirtualKeyCode); - return 1; - } - } - } - return globals.Add( TKeyDef(lpzKeyDef, 0, wVirtualKeyCode)); -} - - -//AVS -// rewrited to support multiple keymaps -int KeyTranslator::DeleteKeyDef(WORD wVirtualKeyCode, DWORD dwControlKeyState) -{ - if ( mapArray.IsEmpty() || mapArray[currentKeyMap].map.IsEmpty() ) - return 0; - - int i = mapArray[currentKeyMap].map.Find(TKeyDef(NULL, dwControlKeyState, wVirtualKeyCode)); - - if ( i != INT_MAX) { - mapArray[currentKeyMap].map.Destroy(i); - return 1; - }; - return 0; -}; - -//AVS -// rewritten to support multiple keymaps -void KeyTranslator::DeleteAllDefs(void) -{ - // This code wants to crash under the STL; Apparently the Destroy() - // function actually deletes the entry, rather than simply releasing - // memory. I think flush() should do the same thing, at least the - // way it is written with STL_BIDS (Paul Brannan 5/25/98). - int max; - - max = mapArray.GetItemsInContainer(); - if ( ! mapArray.IsEmpty() ) { - for ( int i = 0; i < max; i++ ) { - if ( !mapArray[i].map.IsEmpty() ) { - mapArray[i].map.Flush(); - }; - }; - }; - globals.Flush(); - mapArray.Flush(); - currentKeyMap = -1; - mainKeyMap = -1; -}; diff --git a/rosapps/net/telnet/src/keytrans.h b/rosapps/net/telnet/src/keytrans.h deleted file mode 100644 index f760a7e7d77..00000000000 --- a/rosapps/net/telnet/src/keytrans.h +++ /dev/null @@ -1,97 +0,0 @@ -/////////////////////////////////////////////////////////////////// -// // -// // -// Key translations - I.Ioannou (roryt@hol.gr) // -// Athens - Greece December 18, 1996 02:56am // -// Reads a .cfg file and keeps the key definitions // -// for the WIN32 console telnet // -// modified for alternate keymap swiching // -// by Andrey V. Smilianets (smile@head.aval.kiev.ua) // -// Kiev - Ukraine, December 1997. // -/////////////////////////////////////////////////////////////////// -// // -// class KeyTranslator // -// // -// Load : loads or replaces the keymap // -// TranslateKey : returns a char * to the key def // -// AddKeyDef : Changes or adds the key translation // -// DeleteKeyDef : Deletes a key def from the list // -/////////////////////////////////////////////////////////////////// - -#ifndef __KEYTRANS_H -#define __KEYTRANS_H - -#include "tkeydef.h" -#include "tkeymap.h" - -#define TOKEN_DELIMITERS " +\t" // The word's delimiters - -// Ioannou 2 June 98: Borland needs them - quick hack -#ifdef __BORLANDC__ -#define bool BOOL -#define true TRUE -#define false FALSE -#endif // __BORLANDC__ - -// Maybe not portable, but this is for application cursor mode -// (Paul Brannan 5/27/98) -// Updated for correct precedence in tncon.cpp (Paul Brannan 12/9/98) -#define APP4_KEY 0x8000 -#define APP3_KEY 0x4000 -#define APP2_KEY 0x2000 -#define APP_KEY 0x1000 - -///////////////////////////////////////////////////////////// -// class KeyTranslator // -// Load : loads or replaces the keymap // -// TranslateKey : returns a sz to the key def // -// AddKeyDef : Changes or adds the key translation // -// DeleteKeyDef : Deletes a key def from the list // -///////////////////////////////////////////////////////////// - -class KeyTranslator { -friend class TMapLoader; // FIX ME!! This isn't the best solution -public: - KeyTranslator(); - ~KeyTranslator() { DeleteAllDefs(); } - - int SwitchTo(int); // switch to selected keymap - int switchMap(TKeyDef& tk); - - // Returns a pointer to the string that should be printed. - // Should return NULL if there is no translation for the key. - const char *TranslateKey(WORD wVirtualKeyCode, DWORD dwControlKeyState); - - // Changes or adds the key translation associated with - // wVirtualScanCode and dwControlKeyState. - // Return 1 on success. - int AddKeyDef(WORD wVirtualKeyCode, DWORD dwControlKeyState, char *lpzKeyDef); - int AddKeyDef(WORD wVirtualKeyCode, DWORD dwControlKeyState, tn_ops op); - - // Delete a key translation - int DeleteKeyDef(WORD wVirtualKeyCode, DWORD dwControlKeyState); - - // Paul Brannan 8/28/98 - void set_ext_mode(DWORD mode) {ext_mode |= mode;} - void unset_ext_mode(DWORD mode) {ext_mode &= ~mode;} - void clear_ext_mode() {ext_mode = 0;} - DWORD get_ext_mode() {return ext_mode;} - -private: - DWORD Fix_ControlKeyState(char *); - char* Fix_Tok(char *); - DWORD ext_mode; // Paul Brannan 8/28/98 - - TArrayAsVector mapArray; - TArrayAsVector globals; - - void DeleteAllDefs(void); - int AddGlobalDef(WORD wVirtualKeyCode, char*lpzKeyDef); - int LookOnGlobal(char* vkey); - DWORD GetGlobalCode(int i) {return globals[i].GetCodeKey();} - - int currentKeyMap, mainKeyMap; // AVS - -}; - -#endif // __KEYTRANS_H diff --git a/rosapps/net/telnet/src/stl_bids.h b/rosapps/net/telnet/src/stl_bids.h deleted file mode 100644 index 0161d6ae973..00000000000 --- a/rosapps/net/telnet/src/stl_bids.h +++ /dev/null @@ -1,159 +0,0 @@ -// This is the STL wrapper for classlib/arrays.h from Borland's web site -// It has been modified to be compatible with vc++ (Paul Branann 5/7/98) - -#ifndef STL_ARRAY_AS_VECTOR -#define STL_ARRAY_AS_VECTOR - -#ifdef _MSC_VER -#pragma warning(disable: 4786) -#endif - -// #include -// #include -#include -#include -using namespace std; - -template -class TArrayAsVector : public vector { -private: - const unsigned int growable; - typedef size_t size_type; - typedef typename vector::const_iterator const_iterator; - const size_type lowerbound; -public: - TArrayAsVector(size_type upper, - size_type lower = 0, - int delta = 0) : - vector( ), - growable(delta), - lowerbound(lower) - { vector::reserve(upper-lower + 1);} - - ~TArrayAsVector( ) - { // This call is unnecessary? (Paul Brannan 5/7/98) - // vector::~vector( ); - } - - int Add(const T& item) - { if(!growable && vector::size( ) == vector::capacity( )) - return 0; - else - insert(vector::end( ), item); - return 1; } - - int AddAt(const T& item, size_type index) - { if(!growable && - ((vector::size( ) == vector::capacity( )) || - (ZeroBase(index > vector::capacity( )) ))) - return 0; - if(ZeroBase(index) > vector::capacity( )) // out of bounds - { insert(vector::end( ), - ZeroBase(index) - vector::size( ), T( )); - insert(vector::end( ), item); } - else - { insert(vector::begin( ) + ZeroBase(index), item); } - return 1; - } - - size_type ArraySize( ) - { return vector::capacity( ); } - - size_type BoundBase(size_type location) const - { if(location == UINT_MAX) - return INT_MAX; - else - return location + lowerbound; } - void Detach(size_type index) - { erase(vector::begin( ) + ZeroBase(index)); } - - void Detach(const T& item) - { Destroy(Find(item)); } - - void Destroy(size_type index) - { erase(vector::begin( ) + ZeroBase(index)); } - - void Destroy(const T& item) - { Destroy(Find(item)); } - - size_type Find(const T& item) const - { const_iterator location = find(vector::begin( ), - vector::end( ), item); - if(location != vector::end( )) - return BoundBase(size_type(location - - vector::begin( ))); - else - return INT_MAX; } - - size_type GetItemsInContainer( ) - { return vector::size( ); } - - void Grow(size_type index) - { if( index < lowerbound ) - Reallocate(ArraySize( ) + (index - - lowerbound)); - else if( index >= BoundBase(vector::size( ))) - Reallocate(ZeroBase(index) ); } - - int HasMember(const T& item) - { if(Find(item) != INT_MAX) - return 1; - else - return 0; } - - int IsEmpty( ) - { return vector::empty( ); } - - int IsFull( ) - { if(growable) - return 0; - if(vector::size( ) == vector::capacity( )) - return 1; - else - return 0; } - - size_type LowerBound( ) - { return lowerbound; } - - T& operator[] (size_type index) - { return vector:: - operator[](ZeroBase(index)); } - - const T& operator[] (size_type index) const - { return vector:: - operator[](ZeroBase(index)); } - - void Flush( ) - { - vector::clear(); - } - - void Reallocate(size_type sz, - size_type offset = 0) - { if(offset) - insert(vector::begin( ), offset, T( )); - vector::reserve(sz); - erase(vector::end( ) - offset, vector::end( )); } - - void RemoveEntry(size_type index) - { Detach(index); } - - void SetData(size_type index, const T& item) - { (*this)[index] = item; } - - size_type UpperBound( ) - { return BoundBase(vector::capacity( )) - 1; } - - size_type ZeroBase(size_type index) const - { return index - lowerbound; } - - // The assignment operator is not inherited (Paul Brannan 5/25/98) - TArrayAsVector& operator=(const TArrayAsVector& v) { - vector::operator=(v); - // should growable and lowerbound be copied as well? - return *this; - } - -}; - -#endif diff --git a/rosapps/net/telnet/src/tcharmap.cpp b/rosapps/net/telnet/src/tcharmap.cpp deleted file mode 100644 index bafe62e2484..00000000000 --- a/rosapps/net/telnet/src/tcharmap.cpp +++ /dev/null @@ -1,220 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -//Telnet Win32 : an ANSI telnet client. -//Copyright (C) 1998-2000 Paul Brannan -//Copyright (C) 1998 I.Ioannou -//Copyright (C) 1997 Brad Johnson -// -//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. -// -//I.Ioannou -//roryt@hol.gr -// -/////////////////////////////////////////////////////////////////////////// - -// TCharmap.cpp -// A simple class for handling character maps -// Written by Paul Brannan -// Last modified 7/12/98 - -#include -#include "tcharmap.h" -#include "tnconfig.h" - -// map B (US ASCII) -// this maps each character to itself -static char mapB[256] = { - (char)0x00,(char)0x01,(char)0x02,(char)0x03,(char)0x04,(char)0x05,(char)0x06,(char)0x07, // 0x00 - 0x0f - (char)0x08,(char)0x09,(char)0x0a,(char)0x0b,(char)0x0c,(char)0x0d,(char)0x0e,(char)0x0f, - (char)0x10,(char)0x11,(char)0x12,(char)0x13,(char)0x14,(char)0x15,(char)0x16,(char)0x17, // 0x10 - 0x1f - (char)0x18,(char)0x19,(char)0x1a,(char)0x1b,(char)0x1c,(char)0x1d,(char)0x1e,(char)0x1f, - (char)0x20,(char)0x21,(char)0x22,(char)0x23,(char)0x24,(char)0x25,(char)0x26,(char)0x27, // 0x20 - 0x2f - (char)0x28,(char)0x29,(char)0x2a,(char)0x2b,(char)0x2c,(char)0x2d,(char)0x2e,(char)0x2f, - (char)0x30,(char)0x31,(char)0x32,(char)0x33,(char)0x34,(char)0x35,(char)0x36,(char)0x37, // 0x30 - 0x3f - (char)0x38,(char)0x39,(char)0x3a,(char)0x3b,(char)0x3c,(char)0x3d,(char)0x3e,(char)0x3f, - (char)0x40,(char)0x41,(char)0x42,(char)0x43,(char)0x44,(char)0x45,(char)0x46,(char)0x47, // 0x40 - 0x4f - (char)0x48,(char)0x49,(char)0x4a,(char)0x4b,(char)0x4c,(char)0x4d,(char)0x4e,(char)0x4f, - (char)0x50,(char)0x51,(char)0x52,(char)0x53,(char)0x54,(char)0x55,(char)0x56,(char)0x57, // 0x50 - 0x5f - (char)0x58,(char)0x59,(char)0x5a,(char)0x5b,(char)0x5c,(char)0x5d,(char)0x5e,(char)0x5f, - (char)0x60,(char)0x61,(char)0x62,(char)0x63,(char)0x64,(char)0x65,(char)0x66,(char)0x67, // 0x60 - 0x6f - (char)0x68,(char)0x69,(char)0x6a,(char)0x6b,(char)0x6c,(char)0x6d,(char)0x6e,(char)0x6f, - (char)0x70,(char)0x71,(char)0x72,(char)0x73,(char)0x74,(char)0x75,(char)0x76,(char)0x77, // 0x70 - 0x7f - (char)0x78,(char)0x79,(char)0x7a,(char)0x7b,(char)0x7c,(char)0x7d,(char)0x7e,(char)0x7f, - (char)0x80,(char)0x81,(char)0x82,(char)0x83,(char)0x84,(char)0x85,(char)0x86,(char)0x87, // 0x80 - 0x8f - (char)0x88,(char)0x89,(char)0x8a,(char)0x8b,(char)0x8c,(char)0x8d,(char)0x8e,(char)0x8f, - (char)0x90,(char)0x91,(char)0x92,(char)0x93,(char)0x94,(char)0x95,(char)0x96,(char)0x97, // 0x90 - 0x9f - (char)0x98,(char)0x99,(char)0x9a,(char)0x9b,(char)0x9c,(char)0x9d,(char)0x9e,(char)0x9f, - (char)0xa0,(char)0xa1,(char)0xa2,(char)0xa3,(char)0xa4,(char)0xa5,(char)0xa6,(char)0xa7, // 0xa0 - 0xaf - (char)0xa8,(char)0xa9,(char)0xaa,(char)0xab,(char)0xac,(char)0xad,(char)0xae,(char)0xaf, - (char)0xb0,(char)0xb1,(char)0xb2,(char)0xb3,(char)0xb4,(char)0xb5,(char)0xb6,(char)0xb7, // 0xb0 - 0xbf - (char)0xb8,(char)0xb9,(char)0xba,(char)0xbb,(char)0xbc,(char)0xbd,(char)0xbe,(char)0xbf, - (char)0xc0,(char)0xc1,(char)0xc2,(char)0xc3,(char)0xc4,(char)0xc5,(char)0xc6,(char)0xc7, // 0xc0 - 0xcf - (char)0xc8,(char)0xc9,(char)0xca,(char)0xcb,(char)0xcc,(char)0xcd,(char)0xce,(char)0xcf, - (char)0xd0,(char)0xd1,(char)0xd2,(char)0xd3,(char)0xd4,(char)0xd5,(char)0xd6,(char)0xd7, // 0xd0 - 0xdf - (char)0xd8,(char)0xd9,(char)0xda,(char)0xdb,(char)0xdc,(char)0xdd,(char)0xde,(char)0xdf, - (char)0xe0,(char)0xe1,(char)0xe2,(char)0xe3,(char)0xe4,(char)0xe5,(char)0xe6,(char)0xe7, // 0xe0 - 0xef - (char)0xe8,(char)0xe9,(char)0xea,(char)0xeb,(char)0xec,(char)0xed,(char)0xee,(char)0xef, - (char)0xf0,(char)0xf1,(char)0xf2,(char)0xf3,(char)0xf4,(char)0xf5,(char)0xf6,(char)0xf7, // 0xf0 - 0xff - (char)0xf8,(char)0xf9,(char)0xfa,(char)0xfb,(char)0xfc,(char)0xfd,(char)0xfe,(char)0xff -}; - -// map A (UK/National) -static char mapA[256] = { - (char)0x00,(char)0x01,(char)0x02,(char)0x03,(char)0x04,(char)0x05,(char)0x06,(char)0x07, // 0x00 - 0x0f - (char)0x08,(char)0x09,(char)0x0a,(char)0x0b,(char)0x0c,(char)0x0d,(char)0x0e,(char)0x0f, - (char)0x10,(char)0x11,(char)0x12,(char)0x13,(char)0x14,(char)0x15,(char)0x16,(char)0x17, // 0x10 - 0x1f - (char)0x18,(char)0x19,(char)0x1a,(char)0x1b,(char)0x1c,(char)0x1d,(char)0x1e,(char)0x1f, - (char)0x20,(char)0x21,(char)0x22,(char)0x9c,(char)0x24,(char)0x25,(char)0x26,(char)0x27, // 0x20 - 0x2f - (char)0x28,(char)0x29,(char)0x2a,(char)0x2b,(char)0x2c,(char)0x2d,(char)0x2e,(char)0x2f, - (char)0x30,(char)0x31,(char)0x32,(char)0x33,(char)0x34,(char)0x35,(char)0x36,(char)0x37, // 0x30 - 0x3f - (char)0x38,(char)0x39,(char)0x3a,(char)0x3b,(char)0x3c,(char)0x3d,(char)0x3e,(char)0x3f, - (char)0x40,(char)0x41,(char)0x42,(char)0x43,(char)0x44,(char)0x45,(char)0x46,(char)0x47, // 0x40 - 0x4f - (char)0x48,(char)0x49,(char)0x4a,(char)0x4b,(char)0x4c,(char)0x4d,(char)0x4e,(char)0x4f, - (char)0x50,(char)0x51,(char)0x52,(char)0x53,(char)0x54,(char)0x55,(char)0x56,(char)0x57, // 0x50 - 0x5f - (char)0x58,(char)0x59,(char)0x5a,(char)0x5b,(char)0x5c,(char)0x5d,(char)0x5e,(char)0x5f, - (char)0x60,(char)0x61,(char)0x62,(char)0x63,(char)0x64,(char)0x65,(char)0x66,(char)0x67, // 0x60 - 0x6f - (char)0x68,(char)0x69,(char)0x6a,(char)0x6b,(char)0x6c,(char)0x6d,(char)0x6e,(char)0x6f, - (char)0x70,(char)0x71,(char)0x72,(char)0x73,(char)0x74,(char)0x75,(char)0x76,(char)0x77, // 0x70 - 0x7f - (char)0x78,(char)0x79,(char)0x7a,(char)0x7b,(char)0x7c,(char)0x7d,(char)0x7e,(char)0x7f, - (char)0x80,(char)0x81,(char)0x82,(char)0x83,(char)0x84,(char)0x85,(char)0x86,(char)0x87, // 0x80 - 0x8f - (char)0x88,(char)0x89,(char)0x8a,(char)0x8b,(char)0x8c,(char)0x8d,(char)0x8e,(char)0x8f, - (char)0x90,(char)0x91,(char)0x92,(char)0x93,(char)0x94,(char)0x95,(char)0x96,(char)0x97, // 0x90 - 0x9f - (char)0x98,(char)0x99,(char)0x9a,(char)0x9b,(char)0x9c,(char)0x9d,(char)0x9e,(char)0x9f, - (char)0xa0,(char)0xa1,(char)0xa2,(char)0xa3,(char)0xa4,(char)0xa5,(char)0xa6,(char)0xa7, // 0xa0 - 0xaf - (char)0xa8,(char)0xa9,(char)0xaa,(char)0xab,(char)0xac,(char)0xad,(char)0xae,(char)0xaf, - (char)0xb0,(char)0xb1,(char)0xb2,(char)0xb3,(char)0xb4,(char)0xb5,(char)0xb6,(char)0xb7, // 0xb0 - 0xbf - (char)0xb8,(char)0xb9,(char)0xba,(char)0xbb,(char)0xbc,(char)0xbd,(char)0xbe,(char)0xbf, - (char)0xc0,(char)0xc1,(char)0xc2,(char)0xc3,(char)0xc4,(char)0xc5,(char)0xc6,(char)0xc7, // 0xc0 - 0xcf - (char)0xc8,(char)0xc9,(char)0xca,(char)0xcb,(char)0xcc,(char)0xcd,(char)0xce,(char)0xcf, - (char)0xd0,(char)0xd1,(char)0xd2,(char)0xd3,(char)0xd4,(char)0xd5,(char)0xd6,(char)0xd7, // 0xd0 - 0xdf - (char)0xd8,(char)0xd9,(char)0xda,(char)0xdb,(char)0xdc,(char)0xdd,(char)0xde,(char)0xdf, - (char)0xe0,(char)0xe1,(char)0xe2,(char)0xe3,(char)0xe4,(char)0xe5,(char)0xe6,(char)0xe7, // 0xe0 - 0xef - (char)0xe8,(char)0xe9,(char)0xea,(char)0xeb,(char)0xec,(char)0xed,(char)0xee,(char)0xef, - (char)0xf0,(char)0xf1,(char)0xf2,(char)0xf3,(char)0xf4,(char)0xf5,(char)0xf6,(char)0xf7, // 0xf0 - 0xff - (char)0xf8,(char)0xf9,(char)0xfa,(char)0xfb,(char)0xfc,(char)0xfd,(char)0xfe,(char)0xff -}; - -// map 0 -// Special graphics and line drawing -static char map0[256] = { - (char)0x00,(char)0x01,(char)0x02,(char)0x03,(char)0x04,(char)0x05,(char)0x06,(char)0x07, // 0x00 - 0x0f - (char)0x08,(char)0x09,(char)0x0a,(char)0x0b,(char)0x0c,(char)0x0d,(char)0x0e,(char)0x0f, - (char)0x10,(char)0x11,(char)0x12,(char)0x13,(char)0x14,(char)0x15,(char)0x16,(char)0x17, // 0x10 - 0x1f - (char)0x18,(char)0x19,(char)0x1a,(char)0x1b,(char)0x1c,(char)0x1d,(char)0x1e,(char)0x1f, - (char)0x20,(char)0x21,(char)0x22,(char)0x23,(char)0x24,(char)0x25,(char)0x26,(char)0x27, // 0x20 - 0x2f - (char)0x28,(char)0x29,(char)0x2a,(char)0x2b,(char)0x2c,(char)0x2d,(char)0x2e,(char)0x2f, - (char)0x30,(char)0x31,(char)0x32,(char)0x33,(char)0x34,(char)0x35,(char)0x36,(char)0x37, // 0x30 - 0x3f - (char)0x38,(char)0x39,(char)0x3a,(char)0x3b,(char)0x3c,(char)0x3d,(char)0x3e,(char)0x3f, - (char)0x40,(char)0x41,(char)0x42,(char)0x43,(char)0x44,(char)0x45,(char)0x46,(char)0x47, // 0x40 - 0x4f - (char)0x48,(char)0x49,(char)0x4a,(char)0x4b,(char)0x4c,(char)0x4d,(char)0x4e,(char)0x4f, - (char)0x50,(char)0x51,(char)0x52,(char)0x53,(char)0x54,(char)0x55,(char)0x56,(char)0x57, // 0x50 - 0x5f - (char)0x58,(char)0x59,(char)0x5a,(char)0x5b,(char)0x04,(char)0x5d,(char)0x5e,(char)0xdb, - (char)0x04,(char)0xb1,(char)0x09,(char)0x0c,(char)0x0d,(char)0x0a,(char)0xf8,(char)0xf1, // 0x60 - 0x6f - (char)0x68,(char)0x0b,(char)0xd9,(char)0xbf,(char)0xda,(char)0xc0,(char)0xc5,(char)0xa9, - (char)0xa9,(char)0xc4,(char)0x5f,(char)0x5f,(char)0xc3,(char)0xb4,(char)0xc1,(char)0xc2, // 0x70 - 0x7f - (char)0xb3,(char)0xf3,(char)0xf2,(char)0xe3,(char)0x2f,(char)0x9c,(char)0xfe,(char)0x7f, - (char)0x80,(char)0x81,(char)0x82,(char)0x83,(char)0x84,(char)0x85,(char)0x86,(char)0x87, // 0x80 - 0x8f - (char)0x88,(char)0x89,(char)0x8a,(char)0x8b,(char)0x8c,(char)0x8d,(char)0x8e,(char)0x8f, - (char)0x90,(char)0x91,(char)0x92,(char)0x93,(char)0x94,(char)0x95,(char)0x96,(char)0x97, // 0x90 - 0x9f - (char)0x98,(char)0x99,(char)0x9a,(char)0x9b,(char)0x9c,(char)0x9d,(char)0x9e,(char)0x9f, - (char)0xa0,(char)0xa1,(char)0xa2,(char)0xa3,(char)0xa4,(char)0xa5,(char)0xa6,(char)0xa7, // 0xa0 - 0xaf - (char)0xa8,(char)0xa9,(char)0xaa,(char)0xab,(char)0xac,(char)0xad,(char)0xae,(char)0xaf, - (char)0xb0,(char)0xb1,(char)0xb2,(char)0xb3,(char)0xb4,(char)0xb5,(char)0xb6,(char)0xb7, // 0xb0 - 0xbf - (char)0xb8,(char)0xb9,(char)0xba,(char)0xbb,(char)0xbc,(char)0xbd,(char)0xbe,(char)0xbf, - (char)0xc0,(char)0xc1,(char)0xc2,(char)0xc3,(char)0xc4,(char)0xc5,(char)0xc6,(char)0xc7, // 0xc0 - 0xcf - (char)0xc8,(char)0xc9,(char)0xca,(char)0xcb,(char)0xcc,(char)0xcd,(char)0xce,(char)0xcf, - (char)0xd0,(char)0xd1,(char)0xd2,(char)0xd3,(char)0xd4,(char)0xd5,(char)0xd6,(char)0xd7, // 0xd0 - 0xdf - (char)0xd8,(char)0xd9,(char)0xda,(char)0xdb,(char)0xdc,(char)0xdd,(char)0xde,(char)0xdf, - (char)0xe0,(char)0xe1,(char)0xe2,(char)0xe3,(char)0xe4,(char)0xe5,(char)0xe6,(char)0xe7, // 0xe0 - 0xef - (char)0xe8,(char)0xe9,(char)0xea,(char)0xeb,(char)0xec,(char)0xed,(char)0xee,(char)0xef, - (char)0xf0,(char)0xf1,(char)0xf2,(char)0xf3,(char)0xf4,(char)0xf5,(char)0xf6,(char)0xf7, // 0xf0 - 0xff - (char)0xf8,(char)0xf9,(char)0xfa,(char)0xfb,(char)0xfc,(char)0xfd,(char)0xfe,(char)0xff -}; - -// map 0 (safe version for being unable to write ROM chars) -// Special graphics and line drawing -static char map0_safe[256] = { - (char)0x00,(char)0x01,(char)0x02,(char)0x03,(char)0x04,(char)0x05,(char)0x06,(char)0x07, // 0x00 - 0x0f - (char)0x08,(char)0x09,(char)0x0a,(char)0x0b,(char)0x0c,(char)0x0d,(char)0x0e,(char)0x0f, - (char)0x10,(char)0x11,(char)0x12,(char)0x13,(char)0x14,(char)0x15,(char)0x16,(char)0x17, // 0x10 - 0x1f - (char)0x18,(char)0x19,(char)0x1a,(char)0x1b,(char)0x1c,(char)0x1d,(char)0x1e,(char)0x1f, - (char)0x20,(char)0x21,(char)0x22,(char)0x23,(char)0x24,(char)0x25,(char)0x26,(char)0x27, // 0x20 - 0x2f - (char)0x28,(char)0x29,(char)0x2a,(char)0x2b,(char)0x2c,(char)0x2d,(char)0x2e,(char)0x2f, - (char)0x30,(char)0x31,(char)0x32,(char)0x33,(char)0x34,(char)0x35,(char)0x36,(char)0x37, // 0x30 - 0x3f - (char)0x38,(char)0x39,(char)0x3a,(char)0x3b,(char)0x3c,(char)0x3d,(char)0x3e,(char)0x3f, - (char)0x40,(char)0x41,(char)0x42,(char)0x43,(char)0x44,(char)0x45,(char)0x46,(char)0x47, // 0x40 - 0x4f - (char)0x48,(char)0x49,(char)0x4a,(char)0x4b,(char)0x4c,(char)0x4d,(char)0x4e,(char)0x4f, - (char)0x50,(char)0x51,(char)0x52,(char)0x53,(char)0x54,(char)0x55,(char)0x56,(char)0x57, // 0x50 - 0x5f - (char)0x58,(char)0x59,(char)0x5a,(char)0x5b,(char)0x04,(char)0x5d,(char)0x5e,(char)0xdb, - (char)0x04,(char)0xb1,(char)0xf8,(char)0xf9,(char)0xfb,(char)0xdb,(char)0xf8,(char)0xf1, // 0x60 - 0x6f - (char)0x68,(char)0xf9,(char)0xd9,(char)0xbf,(char)0xda,(char)0xc0,(char)0xc5,(char)0xa9, - (char)0xa9,(char)0xc4,(char)0x5f,(char)0x5f,(char)0xc3,(char)0xb4,(char)0xc1,(char)0xc2, // 0x70 - 0x7f - (char)0xb3,(char)0xf3,(char)0xf2,(char)0xe3,(char)0x2f,(char)0x9c,(char)0xfe,(char)0x7f, - (char)0x80,(char)0x81,(char)0x82,(char)0x83,(char)0x84,(char)0x85,(char)0x86,(char)0x87, // 0x80 - 0x8f - (char)0x88,(char)0x89,(char)0x8a,(char)0x8b,(char)0x8c,(char)0x8d,(char)0x8e,(char)0x8f, - (char)0x90,(char)0x91,(char)0x92,(char)0x93,(char)0x94,(char)0x95,(char)0x96,(char)0x97, // 0x90 - 0x9f - (char)0x98,(char)0x99,(char)0x9a,(char)0x9b,(char)0x9c,(char)0x9d,(char)0x9e,(char)0x9f, - (char)0xa0,(char)0xa1,(char)0xa2,(char)0xa3,(char)0xa4,(char)0xa5,(char)0xa6,(char)0xa7, // 0xa0 - 0xaf - (char)0xa8,(char)0xa9,(char)0xaa,(char)0xab,(char)0xac,(char)0xad,(char)0xae,(char)0xaf, - (char)0xb0,(char)0xb1,(char)0xb2,(char)0xb3,(char)0xb4,(char)0xb5,(char)0xb6,(char)0xb7, // 0xb0 - 0xbf - (char)0xb8,(char)0xb9,(char)0xba,(char)0xbb,(char)0xbc,(char)0xbd,(char)0xbe,(char)0xbf, - (char)0xc0,(char)0xc1,(char)0xc2,(char)0xc3,(char)0xc4,(char)0xc5,(char)0xc6,(char)0xc7, // 0xc0 - 0xcf - (char)0xc8,(char)0xc9,(char)0xca,(char)0xcb,(char)0xcc,(char)0xcd,(char)0xce,(char)0xcf, - (char)0xd0,(char)0xd1,(char)0xd2,(char)0xd3,(char)0xd4,(char)0xd5,(char)0xd6,(char)0xd7, // 0xd0 - 0xdf - (char)0xd8,(char)0xd9,(char)0xda,(char)0xdb,(char)0xdc,(char)0xdd,(char)0xde,(char)0xdf, - (char)0xe0,(char)0xe1,(char)0xe2,(char)0xe3,(char)0xe4,(char)0xe5,(char)0xe6,(char)0xe7, // 0xe0 - 0xef - (char)0xe8,(char)0xe9,(char)0xea,(char)0xeb,(char)0xec,(char)0xed,(char)0xee,(char)0xef, - (char)0xf0,(char)0xf1,(char)0xf2,(char)0xf3,(char)0xf4,(char)0xf5,(char)0xf6,(char)0xf7, // 0xf0 - 0xff - (char)0xf8,(char)0xf9,(char)0xfa,(char)0xfb,(char)0xfc,(char)0xfd,(char)0xfe,(char)0xff -}; - -TCharmap::TCharmap() { - memset(map, 0, sizeof(map)); - - map[0] = mapB; // default map - map[(unsigned char)'B'] = mapB; - map[(unsigned char)'A'] = mapA; - if(ini.get_fast_write()) { - map[(unsigned char)'0'] = map0_safe; - map[(unsigned char)'2'] = map0_safe; - } else { - map[(unsigned char)'0'] = map0; - map[(unsigned char)'2'] = map0; - } - current_map = map[0]; -} - -TCharmap::~TCharmap() { - for(int j = 0; j < 256; j++) { - if(map[j]) { - // Don't delete static maps! - switch(j) { - case 'B': - case 'A': - case '0': - case '2': - case 0: break; - default: delete map[j]; - } - } - } -} - -void TCharmap::modmap(char pos, char mapchar, char c) { - if(!map[(unsigned char)mapchar]) { - map[(unsigned char)mapchar] = new char[256]; - for(int j = 0; j < 256; j++) map[(unsigned char)mapchar][(unsigned char)pos] = j; - } - map[(unsigned char)mapchar][(unsigned char)pos] = c; -} diff --git a/rosapps/net/telnet/src/tcharmap.h b/rosapps/net/telnet/src/tcharmap.h deleted file mode 100644 index cbc97e3dea6..00000000000 --- a/rosapps/net/telnet/src/tcharmap.h +++ /dev/null @@ -1,41 +0,0 @@ -// This is a simple class to handle character maps -// (Paul Brannan 6/25/98) - -#ifndef __TCHARMAP_H -#define __TCHARMAP_H - -class TCharmap { -private: - char *map[256]; - char *current_map; -public: - TCharmap(); - ~TCharmap(); - - void init() {} - - char translate(char c, char mapchar) { - if(map[(unsigned char)mapchar]) return map[(unsigned char)mapchar][(unsigned char)c]; - return c; - } - char translate(char c) { - return current_map[(unsigned char)c]; - } - - void setmap(char mapchar) { - if(map[(unsigned char)mapchar]) current_map = map[(unsigned char)mapchar]; - } - - void translate_buffer(char *start, char *end) { - while(start < end) { - *start = translate(*start); - start++; - } - } - - void modmap(char pos, char mapchar, char c); - - int enabled; -}; - -#endif diff --git a/rosapps/net/telnet/src/tconsole.cpp b/rosapps/net/telnet/src/tconsole.cpp deleted file mode 100644 index e5e434f0287..00000000000 --- a/rosapps/net/telnet/src/tconsole.cpp +++ /dev/null @@ -1,1008 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -//Telnet Win32 : an ANSI telnet client. -//Copyright (C) 1998-2000 Paul Brannan -//Copyright (C) 1998 I.Ioannou -//Copyright (C) 1997 Brad Johnson -// -//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. -// -//I.Ioannou -//roryt@hol.gr -// -/////////////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// -// Module: tconsole.cpp -// -// Contents: screen functions -// -// Product: telnet -// -// -// Revisions: Mar. 29, 2000 pbranna@clemson (Paul Brannan) -// June 15, 1998 pbranna@clemson.edu -// May 16, 1998 pbranna@clemson.edu -// 05. Sep.1997 roryt@hol.gr (I.Ioannou) -// 11.May,1997 roryt@hol.gr -// 06.April,1997 roryt@hol.gr -// 30.M„rz.1997 Titus_Boxberg@public.uni-hamburg.de -// 5.Dec.1996 jbj@nounname.com -// Version 2.0 -// 02.Apr.1995 igor.milavec@uni-lj.si -// Original code -// -/////////////////////////////////////////////////////////////////////////////// - -#include -#include "tconsole.h" - -// argsused doesn't work on MSVC++ -#ifdef __BORLANDC__ -#pragma argsused -#endif - -TConsole::TConsole(HANDLE h) { - hConsole = h; - - GetConsoleScreenBufferInfo(hConsole, &ConsoleInfo); - - // Start with correct colors - int fg = ini.get_normal_fg(); - int bg = ini.get_normal_bg(); - if(fg == -1) - fg = defaultfg = origfg = ConsoleInfo.wAttributes & 0xF; - else - defaultfg = origfg = fg; - if(bg == -1) - bg = defaultbg = origbg = (ConsoleInfo.wAttributes >> 4) & 0xF; - else - defaultbg = origbg = bg; - wAttributes = fg | (bg << 4); - reverse = blink = underline = false; - SetConsoleTextAttribute(hConsole, wAttributes); - - insert_mode = 0; - - // Set the screen size - SetWindowSize(ini.get_term_width(), ini.get_term_height()); - - iScrollStart = -1; - iScrollEnd = -1; -} - -TConsole::~TConsole() { - wAttributes = origfg | (origbg << 4); - SetCursorPosition(0, CON_HEIGHT); - SetConsoleTextAttribute(hConsole, wAttributes); - WriteCtrlChar('\x0a'); -} - -// Paul Brannan 8/2/98 -void TConsole::SetWindowSize(int width, int height) { - SMALL_RECT sr = { - CON_LEFT, - CON_TOP, - (width == -1) ? CON_RIGHT : CON_LEFT + width - 1, - (height == -1) ? CON_BOTTOM : CON_TOP + height - 1 - }; - ConsoleInfo.dwSize.X = width; - if(ConsoleInfo.dwSize.Y < height) ConsoleInfo.dwSize.Y = height; - SetConsoleScreenBufferSize(hConsole, ConsoleInfo.dwSize); - SetConsoleWindowInfo(hConsole, TRUE, &sr); - SetConsoleScreenBufferSize(hConsole, ConsoleInfo.dwSize); - sync(); -} - -// Paul Brannan 5/15/98 -void TConsole::sync() { - GetConsoleScreenBufferInfo(hConsole, &ConsoleInfo); -} - -void TConsole::HighVideo() { - wAttributes = wAttributes | (unsigned char) 8; -} - -void TConsole::LowVideo() { - wAttributes = wAttributes & (unsigned char) (0xff-8); -} - -void TConsole::Normal() { - // I.Ioannou 11 May 1997 - // Color 7 is correct on some systems (for example Linux) - // but not with others (for example SCO) - // we must preserve the colors : - // 06/04/98 thanks to Paul a .ini parameter from now on - - BlinkOff(); - UnderlineOff(); - if(ini.get_preserve_colors()) { - ReverseOff(); - LowVideo(); - } else { - fg = defaultfg; - bg = defaultbg; - wAttributes = (unsigned char)fg | (bg << 4); - reverse = false; - } -} - -void TConsole::SetForeground(unsigned char wAttrib) { - if(reverse) bg = wAttrib; else fg = wAttrib; - wAttributes = (wAttributes & (unsigned char)0x88) | - (unsigned char)fg | (bg << 4); -} - -void TConsole::SetBackground(unsigned char wAttrib) { - if(reverse) fg = wAttrib; else bg = wAttrib; - wAttributes = (wAttributes & (unsigned char)0x88) | - (unsigned char)fg | (bg << 4); -} - -// As far as I can tell, there's no such thing as blink in Windows Console. -// I tried using some inline asm to turn off high-intensity backgrounds, -// but I got a BSOD. Perhaps there is an undocumented function? -// (Paul Brannan 6/27/98) -void TConsole::BlinkOn() { - blink = 1; - if(underline) { - UlBlinkOn(); - } else { - if(ini.get_blink_bg() != -1) { - wAttributes &= 0x8f; // turn off bg - wAttributes |= ini.get_blink_bg() << 4; - } - if(ini.get_blink_fg() != -1) { - wAttributes &= 0xf8; // turn off fg - wAttributes |= ini.get_blink_fg(); - } - if(ini.get_blink_bg() == -1 && ini.get_blink_fg() == -1) - wAttributes |= 0x80; - } -} - -// Added by I.Ioannou 06 April, 1997 -void TConsole::BlinkOff() { - blink = 0; - if(underline) { - UlBlinkOff(); - } else { - if(ini.get_blink_bg() != -1) { - wAttributes &= 0x8f; // turn off bg - wAttributes |= defaultbg << 4; - } - if(ini.get_blink_fg() != -1) { - wAttributes &= 0xf8; // turn off fg - wAttributes |= defaultfg; - } - if(ini.get_blink_bg() == -1 && ini.get_blink_fg() == -1) - wAttributes &= 0x7f; - } -} - -// Paul Brannan 6/27/98 -void TConsole::UnderlineOn() { - underline = 1; - if(blink) { - UlBlinkOn(); - } else { - if(ini.get_underline_bg() != -1) { - wAttributes &= 0x8f; // turn off bg - wAttributes |= ini.get_underline_bg() << 4; - } - if(ini.get_underline_fg() != -1) { - wAttributes &= 0xf8; // turn off fg - wAttributes |= ini.get_underline_fg(); - } - if(ini.get_underline_bg() == -1 && ini.get_underline_fg() == -1) - wAttributes |= 0x80; - } -} - -// Paul Brannan 6/27/98 -void TConsole::UnderlineOff() { - underline = 0; - if(blink) { - UlBlinkOff(); - } else { - if(ini.get_blink_bg() != -1) { - wAttributes &= 0x8f; // turn off bg - wAttributes |= defaultbg << 4; - } - if(ini.get_blink_fg() != -1) { - wAttributes &= 0xf8; // turn off fg - wAttributes |= defaultfg; - } - if(ini.get_blink_bg() == -1 && ini.get_blink_fg() == -1) - wAttributes &= 0x7f; - } -} - -// Paul Brannan 6/27/98 -void TConsole::UlBlinkOn() { - if(ini.get_ulblink_bg() != -1) { - wAttributes &= 0x8f; // turn off bg - wAttributes |= ini.get_ulblink_bg() << 4; - } - if(ini.get_ulblink_fg() != -1) { - wAttributes &= 0xf8; // turn off fg - wAttributes |= ini.get_ulblink_fg(); - } - if(ini.get_ulblink_bg() == -1 && ini.get_ulblink_fg() == -1) - wAttributes |= 0x80; -} - -// Paul Brannan 6/27/98 -void TConsole::UlBlinkOff() { - if(blink) { - BlinkOn(); - } else if(underline) { - UnderlineOn(); - } else { - Normal(); - } -} - -// Paul Brannan 6/26/98 -void TConsole::Lightbg() { - WORD *pAttributes = new WORD[CON_COLS]; - DWORD Result; - - // Paul Brannan 8/5/98 - // Correction: processing more than one line at a time causes a segfault - // if the screen width != 80 - for(int i = CON_TOP; i <= CON_BOTTOM; i++) { - COORD Coord = {CON_LEFT, i}; - - ReadConsoleOutputAttribute(hConsole, pAttributes, (DWORD)(CON_COLS), - Coord, &Result); - - for(DWORD j = 0; j < Result; j++) pAttributes[j] |= 0x80; - - WriteConsoleOutputAttribute(hConsole, pAttributes, Result, Coord, - &Result); - } - - delete[] pAttributes; // clean up - - wAttributes |= (unsigned char)0x80; - bg |= 8; -} - -// Paul Brannan 6/26/98 -void TConsole::Darkbg() { - WORD *pAttributes = new WORD[CON_COLS]; - DWORD Result; - - // Paul Brannan 8/5/98 - // Correction: processing more than one line at a time causes a segfault - // if the screen width != 80 - for(int i = CON_TOP; i <= CON_BOTTOM; i++) { - COORD Coord = {CON_LEFT, i}; - - ReadConsoleOutputAttribute(hConsole, pAttributes, (DWORD)(CON_COLS), - Coord, &Result); - - for(DWORD j = 0; j < Result; j++) pAttributes[j] &= 0x7f; - - WriteConsoleOutputAttribute(hConsole, pAttributes, Result, Coord, - &Result); - } - - delete[] pAttributes; // clean up - - - wAttributes &= (unsigned char)0x7f; - bg &= 7; -} - -// Added by I.Ioannou 11.May,1997 -void TConsole::ReverseOn() { - if (!reverse) { - reverse = true; - - // atl : forground attributes without the intensity - // ath : backgound attributes without the blink - // bl : the blink state - // ints : the intensity - unsigned char atl = wAttributes & (unsigned char) 0x07; - unsigned char ath = wAttributes & (unsigned char) 0x70; - unsigned char bl = wAttributes & (unsigned char) 0x80; - unsigned char ints = wAttributes & (unsigned char) 0x08; - wAttributes = bl | (atl << 4) | ints | (ath >> 4); - } -} - -// Added by I.Ioannou 11.May,1997 -void TConsole::ReverseOff() { - if (reverse) { - reverse = false; - wAttributes = fg | (bg << 4); - } -} - -unsigned long TConsole::WriteText(const char *pszString, unsigned long cbString) { - DWORD Result; - - if(insert_mode) { - InsertCharacter(cbString); - } - - WriteConsoleOutputCharacter(hConsole, (char *)pszString, cbString, - ConsoleInfo.dwCursorPosition, &Result); - FillConsoleOutputAttribute(hConsole, wAttributes, cbString, - ConsoleInfo.dwCursorPosition, &Result); - return Result; -} - -// Formerly ConWriteString (Paul Brannan 6/28/98) -unsigned long TConsole::WriteStringFast(const char* pszString, unsigned long cbString) { - DWORD Result; - - SetConsoleTextAttribute(hConsole, wAttributes); - - //check to see if the line is longer than the display - if (!getLineWrap() && ((unsigned)CON_CUR_X + cbString) >= (unsigned)CON_COLS) { - // Take care of the last line last colum exception... - // The display scrolls up if you use the normal char out - // function even if you only write to the last place - // on the line. :-( - if ((unsigned)CON_CUR_Y >= (unsigned)CON_HEIGHT) { - unsigned long iFakeResult = cbString; - cbString = CON_COLS - CON_CUR_X - 1; - - // FIX ME !!! This will avoid the exception when cbString - // is <= 0 but still doesn't work :-( - if (cbString > 0) - WriteConsole(hConsole, pszString, cbString, &Result, 0); - - COORD dwBufferCoord; - dwBufferCoord.X = 0; - dwBufferCoord.Y = 0; - - CHAR_INFO ciBuffer; - ciBuffer.Char.AsciiChar = *(pszString+cbString); - ciBuffer.Attributes = wAttributes; - SMALL_RECT srWriteRegion; - srWriteRegion.Top = (SHORT) CON_BOTTOM; - srWriteRegion.Bottom = (SHORT) CON_BOTTOM; - srWriteRegion.Left = (SHORT) CON_RIGHT; - srWriteRegion.Right = (SHORT) CON_RIGHT; - - COORD bufSize = {1,1}; - - WriteConsoleOutput(hConsole, &ciBuffer, bufSize, - dwBufferCoord, &srWriteRegion); - - // We need to update the ConsoleInfo struct now (Paul Brannan 5/9/98) - ConsoleInfo.dwCursorPosition.X = CON_RIGHT; - - return iFakeResult; // Skip the chars that did not fit - } - // just write the line up to the end - else { - int iFakeResult = cbString; - cbString = CON_COLS - CON_CUR_X; - - if(cbString > 0) { - WriteConsole(hConsole, pszString, cbString, &Result, 0); - - // We need to update the ConsoleInfo struct now (Paul Brannan 5/9/98) - ConsoleInfo.dwCursorPosition.X += (unsigned short)Result; - } - - return iFakeResult; // Skip the chars that did not fit - } - } else { - // If custom scrolling is enabled we must take care of it - if(iScrollStart != -1 || iScrollEnd != -1) { - return WriteString(pszString, cbString); - } - - // Apparently VT100 terminals have an invisible "81st" column that - // can hold a cursor until another character is printed. I'm not sure - // exactly how to handle this, but here's a hack (Paul Brannan 5/28/98) - if(ini.get_vt100_mode() && cbString + (unsigned)CON_CUR_X == (unsigned)CON_COLS) { - - cbString--; - if(cbString >= 0) WriteConsole(hConsole, pszString, cbString, &Result, 0); - - COORD dwBufferCoord; - dwBufferCoord.X = 0; - dwBufferCoord.Y = 0; - - CHAR_INFO ciBuffer; - ciBuffer.Char.AsciiChar = *(pszString+cbString); - ciBuffer.Attributes = wAttributes; - SMALL_RECT srWriteRegion; - srWriteRegion.Top = (SHORT) ConsoleInfo.dwCursorPosition.Y; - srWriteRegion.Bottom = (SHORT) ConsoleInfo.dwCursorPosition.Y; - srWriteRegion.Left = (SHORT) CON_RIGHT; - srWriteRegion.Right = (SHORT) CON_RIGHT; - - COORD bufSize = {1,1}; - - WriteConsoleOutput(hConsole, &ciBuffer, bufSize, - dwBufferCoord, &srWriteRegion); - - // Update the ConsoleInfo struct - ConsoleInfo.dwCursorPosition.X = CON_RIGHT + 1; - - return Result + 1; - } - - // normal line will wrap normally or not to the end of buffer - WriteConsole(hConsole, pszString, cbString, &Result, 0); - - // We need to update the ConsoleInfo struct now (Paul Brannan 5/9/98) - // FIX ME!!! This is susceptible to the same problem as above. - // (e.g. we write out 160 characters) - ConsoleInfo.dwCursorPosition.X += (unsigned short)Result; - while(CON_CUR_X > CON_WIDTH) { - ConsoleInfo.dwCursorPosition.X -= ConsoleInfo.dwSize.X; - if((unsigned)CON_CUR_Y < (unsigned)CON_HEIGHT) { - ConsoleInfo.dwCursorPosition.Y++; - } else { - // If we aren't at the bottom of the window, then we need to - // scroll down (Paul Brannan 4/14/2000) - if(ConsoleInfo.srWindow.Bottom < ConsoleInfo.dwSize.Y - 1) { - ConsoleInfo.srWindow.Top++; - ConsoleInfo.srWindow.Bottom++; - ConsoleInfo.dwCursorPosition.Y++; - SetConsoleWindowInfo(hConsole, TRUE, &ConsoleInfo.srWindow); - } - } - } - } - - return Result; - -} - -unsigned long TConsole::WriteString(const char* pszString, unsigned long cbString) { - DWORD Result = 0; - - SetConsoleTextAttribute(hConsole, wAttributes); - - //check to see if the line is longer than the display - if (!getLineWrap()){ - unsigned long iFakeResult = cbString; - if((CON_CUR_X + cbString) >= (unsigned int)CON_COLS) - cbString = CON_COLS - CON_CUR_X; - if(cbString > 0) - Result = WriteText(pszString, cbString); - - // We need to update the ConsoleInfo struct now (Paul Brannan 5/9/98) - ConsoleInfo.dwCursorPosition.X += (unsigned short)Result; - SetConsoleCursorPosition(hConsole, ConsoleInfo.dwCursorPosition); - - return iFakeResult; // Skip the chars that did not fit - } else { - // Write up to the end of the line - unsigned long temp = cbString; - if((CON_CUR_X + temp) > (unsigned int)CON_COLS) { - temp = CON_COLS - CON_CUR_X; - } else { - Result = WriteText(pszString, temp); - ConsoleInfo.dwCursorPosition.X += (unsigned short)Result; - SetConsoleCursorPosition(hConsole, ConsoleInfo.dwCursorPosition); - return Result; - } - if(temp > 0) { - Result = WriteText(pszString, temp); - ConsoleInfo.dwCursorPosition.X += (unsigned short)Result; - temp = (unsigned short)Result; - } - - // keep writing lines until we get to less than 80 chars left - while((temp + (unsigned int)CON_COLS) < cbString) { - index(); // LF - ConsoleInfo.dwCursorPosition.X = 0; // CR - Result = WriteText(&pszString[temp], CON_COLS); - temp += (unsigned short)Result; - } - - // write out the last bit - if(temp < cbString) { - index(); - ConsoleInfo.dwCursorPosition.X = 0; - Result = WriteText(&pszString[temp], cbString - temp); - temp += (unsigned short)Result; - } - - // Apparently VT100 terminals have an invisible "81st" column that - // can hold a cursor until another character is printed. I'm not sure - // exactly how to handle this, but here's a hack (Paul Brannan 5/28/98) - if(!ini.get_vt100_mode() && cbString + (unsigned)ConsoleInfo.dwCursorPosition.X - == (unsigned int)CON_COLS) { - index(); - ConsoleInfo.dwCursorPosition.X = 0; - } - - SetConsoleCursorPosition(hConsole, ConsoleInfo.dwCursorPosition); - - return temp; - } - - return 0; -} - -// This is for multi-character control strings (Paul Brannan 6/26/98) -unsigned long TConsole::WriteCtrlString(const char *pszString, unsigned long cbString) { - unsigned long total = 0; - while(total < cbString) { - unsigned long Result = WriteCtrlChar(*(pszString + total)); - if(Result == 0) { - Result = WriteStringFast(pszString + total, 1); - if(Result == 0) return total; - } - total += Result; - } - return total; -} - -// This is for printing single control characters -// WriteCtrlString uses this (Paul Brannan 6/26/98) -unsigned long TConsole::WriteCtrlChar(char c) { - // The console does not handel the CR/LF chars as we might expect - // when using color. The attributes are not set correctly, so we - // must interpret them manualy to preserve the colors on the screen. - - unsigned long Result = 0; // just in case (Paul Brannan 6/26/98) - switch (c) { - case '\x09': // horizontal tab - SetCursorPosition((((CON_CUR_X/8)+1)*8), CON_CUR_Y); - Result = 1; - break; - - case '\x0a': // line feed - index(); - Result = 1; - break; - case '\x0d': // carrage return - SetCursorPosition(CON_LEFT, CON_CUR_Y); // move to beginning of line - Result = 1; - break; - case '\b': // backspace - // Added support for backspace so the cursor position can be changed - // (Paul Brannan 5/25/98) - MoveCursorPosition(-1, 0); - Result = 1; - default : // else just write it like normal - break; - } - - return Result; -} - -void TConsole::index() { - // if on the last line scroll up - // This must work with scrolling (Paul Brannan 5/13/98) - if(iScrollEnd != -1 && (signed)CON_CUR_Y >= iScrollEnd) { - ScrollDown(iScrollStart, iScrollEnd, -1); - } else if ((iScrollEnd == -1 && (signed)CON_CUR_Y >= (signed)CON_HEIGHT)) { - DWORD Result; - WriteConsole(hConsole, "\n", 1, &Result, NULL); - - // If we aren't at the bottom of the buffer, then we need to - // scroll down (Paul Brannan 4/14/2000) - if(iScrollEnd == -1 && ConsoleInfo.srWindow.Bottom < ConsoleInfo.dwSize.Y - 1) { - ConsoleInfo.srWindow.Top++; - ConsoleInfo.srWindow.Bottom++; - ConsoleInfo.dwCursorPosition.Y++; - // SetConsoleWindowInfo(hConsole, TRUE, &ConsoleInfo.srWindow); - } else { - ClearLine(); - } - } else { // else move cursor down to the next line - SetCursorPosition(CON_CUR_X, CON_CUR_Y + 1); - } -} - -void TConsole::reverse_index() { - // if on the top line scroll down - // This must work with scrolling (Paul Brannan 5/13/98) - // We should be comparing against iScrollStart, not iScrollEnd (PB 12/2/98) - if (iScrollStart == -1 && (signed)CON_CUR_Y <= 0) { - ScrollDown(iScrollStart, -1, 1); - } else if (iScrollStart != -1 && (signed)CON_CUR_Y <= iScrollStart) { - ScrollDown(iScrollStart, iScrollEnd, 1); - } else // else move cursor up to the previous line - SetCursorPosition(CON_CUR_X,CON_CUR_Y - 1); -} - -void TConsole::ScrollDown( int iStartRow , int iEndRow, int bUp ){ - CHAR_INFO ciChar; - SMALL_RECT srScrollWindow; - - // Correction from I.Ioannou 11 May 1997 - // check the scroll region - if (iStartRow < iScrollStart) iStartRow = iScrollStart; - - // Correction from I.Ioannou 11 May 1997 - // this will make Top the CON_TOP - if ( iStartRow == -1) iStartRow = 0; - - // Correction from I.Ioannou 18 Aug 97 - if ( iEndRow == -1) { - if ( iScrollEnd == -1 ) - iEndRow = CON_HEIGHT; - else - iEndRow = ((CON_HEIGHT <= iScrollEnd) ? CON_HEIGHT : iScrollEnd); - } - // - - if ( iStartRow > CON_HEIGHT) iStartRow = CON_HEIGHT; - if ( iEndRow > CON_HEIGHT) iEndRow = CON_HEIGHT; - - srScrollWindow.Left = (CON_LEFT); - srScrollWindow.Right = (SHORT) (CON_RIGHT); - srScrollWindow.Top = (SHORT) (CON_TOP + iStartRow ); - srScrollWindow.Bottom = (SHORT) (CON_TOP + iEndRow); // don't subtract 1 (PB 5/28) - - ciChar.Char.AsciiChar = ' '; // fill with spaces - ciChar.Attributes = wAttributes; // fill with current attrib - - // This should speed things up (Paul Brannan 9/2/98) - COORD dwDestOrg = {srScrollWindow.Left, srScrollWindow.Top + bUp}; - - // Note that iEndRow and iStartRow had better not be equal to -1 at this - // point. There are four cases to consider for out of bounds. Two of - // these cause the scroll window to be cleared; the others cause the - // scroll region to be modified. (Paul Brannan 12/3/98) - if(dwDestOrg.Y > CON_TOP + iEndRow) { - // We are scrolling past the end of the scroll region, so just - // clear the window instead (Paul Brannan 12/3/98) - ClearWindow(CON_TOP + iStartRow, CON_TOP + iEndRow); - return; - } else if(dwDestOrg.Y + (iEndRow-iStartRow+1) < CON_TOP + iStartRow) { - // We are scrolling past the end of the scroll region, so just - // clear the window instead (Paul Brannan 12/3/98) - ClearWindow(CON_TOP + iStartRow, CON_TOP + iEndRow); - return; - } else if(dwDestOrg.Y < CON_TOP + iStartRow) { - // Modify the scroll region (Paul Brannan 12/3/98) - dwDestOrg.Y = CON_TOP + iStartRow; - srScrollWindow.Top -= bUp; - } else if(dwDestOrg.Y + (iEndRow-iStartRow+1) > CON_TOP + iEndRow) { - // Modify the scroll region (Paul Brannan 12/3/98) - srScrollWindow.Bottom -= bUp; - } - - ScrollConsoleScreenBuffer(hConsole, &srScrollWindow, - 0, dwDestOrg, &ciChar); -} - -// This allows us to clear the screen with an arbitrary character -// (Paul Brannan 6/26/98) -void TConsole::ClearScreen(char c) { - DWORD dwWritten; - COORD Coord = {CON_LEFT, CON_TOP}; - FillConsoleOutputCharacter(hConsole, c, (DWORD)(CON_COLS)* - (DWORD)(CON_LINES), Coord, &dwWritten); - FillConsoleOutputAttribute(hConsole, wAttributes, (DWORD)(CON_COLS)* - (DWORD)(CON_LINES), Coord, &dwWritten); -} - -// Same as clear screen, but only affects the scroll region -void TConsole::ClearWindow(int iStartRow, int iEndRow, char c) { - DWORD dwWritten; - COORD Coord = {CON_LEFT, CON_TOP + iStartRow}; - FillConsoleOutputCharacter(hConsole, c, (DWORD)(CON_COLS)* - (DWORD)(iEndRow-iStartRow+1), Coord, &dwWritten); - FillConsoleOutputAttribute(hConsole, wAttributes, (DWORD)(CON_COLS)* - (DWORD)(CON_LINES), Coord, &dwWritten); -} - -// Clear from cursor to end of screen -void TConsole::ClearEOScreen(char c) -{ - DWORD dwWritten; - COORD Coord = {CON_LEFT, CON_TOP + CON_CUR_Y + 1}; - FillConsoleOutputCharacter(hConsole, c, (DWORD)(CON_COLS)* - (DWORD)(CON_HEIGHT - CON_CUR_Y), Coord, &dwWritten); - FillConsoleOutputAttribute(hConsole, wAttributes, (DWORD)(CON_COLS)* - (DWORD)(CON_LINES - CON_CUR_Y), Coord, &dwWritten); - ClearEOLine(); -} - -// Clear from beginning of screen to cursor -void TConsole::ClearBOScreen(char c) -{ - DWORD dwWritten; - COORD Coord = {CON_LEFT, CON_TOP}; - FillConsoleOutputCharacter(hConsole, c, (DWORD)(CON_COLS)* - (DWORD)(CON_CUR_Y), Coord, &dwWritten); - FillConsoleOutputAttribute(hConsole, wAttributes, (DWORD)(CON_COLS)* - (DWORD)(CON_CUR_Y), Coord, &dwWritten); - ClearBOLine(); -} - -void TConsole::ClearLine(char c) -{ - DWORD dwWritten; - COORD Coord = {CON_LEFT, CON_TOP + CON_CUR_Y}; - FillConsoleOutputCharacter(hConsole, c, (DWORD)(CON_COLS), - Coord, &dwWritten); - FillConsoleOutputAttribute(hConsole, wAttributes, (DWORD)(CON_COLS), - Coord, &dwWritten); - GetConsoleScreenBufferInfo(hConsole, &ConsoleInfo); -} - -void TConsole::ClearEOLine(char c) -{ - DWORD dwWritten; - COORD Coord = {CON_LEFT + CON_CUR_X, CON_TOP + CON_CUR_Y}; - FillConsoleOutputAttribute(hConsole, wAttributes, - (DWORD)(CON_RIGHT - CON_CUR_X) +1, Coord, &dwWritten); - FillConsoleOutputCharacter(hConsole, c, (DWORD)(CON_RIGHT - CON_CUR_X) +1, - Coord, &dwWritten); - GetConsoleScreenBufferInfo(hConsole, &ConsoleInfo); -} - -void TConsole::ClearBOLine(char c) -{ - DWORD dwWritten; - COORD Coord = {CON_LEFT, CON_TOP + CON_CUR_Y}; - FillConsoleOutputCharacter(hConsole, c, (DWORD)(CON_CUR_X) + 1, Coord, - &dwWritten); - FillConsoleOutputAttribute(hConsole, wAttributes, (DWORD)(CON_CUR_X) + 1, - Coord, &dwWritten); - GetConsoleScreenBufferInfo(hConsole, &ConsoleInfo); -} - - -// Inserts blank lines to the cursor-y-position -// scrolls down the rest. CURSOR MOVEMENT (to Col#1) ??? -void TConsole::InsertLine(int numlines) -{ - COORD to; - SMALL_RECT from; - SMALL_RECT clip; - CHAR_INFO fill; - int acty; - - // Rest of screen would be deleted - if ( (acty = GetCursorY()) >= CON_LINES - numlines ) { - ClearEOScreen(); // delete rest of screen - return; - } /* IF */ - - // Else scroll down the part of the screen which is below the - // cursor. - from.Left = CON_LEFT; - from.Top = CON_TOP + (SHORT)acty; - from.Right = CON_LEFT + (SHORT)CON_COLS; - from.Bottom = CON_TOP + (SHORT)CON_LINES; - - clip = from; - to.X = 0; - to.Y = (SHORT)(from.Top + numlines); - - fill.Char.AsciiChar = ' '; - fill.Attributes = 7; // WHICH ATTRIBUTES TO TAKE FOR BLANK LINE ?? - - ScrollConsoleScreenBuffer(hConsole, &from, &clip, to, &fill); -} /* InsertLine */ - -// Inserts blank characters under the cursor -void TConsole::InsertCharacter(int numchar) -{ - int actx; - SMALL_RECT from; - SMALL_RECT clip; - COORD to; - CHAR_INFO fill; - - if ( (actx = GetCursorX()) >= CON_COLS - numchar ) { - ClearEOLine(); - return; - } /* IF */ - - from.Left = CON_LEFT + (SHORT)actx; - from.Top = CON_TOP + (SHORT)GetCursorY(); - from.Right = CON_LEFT + (SHORT)CON_COLS; - from.Bottom = CON_TOP + (SHORT)from.Top; - - clip = from; - to.X = (SHORT)(actx + numchar); - to.Y = from.Top; - - fill.Char.AsciiChar = ' '; - fill.Attributes = wAttributes; // WHICH ATTRIBUTES TO TAKE FOR BLANK CHAR ?? - - ScrollConsoleScreenBuffer(hConsole, &from, &clip, to, &fill); -} /* InsertCharacter */ - -// Deletes characters under the cursor -// Note that there are cases in which all the following lines should shift by -// a character, but we don't handle these. This could break some -// VT102-applications, but it shouldn't be too much of an issue. -void TConsole::DeleteCharacter(int numchar) -{ - int actx; - SMALL_RECT from; - SMALL_RECT clip; - COORD to; - CHAR_INFO fill; - - if ( (actx = GetCursorX()) >= CON_COLS - numchar ) { - ClearEOLine(); - return; - } /* IF */ - - from.Left = CON_LEFT + (SHORT)actx; - from.Top = CON_TOP + (SHORT)GetCursorY(); - from.Right = CON_LEFT + (SHORT)CON_COLS; - from.Bottom = CON_TOP + from.Top; - - clip = from; - to.X = (SHORT)(actx - numchar); - to.Y = from.Top; - - fill.Char.AsciiChar = ' '; - fill.Attributes = wAttributes; // WHICH ATTRIBUTES TO TAKE FOR BLANK CHAR ?? - - ScrollConsoleScreenBuffer(hConsole, &from, &clip, to, &fill); -} /* DeleteCharacter */ - -void TConsole::SetRawCursorPosition(int x, int y) { - if (x > CON_WIDTH) x = CON_WIDTH; - if (x < 0) x = 0; - if (y > CON_HEIGHT) y = CON_HEIGHT; - if (y < 0) y = 0; - COORD Coord = {(short)(CON_LEFT + x), (short)(CON_TOP + y)}; - SetConsoleCursorPosition(hConsole, Coord); - - // Update the ConsoleInfo struct (Paul Brannan 5/9/98) - ConsoleInfo.dwCursorPosition.Y = Coord.Y; - ConsoleInfo.dwCursorPosition.X = Coord.X; - - // bug fix in case we went too far (Paul Brannan 5/25/98) - if(ConsoleInfo.dwCursorPosition.X < CON_LEFT) - ConsoleInfo.dwCursorPosition.X = CON_LEFT; - if(ConsoleInfo.dwCursorPosition.X > CON_RIGHT) - ConsoleInfo.dwCursorPosition.X = CON_RIGHT; - if(ConsoleInfo.dwCursorPosition.Y < CON_TOP) - ConsoleInfo.dwCursorPosition.Y = CON_TOP; - if(ConsoleInfo.dwCursorPosition.Y > CON_BOTTOM) - ConsoleInfo.dwCursorPosition.Y = CON_BOTTOM; -} - -// The new SetCursorPosition takes scroll regions into consideration -// (Paul Brannan 6/27/98) -void TConsole::SetCursorPosition(int x, int y) { - if (x > CON_WIDTH) x = CON_WIDTH; - if (x < 0) x = 0; - if(iScrollEnd != -1) { - if(y > iScrollEnd) y = iScrollEnd; - } else { - if(y > CON_HEIGHT) y = CON_HEIGHT; - } - if(iScrollStart != -1) { - if(y < iScrollStart) y = iScrollStart; - } else { - if(y < 0) y = 0; - } - - COORD Coord = {(short)(CON_LEFT + x), (short)(CON_TOP + y)}; - SetConsoleCursorPosition(hConsole, Coord); - - // Update the ConsoleInfo struct - ConsoleInfo.dwCursorPosition.Y = Coord.Y; - ConsoleInfo.dwCursorPosition.X = Coord.X; -} - -void TConsole::MoveCursorPosition(int x, int y) { - SetCursorPosition(CON_CUR_X + x, CON_CUR_Y + y); -} - -void TConsole::SetExtendedMode(int iFunction, BOOL bEnable) -{ - // Probably should do something here... - // Should change the screen mode, but do we need this? -} - -void TConsole::SetScroll(int start, int end) { - iScrollStart = start; - iScrollEnd = end; -} - -void TConsole::Beep() { - if(ini.get_do_beep()) { - if(!ini.get_speaker_beep()) printit("\a"); - else ::Beep(400, 100); - } -} - -void TConsole::SetCursorSize(int pct) { - CONSOLE_CURSOR_INFO ci = {(pct != 0)?pct:1, pct != 0}; - SetConsoleCursorInfo(hConsole, &ci); -} - -void saveScreen(CHAR_INFO *chiBuffer) { - HANDLE hStdout; - CONSOLE_SCREEN_BUFFER_INFO ConsoleInfo; - SMALL_RECT srctReadRect; - COORD coordBufSize; - COORD coordBufCoord; - - hStdout = GetStdHandle(STD_OUTPUT_HANDLE); - GetConsoleScreenBufferInfo(hStdout, &ConsoleInfo); - - srctReadRect.Top = CON_TOP; /* top left: row 0, col 0 */ - srctReadRect.Left = CON_LEFT; - srctReadRect.Bottom = CON_BOTTOM; /* bot. right: row 1, col 79 */ - srctReadRect.Right = CON_RIGHT; - - coordBufSize.Y = CON_BOTTOM-CON_TOP+1; - coordBufSize.X = CON_RIGHT-CON_LEFT+1; - - coordBufCoord.X = CON_TOP; - coordBufCoord.Y = CON_LEFT; - - ReadConsoleOutput( - hStdout, /* screen buffer to read from */ - chiBuffer, /* buffer to copy into */ - coordBufSize, /* col-row size of chiBuffer */ - - coordBufCoord, /* top left dest. cell in chiBuffer */ - &srctReadRect); /* screen buffer source rectangle */ -} - -void restoreScreen(CHAR_INFO *chiBuffer) { - HANDLE hStdout; - CONSOLE_SCREEN_BUFFER_INFO ConsoleInfo; - SMALL_RECT srctReadRect; - COORD coordBufSize; - COORD coordBufCoord; - - hStdout = GetStdHandle(STD_OUTPUT_HANDLE); - GetConsoleScreenBufferInfo(hStdout, &ConsoleInfo); - - // restore screen - srctReadRect.Top = CON_TOP; /* top left: row 0, col 0 */ - srctReadRect.Left = CON_LEFT; - srctReadRect.Bottom = CON_BOTTOM; /* bot. right: row 1, col 79 */ - srctReadRect.Right = CON_RIGHT; - - coordBufSize.Y = CON_BOTTOM-CON_TOP+1; - coordBufSize.X = CON_RIGHT-CON_LEFT+1; - - coordBufCoord.X = CON_TOP; - coordBufCoord.Y = CON_LEFT; - WriteConsoleOutput( - hStdout, /* screen buffer to write to */ - chiBuffer, /* buffer to copy from */ - coordBufSize, /* col-row size of chiBuffer */ - coordBufCoord, /* top left src cell in chiBuffer */ - &srctReadRect); /* dest. screen buffer rectangle */ - // end restore screen - -} - -CHAR_INFO* newBuffer() { - CONSOLE_SCREEN_BUFFER_INFO ConsoleInfo; - HANDLE hStdout = GetStdHandle(STD_OUTPUT_HANDLE); - GetConsoleScreenBufferInfo(hStdout, &ConsoleInfo); - CHAR_INFO * chiBuffer; - chiBuffer = new CHAR_INFO[(CON_BOTTOM-CON_TOP+1)*(CON_RIGHT-CON_LEFT+1)]; - return chiBuffer; -} - -void deleteBuffer(CHAR_INFO* chiBuffer) { - delete[] chiBuffer; -} - diff --git a/rosapps/net/telnet/src/tconsole.h b/rosapps/net/telnet/src/tconsole.h deleted file mode 100644 index 599fd2b4795..00000000000 --- a/rosapps/net/telnet/src/tconsole.h +++ /dev/null @@ -1,172 +0,0 @@ -#ifndef __TNPARSER_H -#define __TNPARSER_H - -#include "tnconfig.h" - -/* A diagram of the following values: - * - * (0,0) - * +----------------------------------------+ - * | | - * | | - * | | - * | | - * | | - * | | - * | | - * | | - * | | - * | | - * | | - * | | - * | | - * | CON_TOP | - * +---------------------------+.....?......| --- - * | . | | | - * | . | <-- OR --> | | - * | . | | | - * CON_LEFT | . | CON_RIGHT | - * (=0) | . | (=CON_ | CON_LINES - * |..............* | WIDTH) | - * | (CON_CUR_X, | | | - * | CON_CUR_Y) | | | - * | | | | - * | | | | - * | | | | - * +---------------------------+------------+ --- - * CON_BOTTOM (=CON_TOP + CON_HEIGHT) - * - * |--------- CON_COLS --------| - * - * Keep in mind that CON_TOP, CON_BOTTOM, CON_LEFT, and CON_RIGHT are relative - * to zero, but CON_CUR_X, CON_CUR_Y, CON_WIDTH, and CON_HEIGHT are relative to - * CON_TOP and CON_LEFT - */ - -#define CON_TOP ConsoleInfo.srWindow.Top -#define CON_BOTTOM ConsoleInfo.srWindow.Bottom - -#define CON_LEFT 0 -#define CON_RIGHT (ConsoleInfo.dwSize.X - 1) - -#define CON_HEIGHT (CON_BOTTOM - CON_TOP) -#define CON_WIDTH (CON_RIGHT - CON_LEFT) -#define CON_LINES (CON_HEIGHT + 1) -#define CON_COLS (CON_WIDTH + 1) - -#define CON_CUR_X (ConsoleInfo.dwCursorPosition.X - CON_LEFT) -#define CON_CUR_Y (ConsoleInfo.dwCursorPosition.Y - CON_TOP) - - -class TConsole { -public: - TConsole(HANDLE hConsole); - ~TConsole(); - void sync(); - - // Cursor movement routines - int GetRawCursorX() {return CON_CUR_X;} - int GetRawCursorY() {return CON_CUR_Y;} - int GetCursorX() {return CON_CUR_X;} - int GetCursorY() { - if(iScrollStart != -1) - return CON_CUR_Y - iScrollStart; - return GetRawCursorY(); - } - void SetRawCursorPosition(int x, int y); - void SetCursorPosition(int x, int y); - void SetCursorSize(int pct); - void MoveCursorPosition(int x, int y); - - // Screen mode/size routines - int GetWidth() {return CON_COLS;} - int GetHeight() {return CON_LINES;} - void SetExtendedMode(int iFunction, BOOL bEnable); - void SetWindowSize(int width, int height); // Set the size of the window, - // but not the buffer - - // Color/attribute routines - void SetAttrib(unsigned char wAttr) {wAttributes = wAttr;} - unsigned char GetAttrib() {return wAttributes;} - void Normal(); // Reset all attributes - void HighVideo(); // Aka "bold" - void LowVideo(); - void SetForeground(unsigned char wAttrib); // Set the foreground directly - void SetBackground(unsigned char wAttrib); - void BlinkOn(); // Blink on/off - void BlinkOff(); - void UnderlineOn(); // Underline on/off - void UnderlineOff(); - void UlBlinkOn(); // Blink+Underline on/off - void UlBlinkOff(); - void ReverseOn(); // Reverse on/off - void ReverseOff(); - void Lightbg(); // High-intensity background - void Darkbg(); // Low-intensity background - void setDefaultFg(unsigned char u) {defaultfg = u;} - void setDefaultBg(unsigned char u) {defaultbg = u;} - - // Text output routines - unsigned long WriteText(const char *pszString, unsigned long cbString); - unsigned long WriteString(const char* pszString, unsigned long cbString); - unsigned long WriteStringFast(const char *pszString, unsigned long cbString); - unsigned long WriteCtrlString(const char* pszString, unsigned long cbString); - unsigned long WriteCtrlChar(char c); - unsigned long NetWriteString(const char* pszString, unsigned long cbString); - - // Clear screen/screen area functions - void ClearScreen(char c = ' '); - void ClearWindow(int start, int end, char c = ' '); - void ClearEOScreen(char c = ' '); - void ClearBOScreen(char c = ' '); - void ClearLine(char c = ' '); - void ClearEOLine(char c = ' '); - void ClearBOLine(char c = ' '); - - // Scrolling and text output control functions - void SetScroll(int start, int end); - void ScrollDown(int iStartRow , int iEndRow, int bUp); - void ScrollAll(int bUp) {ScrollDown(iScrollStart, iScrollEnd, bUp);} - void index(); - void reverse_index(); - void setLineWrap(bool bEnabled){ - if(!ini.get_lock_linewrap()) - ini.set_value("Wrap_Line", bEnabled ? "true" : "false"); - } - bool getLineWrap() {return ini.get_wrapline();} - - // Insert/delete characters/lines - void InsertLine(int numlines); // Added by Titus von Boxberg 30/3/97 - void InsertCharacter(int numchar); // " - void DeleteCharacter(int numchar); // " - void InsertMode(int i) {insert_mode = i;} - - // Miscellaneous functions - void Beep(); - -protected: - HANDLE hConsole; - - CONSOLE_SCREEN_BUFFER_INFO ConsoleInfo; - - unsigned char wAttributes; - unsigned char fg, bg; - unsigned char defaultfg, defaultbg; - unsigned char origfg, origbg; - - bool blink; - bool underline; - bool reverse; - - int iScrollStart; - int iScrollEnd; - int insert_mode; -}; - -// Non-member functions for saving state -- used by the scrollback buffer viewer -void saveScreen(CHAR_INFO* chiBuffer); -void restoreScreen(CHAR_INFO* chiBuffer); -CHAR_INFO* newBuffer(); -void deleteBuffer(CHAR_INFO* chiBuffer); - -#endif diff --git a/rosapps/net/telnet/src/telnet.h b/rosapps/net/telnet/src/telnet.h deleted file mode 100644 index dbb2cdedc3b..00000000000 --- a/rosapps/net/telnet/src/telnet.h +++ /dev/null @@ -1,305 +0,0 @@ -#ifndef ___TELNET_H -#define ___TELNET_H - -/* -* Copyright (c) 1983 Regents of the University of California. -* All rights reserved. -* -* Redistribution and use in source and binary forms are permitted provided -* that: (1) source distributions retain this entire copyright notice and -* comment, and (2) distributions including binaries display the following -* acknowledgement: ``This product includes software developed by the -* University of California, Berkeley and its contributors'' in the -* documentation or other materials provided with the distribution and in -* all advertising materials mentioning features or use of this software. -* Neither the name of the University nor the names of its contributors may -* be used to endorse or promote products derived from this software without -* specific prior written permission. -* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED -* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF -* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -* -* @(#)telnet.h 5.12 (Berkeley) 3/5/91 -*/ - -// This file modified 5/15/98 by Paul Brannan. -// Added (unsigned char) to the #defines. -// Formatted for readability. - -/* -* Definitions for the TELNET protocol. -*/ -#define IAC (unsigned char)255 /* interpret as command: */ -#define DONT (unsigned char)254 /* you are not to use option */ -#define DO (unsigned char)253 /* please, you use option */ -#define WONT (unsigned char)252 /* I won't use option */ -#define WILL (unsigned char)251 /* I will use option */ -#define SB (unsigned char)250 /* interpret as subnegotiation */ -#define GA (unsigned char)249 /* you may reverse the line */ -#define EL (unsigned char)248 /* erase the current line */ -#define EC (unsigned char)247 /* erase the current character */ -#define AYT (unsigned char)246 /* are you there */ -#define AO (unsigned char)245 /* abort output--but let prog finish */ -#define IP (unsigned char)244 /* interrupt process--permanently */ -#define BREAK (unsigned char)243 /* break */ -#define DM (unsigned char)242 /* data mark--for connect. cleaning */ -#define NOP (unsigned char)241 /* nop */ -#define SE (unsigned char)240 /* end sub negotiation */ -#define EOR (unsigned char)239 /* end of record (transparent mode) */ -#define ABORT (unsigned char)238 /* Abort process */ -#define SUSP (unsigned char)237 /* Suspend process */ -#define xEOF (unsigned char)236 /* End of file: EOF is already used... */ - -#define SYNCH (unsigned char)242 /* for telfunc calls */ - -#ifdef TELCMDS -char *telcmds[] = { - "EOF", "SUSP", "ABORT", "EOR", - "SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC", - "EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC", 0, -}; -#else -extern char *telcmds[]; -#endif - -#define TELCMD_FIRST xEOF -#define TELCMD_LAST IAC -#define TELCMD_OK(x) ((x) <= TELCMD_LAST && (x) >= TELCMD_FIRST) -#define TELCMD(x) telcmds[(x)-TELCMD_FIRST] - -/* telnet options */ -#define TELOPT_BINARY (unsigned char)0 /* 8-bit data path */ -#define TELOPT_ECHO (unsigned char)1 /* echo */ -#define TELOPT_RCP (unsigned char)2 /* prepare to reconnect */ -#define TELOPT_SGA (unsigned char)3 /* suppress go ahead */ -#define TELOPT_NAMS (unsigned char)4 /* approximate message size */ -#define TELOPT_STATUS (unsigned char)5 /* give status */ -#define TELOPT_TM (unsigned char)6 /* timing mark */ -#define TELOPT_RCTE (unsigned char)7 /* remote controlled transmission and echo */ -#define TELOPT_NAOL (unsigned char)8 /* negotiate about output line width */ -#define TELOPT_NAOP (unsigned char)9 /* negotiate about output page size */ -#define TELOPT_NAOCRD (unsigned char)10 /* negotiate about CR disposition */ -#define TELOPT_NAOHTS (unsigned char)11 /* negotiate about horizontal tabstops */ -#define TELOPT_NAOHTD (unsigned char)12 /* negotiate about horizontal tab disposition */ -#define TELOPT_NAOFFD (unsigned char)13 /* negotiate about formfeed disposition */ -#define TELOPT_NAOVTS (unsigned char)14 /* negotiate about vertical tab stops */ -#define TELOPT_NAOVTD (unsigned char)15 /* negotiate about vertical tab disposition */ -#define TELOPT_NAOLFD (unsigned char)16 /* negotiate about output LF disposition */ -#define TELOPT_XASCII (unsigned char)17 /* extended ascic character set */ -#define TELOPT_LOGOUT (unsigned char)18 /* force logout */ -#define TELOPT_BM (unsigned char)19 /* byte macro */ -#define TELOPT_DET (unsigned char)20 /* data entry terminal */ -#define TELOPT_SUPDUP (unsigned char)21 /* supdup protocol */ -#define TELOPT_SUPDUPOUTPUT (unsigned char)22 /* supdup output */ -#define TELOPT_SNDLOC (unsigned char)23 /* send location */ -#define TELOPT_TTYPE (unsigned char)24 /* terminal type */ -#define TELOPT_EOR (unsigned char)25 /* end or record */ -#define TELOPT_TUID (unsigned char)26 /* TACACS user identification */ -#define TELOPT_OUTMRK (unsigned char)27 /* output marking */ -#define TELOPT_TTYLOC (unsigned char)28 /* terminal location number */ -#define TELOPT_3270REGIME (unsigned char)29 /* 3270 regime */ -#define TELOPT_X3PAD (unsigned char)30 /* X.3 PAD */ -#define TELOPT_NAWS (unsigned char)31 /* window size */ -#define TELOPT_TSPEED (unsigned char)32 /* terminal speed */ -#define TELOPT_LFLOW (unsigned char)33 /* remote flow control */ -#define TELOPT_LINEMODE (unsigned char)34 /* Linemode option */ -#define TELOPT_XDISPLOC (unsigned char)35 /* X Display Location */ -#define TELOPT_ENVIRON (unsigned char)36 /* Environment variables */ -#define TELOPT_AUTHENTICATION (unsigned char)37 /* Authenticate */ -#define TELOPT_ENCRYPT (unsigned char)38 /* Encryption option */ -#define TELOPT_EXOPL (unsigned char)255 /* extended-options-list */ - - -#define NTELOPTS (1+TELOPT_ENCRYPT) -#ifdef TELOPTS -char *telopts[NTELOPTS+1] = { - "BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME", - "STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP", - "NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS", - "NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO", - "DATA ENTRY TERMINAL", "SUPDUP", "SUPDUP OUTPUT", - "SEND LOCATION", "TERMINAL TYPE", "END OF RECORD", - "TACACS UID", "OUTPUT MARKING", "TTYLOC", - "3270 REGIME", "X.3 PAD", "NAWS", "TSPEED", "LFLOW", - "LINEMODE", "XDISPLOC", "ENVIRON", "AUTHENTICATION", - "ENCRYPT", - 0, -}; -#define TELOPT_FIRST TELOPT_BINARY -#define TELOPT_LAST TELOPT_ENCRYPT -#define TELOPT_OK(x) ((x) <= TELOPT_LAST && (x) >= TELOPT_FIRST) -#define TELOPT(x) telopts[(x)-TELOPT_FIRST] -#endif - -/* sub-option qualifiers */ -#define TELQUAL_IS (unsigned char)0 /* option is... */ -#define TELQUAL_SEND (unsigned char)1 /* send option */ -#define TELQUAL_INFO (unsigned char)2 /* ENVIRON: informational version of IS */ -#define TELQUAL_REPLY (unsigned char)2 /* AUTHENTICATION: client version of IS */ -#define TELQUAL_NAME (unsigned char)3 /* AUTHENTICATION: client version of IS */ - -/* -* LINEMODE suboptions -*/ - -#define LM_MODE 1 -#define LM_FORWARDMASK 2 -#define LM_SLC 3 - -#define MODE_EDIT 0x01 -#define MODE_TRAPSIG 0x02 -#define MODE_ACK 0x04 -#define MODE_SOFT_TAB 0x08 -#define MODE_LIT_ECHO 0x10 - -#define MODE_MASK 0x1f - -/* Not part of protocol, but needed to simplify things... */ -#define MODE_FLOW 0x0100 -#define MODE_ECHO 0x0200 -#define MODE_INBIN 0x0400 -#define MODE_OUTBIN 0x0800 -#define MODE_FORCE 0x1000 - -#define SLC_SYNCH 1 -#define SLC_BRK 2 -#define SLC_IP 3 -#define SLC_AO 4 -#define SLC_AYT 5 -#define SLC_EOR 6 -#define SLC_ABORT 7 -#define SLC_EOF 8 -#define SLC_SUSP 9 -#define SLC_EC 10 -#define SLC_EL 11 -#define SLC_EW 12 -#define SLC_RP 13 -#define SLC_LNEXT 14 -#define SLC_XON 15 -#define SLC_XOFF 16 -#define SLC_FORW1 17 -#define SLC_FORW2 18 - -#define NSLC 18 - -/* -* For backwards compatability, we define SLC_NAMES to be the -* list of names if SLC_NAMES is not defined. -*/ -#define SLC_NAMELIST "0", "SYNCH", "BRK", "IP", "AO", "AYT", "EOR", \ - "ABORT", "EOF", "SUSP", "EC", "EL", "EW", "RP", \ -"LNEXT", "XON", "XOFF", "FORW1", "FORW2", 0, -#ifdef SLC_NAMES -//char *slc_names[] = { -// SLC_NAMELIST -//}; -#else -extern char *slc_names[]; -#define SLC_NAMES SLC_NAMELIST -#endif - -#define SLC_NAME_OK(x) ((x) >= 0 && (x) < NSLC) -#define SLC_NAME(x) slc_names[x] - -#define SLC_NOSUPPORT 0 -#define SLC_CANTCHANGE 1 -#define SLC_VARIABLE 2 -#define SLC_DEFAULT 3 -#define SLC_LEVELBITS 0x03 - -#define SLC_FUNC 0 -#define SLC_FLAGS 1 -#define SLC_VALUE 2 - -#define SLC_ACK 0x80 -#define SLC_FLUSHIN 0x40 -#define SLC_FLUSHOUT 0x20 - -#define ENV_VALUE 0 -#define ENV_VAR 1 -#define ENV_ESC 2 - -/* -* AUTHENTICATION suboptions -*/ - -/* -* Who is authenticating who ... -*/ -#define AUTH_WHO_CLIENT 0 /* Client authenticating server */ -#define AUTH_WHO_SERVER 1 /* Server authenticating client */ -#define AUTH_WHO_MASK 1 - -/* -* amount of authentication done -*/ -#define AUTH_HOW_ONE_WAY 0 -#define AUTH_HOW_MUTUAL 2 -#define AUTH_HOW_MASK 2 - -#define AUTHTYPE_NULL 0 -#define AUTHTYPE_KERBEROS_V4 1 -#define AUTHTYPE_KERBEROS_V5 2 -#define AUTHTYPE_SPX 3 -#define AUTHTYPE_MINK 4 -#define AUTHTYPE_CNT 5 - -#define AUTHTYPE_TEST 99 - -#ifdef AUTH_NAMES -char *authtype_names[] = { - "NULL", "KERBEROS_V4", "KERBEROS_V5", "SPX", "MINK", 0, -}; -#else -extern char *authtype_names[]; -#endif - -#define AUTHTYPE_NAME_OK(x) ((x) >= 0 && (x) < AUTHTYPE_CNT) -#define AUTHTYPE_NAME(x) authtype_names[x] - -/* -* ENCRYPTion suboptions -*/ -#define ENCRYPT_IS 0 /* I pick encryption type ... */ -#define ENCRYPT_SUPPORT 1 /* I support encryption types ... */ -#define ENCRYPT_REPLY 2 /* Initial setup response */ -#define ENCRYPT_START 3 /* Am starting to send encrypted */ -#define ENCRYPT_END 4 /* Am ending encrypted */ -#define ENCRYPT_REQSTART 5 /* Request you start encrypting */ -#define ENCRYPT_REQEND 6 /* Request you send encrypting */ -#define ENCRYPT_ENC_KEYID 7 -#define ENCRYPT_DEC_KEYID 8 -#define ENCRYPT_CNT 9 - -#define ENCTYPE_ANY 0 -#define ENCTYPE_DES_CFB64 1 -#define ENCTYPE_DES_OFB64 2 -#define ENCTYPE_CNT 3 - -#ifdef ENCRYPT_NAMES -char *encrypt_names[] = { - "IS", "SUPPORT", "REPLY", "START", "END", - "REQUEST-START", "REQUEST-END", "ENC-KEYID", "DEC-KEYID", - 0, -}; -char *enctype_names[] = { - "ANY", "DES_CFB64", "DES_OFB64", 0, -}; -#else -extern char *encrypt_names[]; -extern char *enctype_names[]; -#endif - - -#define ENCRYPT_NAME_OK(x) ((x) >= 0 && (x) < ENCRYPT_CNT) -#define ENCRYPT_NAME(x) encrypt_names[x] - -#define ENCTYPE_NAME_OK(x) ((x) >= 0 && (x) < ENCTYPE_CNT) -#define ENCTYPE_NAME(x) enctype_names[x] -////////////////////////////////////////////////////// -////////////////////////////////////////////////////// - - - -#endif - diff --git a/rosapps/net/telnet/src/tkeydef.cpp b/rosapps/net/telnet/src/tkeydef.cpp deleted file mode 100644 index e1803271826..00000000000 --- a/rosapps/net/telnet/src/tkeydef.cpp +++ /dev/null @@ -1,136 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -//Telnet Win32 : an ANSI telnet client. -//Copyright (C) 1998-2000 Paul Brannan -//Copyright (C) 1998 I.Ioannou -//Copyright (C) 1997 Brad Johnson -// -//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. -// -//I.Ioannou -//roryt@hol.gr -// -/////////////////////////////////////////////////////////////////////////// - -///////////////////////////////////////////////////////// -// Class TkeyDef - Key Definitions // -// - kept in an array container // -// originally part of KeyTrans.cpp // -///////////////////////////////////////////////////////// - -#include "tkeydef.h" -#include - -// This class did not properly release memory before, and a buffer overrun -// was apparent in operator=(char*). Fixed. (Paul Brannan Feb. 4, 1999) - -TKeyDef::TKeyDef() { - uKeyDef.szKeyDef = 0; - vk_code = dwState = 0; -} - -TKeyDef::TKeyDef(char *def, DWORD state, DWORD code) { - uKeyDef.szKeyDef = 0; - if (def != NULL && *def != 0) { - // szKeyDef = (char *) GlobalAlloc(GPTR, strlen(def) +1); - uKeyDef.szKeyDef = new char[strlen(def)+1]; - strcpy(uKeyDef.szKeyDef, def); - } - dwState = state; - vk_code = code; -} - -TKeyDef::TKeyDef(optype op, DWORD state, DWORD code) { - uKeyDef.op = new optype; - uKeyDef.op->sendstr = 0; - uKeyDef.op->the_op = op.the_op; - dwState = state; - vk_code = code; -} - -TKeyDef::TKeyDef(const TKeyDef &t) { - if(t.uKeyDef.szKeyDef == NULL) { - uKeyDef.szKeyDef = (char *)NULL; - } else if(t.uKeyDef.op->sendstr == 0) { - uKeyDef.op = new optype; - uKeyDef.op->sendstr = 0; - uKeyDef.op->the_op = t.uKeyDef.op->the_op; - } else { - uKeyDef.szKeyDef = new char[strlen(t.uKeyDef.szKeyDef)+1]; - strcpy(uKeyDef.szKeyDef, t.uKeyDef.szKeyDef); - } - dwState = t.dwState; - vk_code = t.vk_code; -} - -TKeyDef::~TKeyDef() { - if(uKeyDef.szKeyDef) delete[] uKeyDef.szKeyDef; -} - -char * TKeyDef::operator=(char *def) { - if(def != NULL && *def != 0) { - if(uKeyDef.szKeyDef) delete[] uKeyDef.szKeyDef; - uKeyDef.szKeyDef = new char[strlen(def)+1]; - strcpy(uKeyDef.szKeyDef, def); - } - return uKeyDef.szKeyDef; -} - -DWORD TKeyDef::operator=(DWORD code) { - return vk_code = code; -} - -TKeyDef& TKeyDef::operator=(const TKeyDef &t) { - if(t.uKeyDef.szKeyDef) { - if(uKeyDef.szKeyDef) delete[] uKeyDef.szKeyDef; - if(t.uKeyDef.op->sendstr) { - uKeyDef.szKeyDef = new char[strlen(t.uKeyDef.szKeyDef)+1]; - strcpy(uKeyDef.szKeyDef, t.uKeyDef.szKeyDef); - } else { - uKeyDef.op = new optype; - uKeyDef.op->sendstr = 0; - uKeyDef.op->the_op = t.uKeyDef.op->the_op; - } - } else { - uKeyDef.szKeyDef = (char *)NULL; - } - dwState = t.dwState; - vk_code = t.vk_code; - return *this; -} - -const optype& TKeyDef::operator=(optype op) { - uKeyDef.op = new optype; - uKeyDef.op->sendstr = 0; - uKeyDef.op->the_op = op.the_op; - return *uKeyDef.op; -} - -// STL requires that operators be friends rather than member functions -// (Paul Brannan 5/25/98) -#ifndef __BORLANDC__ -bool operator==(const TKeyDef & t1, const TKeyDef & t2) { - return ((t1.vk_code == t2.vk_code) && (t1.dwState == t2.dwState)); -} -// We need this function for compatibility with STL (Paul Brannan 5/25/98) -bool operator< (const TKeyDef& t1, const TKeyDef& t2) { - if (t1.vk_code == t2.vk_code) return t1.dwState < t2.dwState; - return t1.vk_code < t2.vk_code; -} -#else -int TKeyDef::operator==(TKeyDef & t) { - return ((vk_code == t.vk_code) && (dwState == t.dwState)); -} -#endif - diff --git a/rosapps/net/telnet/src/tkeydef.h b/rosapps/net/telnet/src/tkeydef.h deleted file mode 100644 index c40ba33a47f..00000000000 --- a/rosapps/net/telnet/src/tkeydef.h +++ /dev/null @@ -1,71 +0,0 @@ -///////////////////////////////////////////////////////// -// TkeyDef - Key Definitions class // -// - keeped in an array container // -///////////////////////////////////////////////////////// - -#ifndef __TKEYDEF_H -#define __TKEYDEF_H - -#include - -#ifndef __BORLANDC__ // Ioannou Dec. 8, 1998 -// We need these for MSVC6 (Sam Robertson Oct. 8, 1998) -class TKeyDef; -bool operator==(const TKeyDef &t1, const TKeyDef &t2); -bool operator<(const TKeyDef &t1, const TKeyDef &t2); -//// -#endif - -// Paul Brannan Feb. 5, 1999 -enum tn_ops {TN_ESCAPE, TN_SCROLLBACK, TN_DIAL, TN_PASTE, TN_NULL, TN_CR, TN_CRLF}; - -typedef struct { - char sendstr; - tn_ops the_op; -} optype; - -union KeyDefType { - char *szKeyDef; - optype *op; -}; - -union KeyDefType_const { - const char *szKeyDef; - const optype *op; -}; - -class TKeyDef { -private: - KeyDefType uKeyDef; - DWORD vk_code; - DWORD dwState; - -public: - TKeyDef(); - TKeyDef(char *def, DWORD state, DWORD code); - TKeyDef(optype op, DWORD state, DWORD code); - TKeyDef(const TKeyDef &t); - - char *operator=(char *def); - DWORD operator=(DWORD code); - TKeyDef& operator=(const TKeyDef &t); - const optype& operator=(optype op); - - ~TKeyDef(); - -#ifdef __BORLANDC__ - int operator==(TKeyDef &t); -#else - // made these into friends for compatibility with stl - // (Paul Brannan 5/7/98) - friend bool operator==(const TKeyDef &t1, const TKeyDef &t2); - friend bool operator<(const TKeyDef &t1, const TKeyDef &t2); -#endif - - const char *GetszKey() { return uKeyDef.szKeyDef; } - const KeyDefType GetKeyDef() { return uKeyDef; } - DWORD GetCodeKey() { return vk_code; } - -}; - -#endif diff --git a/rosapps/net/telnet/src/tkeymap.cpp b/rosapps/net/telnet/src/tkeymap.cpp deleted file mode 100644 index e1730f5a8bf..00000000000 --- a/rosapps/net/telnet/src/tkeymap.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -//Telnet Win32 : an ANSI telnet client. -//Copyright (C) 1998-2000 Paul Brannan -//Copyright (C) 1998 I.Ioannou -//Copyright (C) 1997 Brad Johnson -// -//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. -// -//I.Ioannou -//roryt@hol.gr -// -/////////////////////////////////////////////////////////////////////////// - -///////////////////////////////////////////////////////// -// Class TkeyMap - Key Mappings // -// - kept in an array container // -// originally part of KeyTrans.cpp // -///////////////////////////////////////////////////////// - -#include "tkeymap.h" - -KeyMap::KeyMap(DWORD state, DWORD code): map(0,0,sizeof(TKeyDef)), - key(NULL,state,code) {}; - -KeyMap::KeyMap(TKeyDef&tk):map(0,0,sizeof(TKeyDef)){ - key = tk; -}; -KeyMap::KeyMap(TKeyDef&tk, string& t):map(0,0,sizeof(TKeyDef)), orig(t){ - key = tk; -}; - -int KeyMap::operator==(const KeyMap & t) const{ - return key == t.key; -}; - -KeyMap& KeyMap::operator = (const KeyMap& t){ - key = t.key; - map = t.map; - orig = t.orig; - return (*this); -}; - -#ifndef __BORLANDC__ -bool operator<(const KeyMap &t1, const KeyMap &t2) { - return t1.key < t2.key; -} -#endif - -KeyMap::~KeyMap() { -}; diff --git a/rosapps/net/telnet/src/tkeymap.h b/rosapps/net/telnet/src/tkeymap.h deleted file mode 100644 index 01258fe5307..00000000000 --- a/rosapps/net/telnet/src/tkeymap.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef __TKEYMAP_H -#define __TKEYMAP_H - -#ifdef __BORLANDC__ -#include -#else -#include -#include "stl_bids.h" -#endif - -#include "tkeydef.h" - -//AVS -typedef TArrayAsVector keyArray; - -//AVS -// representation of keymap -struct KeyMap { - keyArray map; // keymap - string orig; // original string from .cfg file - TKeyDef key; // 'switch to' key - - KeyMap(DWORD state, DWORD code); - KeyMap(): map(0,0,sizeof(TKeyDef)){}; - KeyMap(TKeyDef&tk); - KeyMap(TKeyDef&tk, string&); - KeyMap(const string&t): map(0,0,sizeof(TKeyDef)), orig(t) {}; - int operator==(const KeyMap & t) const; - KeyMap& operator = (const KeyMap& t); - -#ifndef __BORLANDC__ - // The STL needs this (Paul Brannan 5/25/98) - friend bool operator<(const KeyMap &t1, const KeyMap &t2); -#endif - - ~KeyMap(); -}; - -#endif diff --git a/rosapps/net/telnet/src/tmapldr.cpp b/rosapps/net/telnet/src/tmapldr.cpp deleted file mode 100644 index de41cbb539e..00000000000 --- a/rosapps/net/telnet/src/tmapldr.cpp +++ /dev/null @@ -1,773 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -//Telnet Win32 : an ANSI telnet client. -//Copyright (C) 1998-2000 Paul Brannan -//Copyright (C) 1998 I.Ioannou -//Copyright (C) 1997 Brad Johnson -// -//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. -// -//I.Ioannou -//roryt@hol.gr -// -/////////////////////////////////////////////////////////////////////////// - -///////////////////////////////////////////////////////// -// Class TMapLoader - Key/Character Mappings // -// - Loads from telnet.cfg // -// originally part of KeyTrans.cpp // -///////////////////////////////////////////////////////// - -#ifdef __BORLANDC__ -#include -#else -#include -#include -#endif - -#include "tmapldr.h" -#include "tnerror.h" -#include "tnconfig.h" - -// It's probably a good idea to turn off the "identifier was truncated" warning -// in MSVC (Paul Brannan 5/25/98) -#ifdef _MSC_VER -#pragma warning(disable: 4786) -#endif - -// AVS -// skip inline comments, empty lines -static char * getline(istream& i, char* buf, int size){ - - int len = 0; - - while (1) { - memset(buf,0,size); - if (i.eof()) break; - i.getline(buf,size,'\n'); - - while (buf[len]) { - if ( /*(buf[len]>=0) &&*/ buf[len]< ' ' ) buf[len] = ' '; - len++; - }; - len = 0; - - // not so fast, but work ;) - while ( buf[len] ) { - if ( (buf[len] == ' ') && (buf[len+1] == ' ')) { - memmove(buf+len, buf+len+1, strlen(buf+len)); - } else len++; - }; - - if (buf[0] == ' ') memmove(buf, buf+1, size-1); - - // empty or comment - if ((buf[0]==0)||(buf[0]==';')) continue; - - len = 0; // look for comment like this one - while (buf[len]) - if ((buf[len] == '/') && (buf[len+1] == '/')) buf[len] = 0; - else len++; - - if (len && (buf[len-1] == ' ')) { - len--; - buf[len]=0; - }; - // in case for comment like this one (in line just a comment) - if (buf[0]==0) continue; - - break; - }; - return (buf); -}; - -//AVS -// use string as FIFO queue for lines -static int getline(string&str, char* buf, size_t sz) { - - if ( !str.length() ) return 0; - const char * p = strchr(str.c_str(),'\n'); - unsigned int len; // Changed to unsigned (Paul Brannan 6/23/98) - if ( p==NULL ) - len = str.length(); - else - len = p - str.c_str(); - - len = len= 'A' && ch <= 'F') { - retval = retval*base + (ch-'A'+10); - } else { - return -1; - }; - readed++; - }; - // Ioannou: If we discard the 0x00 we can't undefine a key !!! - // if ( retval == 0 ) { - // return -1; - // }; - return retval; -}; - -//AVS -// a little optimization -DWORD Fix_ControlKeyState(char * Next_Token) { - if (stricmp(Next_Token, "RIGHT_ALT" ) == 0) return RIGHT_ALT_PRESSED; - if (stricmp(Next_Token, "LEFT_ALT" ) == 0) return LEFT_ALT_PRESSED; - if (stricmp(Next_Token, "RIGHT_CTRL") == 0) return RIGHT_CTRL_PRESSED; - if (stricmp(Next_Token, "LEFT_CTRL" ) == 0) return LEFT_CTRL_PRESSED; - if (stricmp(Next_Token, "SHIFT" ) == 0) return SHIFT_PRESSED; - if (stricmp(Next_Token, "NUMLOCK" ) == 0) return NUMLOCK_ON; - if (stricmp(Next_Token, "SCROLLLOCK") == 0) return SCROLLLOCK_ON; - if (stricmp(Next_Token, "CAPSLOCK" ) == 0) return CAPSLOCK_ON; - if (stricmp(Next_Token, "ENHANCED" ) == 0) return ENHANCED_KEY; - - // Paul Brannan 5/27/98 - if (stricmp(Next_Token, "APP_KEY" ) == 0) return APP_KEY; - // Paul Brannan 6/28/98 - if (stricmp(Next_Token, "APP2_KEY" ) == 0) return APP2_KEY; - // Paul Brannan 8/28/98 - if (stricmp(Next_Token, "APP3_KEY" ) == 0) return APP3_KEY; - // Paul Brannan 12/9/98 - if (stricmp(Next_Token, "APP4_KEY" ) == 0) return APP4_KEY; - - return 0; -} - - -// AVS -// rewrited to suppert \xhh notation, a little optimized -char* Fix_Tok(char * tok) { - static char s[256]; - int i,j,n; - - // setmem is nonstandard; memset is standard (Paul Brannan 5/25/98) - memset(s, 0, 256); - // setmem(s, 256, 0); - i = j = n = 0; - if ( tok != NULL ) { - for ( ; tok[i] != 0; ) { - switch ( tok[i] ) { - case '\\' : - switch ( tok[i+1] ) { - case '\\': - s[j++] = '\\'; - i += 2; - break; - default: - n = getbyte(tok+i+1); - if ( n < 0 ) - s[j++] = tok[i++]; - else { - s[j++]=n; - i += 4; - } ; - break; - }; - break; - case '^' : - if ( tok[i+1] >= '@' ) { - s[j++] = tok[i+1] - '@'; - i += 2; - break; - } - default : - s[j++] = tok[i++]; - } - } - } - return s; -}; - -// AVS -// perform 'normalization' for lines like [some text], and some checks -// maybe it will be done faster - but no time for it -int normalizeSplitter(string& buf) { - if ( buf.length() <= 2 ) return 0; - if ( buf[0] == '[' && buf[buf.length()-1] == ']' ) { - while ( buf[1] == ' ' ) - // DJGPP also uses erase rather than remove (Paul Brannan 6/23/98) -#ifndef __BORLANDC__ - buf.erase(1, 1); -#else - buf.remove(1,1); -#endif - while ( buf[buf.length()-2] == ' ' ) - // Paul Brannan 6/23/98 -#ifndef __BORLANDC__ - buf.erase(buf.length()-2,1); -#else - buf.remove(buf.length()-2,1); -#endif - return 1; - } - return 0; -}; - -// AVS -// looking for part in string array, see Load(..) for more info -int TMapLoader::LookForPart(stringArray& sa, const char* partType, const char* partName) { - if ( !sa.IsEmpty() ) { - string cmpbuf("["); - cmpbuf += partType; - cmpbuf += " "; - cmpbuf += partName; - cmpbuf += "]"; - normalizeSplitter(cmpbuf); // if no parttype, [global] for example - int max = sa.GetItemsInContainer(); - for ( int i = 0; i no value for " << Name << endl; - printm(0, FALSE, MSG_KEYNOVAL, Name); - continue; - }; - int val = atoi(Value); - if ( val > 0 && val <= 0xff ) { - if ( !KeyTrans.AddGlobalDef(val, Name)) return 0; - } - else { - // cerr << "[global] -> bad value for " << Name << endl; - printm(0, FALSE, MSG_KEYBADVAL, Name); - continue; - }; - }; - return 1; -}; - -// AVS -// perform parsing of strings like 'VK_CODE shifts text' -// returns text on success -char* TMapLoader::ParseKeyDef(const char* buf, WORD& vk_code, DWORD& control) { - char wbuf[256]; - strcpy(wbuf,buf); - char* ptr = strtok(wbuf, TOKEN_DELIMITERS); - if ( ptr == NULL ) return NULL; - - int i = KeyTrans.LookOnGlobal(ptr); - if ( i == INT_MAX ) return NULL; - - vk_code = KeyTrans.GetGlobalCode(i); - - control = 0; - DWORD st; - while (1) { - ptr = strtok(NULL, TOKEN_DELIMITERS); - if ((ptr == NULL) || ((st = Fix_ControlKeyState(ptr)) == 0)) break; - control |= st; - }; - - if ( ptr == NULL ) return NULL; - - return Fix_Tok(ptr); -}; - -// AVS -// load keymap to current map -// be aware - buf must passed by value, its destroyed -int TMapLoader::LoadKeyMap(string buf) { - - char wbuf[128]; - WORD vk_code; - DWORD control; - int i; - - // Paul Brannan Feb. 22, 1999 - strcpy(wbuf, "VK_"); - wbuf[4] = 0; - wbuf[3] = ini.get_escape_key(); - i = KeyTrans.LookOnGlobal(wbuf); - if (i != INT_MAX) { - KeyTrans.AddKeyDef(KeyTrans.GetGlobalCode(i), RIGHT_ALT_PRESSED, TN_ESCAPE); - KeyTrans.AddKeyDef(KeyTrans.GetGlobalCode(i), LEFT_ALT_PRESSED, TN_ESCAPE); - } - wbuf[3] = ini.get_scrollback_key(); - i = KeyTrans.LookOnGlobal(wbuf); - if (i != INT_MAX) { - KeyTrans.AddKeyDef(KeyTrans.GetGlobalCode(i), RIGHT_ALT_PRESSED, TN_SCROLLBACK); - KeyTrans.AddKeyDef(KeyTrans.GetGlobalCode(i), LEFT_ALT_PRESSED, TN_SCROLLBACK); - } - wbuf[3] = ini.get_dial_key(); - i = KeyTrans.LookOnGlobal(wbuf); - if (i != INT_MAX) { - KeyTrans.AddKeyDef(KeyTrans.GetGlobalCode(i), RIGHT_ALT_PRESSED, TN_DIAL); - KeyTrans.AddKeyDef(KeyTrans.GetGlobalCode(i), LEFT_ALT_PRESSED, TN_DIAL); - } - KeyTrans.AddKeyDef(VK_INSERT, SHIFT_PRESSED, TN_PASTE); - - while ( buf.length() ) { - wbuf[0] = 0; - if (!getline(buf,wbuf,sizeof(wbuf))) break; - if ( wbuf[0]==0 ) break; - if ( strnicmp(wbuf,"[keymap",7)==0 ) continue; - - char * keydef = ParseKeyDef(wbuf,vk_code,control); - - if ( keydef != NULL ) { - - // Check to see if keydef is a "special" code (Paul Brannan 3/29/00) - if(!strnicmp(keydef, "\\tn_escape", strlen("\\tn_escape"))) { - if(!KeyTrans.AddKeyDef(vk_code, control, TN_ESCAPE)) return 0; - } else if(!strnicmp(keydef, "\\tn_scrollback", strlen("\\tn_scrollback"))) { - if(!KeyTrans.AddKeyDef(vk_code, control, TN_SCROLLBACK)) return 0; - } else if(!strnicmp(keydef, "\\tn_dial", strlen("\\tn_dial"))) { - if(!KeyTrans.AddKeyDef(vk_code, control, TN_DIAL)) return 0; - } else if(!strnicmp(keydef, "\\tn_paste", strlen("\\tn_paste"))) { - if(!KeyTrans.AddKeyDef(vk_code, control, TN_PASTE)) return 0; - } else if(!strnicmp(keydef, "\\tn_null", strlen("\\tn_null"))) { - if(!KeyTrans.AddKeyDef(vk_code, control, TN_NULL)) return 0; - } else if(!strnicmp(keydef, "\\tn_cr", strlen("\\tn_cr"))) { - if(!KeyTrans.AddKeyDef(vk_code, control, TN_CR)) return 0; - } else if(!strnicmp(keydef, "\\tn_crlf", strlen("\\tn_crlf"))) { - if(!KeyTrans.AddKeyDef(vk_code, control, TN_CRLF)) return 0; - } else - if(!KeyTrans.AddKeyDef(vk_code,control,keydef)) return 0; - // else DeleteKeyDef() ???? - I'm not sure... - } - }; - - return 1; -}; - -// AVS -// load [charmap ...] part to xlat -int TMapLoader::LoadCharMap(string buf) { - char wbuf[128]; - char charmapname[128]; - charmapname[0] = 0; - - // xlat.init(); now it done by KeyTranslator::Load() - - while ( buf.length() ) { - wbuf[0]=0; - if (!getline(buf,wbuf,sizeof(wbuf))) break; - if ( wbuf[0]==0 ) break; - if ( strnicmp(wbuf,"[charmap",8)==0 ) { - strcpy(charmapname,wbuf); - continue; - }; - char * host = strtok(wbuf, " "); - char * console = strtok(NULL, " "); - - int bHost; - int bConsole; - - if ( host == NULL || console == NULL ) { - // cerr << charmapname << " -> Bad structure" << endl; - printm(0, FALSE, MSG_KEYBADSTRUCT, charmapname); - return 0; - }; - if ( strlen(host) > 1 && host[0] == '\\' ) - bHost = getbyte(host+1); - else - bHost = (unsigned char)host[0]; - - if ( strlen(console) > 1 && console[0] == '\\' ) - bConsole = getbyte(console+1); - else - bConsole = (unsigned char)console[0]; - - if ( bHost <= 0 || bConsole <= 0 ) { - // cerr << charmapname << " -> Bad chars? " - // << host << " -> " << console << endl; - printm(0, FALSE, MSG_KEYBADCHARS, charmapname, host, console); - return 0; - }; - // xlat.table[bHost] = bConsole; - Charmap.modmap(bHost, 'B', bConsole); - }; - return (Charmap.enabled = 1); - return 1; -}; - -// AVS -// ignore long comment [comment] ... [end comment] -// recursive! -int getLongComment(istream& is, char* wbuf, size_t sz) { - - int bufLen; - while ( is ) { - wbuf[0] = 0; - getline(is, wbuf, sz); - if ( wbuf[0]==0 ) return 1; - bufLen = strlen(wbuf); - if ( wbuf[0] == '[' && wbuf[bufLen-1] == ']' ) { - string temps(wbuf); - - if (!normalizeSplitter(temps)) { - // cerr << "Unexpected line '" << temps << "'\n"; - printm(0, FALSE, MSG_KEYUNEXPLINE, temps.c_str()); - return 0; - }; - if ( stricmp(temps.c_str(),"[comment]") == 0 ) { - // do recursive call - if ( !getLongComment(is, wbuf, sz) ) return 0; - continue; - }; - if ( stricmp(temps.c_str(),"[end comment]") == 0 ) return 1; - }; - }; - // we get a warning if we don't put a return here (Paul Brannan 5/25/98) - return 0; -}; - -// AVS -// completelly rewrited to support new conceptions -int TMapLoader::Load(const char * filename, const char * szActiveEmul) { - char buf[256]; - int bufLen; - - ifstream inpfile(filename); - KeyTrans.DeleteAllDefs(); - Charmap.init(); - - // it is an array for store [...] ... [end ...] parts from file - stringArray SA(0,0,sizeof(string)); - int AllOk = 0; - - while ( inpfile ) { - - getline(inpfile, buf, 255); - bufLen = strlen(buf); - if ( !bufLen ) continue; - - if ( buf[0] == '[' && buf[bufLen-1] == ']' ) { - // is a part splitter [...] - string temps(buf); - - if (!normalizeSplitter(temps)) { - printm(0, FALSE, MSG_KEYUNEXPLINE, temps.c_str()); - AllOk = 0; - break; - }; - // if a comment - if ( stricmp(temps.c_str(),"[comment]") == 0 ) { -#ifdef KEYDEBUG - printit(temps.c_str()); -#endif - if ( !getLongComment(inpfile, buf, sizeof(buf)) ) { - printm(0, FALSE, MSG_KEYUNEXPEOF); - break; - }; -#ifdef KEYDEBUG - printit("\r \r"); -#endif - continue; - }; - - - string back = temps; - // prepare line for make it as [end ...] - // and check it - if ( strnicmp(back.c_str(), "[global]", 8) == 0 ) {} // do nothing - else if ( strnicmp(back.c_str(), "[keymap", 7) == 0 ) { - // DJGPP also uses erase rather than remove (Paul Brannan 6/23/98) -#ifndef __BORLANDC__ - back.erase(7); -#else - back.remove(7); -#endif - back += "]"; - } - else if ( strnicmp(back.c_str(), "[charmap", 8) == 0 ) { - // Paul Brannan 6/23/98 -#ifndef __BORLANDC__ - back.erase(8); -#else - back.remove(8); -#endif - back += "]"; - } - else if ( strnicmp(back.c_str(), "[config", 7) == 0 ) { - // Paul Brannan 6/23/98 -#ifndef __BORLANDC__ - back.erase(7); -#else - back.remove(7); -#endif - back += "]"; - } - else { - // cerr << "Unexpected token " << back << endl; - printm(0, FALSE, MSG_KEYUNEXPTOK, back.c_str()); - break; - }; - - back.insert(1,"END "); // now it looks like [END ...] -#ifdef KEYDEBUG - printit(temps.c_str()); -#endif - - int ok = 0; - // fetch it to temps - while ( 1 ) { - getline(inpfile, buf, sizeof(buf)); - bufLen = strlen(buf); - if ( !bufLen ) break; - if ( buf[0] == '[' && buf[bufLen-1] == ']' ) { - string t(buf); - if ( !normalizeSplitter(t) ) break; - - if ( stricmp(t.c_str(),back.c_str()) == 0 ) { - ok = 1; - break; - }; - - // AVS 31.12.97 fix [comment] block inside another block - if ( stricmp(t.c_str(),"[comment]") == 0 && - getLongComment(inpfile, buf, sizeof(buf)) ) continue; - - break; - }; - temps += "\n"; - temps += buf; - }; - if ( !ok ) { - // cerr << "Unexpected end of file or token" << endl; - printm(0, FALSE, MSG_KEYUNEXP); - AllOk = 0; - break; - }; -#ifdef KEYDEBUG - printit("\r \r"); -#endif - AllOk = SA.Add(temps);; - if ( !AllOk ) break; - } else { - // cerr << "Unexpected line '" << buf << "'\n"; - printm(0, FALSE, MSG_KEYUNEXPLINE, buf); - AllOk = 0; - break; - }; - }; - - inpfile.close(); - - if ( !AllOk ) return 0; - - // now all file are in SA, comments are stripped - - int i = LookForPart(SA, "global", ""); - if ( i == INT_MAX ) { - // cerr << "No [GLOBAL] definition!" << endl; - printm(0, FALSE, MSG_KEYNOGLOBAL); - return 0; - }; - if ( !LoadGlobal(SA[i]) ) { - return 0; - }; - - // look for need configuration - i = LookForPart(SA, "config", szActiveEmul); - if ( i == INT_MAX ) { - // cerr << "No [CONFIG " << szActiveEmul << "]\n"; - printm(0, FALSE, MSG_KEYNOCONFIG, szActiveEmul); - return 0; - }; - // cerr << "use configuration: " << szActiveEmul << endl; - printm(0, FALSE, MSG_KEYUSECONFIG, szActiveEmul); - BOOL hadKeys = FALSE; - - string config = SA[i]; - // parse it - while ( config.length() ) { - buf[0] = 0; - getline(config,buf,sizeof(buf)); - bufLen = strlen(buf); - if ( !bufLen || (buf[0] == '[' && buf[bufLen-1] == ']') ) continue; - if ( strnicmp(buf,"keymap",6) == 0 ) { - string orig(buf); - printit("\t"); printit(buf); printit("\n"); - char * mapdef = strtok(buf,":"); - char * switchKey = strtok(NULL,"\n"); - - if ( !KeyTrans.mapArray.IsEmpty() && switchKey == NULL ) { - // cerr << "no switch Key for '" << mapdef - // << "'" << endl; - printm(0, FALSE, MSG_KEYNOSWKEY, mapdef); - break; - }; - if ( KeyTrans.mapArray.IsEmpty() ) { - if ( switchKey != NULL ) { // create default keymap - // cerr << "You cannot define switch key for default keymap -> ignored" - // << endl; - printm(0, FALSE, MSG_KEYCANNOTDEF); - }; - TKeyDef empty; - KeyTrans.mapArray.Add(KeyMap(string(mapdef))); - KeyTrans.switchMap(empty); // set it as current keymap - KeyTrans.mainKeyMap = KeyTrans.currentKeyMap; - } - else { - string keydef(switchKey); - keydef += " !*!*!*"; // just for check - WORD vk_code; - DWORD control; - switchKey = ParseKeyDef(keydef.c_str(),vk_code,control); - if ( switchKey != NULL ) { - TKeyDef swi(NULL,control,vk_code); - if ( KeyTrans.switchMap(swi) > 0 ) { - // cerr << "Duplicate switching key\n"; - printm(0, FALSE, MSG_KEYDUPSWKEY); - break; - }; - KeyTrans.mapArray.Add(KeyMap(swi, orig)); - KeyTrans.switchMap(swi); // set it as current keymap - } - }; - mapdef+=7; // 'keymap ' - // now load defined keymaps to current - while ((mapdef != NULL)&& - (mapdef = strtok(mapdef,TOKEN_DELIMITERS)) != NULL ) { - i = LookForPart(SA,"keymap",mapdef); - if ( i == INT_MAX ) { - // cerr << "Unknown KEYMAP " << mapdef << endl; - printm(0, FALSE, MSG_KEYUNKNOWNMAP, mapdef); - } else { - mapdef = strtok(NULL,"\n"); // strtok is used in LoadKeyMap - // so - save pointer! - hadKeys = LoadKeyMap(SA[i]); // load it - }; - }; - - } - else if ( strnicmp(buf,"charmap",7) == 0 ) { - printit("\t"); printit(buf); printit("\n"); - char * mapdef = buf + 8;// 'charmap ' - int SuccesLoaded = 0; - // now load defined charmaps to current - while ((mapdef != NULL)&& - (mapdef = strtok(mapdef,TOKEN_DELIMITERS)) != NULL ) { - i = LookForPart(SA,"charmap",mapdef); - if ( i == INT_MAX ) { - // cerr << "Unknown KEYMAP " << mapdef << endl; - printm(0, FALSE, MSG_KEYUNKNOWNMAP, mapdef); - } else { - mapdef = strtok(NULL,"\n"); // strtok is used in LoadKeyMap - // so - save pointer! - if (LoadCharMap(SA[i])) // load it - SuccesLoaded++; - }; - }; - if (!SuccesLoaded) { - // cerr << "No charmaps loaded\n"; - printm(0, FALSE, MSG_KEYNOCHARMAPS); - Charmap.init(); - }; - /* strtok(buf," "); - - char* name = strtok(NULL," "); - if ( name == NULL ) { - cerr << "No name for CHARMAP" << endl; - } else { - i = LookForPart(SA,"charmap", name); - if ( i == INT_MAX ) { - cerr << "Unknown CHARMAP " << name << endl; - } else { - LoadCharMap(SA[i]); - }; - }; - */ - } - else { - // cerr << "unexpected token in " << szActiveEmul << endl; - printm(0, FALSE, MSG_KEYUNEXPTOKIN, szActiveEmul); - } - } - - if ( hadKeys) { - TKeyDef empty; - KeyTrans.switchMap(empty); // switch to default - KeyTrans.mainKeyMap = KeyTrans.currentKeyMap; // save it's number - // cerr << "There are " << (KeyTrans.mapArray.GetItemsInContainer()) << " maps\n"; - char s[12]; // good enough for a long int (32-bit) - itoa(KeyTrans.mapArray.GetItemsInContainer(), s, 10); - printm(0, FALSE, MSG_KEYNUMMAPS, s); - return 1; - }; - return 0; -} - -void TMapLoader::Display() { - - int max = KeyTrans.mapArray.GetItemsInContainer(); - if (max == 0) { - printm(0, FALSE, MSG_KEYNOKEYMAPS); - return; - }; - for ( int i = 0; i < max; i++ ) { - char buf[20]; - itoa(i,buf,10); - printit("\t"); - // Ioannou : we can show the current - if (KeyTrans.currentKeyMap == i) - printit("*"); - else - printit(" "); - strcat(buf," "); - printit(buf); - char * msg = new char [KeyTrans.mapArray[i].orig.length()+1]; - strcpy(msg,KeyTrans.mapArray[i].orig.c_str()); - printit(msg); - delete[] msg; - printit("\n"); - }; -}; diff --git a/rosapps/net/telnet/src/tmapldr.h b/rosapps/net/telnet/src/tmapldr.h deleted file mode 100644 index 4a80966f0cd..00000000000 --- a/rosapps/net/telnet/src/tmapldr.h +++ /dev/null @@ -1,105 +0,0 @@ -/////////////////////////////////////////////////////////////////// -// // -// File format : // -// // -// Comments with a ; in column 1 // -// Empty Lines ignored // -// The words are separated by a space, a tab, or a plus ("+") // -// // -// First a [GLOBAL] section : // -// [GLOBAL] // -// VK_F1 112 // -// . // -// . // -// [END_GLOBAL] // -// // -// The GLOBAL section defines the names of the keys // -// and the virtual key code they have. // -// If you repeat a name you'll overwrite the code. // -// You can name the keys anything you like // -// The Virtual key nymber must be in Decimal // -// After the number you can put anything : it is ignored // -// Here you must put ALL the keys you'll use in the // -// other sections. // -// // -// Then the emulations sections : // -// // -// [SCO_ANSI] // -// // -// VK_F1 \027[M or // -// VK_F1 ^[[M or // -// VK_F1 SHIFT ^[[W etc // -// . // -// . // -// [SCO_ANSI_END] // -// // -// There are three parts : // -// a) the key name // -// b) the shift state // -// here you put compination of the words : // -// // -// RIGHT_ALT // -// LEFT_ALT // -// RIGHT_CTRL // -// LEFT_CTRL // -// SHIFT // -// NUMLOCK // -// SCROLLLOCK // -// CAPSLOCK // -// ENHANCED // -// APP_KEY // -// c) the assigned string : // -// you can use the ^ for esc (^[ = 0x1b) // -// \ and a three digit decimal number // -// (\027) // -// You can't use the NULL !!! // -// Also (for the moment) you can't use spaces // -// in the string : everything after the 3rd word is // -// ignored - use unsderscore instead. // -// // -// for example : // -// // -// VK_F4 SHIFT+LEFT_ALT \0274m^[[M = 0x1b 4 m 0x1b [ M // -// VK_F1 RIGHT_CTRL This_is_ctrl_f1 // -// // -// You may have as many sections as you like // -// If you repeat any section (even the GLOBAL) you'll overwrite // -// the common parts. // -// // -/////////////////////////////////////////////////////////////////// - -#ifndef __TLOADMAP_H -#define __TLOADMAP_H - -#include "keytrans.h" -#include "tcharmap.h" - -// AVS -typedef TArrayAsVector stringArray; - -class TMapLoader { -public: - TMapLoader(KeyTranslator &RefKeyTrans, TCharmap &RefCharmap): - KeyTrans(RefKeyTrans), Charmap(RefCharmap) {} - ~TMapLoader() {} - - // If called more than once the new map replaces the old one. - // load with a different KeysetName to change keysets - // Return 0 on error - int Load(const char * filename, const char * szKeysetName); - - void Display(); -private: - KeyTranslator &KeyTrans; - TCharmap &Charmap; - - int LookForPart(stringArray& sa, const char* partType, const char* partName); - char* ParseKeyDef(const char* buf, WORD& vk_code, DWORD& control); - - int LoadGlobal(string& buf); - int LoadKeyMap(string buf); - int LoadCharMap(string buf); - -}; - -#endif diff --git a/rosapps/net/telnet/src/tmouse.cpp b/rosapps/net/telnet/src/tmouse.cpp deleted file mode 100644 index 9f87c048f8e..00000000000 --- a/rosapps/net/telnet/src/tmouse.cpp +++ /dev/null @@ -1,210 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -//Telnet Win32 : an ANSI telnet client. -//Copyright (C) 1998 Paul Brannan -//Copyright (C) 1998 I.Ioannou -//Copyright (C) 1997 Brad Johnson -// -//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. -// -//I.Ioannou -//roryt@hol.gr -// -/////////////////////////////////////////////////////////////////////////// - -// TMouse.cpp -// A simple class for handling mouse events -// Written by Paul Brannan -// Last modified August 30, 1998 - -#include "tmouse.h" -#include "tconsole.h" - -TMouse::TMouse(Tnclip &RefClipboard): Clipboard(RefClipboard) { - hConsole = GetStdHandle(STD_INPUT_HANDLE); - hStdout = GetStdHandle(STD_OUTPUT_HANDLE); -} - -TMouse::~TMouse() { -} - -void TMouse::get_coords(COORD *start_coords, COORD *end_coords, - COORD *first_coords, COORD *last_coords) { - if(end_coords->Y < start_coords->Y || - (end_coords->Y == start_coords->Y && end_coords->X < start_coords->X)) - { - *first_coords = *end_coords; - *last_coords = *start_coords; - } else { - *first_coords = *start_coords; - *last_coords = *end_coords; - } - last_coords->X++; -} - -void TMouse::doMouse_init() { - GetConsoleScreenBufferInfo(hStdout, &ConsoleInfo); - chiBuffer = newBuffer(); - saveScreen(chiBuffer); -} - -void TMouse::doMouse_cleanup() { - restoreScreen(chiBuffer); - delete[] chiBuffer; -} - -void TMouse::move_mouse(COORD start_coords, COORD end_coords) { - COORD screen_start = {0, 0}; - COORD first_coords, last_coords; - DWORD Result; - - FillConsoleOutputAttribute(hStdout, normal, - ConsoleInfo.dwSize.X * ConsoleInfo.dwSize.Y, screen_start, &Result); - - get_coords(&start_coords, &end_coords, &first_coords, &last_coords); - FillConsoleOutputAttribute(hStdout, inverse, ConsoleInfo.dwSize.X * - (last_coords.Y - first_coords.Y) + (last_coords.X - first_coords.X), - first_coords, &Result); -} - -void TMouse::doClip(COORD start_coords, COORD end_coords) { - // COORD screen_start = {0, 0}; - COORD first_coords, last_coords; - DWORD Result; - - get_coords(&start_coords, &end_coords, &first_coords, &last_coords); - - // Allocate the minimal size buffer - int data_size = 3 + ConsoleInfo.dwSize.X * - (last_coords.Y - first_coords.Y) + (last_coords.X - first_coords.X); - HGLOBAL clipboard_data = GlobalAlloc(GMEM_MOVEABLE + GMEM_DDESHARE, - data_size); - LPVOID mem_ptr = GlobalLock(clipboard_data); - - // Reset data_size so we can count the actual data size - data_size = 0; - - // Read the console, put carriage returns at the end of each line if - // reading more than one line (Paul Brannan 9/17/98) - for(int j = first_coords.Y; j <= last_coords.Y; j++) { - - // Read line at (0,j) - COORD coords; - coords.X = 0; - coords.Y = j; - int length = ConsoleInfo.dwSize.X; - - if(j == first_coords.Y) { - coords.X = first_coords.X; - length = ConsoleInfo.dwSize.X - first_coords.X; - } else { - // Add a carriage return to the end of the previous line - *((char *)mem_ptr + data_size++) = '\r'; - *((char *)mem_ptr + data_size++) = '\n'; - } - - if(j == last_coords.Y) { - length -= (ConsoleInfo.dwSize.X - last_coords.X); - } - - // Read the next line - ReadConsoleOutputCharacter(hStdout, (LPTSTR)((char *)mem_ptr + - data_size), length, coords, &Result); - data_size += Result; - - // Strip the spaces at the end of the line - if((j != last_coords.Y) && (first_coords.Y != last_coords.Y)) - while(*((char *)mem_ptr + data_size - 1) == ' ') data_size--; - } - if(first_coords.Y != last_coords.Y) { - // Add a carriage return to the end of the last line - *((char *)mem_ptr + data_size++) = '\r'; - *((char *)mem_ptr + data_size++) = '\n'; - } - - *((char *)mem_ptr + data_size) = 0; - GlobalUnlock(clipboard_data); - - Clipboard.Copy(clipboard_data); -} - -void TMouse::doMouse() { - INPUT_RECORD InputRecord; - DWORD Result; - InputRecord.EventType = KEY_EVENT; // just in case - while(InputRecord.EventType != MOUSE_EVENT) { - if (!ReadConsoleInput(hConsole, &InputRecord, 1, &Result)) - return; // uh oh! we don't know the starting coordinates! - } - if(InputRecord.Event.MouseEvent.dwButtonState == 0) return; - if(!(InputRecord.Event.MouseEvent.dwButtonState & - FROM_LEFT_1ST_BUTTON_PRESSED)) { - Clipboard.Paste(); - return; - } - - COORD screen_start = {0, 0}; - COORD start_coords = InputRecord.Event.MouseEvent.dwMousePosition; - COORD end_coords = start_coords; - BOOL done = FALSE; - - // init vars - doMouse_init(); - int normal_bg = ini.get_normal_bg(); - int normal_fg = ini.get_normal_fg(); - if(normal_bg == -1) normal_bg = 0; // FIX ME!! This is just a hack - if(normal_fg == -1) normal_fg = 7; - normal = (normal_bg << 4) | normal_fg; - inverse = (normal_fg << 4) | normal_bg; - - // make screen all one attribute - FillConsoleOutputAttribute(hStdout, normal, ConsoleInfo.dwSize.X * - ConsoleInfo.dwSize.Y, screen_start, &Result); - - while(!done) { - - switch (InputRecord.EventType) { - case MOUSE_EVENT: - switch(InputRecord.Event.MouseEvent.dwEventFlags) { - case 0: // only copy if the mouse button has been released - if(!InputRecord.Event.MouseEvent.dwButtonState) { - doClip(start_coords, end_coords); - done = TRUE; - } - break; - - case MOUSE_MOVED: - end_coords = InputRecord.Event.MouseEvent.dwMousePosition; - move_mouse(start_coords, end_coords); - break; - } - break; - // If we are changing focus, we don't want to highlight anything - // (Paul Brannan 9/2/98) - case FOCUS_EVENT: - return; - } - - WaitForSingleObject(hConsole, INFINITE); - if (!ReadConsoleInput(hConsole, &InputRecord, 1, &Result)) - done = TRUE; - - } - - doMouse_cleanup(); -} - -void TMouse::scrollMouse() { - doMouse(); -} diff --git a/rosapps/net/telnet/src/tmouse.h b/rosapps/net/telnet/src/tmouse.h deleted file mode 100644 index fde6ec71828..00000000000 --- a/rosapps/net/telnet/src/tmouse.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef __TMOUSE_H -#define __TMOUSE_H - -#include "tnclip.h" -#include - -class TMouse { -private: - int normal, inverse; - HANDLE hConsole, hStdout; - CHAR_INFO *chiBuffer; - CONSOLE_SCREEN_BUFFER_INFO ConsoleInfo; - Tnclip &Clipboard; - - void get_coords(COORD *start_coords, COORD *end_coords, - COORD *first_coords, COORD *last_coords); - void doMouse_init(); - void doMouse_cleanup(); - void move_mouse(COORD start_coords, COORD end_coords); - void doClip(COORD start_coords, COORD end_coords); - -public: - void doMouse(); - void scrollMouse(); - TMouse(Tnclip &RefClipboard); - ~TMouse(); -}; - -#endif diff --git a/rosapps/net/telnet/src/tnclass.cpp b/rosapps/net/telnet/src/tnclass.cpp deleted file mode 100644 index 455c5477f34..00000000000 --- a/rosapps/net/telnet/src/tnclass.cpp +++ /dev/null @@ -1,398 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -//Telnet Win32 : an ANSI telnet client. -//Copyright (C) 1998 Paul Brannan -//Copyright (C) 1998 I.Ioannou -//Copyright (C) 1997 Brad Johnson -// -//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. -// -//I.Ioannou -//roryt@hol.gr -// -/////////////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// -// Module: tnclass.cpp -// -// Contents: telnet object definition -// -// Product: telnet -// -// Revisions: August 30, 1998 Paul Brannan -// July 12, 1998 Paul Brannan -// June 15, 1998 Paul Brannan -// May 14, 1998 Paul Brannan -// 5.April.1997 jbj@nounname.com -// 14.Sept.1996 jbj@nounname.com -// Version 2.0 -// -/////////////////////////////////////////////////////////////////////////////// - -#include -#include -#include "tnclass.h" -#include "tnmisc.h" - -// Mingw32 needs these (Paul Brannan 9/4/98) -#ifndef ICON_SMALL -#define ICON_SMALL 0 -#endif -#ifndef ICON_BIG -#define ICON_BIG 1 -#endif - -// Ioannou Dec. 8, 1998 -#ifdef __BORLANDC__ -#ifndef WM_SETICON -#define WM_SETICON STM_SETICON -#endif -#endif - -// DoInit() - performs initialization that is common to both the -// constructors (Paul Brannan 6/15/98) -void Telnet::DoInit() { - Socket = INVALID_SOCKET; - bConnected = 0; - bNetPaused = 1; - bNetFinished = 1; - bNetFinish = 0; - hThread = 0; // Sam Robertson 12/7/98 - hProcess = 0; - - WSADATA WsaData; - - // Set the title - telSetConsoleTitle("No Connection"); - - // Change the icon - hConsoleWindow = GetConsoleWindow(); - iconChange = SetIcon(hConsoleWindow, 0, &oldBIcon, &oldSIcon, ini.get_startdir()); - - if (WSAStartup(MAKEWORD(1, 1), &WsaData)) { - DWORD dwLastError = GetLastError(); - printm(0, FALSE, MSG_ERROR, "WSAStartup()"); - printm(0, TRUE, dwLastError); - bWinsockUp = 0; - return; - } - bWinsockUp = 1; - - // Get keyfile (Paul Brannan 5/12/98) - const char *keyfile = ini.get_keyfile(); - - // This should be changed later to use the Tnerror routines - // This has been done (Paul Brannan 6/5/98) - if(LoadKeyMap( keyfile, ini.get_default_config()) != 1) - // printf("Error loading keymap.\n"); - printm(0, FALSE, MSG_ERRKEYMAP); -} - -Telnet::Telnet(): -MapLoader(KeyTrans, Charmap), -Console(GetStdHandle(STD_OUTPUT_HANDLE)), -TelHandler(Network, Console, Parser), -ThreadParams(TelHandler), -Clipboard(GetConsoleWindow(), Network), -Mouse(Clipboard), -Scroller(Mouse, ini.get_scroll_size()), -Parser(Console, KeyTrans, Scroller, Network, Charmap) { - DoInit(); -} - -Telnet::Telnet(const char * szHost1, const char *strPort1): -MapLoader(KeyTrans, Charmap), -Console(GetStdHandle(STD_OUTPUT_HANDLE)), -TelHandler(Network, Console, Parser), -ThreadParams(TelHandler), -Clipboard(GetConsoleWindow(), Network), -Mouse(Clipboard), -Scroller(Mouse, ini.get_scroll_size()), -Parser(Console, KeyTrans, Scroller, Network, Charmap) { - DoInit(); - Open( szHost1, strPort1); -} - -Telnet::~Telnet(){ - if (bWinsockUp){ - if(bConnected) Close(); - WSACleanup(); - } - - // Paul Brannan 8/10/98 - if(iconChange) { - ResetIcon(hConsoleWindow, oldBIcon, oldSIcon); - } - -} - -// changed from char * to const char * (Paul Brannan 5/12/98) -int Telnet::LoadKeyMap(const char * file, const char * name){ - // printf("Loading %s from %s.\n", name ,file); - printm(0, FALSE, MSG_KEYMAP, name, file); - return MapLoader.Load(file,name); -} - -void Telnet::DisplayKeyMap(){ // display available keymaps - MapLoader.Display(); -}; - -int Telnet::SwitchKeyMap(int to) { // switch to selected keymap - int ret = KeyTrans.SwitchTo(to); - switch(ret) { - case -1: printm(0, FALSE, MSG_KEYNOKEYMAPS); break; - case 0: printm(0, FALSE, MSG_KEYBADMAP); break; - case 1: printm(0, FALSE, MSG_KEYMAPSWITCHED); break; - } - return ret; -}; - - -int Telnet::Open(const char *szHost1, const char *strPort1){ - if (bWinsockUp && !bConnected){ - telSetConsoleTitle(szHost1); - - strncpy (szHost,szHost1, 127); - strncpy(strPort, strPort1, sizeof(strPort)); - - // Determine whether to pipe to an executable or use our own sockets - // (Paul Brannan March 18, 1999) - const char *netpipe; - if(*(netpipe=ini.get_netpipe())) { - PROCESS_INFORMATION pi; - HANDLE hInWrite, hOutRead, hErrRead; - if(!CreateHiddenConsoleProcess(netpipe, &pi, &hInWrite, - &hOutRead, &hErrRead)) { - printm(0, FALSE, MSG_ERRPIPE); - return TNNOCON; - } - Network.SetPipe(hOutRead, hInWrite); - hProcess = pi.hProcess; - } else { - Socket = Connect(); - if (Socket == INVALID_SOCKET) { - printm(0, FALSE, GetLastError()); - return TNNOCON; - } - Network.SetSocket(Socket); - SetLocalAddress(Socket); - } - - bNetFinish = 0; - bConnected = 1; - ThreadParams.p.bNetPaused = &bNetPaused; - ThreadParams.p.bNetFinish = &bNetFinish; - ThreadParams.p.bNetFinished = &bNetFinished; - ThreadParams.p.hExit = CreateEvent(0, TRUE, FALSE, ""); - ThreadParams.p.hPause = CreateEvent(0, FALSE, FALSE, ""); - ThreadParams.p.hUnPause = CreateEvent(0, FALSE, FALSE, ""); - DWORD idThread; - - // Disable Ctrl-break (PB 5/14/98); - // Fixed (Thomas Briggs 8/17/98) - if(ini.get_disable_break() || ini.get_control_break_as_c()) - SetConsoleCtrlHandler(ControlEventHandler, TRUE); - - hThread = CreateThread(0, 0, - (LPTHREAD_START_ROUTINE) telProcessNetwork, - (LPVOID)&ThreadParams, 0, &idThread); - // This helps the display thread a little (Paul Brannan 8/3/98) - SetThreadPriority(hThread, THREAD_PRIORITY_ABOVE_NORMAL); - return Resume(); - } else if(bWinsockUp && bConnected) { - printm (0, FALSE, MSG_ALREADYCONNECTED, szHost); - } - - return TNNOCON; // cannot do winsock stuff or already connected -} - -// There seems to be a bug with MSVC's optimization. This turns them off -// for these two functions. -// (Paul Brannan 5/14/98) -#ifdef _MSC_VER -#pragma optimize("", off) -#endif - - -int Telnet::Close() { - Console.sync(); - switch(Network.get_net_type()) { - case TN_NETSOCKET: - if(Socket != INVALID_SOCKET) closesocket(Socket); - Socket = INVALID_SOCKET; - break; - case TN_NETPIPE: - if(hProcess != 0) { - TerminateProcess(hProcess, 0); - CloseHandle(hProcess); - hProcess = 0; - } - break; - } - - // Enable Ctrl-break (PB 5/14/98); - // Ioannou : this must be FALSE - if(ini.get_disable_break()) SetConsoleCtrlHandler(NULL, FALSE); - - if (hThread) CloseHandle(hThread); // Paul Brannan 8/11/98 - hThread = NULL; // Daniel Straub 11/12/98 - - SetEvent(ThreadParams.p.hUnPause); - bNetFinish = 1; - while (!bNetFinished) - Sleep (0); // give up our time slice- this lets our connection thread - // finish itself, so we don't hang -crn@ozemail.com.au - telSetConsoleTitle("No Connection"); - bConnected = 0; - return 1; -} - -int Telnet::Resume(){ - int i; - if (bConnected) { - Console.sync(); - for(;;){ - SetEvent(ThreadParams.p.hUnPause); - i = telProcessConsole(&ThreadParams.p, KeyTrans, Console, - Network, Mouse, Clipboard, hThread); - if (i) bConnected = 1; - else bConnected = 0; - ResetEvent(ThreadParams.p.hUnPause); - SetEvent(ThreadParams.p.hPause); - while (!bNetPaused) - Sleep (0); // give up our time slice- this lets our connection thread - // unpause itself, so we don't hang -crn@ozemail.com.au - switch (i){ - case TNNOCON: - Close(); - return TNDONE; - case TNPROMPT: - return TNPROMPT; - case TNSCROLLBACK: - Scroller.ScrollBack(); - break; - case TNSPAWN: - NewProcess(); - } - } - } - return TNNOCON; -} - -// Turn optimization back on (Paul Brannan 5/12/98) -#ifdef _MSC_VER -#pragma optimize("", on) -#endif - -// The scrollback functions have been moved to TScroll.cpp -// (Paul Brannan 6/15/98) -SOCKET Telnet::Connect() -{ - SOCKET Socket1 = socket(AF_INET, SOCK_STREAM, 0); - SOCKADDR_IN SockAddr; - SockAddr.sin_family = AF_INET; - SockAddr.sin_addr.s_addr = inet_addr(szHost); - - // determine the port correctly -crn@ozemail.com.au 15/12/98 - SERVENT *sp; - sp = getservbyname (strPort, "tcp"); - if (sp == NULL) { - if (isdigit (*(strPort))) - SockAddr.sin_port = htons(atoi(strPort)); - else { - printm(0, FALSE, MSG_NOSERVICE, strPort); - return INVALID_SOCKET; - } - } else - SockAddr.sin_port = sp->s_port; - /// - - // Were we given host name? - if (SockAddr.sin_addr.s_addr == INADDR_NONE) { - - // Resolve host name to IP address. - printm(0, FALSE, MSG_RESOLVING, szHost); - hostent* pHostEnt = gethostbyname(szHost); - if (!pHostEnt) - return INVALID_SOCKET; - printit("\n"); - - SockAddr.sin_addr.s_addr = *(DWORD*)pHostEnt->h_addr; - } - - // Print a message telling the user the IP we are connecting to - // (Paul Brannan 5/14/98) - char ss_b1[4], ss_b2[4], ss_b3[4], ss_b4[4], ss_b5[12]; - itoa(SockAddr.sin_addr.S_un.S_un_b.s_b1, ss_b1, 10); - itoa(SockAddr.sin_addr.S_un.S_un_b.s_b2, ss_b2, 10); - itoa(SockAddr.sin_addr.S_un.S_un_b.s_b3, ss_b3, 10); - itoa(SockAddr.sin_addr.S_un.S_un_b.s_b4, ss_b4, 10); - itoa(ntohs(SockAddr.sin_port), ss_b5, 10); - printm(0, FALSE, MSG_TRYING, ss_b1, ss_b2, ss_b3, ss_b4, ss_b5); - - if (connect(Socket1, (sockaddr*)&SockAddr, sizeof(SockAddr))) - return INVALID_SOCKET; - - char esc[2]; - esc [0] = ini.get_escape_key(); - esc [1] = 0; - printm(0, FALSE, MSG_CONNECTED, szHost, esc); - - return Socket1; -} - -void Telnet::telSetConsoleTitle(const char * szHost1) -{ - char szTitle[128] = "Telnet - "; - strcat(szTitle, szHost1); - if(ini.get_set_title()) SetConsoleTitle(szTitle); -} - -void Telnet::NewProcess() { - char cmd_line[MAX_PATH*2]; - PROCESS_INFORMATION pi; - - strcpy(cmd_line, ini.get_startdir()); - strcat(cmd_line, ini.get_exename()); // Thomas Briggs 12/7/98 - - if(!SpawnProcess(cmd_line, &pi)) printm(0, FALSE, MSG_NOSPAWN); -} - -void Telnet::SetLocalAddress(SOCKET s) { - SOCKADDR_IN SockAddr; - int size = sizeof(SOCKADDR_IN); - memset(&SockAddr, 0, sizeof(SockAddr)); - SockAddr.sin_family = AF_INET; - - getsockname(Network.GetSocket(), (sockaddr*)&SockAddr, &size); - char ss_b1[4], ss_b2[4], ss_b3[4], ss_b4[4]; - itoa(SockAddr.sin_addr.S_un.S_un_b.s_b1, ss_b1, 10); - itoa(SockAddr.sin_addr.S_un.S_un_b.s_b2, ss_b2, 10); - itoa(SockAddr.sin_addr.S_un.S_un_b.s_b3, ss_b3, 10); - itoa(SockAddr.sin_addr.S_un.S_un_b.s_b4, ss_b4, 10); - - char addr[40]; - strcpy(addr, ss_b1); - strcat(addr, "."); - strcat(addr, ss_b2); - strcat(addr, "."); - strcat(addr, ss_b3); - strcat(addr, "."); - strcat(addr, ss_b4); - strcat(addr, ":0.0"); - - Network.SetLocalAddress(addr); -} - diff --git a/rosapps/net/telnet/src/tnclass.h b/rosapps/net/telnet/src/tnclass.h deleted file mode 100644 index faab2bf3762..00000000000 --- a/rosapps/net/telnet/src/tnclass.h +++ /dev/null @@ -1,74 +0,0 @@ -#ifndef __TNCLASS_H_ -#define __TNCLASS_H_ - -#include -#include "tnconfig.h" -#include "ttelhndl.h" -#include "tncon.h" -#include "tnerror.h" -#include "tparams.h" -#include "keytrans.h" -#include "ansiprsr.h" -#include "tcharmap.h" -#include "tnclip.h" -#include "tmouse.h" -#include "tmapldr.h" - -class Telnet { -public: - // create a telnet instance - Telnet(); - // open a connection return on break/quit - Telnet(const char * szHost1, const char *strPort1); - ~Telnet(); - - // open a connection return on break/quit - int Open(const char *szHost, const char *strPort = "23"); - int Close(); // close current connection - int Resume(); // resume current session - - // changes to the keymap profile in the file - int LoadKeyMap( const char * file, const char * name); - void DisplayKeyMap(); // display available keymaps - int SwitchKeyMap(int); // switch to selected keymap -private: - SOCKET Connect(); - void telSetConsoleTitle(const char * szHost); - void DoInit(); - - SOCKET Socket; - char strPort[32]; // int iPort; - char szHost[127]; - volatile int bConnected; - volatile int bWinsockUp; - volatile int bNetPaused; - volatile int bNetFinished; - volatile int bNetFinish; - - // The order of member classes in the class definition MUST come in - // this order! (Paul Brannan 12/4/98) - TNetwork Network; - TCharmap Charmap; - KeyTranslator KeyTrans; - TMapLoader MapLoader; - TConsole Console; - TTelnetHandler TelHandler; - TelThreadParams ThreadParams; - Tnclip Clipboard; - TMouse Mouse; - TScroller Scroller; - TANSIParser Parser; - - HWND hConsoleWindow; // Paul Brannan 8/10/98 - LPARAM oldBIcon, oldSIcon; // Paul Brannan 8/10/98 - bool iconChange; - - HANDLE hThread; // Paul Brannan 8/11/98 - HANDLE hProcess; // Paul Brannan 7/15/99 - - void NewProcess(); // Paul Brannan 9/13/98 - void SetLocalAddress(SOCKET s); -}; - -#endif - diff --git a/rosapps/net/telnet/src/tnclip.cpp b/rosapps/net/telnet/src/tnclip.cpp deleted file mode 100644 index d957d5ab7a6..00000000000 --- a/rosapps/net/telnet/src/tnclip.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -//Telnet Win32 : an ANSI telnet client. -//Copyright (C) 1998 Paul Brannan -//Copyright (C) 1998 I.Ioannou -//Copyright (C) 1997 Brad Johnson -// -//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. -// -//I.Ioannou -//roryt@hol.gr -// -/////////////////////////////////////////////////////////////////////////// - -// TnClip.cpp -// A simple class for handling clipboard functions -// Written by Paul Brannan -// Last modified 7/12/98 - -#include -#include "tnclip.h" - -Tnclip::Tnclip(HWND W, TNetwork &RefNetwork): Network(RefNetwork) { - Window = W; -} - -Tnclip::~Tnclip() { -} - -void Tnclip::Copy(HGLOBAL clipboard_data) { - if(!OpenClipboard(Window)) return; - if(!EmptyClipboard()) return; - - SetClipboardData(CF_TEXT, clipboard_data); - CloseClipboard(); -} - -void Tnclip::Paste() { - if(!OpenClipboard(Window)) return; - - HANDLE clipboard_data = GetClipboardData(CF_TEXT); - LPVOID clipboard_ptr = GlobalLock(clipboard_data); - DWORD size = strlen((const char *)clipboard_data); - Network.WriteString((const char *)clipboard_ptr, size); - GlobalUnlock(clipboard_data); - - CloseClipboard(); -} - diff --git a/rosapps/net/telnet/src/tnclip.h b/rosapps/net/telnet/src/tnclip.h deleted file mode 100644 index cd20c30e6ec..00000000000 --- a/rosapps/net/telnet/src/tnclip.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef __TNCLIP_H -#define __TNCLIP_H - -#include -#include "tnetwork.h" - -class Tnclip { -private: - HWND Window; - TNetwork &Network; - -public: - Tnclip(HWND Window, TNetwork &RefNetwork); - ~Tnclip(); - - void Copy(HGLOBAL clipboard_data); - void Paste(); -}; - -#endif diff --git a/rosapps/net/telnet/src/tncon.cpp b/rosapps/net/telnet/src/tncon.cpp deleted file mode 100644 index cb9fda54aef..00000000000 --- a/rosapps/net/telnet/src/tncon.cpp +++ /dev/null @@ -1,368 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -//Telnet Win32 : an ANSI telnet client. -//Copyright (C) 1998-2000 Paul Brannan -//Copyright (C) 1998 I.Ioannou -//Copyright (C) 1997 Brad Johnson -// -//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. -// -//I.Ioannou -//roryt@hol.gr -// -/////////////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// -// Module: tncon.cpp -// -// Contents: telnet console processing -// -// Product: telnet -// -// Revisions: August 30, 1998 Paul Brannan -// July 29, 1998 Paul Brannan -// June 15, 1998 Paul Brannan -// May 16, 1998 Paul Brannan -// 5.April.1997 jbj@nounname.com -// 9.Dec.1996 jbj@nounname.com -// Version 2.0 -// -// 02.Apr.1995 igor.milavec@uni-lj.si -// Original code -// -/////////////////////////////////////////////////////////////////////////////// -#include "tncon.h" -#include "keytrans.h" -#include "ttelhndl.h" -#include "tconsole.h" - -#define KEYEVENT InputRecord[i].Event.KeyEvent - -// Paul Brannan 6/25/98 -// #ifdef __MINGW32__ -// #define KEYEVENT_CHAR KEYEVENT.AsciiChar -// #else -#define KEYEVENT_CHAR KEYEVENT.uChar.AsciiChar -// #endif - -#define KEYEVENT_PCHAR &KEYEVENT_CHAR - -// This is for local echo (Paul Brannan 5/16/98) -inline void DoEcho(const char *p, int l, TConsole &Console, - TNetwork &Network, NetParams *pParams) { - // Pause the console (Paul Brannan 8/24/98) - if(Network.get_local_echo()) { - ResetEvent(pParams->hUnPause); - SetEvent(pParams->hPause); - while (!*pParams->bNetPaused); // Pause - - Console.WriteCtrlString(p, l); - - SetEvent(pParams->hUnPause); // Unpause - } -} - -// This is for line mode (Paul Brannan 12/31/98) -static char buffer[1024]; -static unsigned int bufptr = 0; - -// Line mode -- currently uses sga/echo to determine when to enter line mode -// (as in RFC 858), but correct behaviour is as described in RFC 1184. -// (Paul Brannan 12/31/98) -// FIX ME!! What to do with unflushed data when we change from line mode -// to character mode? -inline bool DoLineModeSpecial(char keychar, TConsole &Console, TNetwork &Network, - NetParams *pParams) { - if(keychar == VK_BACK) { - if(bufptr) bufptr--; - DoEcho("\b \b", 3, Console, Network, pParams); - return true; - } else if(keychar == VK_RETURN) { - Network.WriteString(buffer, bufptr); - Network.WriteString("\012", 1); - DoEcho("\r\n", 2, Console, Network, pParams); - bufptr = 0; - return true; - } - return false; -} - -inline void DoLineMode(const char *p, int p_len, TConsole &Console, - TNetwork &Network) { - if(Network.get_line_mode()) { - if(bufptr < sizeof(buffer) + p_len - 1) { - memcpy(buffer + bufptr, p, p_len); - bufptr += p_len; - } else { - Console.Beep(); - } - } else { - Network.WriteString(p, p_len); - } -} - -// Paul Brannan 5/27/98 -// Fixed this code for use with appliation cursor keys -// This should probably be optimized; it's pretty ugly as it is -// Rewrite #1: now uses ClosestStateKey (Paul Brannan 12/9/98) -const char *ClosestStateKey(WORD keyCode, DWORD keyState, - KeyTranslator &KeyTrans) { - char const *p; - - if((p = KeyTrans.TranslateKey(keyCode, keyState))) return p; - - // Check numlock and scroll lock (Paul Brannan 9/23/98) - if((p = KeyTrans.TranslateKey(keyCode, keyState & ~NUMLOCK_ON))) return p; - if((p = KeyTrans.TranslateKey(keyCode, keyState & ~ENHANCED_KEY - & ~NUMLOCK_ON))) return p; - if((p = KeyTrans.TranslateKey(keyCode, keyState & ~SCROLLLOCK_ON))) return p; - if((p = KeyTrans.TranslateKey(keyCode, keyState & ~ENHANCED_KEY - & ~SCROLLLOCK_ON))) return p; - - // John Ioannou (roryt@hol.gr) - // Athens 31/03/97 00:25am GMT+2 - // fix for win95 CAPSLOCK bug - // first check if the user has keys with capslock and then we filter it - if((p = KeyTrans.TranslateKey(keyCode, keyState & ~ENHANCED_KEY))) return p; - if((p = KeyTrans.TranslateKey(keyCode, keyState & ~CAPSLOCK_ON))) return p; - if((p = KeyTrans.TranslateKey(keyCode, keyState & ~ENHANCED_KEY - & ~CAPSLOCK_ON))) return p; - - return 0; // we couldn't find a suitable key translation -} - -const char *FindClosestKey(WORD keyCode, DWORD keyState, - KeyTranslator &KeyTrans) { - char const *p; - - // Paul Brannan 7/20/98 - if(ini.get_alt_erase()) { - if(keyCode == VK_BACK) { - keyCode = VK_DELETE; - keyState |= ENHANCED_KEY; - } else if(keyCode == VK_DELETE && (keyState & ENHANCED_KEY)) { - keyCode = VK_BACK; - keyState &= ~ENHANCED_KEY; - } - } - - DWORD ext_mode = KeyTrans.get_ext_mode(); - if(ext_mode) { - // Not as fast as an unrolled loop, but certainly more - // compact (Paul Brannan 12/9/98) - for(DWORD j = ext_mode; j >= APP_KEY; j -= APP_KEY) { - if((j | ext_mode) == ext_mode) { - if((p = ClosestStateKey(keyCode, keyState | j, - KeyTrans))) return p; - } - } - } - return ClosestStateKey(keyCode, keyState, KeyTrans); -} - -// Paul Brannan Feb. 22, 1999 -int do_op(tn_ops op, TNetwork &Network, Tnclip &Clipboard) { - switch(op) { - case TN_ESCAPE: - return TNPROMPT; - case TN_SCROLLBACK: - return TNSCROLLBACK; - case TN_DIAL: - return TNSPAWN; - case TN_PASTE: - if(ini.get_keyboard_paste()) Clipboard.Paste(); - else return 0; - break; - case TN_NULL: - Network.WriteString("", 1); - return 0; - case TN_CR: - Network.WriteString("\r", 2); // CR must be followed by NUL - return 0; - case TN_CRLF: - Network.WriteString("\r\n", 2); - return 0; - } - return 0; -} - -int telProcessConsole(NetParams *pParams, KeyTranslator &KeyTrans, - TConsole &Console, TNetwork &Network, TMouse &Mouse, - Tnclip &Clipboard, HANDLE hThread) -{ - KeyDefType_const keydef; - const char *p; - int p_len; - unsigned int i; - int opval; - HANDLE hConsole = GetStdHandle(STD_INPUT_HANDLE); - - SetConsoleMode(hConsole, ini.get_enable_mouse() ? ENABLE_MOUSE_INPUT : 0); - - const DWORD nHandle = 2; - HANDLE hHandle[nHandle] = {hConsole, pParams->hExit}; - - for (;;) { - DWORD dwInput; - switch (WaitForMultipleObjects(nHandle, hHandle, FALSE, INFINITE)) { - case WAIT_OBJECT_0: { - - // Paul Brannan 7/29/98 - if(ini.get_input_redir()) { - char InputBuffer[10]; - - // Correction from Joe Manns - // to fix race conditions (4/13/99) - int bResult; - bResult = ReadFile(hConsole, InputBuffer, 10, &dwInput, 0); - if(bResult && dwInput == 0) return TNNOCON; - - // no key translation for redirected input - Network.WriteString(InputBuffer, dwInput); - break; - } - - INPUT_RECORD InputRecord[11]; - if (!ReadConsoleInput(hConsole, &InputRecord[0], 10, &dwInput)) - return TNPROMPT; - - for (i = 0; (unsigned)i < dwInput; i++){ - switch (InputRecord[i].EventType) { - case KEY_EVENT:{ - if (KEYEVENT.bKeyDown) { - - WORD keyCode = KEYEVENT.wVirtualKeyCode; - DWORD keyState = KEYEVENT.dwControlKeyState; - - // Paul Brannan 5/27/98 - // Moved the code that was here to FindClosestKey() - keydef.szKeyDef = FindClosestKey(keyCode, - keyState, KeyTrans); - - if(keydef.szKeyDef) { - if(!keydef.op->sendstr) - if((opval = do_op(keydef.op->the_op, Network, - Clipboard)) != 0) - return opval; - } - - if(Network.get_line_mode()) { - if(DoLineModeSpecial(KEYEVENT_CHAR, Console, Network, pParams)) - continue; - } - - p = keydef.szKeyDef; - if (p == NULL) { // if we don't have a translator - if(!KEYEVENT_CHAR) continue; - p_len = 1; - p = KEYEVENT_PCHAR; - } else { - p_len = strlen(p); - } - - // Local echo (Paul Brannan 5/16/98) - DoEcho(p, p_len, Console, Network, pParams); - // Line mode (Paul Brannan 12/31/98) - DoLineMode(p, p_len, Console, Network); - } - } - break; - - case MOUSE_EVENT: - if(!InputRecord[i].Event.MouseEvent.dwEventFlags) { - ResetEvent(pParams->hUnPause); - SetEvent(pParams->hPause); - while (!*pParams->bNetPaused); // thread paused - // SuspendThread(hThread); - - // Put the mouse's X and Y coords back into the - // input buffer - DWORD Result; - WriteConsoleInput(hConsole, &InputRecord[i], 1, - &Result); - - Mouse.doMouse(); - - SetEvent(pParams->hUnPause); - // ResumeThread(hThread); - } - break; - - case FOCUS_EVENT: - break; - case WINDOW_BUFFER_SIZE_EVENT: - // FIX ME!! This should take care of the window re-sizing bug - // Unfortunately, it doesn't. - Console.sync(); - Network.do_naws(Console.GetWidth(), Console.GetHeight()); - break; - } - - } // keep going until no more input - break; - } - default: - return TNNOCON; - } - } -} - -WORD scrollkeys() { - HANDLE hConsole = GetStdHandle(STD_INPUT_HANDLE); - INPUT_RECORD InputRecord; - BOOL done = FALSE; - - while (!done) { - DWORD dwInput; - WaitForSingleObject( hConsole, INFINITE ); - if (!ReadConsoleInput(hConsole, &InputRecord, 1, &dwInput)){ - done = TRUE; - continue; - } - if (InputRecord.EventType == KEY_EVENT && - InputRecord.Event.KeyEvent.bKeyDown ) { - // Why not just return the key code? (Paul Brannan 12/5/98) - return InputRecord.Event.KeyEvent.wVirtualKeyCode; - } else if(InputRecord.EventType == MOUSE_EVENT) { - if(!InputRecord.Event.MouseEvent.dwEventFlags) { - // Put the mouse's X and Y coords back into the input buffer - WriteConsoleInput(hConsole, &InputRecord, 1, &dwInput); - return SC_MOUSE; - } - } - } - return SC_ESC; -} - -// FIX ME!! This is more evidence that tncon.cpp ought to have class structure -// (Paul Brannan 12/10/98) - -// Bryan Montgomery 10/14/98 -static TNetwork net; -void setTNetwork(TNetwork tnet) { - net = tnet; -} - -// Thomas Briggs 8/17/98 -BOOL WINAPI ControlEventHandler(DWORD event) { - switch(event) { - case CTRL_BREAK_EVENT: - // Bryan Montgomery 10/14/98 - if(ini.get_control_break_as_c()) net.WriteString("\x3",1); - return TRUE; - default: - return FALSE; - } -} diff --git a/rosapps/net/telnet/src/tncon.h b/rosapps/net/telnet/src/tncon.h deleted file mode 100644 index d8b94142e1d..00000000000 --- a/rosapps/net/telnet/src/tncon.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef __TNCON_H -#define __TNCON_H - -#include "tparams.h" -#include "tnclip.h" -#include "ttelhndl.h" - -enum { - SC_UP, - SC_DOWN, - SC_ESC, - SC_MOUSE -}; - -enum { - TNNOCON, - TNPROMPT, - TNSCROLLBACK, - TNSPAWN, - TNDONE -}; - -int telProcessConsole(NetParams *pParams, KeyTranslator &KeyTrans, - TConsole &Console, TNetwork &Network, TMouse &Mouse, - Tnclip &Clipboard, HANDLE hThread); -WORD scrollkeys (); - -// Thomas Briggs 8/17/98 -BOOL WINAPI ControlEventHandler(DWORD); - -// Bryan Montgomery 10/14/98 -void setTNetwork(TNetwork); - -#endif diff --git a/rosapps/net/telnet/src/tnconfig.cpp b/rosapps/net/telnet/src/tnconfig.cpp deleted file mode 100644 index 4440e970867..00000000000 --- a/rosapps/net/telnet/src/tnconfig.cpp +++ /dev/null @@ -1,704 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -//Telnet Win32 : an ANSI telnet client. -//Copyright (C) 1998-2000 Paul Brannan -//Copyright (C) 1998 I.Ioannou -//Copyright (C) 1997 Brad Johnson -// -//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. -// -//I.Ioannou -//roryt@hol.gr -// -/////////////////////////////////////////////////////////////////////////// - -// tnconfig.cpp -// Written by Paul Brannan -// Last modified August 30, 1998 -// -// This is a class designed for use with Brad Johnson's Console Telnet -// see the file tnconfig.h for more information - -#include -#include -#include -#include -#include -#include -#include -#include "tnconfig.h" - -// Turn off the "forcing value to bool 'true' or 'false'" warning -#ifdef _MSC_VER -#pragma warning(disable: 4800) -#endif - -// This is the ini variable that is used for everybody -TConfig ini; - -TConfig::TConfig() { - // set all default values - startdir[0] = '\0'; - keyfile[0] = '\0'; - inifile[0] = '\0'; - dumpfile[0] = '\0'; - term[0] = '\0'; - default_config[0] = '\0'; - strcpy(printer_name, "LPT1"); - - input_redir = 0; - output_redir = 0; - strip_redir = FALSE; - - dstrbksp = FALSE; - eightbit_ansi = FALSE; - vt100_mode = FALSE; - disable_break = FALSE; - speaker_beep = TRUE; - do_beep = TRUE; - preserve_colors = FALSE; - wrapline = TRUE; - lock_linewrap = FALSE; - fast_write = TRUE; - enable_mouse = TRUE; - alt_erase = FALSE; - wide_enable = FALSE; - keyboard_paste = FALSE; - set_title = TRUE; - - blink_bg = -1; - blink_fg = 2; - underline_bg = -1; - underline_fg = 3; - ulblink_bg = -1; - ulblink_fg = 1; - normal_bg = -1; - normal_fg = -1; - scroll_bg = 0; - scroll_fg = 7; - status_bg = 1; - status_fg = 15; - - buffer_size = 2048; - - term_width = -1; - term_height = -1; - window_width = -1; - window_height = -1; - - strcpy(escape_key, "]"); - strcpy(scrollback_key, "["); - strcpy(dial_key, "\\"); - strcpy(default_config, "ANSI"); - strcpy(term, "ansi"); - - strcpy(scroll_mode, "DUMP"); - scroll_size=32000; - scroll_enable=TRUE; - - host[0] = '\0'; - port = "23"; - - init_varlist(); - - aliases = NULL; -} - -TConfig::~TConfig() { - if(aliases) { - for(int j = 0; j < alias_total; j++) delete[] aliases[j]; - delete[] aliases; - } -} - -enum ini_data_type { - INI_STRING, - INI_INT, - INI_BOOL -}; - -enum { - INIFILE, - KEYFILE, - DUMPFILE, - DEFAULT_CONFIG, - TERM, - INPUT_REDIR, - OUTPUT_REDIR, - STRIP_REDIR, - DSTRBKSP, - EIGHTBIT_ANSI, - VT100_MODE, - DISABLE_BREAK, - SPEAKER_BEEP, - DO_BEEP, - PRESERVE_COLORS, - WRAP_LINE, - LOCK_LINEWRAP, - FAST_WRITE, - TERM_WIDTH, - TERM_HEIGHT, - WINDOW_WIDTH, - WINDOW_HEIGHT, - WIDE_ENABLE, - CTRLBREAK_AS_CTRLC, - BUFFER_SIZE, - SET_TITLE, - BLINK_BG, - BLINK_FG, - UNDERLINE_BG, - UNDERLINE_FG, - ULBLINK_BG, - ULBLINK_FG, - NORMAL_BG, - NORMAL_FG, - SCROLL_BG, - SCROLL_FG, - STATUS_BG, - STATUS_FG, - PRINTER_NAME, - ENABLE_MOUSE, - ESCAPE_KEY, - SCROLLBACK_KEY, - DIAL_KEY, - ALT_ERASE, - KEYBOARD_PASTE, - SCROLL_MODE, - SCROLL_SIZE, - SCROLL_ENABLE, - SCRIPTNAME, - SCRIPT_ENABLE, - NETPIPE, - IOPIPE, - - MAX_INI_VARS // must be last -}; - -struct ini_variable { - char *name; // variable name - char *section; // name of ini file section the variable is in - enum ini_data_type data_type; // type of data - void *ini_data; // pointer to data - int max_size; // max size if string -}; - -// Note: default values are set in the constructor, TConfig() -ini_variable ini_varlist[MAX_INI_VARS]; - -enum { - KEYBOARD, - TERMINAL, - COLORS, - MOUSE, - PRINTER, - SCROLLBACK, - SCRIPTING, - PIPES, - - MAX_INI_GROUPS // Must be last -}; - -char *ini_groups[MAX_INI_GROUPS]; - -void TConfig::init_varlist() { - static const ini_variable static_ini_varlist[MAX_INI_VARS] = { - {"Inifile", NULL, INI_STRING, &inifile, sizeof(inifile)}, - {"Keyfile", "Keyboard", INI_STRING, &keyfile, sizeof(keyfile)}, - {"Dumpfile", "Terminal", INI_STRING, &dumpfile, sizeof(dumpfile)}, - {"Default_Config","Keyboard", INI_STRING, &default_config, sizeof(default_config)}, - {"Term", "Terminal", INI_STRING, &term, sizeof(term)}, - {"Input_Redir", "Terminal", INI_INT, &input_redir, 0}, - {"Output_Redir","Terminal", INI_INT, &output_redir, 0}, - {"Strip_Redir", "Terminal", INI_BOOL, &strip_redir, 0}, - {"Destructive_Backspace","Terminal",INI_BOOL, &dstrbksp, 0}, - {"EightBit_Ansi","Terminal", INI_BOOL, &eightbit_ansi, 0}, - {"VT100_Mode", "Terminal", INI_BOOL, &vt100_mode, 0}, - {"Disable_Break","Terminal", INI_BOOL, &disable_break, 0}, - {"Speaker_Beep","Terminal", INI_BOOL, &speaker_beep, 0}, - {"Beep", "Terminal", INI_BOOL, &do_beep, 0}, - {"Preserve_Colors","Terminal", INI_BOOL, &preserve_colors, 0}, - {"Wrap_Line", "Terminal", INI_BOOL, &wrapline, 0}, - {"Lock_linewrap","Terminal", INI_BOOL, &lock_linewrap, 0}, - {"Fast_Write", "Terminal", INI_BOOL, &fast_write, 0}, - {"Term_Width", "Terminal", INI_INT, &term_width, 0}, - {"Term_Height", "Terminal", INI_INT, &term_height, 0}, - {"Window_Width","Terminal", INI_INT, &window_width, 0}, - {"Window_Height","Terminal", INI_INT, &window_height, 0}, - {"Wide_Enable", "Terminal", INI_BOOL, &wide_enable, 0}, - {"Ctrlbreak_as_Ctrlc","Keyboard", INI_BOOL, &ctrlbreak_as_ctrlc, 0}, - {"Buffer_Size", "Terminal", INI_INT, &buffer_size, 0}, - {"Set_Title", "Terminal", INI_BOOL, &set_title, 0}, - {"Blink_bg", "Colors", INI_INT, &blink_bg, 0}, - {"Blink_fg", "Colors", INI_INT, &blink_fg, 0}, - {"Underline_bg","Colors", INI_INT, &underline_bg, 0}, - {"Underline_fg","Colors", INI_INT, &underline_fg, 0}, - {"UlBlink_bg", "Colors", INI_INT, &ulblink_bg, 0}, - {"UlBlink_fg", "Colors", INI_INT, &ulblink_fg, 0}, - {"Normal_bg", "Colors", INI_INT, &normal_bg, 0}, - {"Normal_fg", "Colors", INI_INT, &normal_fg, 0}, - {"Scroll_bg", "Colors", INI_INT, &scroll_bg, 0}, - {"Scroll_fg", "Colors", INI_INT, &scroll_fg, 0}, - {"Status_bg", "Colors", INI_INT, &status_bg, 0}, - {"Status_fg", "Colors", INI_INT, &status_fg, 0}, - {"Enable_Mouse","Mouse", INI_BOOL, &enable_mouse, 0}, - {"Printer_Name","Printer", INI_STRING, &printer_name, sizeof(printer_name)}, - {"Escape_Key", "Keyboard", INI_STRING, &escape_key, 1}, - {"Scrollback_Key","Keyboard", INI_STRING, &scrollback_key, 1}, - {"Dial_Key", "Keyboard", INI_STRING, &dial_key, 1}, - {"Alt_Erase", "Keyboard", INI_BOOL, &alt_erase, 0}, - {"Keyboard_Paste","Keyboard", INI_BOOL, &keyboard_paste, 0}, - {"Scroll_Mode", "Scrollback", INI_STRING, &scroll_mode, sizeof(scroll_mode)}, - {"Scroll_Size", "Scrollback", INI_INT, &scroll_size, 0}, - {"Scroll_Enable","Scrollback", INI_BOOL, &scroll_enable, 0}, - {"Scriptname", "Scripting", INI_STRING, &scriptname, sizeof(scriptname)}, - {"Script_enable","Scripting", INI_BOOL, &script_enable, 0}, - {"Netpipe", "Pipes", INI_STRING, &netpipe, sizeof(netpipe)}, - {"Iopipe", "Pipes", INI_STRING, &iopipe, sizeof(iopipe)} - }; - - static const char *static_ini_groups[MAX_INI_GROUPS] = { - "Keyboard", - "Terminal", - "Colors", - "Mouse", - "Printer", - "Scrollback", - "Scripting", - "Pipes" - }; - - memcpy(ini_varlist, static_ini_varlist, sizeof(ini_varlist)); - memcpy(ini_groups, static_ini_groups, sizeof(ini_groups)); -} - -void TConfig::init(char *dirname, char *execname) { - // Copy temporary dirname to permanent startdir - strncpy(startdir, dirname, sizeof(startdir)); - startdir[sizeof(startdir) - 1] = 0; - - // Copy temp execname to permanent exename (Thomas Briggs 12/7/98) - strncpy(exename, execname, sizeof(exename)); - exename[sizeof(exename) - 1] = 0; - - // Initialize INI file - inifile_init(); - - // Initialize redir - // Note that this must be done early, so error messages will be printed - // properly - redir_init(); - - // Initialize aliases (Paul Brannan 1/1/99) - init_aliases(); - - // Make sure the file that we're trying to work with exists - int iResult = access(inifile, 04); - - // Thomas Briggs 9/14/98 - if( iResult == 0 ) - // Tell the user what file we are reading - // We cannot print any messages before initializing telnet_redir - printm(0, FALSE, MSG_CONFIG, inifile); - else - // Tell the user that the file doesn't exist, but later read the - // file anyway simply to populate the defaults - printm(0, FALSE, MSG_NOINI, inifile); - - init_vars(); // Initialize misc. vars - keyfile_init(); // Initialize keyfile -} - -// Alias support (Paul Brannan 1/1/99) -void TConfig::init_aliases() { - char *buffer; - alias_total = 0; - - // Find the correct buffer size - // FIX ME!! some implementations of Mingw32 don't have a - // GetPrivateProfileSecionNames function. What do we do about this? -#ifndef __MINGW32__ - { - int size=1024, Result = 0; - for(;;) { - buffer = new char[size]; - Result = GetPrivateProfileSectionNames(buffer, size, inifile); - if(Result < size - 2) break; - size *= 2; - delete[] buffer; - } - } -#else - return; -#endif - - // Find the maximum number of aliases - int max = 0; - char *tmp; - for(tmp = buffer; *tmp != 0; tmp += strlen(tmp) + 1) - max++; - - aliases = new char*[max]; - - // Load the aliases into an array - for(tmp = buffer; *tmp != 0; tmp += strlen(tmp) + 1) { - int flag = 0; - for(int j = 0; j < MAX_INI_GROUPS; j++) { - if(!stricmp(ini_groups[j], tmp)) flag = 1; - } - if(!flag) { - aliases[alias_total] = new char[strlen(tmp)+1]; - strcpy(aliases[alias_total], tmp); - alias_total++; - } - } - - delete[] buffer; -} - -void TConfig::print_aliases() { - for(int j = 0; j < alias_total; j++) { - char alias_name[20]; - set_string(alias_name, aliases[j], sizeof(alias_name)); - for(unsigned int i = strlen(alias_name); i < sizeof(alias_name) - 1; i++) - alias_name[i] = ' '; - alias_name[sizeof(alias_name) - 1] = 0; - printit(alias_name); - if((j % 4) == 3) printit("\n"); - } - printit("\n"); -} - -bool find_alias(const char *alias_name) { - return false; -} - -void TConfig::print_vars() { - int j; - for(j = 0; j < MAX_INI_VARS; j++) { - if(print_value(ini_varlist[j].name) > 40) printit("\n"); - else if(j % 2) printit("\n"); - else printit("\t"); - } - if(j % 2) printit("\n"); -} - -// Paul Brannan 9/3/98 -void TConfig::print_vars(char *s) { - if(!strnicmp(s, "all", 3)) { // Print out all vars - print_vars(); - return; - } - - // See if the group exists - int j, flag; - for(j = 0, flag = 0; j < MAX_INI_GROUPS; j++) - if(!stricmp(ini_groups[j], s)) break; - // If not, print out the value of the variable by that name - if(j == MAX_INI_GROUPS) { - print_value(s); - printit("\n"); - return; - } - - // Print out the vars in the given group - int count = 0; - for(j = 0; j < MAX_INI_VARS; j++) { - if(ini_varlist[j].section == NULL) continue; - if(!stricmp(ini_varlist[j].section, s)) { - if(print_value(ini_varlist[j].name) > 40) printit("\n"); - else if(count % 2) printit("\n"); - else printit("\t"); - count++; - } - } - if(count % 2) printit("\n"); -} - -// Paul Brannan 9/3/98 -void TConfig::print_groups() { - for(int j = 0; j < MAX_INI_GROUPS; j++) { - char group_name[20]; - set_string(group_name, ini_groups[j], sizeof(group_name)); - for(unsigned int i = strlen(group_name); i < sizeof(group_name) - 1; i++) - group_name[i] = ' '; - group_name[sizeof(group_name) - 1] = 0; - printit(group_name); - if((j % 4) == 3) printit("\n"); - } - printit("\n"); -} - -// Ioannou : The index in the while causes segfaults if there is no match -// changes to for(), and strcmp to stricmp (prompt gives rong names) - -bool TConfig::set_value(const char *var, const char *value) { - //int j = 0; - //while(strcmp(var, ini_varlist[j].name) && j < MAX_INI_VARS) j++; - for (int j = 0; j < MAX_INI_VARS; j++) - { - if (stricmp(var, ini_varlist[j].name) == 0) - { - switch(ini_varlist[j].data_type) { - case INI_STRING: - set_string((char *)ini_varlist[j].ini_data, value, - ini_varlist[j].max_size); - break; - case INI_INT: - *(int *)ini_varlist[j].ini_data = atoi(value); - break; - case INI_BOOL: - set_bool((bool *)ini_varlist[j].ini_data, value); - break; - } - // j = MAX_INI_VARS; - return TRUE; - } - } - return FALSE; -} - -int TConfig::print_value(const char *var) { - //int j = 0; - //while(strcmp(var, ini_varlist[j].name) && j < MAX_INI_VARS) j++; - int Result = 0; - for (int j = 0; j < MAX_INI_VARS; j++) - { - if (stricmp(var, ini_varlist[j].name) == 0) - { - char var_name[25]; - set_string(var_name, var, sizeof(var_name)); - for(unsigned int i = strlen(var_name); i < sizeof(var_name) - 1; i++) - var_name[i] = ' '; - var_name[sizeof(var_name) - 1] = 0; - Result = sizeof(var_name); - - printit(var_name); - printit("\t"); - Result = Result / 8 + 8; - - switch(ini_varlist[j].data_type) { - case INI_STRING: - printit((char *)ini_varlist[j].ini_data); - Result += strlen((char *)ini_varlist[j].ini_data); - break; - case INI_INT: - char buffer[20]; // this may not be safe - // Ioannou : Paul this was _itoa, but Borland needs itoa !! - itoa(*(int *)ini_varlist[j].ini_data, buffer, 10); - printit(buffer); - Result += strlen(buffer); - break; - case INI_BOOL: - if(*(bool *)ini_varlist[j].ini_data == true) { - printit("on"); - Result += 2; - } else { - printit("off"); - Result += 3; - } - } - // printit("\n"); - j = MAX_INI_VARS; - } - } - return Result; -} - -void TConfig::init_vars() { - char buffer[4096]; - for(int j = 0; j < MAX_INI_VARS; j++) { - if(ini_varlist[j].section != NULL) { - GetPrivateProfileString(ini_varlist[j].section, ini_varlist[j].name, "", - buffer, sizeof(buffer), inifile); - if(*buffer != 0) set_value(ini_varlist[j].name, buffer); - } - } -} - -void TConfig::inifile_init() { - // B. K. Oxley 9/16/98 - char* env_telnet_ini = getenv (ENV_TELNET_INI); - if (env_telnet_ini && *env_telnet_ini) { - strncpy (inifile, env_telnet_ini, sizeof(inifile)); - return; - } - - strcpy(inifile, startdir); - if (sizeof(inifile) >= strlen(inifile)+strlen("telnet.ini")) { - strcat(inifile,"telnet.ini"); // add the default filename to the path - } else { - // if there is not enough room set the path to nothing - strcpy(inifile,""); - } -} - -void TConfig::keyfile_init() { - // check to see if there is a key config file environment variable. - char *k; - if ((k = getenv(ENV_TELNET_CFG)) == NULL){ - // if there is no environment variable - GetPrivateProfileString("Keyboard", "Keyfile", "", keyfile, - sizeof(keyfile), inifile); - if(keyfile == 0 || *keyfile == 0) { - // and there is no profile string - strcpy(keyfile, startdir); - if (sizeof(keyfile) >= strlen(keyfile)+strlen("telnet.cfg")) { - struct stat buf; - - strcat(keyfile,"telnet.cfg"); // add the default filename to the path - if(stat(keyfile, &buf) != 0) { - char *s = keyfile + strlen(keyfile) - strlen("telnet.cfg"); - strcpy(s, "keys.cfg"); - } - } else { - // if there is not enough room set the path to nothing - strcpy(keyfile,""); - } - - // Vassili Bourdo (vassili_bourdo@softhome.net) - } else { - // check that keyfile really exists - if( access(keyfile,04) == -1 ) { - //it does not... - char pathbuf[MAX_PATH], *fn; - //substitute keyfile path with startdir path - if((fn = strrchr(keyfile,'\\'))) strcpy(keyfile,fn); - strcat(strcpy(pathbuf,startdir),keyfile); - //check that startdir\keyfile does exist - if( access(pathbuf,04) == -1 ) { - //it does not... - //so, look for it in all paths - _searchenv(keyfile, "PATH", pathbuf); - if( *pathbuf == 0 ) //no luck - revert it to INI file value - GetPrivateProfileString("Keyboard", "Keyfile", "", - keyfile, sizeof(keyfile), inifile); - } else { - strcpy(keyfile, pathbuf); - } - } - } - //// - - } else { - // set the keyfile to the value of the environment variable - strncpy(keyfile, k, sizeof(keyfile)); - } -} - -void TConfig::redir_init() { - // check to see if the environment variable 'TELNET_REDIR' is not 0; - char* p = getenv(ENV_TELNET_REDIR); - if (p) { - input_redir = output_redir = atoi(p); - if((p = getenv(ENV_INPUT_REDIR))) input_redir = atoi(p); - if((p = getenv(ENV_OUTPUT_REDIR))) output_redir = atoi(p); - } else { - input_redir = output_redir = GetPrivateProfileInt("Terminal", - "Telnet_Redir", 0, inifile); - input_redir = GetPrivateProfileInt("Terminal", - "Input_Redir", input_redir, inifile); - output_redir = GetPrivateProfileInt("Terminal", - "Output_Redir", output_redir, inifile); - } - if ((input_redir > 1) || (output_redir > 1)) - setlocale(LC_CTYPE,""); - // tell isprint() to not ignore local characters, if the environment - // variable "LANG" has a valid value (e.g. LANG=de for german characters) - // and the file LOCALE.BLL is installed somewhere along the PATH. -} - -// Modified not to use getopt() by Paul Brannan 12/17/98 -bool TConfig::Process_Params(int argc, char *argv[]) { - int optind = 1; - char *optarg = argv[optind]; - char c; - - while(optind < argc) { - if(argv[optind][0] != '-') break; - - // getopt - c = argv[optind][1]; - if(argv[optind][2] == 0) - optarg = argv[++optind]; - else - optarg = &argv[optind][2]; - optind++; - - switch(c) { - case 'd': - set_string(dumpfile, optarg, sizeof(dumpfile)); - printm(0, FALSE, MSG_DUMPFILE, dumpfile); - break; - // added support for setting options on the command-line - // (Paul Brannan 7/31/98) - case '-': - { - int j; - for(j = 0; optarg[j] != ' ' && optarg[j] != '=' && optarg[j] != 0; j++); - if(optarg == 0) { - printm(0, FALSE, MSG_USAGE); // print a usage message - printm(0, FALSE, MSG_USAGE_1); - return FALSE; - } - optarg[j] = 0; - if(!set_value(optarg, &optarg[j+1])) - printm(0, FALSE, MSG_BADVAL, optarg); - } - break; - default: - printm(0, FALSE, MSG_USAGE); // print a usage message - printm(0, FALSE, MSG_USAGE_1); - return FALSE; - } - } - if(optind < argc) - set_string(host, argv[optind++], sizeof(host)-1); - if(!strnicmp(host, "telnet://", 9)) { - // we have a URL to parse - char *s, *t; - - for(s = host+9, t = host; *s != 0; *(t++) = *(s++)); - *t = 0; - for(s = host; *s != ':' && *s != 0; s++); - if(*s != 0) { - *(s++) = 0; - port = s; - } - } - if(optind < argc) - port = argv[optind++]; - - return TRUE; -} - -void TConfig::set_string(char *dest, const char *src, const int length) { - int l = length; - strncpy(dest, src, l); - // dest[length-1] = '\0'; - // Ioannou : this messes strings - is this really needed ? - // The target string, dest, might not be null-terminated - // if the length of src is length or more. - // it should be dest[length] = '\0' for strings with length 1 - // (Escape_string etc), but doesn't work with others (like host). - // dest is long enough to avoid this in all the tested cases -} - -// Ioannou : ignore case for true or on - -void TConfig::set_bool(bool *boolval, const char *str) { - if(!stricmp(str, "true")) *boolval = true; - else if(!stricmp(str, "on")) *boolval = true; - else *boolval = (bool)atoi(str); -} - diff --git a/rosapps/net/telnet/src/tnconfig.h b/rosapps/net/telnet/src/tnconfig.h deleted file mode 100644 index 31084df5ab5..00000000000 --- a/rosapps/net/telnet/src/tnconfig.h +++ /dev/null @@ -1,211 +0,0 @@ -// Tnconfig.h -// Written by Paul Brannan -// -// This is a class designed for use with Brad Johnson's Console Telnet -// It reads an ini file and keeps the settings for later retrieval. -// It does not store any information about the current settings, only default -// or recommended settings. - -#ifndef __TNCONFIG_H -#define __TNCONFIG_H - -// Ioannou 2 June 98: Borland needs them - quick hack -#ifdef __BORLANDC__ -#define bool BOOL -#define true TRUE -#define false FALSE -#endif // __BORLANDC__ - -#include "tnerror.h" - -#define ENV_TELNET_CFG "TELNET_CFG" -#define ENV_TELNET_REDIR "TELNET_REDIR" -#define ENV_INPUT_REDIR "TELNET_INPUT_REDIR" -#define ENV_OUTPUT_REDIR "TENLET_OUTPUT_REDIR" -#define ENV_TELNET_INI "TELNET_INI" - -class TConfig { -public: - TConfig(); - ~TConfig(); - - // Miscellaneous strings - const char *get_startdir() const {return startdir;} - const char *get_exename() const {return exename;} - const char *get_keyfile() const {return keyfile;} - const char *get_inifile() const {return inifile;} - const char *get_dumpfile() const {return dumpfile;} - const char *get_term() const {return term;} - const char *get_printer_name() const {return printer_name;} - const char *get_default_config() const {return default_config;} - - // Terminal settings - int get_input_redir() const {return input_redir;} - int get_output_redir() const {return output_redir;} - bool get_strip_redir() const {return strip_redir;} - bool get_dstrbksp() const {return dstrbksp;} - bool get_eightbit_ansi() const {return eightbit_ansi;} - bool get_vt100_mode() const {return vt100_mode;} - bool get_disable_break() const {return disable_break;} - bool get_speaker_beep() const {return speaker_beep;} - bool get_do_beep() const {return do_beep;} - bool get_preserve_colors() const {return preserve_colors;} - bool get_wrapline() const {return wrapline;} - bool get_fast_write() const {return fast_write;} - bool get_lock_linewrap() const {return lock_linewrap;} - bool get_set_title() const { return set_title;} - int get_term_width() const {return term_width;} - int get_term_height() const {return term_height;} - int get_window_width() const {return window_width;} - int get_window_height() const {return window_height;} - bool get_wide_enable() const {return wide_enable;} - bool get_control_break_as_c() const {return ctrlbreak_as_ctrlc;} - int get_buffer_size() const {return buffer_size;} - - // Colors - int get_blink_bg() const {return blink_bg;} - int get_blink_fg() const {return blink_fg;} - int get_underline_bg() const {return underline_bg;} - int get_underline_fg() const {return underline_fg;} - int get_ulblink_bg() const {return ulblink_bg;} - int get_ulblink_fg() const {return ulblink_fg;} - int get_normal_bg() const {return normal_bg;} - int get_normal_fg() const {return normal_fg;} - int get_scroll_bg() const {return scroll_bg;} - int get_scroll_fg() const {return scroll_fg;} - int get_status_bg() const {return status_bg;} - int get_status_fg() const {return status_fg;} - - // Mouse - bool get_enable_mouse() const {return enable_mouse;} - - // Keyboard - char get_escape_key() const {return escape_key[0];} - char get_scrollback_key() const {return scrollback_key[0];} - char get_dial_key() const {return dial_key[0];} - bool get_alt_erase() const {return alt_erase;} - bool get_keyboard_paste() const {return keyboard_paste;} - - // Scrollback - const char *get_scroll_mode() const {return scroll_mode;} - bool get_scroll_enable() const {return scroll_enable;} - int get_scroll_size() const {return scroll_size;} - - // Scripting - const char *get_scriptname() const {return scriptname;} - bool get_script_enable() const {return script_enable;} - - // Pipes - const char *get_netpipe() const {return netpipe;} - const char *get_iopipe() const {return iopipe;} - - // Host configuration - const char *get_host() const {return host;} - const char *get_port() const {return port;} - - // Initialization - void init(char *dirname, char *exename); - bool Process_Params(int argc, char *argv[]); - - // Ini variables - void print_vars(); - void print_vars(char *s); - void print_groups(); - bool set_value(const char *var, const char *value); - int print_value(const char *var); - - // Aliases - void print_aliases(); - bool find_alias(const char *alias_name); - -private: - - void inifile_init(); - void keyfile_init(); - void redir_init(); - void init_varlist(); - void init_vars(); - void init_aliases(); - void set_string(char *dest, const char *src, const int length); - void set_bool(bool *boolval, const char *str); - - // Miscellaneous strings - char startdir[MAX_PATH]; - char exename[MAX_PATH]; - char keyfile[MAX_PATH*2]; - char inifile[MAX_PATH*2]; - char dumpfile[MAX_PATH*2]; - char printer_name[MAX_PATH*2]; - char term[128]; - char default_config[128]; - - // Terminal - int input_redir, output_redir; - bool strip_redir; - bool dstrbksp; - bool eightbit_ansi; - bool vt100_mode; - bool disable_break; - bool speaker_beep; - bool do_beep; - bool preserve_colors; - bool wrapline; - bool lock_linewrap; - bool fast_write; - bool set_title; - int term_width, term_height; - int window_width, window_height; - bool wide_enable; - bool ctrlbreak_as_ctrlc; - int buffer_size; - - // Colors - int blink_bg; - int blink_fg; - int underline_bg; - int underline_fg; - int ulblink_bg; - int ulblink_fg; - int normal_bg; - int normal_fg; - int scroll_bg; - int scroll_fg; - int status_bg; - int status_fg; - - // Mouse - bool enable_mouse; - - // Keyboard - char escape_key[2]; - char scrollback_key[2]; - char dial_key[2]; - bool alt_erase; - bool keyboard_paste; - - // Scrollback - char scroll_mode[8]; - bool scroll_enable; - int scroll_size; - - // Scripting - char scriptname[MAX_PATH*2]; - bool script_enable; - - // Pipes - char netpipe[MAX_PATH*2]; - char iopipe[MAX_PATH*2]; - - // Host configration - char host[128]; - char *port; - - // Aliases - char **aliases; - int alias_total; - -}; - -extern TConfig ini; - -#endif diff --git a/rosapps/net/telnet/src/tnerror.cpp b/rosapps/net/telnet/src/tnerror.cpp deleted file mode 100644 index 74249cb55a0..00000000000 --- a/rosapps/net/telnet/src/tnerror.cpp +++ /dev/null @@ -1,220 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -//Telnet Win32 : an ANSI telnet client. -//Copyright (C) 1998-2000 Paul Brannan -//Copyright (C) 1998 I.Ioannou -//Copyright (C) 1997 Brad Johnson -// -//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. -// -//I.Ioannou -//roryt@hol.gr -// -/////////////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// -// Module: tnerror.cpp -// -// Contents: error reporting -// -// Product: telnet -// -// Revisions: June 15, 1998 Paul Brannan -// May 15, 1998 Paul Brannan -// 5.April.1997 jbj@nounname.com -// 5.Dec.1996 jbj@nounname.com -// Version 2.0 -// -// 02.Apr.1995 igor.milavec@uni-lj.si -// Original code -// -/////////////////////////////////////////////////////////////////////////////// - -#include "tnerror.h" -#include "ttelhndl.h" // Paul Brannan 5/25/98 -#include "tnconfig.h" // Paul Brannan 5/25/98 -#include -#include -#include -#include - -#ifndef LANG_USER_DEFAULT -#define LANG_USER_DEFAULT 400 -#endif - -// This has been moved to tnconfig.cpp -// int Telnet_Redir = 0; -// Telnet_Redir is set to the value of the environment variable TELNET_REDIR -// in main. - -int printit(const char * it){ - DWORD numwritten; - if (!ini.get_output_redir()) { - if (!WriteConsole( - GetStdHandle(STD_OUTPUT_HANDLE), // handle of a console screen buffer - it, // address of buffer to write from - strlen(it), // number of characters to write - &numwritten, // address of number of characters written - 0 // reserved - )) return -1; - // FIX ME!!! We need to tell the console that the cursor has moved. - // Does this mean making Console global? - // Paul Brannan 6/14/98 - // Console.sync(); - }else{ - if (!WriteFile( - GetStdHandle(STD_OUTPUT_HANDLE), // handle of a console screen buffer - it, // address of buffer to write from - strlen(it), // number of characters to write - &numwritten, // address of number of characters written - NULL // no overlapped I/O - )) return -1; - } - return 0; -} - -int printm(LPTSTR szModule, BOOL fSystem, DWORD dwMessageId, ...) -{ - int Result = 0; - - HMODULE hModule = 0; - if (szModule) - hModule = LoadLibrary(szModule); - - va_list Ellipsis; - va_start(Ellipsis, dwMessageId); - - LPTSTR pszMessage = 0; - DWORD dwMessage = 0; - if(fSystem) { - dwMessage = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM, hModule, dwMessageId, - LANG_USER_DEFAULT, (LPTSTR)&pszMessage, 128, &Ellipsis); - } else { - // we will use a string table. - char szString[256]; - if(LoadString(0, dwMessageId, szString, sizeof(szString))) - dwMessage = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_STRING, szString, dwMessageId, - LANG_USER_DEFAULT, (LPTSTR)&pszMessage, 256, &Ellipsis); - } - - va_end(Ellipsis); - - if (szModule) - FreeLibrary(hModule); - - if (dwMessage) { - - Result = printit(pszMessage); - LocalFree(pszMessage); - } - - return Result; -} - - -void LogErrorConsole(LPTSTR szError) -{ - DWORD dwLastError = GetLastError(); - - const int cbLastError = 1024; - TCHAR szLastError[cbLastError]; - FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, 0, dwLastError, LANG_USER_DEFAULT, - szLastError, cbLastError, 0); - - LPTSTR lpszStrings[2]; - lpszStrings[0] = szError; - lpszStrings[1] = szLastError; - - const int cbErrorString = 1024; - TCHAR szErrorString[cbErrorString]; - FormatMessage(FORMAT_MESSAGE_FROM_HMODULE| FORMAT_MESSAGE_ARGUMENT_ARRAY, - 0, MSG_ERROR, LANG_USER_DEFAULT, - szErrorString, cbErrorString, (va_list*)lpszStrings); - - time_t dwTime; - time(&dwTime); - char* szTime = ctime(&dwTime); - szTime[19] = 0; - - // printf("E %s %s", szTime + 11, szErrorString); - char * buf; - buf = new char [ 3 + strlen(szTime) - 11 + strlen(szErrorString) + 5 ]; - sprintf( buf,"E %s %s", szTime + 11, szErrorString); - printit(buf); - delete [] buf; -} - - -void LogWarningConsole(DWORD dwEvent, LPTSTR szWarning) -{ - DWORD dwLastError = GetLastError(); - - const int cbLastError = 1024; - TCHAR szLastError[cbLastError]; - FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, 0, dwLastError, LANG_USER_DEFAULT, - szLastError, cbLastError, 0); - - LPTSTR lpszStrings[2]; - lpszStrings[0] = szWarning; - lpszStrings[1] = szLastError; - - const int cbWarningString = 1024; - TCHAR szWarningString[cbWarningString]; - FormatMessage(FORMAT_MESSAGE_FROM_HMODULE| FORMAT_MESSAGE_ARGUMENT_ARRAY, - 0, dwEvent, LANG_USER_DEFAULT, - szWarningString, cbWarningString, (va_list*)lpszStrings); - - time_t dwTime; - time(&dwTime); - char* szTime = ctime(&dwTime); - szTime[19] = 0; - - // printf("W %s %s", szTime + 11, szWarningString); - char * buf; - buf = new char [ 3 + strlen(szTime) - 11 + strlen(szWarningString) + 5 ]; - sprintf(buf ,"W %s %s", szTime + 11, szWarningString); - printit(buf); - delete [] buf; - -} - - -void LogInfoConsole(DWORD dwEvent, LPTSTR szInformation) -{ - LPTSTR lpszStrings[1]; - lpszStrings[0] = szInformation; - - const int cbInfoString = 1024; - TCHAR szInfoString[cbInfoString]; - FormatMessage(FORMAT_MESSAGE_FROM_HMODULE| FORMAT_MESSAGE_ARGUMENT_ARRAY, - 0, dwEvent, LANG_USER_DEFAULT, - szInfoString, cbInfoString, (va_list*)lpszStrings); - - time_t dwTime; - time(&dwTime); - char* szTime = ctime(&dwTime); - szTime[19] = 0; - - // printf("I %s %s", szTime + 11, szInfoString); - char * buf; - buf = new char [ 3 + strlen(szTime) - 11 + strlen(szInfoString) + 5 ]; - sprintf(buf,"I %s %s", szTime + 11, szInfoString); - printit(buf); - delete [] buf; - -} - diff --git a/rosapps/net/telnet/src/tnerror.h b/rosapps/net/telnet/src/tnerror.h deleted file mode 100644 index a7ada284c58..00000000000 --- a/rosapps/net/telnet/src/tnerror.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef __TNERROR_H -#define __TNERROR_H - -#ifndef __WINDOWS_H -#include -#endif - -#include "tnmsg.h" - -extern int Telnet_Redir; - -int printm(LPTSTR szModule, BOOL fSystem, DWORD dwMessageId, ...); -void LogErrorConsole(LPTSTR szError); -int printit(const char * it); - -#endif diff --git a/rosapps/net/telnet/src/tnetwork.cpp b/rosapps/net/telnet/src/tnetwork.cpp deleted file mode 100644 index 64eed9be358..00000000000 --- a/rosapps/net/telnet/src/tnetwork.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -//Telnet Win32 : an ANSI telnet client. -//Copyright (C) 1998-2000 Paul Brannan -//Copyright (C) 1998 I.Ioannou -//Copyright (C) 1997 Brad Johnson -// -//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. -// -//I.Ioannou -//roryt@hol.gr -// -/////////////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// -// Module: tnetwork.cpp -// -// Contents: telnet network module -// -// Product: telnet -// -// Revisions: March 18, 1999 Paul Brannan (pbranna@clemson.edu) -// -/////////////////////////////////////////////////////////////////////////////// - -#include "tnetwork.h" - -void TNetwork::SetSocket(SOCKET s) { - socket = s; - net_type = TN_NETSOCKET; - local_echo = line_mode = 1; -} - -void TNetwork::SetPipe(HANDLE pIn, HANDLE pOut) { - pipeIn = pIn; - pipeOut = pOut; - net_type = TN_NETPIPE; - local_echo = line_mode = 0; -} - -int TNetwork::WriteString(const char *str, const int length) { - switch(net_type) { - case TN_NETSOCKET: - return send(socket, str, length, 0); - case TN_NETPIPE: - { - DWORD dwWritten; - if(!WriteFile(pipeOut, str, length, &dwWritten, (LPOVERLAPPED)NULL)) return -1; - return dwWritten; - } - } - return 0; -} - -int TNetwork::ReadString (char *str, const int length) { - switch(net_type) { - case TN_NETSOCKET: - return recv(socket, str, length, 0); - case TN_NETPIPE: - { - DWORD dwRead; - if(!ReadFile(pipeIn, str, length, &dwRead, (LPOVERLAPPED)NULL)) return -1; - return dwRead; - } - } - return 0; -} - -void TNetwork::do_naws(int width, int height) { - if(!naws_func) return; - char buf[100]; - int len = (*naws_func)(buf, width, height); - WriteString(buf, len); -} - -void TNetwork::SetLocalAddress(char *buf) { - local_address = new char[strlen(buf) + 1]; - strcpy(local_address, buf); -} - diff --git a/rosapps/net/telnet/src/tnetwork.h b/rosapps/net/telnet/src/tnetwork.h deleted file mode 100644 index 1a42939d9d1..00000000000 --- a/rosapps/net/telnet/src/tnetwork.h +++ /dev/null @@ -1,66 +0,0 @@ -// This is a simple class to handle socket connections -// (Paul Brannan 6/15/98) - -#ifndef __TNETWORK_H -#define __TNETWORK_H - -#include - -// Mingw32 doesn't use winsock.h (Paul Brannan 9/4/98) -#ifdef __MINGW32__ -#ifdef __CYGWIN__ -#include -#else -// #include Removed for ReactOS -#endif -#else -#include -#endif - -// ReactOS uses winsock2.h (Steven Edwards 12-31-01) -#ifdef __REACTOS__ -#include -#endif - -enum NetworkType {TN_NETSOCKET, TN_NETPIPE}; - -typedef int(*Naws_func_t)(char *, int, int); - -class TNetwork { -private: - SOCKET socket; - BOOL local_echo; // Paul Brannan 8/25/98 - BOOL line_mode; // Paul Brannan 12/31/98 - NetworkType net_type; // Paul Brannan 3/18/99 - HANDLE pipeIn, pipeOut; // Paul Brannan 3/18/99 - Naws_func_t naws_func; - char *local_address; - -public: - TNetwork(SOCKET s = 0): socket(s), local_echo(1), line_mode(1), - net_type(TN_NETSOCKET), naws_func((Naws_func_t)NULL), - local_address((char *)NULL) {} - ~TNetwork() {if(local_address) delete local_address;} - - void SetSocket(SOCKET s); - SOCKET GetSocket() {return socket;} - void SetPipe(HANDLE pIn, HANDLE pOut); - void SetNawsFunc(Naws_func_t func) {naws_func = func;} - void SetLocalAddress(char *buf); - const char* GetLocalAddress() {return local_address;} - - NetworkType get_net_type() {return net_type;} - - int WriteString(const char *str, const int length); - int ReadString (char *str, const int length); - - BOOL get_local_echo() {return local_echo;} - void set_local_echo(BOOL b) {local_echo = b;} - - BOOL get_line_mode() {return line_mode;} - void set_line_mode(BOOL b) {line_mode = b;} - - void do_naws(int width, int height); -}; - -#endif diff --git a/rosapps/net/telnet/src/tnmain.cpp b/rosapps/net/telnet/src/tnmain.cpp deleted file mode 100644 index eff0ca776b9..00000000000 --- a/rosapps/net/telnet/src/tnmain.cpp +++ /dev/null @@ -1,718 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -//Telnet Win32 : an ANSI telnet client. -//Copyright (C) 1998 Paul Brannan -//Copyright (C) 1998 I.Ioannou -//Copyright (C) 1997 Brad Johnson -// -//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. -// -//I.Ioannou -//roryt@hol.gr -// -/////////////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// -// Module: tnmain.cpp -// -// Contents: telnet main program -// -// Product: telnet -// -// Revisions: August 11, 1998 Thomas Briggs -// May 14, 1998 Paul Brannan -// 5.April.1997 jbj@nounname.com -// 5.Dec.1996 jbj@nounname.com -// Version 2.0 -// -// 02.Apr.1995 igor.milavec@uni-lj.si -// Original code -// -/////////////////////////////////////////////////////////////////////////////// - -#include -#include -#include "tnmain.h" -#include "tnmisc.h" - -int telCommandLine (Telnet &MyConnection); - -void waitforkey() { - HANDLE hConsole = GetStdHandle(STD_INPUT_HANDLE); - INPUT_RECORD InputRecord; - DWORD dwInput; - BOOL done = FALSE; - while (!done){ - WaitForSingleObject( hConsole, INFINITE ); - if (!ReadConsoleInput(hConsole, &InputRecord, 1, &dwInput)){ - done = TRUE; - continue; - } - if (InputRecord.EventType == KEY_EVENT && - InputRecord.Event.KeyEvent.bKeyDown ) - done = TRUE; - } -} - -//char * cfgets ( char * buf, unsigned int length, char pszHistory[][80], int iHistLength){ -struct cmdHistory * cfgets (char *buf, unsigned int length, struct cmdHistory *cmdhist) { - - HANDLE hConsole = GetStdHandle(STD_INPUT_HANDLE); - unsigned int current=0, cursor =0, iEraseLength=0, i; - char chr; - char temp[2]; - char temp1[80]; - - INPUT_RECORD InputRecord; - BOOL done = FALSE; - - temp[1] = 0; - buf[0] = '\0'; - - if(!ini.get_input_redir()) { - while (!done) { - DWORD dwInput; - int MustRefresh = 0; - WaitForSingleObject( hConsole, INFINITE ); - if (!ReadConsoleInput(hConsole, &InputRecord, 1, &dwInput)){ - done = TRUE; - continue; - } - MustRefresh = 0; - if (InputRecord.EventType == KEY_EVENT && - InputRecord.Event.KeyEvent.bKeyDown ) { - - if(InputRecord.Event.KeyEvent.dwControlKeyState & - (LEFT_CTRL_PRESSED | RIGHT_CTRL_PRESSED)) { - - switch(InputRecord.Event.KeyEvent.wVirtualKeyCode) { - case 'D': // Thomas Briggs 8/11/98 - buf[0] = '\04'; - buf[1] = '\0'; - current = 1; - done = true; - continue; - case 'U': // Paul Brannan 8/11/98 - buf[0] = '\0'; - current = 0; - cursor = 0; - MustRefresh = 1; - break; - } - } - - switch (InputRecord.Event.KeyEvent.wVirtualKeyCode) { - case VK_UP: - // crn@ozemail.com.au - if (cmdhist != NULL) { - if (!strcmp(buf, "")) - strncpy(buf, cmdhist->cmd, 79); - else if (cmdhist->prev != NULL) { - cmdhist = cmdhist->prev; - strncpy(buf, cmdhist->cmd, 79); - } - current = strlen(buf); - } - /// - MustRefresh = 1; - break; - case VK_DOWN: - // crn@ozemail.com.au - if (cmdhist != NULL) { - if (cmdhist->next != NULL) { - cmdhist = cmdhist->next; - strncpy(buf, cmdhist->cmd, 79); - } else { - strncpy(buf, "", 79); - } - current = strlen(buf); - } - /// - MustRefresh = 1; - break; - case VK_RIGHT: //crn@ozemail.com.au (added ctrl+arrow) - if (cursor < current) - if (InputRecord.Event.KeyEvent.dwControlKeyState & - (LEFT_CTRL_PRESSED | RIGHT_CTRL_PRESSED)) { - unsigned int i,j; - for (j = cursor; j <= current; j++) - if (buf[j+1] == ' ' || (j+1)==current) - break; - for (i = ++j; i <= current; i++) - if (buf[i] != ' ' || i == current) { - cursor = i == current ? --i : i; - break; - } - } else - cursor++; - MustRefresh = 1; - break; - case VK_LEFT: //crn@ozemail.com.au (added ctrl+arrow) - if (cursor > 0) - if(InputRecord.Event.KeyEvent.dwControlKeyState & - (LEFT_CTRL_PRESSED | RIGHT_CTRL_PRESSED)) { - int i,j; - for (j = cursor; j >= 0; j--) - if (buf[j-1] != ' ') - break; - for (i = --j; i >= 0; i--) - if (buf[i] == ' ' || i == 0) { - cursor = !i ? i : ++i; - break; - } - } else - cursor--; - MustRefresh = 1; - break; - case VK_HOME: - if (cursor>0) cursor = 0; - MustRefresh = 1; - break; - case VK_END: - if (cursor 0 && current > cursor) { - strcpy(&buf[cursor],&buf[cursor+1]); - current--; - buf[current] = 0; - printit("\r"); - for (i = 0; i < current+strlen("telnet>")+1 ;i++) - printit(" "); - } - MustRefresh = 1; - break; - case VK_BACK: - if (cursor > 0 ) { - strcpy(&buf[cursor-1],&buf[cursor]); - current--; - cursor--; - buf[current] = 0; - printit("\r"); - for (i = 0; i < current+strlen("telnet>")+1 ;i++) - printit(" "); - } - MustRefresh = 1; - break; - - default: - chr = InputRecord.Event.KeyEvent.uChar.AsciiChar; - if (chr == '\r') { - done = TRUE; - continue; - } - if (current >= length-1){ - done = TRUE; - continue; - } - if ( isprint (chr) ){ - strncpy(temp1,&buf[cursor],79); - strncpy(&buf[cursor+1],temp1,79-(cursor+1)); - buf[cursor++]=chr; - current++; - buf[current] = 0; - MustRefresh = 1; - } - break; - } - if (MustRefresh == 1) - { - printit("\rtelnet"); - for (i = 0; i <= iEraseLength ;i++) - printit(" "); - printit("\rtelnet>"); - printit(buf); - iEraseLength = strlen(buf); - for (i = 0; i < current-cursor; i++) - printit("\b"); - } - } - } - buf[current] = 0; - if (strcmp(buf, "")) { - if (cmdhist == NULL) { - cmdhist = new struct cmdHistory; - if (cmdhist == NULL) { - printit ("\nUnable to allocate memory for history buffer -- use the \"flush\" command to clear the buffer.\n"); - return cmdhist; - } - strncpy(cmdhist->cmd, buf, 79); - cmdhist->next = NULL; - cmdhist->prev = NULL; - } else { - while (cmdhist->next != NULL) // move to the end of the list - cmdhist = cmdhist->next; - cmdhist->next = new struct cmdHistory; - if (cmdhist->next == NULL) { - printit ("\nUnable to allocate memory for history buffer -- use the \"flush\" command to clear the buffer.\n"); - return cmdhist; - } - cmdhist->next->prev = cmdhist; // previous is where we are now - cmdhist = cmdhist->next; - strncpy(cmdhist->cmd, buf, 79); - cmdhist->next = NULL; - } - while (cmdhist->next) - cmdhist = cmdhist->next; - } - return cmdhist; - /// - } else { - WaitForSingleObject( hConsole, INFINITE ); - DWORD dwInput; - DWORD OldMode; - GetConsoleMode(hConsole, &OldMode); - SetConsoleMode(hConsole, - OldMode &~ (ENABLE_ECHO_INPUT | ENABLE_LINE_INPUT) ); - while (ReadFile(hConsole, &chr, 1, &dwInput, NULL)) { - if (chr == '\r') { - temp[0] = chr; - printit(&temp[0]); - break; - } - if (chr == '\b' && current > 0) { - current--; - printit("\b \b"); - } - if (current >= length-1){ - break; - } - if ( isprint (chr) ){ - temp[0] = chr; - printit(&temp[0]); - buf[current++]=chr; - } - } - buf[current] = 0; - SetConsoleMode(hConsole, OldMode); - return NULL; - } -} - -// AVS ** for fix bug in command 'keys load keymapname' without file -// static char keyfile[MAX_PATH*2]; - -int main(int ArgC, char* ArgV[]) { - - CONSOLE_SCREEN_BUFFER_INFO ConsoleScreenBufferInfo; - GetConsoleScreenBufferInfo( - GetStdHandle(STD_OUTPUT_HANDLE), - &ConsoleScreenBufferInfo - ); - - char *k; - char startdir[MAX_PATH*2]; - char exename[MAX_PATH]; - - // strncpy(startdir, ArgV[0],MAX_PATH); - // This should be more accurate than using argv[0] (Paul Brannan 9/16/98) - GetModuleFileName(NULL, startdir, sizeof(startdir)); - - // Get the current console title so it can be set later - // ("Pedro A. Aranda Gutiérrez" ) - TCHAR ConsoleTitle[255]; - GetConsoleTitle(ConsoleTitle, sizeof(ConsoleTitle)); - - k = strrchr(startdir, '\\'); - if (k == NULL){ // if the \ character is not found... - strcpy(exename, startdir); - strcpy(startdir,""); // set the path to nothing - } else { - // end the string after the last '\' to get rid of the file name - strcpy(exename, k+1); - k[1] = 0; - } - - printm(0, FALSE, MSG_COPYRIGHT); - printm(0, FALSE, MSG_COPYRIGHT_1); - - // set up the ini class - ini.init(startdir, exename); - - // Process the command line arguments and connect to a host if necessary - if(ini.Process_Params(ArgC, ArgV)) { - const char *szHost = ini.get_host(); - const char *strPort = ini.get_port(); - if(!*szHost) { - Telnet MyConnection; - while(telCommandLine(MyConnection)); - } else { - Telnet MyConnection; - if(MyConnection.Open(szHost, strPort) == TNPROMPT) { - // still connected - printit("\n"); - telCommandLine(MyConnection); - } - } - } - //// (Paul Brannan 5/14/98) - - if(ini.get_term_width() != -1 || ini.get_term_height() != -1) { - SetConsoleScreenBufferSize( - GetStdHandle(STD_OUTPUT_HANDLE), // handle of console screen buffer - ConsoleScreenBufferInfo.dwSize // new size in character rows and cols. - ); - SetConsoleWindowInfo( - GetStdHandle(STD_OUTPUT_HANDLE), // handle of console screen buffer - TRUE, // coordinate type flag - &ConsoleScreenBufferInfo.srWindow // address of new window rectangle - ); - } - SetConsoleTextAttribute( - GetStdHandle(STD_OUTPUT_HANDLE), // handle of console screen buffer - ConsoleScreenBufferInfo.wAttributes // text and background colors - ); - - // Restore the original console title - // ("Pedro A. Aranda Gutiérrez" ) - SetConsoleTitle(ConsoleTitle); - - return 0; -} - -// AVS -enum { - BAD_USAGE = -3, - EMPTY_LINE = -2, - INVALID_CMD = -1, - __FIRST_COMMAND = 0, - - OPEN = __FIRST_COMMAND, - CLOSE, - KEYS, - QUIT, - HELP, - HELP2, // there is way for synonims - K_LOAD, // subcommand of 'keys' - K_SWITCH, // subcommand of 'keys' - K_DISPLAY, // subcommand of 'keys' - - SET, // Paul Brannan 5/30/98 - - SUSPEND, - FASTQUIT, // Thomas Briggs 8/11/98 - CMD_HISTORY, // crn@ozemail.com.au - CLEAR_HISTORY, // crn@ozemail.com.au - - ALIASES, // Paul Brannan 1/1/99 - - __COMMAND_LIST_SIZE // must be last -}; - - -struct command { - char* cmd; // command - int minLen, // minimal length for match - minParms, // minimal count of parms - maxParms; // maximal -/- (negative disables) - int isSubCmd, // is a subcommand - number of wich command - haveSubCmd; // have subcommands? 0 or 1 - char* usage; // text of usage -}; - -command cmdList[__COMMAND_LIST_SIZE] = { - {"open", 1, 1, 2, -1, 0, "o[pen] host [port]\n"}, - {"close", 2, 0, 0, -1, 0, NULL}, - {"keys", 2, 1, 3, -1, 1, "ke[ys] l[oad] keymapname [file]\n" - "ke[ys] d[isplay]\n" - "ke[ys] s[witch] number\n"}, - // Ioannou : i change it to q, to be more compatible with unix telnet - {"quit", 1, 0, 0, -1, 0, NULL}, // must type it exactly - {"?", 1, 0, 0, -1, 0, NULL}, - {"help", 1, 0, 0, -1, 0, NULL}, - {"load", 1, 1, 2, KEYS, 0, NULL}, - {"switch", 1, 1, 1, KEYS, 0, NULL}, - {"display", 1, 0, 0, KEYS, 0, NULL}, - // Paul Brannan 5/30/98 - {"set", 3, 0, 2, -1, 0, "set will display available groups.\n" - "set groupname will display all variables/values in a group.\n" - "set [variable [value]] will set variable to value.\n"}, - // Thomas Briggs 8/11/98 - {"z", 1, 0, 0, -1, 0, "suspend telnet\n"}, - {"\04", 1, 0, 0, -1, 0, NULL}, - // crn@ozemail.com.au - {"history", 2, 0, 0, -1, 0, "show command history"}, - {"flush", 2, 0, 0, -1, 0, "flush history buffer"}, - // Paul Brannan 1/1/99 - {"aliases", 5, 0, 0, -1, 0, NULL} -}; - -// a maximal count of parms -#define MAX_PARM_COUNT 3 -#define MAX_TOKEN_COUNT (MAX_PARM_COUNT+2) - -static int cmdMatch(const char* cmd, const char* token, int tokenLen, int minM) { - if ( tokenLen < minM ) return 0; - // The (unsigned) gets rid of a compiler warning (Paul Brannan 5/25/98) - if ( (unsigned)tokenLen > strlen(cmd) ) return 0; - if ( strcmp(cmd,token) == 0 ) return 1; - - int i; - for ( i = 0; i < minM; i++ ) if ( cmd[i] != token[i] ) return 0; - - for ( i = minM; i < tokenLen; i++ ) if ( cmd[i] != token[i] ) return 0; - - return 1; -}; - -static void printUsage(int cmd) { - if ( cmdList[cmd].usage != NULL ) { - printit(cmdList[cmd].usage); - return; - }; - if ( cmdList[cmd].isSubCmd >= 0 ) { - printUsage(cmdList[cmd].isSubCmd); - return; - } - printm(0, FALSE, MSG_BADUSAGE); -}; - -int tokenizeCommand(char* szCommand, int& argc, char** argv) { - char* tokens[MAX_TOKEN_COUNT]; - char* p; - int args = 0; - - if(!szCommand || !*szCommand) return EMPTY_LINE; - - // Removed strtok to handle tokens with spaces; this is handled with - // quotes. (Paul Brannan 3/18/99) - char *token_start = szCommand; - for(p = szCommand;; p++) { - if(*p == '\"') { - char *tmp = p; - for(p++; *p != '\"' && *p != 0; p++); // Find the next quote - if(*p != 0) strcpy(p, p + 1); // Remove quote#2 - strcpy(tmp, tmp + 1); // Remove quote#1 - } - if(*p == 0 || *p == ' ' || *p == '\t') { - tokens[args] = token_start; - args++; - if(args >= MAX_TOKEN_COUNT) break; // Break if too many args - token_start = p + 1; - if(*p == 0) break; - *p = 0; - } - } - // while ( (p = strtok((args?NULL:szCommand), " \t")) != NULL && args < MAX_TOKEN_COUNT ) { - // tokens[args] = p; - // args++; - // }; - - if ( !args ) return EMPTY_LINE; - argc = args - 1; - args = 0; - int curCmd = -1; - int ok = -1; - while ( ok < 0 ) { - int tokenLen = strlen(tokens[args]); - int match = 0; - for ( int i = 0; i<__COMMAND_LIST_SIZE; i++ ) { - if ( cmdMatch(cmdList[i].cmd, tokens[args], tokenLen, cmdList[i].minLen) ) { - if (argc < cmdList[i].minParms || argc > cmdList[i].maxParms) { - printUsage(i); - return BAD_USAGE; - }; - if ( cmdList[i].haveSubCmd && curCmd == cmdList[i].isSubCmd) { - curCmd = i; - args++; - argc--; - match = 1; - break; - }; - if ( curCmd == cmdList[i].isSubCmd ) { - ok = i; - match = 1; - break; - }; - printUsage(i); - return BAD_USAGE; - }; - }; - if ( !match ) { - if ( curCmd < 0 ) return INVALID_CMD; - printUsage(curCmd); - return -3; - }; - }; - - for ( int i = 0; i"); - cmdhist = cfgets (szCommand, 79, cmdhist); - printit( "\n"); - - strlwr(szCommand); // convert command line to lower - // i = sscanf(szCommand,"%80s %80s %80s %80s", szCmd, szArg1, szArg2, szArg3); - switch ( tokenizeCommand(szCommand, i, Parms) ) { - case BAD_USAGE: break; - case EMPTY_LINE: - if(MyConnection.Resume() == TNPROMPT) { - printit("\n"); - break; - } - else - return 1; - case INVALID_CMD: - printm(0, FALSE, MSG_INVCMD); - break; - case OPEN: - if (i == 1) - retval = MyConnection.Open(Parms[0], "23"); - else - retval = MyConnection.Open(Parms[0], Parms[1]); - if(retval != TNNOCON && retval != TNPROMPT) return 1; - if(retval == TNPROMPT) printit("\n"); - break; - case CLOSE: - MyConnection.Close(); - break; - case FASTQUIT: // Thomas Briggs 8/11/98 - case QUIT: - MyConnection.Close(); - bDone = 1; - break; - case HELP: - case HELP2: - printm(0, FALSE, MSG_HELP); - printm(0, FALSE, MSG_HELP_1); - break; - // case KEYS: we should never get it - case K_LOAD: - if ( i == 1 ) { - // Ioannou : changed to ini.get_keyfile() - if(MyConnection.LoadKeyMap( ini.get_keyfile(), Parms[0]) != 1) - printit("Error loading keymap.\n"); - break; - }; - if(MyConnection.LoadKeyMap( Parms[1], Parms[0]) != 1) - printit("Error loading keymap.\n"); - break; - case K_DISPLAY: - MyConnection.DisplayKeyMap(); - break; - case K_SWITCH: - MyConnection.SwitchKeyMap(atoi(Parms[0])); - break; - - // Paul Brannan 5/30/98 - case SET: - if(i == 0) { - printit("Available groups:\n"); // Print out groups - ini.print_groups(); // (Paul Brannan 9/3/98) - } else if(i == 1) { - ini.print_vars(Parms[0]); - } else if(i >= 2) { - ini.set_value(Parms[0], Parms[1]); - // FIX ME !!! Ioannou: here we must call the parser routine for - // wrap line, not the ini.set_value - // something like Parser.ConLineWrap(Wrap_Line); - } - break; - - case SUSPEND: // Thomas Briggs 8/11/98 - - // remind the user we're suspended -crn@ozemail.com.au 15/12/98 - extitle = new char[128]; - GetConsoleTitle (extitle, 128); - - newtitle = new char[128+sizeof("[suspended]")]; - strcpy(newtitle, extitle); - strncat(newtitle, "[suspended]", 128+sizeof("[suspended]")); - if(ini.get_set_title()) SetConsoleTitle (newtitle); - delete[] newtitle; - - if (getenv("comspec") == NULL) { - switch (GetWin32Version()) { - case 2: // 'cmd' is faster than 'command' in NT -crn@ozemail.com.au - system ("cmd"); - break; - default: - system ("command"); - break; - } - } else { - system(getenv("comspec")); - } - - if(ini.get_set_title()) SetConsoleTitle (extitle); - delete[] extitle; - /// - - break; - - case CMD_HISTORY: //crn@ozemail.com.au - if (cmdhist != NULL) { - while (cmdhist->prev != NULL) - cmdhist = cmdhist->prev; //rewind - printf ("Command history:\n"); - while (1) { - printf ("\t%s\n", cmdhist->cmd); - - if (cmdhist->next != NULL) - cmdhist = cmdhist->next; - else - break; - } - } else - printf ("No command history available.\n"); - - break; - - case CLEAR_HISTORY: //crn@ozemail.com.au - if (cmdhist != NULL) { - while (cmdhist->next != NULL) - cmdhist = cmdhist->next; //fast forward - while (cmdhist->prev != NULL) { - cmdhist = cmdhist->prev; - delete cmdhist->next; - } - delete cmdhist; - cmdhist = NULL; - printf ("Command history cleared.\n"); - } else - printf ("No command history available.\n"); - - case ALIASES: // Paul Brannan 1/1/99 - ini.print_aliases(); - break; - - default: // paranoik - printm(0, FALSE, MSG_INVCMD); - break; - } - - } - - return 0; -} diff --git a/rosapps/net/telnet/src/tnmain.h b/rosapps/net/telnet/src/tnmain.h deleted file mode 100644 index 526742c56b6..00000000000 --- a/rosapps/net/telnet/src/tnmain.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef __TNMAIN_H -#define __TNMAIN_H - -#include -#include -#include "tncon.h" -#include "tnclass.h" -#include "ttelhndl.h" -#include "tnerror.h" -// Paul Brannan 5/25/98 -#include "tnconfig.h" - -struct cmdHistory { - char cmd[80]; - struct cmdHistory *next; - struct cmdHistory *prev; -}; - -#endif diff --git a/rosapps/net/telnet/src/tnmisc.cpp b/rosapps/net/telnet/src/tnmisc.cpp deleted file mode 100644 index 797d2931730..00000000000 --- a/rosapps/net/telnet/src/tnmisc.cpp +++ /dev/null @@ -1,185 +0,0 @@ -#include -#include -#include - -#include "tnmisc.h" - -// from the PVAX (http://www.ccas.ru/~posp/popov/spawn.htm) -// Create a process with pipes to stdin/out/err -BOOL CreateHiddenConsoleProcess(LPCTSTR szChildName, PROCESS_INFORMATION* ppi, - LPHANDLE phInWrite, LPHANDLE phOutRead, - LPHANDLE phErrRead) { - BOOL fCreated; - STARTUPINFO si; - SECURITY_ATTRIBUTES sa; - HANDLE hInRead; - HANDLE hOutWrite; - HANDLE hErrWrite; - - // Create pipes - // initialize security attributes for handle inheritance (for WinNT) - sa.nLength = sizeof( sa ); - sa.bInheritHandle = TRUE; - sa.lpSecurityDescriptor = NULL; - - // create STDIN pipe - if( !CreatePipe( &hInRead, phInWrite, &sa, 0 )) - goto error; - - // create STDOUT pipe - if( !CreatePipe( phOutRead, &hOutWrite, &sa, 0 )) - goto error; - - // create STDERR pipe - if( !CreatePipe( phErrRead, &hErrWrite, &sa, 0 )) - goto error; - - // process startup information - memset( &si, 0, sizeof( si )); - si.cb = sizeof( si ); - si.dwFlags = STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES; - // child process' console must be hidden for Win95 compatibility - si.wShowWindow = SW_HIDE; - // assign "other" sides of pipes - si.hStdInput = hInRead; - si.hStdOutput = hOutWrite; - si.hStdError = hErrWrite; - - // Create a child process (suspended) - fCreated = CreateProcess( NULL, - (LPTSTR)szChildName, - NULL, - NULL, - TRUE, - 0, - NULL, - NULL, - &si, - ppi ); - - if( !fCreated ) - goto error; - - CloseHandle( hInRead ); - CloseHandle( hOutWrite ); - CloseHandle( hErrWrite ); - - return TRUE; - -error: - CloseHandle( hInRead ); - CloseHandle( hOutWrite ); - CloseHandle( hErrWrite ); - CloseHandle( ppi->hProcess ); - CloseHandle( ppi->hThread ); - - hInRead = - hOutWrite = - hErrWrite = - ppi->hProcess = - ppi->hThread = INVALID_HANDLE_VALUE; - - return FALSE; -} - -BOOL SpawnProcess(char *cmd_line, PROCESS_INFORMATION *pi) { - STARTUPINFO si; - - memset(&si, 0, sizeof(si)); - si.cb = sizeof(si); - - return CreateProcess(cmd_line, NULL, NULL, FALSE, NORMAL_PRIORITY_CLASS, - CREATE_NEW_CONSOLE, NULL, NULL, &si, pi); -} - -// crn@ozemail.com.au -int GetWin32Version(void) { - // return win32 version; 0 = Win32s, 1 = Win95, 2 = WinNT, 3 = Unknown -crn@ozemail.com.au - LPOSVERSIONINFO osv; - DWORD retval; - - osv = new OSVERSIONINFO; - - osv->dwOSVersionInfoSize = sizeof (OSVERSIONINFO); - GetVersionEx (osv); - retval = osv->dwPlatformId; - delete osv; - return (retval); -} - -// Paul Brannan 8/7/98 -// This code is from Michael 'Hacker' Krelin (author of KINSole) -// (slightly modified) -HWND GetConsoleWindow() { - DWORD pid = GetCurrentProcessId(), wpid; - char title[512], *t = title; - HWND hrv = NULL; - -#ifndef __BORLANDC__ // Ioannou Dec. 8, 1998 - if(!GetConsoleTitle(title, sizeof(title))) t = NULL; - - for(;;) { - if((hrv = FindWindowEx(NULL, hrv, "tty", t)) == NULL) break; - if(!GetWindowThreadProcessId(hrv, &wpid)) continue; - if(wpid == pid) return hrv; - } -#endif - - return GetForegroundWindow(); -} - -// Sets the icon of the console window to hIcon -// If hIcon is 0, then use a default icon -// hConsoleWindow must be set before calling SetIcon -bool SetIcon(HWND hConsoleWindow, HANDLE hIcon, LPARAM *pOldBIcon, LPARAM *pOldSIcon, - const char *icondir) { - if(!hConsoleWindow) return false; - -// FIX ME!!! The LoadIcon code should work with any compiler! -// (Paul Brannan 12/17/98) -#ifndef __BORLANDC__ // Ioannou Dec. 8, 1998 - if(!hIcon) { - char filename[128]; // load from telnet.ico - strncpy(filename, icondir, sizeof(filename)); - strncat(filename, "telnet.ico", sizeof(filename)); - filename[sizeof(filename) - 1] = 0; - - // Note: loading the icon from a file doesn't work on NT - // There is no LoadImage in Borland headers - only LoadIcon - hIcon = LoadImage(NULL, filename, IMAGE_ICON, 0, 0, LR_DEFAULTSIZE + - LR_LOADFROMFILE); - } -#else - // load the icon from the resource file -crn@ozemail.com.au 16/12/98 - if(!hIcon) { - hIcon = LoadIcon ((HANDLE)GetWindowLong(hConsoleWindow, - GWL_HINSTANCE), "TELNETICON"); - } -#endif - - if(hIcon) { -#ifdef ICON_BIG - *pOldBIcon = SendMessage(hConsoleWindow, WM_SETICON, ICON_BIG, - (LPARAM)hIcon); -#endif -#ifdef ICON_SMALL - *pOldSIcon = SendMessage(hConsoleWindow, WM_SETICON, ICON_SMALL, - (LPARAM)hIcon); -#endif - return true; - } else { - // Otherwise we get a random icon at exit! (Paul Brannan 9/13/98) - return false; - } -} - -// Allows SetIcon to be called again by resetting the current icon -// Added 12/17/98 by Paul Brannan -void ResetIcon(HWND hConsoleWindow, LPARAM oldBIcon, LPARAM oldSIcon) { -#ifdef ICON_BIG - SendMessage(hConsoleWindow, WM_SETICON, ICON_BIG, (LPARAM)oldBIcon); -#endif -#ifdef ICON_SMALL - SendMessage(hConsoleWindow, WM_SETICON, ICON_SMALL, (LPARAM)oldSIcon); -#endif -} diff --git a/rosapps/net/telnet/src/tnmisc.h b/rosapps/net/telnet/src/tnmisc.h deleted file mode 100644 index 1f5488ca376..00000000000 --- a/rosapps/net/telnet/src/tnmisc.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef __TNMISC_H -#define __TNMISC_H - -// Process-related functions -BOOL CreateHiddenConsoleProcess(LPCTSTR szChildName, PROCESS_INFORMATION* ppi, - LPHANDLE phInWrite, LPHANDLE phOutRead, - LPHANDLE phErrRead); -BOOL SpawnProcess(char *cmd_line, PROCESS_INFORMATION *pi); - -int GetWin32Version(void); - -HWND GetConsoleWindow(); - -bool SetIcon(HWND hConsoleWindow, HANDLE hIcon, LPARAM *pOldBIcon, LPARAM *pOldSIcon, - const char *icondir); -void ResetIcon(HWND hConsoleWindow, LPARAM oldBIcon, LPARAM oldSIcon); - -#endif diff --git a/rosapps/net/telnet/src/tnmsg.h b/rosapps/net/telnet/src/tnmsg.h deleted file mode 100644 index d1ed5f154e0..00000000000 --- a/rosapps/net/telnet/src/tnmsg.h +++ /dev/null @@ -1,108 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by Tnmsg.rc -// -#define MSG_COPYRIGHT 0x01 -#define MSG_COPYRIGHT_1 0x02 -#define MSG_USAGE 0x03 -#define MSG_USAGE_1 0x04 -#define MSG_HELP 0x05 -#define MSG_HELP_1 0x06 -#define MSG_INVCMD 0x07 -#define MSG_ERROR 0x08 -#define MSG_INFO 0x09 -#define MSG_WARNING 0x0a -#define MSG_TRYING 0x0b -#define MSG_CONNECTED 0x0c -#define MSG_TERMBYREM 0x0d -#define MSG_KEYMAP 0x0e -#define MSG_ERRKEYMAP 0x0f -#define MSG_DUMPFILE 0x10 -#define MSG_CONFIG 0x11 -#define MSG_NOINI 0x12 -#define MSG_BADVAL 0x13 -#define MSG_NOSPAWN 0x14 -#define MSG_RESOLVING 0x15 -#define MSG_NOSERVICE 0x16 -#define MSG_SIZEALIAS 0x17 -#define MSG_ERRPIPE 0x18 -#define MSG_BADUSAGE 0x19 -#define MSG_ALREADYCONNECTED 0x1a - -#define MSG_KEYNOVAL 1001 -#define MSG_KEYBADVAL 1002 -#define MSG_KEYBADSTRUCT 1003 -#define MSG_KEYBADCHARS 1004 -#define MSG_KEYUNEXPLINE 1005 -#define MSG_KEYUNEXPEOF 1006 -#define MSG_KEYUNEXPTOK 1007 -#define MSG_KEYUNEXPTOKIN 1008 -#define MSG_KEYUNEXP 1009 -#define MSG_KEYNOGLOBAL 1010 -#define MSG_KEYNOCONFIG 1011 -#define MSG_KEYUSECONFIG 1012 -#define MSG_KEYNOSWKEY 1013 -#define MSG_KEYCANNOTDEF 1014 -#define MSG_KEYDUPSWKEY 1015 -#define MSG_KEYUNKNOWNMAP 1016 -#define MSG_KEYNOCHARMAPS 1017 -#define MSG_KEYNOKEYMAPS 1018 -#define MSG_KEYNUMMAPS 1019 -#define MSG_KEYBADMAP 1020 -#define MSG_KEYMAPSWITCHED 1021 - -#define MSG_WSAEINTR 0x2714 -#define MSG_WSAEBADF 0x2719 -#define MSG_WSAEACCESS 0x271D -#define MSG_WSAEDEFAULT 0x271E -#define MSG_WSAEINVAL 0x2726 -#define MSG_WSAEMFILE 0x2728 -#define MSG_WSAEWOULDBLOCK 0x2733 -#define MSG_WSAEINPROGRESS 0x2734 -#define MSG_WSAEALREADY 0x2735 -#define MSG_WSAENOTSOCK 0x2736 -#define MSG_WSAEDESTADDRREQ 0x2737 -#define MSG_WSAEMSGSIZE 0x2738 -#define MSG_WSAEPROTOTYPE 0x2739 -#define MSG_WSAENOPROTOOPT 0x273A -#define MSG_WSAEPROTONOTSUPPORT 0x273B -#define MSG_WSAESOCKNOTSUPPORT 0x273C -#define MSG_WSAEOPNOTSUPP 0x273D -#define MSG_WSAEPFNOTSUPPORT 0x273E -#define MSG_WSAEAFNOTSUPPORT 0x273F -#define MSG_WSAEADDRINUSE 0x2740 -#define MSG_WSAEADDRNOTAVAIL 0x2741 -#define MSG_WSAENETDOWN 0x2742 -#define MSG_WSAENETUNREACH 0x2743 -#define MSG_WSAENETRESET 0x2744 -#define MSG_WSAECONNABORTED 0x2745 -#define MSG_WSAECONNRESET 0x2746 -#define MSG_WSAENOBUFS 0x2747 -#define MSG_WSAEISCONN 0x2748 -#define MSG_WSAENOTCONN 0x2749 -#define MSG_WSAESHUTDOWN 0x274A -#define MSG_WSAETOOMANYREFS 0x274B -#define MSG_WSAETIMEDOUT 0x274C -#define MSG_WSAECONNREFUSED 0x274D -#define MSG_WSAELOOP 0x274E -#define MSG_WSAENAMETOOLONG 0x274F -#define MSG_WSAEHOSTDOWN 0x2750 -#define MSG_WSAEHOSTUNREACH 0x2751 -#define MSG_WSAESYSNOTREADY 0x276B -#define MSG_WSAVERNOTSUPPORTED 0x276C -#define MSG_WSANOTINITIALISED 0x276D -#define MSG_WSAHOST_NOT_FOUND 0x2AF9 -#define MSG_WSATRY_AGAIN 0x2AFA -#define MSG_WSANO_RECOVERY 0x2AFB -#define MSG_WSANO_DATA 0x2AFC - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 101 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1000 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/rosapps/net/telnet/src/tparams.h b/rosapps/net/telnet/src/tparams.h deleted file mode 100644 index ffd4f8cbad9..00000000000 --- a/rosapps/net/telnet/src/tparams.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef __THREADPARAMS -#define __THREADPARAMS - -#include "ttelhndl.h" - -typedef struct { - HANDLE hExit; - HANDLE hPause, hUnPause; - volatile int *bNetPaused; - volatile int *bNetFinished; - volatile int *bNetFinish; -} NetParams; - -// We could make TelHandler a pointer rather than a reference, but making it -// a reference forces us to initialize it when it is created, thus avoiding -// a possible segfault (Paul Brannan 6/15/98) -class TelThreadParams { -public: - TelThreadParams(TTelnetHandler &RefTelHandler): TelHandler(RefTelHandler) {} - NetParams p; - TTelnetHandler &TelHandler; -}; - -#endif diff --git a/rosapps/net/telnet/src/tparser.h b/rosapps/net/telnet/src/tparser.h deleted file mode 100644 index 143649f5687..00000000000 --- a/rosapps/net/telnet/src/tparser.h +++ /dev/null @@ -1,49 +0,0 @@ -// A TParser is a class for parsing input and formatting it (presumabyl for -// display on the screen). All parsers are derived from the TParser class, -// in order to facilitate extending telnet to include other kinds of -// output. Currently, only one parser is implemented, the ANSI parser. -// A TParser includes: -// - A ParseBuffer function, which takes as parameters start and end -// pointers. It returns a pointer to the last character parsed plus 1. -// The start pointer is the beginning of the buffer, and the end -// pointer is one character after the end of the buffer. -// - An Init() function, which will re-initialize the parser when -// necessary. - -#ifndef __TPARSER_H -#define __TPARSER_H - -#include "tconsole.h" -#include "keytrans.h" -#include "tscroll.h" -#include "tnetwork.h" -#include "tcharmap.h" - -class TParser { -public: - TParser(TConsole &RefConsole, KeyTranslator &RefKeyTrans, - TScroller &RefScroller, TNetwork &RefNetwork, TCharmap &RefCharmap) : - Console(RefConsole), KeyTrans(RefKeyTrans), Scroller (RefScroller), - Network(RefNetwork), Charmap(RefCharmap) {} - virtual ~TParser() {} - -/* TParser& operator= (const TParser &p) { - Console = p.Console; - KeyTrans = p.KeyTrans; - Scroller = p.Scroller; - Network = p.Network; - return *this; - }*/ - - virtual char *ParseBuffer(char *pszBuffer, char *pszBufferEnd) = 0; - virtual void Init() = 0; - -protected: - TConsole &Console; - KeyTranslator &KeyTrans; - TScroller &Scroller; - TNetwork &Network; - TCharmap &Charmap; -}; - -#endif diff --git a/rosapps/net/telnet/src/tscript.cpp b/rosapps/net/telnet/src/tscript.cpp deleted file mode 100644 index 2045e43ce17..00000000000 --- a/rosapps/net/telnet/src/tscript.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -//Telnet Win32 : an ANSI telnet client. -//Copyright (C) 1998-2000 Paul Brannan -//Copyright (C) 1998 I.Ioannou -//Copyright (C) 1997 Brad Johnson -// -//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. -// -//I.Ioannou -//roryt@hol.gr -// -/////////////////////////////////////////////////////////////////////////// - -#include "tscript.h" - -// FIX ME!! This code not yet functional. - -#define TERMINATOR '~' -#define SPACE_HOLDER '_' - -// processScript by Bryan Montgomery -// modified to handle script file by Paul Brannan -BOOL TScript::processScript (char* data) { -/* char* end = strchr(script,TERMINATOR); - if (0 == end) { - return true; - } else { - char* current = new char(sizeof(char)*strlen(script)); - strncpy(current,script,(int)(end-script)); - current[(int)(end-script)]=0; - char *ptr=end; - if (strstr(data,current) != 0) { - script = ++end; - end = strchr(script,TERMINATOR); - while ((ptr = strchr(ptr,SPACE_HOLDER)) != 0 && ptr < end) { - *ptr=' '; - } - Network.WriteString(script,(int)(end-script)); - Network.WriteString("\r\n",2); - script = ++end; - } - delete current; - }*/ - return TRUE; -} - -void TScript::initScript (char *filename) { - if(fp) fclose(fp); - fp = fopen(filename, "rt"); -} - diff --git a/rosapps/net/telnet/src/tscript.h b/rosapps/net/telnet/src/tscript.h deleted file mode 100644 index f9626bf7059..00000000000 --- a/rosapps/net/telnet/src/tscript.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef __TSCRIPT_H -#define __TSCRIPT_H - -#include -#include -#include "tnetwork.h" - -class TScript { -public: - TScript(TNetwork &RefNetwork):Network(RefNetwork) {fp = NULL;} - ~TScript() {} - BOOL processScript(char *data); - void initScript(char *filename); -private: - FILE *fp; - char *script; - TNetwork &Network; -}; - -#endif diff --git a/rosapps/net/telnet/src/tscroll.cpp b/rosapps/net/telnet/src/tscroll.cpp deleted file mode 100644 index b8befe0180c..00000000000 --- a/rosapps/net/telnet/src/tscroll.cpp +++ /dev/null @@ -1,369 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -//Telnet Win32 : an ANSI telnet client. -//Copyright (C) 1998-2000 Paul Brannan -//Copyright (C) 1998 I.Ioannou -//Copyright (C) 1997 Brad Johnson -// -//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. -// -//I.Ioannou -//roryt@hol.gr -// -/////////////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// -// Module: tscroll.cpp -// -// Contents: Telnet Handler -// -// Product: telnet -// -// Revisions: Dec. 5, 1998 Paul Brannan -// June 15, 1998 Paul Brannan -// -// This is code originally from tnclass.cpp and ansiprsr.cpp -// -/////////////////////////////////////////////////////////////////////////////// - -#include -#include -#include -#include "tscroll.h" -#include "tncon.h" -#include "tconsole.h" -#include "tnconfig.h" - -enum { - HEX, - DUMP, - DUMPB, - TEXTB, -}; - -int DummyStripBuffer(char *start, char *end, int width) {return 0;} - -TScroller::TScroller(TMouse &M, int size) : Mouse(M) { - iScrollSize = size; - pcScrollData = new char[iScrollSize]; - iScrollEnd = 0; - iPastEnd = 0; - memset(pcScrollData, ' ', iScrollSize); - - if(stricmp(ini.get_scroll_mode(), "hex") == 0) iDisplay = HEX; - else if(stricmp(ini.get_scroll_mode(), "dump") == 0) iDisplay = DUMP; - else if(stricmp(ini.get_scroll_mode(), "dumpb") == 0) iDisplay = DUMPB; - else if(stricmp(ini.get_scroll_mode(), "text") == 0) iDisplay = TEXTB; - else iDisplay = DUMP; - - strip = &DummyStripBuffer; -} - -TScroller::~TScroller() { - delete[] pcScrollData; -} - -void TScroller::init(stripfunc *s) { - strip = s; -} - -// Fixed update of circular buffer (Paul Brannan 12/4/98) -// Note: iScrollEnd is one character beyond the end -void TScroller::update(const char *pszHead, const char *pszTail) { - if ((iScrollEnd)+(pszTail-pszHead) < iScrollSize) { - memcpy(&pcScrollData[iScrollEnd], pszHead, pszTail-pszHead); - } else if (pszTail-pszHead > iScrollSize) { - memcpy(pcScrollData, pszTail-iScrollSize, iScrollSize); - iScrollEnd = 0; - } else { - memcpy(&pcScrollData[iScrollEnd], pszHead, iScrollSize-iScrollEnd); - memcpy(&pcScrollData[0], pszHead + (iScrollSize-iScrollEnd), - pszTail-pszHead-(iScrollSize-iScrollEnd)); - } - - // This could probably be optimized better, but it's probably not worth it - int temp = iScrollEnd; - iScrollEnd = ((iScrollEnd)+(pszTail-pszHead))%iScrollSize; - if(iScrollEnd < temp) iPastEnd = 1; -} - -// Perhaps this should be moved to Tconsole.cpp? (Paul Brannan 6/12/98) -static BOOL WriteConsoleOutputCharAndAttribute( - HANDLE hConsoleOutput, // handle of a console screen buffer - CHAR * lpWriteBuffer, - WORD wAttrib, - SHORT sX, - SHORT sY ){ - // we ought to allocate memory before writing to an address (PB 5/12/98) - DWORD cWritten; - const LPDWORD lpcWritten = &cWritten; - - DWORD cWriteCells = strlen(lpWriteBuffer); - COORD coordWrite = {sX,sY}; - LPWORD lpwAttribute = new WORD[cWriteCells]; - for (unsigned int i = 0; i < cWriteCells; i++) - lpwAttribute[i] = wAttrib; - WriteConsoleOutputAttribute( - hConsoleOutput, // handle of a console screen buffer - lpwAttribute, // address of buffer to write attributes from - cWriteCells, // number of character cells to write to - coordWrite, // coordinates of first cell to write to - lpcWritten // address of number of cells written to - ); - WriteConsoleOutputCharacter( - hConsoleOutput, // handle of a console screen buffer - lpWriteBuffer, // address of buffer to write characters from - cWriteCells, // number of character cells to write to - coordWrite, // coordinates of first cell to write to - lpcWritten // address of number of cells written to - ); - delete [] lpwAttribute; - return 1; -} - -static void hexify(int x, char *str, int len) { - for(int j = len - 1; j >= 0; j--) { - str[j] = x % 16; - if(str[j] > 9) str[j] += 'A' - 10; - else str[j] += '0'; - x /= 16; - } -} - -static int setmaxlines(int iDisplay, int iScrollSize, int strippedlines, - int con_width) { - switch(iDisplay) { - case HEX: return(iScrollSize / 16); break; - case DUMP: - case DUMPB: return(iScrollSize / con_width); break; - case TEXTB: return(strippedlines); break; - } - return 0; -} - -static void setstatusline(char *szStatusLine, int len, int iDisplay) { - memset(szStatusLine, ' ', len); - memcpy(&szStatusLine[1], "Scrollback Mode", 15); - switch(iDisplay) { - case HEX: memcpy(&szStatusLine[len / 2 - 1], "HEX", 3); break; - case DUMP: memcpy(&szStatusLine[len / 2 - 2], "DUMP", 4); break; - case DUMPB: memcpy(&szStatusLine[len / 2 - 5], "BINARY DUMP", 11); break; - case TEXTB: memcpy(&szStatusLine[len / 2 - 2], "TEXT", 4); break; - } - memcpy(&szStatusLine[len - 6], "READY", 5); - szStatusLine[len] = 0; -} - -void TScroller::ScrollBack(){ - char p; - int r,c; - - // define colors (Paul Brannan 7/5/98) - int normal = (ini.get_scroll_bg() << 4) | ini.get_scroll_fg(); - // int inverse = (ini.get_scroll_fg() << 4) | ini.get_scroll_bg(); - int status = (ini.get_status_bg() << 4) | ini.get_status_fg(); - - CHAR_INFO* chiBuffer; - chiBuffer = newBuffer(); - saveScreen(chiBuffer); - - HANDLE hStdout = GetStdHandle(STD_OUTPUT_HANDLE); - CONSOLE_SCREEN_BUFFER_INFO ConsoleInfo; - GetConsoleScreenBufferInfo(hStdout, &ConsoleInfo); - - // Update iScrollBegin -- necessary in case the buffer isn't full yet - long iScrollBegin, iScrollLast; - if(iPastEnd == 0) { - iScrollBegin = 0; - iScrollLast = iScrollEnd - 1; - } else { - iScrollBegin = iScrollEnd; - iScrollLast = iScrollSize - 1; - } - - // Create buffer with ANSI codes stripped - // Fixed this to work properly with a circular buffer (PB 12/4/98) - char *stripped = new char[iScrollSize]; - memcpy(stripped, pcScrollData + iScrollBegin, iScrollSize - - iScrollBegin); - if(iScrollBegin != 0) memcpy(stripped + (iScrollSize - iScrollBegin), - pcScrollData, iScrollBegin - 1); - int strippedlines = (*strip)(stripped, stripped + iScrollLast, - CON_COLS); - - // Calculate the last line of the scroll buffer (Paul Brannan 12/4/98) - int maxlines = setmaxlines(iDisplay, iScrollLast + 1, strippedlines, - CON_COLS); - - // init scroll position - int current = maxlines - CON_HEIGHT + 1; - if(current < 0) current = 0; - - // paint border and info - // paint last two lines black on white - char * szStatusLine; - szStatusLine = new char[CON_WIDTH+2]; - setstatusline(szStatusLine, CON_COLS, iDisplay); - WriteConsoleOutputCharAndAttribute(hStdout, szStatusLine, status, - CON_LEFT, CON_BOTTOM); - - // loop while not done - BOOL done = FALSE; - while (!done){ - switch (iDisplay){ - case HEX: - memset(szStatusLine, ' ', CON_COLS); - szStatusLine[8] = ':'; - szStatusLine[34] = '-'; - for (r = 0; r < CON_HEIGHT; r++) { - hexify((r + current) * 16, &szStatusLine[2], 6); - for (c = 0; c < 16; c++){ - if (c+(16*(r+current)) >= iScrollLast) - p = 0; - else - p = pcScrollData[(c+16*(r+current) + iScrollBegin) % - iScrollSize]; - hexify((char)p, &szStatusLine[11 + 3*c], 2); - if (!iscntrl(p)) { - szStatusLine[60 + c] = (char)p; - } else { - szStatusLine[60 + c] = '.'; - } - } - for(int j = 0; j < 16; j++) { - } - szStatusLine[CON_COLS] = '\0'; - WriteConsoleOutputCharAndAttribute(hStdout, szStatusLine, - normal, CON_LEFT, r+CON_TOP); - } - break; - case DUMP: - for (r = 0; r < CON_HEIGHT; r++) { - for (c = 0; c <= CON_WIDTH; c++) { - if (c+((CON_COLS)*(r+current)) >= iScrollLast) p = ' '; - else p = pcScrollData[(c+((CON_COLS)*(r+current)) - + iScrollBegin) % iScrollSize]; - if (!iscntrl(p)) - szStatusLine[c] = p; - else - szStatusLine[c] = '.'; - } - szStatusLine[c] = '\0'; - WriteConsoleOutputCharAndAttribute(hStdout, szStatusLine, - normal, CON_LEFT, r+CON_TOP); - } - break; - case DUMPB: - for (r = 0; r < CON_HEIGHT; r++) { - for (c = 0; c <= CON_WIDTH; c++) { - if (c+((CON_COLS)*(r+current)) >= iScrollLast) p = ' '; - else p = pcScrollData[ (c+((CON_COLS)*(r+current)) - + iScrollBegin) % iScrollSize]; - if (p != 0) - szStatusLine[c] = p; - else - szStatusLine[c] = ' '; - } - szStatusLine[c] = '\0'; - WriteConsoleOutputCharAndAttribute(hStdout, szStatusLine, - normal, CON_LEFT, r+CON_TOP); - } - break; - case TEXTB: { - int ch, lines, x; - // Find the starting position - for(ch = 0, lines = 0, x = 1; ch < iScrollSize && - lines < current; ch++, x++) { - - if(stripped[ch] == '\n') lines++; - if(stripped[ch] == '\r') x = 1; - } - - for (r = 0; r < CON_HEIGHT; r++) { - memset(szStatusLine, ' ', CON_COLS); - for(c = 0; c <= CON_WIDTH; c++) { - int done = FALSE; - if (ch >= iScrollSize) p = ' '; - else p = stripped[ch]; - switch(p) { - case 10: done = TRUE; break; - case 13: c = 0; break; - default: szStatusLine[c] = p; - } - ch++; - if(done) break; - } - szStatusLine[CON_COLS] = '\0'; - WriteConsoleOutputCharAndAttribute(hStdout, szStatusLine, - normal, CON_LEFT, r+CON_TOP); - } - } - break; - } - - setstatusline(szStatusLine, CON_COLS, iDisplay); - WriteConsoleOutputCharAndAttribute(hStdout, szStatusLine, status, - CON_LEFT, CON_BOTTOM); - - // paint scroll back data - // get key input - switch(scrollkeys()){ - case VK_ESCAPE: - done = TRUE; - break; - case VK_PRIOR: - if ( current > CON_HEIGHT) - current-= CON_HEIGHT; - else - current = 0; - break; - case VK_NEXT: - if ( current < maxlines - 2*CON_HEIGHT + 2) - current += CON_HEIGHT; - else - current = maxlines - CON_HEIGHT + 1; - break; - case VK_DOWN: - if (current <= maxlines - CON_HEIGHT) current++; - break; - case VK_UP: - if ( current > 0) current--; - break; - case VK_TAB: - iDisplay = (iDisplay+1)%4; - maxlines = setmaxlines(iDisplay, iScrollLast + 1, strippedlines, - CON_COLS); - if(current > maxlines) current = maxlines - 1; - if(current < 0) current = 0; - break; - case VK_END: - current = maxlines - CON_HEIGHT + 1; - if(current < 0) current = 0; - break; - case VK_HOME: - current = 0; - break; - case SC_MOUSE: - Mouse.scrollMouse(); - break; - } - } - - // Clean up - restoreScreen(chiBuffer); - delete[] szStatusLine; - delete[] chiBuffer; - delete[] stripped; -} diff --git a/rosapps/net/telnet/src/tscroll.h b/rosapps/net/telnet/src/tscroll.h deleted file mode 100644 index 4261ca0f94c..00000000000 --- a/rosapps/net/telnet/src/tscroll.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef __TSCROLL_H -#define __TSCROLL_H - -#include "tconsole.h" -#include "tmouse.h" - -typedef int(stripfunc)(char *, char *, int); - -class TScroller { -private: - char *pcScrollData; - long iScrollSize; - long iScrollEnd; - int iPastEnd; - int iDisplay; - stripfunc *strip; - TMouse &Mouse; -public: - void init(stripfunc *s); - void update(const char *pszBegin, const char *pszEnd); - void ScrollBack(); - TScroller(TMouse &M, int size=20000); - ~TScroller(); -}; - -#endif diff --git a/rosapps/net/telnet/src/ttelhndl.cpp b/rosapps/net/telnet/src/ttelhndl.cpp deleted file mode 100644 index cdbb1f7acea..00000000000 --- a/rosapps/net/telnet/src/ttelhndl.cpp +++ /dev/null @@ -1,548 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -//Telnet Win32 : an ANSI telnet client. -//Copyright (C) 1998 Paul Brannan -//Copyright (C) 1998 I.Ioannou -//Copyright (C) 1997 Brad Johnson -// -//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. -// -//I.Ioannou -//roryt@hol.gr -// -/////////////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// -// Module: ttelhndl.cpp -// -// Contents: Telnet Handler -// -// Product: telnet -// -// Revisions: August 30, 1998 Paul Brannan -// June 15, 1998 pbranna@clemson.edu (Paul Brannan) -// -// This is code originally from tnnet.cpp and ansiprsr.cpp -// -/////////////////////////////////////////////////////////////////////////////// - -#include -#include "ttelhndl.h" -#include "telnet.h" -#include "tnconfig.h" -#include "tparams.h" - -int naws_string(char *buf, int width, int height); - -// This helps make the code more readable (Paul Brannan 1/1/99) -#ifdef DEBUG_TELOPT -#define TELOPT_PRINTD(x) printit(x); -#define TELOPT_PRINTD2(x,n) { \ - static char buf[20]; \ - printit(s); \ - printit(" "); \ - itoa(d, buf, 10); \ - printit(buf); \ - printit("\n"); \ -} -#else -#define TELOPT_PRINTD(x) ; -#define TELOPT_PRINTD2(x,n) ; -#endif - -// A new print function for debugging (Paul Brannan 5/15/98) -#ifdef DEBUG_TELOPT -void TTelnetHandler::print_telopt(const char *s, int d) { - static char buf[20]; - printit(s); - printit(" "); - itoa(d, buf, 10); - printit(buf); - printit("\n"); -} -#endif - -TTelnetHandler::TTelnetHandler(TNetwork &RefNetwork, TConsole &RefConsole, - TParser &RefParser): -Network(RefNetwork), Console(RefConsole), Parser(RefParser) { - init(); - - // Paul Brannan 9/13/98 - dwBuffer = ini.get_buffer_size(); - szBuffer = new char [dwBuffer]; - Network.SetNawsFunc(NULL); -} - -void TTelnetHandler::init() { - iTermSet = 0; - bInBinaryRx = 0; - bInBinaryTx = 0; - bInEchoTx = 0; - bInEchoRx = 0; - Network.set_local_echo(1); -} - -TTelnetHandler::~TTelnetHandler() { - delete[] szBuffer; -} - -int TTelnetHandler::escapeIAC(char *buf, int length){ - // The size of buffer must be greater than 2 * length to ensure no memory - // out of bounds errors. The 0xff is escaped into 0xff 0xff. - char * temp; - temp = new char [length * 2]; - int current=0; - for (int x=0; x < length; x++){ - if (buf[x] == (signed char)IAC) - temp[current++]=(char)IAC; - temp[current++]=buf[x]; - } - memcpy( buf, temp, current); - delete [] temp; - return current; -} - -// This lets us get rid of all the printf's (Paul Brannan 5/15/98) -void TTelnetHandler::SendIAC(char c) { - static char buf[2] = {IAC}; - buf[1] = c; - Network.WriteString(buf, 2); -} -void TTelnetHandler::SendIAC(char c1, char c2) { - static char buf[3] = {IAC}; - buf[1] = c1; buf[2] = c2; - Network.WriteString(buf, 3); -} -void TTelnetHandler::SendIACParams(char c) { - static char buf[2]; - buf[0] = c; - static int length = escapeIAC(buf, 1); - Network.WriteString(buf, length); -} -void TTelnetHandler::SendIACParams(char c1, char c2) { - static char buf[4]; - buf[0] = c1; buf[1] = c2; - static int length = escapeIAC(buf, 2); - Network.WriteString(buf, length); -} - -int naws_string(char *b, int width, int height) { - int l = 0; - unsigned char *buf = (unsigned char *)b; - - union { - char szResponse[2]; - int n; - }; - - buf[l++] = IAC; - buf[l++] = SB; - buf[l++] = TELOPT_NAWS; - - n = width; - buf[l] = szResponse[1]; - if(buf[l-1] == IAC) buf[l++] = IAC; - buf[l++] = szResponse[0]; - if(buf[l-1] == IAC) buf[l++] = IAC; - - n = height; - buf[l++] = szResponse[1]; - if(buf[l-1] == IAC) buf[l++] = IAC; - buf[l++] = szResponse[0]; - if(buf[l-1] == IAC) buf[l++] = IAC; - - buf[l++] = IAC; - buf[l++] = SE; - - return l; -} - -// Ioannou 29 May 1998 : Something strange happens with -// Borland compiler at this point when it passes the arguments -// to SendIACParams. It always sends 80 lines to the server !!! -// There seems to be a bug with optimization (the disassemble shows -// that it uses an address plus 0xa than the right one). -// This turns them off for this point. -#ifdef __BORLANDC__ -#pragma -O- -#endif - -// Removed old printf code that was commented out to clean this function -// up a bit (Paul brannan 6/15/98) -char* TTelnetHandler::ParseIAC(char* pszBuffer, char* pszBufferEnd) -{ - // int n,l; - // char szResponse[40]; - // Ioannou 29 May 1998 : I prefer the union redefinitions - // than the typecasting (used with them from Pascal and Cobol :-) ) - // FIX ME !!!! Shall we use the winsock routines instead ? - - union { - char szResponse[2]; - int n; - }; - - // Added support for user-defined term name (Paul Brannan 5/13/98) -#define LASTTERM 4 - const char *pszTerms[] = {ini.get_term(), "ANSI","DEC-VT100","DEC-VT52","UNKNOWN"}; - if(!iTermSet && (pszTerms[0] == 0 || *pszTerms[0] == 0)) iTermSet++; - - if (pszBuffer + 2 < pszBufferEnd) { - switch ((unsigned char)pszBuffer[1]) { - - ///////////////// DO //////////////////// - case DO: - { - switch (pszBuffer[2]){ - case TELOPT_BINARY: - TELOPT_PRINTD("RCVD DO TELOPT_BINARY\n"); - if (!bInBinaryRx){ - SendIAC(WILL, TELOPT_BINARY); - bInBinaryRx = 1; - TELOPT_PRINTD("SENT WILL TELOPT_BINARY\n"); - } - break; - case TELOPT_ECHO: - // we shouldn't echo for the server! (Paul Brannan 5/30/98) - TELOPT_PRINTD2("RCVD DO TELOPT_ECHO", pszBuffer[2]); - SendIAC(WONT, TELOPT_ECHO); - TELOPT_PRINTD("SENT WONT TELOPT_ECHO\n"); - break; - case TELOPT_TTYPE: - TELOPT_PRINTD("RCVD DO TELOPT_TTYPE\n"); - SendIAC(WILL, TELOPT_TTYPE); - TELOPT_PRINTD("SENT WILL TELOPT_TTYPE\n"); - break; - case TELOPT_NAWS: - TELOPT_PRINTD("RCVD DO TELOPT_NAWS\n"); - SendIAC(WILL, TELOPT_NAWS); - SendIAC(SB, TELOPT_NAWS); - - Network.SetNawsFunc(naws_string); - - n = Console.GetWidth(); - SendIACParams(szResponse[1],szResponse [0]); - - n = Console.GetHeight(); - SendIACParams(szResponse[1],szResponse[0]); - - SendIAC(SE); - TELOPT_PRINTD("SENT WILL TELOPT_NAWS\n"); - break; - case TELOPT_XDISPLOC: - TELOPT_PRINTD("RCVD DO TELOPT_XDISPLOC\n"); - SendIAC(WILL, TELOPT_XDISPLOC); - TELOPT_PRINTD("SENT WILL TELOPT_XDISPLOC\n"); - printit("Retrieving IP..."); - break; - default: - TELOPT_PRINTD2("RCVD DO", pszBuffer[2]); - SendIAC(WONT, pszBuffer[2]); - TELOPT_PRINTD2("SENT WONT", pszBuffer[2]); - break; - } - if (pszBuffer + 2 < pszBufferEnd) - pszBuffer += 3; - break; - } - - ///////////////// WILL //////////////////// - case WILL: - { - switch ((unsigned char)pszBuffer[2]){ - case TELOPT_BINARY: - TELOPT_PRINTD("RCVD WILL TELOPT_BINARY\n"); - if (!bInBinaryTx){ - SendIAC(DO, TELOPT_BINARY); - bInBinaryTx = 1; - TELOPT_PRINTD("SENT DO TELOPT_BINARY\n"); - } - break; - case TELOPT_ECHO: - TELOPT_PRINTD2("RCVD WILL TELOPT_ECHO", pszBuffer[2]); - if(!bInEchoRx) { - SendIAC(DO, TELOPT_ECHO); - bInEchoRx = 1; - Network.set_local_echo(0); // Paul Brannan 8/25/98 - if(iWillSGA) Network.set_line_mode(0); - TELOPT_PRINTD2("SENT DO TELOPT_ECHO", pszBuffer[2]); - if(Network.get_local_echo()) Network.set_line_mode(0); - } - break; - - // Suppress Go Ahead (Paul Brannan 12/31/98) - case TELOPT_SGA: - TELOPT_PRINTD("RCVD WILL TELOPT_SGA\n"); - if(!iWillSGA) { - SendIAC(DO, TELOPT_SGA); - if(bInEchoRx) Network.set_line_mode(0); - iWillSGA = 1; - TELOPT_PRINTD("SENT DO TELOPT_SGA\n"); - } - break; - - ////added 1/28/97 - default: - TELOPT_PRINTD2("RCVD WILL", pszBuffer[2]); - SendIAC(DONT, pszBuffer[2]); - TELOPT_PRINTD2("SENT DONT", pszBuffer[2]); - break; - //// - } - if (pszBuffer + 2 < pszBufferEnd) - pszBuffer += 3; - break; - } - - ///////////////// WONT //////////////////// - case WONT: - { - switch ((unsigned char)pszBuffer[2]){ - case TELOPT_ECHO: - TELOPT_PRINTD("RCVD WONT TELOPT_ECHO\n"); - if (bInEchoRx){ - SendIAC(DONT, TELOPT_ECHO); - // bInBinaryRx = 0; - bInEchoRx = 0; // Paul Brannan 8/25/98 - Network.set_local_echo(1); - Network.set_line_mode(0); - TELOPT_PRINTD("SENT DONT TELOPT_ECHO\n"); - } - break; - - // Suppress Go Ahead (Paul Brannan 12/31/98) - case TELOPT_SGA: - TELOPT_PRINTD("RCVD WONT TELOPT_SGA\n"); - if(iWillSGA) { - SendIAC(DONT, TELOPT_SGA); - Network.set_line_mode(0); - iWillSGA = 0; - TELOPT_PRINTD("SENT DONT TELOPT_SGA\n"); - } - break; - - default: - TELOPT_PRINTD2("RCVD WONT", pszBuffer[2]); - break; - } - if (pszBuffer + 2 < pszBufferEnd) - pszBuffer += 3; - break; - } - - ///////////////// DONT //////////////////// - case DONT: - { - switch ((unsigned char)pszBuffer[2]){ - case TELOPT_ECHO: - TELOPT_PRINTD("RCVD DONT TELOPT_ECHO\n"); - if (bInEchoTx){ - SendIAC(WONT, TELOPT_ECHO); - bInEchoTx = 0; - TELOPT_PRINTD("SENT WONT TELOPT_ECHO\n"); - } - break; - case TELOPT_NAWS: - TELOPT_PRINTD("RCVD DONT TELOPT_NAWS\n"); - SendIAC(WONT, TELOPT_NAWS); - Network.SetNawsFunc(naws_string); - TELOPT_PRINTD("SENT WONT TELOPT_NAWS\n"); - break; - default: - TELOPT_PRINTD2("RCVD DONT", pszBuffer[2]); - break; - } - if (pszBuffer + 2 < pszBufferEnd) - pszBuffer += 3; - break; - } - - ///////////////// SB //////////////////// - case SB: - { - switch ((unsigned char)pszBuffer[2]){ - case TELOPT_TTYPE: - if (pszBuffer + 5 < pszBufferEnd) { - TELOPT_PRINTD("RCVD SB TELOPT_TTYPE\n"); - if (pszBuffer[3] == 1){ - TELOPT_PRINTD("SENT SB TT"); - TELOPT_PRINTD(pszTerms[iTermSet]); - TELOPT_PRINTD("\n"); - SendIAC(SB, TELOPT_TTYPE); - SendIACParams(0); - Network.WriteString(pszTerms[iTermSet], strlen(pszTerms[iTermSet])); - SendIAC(SE); - - if (iTermSet < LASTTERM ) - iTermSet+=1; - } - if (pszBuffer + 5 < pszBufferEnd) - pszBuffer += 6; - } - break; - case TELOPT_XDISPLOC: - if(pszBuffer + 5 < pszBufferEnd) { - TELOPT_PRINTD("RCVD SB XDISPLOC\n"); - SendIAC(SB, TELOPT_XDISPLOC); - TELOPT_PRINTD("SENT SB XDISPLOC"); - SendIACParams(0); - if(Network.GetLocalAddress()) Network.WriteString(Network.GetLocalAddress(), - strlen(Network.GetLocalAddress())); - TELOPT_PRINTD(Network.GetLocalAddress()); - TELOPT_PRINTD("\n"); - SendIAC(SE); - if (pszBuffer + 5 < pszBufferEnd) - pszBuffer += 6; - } - break; - default: break; - } - break; - } - default: - pszBuffer += 2; - break; - } - } - return pszBuffer; -} - -#ifdef __BORLANDC__ -// bring bug optimazations -#pragma -O. -#endif - -// This is the code from TANSIParser::ParseBuffer. It parses out IACs, and -// then calls TParser::ParseBuffer to do the terminal emulation. -// (Paul Brannan 6/15/98) -// Hopefully eliminating the unnecessary copying should speed things up a -// little. (Paul Brannan 6/28/98) -char* TTelnetHandler::ParseBuffer(char* pszBuffer, char* pszBufferEnd){ - char *pszResult; - char *pszHead = pszBuffer; - - if(Network.get_net_type() == TN_NETSOCKET) { - while (pszBuffer < pszBufferEnd) { - // if IAC then parse IAC - if((unsigned char) *pszBuffer == IAC) { - - // check for escaped IAC - if((pszBufferEnd >= pszBuffer + 1) && - (unsigned char)*(pszBuffer + 1) == IAC) { - // we move data at the front of the buffer to the end so - // that if we only have IACs we won't return pszBuffer - // even though we did parse something. Returning - // pszBuffer is an error condition. - memmove(pszHead + 1, pszHead, pszBuffer - pszHead); - pszBuffer+=2; - pszHead++; - } - // parse the IAC - else { - pszResult = ParseIAC(pszBuffer, pszBufferEnd); - if(pszBuffer == pszResult) return pszBuffer; - // see above regarding moving from front to end. - memmove(pszHead + (pszResult - pszBuffer), pszHead, - pszBuffer - pszHead); - pszHead += (pszResult - pszBuffer); - pszBuffer = pszResult; - } - } - // else copy char over to ANSI buffer - else { - pszBuffer++; - } - } - - // Not a socket connection, so don't parse out IACs. - // (Paul Brannan 3/19/99) - } else { - pszBuffer = pszBufferEnd; - } - - return(Parser.ParseBuffer(pszHead, pszBuffer)); -} - -// telProcessNetwork calls the member function TTelnetHandler::Go, since -// TTelnetHandler::Go is not a static function, and cannot be called with -// CreateThread(). (Paul Brannan 6/15/98) -DWORD telProcessNetwork(LPVOID pvParams) { - TelThreadParams *pParams = (TelThreadParams *)pvParams; - return pParams->TelHandler.Go(&pParams->p); -} - -// This function is what used to be telProcessNetwork (Paul Brannan 6/15/98) -DWORD TTelnetHandler::Go(LPVOID pvParams) -{ - NetParams *pParams = (NetParams *)pvParams; - - // No longer a need to copy pParams-> socket and create an instance - // of TANSIParser (Paul Brannan 6/15/98) - - Console.sync(); // Sync with the parser so the cursor is positioned - - Parser.Init(); // Reset the parser (Paul Brannan 9/19/98) - init(); // Turn on local echo (Paul Brannan 9/19/98) - - *pParams->bNetFinished = 0; - char* pszHead = szBuffer; - char* pszTail = szBuffer; - while (!*pParams->bNetFinish) { - // Get data from Socket - *pParams->bNetPaused = 1; //Pause - int Result = Network.ReadString(pszTail, (szBuffer + dwBuffer) - pszTail); - - // Speed up mouse by not going into loop (Paul Brannan 8/10/98) - // while(*pParams->bNetPause && !*pParams->bNetFinish) *pParams->bNetPaused = 1; //Pause - if(WaitForSingleObject(pParams->hPause, 0) == WAIT_OBJECT_0) - WaitForSingleObject(pParams->hUnPause, INFINITE); - - *pParams->bNetPaused = 0; //UnPause - - if (Result <= 0 || Result > dwBuffer ){ - break; - } - pszTail += Result; - - // Process the buffer - char* pszNewHead = pszHead; - do { - // Speed up mouse by not going into loop (Paul Brannan 8/10/98) - if(WaitForSingleObject(pParams->hPause, 0) == WAIT_OBJECT_0) { - *pParams->bNetPaused = 1; - WaitForSingleObject(pParams->hUnPause, INFINITE); - *pParams->bNetPaused = 0; - } - - pszHead = pszNewHead; - pszNewHead = ParseBuffer(pszHead, pszTail); // Parse buffer - } while ((pszNewHead != pszHead) && (pszNewHead < pszTail) && !*pParams->bNetFinish); - pszHead = pszNewHead; - - // When we reach the end of the buffer, move contents to the - // beginning of the buffer to get free space at the end. - if (pszTail == (szBuffer + dwBuffer)) { - memmove(szBuffer, pszHead, pszTail - pszHead); - pszTail = szBuffer + (pszTail - pszHead); - pszHead = szBuffer; - } - } - SetEvent(pParams->hExit); - - printm(0, FALSE, MSG_TERMBYREM); - *pParams->bNetPaused = 1; //Pause - *pParams->bNetFinished = 1; - return 0; -} diff --git a/rosapps/net/telnet/src/ttelhndl.h b/rosapps/net/telnet/src/ttelhndl.h deleted file mode 100644 index 5208f869867..00000000000 --- a/rosapps/net/telnet/src/ttelhndl.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef __TTELHNDL_H -#define __TTELHNDL_H - -#include "tparser.h" -#include "tnetwork.h" - -DWORD telProcessNetwork(LPVOID pvParams); - -class TTelnetHandler { -private: - int iTermSet; - int bInBinaryRx, bInBinaryTx; - int bInEchoTx, bInEchoRx; - int iWillSGA; - - void init(); - - int escapeIAC(char *buf, int length); - - // Paul Brannan 5/15/98 - void SendIAC(char c); - void SendIAC(char c1, char c2); - void SendIACParams(char c); - void SendIACParams(char c1, char c2); - void print_telopt(const char *s, int d); - - TNetwork &Network; - TConsole &Console; - TParser &Parser; - - char* ParseBuffer(char* pszBuffer, char* pszBufferEnd); - char* ParseIAC(char* pszBuffer, char* pszBufferEnd); - - // Paul Brannan 9/13/98 - char *szBuffer, *tmpBuffer; - char *ansiBufferStart, *ansiBufferEnd; - int dwBuffer; - - void do_naws(int width, int height); - -public: - TTelnetHandler(TNetwork &RefNetwork, TConsole &RefConsole, - TParser &RefParser); - ~TTelnetHandler(); - - DWORD Go(LPVOID pvParams); - - int get_term() {return iTermSet;} -}; - -#endif diff --git a/rosapps/net/telnet/telnet.cfg b/rosapps/net/telnet/telnet.cfg deleted file mode 100644 index 37a2f512e73..00000000000 --- a/rosapps/net/telnet/telnet.cfg +++ /dev/null @@ -1,2616 +0,0 @@ -; Console Telnet 2.0 keys.cfg -; -[comment] - -This is a completely rewritten configuration file for Console Telnet 2.0. - -Now you can define multiple keymaps, character maps, and combine them in your -own ways. - -Possible definition: - [COMMENT] - ... - [END COMMENT] - This is for commenting a big part of text. can be nested. - In text these also work: - ; - First printable character in line, which is completely - ignored. - // - Like C++ comment - - [GLOBAL] - ... - [END GLOBAL] - This part is required. For an explanation look at the body. - - [KEYMAP name] - ... - [END KEYMAP] - 'name' - is a keymap name for reference. In 'name' you can use - any char exept spaces, '+', ':' and ']'. '+' and ':' reserved for - CONFIG section. - Body is a sequence of key definitions: - - [keymodifier[+keymodifier[+...]]] - - example: - VK_F1 RIGHT_ALT+RIGHT_CTRL this_would_print - - vk_name is an ASCII string equivalent to an entry in [GLOBAL]. - - Valid keymodifiers are: - RIGHT_ALT - LEFT_ALT - RIGHT_CTRL - LEFT_CTRL - SHIFT - ENHANCED - NUMLOCK - CAPSLOCK - SCROLLLOCK - APP_KEY - APP2_KEY - APP3_KEY - APP4_KEY - - Undefined enhanced keys will use the non-enhanced definition. - - APP_KEY, APP2_KEY, and APP3_KEY are application-specific key modes. - Other terminal emulations (which have not yet been implemented) may - use other definitions for these keys, but for the standard ANSI - emulation, these mean: - APP_KEY - VT100 application cursor keys - APP2_KEY - VT52 cursor keys - APP3_KEY - VT102 alternate keypad mode - APP4_KEY - VT100 newline mode set - - keytranslation is the string you want printed for the key. - The notation ^[ can be used to denote an escape character. - Any ASCII value can be represented by - - \nnn where nnn is a 3 digit decimal ASCII value or - \xhh where hh is a 2 digit hexadecimal ASCII value. - - Leading zeros may not be omitted. - A value of \000(\x00) will not be transmitted. - Rather, if you put \000 you undefine a key. If you must send a NULL character, - please use \TN_NULL\. - - A word on special sequences: - Any sequence of the form: \TN_...\ is a special sequence, which will perform a - special function for telnet. You may substitute one of these for keytranslation - for any key. Some of the special sequences that telnet recognizes: - - \TN_ESCAPE Escape into the telnet client - \TN_SCROLLBACK Go into the scrollback buffer - \TN_DIAL Start a new telnet session - \TN_PASTE Paste the contents of the clipboard to the server - \TN_NULL Send a null sequence to the server - \TN_CR Send \rNULL to the server - \TN_CRLF Send \r\n to the server - - note: In order to have both left and right alt have the same - action, you must create a separate def for left and right. - - [CHARMAP name] - ... - [END CHARMAP] - 'name' - is a charmap name for reference. Requirements are the same - as for keymap name. - body is a sequence of char conversion definition: - - - - where host_char is a char received from host, and console_char - is a char, which would be displayed on console. - - The main purpose of it is a conversion between differents code - pages, for example, on former USSR part of world most unix's hosts - uses 'koi8' code page, and on W95 machines - 866 code page. - - Any ASCII value can be represented by - - \nnn where nnn is a 3 digit decimal ASCII value or - \xhh where hh is a 2 digit hexadecimal ASCII value. - - Leading zeros may be omitted. - A value of \000(\x00) will not be accepted. - - Look for example at [charmap koi8-cp866]. - - [CONFIG name] - ... - [END CONFIG] - 'name' - is a configuration name for reference. Requirements are - the same as for keymap name. - - You must define one with name 'default', which will be used as - default. - - In the body of this section you can combine keymaps and set - the charmap. The format for this is: - - KEYMAP name_list [: [keymodifier[+keymodifier[+...]]] ] - - where - name_list: - keymap_name - keymap_name '+' name_list - - keymap_name is a name of [KEYMAP] - - You can specify multiple keymaps, for first (the default) - you can not define ': ...' part, but for the rest - (secondary) you must! - The ': ...' part defines a key for switch to this - keymap. - - Assigning a switching key to the first (default) keymap will be - ignored, but you can switch to by pressing a second time the - switch key for the current keymap. - - If a key is not found in a switched keymap, a program will - look for it in the default keymap. So, you only need to redefine - needed keys in secondary keymaps. - - CHARMAP name - - define which charmap is to use. - - examples: - [config default] - keymap default - [end config] - - [config linux] - keymap default + linux - [end config] - - [config default_koi8] - keymap default - keymap koi8u + koi8r : VK_/ RIGHT_ALT // russian keyboard - keymap koi8u : VK_. RIGHT_ALT // ukranian - - charmap koi8-cp866 - [end config] - - [config linux_koi8] - keymap default + linux - keymap koi8u + koi8r : VK_/ RIGHT_ALT // russian keyboard - keymap koi8u : VK_. RIGHT_ALT // ukranian - - charmap koi8-cp866 - [end config] - - For switching to russian keyboard just press RIGHT_ALT and '/'. - To switch back press it again. - -[end comment] - -[GLOBAL] -; DO NOT MODIFY THE GLOBALS UNLESS YOU KNOW WHAT YOU ARE DOING. -; The globals are required for the key translation to work. -; do not place keymap before globals - -VK_LBUTTON 01 Left mouse button -VK_RBUTTON 02 Right mouse button -VK_CANCEL 03 Control-break processing -VK_MBUTTON 04 Middle mouse button (three-button mouse) -;-- 05-07 Undefined -VK_BACK 08 BACKSPACE key -VK_TAB 09 TAB key -;-- 10-11 Undefined -VK_CLEAR 12 CLEAR key -VK_RETURN 13 ENTER key -;-- 14-15 Undefined -;VK_SHIFT 16 SHIFT key -;VK_CONTROL 17 CTRL key -;VK_MENU 18 ALT key - -VK_PAUSE 19 PAUSE key -;VK_CAPITAL 20 CAPS LOCK key -;-- 21-25 Reserved for Kanji systems -;-- 26 Undefined -VK_ESCAPE 27 ESC key -;-- 28-31 Reserved for Kanji systems -VK_SPACE 32 SPACEBAR -VK_PGUP 33 PAGE UP key -VK_PGDN 34 PAGE DOWN key -VK_END 35 END key -VK_HOME 36 HOME key -VK_LEFT 37 LEFT ARROW key -VK_UP 38 UP ARROW key -VK_RIGHT 39 RIGHT ARROW key -VK_DOWN 40 DOWN ARROW key -VK_SELECT 41 SELECT key -;-- 42 Original equipment manufacturer (OEM) specific -VK_EXECUTE 43 EXECUTE key -VK_SNAPSHOT 44 PRINT SCREEN key for Windows 3.0 and later -VK_INSERT 45 INS key -VK_DELETE 46 DEL key -VK_HELP 47 HELP key -VK_0 48 0 key -VK_1 49 1 key -VK_2 50 2 key -VK_3 51 3 key -VK_4 52 4 key -VK_5 53 5 key -VK_6 54 6 key -VK_7 55 7 key -VK_8 56 8 key -VK_9 57 9 key -;-- 58-64 Undefined -VK_A 65 A key -VK_B 66 B key -VK_C 67 C key -VK_D 68 D key -VK_E 69 E key -VK_F 70 F key -VK_G 71 G key -VK_H 72 H key -VK_I 73 I key -VK_J 74 J key -VK_K 75 K key -VK_L 76 L key -VK_M 77 M key -VK_N 78 N key -VK_O 79 O key -VK_P 80 P key -VK_Q 81 Q key -VK_R 82 R key -VK_S 83 S key -VK_T 84 T key -VK_U 85 U key -VK_V 86 V key -VK_W 87 W key -VK_X 88 X key -VK_Y 89 Y key -VK_Z 90 Z key -;-- 91-95 Undefined -VK_NUMPAD0 96 Numeric keypad 0 key -VK_NUMPAD1 97 Numeric keypad 1 key -VK_NUMPAD2 98 Numeric keypad 2 key -VK_NUMPAD3 99 Numeric keypad 3 key -VK_NUMPAD4 100 Numeric keypad 4 key -VK_NUMPAD5 101 Numeric keypad 5 key -VK_NUMPAD6 102 Numeric keypad 6 key -VK_NUMPAD7 103 Numeric keypad 7 key -VK_NUMPAD8 104 Numeric keypad 8 key -VK_NUMPAD9 105 Numeric keypad 9 key -VK_MULTIPLY 106 Multiply key -VK_ADD 107 Add key -VK_SEPARATOR 108 Separator key -VK_SUBTRACT 109 Subtract key -VK_DECIMAL 110 Decimal key -VK_DIVIDE 111 Divide key -VK_F1 112 F1 key -VK_F2 113 F2 key -VK_F3 114 F3 key -VK_F4 115 F4 key -VK_F5 116 F5 key -VK_F6 117 F6 key -VK_F7 118 F7 key -VK_F8 119 F8 key -VK_F9 120 F9 key -VK_F10 121 F10 key -VK_F11 122 F11 key -VK_F12 123 F12 key -VK_F13 124 F13 key -VK_F14 125 F14 key -VK_F15 126 F15 key -VK_F16 127 F16 key -VK_F17 128 F17 key -VK_F18 129 F18 key -VK_F19 130 F19 key -VK_F20 131 F20 key -VK_F21 132 F21 key -VK_F22 133 F22 key -VK_F23 134 F23 key -VK_F24 135 F24 key -;-- 136-143 Unassigned -VK_NUMLOCK 144 NUM LOCK key -VK_SCROLL 145 SCROLL LOCK key -;-- 146-185 Unassigned - -; -; -; John Ioannou (roryt@hol.gr) -; Athens 30/03/97 10:42pm GMT-2 -; Correction for Win95 -; -; This keys are used (at least in my keyboard -737/437 cp) -; for some common keys (equal, slash, backslash etc). -; Normally we don't want to define them, but -; there is a bug with win95 with them : -; with CAPS LOCK on they produce the SHIFTED character -; (minus gives _, = gives + etc). -; -; -;-- 186-192 OEM specific -VK_; 186 ; -VK_= 187 EQUAL -VK_, 188 , -VK_- 189 MINUS -VK_. 190 FULLSTOP -VK_/ 191 SLASH -VK_` 192 ` -;-- 193-218 Unassigned -;-- 219-228 OEM specific -VK_[ 219 [ -VK_\ 220 BACKSLASH -VK_] 221 ] -VK_' 222 ' -;-- 229 Unassigned -;-- 230 OEM specific -;-- 231-232 Unassigned -;-- 233-245 OEM specific -;-- 246-254 Unassigned - -[END GLOBAL] - -[keymap ANSI] -; -; John Ioannou (roryt@hol.gr) -; Athens 30/03/97 10:42pm GMT-2 -; -; these are full (SCO and not only) ANSI -; also they deal with the win95 bug and -; give support for the Midnight Commander -; -; -; function keys -; -VK_F1 ^[[M -VK_F2 ^[[N -VK_F3 ^[[O -VK_F4 ^[[P -VK_F5 ^[[Q -VK_F6 ^[[R -VK_F7 ^[[S -VK_F8 ^[[T -VK_F9 ^[[U -VK_F10 ^[[V -VK_F11 ^[[W -VK_F12 ^[[X -VK_F1 SHIFT ^[[Y -VK_F2 SHIFT ^[[Z -VK_F3 SHIFT ^[[a -VK_F4 SHIFT ^[[b -VK_F5 SHIFT ^[[c -VK_F6 SHIFT ^[[d -VK_F7 SHIFT ^[[e -VK_F8 SHIFT ^[[f -VK_F9 SHIFT ^[[g -VK_F10 SHIFT ^[[h -VK_F11 SHIFT ^[[i -VK_F12 SHIFT ^[[j -VK_F1 RIGHT_CTRL ^[[k -VK_F2 RIGHT_CTRL ^[[l -VK_F3 RIGHT_CTRL ^[[m -VK_F4 RIGHT_CTRL ^[[n -VK_F5 RIGHT_CTRL ^[[o -VK_F6 RIGHT_CTRL ^[[p -VK_F7 RIGHT_CTRL ^[[q -VK_F8 RIGHT_CTRL ^[[r -VK_F9 RIGHT_CTRL ^[[s -VK_F10 RIGHT_CTRL ^[[t -VK_F11 RIGHT_CTRL ^[[y -VK_F12 RIGHT_CTRL ^[[v -VK_F1 LEFT_CTRL ^[[k -VK_F2 LEFT_CTRL ^[[l -VK_F3 LEFT_CTRL ^[[m -VK_F4 LEFT_CTRL ^[[n -VK_F5 LEFT_CTRL ^[[o -VK_F6 LEFT_CTRL ^[[p -VK_F7 LEFT_CTRL ^[[q -VK_F8 LEFT_CTRL ^[[r -VK_F9 LEFT_CTRL ^[[s -VK_F10 LEFT_CTRL ^[[t -VK_F11 LEFT_CTRL ^[[y -VK_F12 LEFT_CTRL ^[[v -; -; misc fuctions -; -; FIX ME!!! Some people have reported that these keys don't work. -VK_SCROLL \017 -VK_PAUSE \019 -VK_INSERT ^[[L -VK_DELETE ENHANCED \127 -VK_HOME ^[[H -VK_PGUP ^[[I -VK_PGDN ^[[G -VK_END ^[[F -VK_INSERT SHIFT ^[[L -VK_DELETE SHIFT+ENHANCED \127 -VK_HOME SHIFT ^[[H -VK_PGUP SHIFT ^[[I -VK_PGDN SHIFT ^[[G -VK_END SHIFT ^[[F -; -; arrows -; -VK_LEFT ^[[D -VK_UP ^[[A -VK_RIGHT ^[[C -VK_DOWN ^[[B -VK_LEFT SHIFT ^[[D -VK_UP SHIFT ^[[A -VK_RIGHT SHIFT ^[[C -VK_DOWN SHIFT ^[[B -; -; just in case !!! -; -VK_ESCAPE SHIFT \027 -VK_TAB \009 -VK_TAB SHIFT ^[[Z^[[Z -; -;--------------------------------------- -; Athens 30/03/97 10:55pm GMT+2 -; Correction for Win95 -; -VK_6 SHIFT \094 -VK_` ` -VK_` SHIFT ~ -VK_0 CAPSLOCK 0 -VK_1 CAPSLOCK 1 -VK_2 CAPSLOCK 2 -VK_3 CAPSLOCK 3 -VK_4 CAPSLOCK 4 -VK_5 CAPSLOCK 5 -VK_6 CAPSLOCK 6 -VK_7 CAPSLOCK 7 -VK_8 CAPSLOCK 8 -VK_9 CAPSLOCK 9 -VK_ESCAPE CAPSLOCK \027 -VK_` CAPSLOCK ` -VK_= CAPSLOCK = -VK_- CAPSLOCK - -VK_\ CAPSLOCK \ -VK_[ CAPSLOCK [ -VK_] CAPSLOCK ] -VK_; CAPSLOCK ; -VK_' CAPSLOCK ' -VK_, CAPSLOCK , -VK_. CAPSLOCK . -VK_/ CAPSLOCK / -VK_0 CAPSLOCK+SHIFT ) -VK_1 CAPSLOCK+SHIFT ! -VK_2 CAPSLOCK+SHIFT @ -VK_3 CAPSLOCK+SHIFT # -VK_4 CAPSLOCK+SHIFT $ -VK_5 CAPSLOCK+SHIFT % -VK_6 CAPSLOCK+SHIFT ^ -VK_7 CAPSLOCK+SHIFT & -VK_8 CAPSLOCK+SHIFT * -VK_9 CAPSLOCK+SHIFT ( -VK_ESCAPE CAPSLOCK+SHIFT \027 -VK_` CAPSLOCK+SHIFT ~ -VK_= CAPSLOCK+SHIFT + -VK_- CAPSLOCK+SHIFT _ -VK_\ CAPSLOCK+SHIFT | -VK_[ CAPSLOCK+SHIFT { -VK_] CAPSLOCK+SHIFT } -VK_; CAPSLOCK+SHIFT : -VK_' CAPSLOCK+SHIFT " -VK_, CAPSLOCK+SHIFT < -VK_. CAPSLOCK+SHIFT > -VK_/ CAPSLOCK+SHIFT ? -; -; -;--------------------------------------- -; -; These are for use with Midnight Commander -; they map Meta key to ALT (Like Linux console, nice isn't it ? ) -; -VK_0 RIGHT_ALT ^[0 -VK_1 RIGHT_ALT ^[1 -VK_2 RIGHT_ALT ^[2 -VK_3 RIGHT_ALT ^[3 -VK_4 RIGHT_ALT ^[4 -VK_5 RIGHT_ALT ^[5 -VK_6 RIGHT_ALT ^[6 -VK_7 RIGHT_ALT ^[7 -VK_8 RIGHT_ALT ^[8 -VK_9 RIGHT_ALT ^[9 -VK_A RIGHT_ALT ^[A -VK_B RIGHT_ALT ^[B -VK_C RIGHT_ALT ^[C -VK_D RIGHT_ALT ^[D -VK_E RIGHT_ALT ^[E -VK_F RIGHT_ALT ^[F -VK_G RIGHT_ALT ^[G -VK_H RIGHT_ALT ^[H -VK_I RIGHT_ALT ^[I -VK_J RIGHT_ALT ^[J -VK_K RIGHT_ALT ^[K -VK_L RIGHT_ALT ^[L -VK_M RIGHT_ALT ^[M -VK_N RIGHT_ALT ^[N -VK_O RIGHT_ALT ^[O -VK_P RIGHT_ALT ^[P -VK_Q RIGHT_ALT ^[Q -VK_R RIGHT_ALT ^[R -VK_S RIGHT_ALT ^[S -VK_T RIGHT_ALT ^[T -VK_U RIGHT_ALT ^[U -VK_V RIGHT_ALT ^[V -VK_W RIGHT_ALT ^[W -VK_X RIGHT_ALT ^[X -VK_Y RIGHT_ALT ^[Y -VK_Z RIGHT_ALT ^[Z -VK_0 LEFT_ALT ^[0 -VK_1 LEFT_ALT ^[1 -VK_2 LEFT_ALT ^[2 -VK_3 LEFT_ALT ^[3 -VK_4 LEFT_ALT ^[4 -VK_5 LEFT_ALT ^[5 -VK_6 LEFT_ALT ^[6 -VK_7 LEFT_ALT ^[7 -VK_8 LEFT_ALT ^[8 -VK_9 LEFT_ALT ^[9 -VK_A LEFT_ALT ^[a -VK_B LEFT_ALT ^[b -VK_C LEFT_ALT ^[c -VK_D LEFT_ALT ^[d -VK_E LEFT_ALT ^[e -VK_F LEFT_ALT ^[f -VK_G LEFT_ALT ^[g -VK_H LEFT_ALT ^[h -VK_I LEFT_ALT ^[i -VK_J LEFT_ALT ^[j -VK_K LEFT_ALT ^[k -VK_L LEFT_ALT ^[l -VK_M LEFT_ALT ^[m -VK_N LEFT_ALT ^[n -VK_O LEFT_ALT ^[o -VK_P LEFT_ALT ^[p -VK_Q LEFT_ALT ^[q -VK_R LEFT_ALT ^[r -VK_S LEFT_ALT ^[s -VK_T LEFT_ALT ^[t -VK_U LEFT_ALT ^[u -VK_V LEFT_ALT ^[v -VK_W LEFT_ALT ^[w -VK_X LEFT_ALT ^[x -VK_Y LEFT_ALT ^[y -VK_Z LEFT_ALT ^[z -VK_RETURN RIGHT_CTRL \TN_CR -VK_RETURN LEFT_CTRL \TN_CR -; VK_RETURN now sends CR except in newline mode (Paul Brannan 12/9/98) -VK_RETURN \TN_CR -VK_RETURN APP4_KEY \TN_CRLF -VK_RETURN ENHANCED \TN_CR -; This is for application cursor keys (Paul Brannan 5/27/98) -VK_LEFT APP_KEY ^[OD -VK_UP APP_KEY ^[OA -VK_RIGHT APP_KEY ^[OC -VK_DOWN APP_KEY ^[OB -VK_LEFT APP_KEY+SHIFT ^[OD -VK_UP APP_KEY+SHIFT ^[OA -VK_RIGHT APP_KEY+SHIFT ^[OC -VK_DOWN APP_KEY+SHIFT ^[OB -; APP2_KEY is for VT52 support (Paul Brannan 6/28/98) -VK_LEFT APP2_KEY ^[D -VK_UP APP2_KEY ^[A -VK_RIGHT APP2_KEY ^[C -VK_DOWN APP2_KEY ^[B -VK_LEFT APP2_KEY+SHIFT ^[D -VK_UP APP2_KEY+SHIFT ^[A -VK_RIGHT APP2_KEY+SHIFT ^[C -VK_DOWN APP2_KEY+SHIFT ^[B -VK_F1 APP2_KEY ^[P -VK_F2 APP2_KEY ^[Q -VK_F3 APP2_KEY ^[R -VK_F4 APP2_KEY ^[S -VK_F5 APP2_KEY ^[?w -VK_F6 APP2_KEY ^[?x -VK_F7 APP2_KEY ^[?y -VK_F8 APP2_KEY ^[?m -VK_F9 APP2_KEY ^[?t -VK_F10 APP2_KEY ^[?u -VK_F1 APP2_KEY+SHIFT ^[?v -VK_F2 APP2_KEY+SHIFT ^[?l -VK_F3 APP2_KEY+SHIFT ^[?q -VK_F4 APP2_KEY+SHIFT ^[?r -VK_F5 APP2_KEY+SHIFT ^[?s -VK_F6 APP2_KEY+SHIFT ^[?M -VK_F7 APP2_KEY+SHIFT ^[?p -VK_F8 APP2_KEY+SHIFT ^[?n - -; Fix for the numeric decimal key (Paul Brannan 9/23/98) -VK_DELETE \127 -VK_DELETE NUMLOCK . -VK_DELETE NUMLOCK+SHIFT \127 - -; VT100 Application keypad mode (Paul Brannan 12/8/98) -VK_NUMPAD0 APP3_KEY ^[Op -VK_NUMPAD1 APP3_KEY ^[Oq -VK_NUMPAD2 APP3_KEY ^[Or -VK_NUMPAD3 APP3_KEY ^[Os -VK_NUMPAD4 APP3_KEY ^[Ot -VK_NUMPAD5 APP3_KEY ^[Ou -VK_NUMPAD6 APP3_KEY ^[Ov -VK_NUMPAD7 APP3_KEY ^[Ow -VK_NUMPAD8 APP3_KEY ^[Ox -VK_NUMPAD9 APP3_KEY ^[Oy -VK_ADD APP3_KEY ^[Ol -VK_SUBTRACT APP3_KEY ^[Om -VK_DELETE APP3_KEY ^[On -VK_RETURN ENHANCED+APP3_KEY ^[OM - -; VT52 Application keypad mode (Paul Brannan 12/8/98) -VK_NUMPAD0 APP2_KEY+APP3_KEY ^[?p -VK_NUMPAD1 APP2_KEY+APP3_KEY ^[?q -VK_NUMPAD2 APP2_KEY+APP3_KEY ^[?r -VK_NUMPAD3 APP2_KEY+APP3_KEY ^[?s -VK_NUMPAD4 APP2_KEY+APP3_KEY ^[?t -VK_NUMPAD5 APP2_KEY+APP3_KEY ^[?u -VK_NUMPAD6 APP2_KEY+APP3_KEY ^[?v -VK_NUMPAD7 APP2_KEY+APP3_KEY ^[?w -VK_NUMPAD8 APP2_KEY+APP3_KEY ^[?x -VK_NUMPAD9 APP2_KEY+APP3_KEY ^[?y -VK_ADD APP2_KEY+APP3_KEY ^[?l -VK_SUBTRACT APP2_KEY+APP3_KEY ^[?m -VK_DELETE APP2_KEY+APP3_KEY ^[?n -VK_RETURN ENHANCED+APP2_KEY+APP3_KEY ^[?M - -; Extra control characters (Paul Brannan 12/10/98) -VK_2 LEFT_CTRL \x00\x00 -VK_2 RIGHT_CTRL \x00\x00 -VK_6 LEFT_CTRL \x1e -VK_6 RIGHT_CTRL \x1e -VK_- LEFT_CTRL \x1f -VK_- RIGHT_CTRL \x1f - -; A way to send the null Character (Paul Brannan 3/29/00) -VK_SPACE LEFT_CTRL \TN_NULL -VK_SPACE RIGHT_CTRL \TN_NULL - -[END keymap] // ansi - -[keymap LINUX] -; -; -; John Ioannou (roryt@hol.gr) -; Athens 12 April 1997 -; -; Linux keys -; -; Andrew Smilianets (smile@head.aval.kiev.ua) -; Kiev 23 December 1997 -; -; duplicated with default stripped, so, to use it, declare -; keymap default+linux - -; -; function keys -; -VK_F1 ^[[[A -VK_F2 ^[[[B -VK_F3 ^[[[C -VK_F4 ^[[[D -VK_F5 ^[[[E -VK_F6 ^[[17~ -VK_F7 ^[[18~ -VK_F8 ^[[19~ -VK_F9 ^[[20~ -VK_F10 ^[[21~ -VK_F11 ^[[23~ -VK_F12 ^[[24~ -VK_F1 SHIFT ^[[23~ -VK_F2 SHIFT ^[[24~ -VK_F3 SHIFT ^[[25~ -VK_F4 SHIFT ^[[26~ -VK_F5 SHIFT ^[[28~ -VK_F6 SHIFT ^[[29~ -VK_F7 SHIFT ^[[31~ -VK_F8 SHIFT ^[[32~ -VK_F9 SHIFT ^[[33~ -VK_F10 SHIFT ^[[34~ -VK_F11 SHIFT ^[[23~ -VK_F12 SHIFT ^[[24~ -VK_F1 RIGHT_CTRL ^[[[A -VK_F2 RIGHT_CTRL ^[[[B -VK_F3 RIGHT_CTRL ^[[[C -VK_F4 RIGHT_CTRL ^[[[D -VK_F5 RIGHT_CTRL ^[[[E -VK_F6 RIGHT_CTRL ^[[17~ -VK_F7 RIGHT_CTRL ^[[18~ -VK_F8 RIGHT_CTRL ^[[19~ -VK_F9 RIGHT_CTRL ^[[20~ -VK_F10 RIGHT_CTRL ^[[21~ -VK_F11 RIGHT_CTRL ^[[23~ -VK_F12 RIGHT_CTRL ^[[24~ -VK_F1 LEFT_CTRL ^[[[A -VK_F2 LEFT_CTRL ^[[[B -VK_F3 LEFT_CTRL ^[[[C -VK_F4 LEFT_CTRL ^[[[D -VK_F5 LEFT_CTRL ^[[[E -VK_F6 LEFT_CTRL ^[[17~ -VK_F7 LEFT_CTRL ^[[18~ -VK_F8 LEFT_CTRL ^[[19~ -VK_F9 LEFT_CTRL ^[[20~ -VK_F10 LEFT_CTRL ^[[21~ -VK_F11 LEFT_CTRL ^[[23~ -VK_F12 LEFT_CTRL ^[[24~ -; -; misc fuctions -; -VK_PAUSE ^[[P -VK_INSERT ^[[2~ -VK_DELETE ENHANCED ^[[3~ -VK_HOME ^[[1~ -VK_PGUP ^[[5~ -VK_PGDN ^[[6~ -VK_END ^[[4~ -VK_INSERT SHIFT ^[[2~ -VK_DELETE SHIFT+ENHANCED ^[[3~ -VK_HOME SHIFT ^[[1~ -VK_PGUP SHIFT ^[[5~ -VK_PGDN SHIFT ^[[6~ -VK_END SHIFT ^[[4~ -VK_INSERT LEFT_CTRL ^[[2~ -VK_DELETE LEFT_CTRL ^[[3~ -VK_HOME LEFT_CTRL ^[[1~ -VK_PGUP LEFT_CTRL ^[[5~ -VK_PGDN LEFT_CTRL ^[[6~ -VK_END LEFT_CTRL ^[[4~ -VK_INSERT RIGHT_CTRL ^[[2~ -VK_DELETE RIGHT_CTRL ^[[3~ -VK_HOME RIGHT_CTRL ^[[1~ -VK_PGUP RIGHT_CTRL ^[[5~ -VK_PGDN RIGHT_CTRL ^[[6~ -VK_END RIGHT_CTRL ^[[4~ -; -; arrows -; -VK_UP RIGHT_CTRL ^[[A -VK_DOWN RIGHT_CTRL ^[[B -VK_RIGHT RIGHT_CTRL ^[[C -VK_LEFT RIGHT_CTRL ^[[D -VK_UP LEFT_CTRL ^[[A -VK_DOWN LEFT_CTRL ^[[B -VK_RIGHT LEFT_CTRL ^[[C -VK_LEFT LEFT_CTRL ^[[D -VK_NUMPAD5 ^[[G - -[END keymap] // linux - -[keymap vt100] -; These were wrong, according to the docs I have. They don't work with -; Midnight Commander on my machine. I'm not sure if -; this is correct or not. I've also changed F1 - F4 so that they -; send PF1 - PF4, and F5 - F10 so they send VT102 application mode -; DEC keypad sequences. I changed SF1 - SF10 so they akso send DEC keypad -; sequences, and CF6 - CF12 so they send VT320 keypad sequences. -; (Paul Brannan 6/28/98) -; -; The numpad keys seem to be wrong, too. This has been fixed. -; (Paul Brannan 12/8/98) -VK_F1 ^[OP -VK_F2 ^[OQ -VK_F3 ^[OR -VK_F4 ^[OS -VK_F5 ^[Ow -VK_F6 ^[Ox -VK_F7 ^[Oy -VK_F8 ^[Om -VK_F9 ^[Ot -VK_F10 ^[Ou -VK_F1 SHIFT ^[Ov -VK_F2 SHIFT ^[Ol -VK_F3 SHIFT ^[Oq -VK_F4 SHIFT ^[Or -VK_F5 SHIFT ^[Os -VK_F6 SHIFT ^[OM -VK_F7 SHIFT ^[Op -VK_F8 SHIFT ^[On -VK_F6 RIGHT_CTRL ^[[17~ -VK_F7 RIGHT_CTRL ^[[18~ -VK_F8 RIGHT_CTRL ^[[19~ -VK_F9 RIGHT_CTRL ^[[20~ -VK_F10 RIGHT_CTRL ^[[21~ -VK_F11 RIGHT_CTRL ^[[23~ -VK_F12 RIGHT_CTRL ^[[24~ -VK_F6 LEFT_CTRL ^[[17~ -VK_F7 LEFT_CTRL ^[[18~ -VK_F8 LEFT_CTRL ^[[19~ -VK_F9 LEFT_CTRL ^[[20~ -VK_F10 LEFT_CTRL ^[[21~ -VK_F11 LEFT_CTRL ^[[23~ -VK_F12 LEFT_CTRL ^[[24~ - -[END keymap] // vt100 - -[keymap AT386] -: -; AT386 extended keys -; -; Dmitry Lapenkov -; - -VK_LBUTTON ^M\x00 -VK_RBUTTON ^[^[ -VK_CANCEL ^C -VK_MBUTTON ^[OP -VK_BACK ^H -VK_BACK SHIFT ^[[O -VK_BACK LEFT_CTRL \127 -VK_BACK RIGHT_CTRL \127 -VK_TAB ^I -VK_TAB SHIFT ^[[Z -VK_TAB LEFT_CTRL ^[[Z -VK_TAB RIGHT_CTRL ^[[Z -VK_RETURN ^M\x00 -VK_RETURN SHIFT ^[[R -VK_RETURN LEFT_CTRL ^J -VK_RETURN RIGHT_CTRL ^J -VK_PAUSE ^S -VK_PAUSE LEFT_CTRL ^C -VK_PAUSE RIGHT_CTRL ^C -VK_PAUSE SHIFT ^S -VK_ESCAPE ^[^[ -VK_ESCAPE SHIFT ^[ -VK_BACK LEFT_ALT ^[[o -VK_BACK RIGHT_ALT ^[[o -VK_TAB LEFT_ALT ^[[z -VK_TAB RIGHT_ALT ^[[z -VK_RETURN LEFT_ALT ^[[r -VK_RETURN RIGHT_ALT ^[[r -VK_PAUSE LEFT_ALT ^[< -VK_PAUSE RIGHT_ALT ^[> -VK_PGUP ^[[V -VK_PGUP SHIFT ^[[V -VK_PGUP LEFT_CTRL ^[[W -VK_PGUP RIGHT_CTRL ^[[W -VK_PGDN ^[[U -VK_PGDN SHIFT ^[[U -VK_PGDN LEFT_CTRL ^[[X -VK_PGDN RIGHT_CTRL ^[[X -VK_END ^[[Y -VK_END SHIFT ^[[Y -VK_END LEFT_CTRL ^[[E -VK_END RIGHT_CTRL ^[[E -VK_HOME ^[[H -VK_HOME SHIFT ^[[H -VK_HOME LEFT_CTRL ^[[F -VK_HOME RIGHT_CTRL ^[[F -VK_LEFT ^[[D -VK_LEFT SHIFT ^[[D -VK_LEFT LEFT_CTRL ^[[K -VK_LEFT RIGHT_CTRL ^[[K -VK_UP ^[[A -VK_UP SHIFT ^[[A -VK_UP LEFT_CTRL ^[[I -VK_UP RIGHT_CTRL ^[[I -VK_RIGHT ^[[C -VK_RIGHT SHIFT ^[[C -VK_RIGHT LEFT_CTRL ^[[L -VK_RIGHT RIGHT_CTRL ^[[L -VK_DOWN ^[[B -VK_DOWN SHIFT ^[[B -VK_DOWN LEFT_CTRL ^[[J -VK_DOWN RIGHT_CTRL ^[[J -VK_INSERT ^[[@ -VK_INSERT SHIFT ^[[T -VK_INSERT LEFT_CTRL ^[[T -VK_INSERT RIGHT_CTRL ^[[T -VK_DELETE \127 -VK_DELETE SHIFT ^[[S -VK_DELETE LEFT_CTRL ^[[S -VK_DELETE RIGHT_CTRL ^[[S -VK_PGUP LEFT_ALT ^[[v -VK_PGUP RIGHT_ALT ^[[v -VK_PGDN LEFT_ALT ^[[u -VK_PGDN RIGHT_ALT ^[[u -VK_END LEFT_ALT ^[[y -VK_END RIGHT_ALT ^[[y -VK_HOME LEFT_ALT ^[[h -VK_HOME RIGHT_ALT ^[[h -VK_LEFT LEFT_ALT ^[[d -VK_LEFT RIGHT_ALT ^[[d -VK_UP LEFT_ALT ^[[a -VK_UP RIGHT_ALT ^[[a -VK_RIGHT LEFT_ALT ^[[c -VK_RIGHT RIGHT_ALT ^[[c -VK_DOWN LEFT_ALT ^[[b -VK_DOWN RIGHT_ALT ^[[b -VK_INSERT LEFT_ALT ^[[t -VK_INSERT RIGHT_ALT ^[[t -VK_DELETE LEFT_ALT ^[[s -VK_DELETE RIGHT_ALT ^[[s -VK_0 LEFT_ALT ^[N0 -VK_1 LEFT_ALT ^[N1 -VK_2 LEFT_ALT ^[N2 -VK_3 LEFT_ALT ^[N3 -VK_4 LEFT_ALT ^[N4 -VK_5 LEFT_ALT ^[N5 -VK_6 LEFT_ALT ^[N6 -VK_7 LEFT_ALT ^[N7 -VK_8 LEFT_ALT ^[N8 -VK_9 LEFT_ALT ^[N9 -VK_0 RIGHT_ALT ^[N0 -VK_1 RIGHT_ALT ^[N1 -VK_2 RIGHT_ALT ^[N2 -VK_3 RIGHT_ALT ^[N3 -VK_4 RIGHT_ALT ^[N4 -VK_5 RIGHT_ALT ^[N5 -VK_6 RIGHT_ALT ^[N6 -VK_7 RIGHT_ALT ^[N7 -VK_8 RIGHT_ALT ^[N8 -VK_9 RIGHT_ALT ^[N9 -VK_A LEFT_ALT ^[NA -VK_B LEFT_ALT ^[NB -VK_C LEFT_ALT ^[NC -VK_D LEFT_ALT ^[ND -VK_E LEFT_ALT ^[NE -VK_F LEFT_ALT ^[NF -VK_G LEFT_ALT ^[NG -VK_H LEFT_ALT ^[NH -VK_I LEFT_ALT ^[NI -VK_J LEFT_ALT ^[NJ -VK_K LEFT_ALT ^[NK -VK_L LEFT_ALT ^[NL -VK_M LEFT_ALT ^[NM -VK_M LEFT_ALT ^[NN -VK_O LEFT_ALT ^[NO -VK_P LEFT_ALT ^[NP -VK_Q LEFT_ALT ^[NQ -VK_R LEFT_ALT ^[NR -VK_S LEFT_ALT ^[NS -VK_T LEFT_ALT ^[NT -VK_U LEFT_ALT ^[NU -VK_V LEFT_ALT ^[NV -VK_W LEFT_ALT ^[NW -VK_X LEFT_ALT ^[NX -VK_Y LEFT_ALT ^[NY -VK_Z LEFT_ALT ^[NZ -VK_A RIGHT_ALT ^[NA -VK_B RIGHT_ALT ^[NB -VK_C RIGHT_ALT ^[NC -VK_D RIGHT_ALT ^[ND -VK_E RIGHT_ALT ^[NE -VK_F RIGHT_ALT ^[NF -VK_G RIGHT_ALT ^[NG -VK_H RIGHT_ALT ^[NH -VK_I RIGHT_ALT ^[NI -VK_J RIGHT_ALT ^[NJ -VK_K RIGHT_ALT ^[NK -VK_L RIGHT_ALT ^[NL -VK_M RIGHT_ALT ^[NM -VK_M RIGHT_ALT ^[NN -VK_O RIGHT_ALT ^[NO -VK_P RIGHT_ALT ^[NP -VK_Q RIGHT_ALT ^[NQ -VK_R RIGHT_ALT ^[NR -VK_S RIGHT_ALT ^[NS -VK_T RIGHT_ALT ^[NT -VK_U RIGHT_ALT ^[NU -VK_V RIGHT_ALT ^[NV -VK_W RIGHT_ALT ^[NW -VK_X RIGHT_ALT ^[NX -VK_Y RIGHT_ALT ^[NY -VK_Z RIGHT_ALT ^[NZ -VK_NUMPAD0 LEFT_CTRL ^[[T -VK_NUMPAD0 RIGHT_CTRL ^[[T -VK_NUMPAD1 LEFT_CTRL ^[[E -VK_NUMPAD1 RIGHT_CTRL ^[[E -VK_NUMPAD2 LEFT_CTRL ^[[J -VK_NUMPAD2 RIGHT_CTRL ^[[J -VK_NUMPAD3 LEFT_CTRL ^[[X -VK_NUMPAD3 RIGHT_CTRL ^[[X -VK_NUMPAD4 LEFT_CTRL ^[[K -VK_NUMPAD4 RIGHT_CTRL ^[[K -VK_NUMPAD5 LEFT_CTRL ^[[G -VK_NUMPAD5 RIGHT_CTRL ^[[G -VK_NUMPAD6 LEFT_CTRL ^[[L -VK_NUMPAD6 RIGHT_CTRL ^[[L -VK_NUMPAD7 LEFT_CTRL ^[[F -VK_NUMPAD7 RIGHT_CTRL ^[[F -VK_NUMPAD8 LEFT_CTRL ^[[I -VK_NUMPAD8 RIGHT_CTRL ^[[I -VK_NUMPAD9 LEFT_CTRL ^[[W -VK_NUMPAD9 RIGHT_CTRL ^[[W -VK_MULTIPLY LEFT_CTRL ^[[Q -VK_MULTIPLY RIGHT_CTRL ^[[Q -VK_ADD LEFT_CTRL ^[[M -VK_ADD RIGHT_CTRL ^[[M -VK_SEPARATOR SHIFT ^[[R -VK_SEPARATOR LEFT_CTRL ^J -VK_SEPARATOR RIGHT_CTRL ^J -VK_SUBTRACT LEFT_CTRL ^[[N -VK_SUBTRACT RIGHT_CTRL ^[[N -VK_DECIMAL LEFT_CTRL ^[[S -VK_DECIMAL RIGHT_CTRL ^[[S -VK_DIVIDE LEFT_CTRL ^[[P -VK_DIVIDE RIGHT_CTRL ^[[P -VK_NUMPAD0 LEFT_ALT ^X -VK_NUMPAD0 RIGHT_ALT ^X -VK_NUMPAD1 LEFT_ALT ^E -VK_NUMPAD1 RIGHT_ALT ^E -VK_NUMPAD2 LEFT_ALT ^X/ -VK_NUMPAD2 RIGHT_ALT ^X/ -VK_NUMPAD3 LEFT_ALT ^V -VK_NUMPAD3 RIGHT_ALT ^V -VK_NUMPAD4 LEFT_ALT ^X^F -VK_NUMPAD4 RIGHT_ALT ^X^F -VK_NUMPAD5 LEFT_ALT ^[[g -VK_NUMPAD5 RIGHT_ALT ^[[g -VK_NUMPAD6 LEFT_ALT ^X^Y -VK_NUMPAD6 RIGHT_ALT ^X^Y -VK_NUMPAD7 LEFT_ALT ^A -VK_NUMPAD7 RIGHT_ALT ^A -VK_NUMPAD8 LEFT_ALT ^X_ -VK_NUMPAD8 RIGHT_ALT ^X_ -VK_NUMPAD9 LEFT_ALT ^[v -VK_NUMPAD9 RIGHT_ALT ^[v -VK_MULTIPLY LEFT_ALT ^[[q -VK_MULTIPLY RIGHT_ALT ^[[q -VK_ADD LEFT_ALT ^[[m -VK_ADD RIGHT_ALT ^[[m -VK_SEPARATOR LEFT_ALT ^[[r -VK_SEPARATOR RIGHT_ALT ^[[r -VK_SUBTRACT LEFT_ALT ^[[n -VK_SUBTRACT RIGHT_ALT ^[[n -VK_DECIMAL LEFT_ALT ^X^C -VK_DECIMAL RIGHT_ALT ^X^C -VK_DIVIDE LEFT_ALT ^[[p -VK_DIVIDE RIGHT_ALT ^[[p -VK_F1 ^[OP -VK_F1 SHIFT ^[Op -VK_F1 LEFT_CTRL ^[Ob -VK_F1 RIGHT_CTRL ^[Ob -VK_F2 ^[OQ -VK_F2 SHIFT ^[Oq -VK_F2 LEFT_CTRL ^[Oc -VK_F2 RIGHT_CTRL ^[Oc -VK_F3 ^[OR -VK_F3 SHIFT ^[Or -VK_F3 LEFT_CTRL ^[Od -VK_F3 RIGHT_CTRL ^[Od -VK_F4 ^[OS -VK_F4 SHIFT ^[Os -VK_F4 LEFT_CTRL ^[Oe -VK_F4 RIGHT_CTRL ^[Oe -VK_F5 ^[OT -VK_F5 SHIFT ^[Ot -VK_F5 LEFT_CTRL ^[Of -VK_F5 RIGHT_CTRL ^[Of -VK_F6 ^[OU -VK_F6 SHIFT ^[Ou -VK_F6 LEFT_CTRL ^[Og -VK_F6 RIGHT_CTRL ^[Og -VK_F7 ^[OV -VK_F7 SHIFT ^[Ov -VK_F7 LEFT_CTRL ^[Oh -VK_F7 RIGHT_CTRL ^[Oh -VK_F8 ^[OW -VK_F8 SHIFT ^[Ow -VK_F8 LEFT_CTRL ^[Oi -VK_F8 RIGHT_CTRL ^[Oi -VK_F9 ^[OX -VK_F9 SHIFT ^[Ox -VK_F9 LEFT_CTRL ^[Oj -VK_F9 RIGHT_CTRL ^[Oj -VK_F10 ^[OY -VK_F10 SHIFT ^[Oy -VK_F10 LEFT_CTRL ^[Ok -VK_F10 RIGHT_CTRL ^[Ok -VK_F11 ^[OZ -VK_F11 SHIFT ^[Oz -VK_F11 LEFT_CTRL ^[Ol -VK_F11 RIGHT_CTRL ^[Ol -VK_F12 ^[OA -VK_F12 SHIFT ^[Oa -VK_F12 LEFT_CTRL ^[Om -VK_F12 RIGHT_CTRL ^[Om -VK_F1 LEFT_ALT ^[O1 -VK_F1 RIGHT_ALT ^[O1 -VK_F2 LEFT_ALT ^[O2 -VK_F2 RIGHT_ALT ^[O2 -VK_F3 LEFT_ALT ^[O3 -VK_F3 RIGHT_ALT ^[O3 -VK_F4 LEFT_ALT ^[O4 -VK_F4 RIGHT_ALT ^[O4 -VK_F5 LEFT_ALT ^[O5 -VK_F5 RIGHT_ALT ^[O5 -VK_F6 LEFT_ALT ^[O6 -VK_F6 RIGHT_ALT ^[O6 -VK_F7 LEFT_ALT ^[O7 -VK_F7 RIGHT_ALT ^[O7 -VK_F8 LEFT_ALT ^[O8 -VK_F8 RIGHT_ALT ^[O8 -VK_F9 LEFT_ALT ^[O9 -VK_F9 RIGHT_ALT ^[O9 -VK_F10 LEFT_ALT ^[O0 -VK_F10 RIGHT_ALT ^[O0 -VK_F11 LEFT_ALT ^[O: -VK_F11 RIGHT_ALT ^[O: -VK_F12 LEFT_ALT ^[O; -VK_F12 RIGHT_ALT ^[O; - -[END keymap] - - -[keymap at386st] -; -; AT386 standard keys -; - -VK_F1 ^[OP -VK_F2 ^[OQ -VK_F3 ^[OR -VK_F4 ^[OS -VK_F5 ^[OT -VK_F6 ^[OU -VK_F7 ^[OV -VK_F8 ^[OW -VK_F9 ^[OX -VK_F10 ^[OY -VK_F11 ^[[W -VK_F12 ^[[X -VK_SCROLL \017 -VK_PAUSE \019 -; -VK_INSERT ^[[@ -VK_DELETE \004 -; -VK_LEFT ^[[D -VK_UP ^[[A -VK_RIGHT ^[[C -VK_DOWN ^[[B -; -VK_HOME ^[[H -VK_PGUP ^[[V -VK_PGDN ^[[U -VK_END ^[[Y -; -VK_TAB \009 -VK_TAB SHIFT ^[[Z -VK_ESCAPE ^[ - -[END keymap] - -;**************************************************************************** -;**************************************************************************** -;*** Ukranian keyboard *** -;**************************************************************************** -;**************************************************************************** -[keymap koi8u] - -; I prefer this -VK_2 SHIFT " -VK_2 CAPSLOCK+SHIFT " -VK_4 SHIFT ; -VK_4 CAPSLOCK+SHIFT ; -VK_5 SHIFT % -VK_5 CAPSLOCK+SHIFT % -VK_6 SHIFT : -VK_6 CAPSLOCK+SHIFT : -VK_7 SHIFT ? -VK_7 CAPSLOCK+SHIFT ? -VK_/ . -VK_/ SHIFT , -VK_/ CAPSLOCK . -VK_/ CAPSLOCK+SHIFT , - -; next will be similar to std - -; \xE1 CYRILLIC CAPITAL LETTER A -; \xC1 CYRILLIC SMALL LETTER A -VK_F \xC1 -VK_F SHIFT \xE1 -VK_F CAPSLOCK \xE1 -VK_F CAPSLOCK+SHIFT \xC1 - -; \xE2 CYRILLIC CAPITAL LETTER BE -; \xC2 CYRILLIC SMALL LETTER BE -VK_, \xc2 -VK_, SHIFT \xe2 -VK_, CAPSLOCK \xe2 -VK_, CAPSLOCK+SHIFT \xc2 - -; \xB6 CYRILLIC CAPITAL LETTER BELORUSSIAN-UKRAINIAN I -; \xA6 CYRILLIC SMALL LETTER BELORUSSIAN-UKRAINIAN I -VK_S \xa6 -VK_S SHIFT \xb6 -VK_S CAPSLOCK \xb6 -VK_S CAPSLOCK+SHIFT \xa6 - -; \xFE CYRILLIC CAPITAL LETTER CHE -; \xDE CYRILLIC SMALL LETTER CHE -VK_X \xde -VK_X SHIFT \xfe -VK_X CAPSLOCK \xfe -VK_X CAPSLOCK+SHIFT \xde - -; \xE4 CYRILLIC CAPITAL LETTER DE -; \xC4 CYRILLIC SMALL LETTER DE -VK_L \xc4 -VK_L SHIFT \xe4 -VK_L CAPSLOCK \xe4 -VK_L CAPSLOCK+SHIFT \xc4 - -; \xE6 CYRILLIC CAPITAL LETTER EF -; \xC6 CYRILLIC SMALL LETTER EF -VK_A \xc6 -VK_A SHIFT \xe6 -VK_A CAPSLOCK \xe6 -VK_A CAPSLOCK+SHIFT \xc6 - -; \xEC CYRILLIC CAPITAL LETTER EL -; \xCC CYRILLIC SMALL LETTER EL -VK_K \xcc -VK_K SHIFT \xec -VK_K CAPSLOCK \xec -VK_K CAPSLOCK+SHIFT \xcc - -; \xED CYRILLIC CAPITAL LETTER EM -; \xCD CYRILLIC SMALL LETTER EM -VK_V \xcd -VK_V SHIFT \xed -VK_V CAPSLOCK \xed -VK_V CAPSLOCK+SHIFT \xcd - -; \xEE CYRILLIC CAPITAL LETTER EN -; \xCE CYRILLIC SMALL LETTER EN -VK_Y \xce -VK_Y SHIFT \xee -VK_Y CAPSLOCK \xee -VK_Y CAPSLOCK+SHIFT \xce - -; \xF2 CYRILLIC CAPITAL LETTER ER -; \xD2 CYRILLIC SMALL LETTER ER -VK_H \xd2 -VK_H SHIFT \xf2 -VK_H CAPSLOCK \xf2 -VK_H CAPSLOCK+SHIFT \xd2 - -; \xF3 CYRILLIC CAPITAL LETTER ES -; \xD3 CYRILLIC SMALL LETTER ES -VK_C \xd3 -VK_C SHIFT \xf3 -VK_C CAPSLOCK \xf3 -VK_C CAPSLOCK+SHIFT \xd3 - -; \xE7 CYRILLIC CAPITAL LETTER GE -; \xC7 CYRILLIC SMALL LETTER GE -VK_U \xc7 -VK_U SHIFT \xe7 -VK_U CAPSLOCK \xe7 -VK_U CAPSLOCK+SHIFT \xc7 - -; \xF1 CYRILLIC CAPITAL LETTER IA -; \xD1 CYRILLIC SMALL LETTER IA -VK_Z \xd1 -VK_Z SHIFT \xf1 -VK_Z CAPSLOCK \xf1 -VK_Z CAPSLOCK+SHIFT \xd1 - -; \xE5 CYRILLIC CAPITAL LETTER IE -; \xC5 CYRILLIC SMALL LETTER IE -VK_T \xc5 -VK_T SHIFT \xe5 -VK_T CAPSLOCK \xe5 -VK_T CAPSLOCK+SHIFT \xc5 - -; \xE9 CYRILLIC CAPITAL LETTER II -; \xC9 CYRILLIC SMALL LETTER II -VK_B \xc9 -VK_B SHIFT \xe9 -VK_B CAPSLOCK \xe9 -VK_B CAPSLOCK+SHIFT \xc9 - -; \xE0 CYRILLIC CAPITAL LETTER IU -; \xC0 CYRILLIC SMALL LETTER IU -VK_. \xc0 -VK_. SHIFT \xe0 -VK_. CAPSLOCK \xe0 -VK_. CAPSLOCK+SHIFT \xc0 - -; \xEB CYRILLIC CAPITAL LETTER KA -; \xCB CYRILLIC SMALL LETTER KA -VK_R \xcb -VK_R SHIFT \xeb -VK_R CAPSLOCK \xeb -VK_R CAPSLOCK+SHIFT \xcb - -; \xE8 CYRILLIC CAPITAL LETTER KHA -; \xC8 CYRILLIC SMALL LETTER KHA -VK_[ \xc8 -VK_[ SHIFT \xe8 -VK_[ CAPSLOCK \xE8 -VK_[ CAPSLOCK+SHIFT \xC8 - -; \xEF CYRILLIC CAPITAL LETTER O -; \xCF CYRILLIC SMALL LETTER O -VK_J \xcf -VK_J SHIFT \xef -VK_J CAPSLOCK \xef -VK_J CAPSLOCK+SHIFT \xcf - -; \xF0 CYRILLIC CAPITAL LETTER PE -; \xD0 CYRILLIC SMALL LETTER PE -VK_G \xd0 -VK_G SHIFT \xf0 -VK_G CAPSLOCK \xf0 -VK_G CAPSLOCK+SHIFT \xd0 - -; \xFB CYRILLIC CAPITAL LETTER SHA -; \xDB CYRILLIC SMALL LETTER SHA -VK_I \xdb -VK_I SHIFT \xfb -VK_I CAPSLOCK \xfb -VK_I CAPSLOCK+SHIFT \xdb - -; \xFD CYRILLIC CAPITAL LETTER SHCHA -; \xDD CYRILLIC SMALL LETTER SHCHA -VK_O \xdd -VK_O SHIFT \xfd -VK_O CAPSLOCK \xfd -VK_O CAPSLOCK+SHIFT \xdd - -; \xEA CYRILLIC CAPITAL LETTER SHORT II -; \xCA CYRILLIC SMALL LETTER SHORT II -VK_Q \xca -VK_Q SHIFT \xea -VK_Q CAPSLOCK \xea -VK_Q CAPSLOCK+SHIFT \xca - -; \xF8 CYRILLIC CAPITAL LETTER SOFT SIGN -; \xD8 CYRILLIC SMALL LETTER SOFT SIGN -VK_M \xd8 -VK_M SHIFT \xf8 -VK_M CAPSLOCK \xf8 -VK_M CAPSLOCK+SHIFT \xd8 - -; \xF4 CYRILLIC CAPITAL LETTER TE -; \xD4 CYRILLIC SMALL LETTER TE -VK_N \xd4 -VK_N SHIFT \xf4 -VK_N CAPSLOCK \xf4 -VK_N CAPSLOCK+SHIFT \xd4 - -; \xE3 CYRILLIC CAPITAL LETTER TSE -; \xC3 CYRILLIC SMALL LETTER TSE -VK_W \xc3 -VK_W SHIFT \xe3 -VK_W CAPSLOCK \xe3 -VK_W CAPSLOCK+SHIFT \xc3 - -; \xF5 CYRILLIC CAPITAL LETTER U -; \xD5 CYRILLIC SMALL LETTER U -VK_E \xd5 -VK_E SHIFT \xf5 -VK_E CAPSLOCK \xf5 -VK_E CAPSLOCK+SHIFT \xd5 - -; \xBD CYRILLIC CAPITAL LETTER UKRAINIAN GHE (UPTURN) -; \xAD CYRILLIC SMALL LETTER UKRAINIAN GHE (UPTURN) -; not realized because not too many words use it, use GHE for it - -; \xB4 CYRILLIC CAPITAL LETTER UKRAINIAN IE -; \xA4 CYRILLIC SMALL LETTER UKRAINIAN IE -VK_' \xa4 -VK_' SHIFT \xb4 -VK_' CAPSLOCK \xb4 -VK_' CAPSLOCK+SHIFT \xa4 - -; \xF7 CYRILLIC CAPITAL LETTER VE -; \xD7 CYRILLIC SMALL LETTER VE -VK_D \xd7 -VK_D SHIFT \xf7 -VK_D CAPSLOCK \xf7 -VK_D CAPSLOCK+SHIFT \xd7 - -; \xB7 CYRILLIC CAPITAL LETTER YI (UKRAINIAN) -; \xA7 CYRILLIC SMALL LETTER YI (UKRAINIAN) -VK_] \xa7 -VK_] SHIFT \xb7 -VK_] CAPSLOCK \xb7 -VK_] CAPSLOCK+SHIFT \xa7 - -; \xFA CYRILLIC CAPITAL LETTER ZE -; \xDA CYRILLIC SMALL LETTER ZE -VK_P \xda -VK_P SHIFT \xfa -VK_P CAPSLOCK \xfa -VK_P CAPSLOCK+SHIFT \xda - -; \xF6 CYRILLIC CAPITAL LETTER ZHE -; \xD6 CYRILLIC SMALL LETTER ZHE -VK_; \xd6 -VK_; SHIFT \xf6 -VK_; CAPSLOCK \xf6 -VK_; CAPSLOCK+SHIFT \xd6 - -[END keymap] // koi8u - -[keymap koi8r] -;**************************************************************************** -;**************************************************************************** -;*** Russian keyboard. *** -;*** *** -;*** there are only differents from koi8u, so use *** -;*** it as 'keymap koi8u + koi8r' *** -;**************************************************************************** -;**************************************************************************** - -; \xFF CYRILLIC CAPITAL LETTER HARD SIGN -; \xDF CYRILLIC SMALL LETTER HARD SIGN -VK_] \xdf -VK_] SHIFT \xff -VK_] CAPSLOCK \xff -VK_] CAPSLOCK+SHIFT \xdf - -; \xB3 CYRILLIC CAPITAL LETTER IO -; \xA3 CYRILLIC SMALL LETTER IO -VK_` \xa3 -VK_` SHIFT \xb3 -VK_` CAPSLOCK \xb3 -VK_` CAPSLOCK+SHIFT \xa3 - -; \xFC CYRILLIC CAPITAL LETTER REVERSED E -; \xDC CYRILLIC SMALL LETTER REVERSED E -VK_' \xdc -VK_' SHIFT \xfc -VK_' CAPSLOCK \xfc -VK_' CAPSLOCK+SHIFT \xdc - -; \xF9 CYRILLIC CAPITAL LETTER YERI -; \xD9 CYRILLIC SMALL LETTER YERI -VK_S \xd9 -VK_S SHIFT \xf9 -VK_S CAPSLOCK \xf9 -VK_S CAPSLOCK+SHIFT \xd9 - -[END keymap] // koi8r - -;**************************************************************************** -;**************************************************************************** -;*** Russian keyboard IBM PC-866 *** -;*** *** -;*** Dmitry Lapenkov *** -;**************************************************************************** -;**************************************************************************** -[keymap ibm866] - -VK_` ) -VK_` SHIFT ( -VK_` CAPSLOCK ( -VK_` CAPSLOCK+SHIFT ) -VK_2 SHIFT " -VK_2 CAPSLOCK+SHIFT " -VK_3 SHIFT / -VK_3 CAPSLOCK+SHIFT / -VK_4 SHIFT \xfc -VK_4 CAPSLOCK+SHIFT \xfc -VK_5 SHIFT : -VK_5 CAPSLOCK+SHIFT : -VK_6 SHIFT , -VK_6 CAPSLOCK+SHIFT , -VK_7 SHIFT . -VK_7 CAPSLOCK+SHIFT . -VK_8 SHIFT ; -VK_8 CAPSLOCK+SHIFT ; -VK_9 SHIFT ? -VK_9 CAPSLOCK+SHIFT ? -VK_0 SHIFT % -VK_0 CAPSLOCK+SHIFT % - -; 128 CYRILLIC CAPITAL LETTER A -; 160 CYRILLIC SMALL LETTER A -VK_F \160 -VK_F SHIFT \128 -VK_F CAPSLOCK \128 -VK_F CAPSLOCK+SHIFT \160 - -; 129 CYRILLIC CAPITAL LETTER BE -; 161 CYRILLIC SMALL LETTER BE -VK_, \161 -VK_, SHIFT \129 -VK_, CAPSLOCK \129 -VK_, CAPSLOCK+SHIFT \161 - -; 240 CYRILLIC CAPITAL LETTER SHORT YO -; 241 CYRILLIC SMALL LETTER SHORT YO -VK_/ \241 -VK_/ SHIFT \240 -VK_/ CAPSLOCK \240 -VK_/ CAPSLOCK+SHIFT \241 - -; 157 CYRILLIC CAPITAL LETTER REVERSED E -; 237 CYRILLIC SMALL LETTER REVERSED E -VK_' \237 -VK_' SHIFT \157 -VK_' CAPSLOCK \157 -VK_' CAPSLOCK+SHIFT \237 - -; 155 CYRILLIC CAPITAL LETTER YERI -; 235 CYRILLIC SMALL LETTER YERI -VK_S \235 -VK_S SHIFT \155 -VK_S CAPSLOCK \155 -VK_S CAPSLOCK+SHIFT \235 - -; 151 CYRILLIC CAPITAL LETTER CHE -; 231 CYRILLIC SMALL LETTER CHE -VK_X \231 -VK_X SHIFT \151 -VK_X CAPSLOCK \151 -VK_X CAPSLOCK+SHIFT \231 - -; 132 CYRILLIC CAPITAL LETTER DE -; 164 CYRILLIC SMALL LETTER DE -VK_L \164 -VK_L SHIFT \132 -VK_L CAPSLOCK \132 -VK_L CAPSLOCK+SHIFT \164 - -; 148 CYRILLIC CAPITAL LETTER EF -; 228 CYRILLIC SMALL LETTER EF -VK_A \228 -VK_A SHIFT \148 -VK_A CAPSLOCK \148 -VK_A CAPSLOCK+SHIFT \228 - -; 139 CYRILLIC CAPITAL LETTER EL -; 171 CYRILLIC SMALL LETTER EL -VK_K \171 -VK_K SHIFT \139 -VK_K CAPSLOCK \139 -VK_K CAPSLOCK+SHIFT \171 - -; 140 CYRILLIC CAPITAL LETTER EM -; 172 CYRILLIC SMALL LETTER EM -VK_V \172 -VK_V SHIFT \140 -VK_V CAPSLOCK \140 -VK_V CAPSLOCK+SHIFT \172 - -; 141 CYRILLIC CAPITAL LETTER EN -; 173 CYRILLIC SMALL LETTER EN -VK_Y \173 -VK_Y SHIFT \141 -VK_Y CAPSLOCK \141 -VK_Y CAPSLOCK+SHIFT \173 - -; 144 CYRILLIC CAPITAL LETTER ER -; 224 CYRILLIC SMALL LETTER ER -VK_H \224 -VK_H SHIFT \144 -VK_H CAPSLOCK \144 -VK_H CAPSLOCK+SHIFT \224 - -; 145 CYRILLIC CAPITAL LETTER ES -; 225 CYRILLIC SMALL LETTER ES -VK_C \225 -VK_C SHIFT \145 -VK_C CAPSLOCK \145 -VK_C CAPSLOCK+SHIFT \225 - -; 131 CYRILLIC CAPITAL LETTER GE -; 163 CYRILLIC SMALL LETTER GE -VK_U \163 -VK_U SHIFT \131 -VK_U CAPSLOCK \131 -VK_U CAPSLOCK+SHIFT \163 - -; 159 CYRILLIC CAPITAL LETTER YA -; 239 CYRILLIC SMALL LETTER YA -VK_Z \239 -VK_Z SHIFT \159 -VK_Z CAPSLOCK \159 -VK_Z CAPSLOCK+SHIFT \239 - -; 133 CYRILLIC CAPITAL LETTER IE -; 165 CYRILLIC SMALL LETTER IE -VK_T \165 -VK_T SHIFT \133 -VK_T CAPSLOCK \133 -VK_T CAPSLOCK+SHIFT \165 - -; 136 CYRILLIC CAPITAL LETTER II -; 168 CYRILLIC SMALL LETTER II -VK_B \168 -VK_B SHIFT \136 -VK_B CAPSLOCK \136 -VK_B CAPSLOCK+SHIFT \168 - -; 158 CYRILLIC CAPITAL LETTER YU -; 238 CYRILLIC SMALL LETTER YU -VK_. \238 -VK_. SHIFT \158 -VK_. CAPSLOCK \158 -VK_. CAPSLOCK+SHIFT \238 - -; 138 CYRILLIC CAPITAL LETTER KA -; 170 CYRILLIC SMALL LETTER KA -VK_R \170 -VK_R SHIFT \138 -VK_R CAPSLOCK \138 -VK_R CAPSLOCK+SHIFT \170 - -; 149 CYRILLIC CAPITAL LETTER KHA -; 229 CYRILLIC SMALL LETTER KHA -VK_[ \229 -VK_[ SHIFT \149 -VK_[ CAPSLOCK \149 -VK_[ CAPSLOCK+SHIFT \229 - -; 142 CYRILLIC CAPITAL LETTER O -; 174 CYRILLIC SMALL LETTER O -VK_J \174 -VK_J SHIFT \142 -VK_J CAPSLOCK \142 -VK_J CAPSLOCK+SHIFT \174 - -; 143 CYRILLIC CAPITAL LETTER PE -; 175 CYRILLIC SMALL LETTER PE -VK_G \175 -VK_G SHIFT \143 -VK_G CAPSLOCK \143 -VK_G CAPSLOCK+SHIFT \175 - -; 152 CYRILLIC CAPITAL LETTER SHA -; 232 CYRILLIC SMALL LETTER SHA -VK_I \232 -VK_I SHIFT \152 -VK_I CAPSLOCK \152 -VK_I CAPSLOCK+SHIFT \232 - -; 153 CYRILLIC CAPITAL LETTER SHCHA -; 233 CYRILLIC SMALL LETTER SHCHA -VK_O \233 -VK_O SHIFT \153 -VK_O CAPSLOCK \153 -VK_O CAPSLOCK+SHIFT \233 - -; 137 CYRILLIC CAPITAL LETTER SHORT II -; 169 CYRILLIC SMALL LETTER SHORT II -VK_Q \169 -VK_Q SHIFT \137 -VK_Q CAPSLOCK \137 -VK_Q CAPSLOCK+SHIFT \169 - -; 156 CYRILLIC CAPITAL LETTER SOFT SIGN -; 236 CYRILLIC SMALL LETTER SOFT SIGN -VK_M \236 -VK_M SHIFT \156 -VK_M CAPSLOCK \156 -VK_M CAPSLOCK+SHIFT \236 - -; 146 CYRILLIC CAPITAL LETTER TE -; 226 CYRILLIC SMALL LETTER TE -VK_N \226 -VK_N SHIFT \146 -VK_N CAPSLOCK \146 -VK_N CAPSLOCK+SHIFT \226 - -; 150 CYRILLIC CAPITAL LETTER TSE -; \230 CYRILLIC SMALL LETTER TSE -VK_W \230 -VK_W SHIFT \150 -VK_W CAPSLOCK \150 -VK_W CAPSLOCK+SHIFT \230 - -; 147 CYRILLIC CAPITAL LETTER U -; 227 CYRILLIC SMALL LETTER U -VK_E \227 -VK_E SHIFT \147 -VK_E CAPSLOCK \147 -VK_E CAPSLOCK+SHIFT \227 - -; 130 CYRILLIC CAPITAL LETTER VE -; 162 CYRILLIC SMALL LETTER VE -VK_D \162 -VK_D SHIFT \130 -VK_D CAPSLOCK \130 -VK_D CAPSLOCK+SHIFT \162 - -; 154 CYRILLIC CAPITAL LETTER HARD SIGN -; 234 CYRILLIC SMALL LETTER HARD SIGN -VK_] \234 -VK_] SHIFT \154 -VK_] CAPSLOCK \154 -VK_] CAPSLOCK+SHIFT \234 - -; 135 CYRILLIC CAPITAL LETTER ZE -; 167 CYRILLIC SMALL LETTER ZE -VK_P \167 -VK_P SHIFT \135 -VK_P CAPSLOCK \135 -VK_P CAPSLOCK+SHIFT \167 - -; 134 CYRILLIC CAPITAL LETTER ZHE -; 166 CYRILLIC SMALL LETTER ZHE -VK_; \166 -VK_; SHIFT \134 -VK_; CAPSLOCK \134 -VK_; CAPSLOCK+SHIFT \166 - -[END keymap] // ibm866 - -[keymap swedish] -; ae Swedish A with dots -VK_A \228 -VK_A SHIFT \196 -VK_A CAPSLOCK \196 -VK_A CAPSLOCK+SHIFT \228 - -; aa Swedish A with circle -VK_A RIGHT_ALT \229 -VK_A RIGHT_ALT+SHIFT \196 -VK_A RIGHT_ALT+CAPSLOCK \196 -VK_A RIGHT_ALT+CAPSLOCK+SHIFT \229 -VK_A LEFT_ALT \229 -VK_A LEFT_ALT+SHIFT \196 -VK_A LEFT_ALT+CAPSLOCK \196 -VK_A LEFT_ALT+CAPSLOCK+SHIFT \229 - -; oe (Swedish O with dots) -VK_O \246 -VK_O SHIFT \214 -VK_O CAPSLOCK \214 -VK_O CAPSLOCK+SHIFT \246 - -[END keymap] // swedish - -[keymap uk] -; The following entries are thanks to Kirschke Guido -; -VK_` " // dosen't work -VK_` SHIFT ! -VK_` RIGHT_ALT ] -; -VK_0 SHIFT = -VK_0 CAPSLOCK 0 -VK_0 CAPSLOCK+SHIFT = -; -VK_1 RIGHT_ALT Ý -VK_1 SHIFT + -VK_1 CAPSLOCK 1 -VK_1 CAPSLOCK+SHIFT + -; -VK_2 RIGHT_ALT @ -VK_2 SHIFT " -VK_2 CAPSLOCK 2 -VK_2 CAPSLOCK+SHIFT " -; -VK_3 RIGHT_ALT # -VK_3 SHIFT * -VK_3 CAPSLOCK 3 -VK_3 CAPSLOCK+SHIFT * -; -VK_4 SHIFT ‡ -VK_4 CAPSLOCK 4 -VK_4 CAPSLOCK+SHIFT ‡ // dosen't work -; -VK_5 SHIFT % -VK_5 CAPSLOCK 5 -VK_5 CAPSLOCK+SHIFT % -; -VK_6 RIGHT_ALT ª -VK_6 SHIFT & -VK_6 CAPSLOCK 6 -VK_6 CAPSLOCK+SHIFT & -; -VK_7 RIGHT_ALT | -VK_7 SHIFT / -VK_7 CAPSLOCK 7 -VK_7 CAPSLOCK+SHIFT / -; -VK_8 RIGHT_ALT › -VK_8 SHIFT ( -VK_8 CAPSLOCK 8 -VK_8 CAPSLOCK+SHIFT ( -; -VK_9 SHIFT ) -VK_9 CAPSLOCK 9 -VK_9 CAPSLOCK+SHIFT ) -VK_; CAPSLOCK š // dosen't work -VK_; CAPSLOCK+SHIFT E // dosen't work -VK_' CAPSLOCK+SHIFT ? -VK_, CAPSLOCK+SHIFT ; -VK_. CAPSLOCK+SHIFT : -VK_/ CAPSLOCK+SHIFT _ -[END keymap] - -[keymap german] - -;**************************************************************************** -;**************************************************************************** -;*** German keyboard. *** -;*** -;**************************************************************************** -;**************************************************************************** -; This keymap used on top the keyb gr driver / CP 850 - -VK_7 RIGHT_ALT { -VK_8 RIGHT_ALT [ -VK_9 RIGHT_ALT ] -VK_0 RIGHT_ALT } -VK_\ ^ -VK_6 SHIFT & -; ™ und ” -VK_` \148 -VK_` SHIFT \153 -; Gravis- /Akut-Akzent -VK_] \039 -VK_] SHIFT \096 - -[END keymap] // german - -;=================================================================== -; Czech keyboard definition for use with CP852 -; Add to your AUTOEXEC.BAT -; mode con codepage prepare=((852) C:\WINDOWS\COMMAND\ega.cpi) -; mode con codepage select=852 -; keyb cz,,C:\WINDOWS\COMMAND\keybrd2.sys -; -; This keyboard driver allows to change US/CZ keyboard by pressing -; CTRL+ALT+F1 / CTRL+ALT+F2 and is present in W9x installation. -; -; Jakub Sterba Mar-2000 Prague, Czech republic -;=================================================================== - -[keymap czech-cz] -VK_BACK \127 -VK_= \000 -VK_= SHIFT \000 -[END keymap] - -[keymap czech-en] -VK_BACK \127 -VK_= = -VK_= SHIFT \043 -[END keymap] - -;###################################################################### -; Spanish Keyborad Definition -; -; I started from ansi definition, and I had to comment several lines -; and add a few more. -;###################################################################### - -[keymap sp] - -;-- These lines are from original emulation - -VK_F1 ^[[M -VK_F2 ^[[N -VK_F3 ^[[O -VK_F4 ^[[P -VK_F5 ^[[Q -VK_F6 ^[[R -VK_F7 ^[[S -VK_F8 ^[[T -VK_F9 ^[[U -VK_F10 ^[[V -VK_F11 ^[[W -VK_F12 ^[[X - -;-- These lines were added : CAPSLOCK status is not relevant -;-- for Function Keys -; -;-- CAPSLOCK ON or OFF : every key must send same sequence -VK_F1 CAPSLOCK ^[[M -VK_F2 CAPSLOCK ^[[N -VK_F3 CAPSLOCK ^[[O -VK_F4 CAPSLOCK ^[[P -VK_F5 CAPSLOCK ^[[Q -VK_F6 CAPSLOCK ^[[R -VK_F7 CAPSLOCK ^[[S -VK_F8 CAPSLOCK ^[[T -VK_F9 CAPSLOCK ^[[U -VK_F10 CAPSLOCK ^[[V -VK_F11 CAPSLOCK ^[[W -VK_F12 CAPSLOCK ^[[X - -;-- These lines are from original emulation -VK_F1 SHIFT ^[[Y -VK_F2 SHIFT ^[[Z -VK_F3 SHIFT ^[[a -VK_F4 SHIFT ^[[b -VK_F5 SHIFT ^[[c -VK_F6 SHIFT ^[[d -VK_F7 SHIFT ^[[e -VK_F8 SHIFT ^[[f -VK_F9 SHIFT ^[[g -VK_F10 SHIFT ^[[h -VK_F11 SHIFT ^[[i -VK_F12 SHIFT ^[[j -VK_F1 RIGHT_CTRL ^[[k -VK_F2 RIGHT_CTRL ^[[l -VK_F3 RIGHT_CTRL ^[[m -VK_F4 RIGHT_CTRL ^[[n -VK_F5 RIGHT_CTRL ^[[o -VK_F6 RIGHT_CTRL ^[[p -VK_F7 RIGHT_CTRL ^[[q -VK_F8 RIGHT_CTRL ^[[r -VK_F9 RIGHT_CTRL ^[[s -VK_F10 RIGHT_CTRL ^[[t -VK_F11 RIGHT_CTRL ^[[y -VK_F12 RIGHT_CTRL ^[[v -VK_F1 LEFT_CTRL ^[[k -VK_F2 LEFT_CTRL ^[[l -VK_F3 LEFT_CTRL ^[[m -VK_F4 LEFT_CTRL ^[[n -VK_F5 LEFT_CTRL ^[[o -VK_F6 LEFT_CTRL ^[[p -VK_F7 LEFT_CTRL ^[[q -VK_F8 LEFT_CTRL ^[[r -VK_F9 LEFT_CTRL ^[[s -VK_F10 LEFT_CTRL ^[[t -VK_F11 LEFT_CTRL ^[[y -VK_F12 LEFT_CTRL ^[[v -; -; misc fuctions -; -; FIX ME!!! Some people have reported that these keys don't work. -VK_SCROLL \017 -VK_PAUSE \019 -VK_INSERT ^[[L -VK_DELETE ENHANCED \127 -VK_HOME ^[[H -VK_PGUP ^[[I -VK_PGDN ^[[G -VK_END ^[[F - -VK_INSERT CAPSLOCK ^[[L -VK_DELETE ENHANCED+CAPSLOCK \127 -VK_HOME CAPSLOCK ^[[H -VK_PGUP CAPSLOCK ^[[I -VK_PGDN CAPSLOCK ^[[G -VK_END CAPSLOCK ^[[F - -VK_INSERT SHIFT ^[[L -VK_DELETE SHIFT+ENHANCED \127 -VK_HOME SHIFT ^[[H -VK_PGUP SHIFT ^[[I -VK_PGDN SHIFT ^[[G -VK_END SHIFT ^[[F -; -; arrows -; -VK_LEFT ^[[D -VK_UP ^[[A -VK_RIGHT ^[[C -VK_DOWN ^[[B - -;-- These lines were added : CAPSLOCK status is not relevant -;-- for Function Keys -; -;-- CAPSLOCK ON or OFF : every key must send same sequence -VK_LEFT CAPSLOCK ^[[D -VK_UP CAPSLOCK ^[[A -VK_RIGHT CAPSLOCK ^[[C -VK_DOWN CAPSLOCK ^[[B - -;-- These lines are from original emulation -VK_LEFT SHIFT ^[[D -VK_UP SHIFT ^[[A -VK_RIGHT SHIFT ^[[C -VK_DOWN SHIFT ^[[B -; -; just in case !!! -; -VK_ESCAPE SHIFT \027 -VK_TAB \009 -VK_TAB SHIFT ^[[Z^[[Z -; -;--------------------------------------- -; Athens 30/03/97 10:55pm GMT+2 -; Correction for Win95 -; -VK_6 SHIFT \094 - -;-- These lines were commented for <¥> support -;VK_` \164 -;VK_` SHIFT \164 - - -VK_0 CAPSLOCK 0 -VK_1 CAPSLOCK 1 -VK_2 CAPSLOCK 2 -VK_3 CAPSLOCK 3 -VK_4 CAPSLOCK 4 -VK_5 CAPSLOCK 5 -VK_6 CAPSLOCK 6 -VK_7 CAPSLOCK 7 -VK_8 CAPSLOCK 8 -VK_9 CAPSLOCK 9 -VK_ESCAPE CAPSLOCK \027 - -;-- This line was commented for <¥> support -;VK_` CAPSLOCK \164 - -VK_= CAPSLOCK + -VK_- CAPSLOCK ­ -VK_\ CAPSLOCK \ -VK_[ CAPSLOCK [ -VK_] CAPSLOCK ] -VK_; CAPSLOCK ` -VK_' CAPSLOCK ' -VK_, CAPSLOCK , -VK_. CAPSLOCK . -VK_/ CAPSLOCK / -VK_0 CAPSLOCK+SHIFT = -VK_1 CAPSLOCK+SHIFT ! -VK_2 CAPSLOCK+SHIFT " -VK_3 CAPSLOCK+SHIFT ú -VK_4 CAPSLOCK+SHIFT $ -VK_5 CAPSLOCK+SHIFT % -VK_6 CAPSLOCK+SHIFT & -VK_7 CAPSLOCK+SHIFT / -VK_8 CAPSLOCK+SHIFT ( -VK_9 CAPSLOCK+SHIFT ) -VK_ESCAPE CAPSLOCK+SHIFT \027 - -;-- This line was commented for <¥> support -;VK_` CAPSLOCK+SHIFT \164 - -VK_= CAPSLOCK+SHIFT ¨ -VK_- CAPSLOCK+SHIFT ¨ -VK_\ CAPSLOCK+SHIFT | -VK_[ CAPSLOCK+SHIFT ? -VK_] CAPSLOCK+SHIFT ¨ -VK_; CAPSLOCK+SHIFT ^ -VK_' CAPSLOCK+SHIFT " -VK_, CAPSLOCK+SHIFT < -VK_. CAPSLOCK+SHIFT > -VK_/ CAPSLOCK+SHIFT ? -; -; -;--------------------------------------- -; -; These are for use with Midnight Commander -; they map Meta key to ALT (Like Linux console, nice isn't it ? ) -; - - -;-- These lines were commented. -;-- This way keyyboard represents <|> <@> <#> and so on ; -;VK_0 RIGHT_ALT ^[0 -;VK_1 RIGHT_ALT ^[1 -;VK_2 RIGHT_ALT ^[2 -;VK_3 RIGHT_ALT ^[3 -;VK_4 RIGHT_ALT ^[4 -;VK_5 RIGHT_ALT ^[5 -;VK_6 RIGHT_ALT ^[6 -;VK_7 RIGHT_ALT ^[7 -;VK_8 RIGHT_ALT ^[8 -;VK_9 RIGHT_ALT ^[9 -;VK_A RIGHT_ALT ^[A -;VK_B RIGHT_ALT ^[B -;VK_C RIGHT_ALT ^[C -;VK_D RIGHT_ALT ^[D -;VK_E RIGHT_ALT ^[E -;VK_F RIGHT_ALT ^[F -;VK_G RIGHT_ALT ^[G -;VK_H RIGHT_ALT ^[H -;VK_I RIGHT_ALT ^[I -;VK_J RIGHT_ALT ^[J -;VK_K RIGHT_ALT ^[K -;VK_L RIGHT_ALT ^[L -;VK_M RIGHT_ALT ^[M -;VK_N RIGHT_ALT ^[N -;VK_O RIGHT_ALT ^[O -;VK_P RIGHT_ALT ^[P -;VK_Q RIGHT_ALT ^[Q -;VK_R RIGHT_ALT ^[R -;VK_S RIGHT_ALT ^[S -;VK_T RIGHT_ALT ^[T -;VK_U RIGHT_ALT ^[U -;VK_V RIGHT_ALT ^[V -;VK_W RIGHT_ALT ^[W -;VK_X RIGHT_ALT ^[X -;VK_Y RIGHT_ALT ^[Y -;VK_Z RIGHT_ALT ^[Z - -;-- These lines are from original emulation -VK_0 LEFT_ALT ^[0 -VK_1 LEFT_ALT ^[1 -VK_2 LEFT_ALT ^[2 -VK_3 LEFT_ALT ^[3 -VK_4 LEFT_ALT ^[4 -VK_5 LEFT_ALT ^[5 -VK_6 LEFT_ALT ^[6 -VK_7 LEFT_ALT ^[7 -VK_8 LEFT_ALT ^[8 -VK_9 LEFT_ALT ^[9 -VK_A LEFT_ALT ^[a -VK_B LEFT_ALT ^[b -VK_C LEFT_ALT ^[c -VK_D LEFT_ALT ^[d -VK_E LEFT_ALT ^[e -VK_F LEFT_ALT ^[f -VK_G LEFT_ALT ^[g -VK_H LEFT_ALT ^[h -VK_I LEFT_ALT ^[i -VK_J LEFT_ALT ^[j -VK_K LEFT_ALT ^[k -VK_L LEFT_ALT ^[l -VK_M LEFT_ALT ^[m -VK_N LEFT_ALT ^[n -VK_O LEFT_ALT ^[o -VK_P LEFT_ALT ^[p -VK_Q LEFT_ALT ^[q -VK_R LEFT_ALT ^[r -VK_S LEFT_ALT ^[s -VK_T LEFT_ALT ^[t -VK_U LEFT_ALT ^[u -VK_V LEFT_ALT ^[v -VK_W LEFT_ALT ^[w -VK_X LEFT_ALT ^[x -VK_Y LEFT_ALT ^[y -VK_Z LEFT_ALT ^[z -VK_RETURN RIGHT_CTRL ^[^M -VK_RETURN LEFT_CTRL ^[^M -; It is correct for telnet to send ^J rather than ^M for return. -; This is noticeable especially when telnetting in to an smtp server. -; It would be even more correct to send \x010\x000, since that is what -; the RFC calls for. (Paul Brannan 5/25/98) -VK_RETURN ^M^J -; This is for application cursor keys (Paul Brannan 5/27/98) -VK_LEFT APP_KEY ^[OD -VK_UP APP_KEY ^[OA -VK_RIGHT APP_KEY ^[OC -VK_DOWN APP_KEY ^[OB -VK_LEFT APP_KEY+SHIFT ^[OD -VK_UP APP_KEY+SHIFT ^[OA -VK_RIGHT APP_KEY+SHIFT ^[OC -VK_DOWN APP_KEY+SHIFT ^[OB -; APP2_KEY is for VT52 support (Paul Brannan 6/28/98) -VK_LEFT APP2_KEY ^[D -VK_UP APP2_KEY ^[A -VK_RIGHT APP2_KEY ^[C -VK_DOWN APP2_KEY ^[B -VK_LEFT APP2_KEY+SHIFT ^[D -VK_UP APP2_KEY+SHIFT ^[A -VK_RIGHT APP2_KEY+SHIFT ^[C -VK_DOWN APP2_KEY+SHIFT ^[B -VK_F1 APP2_KEY ^[P -VK_F2 APP2_KEY ^[Q -VK_F3 APP2_KEY ^[R -VK_F4 APP2_KEY ^[S -VK_F5 APP2_KEY ^[?w -VK_F6 APP2_KEY ^[?x -VK_F7 APP2_KEY ^[?y -VK_F8 APP2_KEY ^[?m -VK_F9 APP2_KEY ^[?t -VK_F10 APP2_KEY ^[?u -VK_F1 APP2_KEY+SHIFT ^[?v -VK_F2 APP2_KEY+SHIFT ^[?l -VK_F3 APP2_KEY+SHIFT ^[?q -VK_F4 APP2_KEY+SHIFT ^[?r -VK_F5 APP2_KEY+SHIFT ^[?s -VK_F6 APP2_KEY+SHIFT ^[?M -VK_F7 APP2_KEY+SHIFT ^[?p -VK_F8 APP2_KEY+SHIFT ^[?n - -; Fix for the numeric decimal key (Paul Brannan 9/23/98) -VK_DELETE \127 -VK_DELETE NUMLOCK . -VK_DELETE NUMLOCK+SHIFT \127 - -;-- From this point all definitions are new. -; -VK_0 RIGHT_ALT \ -VK_0 RIGHT_ALT+CAPSLOCK \ -VK_0 § -VK_0 SHIFT ¦ -VK_0 CAPSLOCK § -VK_0 CAPSLOCK+SHIFT ¦ -; -VK_1 RIGHT_ALT Ý -VK_1 SHIFT ! -VK_1 CAPSLOCK 1 -VK_1 CAPSLOCK+SHIFT ! -; -VK_2 RIGHT_ALT @ -VK_2 SHIFT " -VK_2 CAPSLOCK 2 -VK_2 CAPSLOCK+SHIFT " -; -VK_3 RIGHT_ALT # -VK_3 SHIFT ú -VK_3 CAPSLOCK 3 -VK_3 CAPSLOCK+SHIFT ú -; -VK_4 SHIFT $ -VK_4 CAPSLOCK 4 -VK_4 CAPSLOCK+SHIFT $ -; -VK_5 SHIFT % -VK_5 CAPSLOCK 5 -VK_5 CAPSLOCK+SHIFT % -; -VK_6 RIGHT_ALT ª -VK_6 SHIFT & -VK_6 CAPSLOCK 6 -VK_6 CAPSLOCK+SHIFT & -; -VK_7 SHIFT / -VK_7 CAPSLOCK 7 -VK_7 CAPSLOCK+SHIFT / -; -VK_8 SHIFT ( -VK_8 CAPSLOCK 8 -VK_8 CAPSLOCK+SHIFT ( -; -VK_9 SHIFT ) -VK_9 CAPSLOCK 9 -VK_9 CAPSLOCK+SHIFT ) -; -VK_. CAPSLOCK+SHIFT : -VK_/ CAPSLOCK+SHIFT _ -; -VK_[ ' -VK_[ CAPSLOCK ' - -;=================================================================== -; End Spanish Keyboard Definition. -; Cesar Otero jcotero@las.es March-1.999 Ferrol. Coru¤a. SPAIN -;=================================================================== -[END keymap] - -[keymap no-numpad] -VK_NUMPAD0 \000 -VK_NUMPAD1 \000 -VK_NUMPAD2 \000 -VK_NUMPAD3 \000 -VK_NUMPAD4 \000 -VK_NUMPAD5 \000 -VK_NUMPAD6 \000 -VK_NUMPAD7 \000 -VK_NUMPAD8 \000 -VK_NUMPAD9 \000 -[END keymap] - -[charmap koi8u-cp866] - \xE1 \x80 // CYRILLIC CAPITAL LETTER A - \xC1 \xA0 // cyrillic small letter A - \xE2 \x81 // CYRILLIC CAPITAL LETTER BE - \xC2 \xA1 // cyrillic small letter BE - \xB6 \x49 // CYRILLIC CAPITAL LETTER BELORUSSIAN-UKRAINIAN I - \xA6 \x69 // cyrillic small letter BELORUSSIAN-UKRAINIAN I - \xFE \x97 // CYRILLIC CAPITAL LETTER CHE - \xDE \xE7 // cyrillic small letter CHE - \xE4 \x84 // CYRILLIC CAPITAL LETTER DE - \xC4 \xA4 // cyrillic small letter DE - \xE6 \x94 // CYRILLIC CAPITAL LETTER EF - \xC6 \xE4 // cyrillic small letter EF - \xEC \x8B // CYRILLIC CAPITAL LETTER EL - \xCC \xAB // cyrillic small letter EL - \xED \x8C // CYRILLIC CAPITAL LETTER EM - \xCD \xAC // cyrillic small letter EM - \xEE \x8D // CYRILLIC CAPITAL LETTER EN - \xCE \xAD // cyrillic small letter EN - \xF2 \x90 // CYRILLIC CAPITAL LETTER ER - \xD2 \xE0 // cyrillic small letter ER - \xF3 \x91 // CYRILLIC CAPITAL LETTER ES - \xD3 \xE1 // cyrillic small letter ES - \xE7 \x83 // CYRILLIC CAPITAL LETTER GE - \xC7 \xA3 // cyrillic small letter GE - \xFF \x9A // CYRILLIC CAPITAL LETTER HARD SIGN - \xDF \xEA // cyrillic small letter HARD SIGN - \xF1 \x9F // CYRILLIC CAPITAL LETTER IA - \xD1 \xEF // cyrillic small letter IA - \xE5 \x85 // CYRILLIC CAPITAL LETTER IE - \xC5 \xA5 // cyrillic small letter IE - \xE9 \x88 // CYRILLIC CAPITAL LETTER II - \xC9 \xA8 // cyrillic small letter II - \xB3 \xF0 // CYRILLIC CAPITAL LETTER IO - \xA3 \xF1 // cyrillic small letter IO - \xE0 \x9E // CYRILLIC CAPITAL LETTER IU - \xC0 \xEE // cyrillic small letter IU - \xEB \x8A // CYRILLIC CAPITAL LETTER KA - \xCB \xAA // cyrillic small letter KA - \xE8 \x95 // CYRILLIC CAPITAL LETTER KHA - \xC8 \xE5 // cyrillic small letter KHA - \xEF \x8E // CYRILLIC CAPITAL LETTER O - \xCF \xAE // cyrillic small letter O - \xF0 \x8F // CYRILLIC CAPITAL LETTER PE - \xD0 \xAF // cyrillic small letter PE - \xFC \x9D // CYRILLIC CAPITAL LETTER REVERSED E - \xDC \xED // cyrillic small letter REVERSED E - \xFB \x98 // CYRILLIC CAPITAL LETTER SHA - \xDB \xE8 // cyrillic small letter SHA - \xFD \x99 // CYRILLIC CAPITAL LETTER SHCHA - \xDD \xE9 // cyrillic small letter SHCHA - \xEA \x89 // CYRILLIC CAPITAL LETTER SHORT II - \xCA \xA9 // cyrillic small letter SHORT II - \xF8 \x9C // CYRILLIC CAPITAL LETTER SOFT SIGN - \xD8 \xEC // cyrillic small letter SOFT SIGN - \xF4 \x92 // CYRILLIC CAPITAL LETTER TE - \xD4 \xE2 // cyrillic small letter TE - \xE3 \x96 // CYRILLIC CAPITAL LETTER TSE - \xC3 \xE6 // cyrillic small letter TSE - \xF5 \x93 // CYRILLIC CAPITAL LETTER U - \xD5 \xE3 // cyrillic small letter U - \xBD \x83 // CYRILLIC CAPITAL LETTER UKRAINIAN GHE (UPTURN) - \xAD \xA3 // cyrillic small letter UKRAINIAN GHE (UPTURN) - \xB4 \xF2 // CYRILLIC CAPITAL LETTER UKRAINIAN IE - \xA4 \xF3 // cyrillic small letter UKRAINIAN IE - \xF7 \x82 // CYRILLIC CAPITAL LETTER VE - \xD7 \xA2 // cyrillic small letter VE - \xF9 \x9B // CYRILLIC CAPITAL LETTER YERI - \xD9 \xEB // cyrillic small letter YERI - \xB7 \xF4 // CYRILLIC CAPITAL LETTER YI (UKRAINIAN) - \xA7 \xF5 // cyrillic small letter YI (UKRAINIAN) - \xFA \x87 // CYRILLIC CAPITAL LETTER ZE - \xDA \xA7 // cyrillic small letter ZE - \xF6 \x86 // CYRILLIC CAPITAL LETTER ZHE - \xD6 \xA6 // cyrillic small letter ZHE -[end charmap] // koi8u-cp866 - -// czech charmap (Petr Balas CP852 -; Added by Jakub Sterba (sterba@nlk.anet.cz) -; -[charmap iso8859-2-cp852] - \xA0 \xAA - \xA1 \xA4 - \xA2 \xF4 - \xA3 \x9D - \xA4 \xCF - \xA5 \x95 - \xA6 \x97 - \xA7 \xF5 - \xA8 \xF9 - \xA9 \xE6 - \xAA \xB8 - \xAB \x9B - \xAC \x8D - \xAD \xF0 - \xAE \xA6 - \xAF \xBD - \xB0 \xF8 - \xB1 \xA5 - \xB2 \xF2 - \xB3 \x88 - \xB4 \xEF - \xB5 \x96 - \xB6 \x98 - \xB7 \xF3 - \xB8 \xF7 - \xB9 \xE7 - \xBA \xAD - \xBB \x9C - \xBC \xAB - \xBD \xF1 - \xBE \xA7 - \xBF \xBE - \xC0 \xE8 - \xC1 \xB5 - \xC2 \xB6 - \xC3 \xC6 - \xC4 \x8E - \xC5 \x91 - \xC6 \x8F - \xC7 \x80 - \xC8 \xAC - \xC9 \x90 - \xCA \xA8 - \xCB \xD3 - \xCC \xB7 - \xCD \xD6 - \xCE \xD7 - \xCF \xD2 - \xD0 \xD1 - \xD1 \xE3 - \xD2 \xD5 - \xD3 \xE0 - \xD4 \xE2 - \xD5 \x8A - \xD6 \x99 - \xD7 \x9E - \xD8 \xFC - \xD9 \xDE - \xDA \xE9 - \xDB \xEB - \xDC \x9A - \xDD \xED - \xDE \xDD - \xDF \xE1 - \xE0 \xEA - \xE1 \xA0 - \xE2 \x83 - \xE3 \xC7 - \xE4 \x84 - \xE5 \x92 - \xE6 \x86 - \xE7 \x87 - \xE8 \x9F - \xE9 \x82 - \xEA \xA9 - \xEB \x89 - \xEC \xD8 - \xED \xA1 - \xEE \x8C - \xEF \xD4 - \xF0 \xD0 - \xF1 \xE4 - \xF2 \xE5 - \xF3 \xA2 - \xF4 \x93 - \xF5 \x8B - \xF6 \x94 - \xF7 \xF6 - \xF8 \xFD - \xF9 \x85 - \xFA \xA3 - \xFC \x81 - \xFD \xEC - \xFE \xEE - \xFF \xFA -[end charmap] // iso8859-2-cp852 - -[config ansi] - keymap ansi -[end config] - -[config linux ] - keymap ansi + linux -[end config] - -[config default_koi8] - keymap ansi - keymap koi8u + koi8r : VK_/ RIGHT_ALT // russian keyboard - keymap koi8u : VK_. RIGHT_ALT // ukranian - - charmap koi8u-cp866 -[end config] - -[config linux_koi8] - keymap ansi + linux - keymap koi8u + koi8r : VK_/ RIGHT_ALT // russian keyboard - keymap koi8u : VK_. RIGHT_ALT // ukranian - - charmap koi8u-cp866 -[end config] - -[config vt100] - keymap ansi + vt100 -[end config] - -[config uk] - keymap ansi + uk -[end config] - -[config uk_vt100] - keymap ansi + vt100 + uk -[end config] - -[config at386] - keymap at386 - keymap ibm866 : VK_SCROLL // russian keyboard PC-866 -[end config] - -[config swedish_vt100] - keymap ansi + vt100 - keymap swedish : VK_/ RIGHT_ALT -[end config] - -[config german] - keymap ansi + german -[end config] - -[config sp] - keymap sp -[end config] - -[config czech] - keymap ansi + czech-cz // Czech keyboard (uses DOS driver) - keymap ansi + czech-en : VK_F1 LEFT_CTRL+LEFT_ALT // US keyboard (uses DOS driver) - keymap ansi + czech-cz : VK_F2 LEFT_CTRL+LEFT_ALT // Czech keyboard (uses DOS driver) - charmap iso8859-2-cp852 // character conversion remote -> console - revcharmap iso8859-2-cp852 // character conversion console -> remote -[end config] - -[config czech_vt100] - keymap ansi + vt100 + czech-cz // Czech keyboard (uses DOS driver) - keymap ansi + vt100 + czech-en : VK_F1 LEFT_CTRL+LEFT_ALT // US keyboard (uses DOS driver) - keymap ansi + vt100 + czech-cz : VK_F2 LEFT_CTRL+LEFT_ALT // Czech keyboard (uses DOS driver) - charmap iso8859-2-cp852 // character conversion remote -> console - revcharmap iso8859-2-cp852 // character conversion console -> remote -[end config] diff --git a/rosapps/net/telnet/telnet.ico b/rosapps/net/telnet/telnet.ico deleted file mode 100644 index 02d59ac9474..00000000000 Binary files a/rosapps/net/telnet/telnet.ico and /dev/null differ diff --git a/rosapps/net/telnet/telnet.ini b/rosapps/net/telnet/telnet.ini deleted file mode 100644 index 76e2a569201..00000000000 --- a/rosapps/net/telnet/telnet.ini +++ /dev/null @@ -1,53 +0,0 @@ -[Terminal] -;Dumpfile= -;Term=ansi -;Telnet_Redir=0 -;Input_Redir=0 -;Output_Redir=0 -;Strip_Redir=FALSE -;Destructive_Backspace=FALSE -;Speaker_Beep=TRUE -;Beep=TRUE -;EightBit_Ansi=True -;VT100_Mode=True -;Disable_Break=FALSE -;Preserve_Colors=FALSE -;Wrap_Line=TRUE -;Fast_Write=TRUE -;Term_Width=-1 -;Term_Height=-1 -;Wide_Enable=FALSE -;Buffer_Size=2048 - -[Colors] -;Blink_bg=-1 -;Blink_fg=2 -;Underline_bg=-1 -;Underline_fg=3 -;UlBlink_bg=-1 -;UlBlink_fg=1 -;Normal_bg=0 -;Normal_fg=7 -;Scroll_bg=0 -;Scroll_fg=7 -;Status_bg=1 -;Status_fg=15 - -[Mouse] -;Enable_Mouse=1 - -[Printer] -;Printer_Name=LPT1 - -[Keyboard] -;Escape_key=] -;Scrollback_key=[ -;Dial_key=\ -;Alt_erase=FALSE -;Keyboard_paste=FALSE -;Keyfile=keys.cfg -;Default_Config=vt100 - -[Scrollback] -;Scroll_Mode=DUMP -;Scroll_Enable=TRUE diff --git a/rosapps/net/telnet/telnet.rc b/rosapps/net/telnet/telnet.rc deleted file mode 100644 index c7bfd148c26..00000000000 --- a/rosapps/net/telnet/telnet.rc +++ /dev/null @@ -1,6 +0,0 @@ -/* $Id: telnet.rc,v 1.4 2004/10/16 22:30:17 gvg Exp $ */ - -#define REACTOS_STR_FILE_DESCRIPTION "Console Telnet for Win32\0" -#define REACTOS_STR_INTERNAL_NAME "telnet\0" -#define REACTOS_STR_ORIGINAL_FILENAME "telnet.exe\0" -#include diff --git a/rosapps/net/whois/.cvsignore b/rosapps/net/whois/.cvsignore deleted file mode 100644 index 954ada33419..00000000000 --- a/rosapps/net/whois/.cvsignore +++ /dev/null @@ -1,17 +0,0 @@ -*.sys -*.exe -*.dll -*.cpl -*.a -*.o -*.d -*.coff -*.dsp -*.dsw -*.aps -*.ncb -*.opt -*.sym -*.plg -*.bak -*.map diff --git a/rosapps/net/whois/LICENSE.txt b/rosapps/net/whois/LICENSE.txt deleted file mode 100644 index 3f506f74169..00000000000 --- a/rosapps/net/whois/LICENSE.txt +++ /dev/null @@ -1,23 +0,0 @@ -July 22, 1999 - -To All Licensees, Distributors of Any Version of BSD: - -As you know, certain of the Berkeley Software Distribution ("BSD") source code files -require that further distributions of products containing all or portions of the -software, acknowledge within their advertising materials that such products contain -software developed by UC Berkeley and its contributors. - -Specifically, the provision reads: - - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - -Effective immediately, licensees and distributors are no longer required to include -the acknowledgement within advertising materials. Accordingly, the foregoing paragraph -of those BSD Unix files containing it is hereby deleted in its entirety. - -William Hoskins -Director, Office of Technology Licensing -University of California, Berkeley " diff --git a/rosapps/net/whois/makefile b/rosapps/net/whois/makefile deleted file mode 100644 index f43684b0be2..00000000000 --- a/rosapps/net/whois/makefile +++ /dev/null @@ -1,20 +0,0 @@ - -PATH_TO_TOP=../../../reactos - -TARGET_TYPE = program - -TARGET_APPTYPE = console - -TARGET_NAME = whois - -TARGET_SDKLIBS = ws2_32.a - -TARGET_OBJECTS = $(TARGET_NAME).o - -TARGET_GCCLIBS = iberty - -include $(PATH_TO_TOP)/rules.mak - -include $(TOOLS_PATH)/helper.mk - -# EOF diff --git a/rosapps/net/whois/whois.c b/rosapps/net/whois/whois.c deleted file mode 100644 index 989d0a2e754..00000000000 --- a/rosapps/net/whois/whois.c +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright (c) 1980, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * 8/1/97 - Ted Felix - * Ported to Win32 from 4.4-BSDLITE2 from wcarchive. - * Added WSAStartup()/WSACleanup() and switched from the - * more convenient fdopen()/fprintf() to send()/recv(). - */ - -#ifndef lint -static char copyright[] = -"@(#) Copyright (c) 1980, 1993\n\ - The Regents of the University of California. All rights reserved.\n"; -#endif /* not lint */ - -#ifndef lint -static char sccsid[] = "@(#)whois.c 8.1 (Berkeley) 6/6/93"; -#endif /* not lint */ - -#include -#include -/* #include */ -/* #include */ -/* #include */ -#include - -/* #include */ -#include -#include - -#define NICHOST "whois.internic.net" - -void usage(); -void leave(int iExitCode); - -int main(int argc, char **argv) -{ - extern char *optarg; - extern int optind; - char ch; - struct sockaddr_in sin; - struct hostent *hp; - struct servent *sp; - int s; - char *host; - WORD wVersionRequested; - WSADATA wsaData; - int err; - - host = NICHOST; - while ((ch = (char)getopt(argc, argv, "h:")) != EOF) - switch((char)ch) { - case 'h': - host = optarg; - break; - case '?': - default: - usage(); - } - argc -= optind; - argv += optind; - - if (!argc) - usage(); - - /* Start winsock */ - wVersionRequested = MAKEWORD( 1, 1 ); - err = WSAStartup( wVersionRequested, &wsaData ); - if ( err != 0 ) - { - /* Tell the user that we couldn't find a usable */ - /* WinSock DLL. */ - perror("whois: WSAStartup failed"); - leave(1); - } - - hp = gethostbyname(host); - if (hp == NULL) { - (void)fprintf(stderr, "whois: %s: ", host); - leave(1); - } - host = hp->h_name; - - s = socket(hp->h_addrtype, SOCK_STREAM, 0); - if (s < 0) { - perror("whois: socket"); - leave(1); - } - - memset(/*(caddr_t)*/&sin, 0, sizeof(sin)); - sin.sin_family = hp->h_addrtype; - if (bind(s, (struct sockaddr *)&sin, sizeof(sin)) < 0) { - perror("whois: bind"); - leave(1); - } - - memcpy((char *)&sin.sin_addr, hp->h_addr, hp->h_length); - sp = getservbyname("whois", "tcp"); - if (sp == NULL) { - (void)fprintf(stderr, "whois: whois/tcp: unknown service\n"); - leave(1); - } - - sin.sin_port = sp->s_port; - - /* have network connection; identify the host connected with */ - (void)printf("[%s]\n", hp->h_name); - - if (connect(s, (struct sockaddr *)&sin, sizeof(sin)) < 0) { - fprintf(stderr, "whois: connect error = %d\n", WSAGetLastError()); - leave(1); - } - - /* WinSock doesn't allow using a socket as a file descriptor. */ - /* Have to use send() and recv(). whois will drop connection. */ - - /* For each request */ - while (argc-- > 1) - { - /* Send the request */ - send(s, *argv, strlen(*argv), 0); - send(s, " ", 1, 0); - argv++; - } - /* Send the last request */ - send(s, *argv, strlen(*argv), 0); - send(s, "\r\n", 2, 0); - - /* Receive anything and print it */ - while (recv(s, &ch, 1, 0) == 1) - putchar(ch); - - leave(0); -} - -void usage() -{ - (void)fprintf(stderr, "usage: whois [-h hostname] name ...\n"); - leave(1); -} - -void leave(int iExitCode) -{ - WSACleanup(); - exit(iExitCode); -} diff --git a/rosapps/net/whois/whois.rc b/rosapps/net/whois/whois.rc deleted file mode 100644 index 2c87d7e6963..00000000000 --- a/rosapps/net/whois/whois.rc +++ /dev/null @@ -1,7 +0,0 @@ -/* $Id: whois.rc,v 1.3 2004/10/16 22:30:18 gvg Exp $ */ - -#define REACTOS_STR_FILE_DESCRIPTION "ReactOS TCP/IPv4 Win32 Whois\0" -#define REACTOS_STR_INTERNAL_NAME "whois\0" -#define REACTOS_STR_ORIGINAL_FILENAME "whois.exe\0" -#define REACTOS_STR_ORIGINAL_COPYRIGHT "Steven Edwards (Isolation@users.sourceforge.net)\0" -#include