packio
diff src/packio.c @ 1:a5728bc6a02f
moving along
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Fri, 09 Jan 2015 02:31:29 +0200 |
parents | a71bd70c1014 |
children |
line diff
1.1 --- a/src/packio.c Sat Jan 03 15:29:05 2015 +0200 1.2 +++ b/src/packio.c Fri Jan 09 02:31:29 2015 +0200 1.3 @@ -1,6 +1,25 @@ 1.4 #include <stdio.h> 1.5 +#include <stdlib.h> 1.6 #include "packio.h" 1.7 +#include "packio_types.h" 1.8 +#include "logger.h" 1.9 +#include "pathmap.h" 1.10 1.11 -int pkio_fopen(const char *path) 1.12 + 1.13 +PKIO_FILE *pkio_fopen(const char *path, const char *mode) 1.14 { 1.15 + struct pkio_file *file; 1.16 + FILE *fp; 1.17 + const char *fname = pkio_pathmap(path); 1.18 + 1.19 + if((fp = fopen(fname, mode))) { 1.20 + if(!(file = calloc(1, sizeof *file))) { 1.21 + pkio_logmsg("%s: failed to allocate file structure\n", __FUNCTION__); 1.22 + return 0; 1.23 + } 1.24 + file->fp = fp; 1.25 + file->in_archive = 0; 1.26 + } 1.27 + 1.28 + return 0; /* TODO */ 1.29 }