/* This is a Q&D utility that should be needed by very few
people--only those who have loaded LADCP databases in late
1996-early 1997 using hundredths of a second as the
directory time increment.  This fixes block files for the
newer form of indicating the use of hundredths.
*/
#include "geninc.h"
#include "dbinc.h"
#if PROTOTYPE_ALLOWED
void main(int argc, char** argv)
#else
main(argc, argv)
int argc;
char **argv;
#endif
{
   int i, n;
   FILE *fp;
   BLOCK_HDR_TYPE hdr;

   for (i = 1; i < argc; i++ )
   {
      fp = fopen(argv[i], "r+b");     /* r+b for TC, ANSI; r+ for old unix */
      if (fp == NULL)
      {
         printf("can't open %s\n", argv[i]);
         exit(-1);
      }
      n = fread(&hdr, sizeof(hdr), 1, fp);
      if (n != 1)
      {
         printf("Could not read the header.\n");
         exit(-1);
      }
      if (hdr.dir_type == 10)
      {
         printf("Dir_type was 10\n");
         hdr.dir_type = 0;
         hdr.dir_time_flag = 2;
         rewind(fp);
         n = fwrite(&hdr, sizeof(hdr), 1, fp);
         if (n != 1)
         {
            printf("Could not write the header.\n");
            exit(-1);
         }
      }
   }
}


