-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathresolve.c
More file actions
38 lines (33 loc) · 778 Bytes
/
resolve.c
File metadata and controls
38 lines (33 loc) · 778 Bytes
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
38
#include <stdio.h>
#include <locale.h>
#include <yaml.h>
#include "demes.h"
int
resolve(char *filename)
{
struct demes_graph *graph;
int ret;
if ((ret = demes_graph_load(filename, &graph))) {
fprintf(stderr, "failed while loading %s\n", filename);
}
if (ret == 0) {
if ((ret = demes_graph_dump(graph, stdout))) {
fprintf(stderr, "failed while dumping graph\n");
}
}
demes_graph_free(graph);
return ret;
}
#ifndef MOCKED_RESOLVE
int
main(int argc, char **argv)
{
// Setting a locale is optional. libdemes works with any locale set.
setlocale(LC_ALL, "");
if (argc != 2) {
fprintf(stderr, "usage: %s model.yaml\n", argv[0]);
return 1;
}
return resolve(argv[1]);
}
#endif