From f3b341c7b2d1d862d23a83a6a4d4ec1c233964e7 Mon Sep 17 00:00:00 2001 From: jacksonmj Date: Thu, 21 Apr 2011 06:31:16 +0800 Subject: Remove limit on size of console scripts Also fix regex to work with x,y instead of needing x+0,y+0 diff --git a/src/main.c b/src/main.c index bbcd5f5..381106b 100644 --- a/src/main.c +++ b/src/main.c @@ -2110,41 +2110,43 @@ int process_command_old(pixel *vid_buf,char *console,char *console_error) { else if (strcmp(console2, "file")==0 && console3[0]) { if (file_script) { - FILE *f=fopen(console3, "r"); - if (f) + int filesize; + char *fileread = file_load(console3, &filesize); + nx = 0; + ny = 0; + if (console4[0] && !console_parse_coords(console4, &nx , &ny, console_error)) { - char fileread[5000];//TODO: make this change with file size - char pch[5000]; - char tokens[10]; + free(fileread); + return 1; + } + if (fileread) + { + char pch[501]; + char tokens[31]; int tokensize; - nx = 0; - ny = 0; - j = 0; - m = 0; - if (console4[0]) - console_parse_coords(console4, &nx , &ny, console_error); + j = 0; // line start position in fileread + m = 0; // token start position in fileread memset(pch,0,sizeof(pch)); - memset(fileread,0,sizeof(fileread)); - fread(fileread,1,5000,f); - for (i=0; i