Main.cpp 815 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #include "FetchBannedIPs.h"
  2. #include "Debug.h"
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. int main(int argc,char *argv[])
  6. {
  7. DEBUG;
  8. Debug::AddErrorHandler();
  9. try
  10. {
  11. switch (argc)
  12. {
  13. case 2:
  14. {
  15. FetchBannedIPs::ProcessOneParameter(argv[1],false);
  16. break;
  17. }
  18. case 3:
  19. {
  20. FetchBannedIPs::ProcessTwoParameters(argv[1],argv[2],false);
  21. break;
  22. }
  23. case 4:
  24. {
  25. FetchBannedIPs::ProcessThreeParameters(argv[1],argv[2],argv[3]);
  26. break;
  27. }
  28. default:
  29. {
  30. FetchBannedIPs::ShowHelpMessage();
  31. break;
  32. }
  33. }
  34. } catch(const char *error) {
  35. printf("%s in %s line %d\n",error,Debug::GetFileName(),Debug::GetLineNumber());
  36. } catch (...) {
  37. printf("Unknown error in %s line %d\n",Debug::GetFileName(),Debug::GetLineNumber());
  38. }
  39. Debug::RemoveErrorHandler();
  40. return 0;
  41. }