| 1377 | } |
| 1378 | |
| 1379 | int doscript(void) { |
| 1380 | int a,b; |
| 1381 | int exitcode=0; |
| 1382 | char line[STRINGL]; |
| 1383 | pc=0; |
| 1384 | while(script[pc]) { |
| 1385 | if(script[pc]=='\n') pc++; |
| 1386 | lastpc=pc; |
| 1387 | skipspaces(); |
| 1388 | if(verbose) printwhere(); |
| 1389 | if(gettoken()) serror("Could not gettoken()",5); |
| 1390 | if(strcmp(token,"rem")==0) { |
| 1391 | skipline(); |
| 1392 | } |
| 1393 | else if (strcmp(token,"label")==0) { |
| 1394 | skiptoken(); /* Get rid of keyword */ |
| 1395 | } |
| 1396 | else if(strcmp(token,"open")==0) { |
| 1397 | doopen(); |
| 1398 | } |
| 1399 | else if(strcmp(token,"opengt")==0) { |
| 1400 | opengt(); |
| 1401 | } |
| 1402 | else if(strcmp(token,"close")==0) { |
| 1403 | doclose(); |
| 1404 | } |
| 1405 | else if(strcmp(token,"exec")==0) { |
| 1406 | getstring(); |
| 1407 | strcpy(msg,"exec "); |
| 1408 | strcat(msg,string); /* Let sh do all the command line work! */ |
| 1409 | execl("/bin/sh","sh","-c",msg,(char *)0); |
| 1410 | serror("Could not execl /bin/sh!",8); |
| 1411 | } |
| 1412 | else if(strcmp(token,"exit")==0) { |
| 1413 | ext(getvalue()); |
| 1414 | } |
| 1415 | else if(strcmp(token,"testkey")==0) { |
| 1416 | dotestkey(); |
| 1417 | } |
| 1418 | else if(strcmp(token,"kill")==0) { |
| 1419 | a=getvalue(); |
| 1420 | resultcode=kill(getvalue(),a); |
| 1421 | } |
| 1422 | else if(strcmp(token,"fork")==0) { |
| 1423 | resultcode=fork(); |
| 1424 | } |
| 1425 | else if(strcmp(token,"hset")==0) { |
| 1426 | hset=0; |
| 1427 | hstart=time(0); |
| 1428 | hset=htime()-getvalue(); |
| 1429 | } |
| 1430 | else if(strcmp(token,"cd")==0) { |
| 1431 | getstring(); |
| 1432 | resultcode=chdir(string); |
| 1433 | } |
| 1434 | else if(strcmp(token,"putenv")==0) { |
| 1435 | getstring(); |
| 1436 | strcpy(line,string); |
no test coverage detected