test/test_physfs.c
changeset 681 451025285d35
parent 654 c0ae01de361d
child 689 204bb201498a
equal deleted inserted replaced
680:413803699662 681:451025285d35
   128     else
   128     else
   129         printf("Failure. reason: %s.\n", PHYSFS_getLastError());
   129         printf("Failure. reason: %s.\n", PHYSFS_getLastError());
   130 
   130 
   131     return(1);
   131     return(1);
   132 } /* cmd_addarchive */
   132 } /* cmd_addarchive */
       
   133 
       
   134 
       
   135 static int cmd_mount(char *args)
       
   136 {
       
   137     char *ptr;
       
   138     char *mntpoint = NULL;
       
   139     int appending = 0;
       
   140 
       
   141     if (*args == '\"')
       
   142     {
       
   143         args++;
       
   144         ptr = strchr(args, '\"');
       
   145         if (ptr == NULL)
       
   146         {
       
   147             printf("missing string terminator in argument.\n");
       
   148             return(1);
       
   149         } /* if */
       
   150         *(ptr) = '\0';
       
   151     } /* if */
       
   152     else
       
   153     {
       
   154         ptr = strchr(args, ' ');
       
   155         *ptr = '\0';
       
   156     } /* else */
       
   157 
       
   158     mntpoint = ptr + 1;
       
   159     if (*mntpoint == '\"')
       
   160     {
       
   161         mntpoint++;
       
   162         ptr = strchr(mntpoint, '\"');
       
   163         if (ptr == NULL)
       
   164         {
       
   165             printf("missing string terminator in argument.\n");
       
   166             return(1);
       
   167         } /* if */
       
   168         *(ptr) = '\0';
       
   169     } /* if */
       
   170     else
       
   171     {
       
   172         ptr = strchr(mntpoint, ' ');
       
   173         *(ptr) = '\0';
       
   174     } /* else */
       
   175     appending = atoi(ptr + 1);
       
   176 
       
   177     printf("[%s], [%s], [%d]\n", args, mntpoint, appending);
       
   178 
       
   179     if (PHYSFS_mount(args, mntpoint, appending))
       
   180         printf("Successful.\n");
       
   181     else
       
   182         printf("Failure. reason: %s.\n", PHYSFS_getLastError());
       
   183 
       
   184     return(1);
       
   185 } /* cmd_mount */
   133 
   186 
   134 
   187 
   135 static int cmd_removearchive(char *args)
   188 static int cmd_removearchive(char *args)
   136 {
   189 {
   137     if (*args == '\"')
   190     if (*args == '\"')
   886     { "q",              cmd_quit,           0, NULL                         },
   939     { "q",              cmd_quit,           0, NULL                         },
   887     { "help",           cmd_help,           0, NULL                         },
   940     { "help",           cmd_help,           0, NULL                         },
   888     { "init",           cmd_init,           1, "<argv0>"                    },
   941     { "init",           cmd_init,           1, "<argv0>"                    },
   889     { "deinit",         cmd_deinit,         0, NULL                         },
   942     { "deinit",         cmd_deinit,         0, NULL                         },
   890     { "addarchive",     cmd_addarchive,     2, "<archiveLocation> <append>" },
   943     { "addarchive",     cmd_addarchive,     2, "<archiveLocation> <append>" },
       
   944     { "mount",          cmd_mount,          3, "<archiveLocation> <mntpoint> <append>" },
   891     { "removearchive",  cmd_removearchive,  1, "<archiveLocation>"          },
   945     { "removearchive",  cmd_removearchive,  1, "<archiveLocation>"          },
   892     { "enumerate",      cmd_enumerate,      1, "<dirToEnumerate>"           },
   946     { "enumerate",      cmd_enumerate,      1, "<dirToEnumerate>"           },
   893     { "ls",             cmd_enumerate,      1, "<dirToEnumerate>"           },
   947     { "ls",             cmd_enumerate,      1, "<dirToEnumerate>"           },
   894     { "getlasterror",   cmd_getlasterror,   0, NULL                         },
   948     { "getlasterror",   cmd_getlasterror,   0, NULL                         },
   895     { "getdirsep",      cmd_getdirsep,      0, NULL                         },
   949     { "getdirsep",      cmd_getdirsep,      0, NULL                         },