16 "fitscheck is a tool to verify the checksums in a fits file.\n" 18 "Usage: fitscheck [OPTIONS] fitsfile\n" 22 " 0: in case of success\n" 23 " 1: if the file could not be opened\n" 24 " 2: if the header checksum could not be varified and\n" 25 " 3: if the header checksum is ok but the data checksum could not be verified.\n" 36 po::options_description configs(
"Fitscheck options");
38 (
"fitsfile,f", var<string>()
39 #
if BOOST_VERSION >= 104200
42 ,
"Name of FITS file")
45 po::positional_options_description p;
52 int main(
int argc,
const char** argv)
61 if (!conf.
Has(
"fitsfile"))
63 cerr <<
"Filename required." << endl;
67 const string fname = conf.
Get<
string>(
"fitsfile");
69 cout <<
"Reading '" << fname <<
"'.." << flush;
71 fits file(fname.c_str());
74 cout <<
"fits::open() failed: " << strerror(errno) <<
" [errno=" << errno <<
"]";
78 if (!file.IsHeaderOk())
80 cout <<
" header checksum could not be verified." << endl;
86 while (file.GetNextRow())
87 if (file.GetRow()<n && file.GetRow()%n==0)
92 cout <<
" data checksum could not be verified." << endl;
96 cout <<
" file ok." << endl;
void SetPrintUsage(const std::function< void(void)> &func)
T Get(const std::string &var)
void SetupConfiguration(Configuration &conf)
void SetArgumentPositions(const po::positional_options_description &desc)
virtual size_t GetNumRows() const
bool Has(const std::string &var)
int main(int argc, const char **argv)
void AddOptions(const po::options_description &opt, bool visible=true)
Commandline parsing, resource file parsing and database access.
bool DoParse(int argc, const char **argv, const std::function< void()> &func=std::function< void()>())