diff options
Diffstat (limited to 'test cases/common/105 generatorcustom/gen.c')
-rw-r--r-- | test cases/common/105 generatorcustom/gen.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/test cases/common/105 generatorcustom/gen.c b/test cases/common/105 generatorcustom/gen.c new file mode 100644 index 0000000..59518c0 --- /dev/null +++ b/test cases/common/105 generatorcustom/gen.c @@ -0,0 +1,35 @@ +/* SPDX-License-Identifier: Apache-2.0 */ +/* Copyright © 2023 Intel Corporation */ + +#include <stdio.h> +#include <stdlib.h> + +int main(int argc, const char ** argv) { + if (argc != 3) { + fprintf(stderr, "%s %i %s\n", "Got incorrect number of arguments, got ", argc - 1, ", but expected 2"); + exit(1); + } + + FILE * input, * output; + + if ((input = fopen(argv[1], "rb")) == NULL) { + exit(1); + } + if ((output = fopen(argv[2], "wb")) == NULL) { + exit(1); + } + + fprintf(output, "#pragma once\n"); + fprintf(output, "#define "); + + char c; + while((c = fgetc(input)) != EOF) { + fputc(c, output); + } + fputc('\n', output); + + fclose(input); + fclose(output); + + return 0; +} |