mount_procfs.c revision 1.1
1#include <stdio.h>
2#include <sys/types.h>
3#include <sys/mount.h>
4
5void
6usage ()
7{
8	fprintf (stderr, "usage: mount_pfs dir\n");
9	exit (1);
10}
11
12int
13main (argc, argv)
14int argc;
15char **argv;
16{
17	char *dev;
18	char *dir;
19	int c;
20	extern char *optarg;
21	extern int optind;
22	int opts;
23
24	opts = MNT_RDONLY;
25
26	while ((c = getopt (argc, argv, "F:")) != EOF) {
27		switch (c) {
28		case 'F':
29			opts |= atoi (optarg);
30			break;
31		default:
32			usage ();
33		}
34	}
35
36	if (optind + 2 != argc)
37		usage ();
38
39	dev = argv[optind];
40	dir = argv[optind + 1];
41
42	if (mount (MOUNT_PROCFS, dir, opts, (caddr_t)0) < 0) {
43		perror ("mount");
44		exit (1);
45	}
46
47	exit (0);
48}
49
50