Annotation of 42BSD/etc/rxformat.c, revision 1.1.1.1

1.1       root        1: #ifndef lint
                      2: static char sccsid[] = "@(#)rxformat.c 4.5 (Berkeley) 8/11/83";
                      3: #endif
                      4: 
                      5: #include <stdio.h>
                      6: #include <sys/file.h>
                      7: #include <errno.h>
                      8: #include <vaxuba/rxreg.h>
                      9: 
                     10: char devname[] = "/dev/rrx?a";
                     11: 
                     12: /*
                     13:  * Format RX02 floppy disks.
                     14:  */
                     15: 
                     16: main(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++;
                     28:                filarg++;
                     29:        }
                     30:        devname[8] = argv[filarg][7];
                     31:        if ((fd = open(devname, O_RDWR)) < NULL) {
                     32:                perror(devname);
                     33:                exit (0);
                     34:        }
                     35:        printf("Format %s to", argv[filarg]);
                     36:        if (idens)
                     37:                printf(" double density (y/n) ?");
                     38:        else
                     39:                printf(" single density (y/n) ?");
                     40:        if (getchar() != 'y')
                     41:                exit (0);
                     42:        /* 
                     43:         * Change the ioctl command when dkio.h has
                     44:         * been finished.
                     45:         */
                     46:        if (ioctl(fd, RXIOC_FORMAT, &idens) != NULL)
                     47:                perror(devname);
                     48:        close (fd);
                     49: }
                     50: 
                     51: usage()
                     52: {
                     53:        fprintf(stderr, "usage: rxformat [-d] /dev/rx?\n");
                     54:        exit (0);
                     55: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.