packio-simple

diff src/packio.c @ 2:4767e7769c32

packio-simple has more chances to ever get done
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 09 Aug 2015 05:14:29 +0300
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/packio.c	Sun Aug 09 05:14:29 2015 +0300
     1.3 @@ -0,0 +1,26 @@
     1.4 +#include <stdio.h>
     1.5 +#include <stdlib.h>
     1.6 +#include <string.h>
     1.7 +#include <errno.h>
     1.8 +#include "packio_impl.h"
     1.9 +
    1.10 +#define MAGIC	"PKIOPKG1"
    1.11 +#define MAXNAME	255
    1.12 +
    1.13 +struct header {
    1.14 +	char magic[8];
    1.15 +	int revision;
    1.16 +	int nfiles;
    1.17 +};
    1.18 +
    1.19 +int pack_load_packfile(struct packfile *pf, const char *fname)
    1.20 +{
    1.21 +	FILE *fp;
    1.22 +	struct header *hdr;
    1.23 +
    1.24 +	if(!(fp = fopen(fname, "rb"))) {
    1.25 +		fprintf(stderr, "failed to open file %s: %s\n", fname, strerror(errno));
    1.26 +		return -1;
    1.27 +	}
    1.28 +
    1.29 +}