- pmap->pm_prog = MOUNTPROG;
- pmap->pm_vers = 0; /* unknown */
- if (opts && (p = strstr(opts, "mountprog=")) && isdigit(*(p+10)))
- pmap->pm_prog = atoi(p+10);
- if (opts && (p = strstr(opts, "mountport=")) && isdigit(*(p+10)))
- pmap->pm_port = atoi(p+10);
- if (opts && hasmntopt(&mnt, "v2"))
- pmap->pm_vers = nfsvers_to_mnt(2);
- if (opts && hasmntopt(&mnt, "v3"))
- pmap->pm_vers = nfsvers_to_mnt(3);
- if (opts && (p = strstr(opts, "vers=")) && isdigit(*(p+5)))
- pmap->pm_vers = nfsvers_to_mnt(atoi(p+5));
- if (opts && (p = strstr(opts, "mountvers=")) && isdigit(*(p+10)))
- pmap->pm_vers = atoi(p+10);
- if (opts && (hasmntopt(&mnt, "udp")
- || hasmntopt(&mnt, "proto=udp")
- || hasmntopt(&mnt, "mountproto=udp")
- ))
- pmap->pm_prot = IPPROTO_UDP;
- if (opts && (hasmntopt(&mnt, "tcp")
- || hasmntopt(&mnt, "proto=tcp")
- || hasmntopt(&mnt, "mountproto=tcp")
- ))
- pmap->pm_prot = IPPROTO_TCP;
-
- if (!nfs_gethostbyname(hostname, &mnt_server.saddr)) {
- nfs_error(_("%s: DNS resolution of '%s' failed"),
- progname, hostname);
- goto out;
+ nfs_options2pmap(options, &nfs_pmap, &mnt_pmap);
+
+ *hostname = nfs_umount_hostname(options, *hostname);
+ if (!*hostname) {
+ nfs_error(_("%s: out of memory"), progname);
+ return EX_FAIL;