File: execute.cc

package info (click to toggle)
stealth 1.47.4-1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 780 kB
  • ctags: 190
  • sloc: cpp: 1,710; makefile: 155; sh: 62
file content (27 lines) | stat: -rw-r--r-- 1,040 bytes parent folder | download | duplicates (3)
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
#include "scanner.ih"

                                        // receives the next command to execute
void Scanner::execute(string const &cmd)
{
    if (!(s_firstWord << cmd))          // determine first word and the rest
        d_reporter.exit() << "Corrupt line in policy file: " << cmd << endl;
    
    if (Arg::instance().option("de"))// echo the command with -d, -e
        cerr << *d_cmdIterator << endl;

    if (s_firstWord[1] == "LABEL")      // set a label 
    {
        d_label = s_firstWord[3];       // the text beyond the LABEL keyword
        Util::replace(d_label,          // change \\n into newlines
                        "\\n", "\n");   
    }
    else if (s_firstWord[1] == "LOCAL") // run a local command
        local(s_firstWord[3]);
    else if (s_firstWord[1] == "GET")   // get a file from the client
        get(cmd);
    else if (s_firstWord[1] == "PUT")   // put a file to the client
        put(cmd);
    else                                // or run a remote command
        remote(cmd);            
}