summaryrefslogtreecommitdiff
path: root/nfs/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'nfs/main.c')
-rw-r--r--nfs/main.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/nfs/main.c b/nfs/main.c
index 17ba51d5..691d707d 100644
--- a/nfs/main.c
+++ b/nfs/main.c
@@ -197,7 +197,7 @@ static const struct argp_option startup_options[] = {
"Port for nfs operations"},
{"default-nfs-port", OPT_NFS_PORT_D,"PORT", 0,
"Port for nfs operations, if none can be found automatically"},
- {"nfs-program", OPT_NFS_PROG, "ID[.VERS]"},
+ {"nfs-program", OPT_NFS_PROG, "[ID.]VERS"},
{"pmap-port", OPT_PMAP_PORT, "SVC|PORT"},
@@ -338,6 +338,30 @@ parse_startup_opt (int key, char *arg, struct argp_state *state)
nfs_port = atoi (arg);
break;
+ case OPT_NFS_PROG:
+ {
+ const char* version = strrchr (arg, '.');
+ const char* program = NULL;
+
+ if (version != NULL)
+ {
+ program = arg;
+ version++;
+ }
+ else
+ version = arg;
+
+ nfs_version = atoi (version);
+ if (program)
+ nfs_program = atoi (program);
+
+ if (nfs_version < 2 || nfs_version > 3)
+ argp_error (state, "Invalid NFS version: %d", nfs_version);
+
+ protocol_version = nfs_version;
+ }
+ break;
+
case ARGP_KEY_ARG:
if (state->arg_num == 0)
remote_fs = arg;