packio-simple
annotate 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 |
rev | line source |
---|---|
nuclear@2 | 1 #include <stdio.h> |
nuclear@2 | 2 #include <stdlib.h> |
nuclear@2 | 3 #include <string.h> |
nuclear@2 | 4 #include <errno.h> |
nuclear@2 | 5 #include "packio_impl.h" |
nuclear@2 | 6 |
nuclear@2 | 7 #define MAGIC "PKIOPKG1" |
nuclear@2 | 8 #define MAXNAME 255 |
nuclear@2 | 9 |
nuclear@2 | 10 struct header { |
nuclear@2 | 11 char magic[8]; |
nuclear@2 | 12 int revision; |
nuclear@2 | 13 int nfiles; |
nuclear@2 | 14 }; |
nuclear@2 | 15 |
nuclear@2 | 16 int pack_load_packfile(struct packfile *pf, const char *fname) |
nuclear@2 | 17 { |
nuclear@2 | 18 FILE *fp; |
nuclear@2 | 19 struct header *hdr; |
nuclear@2 | 20 |
nuclear@2 | 21 if(!(fp = fopen(fname, "rb"))) { |
nuclear@2 | 22 fprintf(stderr, "failed to open file %s: %s\n", fname, strerror(errno)); |
nuclear@2 | 23 return -1; |
nuclear@2 | 24 } |
nuclear@2 | 25 |
nuclear@2 | 26 } |