X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Usermode%2FApplications%2Fmount_src%2Fmain.c;h=a272214e365fdd86688d48e0f9af8d2e64e7717c;hb=6e70970166702d1cdc8e25c096167e0d80ba38c9;hp=16081088a5c727c2c5517ae3817c53e519ece8fa;hpb=775bf8013abe9fe4ef3d4883ea2e43bba2a84da1;p=tpg%2Facess2.git diff --git a/Usermode/Applications/mount_src/main.c b/Usermode/Applications/mount_src/main.c index 16081088..a272214e 100644 --- a/Usermode/Applications/mount_src/main.c +++ b/Usermode/Applications/mount_src/main.c @@ -6,10 +6,10 @@ #include #define MOUNTABLE_FILE "/Acess/Conf/Mountable" -#define MOUNTED_FILE "/Devices/System/VFS/Mounts" +#define MOUNTED_FILE "/Devices/system/VFS/Mounts" // === PROTOTYPES === -void ShowUsage(); +void ShowUsage(char *ProgName); int GetMountDefs(char *Ident, char **spDevice, char **spDir, char **spType, char **spOptions); // === CODE === @@ -27,8 +27,21 @@ int main(int argc, char *argv[]) char *sDir = NULL; char *sOptions = NULL; + // List mounted filesystems + // - This is cheating, isn't it? + if(argc == 1) { + // Dump the contents of /Devices/system/VFS/Mounts + FILE *fp = fopen(MOUNTED_FILE, "r"); + char buf[1024]; + int len; + while( (len = fread(buf, 1024, 1, fp)) ) + fwrite(buf, len, 1, stdout); + printf("\n"); + return 0; + } + if(argc < 3) { - ShowUsage(); + ShowUsage(argv[0]); return EXIT_FAILURE; } @@ -43,6 +56,7 @@ int main(int argc, char *argv[]) { // -t :: Filesystem driver to use case 't': sType = argv[++i]; break; + case 'o': sOptions = argv[++i]; break; case '-': //TODO: Long Arguments default: @@ -100,10 +114,10 @@ int main(int argc, char *argv[]) else { // Check that we were passed a filesystem type - if(sType == NULL) { - fprintf(stderr, "Please pass a filesystem type\n"); - return EXIT_FAILURE; - } +// if(sType == NULL) { +// fprintf(stderr, "Please pass a filesystem type\n"); +// return EXIT_FAILURE; +// } } // Check Device @@ -126,17 +140,21 @@ int main(int argc, char *argv[]) if(sOptions == NULL) sOptions = ""; // Let's Mount! - _SysMount(sDevice, sDir, sType, sOptions); + if( _SysMount(sDevice, sDir, sType, sOptions) ) { + if( !sType ) + fprintf(stderr, "Filesystem autodetection failed, please pass a type\n"); + } return 0; } void ShowUsage(char *ProgName) { - fprintf(stderr, "Usage:\n", ProgName); - fprintf(stderr, " %s [-t ] \n"); - fprintf(stderr, "or %s \n"); - fprintf(stderr, "or %s \n"); + fprintf(stderr, "Usage:\n"); + fprintf(stderr, " %s [-t ] [-o ]\n", ProgName); + fprintf(stderr, "or %s \n", ProgName); + fprintf(stderr, "or %s \n", ProgName); + fprintf(stderr, "or %s\n", ProgName); } /**