aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
blob: d4b24313b82c280ed6e32436f7fe3f35508d273e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include "cycle_detection.h"

#include <stdio.h>

int main(int argc, char **argv) {
    if(argc < 2) {
        fprintf(stderr, "Missing argument: input file\n");
        fprintf(stderr, "Usage:\n");
        fprintf(stderr, " %s <filename>\n", argv[0]);
        return 1;
    }

    Graph *g = graph_read(argv[1]);
    if (!g) {
        fprintf(stderr, "%s: %s: No such file\n", argv[0], argv[1]);
        return 2;
    }

    cycle_detection(g);
    graph_delete(g);
    return 0;
}