New stuff.
This commit is contained in:
parent
955819c03b
commit
5e31e42201
5 changed files with 1037 additions and 6 deletions
|
|
@ -3,6 +3,7 @@
|
|||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define UMOD_MAGIC 0x9FE3C5A3
|
||||
|
||||
|
|
@ -94,6 +95,8 @@ int main( int argc, char **argv )
|
|||
int32_t ndir = readindex(f);
|
||||
//printf("ndir: %d\n",ndir);
|
||||
umoddir_t *dir = calloc(ndir,sizeof(umoddir_t));
|
||||
char cwd[4096];
|
||||
getcwd(&cwd[0],4096);
|
||||
for ( int32_t i=0; i<ndir; i++ )
|
||||
{
|
||||
int32_t flen = readindex(f);
|
||||
|
|
@ -133,21 +136,23 @@ int main( int argc, char **argv )
|
|||
FILE *fout;
|
||||
// subdivide folders
|
||||
char *nxt = 0;
|
||||
//int i = 0;
|
||||
int j = 0;
|
||||
do
|
||||
{
|
||||
nxt = strchr(rpath,'\\');
|
||||
if ( nxt )
|
||||
{
|
||||
*nxt = '\0';
|
||||
//printf("path%d: %s\n",i,rpath);
|
||||
//printf("path%d: %s\n",j,rpath);
|
||||
mkdir(rpath,0755);
|
||||
chdir(rpath);
|
||||
*nxt = '/';
|
||||
rpath = nxt+1;
|
||||
}
|
||||
else
|
||||
{
|
||||
// the file itself
|
||||
chdir(cwd);
|
||||
//printf("fout: %s\n",dir[i].fname);
|
||||
printf("==== EXTRACTING %s (%u bytes) ====\n",dir[i].fname,dir[i].len);
|
||||
fout = fopen(dir[i].fname,"wb");
|
||||
|
|
@ -157,7 +162,7 @@ int main( int argc, char **argv )
|
|||
free(dat);
|
||||
fclose(fout);
|
||||
}
|
||||
//i++;
|
||||
j++;
|
||||
} while ( nxt );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue