1 /* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
7 int main(int argc, char **argv)
12 fprintf(stderr, "Syntax: %s <in-file> <out-file>\n", argv[0]);
16 infp = fopen(argv[1], "r");
23 outfp = fopen(argv[2], "w");
31 fprintf(outfp, "/* This file has been automatically generated\n"
32 " from the input file \"%s\". */\n\n", argv[1]);
33 fputs("#include \"config/configfragment.hpp\"\n\nnamespace {\n\nconst char *fragment = R\"CONFIG_FRAGMENT(", outfp);
37 size_t rc = fread(buf, 1, sizeof(buf), infp);
42 fwrite(buf, rc, 1, outfp);
45 fprintf(outfp, ")CONFIG_FRAGMENT\";\n\nREGISTER_CONFIG_FRAGMENT(\"%s\", fragment);\n\n}", argv[1]);