add symlin(1)
[unix-history] / usr / src / old / mount_lofs / mount_lofs.c
CommitLineData
154a8691
KB
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 *
ad1dc908 11 * @(#)mount_lofs.c 5.3 (Berkeley) %G%
154a8691
KB
12 */
13
154a8691
KB
14#include <sys/param.h>
15#include <sys/mount.h>
ad1dc908 16#include <miscfs/lofs/lofs.h>
154a8691 17
101f5f3a
KB
18#include <errno.h>
19#include <stdio.h>
20#include <unistd.h>
21#include <stdlib.h>
22#include <string.h>
154a8691 23
101f5f3a 24void usage __P((void));
154a8691 25
101f5f3a
KB
26int
27main(argc, argv)
28 int argc;
29 char *argv[];
30{
31 struct lofs_args args;
32 int ch, mntflags;
154a8691 33
101f5f3a
KB
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;
154a8691 46
101f5f3a
KB
47 if (argc != 2)
48 usage();
154a8691 49
101f5f3a 50 args.target = argv[0];
154a8691 51
101f5f3a
KB
52 if (mount(MOUNT_LOFS, argv[1], mntflags, &args)) {
53 (void)fprintf(stderr, "mount_lofs: %s\n", strerror(errno));
154a8691
KB
54 exit(1);
55 }
56 exit(0);
57}
101f5f3a
KB
58
59void
60usage()
61{
62 (void)fprintf(stderr,
63 "usage: mount_lofs [ -F fsoptions ] target_fs mount_point\n");
64 exit(1);
65}