From af1a266670d040d2f4083ff309d732d648afba2a Mon Sep 17 00:00:00 2001 From: Angelos Mouzakitis Date: Tue, 10 Oct 2023 14:33:42 +0000 Subject: Add submodule dependency files Change-Id: Iaf8d18082d3991dec7c0ebbea540f092188eb4ec --- meson/test cases/native/3 pipeline/srcgen.c | 69 +++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 meson/test cases/native/3 pipeline/srcgen.c (limited to 'meson/test cases/native/3 pipeline/srcgen.c') diff --git a/meson/test cases/native/3 pipeline/srcgen.c b/meson/test cases/native/3 pipeline/srcgen.c new file mode 100644 index 000000000..ceb9eccee --- /dev/null +++ b/meson/test cases/native/3 pipeline/srcgen.c @@ -0,0 +1,69 @@ +#include +#include +#include + +#define ARRSIZE 80 + +int main(int argc, char **argv) { + char arr[ARRSIZE]; + char *ofilename; + char *ifilename; + char *dfilename; + FILE *ifile; + FILE *ofile; + FILE *depfile; + size_t bytes; + int i; + + if(argc != 4) { + fprintf(stderr, "%s \n", argv[0]); + return 1; + } + ifilename = argv[1]; + ofilename = argv[2]; + dfilename = argv[3]; + ifile = fopen(argv[1], "r"); + if(!ifile) { + fprintf(stderr, "Could not open source file %s.\n", argv[1]); + return 1; + } + ofile = fopen(ofilename, "w"); + if(!ofile) { + fprintf(stderr, "Could not open target file %s\n", ofilename); + fclose(ifile); + return 1; + } + bytes = fread(arr, 1, ARRSIZE, ifile); + assert(bytes < 80); + assert(bytes > 0); + fwrite(arr, 1, bytes, ofile); + + depfile = fopen(dfilename, "w"); + if(!depfile) { + fprintf(stderr, "Could not open depfile %s\n", ofilename); + fclose(ifile); + fclose(ofile); + return 1; + } + for(i=0; i