-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathgenimbed.c
More file actions
36 lines (29 loc) · 823 Bytes
/
genimbed.c
File metadata and controls
36 lines (29 loc) · 823 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
/*
* Copyright (c) Regents of The University of Michigan
* See COPYING.
*/
#include <config.h>
#include <stdio.h>
#include <string.h>
#include <syslog.h>
#include <unistd.h>
#include <ucl.h>
int
main(int ac, char *av[]) {
struct ucl_parser *parser;
if (ac != 3) {
fprintf(stderr, "Usage:\t\t%s <file> <slug>\n", av[ 0 ]);
exit(1);
}
parser = ucl_parser_new(UCL_PARSER_DEFAULT);
if (!ucl_parser_add_file(parser, av[ 1 ])) {
exit(1);
}
printf("#define LONG_STRING_CONST(...) #__VA_ARGS__\n"
"const char *SIMTA_%s = LONG_STRING_CONST(\n",
av[ 2 ]);
printf("%s", ucl_object_emit(
ucl_parser_get_object(parser), UCL_EMIT_JSON_COMPACT));
printf("\n);\n");
}
/* vim: set softtabstop=4 shiftwidth=4 expandtab :*/