Replaced GNU test with Berkeley test
[unix-history] / sbin / mount_isofs / mount_isofs.c
CommitLineData
15637ed4
RG
1#include <stdio.h>
2#include <sys/types.h>
3#include <sys/mount.h>
4
5void
6usage ()
7{
8 fprintf (stderr, "usage: mount_iso bdev dir\n");
9 exit (1);
10}
11
12int
13main (argc, argv)
14int argc;
15char **argv;
16{
17 char *dev;
18 char *dir;
19 struct ufs_args args;
20 int c;
21 extern char *optarg;
22 extern int optind;
23 int opts;
24
25 opts = MNT_RDONLY;
26
27 while ((c = getopt (argc, argv, "F:")) != EOF) {
28 switch (c) {
29 case 'F':
30 opts |= atoi (optarg);
31 break;
32 default:
33 usage ();
34 }
35 }
36
37 if (optind + 2 != argc)
38 usage ();
39
40 dev = argv[optind];
41 dir = argv[optind + 1];
42
43 args.fspec = dev;
44 args.exflags = MNT_EXRDONLY;
45 args.exroot = 0;
46
47 if (mount (MOUNT_ISOFS, dir, MNT_RDONLY, &args) < 0) {
48 perror ("mount");
49 exit (1);
50 }
51
52 exit (0);
53}
54