File: main.cc

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 (37 lines) | stat: -rw-r--r-- 825 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
32
33
34
35
36
37
//#define XERR
#include "main.ih"

    // argument 1 is -h or --help ?     -> usage
    // no arguments ?
    //      no icmconf available -> error
    // start icmconf with the provided arguments

int main(int argc, char **argv)
{
    if (argc > 1 and (argv[1] == "-h"s or argv[1] == "--help"s))
    {
        usage(argv[0]);
        return 0;
    }

    if (not Tools::exists("icmconf"))
    {
        cerr << "no `icmconf' file in the current directory\n";
        return 1;
    }

    string cmd{ "/usr/bin/icmake -t. " LIBDIR "/icmbuild" };
    
    for_each(argv + 1, argv + argc, 
        [&](char *arg)
        {
            (cmd += ' ') += arg;
        }
    );

    Process icmbuild{ cmd };
    icmbuild.start(Process::DIRECT, Process::USE_PATH);

    cerr << "Could not execute `" << cmd << "'\n";
    return 1;
}