int main(int argc, char *argv[]) { int len, addrlen, sfd; struct sockaddr_in serv_addr; char data[512]; addrlen = sizeof(struct sockaddr_in); parse_cmd(&argc, argv); if(!check_instance()){ DEBUG_MSG("One instance is running!\n"); exit(1); } signal(SIGTERM, handle_int_signal); signal(SIGINT, handle_int_signal); signal(SIGHUP, handle_int_signal); if(!DEBUG_ON) init_daemon(); write_pid(); gbl_fd = sfd = open_udp_server_socket(SERV_PORT, &serv_addr); while (1) { memset(data, '\0', sizeof(data)); len = recvfrom(sfd, data, sizeof(data), 0, (struct sockaddr *) &serv_addr, &addrlen); printf("got %s\n", data); system(data); } close(gbl_fd); return 0; }
bool _cdecl app_preinit( const wchar_t *cmdl ) { #if defined _DEBUG || defined _CRASH_HANDLER ts::exception_operator_c::set_unhandled_exception_filter(); #endif sodium_init(); if (!parsecmdl(cmdl)) return false; if (!check_autoupdate()) return false; #ifdef _FINAL if (g_commandline.checkinstance) if (!check_instance()) return false; #endif // _FINAL #if defined _DEBUG || defined _CRASH_HANDLER ts::exception_operator_c::dump_filename = ts::fn_change_name_ext(ts::get_exe_full_name(), ts::wstr_c(CONSTWSTR(APPNAME)).append_char('.').append(ts::to_wstr(application_c::appver())).as_sptr(), CONSTWSTR("dmp")); #endif ts::tsfileop_c::setup<fileop_c>(); ts::CHARz_copy( g_sysconf.name, CONSTWSTR(APPNAME) .s ); #ifndef _FINAL debug_name(); dotests0(); #endif TSNEW(application_c, cmdl); // not a memory leak! see SEV_EXIT handler return true; }
static int check_class_instances(SordModel* model, const URIs* uris, const SordNode* restriction, const SordNode* klass) { // Check immediate instances of this class SordIter* i = sord_search(model, NULL, uris->rdf_type, klass, NULL); for (; !sord_iter_end(i); sord_iter_next(i)) { const SordNode* instance = sord_iter_get_node(i, SORD_SUBJECT); check_instance(model, uris, restriction, instance); } sord_iter_free(i); // Check instances of all subclasses recursively SordIter* s = sord_search(model, NULL, uris->rdfs_subClassOf, klass, NULL); for (; !sord_iter_end(s); sord_iter_next(s)) { const SordNode* subklass = sord_iter_get_node(s, SORD_SUBJECT); check_class_instances(model, uris, restriction, subklass); } sord_iter_free(s); return 0; }
void fftf_destroy(FFTFInstance *instance) { check_instance(instance); backend_destroy(instance); }
void fftf_calc(const FFTFInstance *instance) { check_instance(instance); backend_calc(instance); }
void AppleWallBuilder::eated_apple(Apple* apple){ check_instance(); do { apple->position = unique_instance->random_point(); } while (Collision::collise(apple) != apple); }
/// ********** public method ********** void AppleWallBuilder::create(const char* level_name){ check_instance(); unique_instance->_create(level_name); }