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.3 (Berkeley) 8/18/87";
  15: #endif not lint
  16: 
  17: #include <stdio.h>
  18: #include <sys/file.h>
  19: #include <sys/ioctl.h>
  20: #include <errno.h>
  21: #include <pdpuba/rxreg.h>
  22: 
  23: char *devname;
  24: 
  25: /*
  26:  * Format RX02 floppy disks.
  27:  */
  28: 
  29: main(argc, argv)
  30:     int argc;
  31:     char *argv[];
  32: {
  33:     int fd, filarg = 1;
  34:     int i, c;
  35: 
  36:     if (argc != 2)
  37:         usage();
  38:     devname = argv[1];
  39:     if ((fd = open(devname, O_RDWR)) < 0) {
  40:         perror(devname);
  41:         exit(1);
  42:     }
  43:     if (isatty(fileno(stdin))) {
  44:         printf("Format %s (y/n)? ", devname);
  45:         i = c = getchar();
  46:         while (c != '\n' && c != EOF)
  47:             c = getchar();
  48:         if (i != 'y')
  49:             exit(0);
  50:     } else
  51:         printf("Formatting %s\n", devname);
  52:     if (ioctl(fd, RXIOC_FORMAT) == 0)
  53:         exit(0);
  54:     else {
  55:         perror(devname);
  56:         exit(1);
  57:     }
  58: }
  59: 
  60: usage()
  61: {
  62:     fprintf(stderr, "usage: rxformat /dev/rrx??\n");
  63:     exit(1);
  64: }

Defined functions

main defined in line 29; never used
usage defined in line 60; used 1 times
  • in line 37

Defined variables

copyright defined in line 8; never used
devname defined in line 23; used 6 times
sccsid defined in line 14; never used
Last modified: 1987-08-23
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 663
Valid CSS Valid XHTML 1.0 Strict