Changeset 9661f81 in nscp
- Timestamp:
- 05/10/10 22:17:31 (3 years ago)
- Branches:
- master, 0.4.0, 0.4.1, 0.4.2, stable
- Children:
- f40d813
- Parents:
- d1029bd
- Files:
-
- 10 added
- 17 edited
-
AutoBuild.h (modified) (1 diff)
-
Jamroot (modified) (5 diffs)
-
NSC.dist (modified) (2 diffs)
-
NSClient++.cpp (modified) (1 diff)
-
changelog (modified) (2 diffs)
-
helpers/installer/Product.wxs (modified) (2 diffs)
-
helpers/installer_dll_fw/firewall.cpp (modified) (1 diff)
-
include/config.h (modified) (1 diff)
-
include/parsers/ast.cpp (modified) (9 diffs)
-
include/parsers/ast.hpp (modified) (1 diff)
-
include/parsers/eval.hpp (modified) (4 diffs)
-
include/parsers/where.cpp (modified) (6 diffs)
-
include/parsers/where.hpp (modified) (1 diff)
-
include/pdh/enumerations.hpp (modified) (1 diff)
-
modules/CheckExternalScripts/CheckExternalScripts.cpp (modified) (2 diffs)
-
modules/CheckExternalScripts/CheckExternalScripts.h (modified) (2 diffs)
-
modules/CheckSystem/CheckSystem.cpp (modified) (2 diffs)
-
scripts/check_60s.bat (added)
-
scripts/check_battery.vbs (added)
-
scripts/check_no_rdp.bat (added)
-
scripts/check_ok.bat (added)
-
scripts/check_printer.vbs (added)
-
scripts/check_test.bat (added)
-
scripts/check_test.ps1 (added)
-
scripts/check_test.vbs (added)
-
scripts/lib/NagiosPlugins.vbs (added)
-
scripts/lib/wrapper.vbs (added)
Legend:
- Unmodified
- Added
- Removed
-
AutoBuild.h
rd1029bd r9661f81 3 3 // change the FALSE to TRUE for autoincrement of build number 4 4 #define INCREMENT_VERSION TRUE 5 #define FILEVER 0,3,8, 466 #define PRODUCTVER 0,3,8, 467 #define STRFILEVER _T("0.3.8. 46")8 #define STRPRODUCTVER _T("0.3.8. 46")9 #define STRPRODUCTDATE _T("2010-0 4-21")5 #define FILEVER 0,3,8,64 6 #define PRODUCTVER 0,3,8,64 7 #define STRFILEVER _T("0.3.8.64") 8 #define STRPRODUCTVER _T("0.3.8.64") 9 #define STRPRODUCTDATE _T("2010-05-10") 10 10 #endif // AUTOBUILD_H -
Jamroot
r9bb220f r9661f81 182 182 ; 183 183 local all-scripts-lst ; 184 all-script-libs = 185 [ MATCH .*scripts/lib/(.+\\..*) : [ glob scripts/lib/* ] ] 186 ; 187 local all-script-libs-lst ; 184 188 if $(toolset) = "msvc" { 185 189 if ! ( [ bjam/lua.isEnabled ] = true ) { … … 229 233 all-scripts-lst = $(all-scripts-lst) scripts/$(l) ; 230 234 } 235 for local l in $(all-script-libs) { 236 all-script-libs-lst = $(all-script-libs-lst) scripts/lib/$(l) ; 237 } 231 238 } else { 232 239 all-installers = … … 265 272 explicit all-scripts-targets ; 266 273 274 alias all-script-libs-targets : $(all-script-libs-lst) ; 275 explicit all-script-libs-targets ; 276 267 277 alias all-root-targets : $(target) $(target-config) $(target-readme) $(target-guide) $(target-refman) $(target-license) $(target-changelog) $(target-counters) helpers/systray_helper ; 268 278 explicit all-root-targets ; … … 307 317 return <location>$(BOOST_STAGE_LOCATE)/$(tag)/binaries/scripts ; 308 318 } 319 rule generate-script-libs-location ( properties * ) 320 { 321 local tag = [ get-root-prefix $(properties) ] ; 322 return <location>$(BOOST_STAGE_LOCATE)/$(tag)/binaries/scripts/lib ; 323 } 309 324 rule generate-module-location ( properties * ) 310 325 { … … 325 340 explicit dist-scripts ; 326 341 327 alias build-binaries : dist dist-modules dist-helpers dist-scripts ; 342 install dist-script-libs : all-script-libs-targets : <conditional>@generate-script-libs-location ; 343 explicit dist-script-libs ; 344 345 alias build-binaries : dist dist-modules dist-helpers dist-scripts dist-script-libs ; 328 346 explicit build-binaries ; 329 347 -
NSC.dist
r42ff14d r9661f81 184 184 ;script_dir=c:\my\script\dir 185 185 186 [Script Wrappings] 187 vbs=cscript.exe //T:30 //NoLogo scripts\lib\wrapper.vbs %SCRIPT% %ARGS% 188 ps1=cmd /c echo scripts\%SCRIPT% %ARGS%; exit($lastexitcode) | powershell.exe -command - 189 bat=scripts\%SCRIPT% %ARGS% 190 186 191 [External Scripts] 187 192 ;check_es_long=scripts\long.bat … … 202 207 alias_file_size=checkFile2 filter=out "file=$ARG1$" filter-size=>$ARG2$ MaxWarn=1 MaxCrit=1 "syntax=%filename% %size%" 203 208 alias_file_size_in_dir=checkFile2 filter=out pattern=*.txt "file=$ARG1$" filter-size=>$ARG2$ MaxWarn=1 MaxCrit=1 "syntax=%filename% %size%" 204 alias_event_log=CheckEventLog file=application file=system filter=new filter=out MaxWarn=1 MaxCrit=1 filter-generated=>2d filter-severity==success filter-severity==informational truncate=1023 unique descriptions "syntax=%severity%: %source%: %message% (%count%)" 205 alias_event_log2=CheckEventLog file=application file=system filter=new filter=in MaxWarn=1 MaxCrit=1 filter+generated=<2d "filter+eventSource==Service Control Manager" filter+severity==error truncate=1023 unique descriptions "syntax=%severity%: %source%: %message% (%count%)" 209 alias_event_log_old=CheckEventLog file=application file=system filter=new filter=out MaxWarn=1 MaxCrit=1 filter-generated=>2d filter-severity==success filter-severity==informational truncate=800 unique descriptions "syntax=%severity%: %source%: %message% (%count%)" 210 alias_event_log_new=CheckEventLog file=application file=system MaxWarn=1 MaxCrit=1 "filter=generated gt -2d AND severity NOT IN ('success', 'informational')" truncate=800 unique descriptions "syntax=%severity%: %source%: %message% (%count%)" 211 alias_event_log=alias_event_log_new 212 206 213 check_ok=CheckOK Everything is fine! 207 214 215 [Wrapped Scripts] 216 ;check_test_vbs=check_test.vbs /arg1:1 /arg2:1 /variable:1 217 ;check_test_ps1=check_test.ps1 arg1 arg2 218 ;check_test_bat=check_test.bat arg1 arg2 219 ;check_battery=check_battery.vbs 220 ;check_printer=check_printer.vbs 208 221 209 222 -
NSClient++.cpp
r5b10435 r9661f81 408 408 } else if ( _wcsicmp( _T("noboot"), argv[1]+1 ) == 0 ) { 409 409 g_bConsoleLog = true; 410 mainClient.enableDebug(false); 411 mainClient.initCore(false); 412 int nRetCode = -1; 413 if (argc>=4) 414 nRetCode = mainClient.commandLineExec(argv[2], argv[3], argc-4, &argv[4]); 415 else if (argc>=3) 416 nRetCode = mainClient.commandLineExec(argv[2], argv[3], 0, NULL); 417 mainClient.exitCore(false); 410 try { 411 mainClient.enableDebug(false); 412 mainClient.initCore(false); 413 int nRetCode = -1; 414 if (argc>=4) 415 nRetCode = mainClient.commandLineExec(argv[2], argv[3], argc-4, &argv[4]); 416 else if (argc>=3) 417 nRetCode = mainClient.commandLineExec(argv[2], argv[3], 0, NULL); 418 else 419 std::wcerr << _T("No arguments specified...") << std::endl; 420 mainClient.exitCore(false); 421 } catch (...) { 422 std::wcerr << _T("Unknown error...") << std::endl; 423 } 418 424 return nRetCode; 419 425 } else if ( _wcsicmp( _T("svc"), argv[1]+1 ) == 0 ) { -
changelog
rd1029bd r9661f81 6 6 * Fix depend onservice LanManWorkStation (old win) 7 7 * Fix RtlStringFromGUID problem on NT4 8 9 2010-05-10 MickeM - 0.3.8 RC2 10 * Fixed issue with listpdh and debugpdh (not works again) 11 + Fixed issue and added support for IN ( ... ) and NOT IN ( ... ) operators (CheckEventLog) 12 13 2010-05-08 MickeM 14 + Added new "script templating" thing to simplify adding scripts: 15 Two new sections: [Script Wrappings] for adding templates and [Wrapped Scripts] for adding the scripts. 16 %SCRIPT% is replaced with the script name 17 %ARGS% is replaced with arguments. 18 vbs=cscript.exe //T:30 //NoLogo scripts\wrapper.vbs %SCRIPT% %ARGS% 19 and 20 w_vbs=check_test.vbs /arg1:1 /arg2:1 /variable:1 21 is the same as: 22 w_vbs=cscript.exe //T:30 //NoLogo scripts\wrapper.vbs check_test.vbs /arg1:1 /arg2:1 /variable:1 23 * Added correct syntax for VB scripts 24 * Added correct syntax for powershell scripts 25 * Cleaned up scripts folder 26 + Added new "NagiosPlugin library" from op5 27 + Added check_no_rdp.vbs (Checks that no RDP connection is online) 28 + Added check_battery.vbs which checks batterys via WMI 29 + Added check_printer.vbs to check printers via WMI 8 30 9 31 2010-04-21 MickeM - 0.3.8 RC1 … … 66 88 67 89 2010-02-26 MickeM 68 * Changed fo missing files and such generate an error90 * Changed so missing files and such generate an error 69 91 * Added option to return error messages to the client [CheckDisk] show_errors=1 (defauilt is off 0) 70 92 * Added warning message ewhen numerical filters evaluate to zero (and are not 0) -
helpers/installer/Product.wxs
r3d782f8 r9661f81 150 150 </Component> 151 151 </Directory> 152 <Directory Id="INSTALLLOCATION_SCRIPTS" Name="scripts"> 153 <Component Id="Scripts" Guid="9B490E67-5472-4267-96DC-$(var.Postfix.GUID)" Win64="$(var.Win64)"> 154 <File Id="scriptargs.bat" Name="args.bat" LongName="args.bat" DiskId="1" Source="$(var.Source)/scripts/args.bat" Vital="no" /> 155 <File Id="scriptcheck_vb.vbs" Name="check_vb.vbs" LongName="check_vb.vbs" DiskId="1" Source="$(var.Source)/scripts/check_vb.vbs" Vital="no" /> 156 <File Id="scriptcritical.bat" Name="critical.bat" LongName="critical.bat" DiskId="1" Source="$(var.Source)/scripts/critical.bat" Vital="no" /> 157 <File Id="scriptmulti_line.bat" Name="mline.bat" LongName="multi_line.bat" DiskId="1" Source="$(var.Source)/scripts/multi_line.bat" Vital="no" /> 158 <File Id="scriptok.bat" Name="ok.bat" LongName="ok.bat" DiskId="1" Source="$(var.Source)/scripts/ok.bat" Vital="no" /> 159 <File Id="scriptpowershell.ps1" Name="pwrshell.ps1" LongName="powershell.ps1" DiskId="1" Source="$(var.Source)/scripts/powershell.ps1" Vital="no" /> 160 <File Id="scripttest.lua" Name="test.lua" LongName="test.lua" DiskId="1" Source="$(var.Source)/scripts/test.lua" Vital="no" /> 161 </Component> 152 <Directory Id="INSTALLLOCATION_SCRIPTS" Name="scripts"> 153 <Component Id="Scripts" Guid="9B490E67-5472-4268-96DF-$(var.Postfix.GUID)" Win64="$(var.Win64)"> 154 <File Id="script001" Name="c_60s.bat" LongName="check_60s.bat" DiskId="1" Source="$(var.Source)/scripts/check_60s.bat" Vital="no" /> 155 <File Id="script002" Name="c_btry.vbs" LongName="check_battery.vbs" DiskId="1" Source="$(var.Source)/scripts/check_battery.vbs" Vital="no" /> 156 <File Id="script003" Name="c_nrdb.bat" LongName="check_no_rdp.bat" DiskId="1" Source="$(var.Source)/scripts/check_no_rdp.bat" Vital="no" /> 157 <File Id="script004" Name="c_prt.vbs" LongName="check_printer.vbs" DiskId="1" Source="$(var.Source)/scripts/check_printer.vbs" Vital="no" /> 158 <File Id="script005" Name="c_ok.bat" LongName="check_ok.bat" DiskId="1" Source="$(var.Source)/scripts/check_ok.bat" Vital="no" /> 159 <File Id="sample001" Name="c_test.bat" LongName="check_test.bat" DiskId="1" Source="$(var.Source)/scripts/check_test.bat" Vital="no" /> 160 <File Id="sample002" Name="c_test.ps1" LongName="check_test.ps1" DiskId="1" Source="$(var.Source)/scripts/check_test.ps1" Vital="no" /> 161 <File Id="sample003" Name="c_test.vbs" LongName="check_test.vbs" DiskId="1" Source="$(var.Source)/scripts/check_test.vbs" Vital="no" /> 162 <File Id="lua001" Name="test.lua" LongName="test.lua" DiskId="1" Source="$(var.Source)/scripts/test.lua" Vital="no" /> 163 </Component> 164 <Directory Id="INSTALLLOCATION_SCRIPTS_LIB" Name="lib"> 165 <Component Id="ScriptLibs" Guid="9B490E67-5472-4267-96DF-$(var.Postfix.GUID)" Win64="$(var.Win64)"> 166 <File Id="lib001" Name="nagplug.vbs" LongName="NagiosPlugins.vbs" DiskId="1" Source="$(var.Source)/scripts/lib/NagiosPlugins.vbs" Vital="no" /> 167 <File Id="lib002" Name="wrapper.vbs" LongName="wrapper.vbs" DiskId="1" Source="$(var.Source)/scripts/lib/wrapper.vbs" Vital="no" /> 168 </Component> 169 </Directory> 162 170 </Directory> 163 171 </Directory> … … 200 208 <Feature Id="SampleScripts" Title="Sample Scripts" Description="Some sample client-side scripts to use with NRPE" Level="1" Absent="disallow"> 201 209 <ComponentRef Id="Scripts" /> 202 </Feature> 210 <ComponentRef Id="ScriptLibs" /> 211 </Feature> 203 212 </Feature> 204 213 </Feature> -
helpers/installer_dll_fw/firewall.cpp
r8170e81 r9661f81 443 443 case msi_helper::WCA_TODO_INSTALL: 444 444 case msi_helper::WCA_TODO_REINSTALL: 445 h.logMessage(_T("Installing firewall exception: ") + name + _T(", ") + file); 446 AddApplicationException(file, name, remote_addr, fIgnoreFailures); 445 try { 446 h.logMessage(_T("Installing firewall exception: ") + name + _T(", ") + file); 447 AddApplicationException(file, name, remote_addr, fIgnoreFailures); 448 } catch (installer_exception &e) { 449 h.logMessage(_T("Failed to install firewall exception: ") + name + _T(", ") + e.what()); 450 } catch (...) { 451 h.logMessage(_T("Failed to install firewall exception: ") + name); 452 } 447 453 break; 448 454 449 455 case msi_helper::WCA_TODO_UNINSTALL: 450 456 h.logMessage(_T("Uninstalling firewall exception: ") + name + _T(", ") + file); 451 RemoveApplicationException(file, fIgnoreFailures); 457 try { 458 RemoveApplicationException(file, fIgnoreFailures); 459 } catch (installer_exception &e) { 460 h.logMessage(_T("Failed to un-install firewall exception: ") + name + _T(", ") + e.what()); 461 } catch (...) { 462 h.logMessage(_T("Failed to un-install firewall exception: ") + name); 463 } 452 464 break; 453 465 default: -
include/config.h
r9bb220f r9661f81 117 117 #define EXTSCRIPT_ALIAS_SECTION_TITLE _T("External Alias") 118 118 #define EXTSCRIPT_SETTINGS_TIMEOUT _T("command_timeout") 119 #define EXTSCRIPT_WRAPPINGS_SECTION_TITLE _T("Script Wrappings") 120 #define EXTSCRIPT_WRAPPED_SCRIPT_SECTION_TITLE _T("Wrapped Scripts") 119 121 #define EXTSCRIPT_SETTINGS_TIMEOUT_DEFAULT 60 120 122 #define EXTSCRIPT_SETTINGS_ALLOW_ARGUMENTS _T("allow_arguments") -
include/parsers/ast.cpp
redf0848 r9661f81 73 73 74 74 bool operator()(binary_op<THandler> & expr) { 75 //std::wcout << "force_bin_op" << std::endl; 75 76 expr.left.force_type(type); 76 77 expr.right.force_type(type); … … 78 79 } 79 80 bool operator()(unary_op<THandler> & expr) { 81 //std::wcout << "force_un_op" << std::endl; 80 82 expr.subject.force_type(type); 81 83 return true; … … 83 85 84 86 bool operator()(unary_fun<THandler> & expr) { 87 //std::wcout << "force_fun" << std::endl; 85 88 if (expr.is_transparent(type)) 86 89 expr.subject.force_type(type); … … 89 92 90 93 bool operator()(list_value<THandler> & expr) { 91 BOOST_FOREACH(expression_ast<THandler> e, expr.list) {94 BOOST_FOREACH(expression_ast<THandler> &e, expr.list) { 92 95 e.force_type(type); 93 96 //boost::apply_visitor(*this, e.expr); 94 97 } 95 return false;98 return true; 96 99 } 97 100 … … 105 108 template<typename THandler> 106 109 void expression_ast<THandler>::force_type(value_type newtype) { 107 std::wcout << _T("Forcing type: ") << type_to_string(type) << _T(" to ") << type_to_string(newtype) << _T(" for ") << to_string() << std::endl;110 //std::wcout << _T("Forcing type: ") << type_to_string(type) << _T(" to ") << type_to_string(newtype) << _T(" for ") << to_string() << std::endl; 108 111 if (type == newtype) 109 112 return; … … 114 117 expr = unary_fun<THandler>(_T("auto_convert"), subnode); 115 118 type = newtype; 119 //std::wcout << _T("Forcing type (D1): ") << type_to_string(type) << _T(" to ") << type_to_string(newtype) << _T(" for ") << to_string() << std::endl; 116 120 return; 117 121 } … … 120 124 set_type(newtype); 121 125 } 126 //std::wcout << _T("Forcing type (D2): ") << type_to_string(type) << _T(" to ") << type_to_string(newtype) << _T(" for ") << to_string() << std::endl; 122 127 } 123 128 … … 163 168 result << _T(" { "); 164 169 BOOST_FOREACH(const expression_ast<THandler> e, expr.list) { 165 boost::apply_visitor(*this, e.expr); 170 operator()(e); 171 //boost::apply_visitor(*this, e.expr); 166 172 result << _T(", "); 167 173 } … … 421 427 template<typename THandler> 422 428 expression_ast<THandler> binary_op<THandler>::evaluate(THandler &handler) const { 423 factory<THandler>::bin_op_type impl = factory<THandler>::get_binary_operator(op );429 factory<THandler>::bin_op_type impl = factory<THandler>::get_binary_operator(op, left, right); 424 430 if (get_return_type(op, type_invalid) == type_bool) { 425 431 return impl->evaluate(handler, left, right); -
include/parsers/ast.hpp
redf0848 r9661f81 123 123 if (identifier == op_le) 124 124 return _T("<="); 125 if (identifier == op_in) 126 return _T("in"); 127 if (identifier == op_nin) 128 return _T("not in"); 125 129 return _T("?"); 126 130 } -
include/parsers/eval.hpp
redf0848 r9661f81 7 7 struct simple_bool_binary_operator_impl : public binary_operator_impl<THandler> { 8 8 expression_ast<THandler> evaluate(THandler &handler, const expression_ast<THandler> &left, const expression_ast<THandler> & right) const { 9 if (left.get_type() != right.get_type()) { 9 value_type ltype = left.get_type(); 10 value_type rtype = right.get_type(); 11 12 if ( (ltype != rtype) && (rtype != type_tbd) ) { 10 13 handler.error(_T("Invalid types (not same) for binary operator")); 11 14 return expression_ast<THandler>(int_value(FALSE)); … … 114 117 // std::wcout << _T("Found: ") << s1 << _T(" in ") << s2 << std::endl; 115 118 return res; 119 }; 120 }; 121 template<typename THandler> 122 struct operator_not_in : public simple_bool_binary_operator_impl<THandler> { 123 124 typedef typename expression_ast<THandler>::list_type list_type; 125 typedef typename expression_ast<THandler> list_item_type; 126 typename expression_ast<THandler>::list_type list; 127 operator_not_in(const expression_ast<THandler> &subject) : list(subject.get_list()) {} 128 129 bool eval_int(value_type type, THandler &handler, const expression_ast<THandler> &left, const expression_ast<THandler> & right) const { 130 long long val = left.get_int(handler); 131 BOOST_FOREACH(list_item_type itm, list) { 132 if (itm.get_int(handler) == val) 133 return false; 134 } 135 return true; 136 } 137 bool eval_string(value_type type, THandler &handler, const expression_ast<THandler> &left, const expression_ast<THandler> & right) const { 138 std::wstring val = left.get_string(handler); 139 BOOST_FOREACH(list_item_type itm, list) { 140 if (itm.get_string(handler) == val) 141 return false; 142 } 143 return true; 144 }; 145 }; 146 template<typename THandler> 147 struct operator_in : public simple_bool_binary_operator_impl<THandler> { 148 149 typedef typename expression_ast<THandler>::list_type list_type; 150 typedef typename expression_ast<THandler> list_item_type; 151 typename expression_ast<THandler>::list_type list; 152 operator_in(const expression_ast<THandler> &subject) : list(subject.get_list()) {} 153 154 bool eval_int(value_type type, THandler &handler, const expression_ast<THandler> &left, const expression_ast<THandler> & right) const { 155 long long val = left.get_int(handler); 156 BOOST_FOREACH(list_item_type itm, list) { 157 if (itm.get_int(handler) == val) 158 return true; 159 } 160 return false; 161 } 162 bool eval_string(value_type type, THandler &handler, const expression_ast<THandler> &left, const expression_ast<THandler> & right) const { 163 std::wstring val = left.get_string(handler); 164 BOOST_FOREACH(list_item_type itm, list) { 165 if (itm.get_string(handler) == val) 166 return true; 167 } 168 return false; 116 169 }; 117 170 }; … … 226 279 } 227 280 template<typename THandler> 228 typename factory<THandler>::bin_op_type factory<THandler>::get_binary_operator(operators op ) {281 typename factory<THandler>::bin_op_type factory<THandler>::get_binary_operator(operators op, const expression_ast<THandler> &left, const expression_ast<THandler> &right) { 229 282 // op_in, op_nin 230 283 if (op == op_eq) … … 247 300 if (op == op_or) 248 301 return bin_op_type(new operator_impl::operator_or<THandler>()); 302 if (op == op_in) 303 return bin_op_type(new operator_impl::operator_in<THandler>(right)); 304 if (op == op_nin) 305 return bin_op_type(new operator_impl::operator_not_in<THandler>(right)); 249 306 std::cout << "======== UNHANDLED OPERATOR\n"; 250 307 return bin_op_type(new operator_impl::operator_false<THandler>()); -
include/parsers/where.cpp
redf0848 r9661f81 37 37 38 38 value_type operator()(expression_ast<THandler> & ast) { 39 //std::wcout << _T(">>>Setting type: ") << ast.to_string() << _T(" to: ") << ast.get_type() << std::endl; 39 40 value_type type = ast.get_type(); 41 //std::wcout << _T("!!!Setting type: ") << ast.to_string() << _T(" to: ") << type << std::endl; 40 42 if (type != type_tbd) 41 43 return type; 42 44 type = boost::apply_visitor(*this, ast.expr); 43 45 ast.set_type(type); 46 //std::wcout << _T("<<<Setting type: ") << ast.to_string() << _T(" to: ") << ast.get_type() << std::endl; 44 47 return type; 45 48 } … … 71 74 return type_tbd; 72 75 if (handler.can_convert(rt, lt)) { 73 std::wcout << _T("FORCE 001") << std::endl;76 //std::wcout << _T("FORCE 001") << std::endl; 74 77 right.force_type(lt); 75 78 return lt; 76 79 } 77 80 if (handler.can_convert(lt, rt)) { 78 std::wcout << _T("FORCE 002") << std::endl;81 //std::wcout << _T("FORCE 002") << std::endl; 79 82 left.force_type(rt); 80 83 return rt; 81 84 } 82 85 if (can_convert(rt, lt)) { 83 std::wcout << _T("FORCE 003") << std::endl;86 //std::wcout << _T("FORCE 003") << std::endl; 84 87 right.force_type(lt); 85 88 return rt; 86 89 } 87 90 if (can_convert(lt, rt)) { 88 std::wcout << _T("FORCE 004") << std::endl;91 //std::wcout << _T("FORCE 004") << std::endl; 89 92 left.force_type(rt); 90 93 return lt; … … 110 113 111 114 value_type operator()(list_value<THandler> & expr) { 115 BOOST_FOREACH(expression_ast<THandler> &e, expr.list) { 116 operator()(e); 117 } 112 118 return type_tbd; 113 119 } … … 171 177 172 178 bool operator()(list_value<THandler> & expr) { 173 // TODO: this is incorrect! 179 BOOST_FOREACH(expression_ast<THandler> e, expr.list) { 180 operator()(e); 181 } 174 182 return true; 175 183 } … … 218 226 219 227 bool operator()(list_value<THandler> & expr) { 220 BOOST_FOREACH(expression_ast<THandler> e, expr.list) {228 BOOST_FOREACH(expression_ast<THandler> &e, expr.list) { 221 229 operator()(e); 222 230 } … … 242 250 bool parser<THandler>::parse(std::wstring expr) { 243 251 constants::reset(); 244 std::wcout << _T("Current time is: ") << constants::get_now() << std::endl;252 //std::wcout << _T("Current time is: ") << constants::get_now() << std::endl; 245 253 typedef std::wstring::const_iterator iterator_type; 246 254 typedef where_grammar<THandler, iterator_type> grammar; -
include/parsers/where.hpp
r5b10435 r9661f81 26 26 typedef boost::shared_ptr<unary_operator_impl<typename THandler> > un_op_type; 27 27 28 static bin_op_type get_binary_operator(operators op); 28 static bin_op_type get_binary_operator(operators op, const expression_ast<THandler> &left, const expression_ast<THandler> &right); 29 //static bin_op_type get_binary_operator(operators op); 29 30 //static varible_handler::bound_function_type get_binary_function(std::wstring name, const expression_ast<THandler> &subject); 30 31 static bin_fun_type get_binary_function(std::wstring name, const expression_ast<THandler> &subject); -
include/pdh/enumerations.hpp
r42ff14d r9661f81 77 77 TCHAR* szInstanceBuffer = NULL; 78 78 status = PDH::PDHFactory::get_impl()->PdhEnumObjectItems(NULL, NULL, (*it).name.c_str(), szCounterBuffer, &dwCounterBufLen, szInstanceBuffer, &dwInstanceBufLen, dwDetailLevel, 0); 79 if ( !status.is_more_data()) {79 if (status.is_more_data()) { 80 80 szCounterBuffer = new TCHAR[dwCounterBufLen+1024]; 81 81 szInstanceBuffer = new TCHAR[dwInstanceBufLen+1024]; -
modules/CheckExternalScripts/CheckExternalScripts.cpp
r4580c6c r9661f81 64 64 } 65 65 FindClose(hFind); 66 } 67 68 69 std::wstring CheckExternalScripts::getWrapping(std::wstring val) { 70 strEx::token tok = strEx::getToken(val, ' ', true); 71 std::wstring::size_type pos = tok.first.find_last_of(_T(".")); 72 if (pos == std::wstring::npos) 73 return _T(""); 74 return tok.first.substr(pos+1); 75 } 76 77 void CheckExternalScripts::addWrappedCommand(std::wstring key, std::wstring tpl, std::wstring command ) { 78 strEx::token tok = strEx::getToken(command, ' ', true); 79 strEx::replace(tpl, _T("%SCRIPT%"), tok.first); 80 strEx::replace(tpl, _T("%ARGS%"), tok.second); 81 tok = strEx::getToken(tpl, ' ', true); 82 addCommand(key.c_str(),tok.first, tok.second); 66 83 } 67 84 … … 96 113 } 97 114 115 std::map<std::wstring,std::wstring> wrappers; 116 std::list<std::wstring> wrappings = NSCModuleHelper::getSettingsSection(EXTSCRIPT_WRAPPINGS_SECTION_TITLE); 117 for (it = wrappings.begin(); it != wrappings.end(); ++it) { 118 std::wstring val = NSCModuleHelper::getSettingsString(EXTSCRIPT_WRAPPINGS_SECTION_TITLE, *it, _T("")); 119 if (!(*it).empty() && !val.empty()) { 120 wrappers[(*it)] = val; 121 } 122 } 123 std::list<std::wstring> wscript = NSCModuleHelper::getSettingsSection(EXTSCRIPT_WRAPPED_SCRIPT_SECTION_TITLE); 124 for (it = wrappings.begin(); it != wscript.end(); ++it) { 125 std::wstring val = NSCModuleHelper::getSettingsString(EXTSCRIPT_WRAPPED_SCRIPT_SECTION_TITLE, *it, _T("")); 126 if (!(*it).empty() && !val.empty()) { 127 std::wstring type = getWrapping(val); 128 std::map<std::wstring,std::wstring>::const_iterator cit = wrappers.find(type); 129 if (cit == wrappers.end()) { 130 NSC_LOG_ERROR_STD(_T("Failed to find wrappings for: ") + type + _T(" (" + (*it) + _T(")"))); 131 } else { 132 addWrappedCommand((*it), (*cit).second, val); 133 } 134 } 135 } 136 98 137 if (!scriptDirectory_.empty()) { 99 138 addAllScriptsFrom(scriptDirectory_); -
modules/CheckExternalScripts/CheckExternalScripts.h
r4580c6c r9661f81 80 80 void addAllScriptsFrom(std::wstring path); 81 81 void addCommand(strEx::blindstr key, std::wstring cmd, std::wstring args) { 82 NSC_DEBUG_MSG_STD(_T("Adding: ") + cmd + _T("Args: ") + args); 82 83 commands[key] = command_data(cmd, args); 83 84 } … … 85 86 alias[key] = command_data(cmd, args); 86 87 } 88 std::wstring getWrapping( std::wstring val ); 89 void addWrappedCommand( std::wstring key, std::wstring tpl, std::wstring command ); 87 90 }; 88 91 -
modules/CheckSystem/CheckSystem.cpp
rd1029bd r9661f81 211 211 } 212 212 } else { 213 if ((*it).counters.size() == 0) { 214 std::wcout << _T("empty counter: ") << (*it).name << std::endl; 215 } 213 216 for (PDH::Enumerations::Counters::const_iterator it2 = (*it).counters.begin();it2!=(*it).counters.end();++it2) { 214 217 std::wstring counter = _T("\\") + (*it).name + _T("\\") + (*it2).name; … … 235 238 } 236 239 std::wcout << _T(" open "); 237 std::wcout << std::endl; ;240 std::wcout << std::endl; 238 241 } 239 242 }
Note: See TracChangeset
for help on using the changeset viewer.








