From 421bfb351a4909dd39f1613f3d81a035ff55b779 Mon Sep 17 00:00:00 2001 From: wollman Date: Tue, 14 May 1996 15:16:49 +0000 Subject: Accept mount(8)'s calling convention of passing just the filesystem type as argv[0]. --- sbin/mount_std/mount_std.8 | 12 ++++++++---- sbin/mount_std/mount_std.c | 20 +++++++++++++++----- 2 files changed, 23 insertions(+), 9 deletions(-) (limited to 'sbin/mount_std') diff --git a/sbin/mount_std/mount_std.8 b/sbin/mount_std/mount_std.8 index f8d22a4..15fc65e 100644 --- a/sbin/mount_std/mount_std.8 +++ b/sbin/mount_std/mount_std.8 @@ -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 diff --git a/sbin/mount_std/mount_std.c b/sbin/mount_std/mount_std.c index 5d0615a..6ca3339 100644 --- a/sbin/mount_std/mount_std.c +++ b/sbin/mount_std/mount_std.c @@ -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 @@ -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) -- cgit v1.1