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.2 (Berkeley) 8/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:     int i, c;
  34: 
  35:     if (argc < 2 || argc > 3)
  36:         usage();
  37:     if (argc == 3) {
  38:         if (strncmp(argv[1],"-d",2) != 0)
  39:             usage();
  40:         idens++;
  41:         filarg++;
  42:     }
  43:     devname[8] = argv[filarg][7];
  44:     if ((fd = open(devname, O_RDWR)) < 0) {
  45:         perror(devname);
  46:         exit(1);
  47:     }
  48:     if (isatty(fileno(stdin))) {
  49:         printf("Format %s to %s density (y/n)? ",
  50:             argv[filarg], idens ? "double" : "single");
  51:         i = c = getchar();
  52:         while (c != '\n' && c != EOF)
  53:             c = getchar();
  54:         if (i != 'y')
  55:             exit(0);
  56:     } else
  57:         printf("Formatting %s to %s density\n",
  58:             argv[filarg], idens ? "double" : "single");
  59:     /*
  60: 	 * Change the ioctl command when dkio.h has
  61: 	 * been finished.
  62: 	 */
  63:     if (ioctl(fd, RXIOC_FORMAT, &idens) == 0)
  64:         exit(0);
  65:     else {
  66:         perror(devname);
  67:         exit(1);
  68:     }
  69: }
  70: 
  71: usage()
  72: {
  73:     fprintf(stderr, "usage: rxformat [-d] /dev/rx?\n");
  74:     exit(1);
  75: }

Defined functions

main defined in line 28; never used
usage defined in line 71; used 2 times

Defined variables

copyright defined in line 8; never used
devname defined in line 22; used 4 times
sccsid defined in line 14; never used
Last modified: 1985-09-09
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1041
Valid CSS Valid XHTML 1.0 Strict