Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=fw32.git;a=commitdiff;h=269de849098ff80827ef5a00d74c8afa05a75f47

commit 269de849098ff80827ef5a00d74c8afa05a75f47
Author: James Buren <r...@frugalware.org>
Date:   Wed Nov 9 11:20:04 2011 -0600

fw32.c: add cp_file function

diff --git a/fw32.c b/fw32.c
index 1270888..6c54a87 100644
--- a/fw32.c
+++ b/fw32.c
@@ -133,6 +133,43 @@ args_merge(char *name,char **args1,char **args2)
}

static void
+cp_file(const char *file)
+{
+  char file2[PATH_MAX];
+  unsigned char buf[4096];
+  FILE *in, *out;
+  size_t n;
+
+  assert(file);
+
+  snprintf(file2,sizeof file2,"%s%s",FW32_ROOT,file);
+
+  in = fopen(file,"rb");
+
+  if(!in)
+    error("Failed to open %s for reading.\n",file);
+
+  out = fopen(file2,"wb");
+
+  if(!out)
+    error("Failed to open %s for writing.\n",file2);
+
+  while(true)
+  {
+    n = fread(buf,sizeof *buf,sizeof buf,in);
+
+    if(!n)
+      break;
+
+    fwrite(buf,sizeof *buf,n,out);
+  }
+
+  fclose(in);
+
+  fclose(out);
+}
+
+static void
mkdir_parents(const char *s)
{
char path[PATH_MAX], *p;
_______________________________________________
Frugalware-git mailing list
Frugalware-git@frugalware.org
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to