Skip to content

Commit

Permalink
Some mount functionality stuff.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Mar 13, 2005
1 parent 8786d07 commit 71da638
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
1 change: 1 addition & 0 deletions makeos2.cmd
Expand Up @@ -104,6 +104,7 @@ rem goto :dolinking
@echo "PHYSFS_writeUBE64" >> bin\physfs.def
@echo "PHYSFS_setBuffer" >> bin\physfs.def
@echo "PHYSFS_flush" >> bin\physfs.def
@echo "PHYSFS_mount" >> bin\physfs.def

@echo Building export library...
emximp -o bin/physfs.lib bin/physfs.def
Expand Down
54 changes: 54 additions & 0 deletions test/test_physfs.c
Expand Up @@ -132,6 +132,59 @@ static int cmd_addarchive(char *args)
} /* cmd_addarchive */


static int cmd_mount(char *args)
{
char *ptr;
char *mntpoint = NULL;
int appending = 0;

if (*args == '\"')
{
args++;
ptr = strchr(args, '\"');
if (ptr == NULL)
{
printf("missing string terminator in argument.\n");
return(1);
} /* if */
*(ptr) = '\0';
} /* if */
else
{
ptr = strchr(args, ' ');
*ptr = '\0';
} /* else */

mntpoint = ptr + 1;
if (*mntpoint == '\"')
{
mntpoint++;
ptr = strchr(mntpoint, '\"');
if (ptr == NULL)
{
printf("missing string terminator in argument.\n");
return(1);
} /* if */
*(ptr) = '\0';
} /* if */
else
{
ptr = strchr(mntpoint, ' ');
*(ptr) = '\0';
} /* else */
appending = atoi(ptr + 1);

printf("[%s], [%s], [%d]\n", args, mntpoint, appending);

if (PHYSFS_mount(args, mntpoint, appending))
printf("Successful.\n");
else
printf("Failure. reason: %s.\n", PHYSFS_getLastError());

return(1);
} /* cmd_mount */


static int cmd_removearchive(char *args)
{
if (*args == '\"')
Expand Down Expand Up @@ -888,6 +941,7 @@ static const command_info commands[] =
{ "init", cmd_init, 1, "<argv0>" },
{ "deinit", cmd_deinit, 0, NULL },
{ "addarchive", cmd_addarchive, 2, "<archiveLocation> <append>" },
{ "mount", cmd_mount, 3, "<archiveLocation> <mntpoint> <append>" },
{ "removearchive", cmd_removearchive, 1, "<archiveLocation>" },
{ "enumerate", cmd_enumerate, 1, "<dirToEnumerate>" },
{ "ls", cmd_enumerate, 1, "<dirToEnumerate>" },
Expand Down

0 comments on commit 71da638

Please sign in to comment.