summaryrefslogtreecommitdiffstats
path: root/fstools/fstools.cpp
blob: b1cc7adf5c1b81b0fe11d6aa79a3fb53017804c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <stdlib.h>

extern "C" {
#include "fstools.h"
}


int
main(int argc, char **argv) {

    // Handle alternative invocations
    char* command = argv[0];
    char* stripped = strrchr(argv[0], '/');
    if (stripped)
        command = stripped + 1;

    if (strcmp(command, "fstools") != 0) {
        struct fstools_cmd cmd = get_command(command);
        if (cmd.name)
            return cmd.main_func(argc, argv);
    }
    return -1;
}