| 635 | // |
| 636 | |
| 637 | static SINT64 ask() |
| 638 | { |
| 639 | AliceGlobals* tdgbl = AliceGlobals::getSpecific(); |
| 640 | |
| 641 | if (tdgbl->uSvc->isService()) |
| 642 | return ~SINT64(0); |
| 643 | |
| 644 | char response[32]; |
| 645 | SINT64 switches = 0; |
| 646 | |
| 647 | while (true) |
| 648 | { |
| 649 | ALICE_print(85); |
| 650 | // msg 85: Commit, rollback, or neither (c, r, or n)? |
| 651 | int c; |
| 652 | const char* end = response + sizeof(response) - 1; |
| 653 | char* p = response; |
| 654 | while ((c = getchar()) != '\n' && !feof(stdin) && !ferror(stdin) && p < end) |
| 655 | *p++ = c; |
| 656 | if (p == response) |
| 657 | return ~SINT64(0); |
| 658 | *p = 0; |
| 659 | ALICE_upper_case(response, response, sizeof(response)); |
| 660 | if (!strcmp(response, "N") || !strcmp(response, "C") || !strcmp(response, "R")) |
| 661 | { |
| 662 | break; |
| 663 | } |
| 664 | } |
| 665 | |
| 666 | if (response[0] == 'C') |
| 667 | switches |= sw_commit; |
| 668 | else if (response[0] == 'R') |
| 669 | switches |= sw_rollback; |
| 670 | |
| 671 | return switches; |
| 672 | } |
| 673 | |
| 674 | |
| 675 | //____________________________________________________________ |
no test coverage detected