renamed functions

This commit is contained in:
_ 2018-04-01 23:24:14 -07:00
parent 96b2acf95c
commit 97527f549c

25
main.c
View File

@ -21,7 +21,7 @@ bool writedata(const char *basename,
return status;
}
void unpackpld(const char *buffer,
void splitpld(const char *buffer,
const struct PldHeader *ph,
const char *name,
unsigned int s) {
@ -44,7 +44,7 @@ void unpackpld(const char *buffer,
free(wbuffer);
}
void show_pldheader(struct PldHeader *x) {
void showpldh(struct PldHeader *x) {
printf("number of offsets = %i\n", x -> numOffset);
unsigned int i;
for (i = 0; i < x -> numOffset; i++) {
@ -52,7 +52,7 @@ void show_pldheader(struct PldHeader *x) {
}
}
struct PldHeader *read_pldheader(const char *buffer) {
struct PldHeader *getpldh(const char *buffer) {
if (buffer == NULL) {
return NULL;
}
@ -74,7 +74,7 @@ struct PldHeader *read_pldheader(const char *buffer) {
return ph;
}
char *readpld(const char *fname, unsigned int *s) {
char *loadfile(const char *fname, unsigned int *s) {
FILE *f = fopen(fname, "rb");
unsigned int size = 0; // number of elements to buffer;
unsigned int rcnt = 0; // number of char's read by fread(...)
@ -103,18 +103,25 @@ char *readpld(const char *fname, unsigned int *s) {
return buf;
}
int main(int argc, char ** argv) {
char *filename = argv[1];
bool unpackpld (const char *filename) {
bool status = false;
unsigned int fsize = 0;
char *filedata = readpld(filename, &fsize);
char *filedata = loadfile(filename, &fsize);
printf("fsize is %i\n", fsize);
if (filedata != NULL && fsize != 0) {
struct PldHeader *pldh = read_pldheader(filedata);
unpackpld(filedata, pldh, filename, fsize);
struct PldHeader *pldh = getpldh(filedata);
splitpld(filedata, pldh, filename, fsize);
free(pldh -> offsets);
free(pldh);
status = true;
}
free(filedata);
return status;
}
int main(int argc, char ** argv) {
char *f = argv[1];
unpackpld(f);
return 0;
}