]> git.decadent.org.uk Git - nfs-utils.git/blobdiff - utils/mount/mount.c
proper merge
[nfs-utils.git] / utils / mount / mount.c
index f3f0a8310164a02a860aa48b9ae13cfc2a1da6af..eea00afe2679f28e3e4f10ea11c0553f5f51f712 100644 (file)
@@ -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;
 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();
 
        char *extra_opts = NULL, *mount_opts = NULL;
        uid_t uid = getuid();
 
@@ -385,26 +385,14 @@ int main(int argc, char *argv[])
        if(!strncmp(progname, "umount", strlen("umount")))
                exit(nfsumount(argc, argv));
 
        if(!strncmp(progname, "umount", strlen("umount")))
                exit(nfsumount(argc, argv));
 
-       if (argv[1] && argv[1][0] == '-') {
-               if(argv[1][1] == 'V')
-                       printf("%s ("PACKAGE_STRING")\n", progname);
-               else
-                       mount_usage();
-               exit(EX_SUCCESS);
-       }
-
        if ((argc < 3)) {
                mount_usage();
                exit(EX_USAGE);
        }
 
        if ((argc < 3)) {
                mount_usage();
                exit(EX_USAGE);
        }
 
-       spec = argv[1];
-       mount_point = argv[2];
-
        mount_config_init(progname);
 
        mount_config_init(progname);
 
-       argv[2] = argv[0]; /* so that getopt error messages are correct */
-       while ((c = getopt_long(argc - 2, argv + 2, "rvVwfno:hs",
+       while ((c = getopt_long(argc, argv, "rvVwfno:hs",
                                longopts, NULL)) != -1) {
                switch (c) {
                case 'r':
                                longopts, NULL)) != -1) {
                switch (c) {
                case 'r':
@@ -447,6 +435,14 @@ int main(int argc, char *argv[])
        if (optind != argc - 2) {
                mount_usage();
                goto out_usage;
        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)
        }
 
        if (strcmp(progname, "mount.nfs4") == 0)