PageRenderTime 19ms CodeModel.GetById 1ms RepoModel.GetById 0ms app.codeStats 0ms

/src/chsgen/main.cpp

https://gitlab.com/github-cloud-corporation/cynara
C++ | 44 lines | 19 code | 4 blank | 21 comment | 0 complexity | dd67b1b0193e4b6a25724eac4f5fb699 MD5 | raw file
  1. /*
  2. * Copyright (c) 2015-2016 Samsung Electronics Co., Ltd All Rights Reserved
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. /**
  17. * @file src/chsgen/main.cpp
  18. * @author Pawel Wieczorek <p.wieczorek2@samsung.com>
  19. * @version 1.0
  20. * @brief A micro-tool for computing checksums for Cynara's database contents
  21. */
  22. #include <iostream>
  23. #include <new>
  24. #include <stdexcept>
  25. #include <cynara-error.h>
  26. #include <chsgen/ChecksumGenerator.h>
  27. int main(int argc, char **argv) {
  28. try {
  29. Cynara::ChecksumGenerator chsgen(argc, argv);
  30. return chsgen.run();
  31. } catch (const std::bad_alloc &) {
  32. std::cerr << "Chsgen could not allocate memory" << std::endl;
  33. return CYNARA_API_OUT_OF_MEMORY;
  34. } catch (const std::runtime_error &e) {
  35. std::cerr << e.what() << std::endl;
  36. } catch (...) {
  37. std::cerr << "Unknown exception, this is a bug in application" << std::endl;
  38. }
  39. return CYNARA_API_UNKNOWN_ERROR;
  40. }