xref: /csrg-svn/old/mount_lofs/mount_lofs.c (revision 54699)
154698Sbostic /*
254698Sbostic  * Copyright (c) 1992 The Regents of the University of California
354698Sbostic  * Copyright (c) 1990, 1992 Jan-Simon Pendry
454698Sbostic  * All rights reserved.
554698Sbostic  *
654698Sbostic  * This code is derived from software donated to Berkeley by
754698Sbostic  * Jan-Simon Pendry.
854698Sbostic  *
954698Sbostic  * %sccs.include.redist.c%
1054698Sbostic  *
11*54699Sbostic  *	@(#)mount_lofs.c	5.2 (Berkeley) 07/05/92
1254698Sbostic  */
1354698Sbostic 
1454698Sbostic #include <sys/param.h>
1554698Sbostic #include <sys/mount.h>
1654698Sbostic #include <lofs/lofs.h>
1754698Sbostic 
18*54699Sbostic #include <errno.h>
19*54699Sbostic #include <stdio.h>
20*54699Sbostic #include <unistd.h>
21*54699Sbostic #include <stdlib.h>
22*54699Sbostic #include <string.h>
23*54699Sbostic 
24*54699Sbostic void usage __P((void));
25*54699Sbostic 
26*54699Sbostic int
27*54699Sbostic main(argc, argv)
28*54699Sbostic 	int argc;
29*54699Sbostic 	char *argv[];
3054698Sbostic {
3154698Sbostic 	struct lofs_args args;
32*54699Sbostic 	int ch, mntflags;
3354698Sbostic 
34*54699Sbostic 	mntflags = 0;
35*54699Sbostic 	while ((ch = getopt(argc, argv, "F:")) != EOF)
36*54699Sbostic 		switch(ch) {
37*54699Sbostic 		case 'F':
38*54699Sbostic 			mntflags = atoi(optarg);
39*54699Sbostic 			break;
40*54699Sbostic 		case '?':
41*54699Sbostic 		default:
42*54699Sbostic 			usage();
43*54699Sbostic 		}
44*54699Sbostic 	argc -= optind;
45*54699Sbostic 	argv += optind;
4654698Sbostic 
47*54699Sbostic 	if (argc != 2)
48*54699Sbostic 		usage();
4954698Sbostic 
50*54699Sbostic 	args.target = argv[0];
5154698Sbostic 
52*54699Sbostic 	if (mount(MOUNT_LOFS, argv[1], mntflags, &args)) {
53*54699Sbostic 		(void)fprintf(stderr, "mount_lofs: %s\n", strerror(errno));
5454698Sbostic 		exit(1);
5554698Sbostic 	}
5654698Sbostic 	exit(0);
5754698Sbostic }
58*54699Sbostic 
59*54699Sbostic void
60*54699Sbostic usage()
61*54699Sbostic {
62*54699Sbostic 	(void)fprintf(stderr,
63*54699Sbostic 	    "usage: mount_lofs [ -F fsoptions ] target_fs mount_point\n");
64*54699Sbostic 	exit(1);
65*54699Sbostic }
66