xref: /csrg-svn/old/mount_lofs/mount_lofs.c (revision 61509)
154698Sbostic /*
2*61509Sbostic  * Copyright (c) 1992, 1993
3*61509Sbostic  *	The Regents of the University of California.  All rights reserved.
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*61509Sbostic  *	@(#)mount_lofs.c	8.1 (Berkeley) 06/05/93
1254698Sbostic  */
1354698Sbostic 
1454698Sbostic #include <sys/param.h>
1554698Sbostic #include <sys/mount.h>
1655026Sbostic #include <miscfs/lofs/lofs.h>
1754698Sbostic 
1854699Sbostic #include <errno.h>
1954699Sbostic #include <stdio.h>
2054699Sbostic #include <unistd.h>
2154699Sbostic #include <stdlib.h>
2254699Sbostic #include <string.h>
2354699Sbostic 
2454699Sbostic void usage __P((void));
2554699Sbostic 
2654699Sbostic int
2754699Sbostic main(argc, argv)
2854699Sbostic 	int argc;
2954699Sbostic 	char *argv[];
3054698Sbostic {
3154698Sbostic 	struct lofs_args args;
3254699Sbostic 	int ch, mntflags;
3354698Sbostic 
3454699Sbostic 	mntflags = 0;
3554699Sbostic 	while ((ch = getopt(argc, argv, "F:")) != EOF)
3654699Sbostic 		switch(ch) {
3754699Sbostic 		case 'F':
3854699Sbostic 			mntflags = atoi(optarg);
3954699Sbostic 			break;
4054699Sbostic 		case '?':
4154699Sbostic 		default:
4254699Sbostic 			usage();
4354699Sbostic 		}
4454699Sbostic 	argc -= optind;
4554699Sbostic 	argv += optind;
4654698Sbostic 
4754699Sbostic 	if (argc != 2)
4854699Sbostic 		usage();
4954698Sbostic 
5054699Sbostic 	args.target = argv[0];
5154698Sbostic 
5254699Sbostic 	if (mount(MOUNT_LOFS, argv[1], mntflags, &args)) {
5354699Sbostic 		(void)fprintf(stderr, "mount_lofs: %s\n", strerror(errno));
5454698Sbostic 		exit(1);
5554698Sbostic 	}
5654698Sbostic 	exit(0);
5754698Sbostic }
5854699Sbostic 
5954699Sbostic void
6054699Sbostic usage()
6154699Sbostic {
6254699Sbostic 	(void)fprintf(stderr,
6354699Sbostic 	    "usage: mount_lofs [ -F fsoptions ] target_fs mount_point\n");
6454699Sbostic 	exit(1);
6554699Sbostic }
66