1*55338Spendry /*
2*55338Spendry  * Copyright (c) 1990, 1992 Jan-Simon Pendry
3*55338Spendry  * Copyright (c) 1992 The Regents of the University of California
4*55338Spendry  * All rights reserved.
5*55338Spendry  *
6*55338Spendry  * This code is derived from software contributed to Berkeley by
7*55338Spendry  * Jan-Simon Pendry.
8*55338Spendry  *
9*55338Spendry  * %sccs.redist.c.%
10*55338Spendry  *
11*55338Spendry  *	@(#)mount_kernfs.c	5.1 (Berkeley) 07/18/92
12*55338Spendry  */
13*55338Spendry 
14*55338Spendry #include <sys/param.h>
15*55338Spendry #include <sys/mount.h>
16*55338Spendry 
17*55338Spendry #include <errno.h>
18*55338Spendry #include <unistd.h>
19*55338Spendry #include <stdio.h>
20*55338Spendry #include <stdlib.h>
21*55338Spendry #include <string.h>
22*55338Spendry 
23*55338Spendry void usage __P((void));
24*55338Spendry 
25*55338Spendry int
26*55338Spendry main(argc, argv)
27*55338Spendry 	int argc;
28*55338Spendry 	char *argv[];
29*55338Spendry {
30*55338Spendry 	int ch, mntflags;
31*55338Spendry 
32*55338Spendry 	mntflags = 0;
33*55338Spendry 	while ((ch = getopt(argc, argv, "F:")) != EOF)
34*55338Spendry 		switch(ch) {
35*55338Spendry 		case 'F':
36*55338Spendry 			mntflags = atoi(optarg);
37*55338Spendry 			break;
38*55338Spendry 		case '?':
39*55338Spendry 		default:
40*55338Spendry 			usage();
41*55338Spendry 		}
42*55338Spendry 	argc -= optind;
43*55338Spendry 	argv += optind;
44*55338Spendry 
45*55338Spendry 	if (argc != 2)
46*55338Spendry 		usage();
47*55338Spendry 
48*55338Spendry 	if (mount(MOUNT_KERNFS, argv[1], mntflags, NULL)) {
49*55338Spendry 		(void)fprintf(stderr, "mount_kernfs: %s\n", strerror(errno));
50*55338Spendry 		exit(1);
51*55338Spendry 	}
52*55338Spendry 	exit(0);
53*55338Spendry }
54*55338Spendry 
55*55338Spendry void
56*55338Spendry usage()
57*55338Spendry {
58*55338Spendry 	(void)fprintf(stderr,
59*55338Spendry 	    "usage: mount_kernfs [ -F fsoptions ] /kern mount_point\n");
60*55338Spendry 	exit(1);
61*55338Spendry }
62