summaryrefslogtreecommitdiff
path: root/cat
diff options
context:
space:
mode:
Diffstat (limited to 'cat')
-rw-r--r--cat/test/main.c23
-rw-r--r--cat/test/test.h2
2 files changed, 25 insertions, 0 deletions
diff --git a/cat/test/main.c b/cat/test/main.c
index d96a64a2..649e0099 100644
--- a/cat/test/main.c
+++ b/cat/test/main.c
@@ -2203,6 +2203,29 @@ extract_reference_file(const char *name)
fclose(in);
}
+void
+copy_reference_file(const char *name)
+{
+ char buff[1024];
+ FILE *in, *out;
+ size_t rbytes;
+
+ sprintf(buff, "%s/%s", refdir, name);
+ in = fopen(buff, "rb");
+ failure("Couldn't open reference file %s", buff);
+ assert(in != NULL);
+ if (in == NULL)
+ return;
+ /* Now, decode the rest and write it. */
+ /* Not a lot of error checking here; the input better be right. */
+ out = fopen(name, "wb");
+ while ((rbytes = fread(buff, 1, sizeof(buff), in)) > 0) {
+ fwrite(buff, 1, rbytes, out);
+ }
+ fclose(out);
+ fclose(in);
+}
+
int
is_LargeInode(const char *file)
{
diff --git a/cat/test/test.h b/cat/test/test.h
index 74332195..fa3e9c57 100644
--- a/cat/test/test.h
+++ b/cat/test/test.h
@@ -305,6 +305,8 @@ char *slurpfile(size_t *, const char *fmt, ...);
/* Extracts named reference file to the current directory. */
void extract_reference_file(const char *);
+/* Copies named reference file to the current directory. */
+void copy_reference_file(const char *);
/* Path to working directory for current test */
extern const char *testworkdir;