Accept mount(8)'s calling convention of passing just the filesystem type

as argv[0].
This commit is contained in:
Garrett Wollman 1996-05-14 15:16:49 +00:00
parent 1bccdd4ade
commit 0d0a40202c
2 changed files with 23 additions and 9 deletions

View File

@ -34,7 +34,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $Id$
.\" $Id: mount_std.8,v 1.1 1996/05/13 17:43:16 wollman Exp $
.\"
.Dd May 13, 1996
.Dt MOUNT_STD 8
@ -80,7 +80,11 @@ it was called) to determine the type of filesystem to be mounted. If
it is called by a name which does not end in
.Dq Li _ Ns Ar fsname ,
.Nm
will issue a diagnostic and return an error. The
will assume (for compatibility
with
.Xr mount 8 )
that the zeroth argument contains only the name of the filesystem type.
The
.Nm
command is normally installed with appropriate links to commands for
the distributed filesystems which can be mounted in this way;
@ -93,8 +97,8 @@ command.
.It argv[0] must end in _fsname
The
.Nm mount_std
command was called with a zero'th argument which does not specify a
filesystem type to be mounted.
command was called with a zero'th argument of
.Dq Li mount_std .
.It vfsload(%s)
.Nm
was unable to load a kernel module implementing the %s filesystem

View File

@ -43,7 +43,7 @@ char copyright[] =
#ifndef lint
static const char rcsid[] =
"$Id$";
"$Id: mount_std.c,v 1.1 1996/05/13 17:43:16 wollman Exp $";
#endif /* not lint */
#include <sys/param.h>
@ -74,11 +74,21 @@ main(argc, argv)
int ch, mntflags;
struct vfsconf *vfc;
/*
* XXX
* mount(8) calls the mount programs with an argv[0] which is
* /just/ the filesystem name. So, if there is no underscore
* in argv[0], we assume that we are being called from mount(8)
* and that argv[0] is thus the name of the filesystem type.
*/
fsname = strrchr(argv[0], '_');
if (!fsname || strcmp(fsname, "_std") == 0)
errx(EX_USAGE, "argv[0] must end in _fsname");
fsname++;
if (fsname) {
if (strcmp(fsname, "_std") == 0)
errx(EX_USAGE, "argv[0] must end in _fsname");
fsname++;
} else {
fsname = argv[0];
}
mntflags = 0;
while ((ch = getopt(argc, argv, "o:")) != EOF)