1 2 #include <stdio.h> 3 #include <sys/file.h> 4 #include <errno.h> 5 #include "/sys/vaxuba/rxreg.h" 6 7 /* 8 * format floppy disks on RX02 9 */ 10 main(argc, argv) 11 int argc; 12 char *argv[]; 13 { 14 int fd, idens = 0, filarg = 1; 15 16 if (argc < 2) 17 usage(); 18 if (argc == 3) { 19 if (strncmp(argv[1],"-d",2) != 0) 20 usage(); 21 idens++; 22 filarg = 2; 23 } 24 if ((fd = open(argv[filarg], FRDWR, 0666)) < NULL) { 25 perror(argv[filarg]); 26 exit (0); 27 } 28 printf("Format %s to", *(argv[filarg])); 29 if (idens) 30 printf(" double density (y/n) ?"); 31 else 32 printf(" single density (y/n) ?"); 33 if (getchar() != 'y') 34 exit (0); 35 if (ioctl(fd, RXIOC_FORMAT, &idens) != NULL) 36 perror(argv[2]); 37 close (fd); 38 } 39 40 usage() 41 { 42 fprintf(stderr, "usage: rxformat [-d] /dev/rx?\n"); 43 exit (0); 44 } 45