FACT++  1.0
int main ( int  argc,
const char **  argv 
)

Definition at line 52 of file fitscheck.cc.

References Configuration::DoParse(), Configuration::Get(), fits::GetNumRows(), Configuration::Has(), PrintHelp(), PrintUsage(), Configuration::SetPrintUsage(), and SetupConfiguration().

53 {
54  Configuration conf(argv[0]);
55  conf.SetPrintUsage(PrintUsage);
56  SetupConfiguration(conf);
57 
58  if (!conf.DoParse(argc, argv, PrintHelp))
59  return -1;
60 
61  if (!conf.Has("fitsfile"))
62  {
63  cerr << "Filename required." << endl;
64  return -1;
65  }
66 
67  const string fname = conf.Get<string>("fitsfile");
68 
69  cout << "Reading '" << fname << "'.." << flush;
70 
71  fits file(fname.c_str());
72  if (!file)
73  {
74  cout << "fits::open() failed: " << strerror(errno) << " [errno=" << errno << "]";
75  return 1;
76  }
77 
78  if (!file.IsHeaderOk())
79  {
80  cout << " header checksum could not be verified." << endl;
81  return 2;
82  }
83 
84  const size_t n = file.GetNumRows()/10;
85 
86  while (file.GetNextRow())
87  if (file.GetRow()<n && file.GetRow()%n==0)
88  cout << '.' << flush;
89 
90  if (!file.IsFileOk())
91  {
92  cout << " data checksum could not be verified." << endl;
93  return 3;
94  }
95 
96  cout << " file ok." << endl;
97 
98  return 0;
99 }
void SetupConfiguration(Configuration &conf)
Definition: fitscheck.cc:34
virtual size_t GetNumRows() const
Definition: fits.h:1031
Definition: fits.h:54
void PrintUsage()
Definition: fitscheck.cc:13
Commandline parsing, resource file parsing and database access.
Definition: Configuration.h:9
void PrintHelp()
Definition: fitscheck.cc:30

+ Here is the call graph for this function: