int main(int argc, char **argv) { int repeat, level; char *from, *to; uint8_t *from_buf = NULL, *to_buf = NULL, *delta_buf = NULL; size_t from_len = 0, to_len, delta_alloc, delta_size = 0; long start, finish; int i, ret; int flags; if (argc != 5) { fprintf(stderr, "usage: speed_test LEVEL COUNT FROM TO\n"); return 1; } level = atoi(argv[1]); repeat = atoi(argv[2]); from = argv[3]; to = argv[4]; flags = (level << XD3_COMPLEVEL_SHIFT) & XD3_COMPLEVEL_MASK; if ((strcmp(from, "null") != 0 && (ret = read_whole_file(from, &from_buf, &from_len))) || (ret = read_whole_file(to, &to_buf, &to_len))) { fprintf(stderr, "read_whole_file error\n"); goto exit; } delta_alloc = to_len * 11 / 10; delta_buf = main_malloc(delta_alloc); start = get_millisecs_now(); for (i = 0; i < repeat; ++i) { delta_size = bench_speed(from_buf, from_len, to_buf, to_len, delta_buf, delta_alloc, flags); } finish = get_millisecs_now(); fprintf(stderr, "STAT: encode %3.2f ms from %s to %s repeat %d %zdbit delta %zd\n", (double)(finish - start) / repeat, from, to, repeat, sizeof (xoff_t) * 8, delta_size); ret = 0; if (0) { exit: ret = 1; } main_free(to_buf); main_free(from_buf); main_free(delta_buf); return ret; }
int main(int argc,char *argv[]) { program = initialise(argc,argv); if(!program) { err(1,"Terminating the program:\n"); } reference = program ; //set up the global reference pointer for the program initialise_scopes(); register_all_scopes(); //register all the scopes initialise_datatypes(); //initialise the data types register_all_datatypes(); //set up the data type handlers stack_initialise(); //set up the stack lval_initialise(); //initialise the lvalue handler function_precursor(); //call function precursor to load functions reference = program; parse_global_scope(); main_free(); //free up the memory exit(0); }
int_fast8_t exitCLI() { char command[500]; int r; if(data.fifoON == 1) { sprintf(command, "rm %s", data.fifoname); r = system(command); } main_free(); if(Listimfile==1) { if(system("rm imlist.txt")==-1) { printERROR(__FILE__,__func__,__LINE__,"system() error"); exit(0); } } rl_callback_handler_remove(); printf("Closing PID %ld (prompt process)\n", (long) getpid()); exit(0); return 0; }
int main(int argc, char **argv) { struct sigaction sig_stop; struct sigaction sig_time; _main = main_init(argc, argv); _log = log_init(); _main->conf = conf_init(argc, argv); _main->work = work_init(); _main->tcp = tcp_init(); _main->node = node_init(); _main->mime = mime_init(); /* Check configuration */ conf_print(); /* Catch SIG INT */ unix_signal(&sig_stop, &sig_time); /* Fork daemon */ unix_fork(log_console(_log)); /* Increase limits */ unix_limits(_main->conf->cores, CONF_EPOLL_MAX_EVENTS); /* Load mime types */ mime_load(); mime_hash(); /* Prepare TCP daemon */ tcp_start(); /* Drop privileges */ unix_dropuid0(); /* Start worker threads */ work_start(); /* Stop worker threads */ work_stop(); /* Stop TCP daemon */ tcp_stop(); mime_free(); node_free(); tcp_free(); work_free(); conf_free(); log_free(_log); main_free(); return 0; }
int curl_main(int argc, char *argv[]) #endif { // scp, sftp: edit arguments and relaunch if ((strcmp(argv[0], "scp") == 0) || (strcmp(argv[0], "sftp") == 0)) { return scp_convert(argc, argv); } CURLcode result = CURLE_OK; struct GlobalConfig global; memset(&global, 0, sizeof(global)); main_checkfds(); #if defined(HAVE_SIGNAL) && defined(SIGPIPE) (void)signal(SIGPIPE, SIG_IGN); #endif /* Initialize memory tracking */ memory_tracking_init(); /* Initialize the curl library - do not call any libcurl functions before this point */ result = main_init(&global); if(!result) { /* Start our curl operation */ result = operate(&global, argc, argv); #ifdef __SYMBIAN32__ if(global.showerror) tool_pressanykey(); #endif /* Perform the main cleanup */ main_free(&global); } #ifdef __NOVELL_LIBC__ if(getenv("_IN_NETWARE_BASH_") == NULL) tool_pressanykey(); #endif #ifdef __VMS vms_special_exit(result, vms_show); #else return (int)result; #endif }
void kadnode_loop(void) { if (gconf && gconf->is_running == 0) { conf_check(); main_setup(); // Loop over all sockets and file descriptors net_loop(); // Export peers if a file is provided peerfile_export(); main_free(); conf_free(); } }
void show_data(struct data *ptr) { if(ptr ) { switch(ptr->ele_type) { case _INT: err(0,"The value of the Integer Object is %d:\n",ptr->INT_VALUE); break; case _FLT: err(0,"The value of the Float Object is %.2f:\n",ptr->FLT_VALUE); break; case _DBL: err(0,"The value of the Double Object is %.2f:\n",ptr->DBL_VALUE); break; case _STR: err(0,"The value of the string object is %s\n",ptr->STR_VALUE); break; default: err(0,"Unknown Data Type:\n"); main_free(); } } }