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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
#include "honeysuckle.h"
#include "options.h"
#include "bindings.h"
struct settings {
const char *template_dir;
};
int main(int argc, char **argv)
{
struct argent_options opts;
int error = parse_options(&opts, argc, argv);
if (error)
return 1;
printf("configuration file: %s\n"
"output directory: %s\n",
opts.conf_filename,
opts.output_dir);
lua_State *L = luaL_newstate();
luaL_openlibs(L);
hs_create_table
(L,
hs_str_cfunc("markdown", markdown)
);
lua_setglobal(L, "argent");
error = luaL_loadfile(L, opts.conf_filename);
if (error != 0) {
fprintf(stderr, "error: %s\n", lua_tostring(L, -1));
lua_close(L);
return error;
}
error = hs_call(L, 0, 1);
if (error != 0) {
fprintf(stderr, "error: %s\n", lua_tostring(L, -1));
lua_close(L);
return error;
}
printf("here!\n");
lua_close(L);
return 0;
}
|