# 2.11BSD#431 - /usr/src/sbin/badsect/badsect.c

##### Functions

    main              X

       1: /*
       2:  * badsect
       3:  *
       4:  * Badsect takes a list of file-system relative sector numbers
       5:  * and makes files containing the blocks of which these sectors are a part.
       6:  * It can be used to contain sectors which have problems if these sectors
       7:  * are not part of the bad file for the pack (see bad144).  For instance,
       8:  * this program can be used if the driver for the file system in question
       9:  * does not support bad block forwarding.
      10:  *
      11:  * Bugfix 930802 by Johnny Billquist
      12:  * Sanity check on sector number August 10,1993 by Steven Schultz
      13:  */
      14: #include <stdio.h>
      15: #include <stdlib.h>
      16: #include <sys/param.h>
      17: #include <sys/inode.h>
      18:
      19: main(argc, argv)
      20:     int argc;
      21:     char **argv;
      22: {
      23:     char nambuf[32];
      24:     long sector;
      25:     int errs = 0;
      26:
      27:     --argc, argv++;
      28:     while (argc > 0) {
      29:         sector = atol(*argv);
      30:         if (sector <= 0 || sector > 131071L) {
      31:             fprintf(stderr, "Sector %s <= 0 or > 131071\n",
      32:                 *argv);
      33:             continue;
      34:         }
      35:         if (mknod(*argv, IFMT, (u_short)(sector / CLSIZE)))
      36:             perror("mknod"), errs++;
      37:         argc--, argv++;
      38:     }
      39:     exit(errs);
      40: }

#### Defined functions

main defined in line 19; never used

Last modified: 1996-11-18 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 999 |