}
}
sprintf(pathbuf, "%s/%s", repo_path, repo_file(i)->path);
- flist_add(flist, pathbuf, contents);
+ flist_add(flist, repo_file(i)->path, pathbuf, contents);
}
repo_cleanup();
}
}
-int flist_add(struct flist *flist, const char *fname, int contents)
+int flist_add(struct flist *flist, const char *name, const char *path, int contents)
{
FILE *fp;
struct proto_file_entry fent;
return -1;
}
- if(!(fp = fopen(fname, "rb"))) {
- fprintf(stderr, "flist_add: failed to open file: %s: %s\n", fname, strerror(errno));
+ if(!(fp = fopen(path, "rb"))) {
+ fprintf(stderr, "flist_add: failed to open file: %s: %s\n", path, strerror(errno));
return -1;
}
fstat(fileno(fp), &st);
fent.size = st.st_size;
fent.mtime = st.st_mtime;
- namelen = datalen = strlen(fname);
+ namelen = datalen = strlen(name);
if(contents) {
datalen += fent.size;
}
fent.nameoffs = flist->data_sz;
fent.namelen = namelen;
dptr = flist->data + flist->data_sz;
- memcpy(dptr, fname, namelen);
+ memcpy(dptr, name, namelen);
md5_begin(&md);
if(contents) {
struct flist *flist_create(void);
void flist_destroy(struct flist *flist);
-int flist_add(struct flist *flist, const char *fname, int contents);
+int flist_add(struct flist *flist, const char *name, const char *path, int contents);
int flist_finalize(struct flist *flist);
int read_line(int s, char *buf, int bufsz);