File: run.cc

package info (click to toggle)
stealth 1.45-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 716 kB
  • ctags: 175
  • sloc: cpp: 1,612; makefile: 88; sh: 70
file content (41 lines) | stat: -rw-r--r-- 1,353 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include "scanner.ih"

void Scanner::run(volatile bool const *quit)
{
    ++d_nScans;

    setSentinel();                              // determine d_sentinel

    d_cmdIterator = d_sorter.firstCmd();        // d_cmdIterator is set to
                                                // the first command. It's a
                                                // true iterator, so we can 
                                                // add values to it, below.
    string cmdNr;

    if (Arg::instance().option(&cmdNr, 'r')) // is there  a command number?
    {
                                                // if so, add its number to
                                                // d_cmdIterator    
        d_cmdIterator += atoi(cmdNr.c_str()) - 1;
        execute(*d_cmdIterator);                // and execute that command
    }
    else                                        // no number: process all
    {                                           // commands    
        for
        (
            vector<string>::const_iterator beyond = d_sorter.beyondCmd();
                d_cmdIterator != beyond;
                    d_cmdIterator++
        )
        {
            if (*quit)
                break;
            execute(*d_cmdIterator);
        }
    }

    if (Util::debug())
        cerr << "Stealth: policy file processed\n";
}