diff options
author | rodrigc <rodrigc@FreeBSD.org> | 2006-11-29 00:41:44 +0000 |
---|---|---|
committer | rodrigc <rodrigc@FreeBSD.org> | 2006-11-29 00:41:44 +0000 |
commit | 3b28652c82f9aedcf02bfd8cf9c95b3f60023ca8 (patch) | |
tree | 6a4a17987f1385e6f02f76b4425f946482c8f8f6 /sbin | |
parent | 59f18dfbe9c3652a764b89ec5648fec11acf566f (diff) | |
download | FreeBSD-src-3b28652c82f9aedcf02bfd8cf9c95b3f60023ca8.zip FreeBSD-src-3b28652c82f9aedcf02bfd8cf9c95b3f60023ca8.tar.gz |
Deduce the "fstype" parameter to pass to nmount() by looking at
the "_nfs" part of argv[0]. This should facilitate unifying mount_nfs
and mount_nfs4 into one binary.
MFC after: 1 month
Reviewed by: mohans
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/mount_nfs/mount_nfs.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/sbin/mount_nfs/mount_nfs.c b/sbin/mount_nfs/mount_nfs.c index aa85868..6907b27 100644 --- a/sbin/mount_nfs/mount_nfs.c +++ b/sbin/mount_nfs/mount_nfs.c @@ -253,7 +253,7 @@ main(int argc, char *argv[]) struct iovec *iov; int mntflags, altflags, num; int iovlen; - char *name, *p, *spec; + char *name, *p, *spec, *fstype; char mntpath[MAXPATHLEN]; mntflags = 0; @@ -263,6 +263,12 @@ main(int argc, char *argv[]) iov = NULL; iovlen = 0; + fstype = strrchr(argv[0], '_'); + if (fstype == NULL) + errx(EX_USAGE, "argv[0] must end in _fstype"); + + ++fstype; + while ((c = getopt(argc, argv, "23a:bcdD:g:I:iLlNo:PR:r:sTt:w:x:U")) != -1) switch (c) { @@ -461,7 +467,7 @@ main(int argc, char *argv[]) (void)checkpath(name, mntpath); build_iovec(&iov, &iovlen, "nfs_args", nfsargsp, sizeof(*nfsargsp)); - build_iovec(&iov, &iovlen, "fstype", "nfs", (size_t)-1); + build_iovec(&iov, &iovlen, "fstype", fstype, (size_t)-1); build_iovec(&iov, &iovlen, "fspath", mntpath, (size_t)-1); if (nmount(iov, iovlen, mntflags)) |