File: getsourcedest

package info (click to toggle)
icmake 13.05.01-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,132 kB
  • sloc: cpp: 11,595; fortran: 883; makefile: 853; sh: 546; pascal: 342
file content (31 lines) | stat: -rw-r--r-- 1,081 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
28
29
30
31
list getSourceDest(string confLine)
{
    list nop;                               // no action at nop

    list fields = strtok(confLine, " \t\n");    // break up the line in parts
    string source = fields[0];                  // look at the first element

                                            // ignore empty lines and comment
    if (listlen(fields) == 0 || source[0] == "#")
        return nop;

    string flags = source;                // remove P/L/D flags

    if (listfind(g_actions, flags) == -1) // no flags: source OK
        flags = "";                      
    else
    {
        fields = shift(fields);             // remove fields[0]
        source = fields[0];                 // reassign source 
    }

    g_confirmInstall = source == "?";   // check for a confirmation request

    if (g_confirmInstall)
        fields = shift(fields);         // if so, then reassign source

    return skip(flags) ?                // inspect the P/L/D and b flags:
                nop
            :
                fields;                 // [0]: source, [1]: dest
}