24774a776833b18b187e344dd51c6989934c853f
[reactos.git] / reactos / base / applications / network / telnet / src / tscript.cpp
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 // FIX ME!! This code not yet functional.
29
30 #define TERMINATOR '~'
31 #define SPACE_HOLDER '_'
32
33 // processScript by Bryan Montgomery
34 // modified to handle script file by Paul Brannan
35 BOOL TScript::processScript (char* data) {
36 /* char* end = strchr(script,TERMINATOR);
37 if (0 == end) {
38 return true;
39 } else {
40 char* current = new char(sizeof(char)*strlen(script));
41 strncpy(current,script,(int)(end-script));
42 current[(int)(end-script)]=0;
43 char *ptr=end;
44 if (strstr(data,current) != 0) {
45 script = ++end;
46 end = strchr(script,TERMINATOR);
47 while ((ptr = strchr(ptr,SPACE_HOLDER)) != 0 && ptr < end) {
48 *ptr=' ';
49 }
50 Network.WriteString(script,(int)(end-script));
51 Network.WriteString("\r\n",2);
52 script = ++end;
53 }
54 delete current;
55 }*/
56 return TRUE;
57 }
58
59 void TScript::initScript (char *filename) {
60 if(fp) fclose(fp);
61 fp = fopen(filename, "rt");
62 }
63