Allow device-less mounts for things like googlefs...
Accept -o as -p; update usage text. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19872 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+14
-7
@@ -18,9 +18,11 @@ static void
|
|||||||
usage(const char *programName)
|
usage(const char *programName)
|
||||||
{
|
{
|
||||||
|
|
||||||
printf("usage: %s [-ro] [-t fstype] [-p parameter] device directory\n"
|
printf("usage: %s [-ro] [-t fstype] [-p parameter] [device] directory\n"
|
||||||
"\t-ro\tmounts the volume read-only\n"
|
"\t-ro\tmounts the volume read-only\n"
|
||||||
"\t-t\tspecifies the file system to use (defaults to automatic recognition)\n",programName);
|
"\t-t\tspecifies the file system to use (defaults to automatic recognition)\n"
|
||||||
|
"\t-p\tspecifies parameters to pass to the file system (-o also accepted)\n"
|
||||||
|
"\tif device is not specified, NULL is passed (for in-memory filesystems)\n",programName);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -29,7 +31,8 @@ int
|
|||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
const char *programName = argv[0];
|
const char *programName = argv[0];
|
||||||
const char *device, *mountPoint;
|
const char *device = NULL;
|
||||||
|
const char *mountPoint;
|
||||||
const char *parameter = NULL;
|
const char *parameter = NULL;
|
||||||
const char *fs = NULL;
|
const char *fs = NULL;
|
||||||
struct stat mountStat;
|
struct stat mountStat;
|
||||||
@@ -56,7 +59,7 @@ main(int argc, char **argv)
|
|||||||
break;
|
break;
|
||||||
fs = *++argv;
|
fs = *++argv;
|
||||||
argc--;
|
argc--;
|
||||||
} else if (!strcmp(arg, "p") && parameter == NULL) {
|
} else if ((!strcmp(arg, "p") || !strcmp(arg, "o")) && parameter == NULL) {
|
||||||
if (argc <= 1)
|
if (argc <= 1)
|
||||||
break;
|
break;
|
||||||
parameter = *++argv;
|
parameter = *++argv;
|
||||||
@@ -67,10 +70,14 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
/* check the arguments */
|
/* check the arguments */
|
||||||
|
|
||||||
device = argv[0];
|
if (argc > 1) {
|
||||||
mountPoint = argv[1];
|
device = argv[0];
|
||||||
|
argv++;
|
||||||
|
argc--;
|
||||||
|
}
|
||||||
|
mountPoint = argv[0];
|
||||||
|
|
||||||
if (device == NULL || mountPoint == NULL)
|
if (mountPoint == NULL)
|
||||||
usage(programName);
|
usage(programName);
|
||||||
|
|
||||||
if (stat(mountPoint, &mountStat) < 0) {
|
if (stat(mountPoint, &mountStat) < 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user