-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpcmount.c
54 lines (49 loc) · 1.18 KB
/
pcmount.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/* pcmount.c */
/* mount a floppy on /pcfs */
/* written by Joseph Poole */
static char sccsid[] = "@(#)pcmount.c 1.3 4/26/95";
#include <string.h>
#define PCFS
#include <errno.h>
#include <stdio.h>
#include <sys/mount.h>
/*
struct pc_args args = { "/dev/sf0"};
*/
struct pc_args args = {"/dev/fd0"};
main(argc, argv) int argc;
char **argv;
{
int code;
/*
if( strcmp( argv[0], "pcmount") == 0)
if( argc == 1)
mount( "pcfs", "/pcfs", M_NEWTYPE, &args);
else if( argc == 2 && (strcmp( argv[1], "-ro") == 0))
mount( "pcfs", "/pcfs", M_NEWTYPE | M_RDONLY, &args);
else
puts("usage : pcmount [-ro]");
*/
if (strcmp(argv[0], "pcmount") == 0)
{
errno = 0;
code = mount("pcfs", "/pcfs", M_NEWTYPE | M_RDONLY, &args);
if (code)
{
fprintf(stderr, "error code %d return %d ", errno, code);
perror("Floppy disk mount");
}
else
printf("Floppy disk mounted\n");
}
else
{
code = unmount("/pcfs");
if (code)
{
perror("Floppy disk unmount");
}
else
printf("Floppy disk unmounted\n");
}
}