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