summaryrefslogtreecommitdiffstats
path: root/utils/mount
diff options
context:
space:
mode:
authorPrem Karat <prem.karat@linux.vnet.ibm.com>2011-06-28 11:53:40 -0400
committerSteve Dickson <steved@redhat.com>2011-06-29 10:18:30 -0400
commit30ebf04700654deddbf5f57d95e84ec69cea8610 (patch)
tree746dcc19db7f5608045a6a10e3ebf5dd66c3c70d /utils/mount
parentb3e190c4adfc9ec47567c968bd000d282d07b05e (diff)
downloadnfs-utils-30ebf04700654deddbf5f57d95e84ec69cea8610.tar.gz
nfs-utils-30ebf04700654deddbf5f57d95e84ec69cea8610.tar.xz
nfs-utils-30ebf04700654deddbf5f57d95e84ec69cea8610.zip
mount.nfs: Don't hard code source and destination
Currently souce and destination parameters should be passed as first and second paramter while using mount.nfs. This patch allows them to be passed anywhere while mounting. Current functionality is mount.nfs source destn -o <options> This patch will allow to do this mount.nfs -o <options> source destn or mount.nfs -o <options> source -o <options> destn Signed-off-by: Prem Karat <prem.karat@linux.vnet.ibm.com> Signed-off-by: Steve Dickson <steved@redhat.com>
Diffstat (limited to 'utils/mount')
-rw-r--r--utils/mount/mount.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/utils/mount/mount.c b/utils/mount/mount.c
index f3f0a83..62115bb 100644
--- a/utils/mount/mount.c
+++ b/utils/mount/mount.c
@@ -374,7 +374,7 @@ static int try_mount(char *spec, char *mount_point, int flags,
int main(int argc, char *argv[])
{
int c, flags = 0, mnt_err = 1, fake = 0;
- char *spec, *mount_point, *fs_type = "nfs";
+ char *spec = NULL, *mount_point = NULL, *fs_type = "nfs";
char *extra_opts = NULL, *mount_opts = NULL;
uid_t uid = getuid();
@@ -398,9 +398,6 @@ int main(int argc, char *argv[])
exit(EX_USAGE);
}
- spec = argv[1];
- mount_point = argv[2];
-
mount_config_init(progname);
argv[2] = argv[0]; /* so that getopt error messages are correct */
@@ -447,6 +444,14 @@ int main(int argc, char *argv[])
if (optind != argc - 2) {
mount_usage();
goto out_usage;
+ } else {
+ while (optind < argc) {
+ if (!spec)
+ spec = argv[optind];
+ else
+ mount_point = argv[optind];
+ optind++;
+ }
}
if (strcmp(progname, "mount.nfs4") == 0)