Report script errors and quit */
| 293 | |
| 294 | /* Report script errors and quit */ |
| 295 | void serror(char *text, int exitcode) { |
| 296 | int a,line; |
| 297 | char lmsg[STRINGL]; |
| 298 | verbose=1; |
| 299 | //dodump(); |
| 300 | vmsg("-- Error Report --"); |
| 301 | a=pc; |
| 302 | pc=lastpc; |
| 303 | //printwhere(); |
| 304 | pc=a; |
| 305 | while(pc!=0 && (script[pc]==' ' || script[pc]=='\t')) pc--; |
| 306 | strcpy(lmsg,"----> "); |
| 307 | for(a=6;a<STRINGL;a++) lmsg[a]=' '; |
| 308 | for(a=0;a<pc-lastpc;a++) { |
| 309 | if(script[a+lastpc]=='\t') lmsg[a+8]='\t'; |
| 310 | } |
| 311 | a+=6; |
| 312 | lmsg[a++]='^'; |
| 313 | lmsg[a]=0; |
| 314 | vmsg(lmsg); |
| 315 | a=0; line=1; |
| 316 | while(a<pc) { |
| 317 | if(script[a++]=='\n') { |
| 318 | if(a<pc) line++; |
| 319 | } |
| 320 | } |
| 321 | sprintf(lmsg,"Error @%d, line %d, %s. (%d)\n",pc,line,text,exitcode); |
| 322 | vmsg(lmsg); |
| 323 | ext(exitcode); |
| 324 | } |
| 325 | |
| 326 | void skipspaces(void) { |
| 327 | while(script[pc]==' ' || script[pc]=='\t' ) pc++; |
no test coverage detected