SCCS-vsn: sbin/mount/mount.c 5.12
#endif not lint
#ifndef lint
#endif not lint
#ifndef lint
-static char sccsid[] = "@(#)mount.c 5.11 (Berkeley) %G%";
+static char sccsid[] = "@(#)mount.c 5.12 (Berkeley) %G%";
#endif not lint
#include "pathnames.h"
#include <sys/param.h>
#include <sys/file.h>
#include <sys/time.h>
#endif not lint
#include "pathnames.h"
#include <sys/param.h>
#include <sys/file.h>
#include <sys/time.h>
#include <fstab.h>
#include <errno.h>
#include <stdio.h>
#include <fstab.h>
#include <errno.h>
#include <stdio.h>
options = optarg;
break;
case 't':
options = optarg;
break;
case 't':
- if (!strcmp(optarg, "ufs")) {
- mnttype = MOUNT_UFS;
+ if (mnttype = getmnttype(optarg))
- }
- if (!strcmp(optarg, "nfs")) {
- mnttype = MOUNT_NFS;
- break;
- }
- if (!strcmp(optarg, "mfs")) {
- mnttype = MOUNT_MFS;
- break;
- }
/* fall through */
case '?':
default:
/* fall through */
case '?':
default:
/* `/' is special, it's always mounted */
if (!strcmp(fs->fs_file, "/"))
fake = 1;
/* `/' is special, it's always mounted */
if (!strcmp(fs->fs_file, "/"))
fake = 1;
+ if ((mnttype = getmnttype(fs->fs_vfstype)) == 0) {
+ fprintf(stderr,
+ "%s %s type of file system is unknown.\n",
+ "mount:", fs->fs_vfstype);
+ continue;
+ }
rval |= mountfs(fs->fs_spec, fs->fs_file,
type ? type : fs->fs_type, options, fs->fs_mntops);
}
rval |= mountfs(fs->fs_spec, fs->fs_file,
type ? type : fs->fs_type, options, fs->fs_mntops);
}
if (argc == 1) {
if (!(fs = getfsfile(*argv)) && !(fs = getfsspec(*argv))) {
fprintf(stderr,
if (argc == 1) {
if (!(fs = getfsfile(*argv)) && !(fs = getfsspec(*argv))) {
fprintf(stderr,
"mount: %s has unknown file system type.\n", *argv);
exit(1);
}
"mount: %s has unknown file system type.\n", *argv);
exit(1);
}
+ if ((mnttype = getmnttype(fs->fs_vfstype)) == 0) {
+ fprintf(stderr,
+ "mount: %s type of file system is unknown.\n",
+ fs->fs_vfstype);
+ exit(1);
+ }
exit(mountfs(fs->fs_spec, fs->fs_file,
type ? type : fs->fs_type, options, fs->fs_mntops));
}
exit(mountfs(fs->fs_spec, fs->fs_file,
type ? type : fs->fs_type, options, fs->fs_mntops));
}
+getmnttype(fstype)
+ char *fstype;
+{
+
+ if (!strcmp(fstype, "ufs"))
+ return (MOUNT_UFS);
+ if (!strcmp(fstype, "nfs"))
+ return (MOUNT_NFS);
+ if (!strcmp(fstype, "mfs"))
+ return (MOUNT_MFS);
+ return (0);
+}
+
usage()
{
fprintf(stderr, "usage: mount [-afrw]\nor mount [-frw] special | node\nor mount [-frw] special node\n");
usage()
{
fprintf(stderr, "usage: mount [-afrw]\nor mount [-frw] special | node\nor mount [-frw] special node\n");