/* * Run the script by continously executing "thisline". */ int execscript(const char *s) { volatile int ret = OK; curenv = (struct env *)malloc(sizeof(struct env)); curenv->lines = NULL; curenv->vars = NULL; curenv->verbose = 1; curenv->scriptname = s; if (readscript(s) < 0) { freemem(); free(curenv); return ERR; } signal(SIGALRM, myclock); alarm(1); if (setjmp(curenv->ebuf) == 0) { thisline = curenv->lines; while (thisline != NULL && (ret = s_exec(thisline->line)) != ERR) thisline = thisline->next; } else ret = curenv->exstat ? ERR : 0; free(curenv); return ret; }
void read4() // used for newbie items { int i, loopexit = 0; readscript(); i = 0; script3[0] = 0; script4[0] = 0; while ((temp[i] != 0) &&(temp[i] != ' ') &&(++loopexit < MAXLOOPS)) { i++; } strncpy((char*)script3, (char*)temp, i); script3[i] = 0; if (script1[0] != '}' && temp[i] != 0) strcpy((char*)script4, (char*)(temp + i + 1)); return; }
void read3() // used for newbie items { readscript(); strcpy((char*)script3, (char*)temp); }