// WARNING: This code segfaults and otherwise does not work as expected #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "php.h" #include "php_nagios.h" #include #include static function_entry nagios_functions[] = { PHP_FE(nagios_get_status, NULL) {NULL, NULL, NULL} }; zend_module_entry nagios_module_entry = { #if ZEND_MODULE_API_NO >= 20010901 STANDARD_MODULE_HEADER, #endif PHP_NAGIOS_EXTNAME, nagios_functions, NULL, NULL, NULL, NULL, NULL, #if ZEND_MODULE_API_NO >= 20010901 PHP_NAGIOS_VERSION, #endif STANDARD_MODULE_PROPERTIES }; #ifdef COMPILE_DL_NAGIOS ZEND_GET_MODULE(nagios) #endif void trim(char *s, const int len) { int end = len - 1; int start = 0; int i = 0; while ((start < len) && (s[start] <= ' ')) { start++; } while ((start < end) && (s[end] <= ' ')) { end--; } if (start > end) { memset(s, '\0', len); return; } for (i = 0; (i + start) <= end; i++) { s[i] = s[start + i]; } memset((s + i), '\0', len - i); } int is_equal(const char *str1, const char *str2) { return strcmp(str1, str2) == 0; } int in_array(char *s, char**array, int arraysize) { int i = 0; for (i = 0; i