lint, KNF, fix error messages
[unix-history] / usr / src / sbin / mount_cd9660 / mount_cd9660.c
CommitLineData
0ceddef8
KM
1/*
2 * Copyright (c) 1992, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley
6 * by Pace Willisson (pace@blitz.com). The Rock Ridge Extension
7 * Support code is derived from software contributed to Berkeley
8 * by Atsushi Murai (amurai@spec.co.jp).
9 *
10 * %sccs.include.redist.c%
11 *
bfec9cd0 12 * @(#)mount_cd9660.c 8.3 (Berkeley) %G%
0ceddef8
KM
13 */
14
15#ifndef lint
16static char copyright[] =
17"@(#) Copyright (c) 1992, 1993\n\
18 The Regents of the University of California. All rights reserved.\n";
19#endif /* not lint */
20
21#ifndef lint
bfec9cd0 22static char sccsid[] = "@(#)mount_cd9660.c 8.3 (Berkeley) %G%";
0ceddef8
KM
23#endif /* not lint */
24
0ceddef8 25#include <sys/param.h>
8098f4ed 26#define CD9660
0ceddef8
KM
27#include <sys/mount.h>
28
bfec9cd0
JSP
29#include <errno.h>
30#include <stdlib.h>
31#include <stdio.h>
32#include <string.h>
33#include <unistd.h>
34
0ceddef8
KM
35#define DEFAULT_ROOTUID -2
36
37void
bfec9cd0 38usage()
0ceddef8
KM
39{
40
bfec9cd0
JSP
41 fprintf(stderr,
42 "usage: mount_cd9660 [-F fsoptions] [-norrip] [-gen] [-extattr] special node\n");
43 exit(1);
0ceddef8
KM
44}
45
46int
bfec9cd0 47main(argc, argv)
0ceddef8
KM
48 int argc;
49 char **argv;
50{
51 char *dev;
52 char *dir;
53 struct iso_args args;
bfec9cd0 54 int mntflags = 0, opts = 0;
0ceddef8
KM
55
56 argc--;
57 argv++;
58 while (argc > 2) {
59 if (!strcmp("-F", argv[0])) {
60 argc--; argv++;
61 mntflags |= atoi(argv[0]);
62 argc--; argv++;
63 } else if (!strcmp(argv[0], "-norrip")) {
64 opts |= ISOFSMNT_NORRIP;
65 argc--; argv++;
66 } else if (!strcmp(argv[0], "-gen")) {
67 opts |= ISOFSMNT_GENS;
68 argc--; argv++;
69 } else if (!strcmp(argv[0], "-extattr")) {
70 opts |= ISOFSMNT_EXTATT;
71 argc--; argv++;
72 } else if (!strcmp(argv[0], "-notrans")) {
73 opts |= ISOFSMNT_NOTRANS;
74 argc--; argv++;
75 } else
76 usage();
77 }
78
79 dev = argv[0];
80 dir = argv[1];
81
82 args.fspec = dev;
83 args.export.ex_root = DEFAULT_ROOTUID;
84 if (mntflags & MNT_RDONLY)
85 args.export.ex_flags = MNT_EXRDONLY;
86 else
87 args.export.ex_flags = 0;
88 args.flags = opts;
89
bfec9cd0
JSP
90 if (mount(MOUNT_CD9660, dir, mntflags, &args) < 0) {
91 (void)fprintf(stderr, "mount_cd9660: %s\n", strerror(errno));
92 exit(1);
0ceddef8
KM
93 }
94
bfec9cd0 95 exit(0);
0ceddef8 96}