From: Joel Rosdahl Date: Sat, 17 Jul 2010 17:10:56 +0000 (+0200) Subject: Add cct_create_file function X-Git-Tag: v3.1~153 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5271039bd28e3184243f1e2feab363b08027fd82;p=thirdparty%2Fccache.git Add cct_create_file function --- diff --git a/test/framework.c b/test/framework.c index b85cfb271..7faca1f59 100644 --- a/test/framework.c +++ b/test/framework.c @@ -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); + } +} diff --git a/test/framework.h b/test/framework.h index 568570554..9e8357b2c 100644 --- a/test/framework.h +++ b/test/framework.h @@ -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