Changeset dff5db9 in nscp for NSClient++.cpp


Ignore:
Timestamp:
06/15/08 14:09:36 (5 years ago)
Author:
Michael Medin <michael@…>
Branches:
master, 0.4.0, 0.4.1, 0.4.2, stable
Children:
e1ef872
Parents:
8f167e8
Message:

2008-06-14 MickeM

  • Fixed error message from external commands (better reporting now)

2008-05-14 MickeM

  • Fixed memoryleak in the service checker.

I am really sorry I usualy write better code then this.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • NSClient++.cpp

    r367bf20 rdff5db9  
    2626NSClient mainClient;  // Global core instance. 
    2727bool g_bConsoleLog = false; 
    28 ////////////////////////////////////////////////////////////////////////// 
    29 // Startup code 
    30  
    31 #define XNSC_DEFINE_SETTING_KEY(name, tag) \ 
    32   name ## _SECTION \ 
    33  
    34 #define DEFINE_SETTING_S(name, section, key, value) \ 
    35   const std::wstring name ## _SECTION = section; \ 
    36   const std::wstring name = key; \ 
    37   const std::wstring name ## _DEFAULT = value; 
    38  
    39 DEFINE_SETTING_S(NSCLIENT_TEST2, NSCLIENT_SECTION_TITLE, _T("bind_to_address"), _T("")) 
    40  
    41  
    42  
    43  
    44 #define NSCLIENT_TEST _T("bind_to_address") 
    45 #define NSCLIENT_TEST_DEFAULT _T("xxx") 
    46 #define NSCLIENT_TEST_SECTION NSCLIENT_SECTION_TITLE 
    47  
    48 #define SETTINGS_KEY(key) \ 
    49   key ## _SECTION, key, key ## _DEFAULT 
    5028 
    5129/** 
     
    156134      LOG_MESSAGE(_T("Enter command to inject or exit to terminate...")); 
    157135 
    158       std::wstring str1 = Settings::getInstance()->getString(SETTINGS_KEY(NSCLIENT_TEST)); 
    159       std::wcout << str1 << std::endl; 
    160       std::wstring str2 = Settings::getInstance()->getString(SETTINGS_KEY(NSCLIENT_TEST2)); 
    161       std::wcout << str2 << std::endl; 
    162  
    163136      std::wstring s = _T(""); 
    164137      std::wstring buff = _T(""); 
     
    179152          std::wstring msg, perf; 
    180153          NSCAPI::nagiosReturn ret = mainClient.inject(t.first, t.second, ' ', true, msg, perf); 
    181           std::wcout << NSCHelper::translateReturn(ret) << _T(":"); 
    182           std::cout << strEx::wstring_to_string(msg); 
    183           if (!perf.empty()) 
    184             std::cout << "|" << strEx::wstring_to_string(perf); 
    185           std::wcout << std::endl; 
     154          if (ret == NSCAPI::returnIgnored) { 
     155            std::wcout << _T("No handler for command: ") << t.first << std::endl; 
     156          } else { 
     157            std::wcout << NSCHelper::translateReturn(ret) << _T(":"); 
     158            std::cout << strEx::wstring_to_string(msg); 
     159            if (!perf.empty()) 
     160              std::cout << "|" << strEx::wstring_to_string(perf); 
     161            std::wcout << std::endl; 
     162          } 
    186163          buff = _T(""); 
    187164        } else { 
Note: See TracChangeset for help on using the changeset viewer.