]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Add cct_create_file function
authorJoel Rosdahl <joel@rosdahl.net>
Sat, 17 Jul 2010 17:10:56 +0000 (19:10 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Sat, 17 Jul 2010 17:10:56 +0000 (19:10 +0200)
test/framework.c
test/framework.h

index b85cfb271356bab2487e1e9f78e6139fba48747d..7faca1f5915818065818ae50afe618042504b0f1 100644 (file)
@@ -302,3 +302,14 @@ void cct_create_fresh_dir(const char *path)
                abort();
        }
 }
+
+void cct_create_file(const char *path, const char *content)
+{
+       FILE *f = fopen(path, "w");
+       if (!f || fputs(content, f) < 0) {
+               fprintf(stderr, "cct_create_file: %s: %s", path, strerror(errno));
+       }
+       if (f) {
+               fclose(f);
+       }
+}
index 5685705544853a526eb6f75da729c824f20aa9f0..9e8357b2c06c822b61aada5fef127ce539536dc4 100644 (file)
@@ -143,5 +143,6 @@ int cct_check_args_eq(const char *file, int line, const char *expression,
 void cct_chdir(const char *path);
 void cct_wipe(const char *path);
 void cct_create_fresh_dir(const char *path);
+void cct_create_file(const char *path, const char *content);
 
 #endif