Commit | Line | Data |
---|---|---|
2f887e17 | 1 | /* rxformat.c 4.4 83/06/02 */ |
b0564e95 HS |
2 | |
3 | #include <stdio.h> | |
4 | #include <sys/file.h> | |
5 | #include <errno.h> | |
2f887e17 | 6 | #include <vaxuba/rxreg.h> |
b0564e95 | 7 | |
f2685c79 HS |
8 | char devname[] = "/dev/rrx?a"; |
9 | ||
b0564e95 | 10 | /* |
2f887e17 | 11 | * Format RX02 floppy disks. |
b0564e95 | 12 | */ |
f2685c79 | 13 | |
b0564e95 HS |
14 | main(argc, argv) |
15 | int argc; | |
16 | char *argv[]; | |
17 | { | |
18 | int fd, idens = 0, filarg = 1; | |
19 | ||
20 | if (argc < 2) | |
21 | usage(); | |
22 | if (argc == 3) { | |
23 | if (strncmp(argv[1],"-d",2) != 0) | |
24 | usage(); | |
25 | idens++; | |
f2685c79 | 26 | filarg++; |
b0564e95 | 27 | } |
f2685c79 | 28 | devname[8] = argv[filarg][7]; |
2f887e17 | 29 | if ((fd = open(devname, O_RDWR)) < NULL) { |
f2685c79 | 30 | perror(devname); |
b0564e95 HS |
31 | exit (0); |
32 | } | |
f2685c79 | 33 | printf("Format %s to", argv[filarg]); |
b0564e95 HS |
34 | if (idens) |
35 | printf(" double density (y/n) ?"); | |
36 | else | |
37 | printf(" single density (y/n) ?"); | |
38 | if (getchar() != 'y') | |
39 | exit (0); | |
f2685c79 | 40 | /* |
2f887e17 SL |
41 | * Change the ioctl command when dkio.h has |
42 | * been finished. | |
f2685c79 | 43 | */ |
b0564e95 | 44 | if (ioctl(fd, RXIOC_FORMAT, &idens) != NULL) |
f2685c79 | 45 | perror(devname); |
b0564e95 HS |
46 | close (fd); |
47 | } | |
48 | ||
49 | usage() | |
50 | { | |
51 | fprintf(stderr, "usage: rxformat [-d] /dev/rx?\n"); | |
52 | exit (0); | |
53 | } |