Reactos
at master 65 lines 1.9 kB view raw
1/////////////////////////////////////////////////////////////////////////////// 2//Telnet Win32 : an ANSI telnet client. 3//Copyright (C) 1998-2000 Paul Brannan 4//Copyright (C) 1998 I.Ioannou 5//Copyright (C) 1997 Brad Johnson 6// 7//This program is free software; you can redistribute it and/or 8//modify it under the terms of the GNU General Public License 9//as published by the Free Software Foundation; either version 2 10//of the License, or (at your option) any later version. 11// 12//This program is distributed in the hope that it will be useful, 13//but WITHOUT ANY WARRANTY; without even the implied warranty of 14//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15//GNU General Public License for more details. 16// 17//You should have received a copy of the GNU General Public License 18//along with this program; if not, write to the Free Software 19//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 20// 21//I.Ioannou 22//roryt@hol.gr 23// 24/////////////////////////////////////////////////////////////////////////// 25 26#include "precomp.h" 27 28#include "tscript.h" 29 30// FIX ME!! This code not yet functional. 31 32#define TERMINATOR '~' 33#define SPACE_HOLDER '_' 34 35// processScript by Bryan Montgomery 36// modified to handle script file by Paul Brannan 37BOOL TScript::processScript (char* data) { 38/* char* end = strchr(script,TERMINATOR); 39 if (0 == end) { 40 return true; 41 } else { 42 char* current = new char(sizeof(char)*strlen(script)); 43 strncpy(current,script,(int)(end-script)); 44 current[(int)(end-script)]=0; 45 char *ptr=end; 46 if (strstr(data,current) != 0) { 47 script = ++end; 48 end = strchr(script,TERMINATOR); 49 while ((ptr = strchr(ptr,SPACE_HOLDER)) != 0 && ptr < end) { 50 *ptr=' '; 51 } 52 Network.WriteString(script,(int)(end-script)); 53 Network.WriteString("\r\n",2); 54 script = ++end; 55 } 56 delete current; 57 }*/ 58 return TRUE; 59} 60 61void TScript::initScript (char *filename) { 62 if(fp) fclose(fp); 63 fp = fopen(filename, "rt"); 64} 65