int main(int argc, char **argv) { int result; /* reset internal variables */ reset_cgi_vars(); /* Initialize shared configuration variables */ init_shared_cfg_vars(1); /* read the CGI configuration file */ result = read_cgi_config_file(get_cgi_config_location()); if(result == ERROR) { document_header(); return ERROR; } /* defaults from CGI config file */ layout_method = default_statuswrl_layout_method; /* get the arguments passed in the URL */ process_cgivars(); document_header(); /* read the main configuration file */ result = read_main_config_file(main_config_file); if(result == ERROR) return ERROR; /* read all object configuration data */ result = read_all_object_configuration_data(main_config_file, READ_ALL_OBJECT_DATA); if(result == ERROR) return ERROR; /* read all status data */ result = read_all_status_data(status_file, READ_ALL_STATUS_DATA); if(result == ERROR) { free_memory(); return ERROR; } /* get authentication information */ get_authentication_information(¤t_authdata); /* display the 3-D VRML world... */ display_world(); /* free all allocated memory */ free_memory(); return OK; }
int main(void) { int result = OK; /* get the arguments passed in the URL */ process_cgivars(); /* reset internal variables */ reset_cgi_vars(); /* read the CGI configuration file */ result = read_cgi_config_file(get_cgi_config_location()); if (result == ERROR) { document_header(CGI_ID, FALSE, "Error"); print_error(get_cgi_config_location(), ERROR_CGI_CFG_FILE, FALSE); document_footer(CGI_ID); free_html_request(html_request_list); return ERROR; } /* read the main configuration file */ result = read_main_config_file(main_config_file); if (result == ERROR) { document_header(CGI_ID, FALSE, "Error"); print_error(main_config_file, ERROR_CGI_MAIN_CFG, FALSE); document_footer(CGI_ID); free_html_request(html_request_list); return ERROR; } /* read all object configuration data */ result = read_all_object_configuration_data(main_config_file, READ_ALL_OBJECT_DATA); if (result == ERROR) { document_header(CGI_ID, FALSE, "Error"); print_error(NULL, ERROR_CGI_OBJECT_DATA, FALSE); document_footer(CGI_ID); free_html_request(html_request_list); return ERROR; } /* read all status data */ result = read_all_status_data(main_config_file, READ_ALL_STATUS_DATA); if (result == ERROR && daemon_check == TRUE) { document_header(CGI_ID, FALSE, "Error"); print_error(NULL, ERROR_CGI_STATUS_DATA, FALSE); document_footer(CGI_ID); free_html_request(html_request_list); free_memory(); return ERROR; } document_header(CGI_ID, TRUE, "Network Outages"); /* get authentication information */ get_authentication_information(¤t_authdata); if (display_header == TRUE) { /* begin top table */ printf("<table border='0' width='100%%'>\n"); printf("<tr>\n"); /* left column of the first row */ printf("<td align='left' valign='top' width='33%%'>\n"); display_info_table("Network Outages", ¤t_authdata, daemon_check); printf("</td>\n"); /* middle column of top row */ printf("<td align='center' valign='top' width='33%%'>\n"); printf("</td>\n"); /* right column of top row */ printf("<td align='right' valign='bottom' width='33%%'>\n"); printf("</td>\n"); /* end of top table */ printf("</tr>\n"); printf("</table>\n"); } /* display network outage info */ display_network_outages(); document_footer(CGI_ID); /* free memory allocated to comment data */ free_comment_data(); /* free all allocated memory */ free_html_request(html_request_list); free_memory(); return OK; }
int main(void) { int result = OK; /* get the arguments passed in the URL */ process_cgivars(); /* reset internal variables */ reset_cgi_vars(); document_header(); /* validate arguments in URL */ result = validate_arguments(); if(result == ERROR) { document_footer(); return ERROR; } /* read the CGI configuration file */ result = read_cgi_config_file(get_cgi_config_location()); if(result == ERROR) { printf("<P>Error: Could not open CGI configuration file '%s' for reading!</P>\n", get_cgi_config_location()); document_footer(); return ERROR; } /* read the main configuration file */ result = read_main_config_file(main_config_file); if(result == ERROR) { printf("<P>Error: Could not open main configuration file '%s' for reading!</P>\n", main_config_file); document_footer(); return ERROR; } /* read all object configuration data */ result = read_all_object_configuration_data(main_config_file, READ_ALL_OBJECT_DATA); if(result == ERROR) { printf("<P>Error: Could not read some or all object configuration data!</P>\n"); document_footer(); return ERROR; } /* read all status data */ result = read_all_status_data(get_cgi_config_location(), READ_ALL_STATUS_DATA); if(result == ERROR) { printf("<P>Error: Could not read host and service status information!</P>\n"); document_footer(); free_memory(); return ERROR; } /* get authentication information */ get_authentication_information(¤t_authdata); /* decide what to display to the user */ if(display_type == DISPLAY_HOST && host_style == DISPLAY_HOST_SERVICES) display_host_services(); else if(display_type == DISPLAY_HOST) display_host(); else if(display_type == DISPLAY_SERVICE) display_service(); else if(display_type == DISPLAY_HOSTGROUP && hostgroup_style == DISPLAY_HOSTGROUP_OVERVIEW) display_hostgroup_overview(); else if(display_type == DISPLAY_HOSTGROUP && hostgroup_style == DISPLAY_HOSTGROUP_SUMMARY) display_hostgroup_summary(); else if(display_type == DISPLAY_PING) display_ping(); else if(display_type == DISPLAY_TRACEROUTE) display_traceroute(); else if(display_type == DISPLAY_QUICKSTATS) display_quick_stats(); else if(display_type == DISPLAY_PROCESS) display_process(); else if(display_type == DISPLAY_ALL_PROBLEMS || display_type == DISPLAY_UNHANDLED_PROBLEMS) display_problems(); else display_index(); document_footer(); /* free all allocated memory */ free_memory(); return OK; }
int main(void) { int result = OK; /* get the arguments passed in the URL */ process_cgivars(); /* reset internal variables */ reset_cgi_vars(); /* read the CGI configuration file */ result = read_cgi_config_file(get_cgi_config_location()); if(result == ERROR) { document_header(FALSE); cgi_config_file_error(get_cgi_config_location()); document_footer(); return ERROR; } /* read the main configuration file */ result = read_main_config_file(main_config_file); if(result == ERROR) { document_header(FALSE); main_config_file_error(main_config_file); document_footer(); return ERROR; } /* read all object configuration data */ result = read_all_object_configuration_data(main_config_file, READ_ALL_OBJECT_DATA); if(result == ERROR) { document_header(FALSE); object_data_error(); document_footer(); return ERROR; } /* read all status data */ result = read_all_status_data(get_cgi_config_location(), READ_ALL_STATUS_DATA); if(result == ERROR) { document_header(FALSE); status_data_error(); document_footer(); free_memory(); return ERROR; } document_header(TRUE); /* get authentication information */ get_authentication_information(¤t_authdata); if(display_header == TRUE) { /* begin top table */ printf("<table border=0 width=100%%>\n"); printf("<tr>\n"); /* left column of the first row */ printf("<td align=left valign=top width=33%%>\n"); display_info_table("Network Outages", TRUE, ¤t_authdata); printf("</td>\n"); /* middle column of top row */ printf("<td align=center valign=top width=33%%>\n"); printf("</td>\n"); /* right column of top row */ printf("<td align=right valign=bottom width=33%%>\n"); /* display context-sensitive help */ display_context_help(CONTEXTHELP_OUTAGES); printf("</td>\n"); /* end of top table */ printf("</tr>\n"); printf("</table>\n"); } /* display network outage info */ display_network_outages(); document_footer(); /* free memory allocated to comment data */ free_comment_data(); /* free all allocated memory */ free_memory(); return OK; }