xref: /netbsd-src/sbin/mount_msdos/mount_msdos.c (revision 4b30c543a0b21e3ba94f2c569e9a82b4fdb2075f)
1 /*
2  * Who wrote this???
3  */
4 
5 #ifndef lint
6 static char rcsid[] = "$Id: mount_msdos.c,v 1.4 1993/09/07 15:40:33 ws Exp $";
7 #endif /* not lint */
8 
9 #include <stdio.h>
10 #include <sys/types.h>
11 #include <sys/mount.h>
12 
13 char *progname;
14 
15 void
16 usage ()
17 {
18 	fprintf (stderr, "usage: %s bdev dir\n", progname);
19 	exit (1);
20 }
21 
22 int
23 main (argc, argv)
24 int argc;
25 char **argv;
26 {
27 	char *dev;
28 	char *dir;
29 	struct msdosfs_args args;
30 	int c;
31 	extern char *optarg;
32 	extern int optind;
33 	int opts;
34 
35 	progname = argv[0];
36 
37 	opts = 0;
38 
39 	while ((c = getopt (argc, argv, "F:")) != EOF) {
40 		switch (c) {
41 		case 'F':
42 			opts |= atoi (optarg);
43 			break;
44 		default:
45 			usage ();
46 		}
47 	}
48 
49 	if (optind + 2 != argc)
50 		usage ();
51 
52 	dev = argv[optind];
53 	dir = argv[optind + 1];
54 
55 	args.fspec = dev;
56 
57 	if (mount (MOUNT_MSDOS, dir, opts, &args) < 0) {
58 		perror ("mount");
59 		exit (1);
60 	}
61 
62 	exit (0);
63 }
64