From 71da6381ad4e52638436a7436f3a54a30dc4cfff Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Sun, 13 Mar 2005 11:59:53 +0000 Subject: [PATCH] Some mount functionality stuff. --- makeos2.cmd | 1 + test/test_physfs.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/makeos2.cmd b/makeos2.cmd index 62ed085a..bc1b65e8 100644 --- a/makeos2.cmd +++ b/makeos2.cmd @@ -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 diff --git a/test/test_physfs.c b/test/test_physfs.c index 1cab696a..dca73d4b 100644 --- a/test/test_physfs.c +++ b/test/test_physfs.c @@ -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 == '\"') @@ -888,6 +941,7 @@ static const command_info commands[] = { "init", cmd_init, 1, "" }, { "deinit", cmd_deinit, 0, NULL }, { "addarchive", cmd_addarchive, 2, " " }, + { "mount", cmd_mount, 3, " " }, { "removearchive", cmd_removearchive, 1, "" }, { "enumerate", cmd_enumerate, 1, "" }, { "ls", cmd_enumerate, 1, "" },