| 1390 | } |
| 1391 | |
| 1392 | void scenario::parseAction(CActions *actions) |
| 1393 | { |
| 1394 | char * actionElem; |
| 1395 | unsigned int recvScenarioLen = 0; |
| 1396 | char ** currentTabVarName = nullptr; |
| 1397 | int currentNbVarNames; |
| 1398 | int sub_currentNbVarId; |
| 1399 | char* ptr; |
| 1400 | const char* cptr; |
| 1401 | |
| 1402 | while((actionElem = xp_open_element(recvScenarioLen))) { |
| 1403 | CAction *tmpAction = new CAction(this); |
| 1404 | |
| 1405 | if(!strcmp(actionElem, "ereg")) { |
| 1406 | ptr = xp_get_string("regexp", "ereg"); |
| 1407 | |
| 1408 | tmpAction->setActionType(CAction::E_AT_ASSIGN_FROM_REGEXP); |
| 1409 | |
| 1410 | // warning - although these are detected for both msg and hdr |
| 1411 | // they are only implemented for search_in="hdr" |
| 1412 | tmpAction->setCaseIndep(xp_get_bool("case_indep", "ereg", false)); |
| 1413 | tmpAction->setHeadersOnly(xp_get_bool("start_line", "ereg", false)); |
| 1414 | |
| 1415 | if ((cptr = xp_get_value("search_in"))) { |
| 1416 | tmpAction->setOccurrence(1); |
| 1417 | |
| 1418 | if (strcmp(cptr, "msg") == 0) { |
| 1419 | tmpAction->setLookingPlace(CAction::E_LP_MSG); |
| 1420 | tmpAction->setLookingChar (nullptr); |
| 1421 | } else if (strcmp(cptr, "body") == 0) { |
| 1422 | tmpAction->setLookingPlace(CAction::E_LP_BODY); |
| 1423 | tmpAction->setLookingChar (nullptr); |
| 1424 | } else if (strcmp(cptr, "var") == 0) { |
| 1425 | tmpAction->setVarInId(xp_get_var("variable", "ereg")); |
| 1426 | tmpAction->setLookingPlace(CAction::E_LP_VAR); |
| 1427 | } else if (strcmp(cptr, "hdr") == 0) { |
| 1428 | cptr = xp_get_value("header"); |
| 1429 | if (!cptr || !strlen(cptr)) { |
| 1430 | ERROR("search_in=\"hdr\" requires header field"); |
| 1431 | } |
| 1432 | tmpAction->setLookingPlace(CAction::E_LP_HDR); |
| 1433 | tmpAction->setLookingChar(cptr); |
| 1434 | if ((cptr = xp_get_value("occurrence"))) { |
| 1435 | tmpAction->setOccurrence(atol(cptr)); |
| 1436 | } else if ((cptr = xp_get_value("occurence"))) { |
| 1437 | /* old misspelling */ |
| 1438 | tmpAction->setOccurrence(atol(cptr)); |
| 1439 | } |
| 1440 | } else { |
| 1441 | ERROR("Unknown search_in value %s", cptr); |
| 1442 | } |
| 1443 | } else { |
| 1444 | tmpAction->setLookingPlace(CAction::E_LP_MSG); |
| 1445 | tmpAction->setLookingChar(nullptr); |
| 1446 | } // end if-else search_in |
| 1447 | |
| 1448 | if (xp_get_value("check_it")) { |
| 1449 | tmpAction->setCheckIt(xp_get_bool("check_it", "ereg", false)); |
nothing calls this directly
no test coverage detected