IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 31065


Ignore:
Timestamp:
Mar 27, 2011, 10:57:10 AM (15 years ago)
Author:
eugene
Message:

cleanup the CHECKSORTED option a bit: define -sorted (and -verbose) as equivalent options; move CHECKSORTED to a local variable; init VERBOSE at declaration; exit immediately when unsorted files are found if CHECKSORTED is chosen; otherwise report number of unsorted files

Location:
branches/eam_branches/ipp-20110213/Ohana/src/dvomerge
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20110213/Ohana/src/dvomerge

  • branches/eam_branches/ipp-20110213/Ohana/src/dvomerge/src/dvoverify.c

    r30615 r31065  
    1313# define DEBUG 0
    1414
    15 int VERBOSE;
     15int VERBOSE = FALSE;
     16int NNotSorted = 0;
    1617
    1718int main (int argc, char **argv) {
     
    2627  // Catalog catalog;
    2728
    28   VERBOSE = FALSE;
     29  int CHECKSORTED;
     30
    2931  if ((N = get_argument (argc, argv, "-v"))) {
    3032    VERBOSE = TRUE;
     33    remove_argument (N, &argc, argv);
     34  }
     35  if ((N = get_argument (argc, argv, "-verbose"))) {
     36    VERBOSE = TRUE;
     37    remove_argument (N, &argc, argv);
     38  }
     39  if ((N = get_argument (argc, argv, "-s"))) {
     40    CHECKSORTED = TRUE;
     41    remove_argument (N, &argc, argv);
     42  }
     43  if ((N = get_argument (argc, argv, "-sorted"))) {
     44    CHECKSORTED = TRUE;
    3145    remove_argument (N, &argc, argv);
    3246  }
     
    5064
    5165  if (argc != 2) {
    52     fprintf (stderr, "USAGE: dvoverify (catdir) [-region Rmin Rmax Dmin Dmax]\n");
    53     fprintf (stderr, "  catdir : database of interest\n");
     66    fprintf (stderr, "USAGE: dvoverify (catdir) [-region Rmin Rmax Dmin Dmax] [-v] [-s]\n\n");
     67    fprintf (stderr, "  -v : VERBOSE\n");
     68    fprintf (stderr, "  -s : checks if sorted, return error if not\n");
     69    fprintf (stderr, "  (catdir) : database of interest\n");
    5470    exit (2);
    5571  }
     
    89105  for (i = 0; i < inlist[0].Nregions; i++) {
    90106    if (!inlist[0].regions[i][0].table) continue;
    91 
    92107    if (i % 1000 == 0) fprintf (stderr, ".");
    93108
     
    109124    if (!CheckCatalogIndexes(catdir, inlist[0].filename[i], inlist[0].regions[i])){
    110125      Nbad ++;
     126    }
     127
     128    // exit immediately if any file are unsorted and we require sorted tables
     129    if (CHECKSORTED && NNotSorted) {
     130      fprintf (stderr, "ERROR: files are not sorted\n");
     131      exit (1);
    111132    }
    112133  }
     
    118139
    119140  fprintf (stderr, "SUCCESS: no files are bad\n");
     141  if (NNotSorted) {
     142    fprintf (stderr, "NOTE: %d files are not sorted\n", NNotSorted);
     143  }
    120144  exit (0);
    121145}
     
    267291    dvo_catalog_unlock (&catalog);
    268292    dvo_catalog_free (&catalog);
     293    NNotSorted++;
     294    if (VERBOSE) fprintf (stderr, "file is not sorted: %s\n", filename);
    269295    return TRUE;
    270296  }
Note: See TracChangeset for help on using the changeset viewer.