--- /dev/null
+/*
+ * Copyright (c) 2002, Robert Collins.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * A copy of the GNU General Public License can be found at
+ * http://www.gnu.org/
+ *
+ * Written by Robert Collins <rbtcollins@hotmail.com>
+ *
+ */
+
+#ifndef SETUP_INIDBBUILDERLINT_H
+#define SETUP_INIDBBUILDERLINT_H
+
+#include "IniDBBuilder.h"
+
+class IniDBBuilderLint:public IniDBBuilder
+{
+public:
+ virtual ~IniDBBuilderLint() {};
+
+ virtual void buildTimestamp (const std::string& ) {};
+ virtual void buildVersion (const std::string& ) {};
+ virtual const std::string buildMinimumVersion(const std::string &s) { return ""; }
+ virtual void buildPackage (const std::string& ) {};
+ virtual void buildPackageVersion (const std::string& ) {};
+ virtual void buildPackageSDesc (const std::string& ) {};
+ virtual void buildPackageLDesc (const std::string& ) {};
+ virtual void buildPackageInstall (const std::string&, const std::string&,
+ char *, hashType) {};
+ virtual void buildPackageSource (const std::string&, const std::string&,
+ char *, hashType) {};
+ virtual void buildPackageTrust (trusts) {};
+ virtual void buildPackageCategory (const std::string& ) {};
+ virtual void buildBeginDepends () {};
+ virtual void buildBeginBuildDepends () {};
+ virtual void buildBeginObsoletes () {};
+ virtual void buildBeginProvides () {};
+ virtual void buildBeginConflicts () {};
+ virtual void buildMessage (const std::string&, const std::string&) {};
+ virtual void buildSourceName (const std::string& ) {};
+ virtual void buildSourceNameVersion (const std::string& ) {};
+ virtual void buildPackageListNode (const std::string& ) {};
+ virtual void buildPackageListOperator (PackageSpecification::_operators const &) {};
+ virtual void buildPackageListOperatorVersion (const std::string& ) {};
+ virtual void buildPackageReplaceVersionsList (const std::string& ) {};
+ virtual void set_arch (const std::string& a) {};
+ virtual void set_release (const std::string& rel) {};
+};
+
+#endif /* SETUP_INIDBBUILDERLINT_H */
*
*/
-#include "getopt++/GetOption.h"
+#include "io_stream.h"
+#include "IniDBBuilderLint.h"
+#include "CliParseFeedback.h"
+#include "ini.h"
#include <iostream>
+#include <sstream>
+#include "LogSingleton.h"
void
show_help()
{
- std::cout << "inilint checks cygwin setup.ini files and reports any errors with" << std::endl;
- std::cout << "diagnostics" << std::endl;
+ std::cout << "inilint checks cygwin setup.ini files and reports any errors" << std::endl;
}
int
main (int argc, char **argv)
{
- if (!GetOption::GetInstance().Process (argc,argv,NULL))
+ if (argc != 2)
{
show_help();
return 1;
}
+
+ std::string inifilename = argv[1];
+
+ // Note: this only accepts absolute pathnames
+ io_stream *ini_file = io_stream::open ("file://" + inifilename, "rb", 0);
+ if (!ini_file)
+ {
+ std::cerr << "could not open " << inifilename << std::endl;
+ return 1;
+ }
+
+ CliParseFeedback feedback;
+ IniDBBuilderLint builder;
+ ini_init(ini_file, &builder, feedback);
+
+ // Note: unrecognized lines are ignored by ignore_line(), so this is currently
+ // only useful for finding where recognized lines don't fit the grammar.
+ yyparse();
+
return 0;
}