Commit | Line | Data |
---|---|---|
8c5eec2f DF |
1 | /* |
2 | * Copyright (c) 1980 Regents of the University of California. | |
3 | * All rights reserved. The Berkeley software License Agreement | |
4 | * specifies the terms and conditions for redistribution. | |
5 | */ | |
6 | ||
7 | #ifndef lint | |
8 | char copyright[] = | |
9 | "@(#) Copyright (c) 1980 Regents of the University of California.\n\ | |
10 | All rights reserved.\n"; | |
11 | #endif not lint | |
12 | ||
524aa063 | 13 | #ifndef lint |
8c5eec2f DF |
14 | static char sccsid[] = "@(#)rxformat.c 5.1 (Berkeley) %G%"; |
15 | #endif not lint | |
b0564e95 HS |
16 | |
17 | #include <stdio.h> | |
18 | #include <sys/file.h> | |
19 | #include <errno.h> | |
2f887e17 | 20 | #include <vaxuba/rxreg.h> |
b0564e95 | 21 | |
f2685c79 HS |
22 | char devname[] = "/dev/rrx?a"; |
23 | ||
b0564e95 | 24 | /* |
2f887e17 | 25 | * Format RX02 floppy disks. |
b0564e95 | 26 | */ |
f2685c79 | 27 | |
b0564e95 HS |
28 | main(argc, argv) |
29 | int argc; | |
30 | char *argv[]; | |
31 | { | |
32 | int fd, idens = 0, filarg = 1; | |
33 | ||
34 | if (argc < 2) | |
35 | usage(); | |
36 | if (argc == 3) { | |
37 | if (strncmp(argv[1],"-d",2) != 0) | |
38 | usage(); | |
39 | idens++; | |
f2685c79 | 40 | filarg++; |
b0564e95 | 41 | } |
f2685c79 | 42 | devname[8] = argv[filarg][7]; |
2f887e17 | 43 | if ((fd = open(devname, O_RDWR)) < NULL) { |
f2685c79 | 44 | perror(devname); |
b0564e95 HS |
45 | exit (0); |
46 | } | |
f2685c79 | 47 | printf("Format %s to", argv[filarg]); |
b0564e95 HS |
48 | if (idens) |
49 | printf(" double density (y/n) ?"); | |
50 | else | |
51 | printf(" single density (y/n) ?"); | |
52 | if (getchar() != 'y') | |
53 | exit (0); | |
f2685c79 | 54 | /* |
2f887e17 SL |
55 | * Change the ioctl command when dkio.h has |
56 | * been finished. | |
f2685c79 | 57 | */ |
b0564e95 | 58 | if (ioctl(fd, RXIOC_FORMAT, &idens) != NULL) |
f2685c79 | 59 | perror(devname); |
b0564e95 HS |
60 | close (fd); |
61 | } | |
62 | ||
63 | usage() | |
64 | { | |
65 | fprintf(stderr, "usage: rxformat [-d] /dev/rx?\n"); | |
66 | exit (0); | |
67 | } |