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 13 #ifndef lint 14 static char sccsid[] = "@(#)rxformat.c 5.1 (Berkeley) 05/28/85"; 15 #endif not lint 16 17 #include <stdio.h> 18 #include <sys/file.h> 19 #include <errno.h> 20 #include <vaxuba/rxreg.h> 21 22 char devname[] = "/dev/rrx?a"; 23 24 /* 25 * Format RX02 floppy disks. 26 */ 27 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++; 40 filarg++; 41 } 42 devname[8] = argv[filarg][7]; 43 if ((fd = open(devname, O_RDWR)) < NULL) { 44 perror(devname); 45 exit (0); 46 } 47 printf("Format %s to", argv[filarg]); 48 if (idens) 49 printf(" double density (y/n) ?"); 50 else 51 printf(" single density (y/n) ?"); 52 if (getchar() != 'y') 53 exit (0); 54 /* 55 * Change the ioctl command when dkio.h has 56 * been finished. 57 */ 58 if (ioctl(fd, RXIOC_FORMAT, &idens) != NULL) 59 perror(devname); 60 close (fd); 61 } 62 63 usage() 64 { 65 fprintf(stderr, "usage: rxformat [-d] /dev/rx?\n"); 66 exit (0); 67 } 68