summaryrefslogtreecommitdiffstats
path: root/commands
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2012-09-05 12:59:29 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2012-09-05 12:59:29 +0200
commit40126ad7f81a115accc3297daf8383d7722a9e70 (patch)
tree53038120353aceecc2c94e0f21138da5f93aabf8 /commands
parente141988898ffbef75e8c525347023d5941f7baad (diff)
parent94fd74dda7d905b37b61310ebd7281891d718241 (diff)
downloadbarebox-40126ad7f81a115accc3297daf8383d7722a9e70.tar.gz
barebox-40126ad7f81a115accc3297daf8383d7722a9e70.tar.xz
Merge branch 'for-next/fs'
Diffstat (limited to 'commands')
-rw-r--r--commands/mount.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/commands/mount.c b/commands/mount.c
index b32faef709..5b12ad4d96 100644
--- a/commands/mount.c
+++ b/commands/mount.c
@@ -29,11 +29,14 @@
#include <command.h>
#include <fs.h>
#include <errno.h>
+#include <getopt.h>
static int do_mount(int argc, char *argv[])
{
+ int opt;
int ret = 0;
struct fs_device_d *fsdev;
+ char *type = NULL;
if (argc == 1) {
for_each_fs_device(fsdev) {
@@ -45,10 +48,18 @@ static int do_mount(int argc, char *argv[])
return 0;
}
- if (argc != 4)
+ while ((opt = getopt(argc, argv, "t:")) > 0) {
+ switch (opt) {
+ case 't':
+ type = optarg;
+ break;
+ }
+ }
+
+ if (argc < optind + 2)
return COMMAND_ERROR_USAGE;
- if ((ret = mount(argv[1], argv[2], argv[3]))) {
+ if ((ret = mount(argv[optind], type, argv[optind + 1]))) {
perror("mount");
return 1;
}
@@ -56,8 +67,9 @@ static int do_mount(int argc, char *argv[])
}
BAREBOX_CMD_HELP_START(mount)
-BAREBOX_CMD_HELP_USAGE("mount [<device> <fstype> <mountpoint>]\n")
+BAREBOX_CMD_HELP_USAGE("mount [[-t <fstype] <device> <mountpoint>]\n")
BAREBOX_CMD_HELP_SHORT("Mount a filesystem of a given type to a mountpoint.\n")
+BAREBOX_CMD_HELP_SHORT("If no fstpye is specified detected it.\n")
BAREBOX_CMD_HELP_SHORT("If no argument is given, list mounted filesystems.\n")
BAREBOX_CMD_HELP_END