void CXCCWOLIRCServerClientDlg::OnReset() { if (update_hosts("")) ::MessageBox(NULL, "Your hosts file could not be updated.", NULL, MB_ICONERROR); Sleep(25); update_ipa2(); }
void CXCCWOLIRCServerClientDlg::OnSet() { DWORD a; m_ipa.GetAddress(a); a = htonl(a); if (update_hosts(inet_ntoa(*reinterpret_cast<in_addr*>(&a)))) ::MessageBox(NULL, "Your hosts file could not be updated.", NULL, MB_ICONERROR); Sleep(25); update_ipa2(); }
int main(int argc, char** argv) { int retval, i; bool do_update_teams = false, do_update_users = false; bool do_update_hosts = false; update_time_cutoff = time(0) - UPDATE_INTERVAL; check_stop_daemons(); for (i=1; i<argc; i++) { if (!strcmp(argv[i], "-update_teams")) { do_update_teams = true; } else if (!strcmp(argv[i], "-update_users")) { do_update_users = true; } else if (!strcmp(argv[i], "-update_hosts")) { do_update_hosts = true; } else if (!strcmp(argv[i], "-d")) { log_messages.set_debug_level(atoi(argv[++i])); } else { log_messages.printf(MSG_CRITICAL, "Unrecognized arg: %s\n", argv[i]); } } log_messages.printf(MSG_NORMAL, "Starting\n"); retval = config.parse_file(); if (retval) { log_messages.printf(MSG_CRITICAL, "Can't parse config.xml: %s\n", boincerror(retval) ); exit(1); } retval = boinc_db.open(config.db_name, config.db_host, config.db_user, config.db_passwd); if (retval) { log_messages.printf(MSG_CRITICAL, "Can't open DB\n"); exit(1); } retval = boinc_db.set_isolation_level(READ_UNCOMMITTED); if (retval) { log_messages.printf(MSG_CRITICAL, "boinc_db.set_isolation_level: %d; %s\n", retval, boinc_db.error_string() ); } if (do_update_users) { retval = update_users(); if (retval) { log_messages.printf(MSG_CRITICAL, "update_users failed: %d\n", retval); exit(1); } } if (do_update_hosts) { retval = update_hosts(); if (retval) { log_messages.printf(MSG_CRITICAL, "update_hosts failed: %d\n", retval); exit(1); } } if (do_update_teams) { retval = update_teams(); if (retval) { log_messages.printf(MSG_CRITICAL, "update_teams failed: %d\n", retval); exit(1); } } log_messages.printf(MSG_NORMAL, "Finished\n"); return 0; }