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