int main(int argc, char *argv[], char *envp[]) { if (process_arguments(argc, argv) == ERROR) exit(ERROR); pid_t pid; int error_code = 0; switch (pid = fork()) { case -1: /* Here pid is -1, the fork failed */ /* Some possible reasons are that you're */ /* out of process slots or virtual memory */ perror("The fork failed!"); error_code = -1; break; case 0: /* pid of zero is the child */ signal(SIGALRM, timeout_sighandler); alarm(timeout); process_env(envp); _exit(0); default: /* pid greater than zero is parent getting the child's pid */ //printf("Child's pid is %d\n",pid); error_code = 0; } exit(error_code); }
int main(int argc, char* argv[]) { size_t seconds = TEST_SECONDS; METRIC_AZURE_INFO metric_info; process_arguments(argc, (const char**)argv, &metric_info); if (platform_init() == 0) { gballoc_init(); if (ExecuteIotHubTest(&metric_info, seconds) != 0) { (void)printf("Mqtt run failed\r\n"); } gballoc_deinit(); platform_deinit(); } else { (void)printf("Platform_Init Failed\r\n"); } (void)printf("Press any key to exit: "); (int)getchar(); return 0; }
int main(int argc, char **argv) { setlocale(LC_ALL,""); /* what to do if we get a control-c */ signal(SIGINT,quit); programInits(&properties); props_defaults_options(&properties,1); props_defaults_futures(&future_properties,1); #if defined(HAVE_GETOPT_H) && defined(HAVE_GETTIMEOFDAY) process_arguments(argc, argv, &properties.data.debug); #endif initscr(); keypad(stdscr,TRUE); welcome_screen(); for(;;) { /* get initial user inputs */ if( get_user_inputs(&properties,&future_properties) == -1 ) continue; curses_process(&properties,&future_properties); } /* for(;;) */ }
int main(int argc, char **argv){ int dhcp_socket; int result; if(process_arguments(argc,argv)!=OK){ /*usage("Invalid command arguments supplied\n");*/ printf("Invalid command arguments supplied\n"); exit(STATE_UNKNOWN); } /* create socket for DHCP communications */ dhcp_socket=create_dhcp_socket(); /* get hardware address of client machine */ get_hardware_address(dhcp_socket,network_interface_name); /* send DHCPDISCOVER packet */ send_dhcp_discover(dhcp_socket); /* wait for a DHCPOFFER packet */ get_dhcp_offer(dhcp_socket); /* close socket we created */ close_dhcp_socket(dhcp_socket); /* determine state/plugin output to return */ result=get_results(); /* free allocated memory */ free_dhcp_offer_list(); free_requested_server_list(); return result; }
/* ------------------------------------------------------------- // ------ MAIN - replace this by your own aplication! // ------------------------------------------------------------- */ int main(int argn, char *argv[]) { int multipnm=1; job_t job; JOB = &job; setvbuf(stdout, (char *) NULL, _IONBF, 0); /* not buffered */ while (multipnm==1) { job_init(&job); process_arguments(&job, argn, argv); mark_start(&job); multipnm = read_picture(&job); /* separation of main and rest for using as lib this will be changed later => introduction of set_option() for better communication to the engine */ if (multipnm<0) break; /* read error */ /* call main loop */ pgm2asc(&job); mark_end(&job); print_output(&job); job_free(&job); } return 0; }
int main (int argc, char **argv) { int result = STATE_UNKNOWN; setlocale (LC_ALL, ""); bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); /* Parse extra opts if any */ argv=np_extra_opts (&argc, argv, progname); if (process_arguments (argc, argv) == ERROR) usage4 (_("Could not parse arguments")); /* initialize alarm signal handling */ signal (SIGALRM, socket_timeout_alarm_handler); alarm (socket_timeout); /* ssh_connect exits if error is found */ result = ssh_connect (server_name, port, remote_version); alarm (0); return (result); }
int main (int argc, char **argv) { /* Local Vars */ FILE *fp; mp_subprocess_t *subp; char line[128]; int failed = 0; int lines = 0; uid_t uid; /* Set signal handling and alarm */ if (signal(SIGALRM, timeout_alarm_handler) == SIG_ERR) critical("Setup SIGALRM trap failed!"); /* Process check arguments */ if (process_arguments(argc, argv) != OK) unknown("Parsing arguments failed!"); /* Start plugin timeout */ alarm(mp_timeout); // Need to be root if (nonroot == 0) mp_noneroot_die(); alarm(mp_timeout); // Parse clustat if (nonroot == 0) { uid = getuid(); if (setuid(0) != 0) unknown("setuid failed"); subp = mp_subprocess((char *[]) {"/sbin/multipath","-l", NULL});
int main (int argc, char **argv) { /* Local Vars */ virConnectPtr conn; const char *hvType; unsigned long libVer, libMajor, libMinor, libRelease; unsigned long hvVer, hvMajor, hvMinor, hvRelease; /* Set signal handling and alarm */ if (signal(SIGALRM, timeout_alarm_handler) == SIG_ERR) critical("Setup SIGALRM trap failed!"); /* Process check arguments */ if (process_arguments(argc, argv) != OK) unknown("Parsing arguments failed!"); /* Start plugin timeout */ alarm(mp_timeout); // PLUGIN CODE conn = virt_connect(); hvType = virConnectGetType(conn); if (hvType == NULL) { if (mp_verbose > 0) { virt_showError(conn); } critical("Failed to get hypervisor type."); } if (virConnectGetVersion(conn, &hvVer) != 0) { if (mp_verbose > 0) { virt_showError(conn); } critical("Failed to get hypervisor version."); } if (virConnectGetLibVersion(conn, &libVer) != 0) { if (mp_verbose > 0) { virt_showError(conn); } critical("Failed to get library version."); } virConnectClose(conn); hvMajor = hvVer / 1000000; hvVer %= 1000000; hvMinor = hvVer / 1000; hvRelease = hvVer % 1000; libMajor = libVer / 1000000; libVer %= 1000000; libMinor = libVer / 1000; libRelease = libVer % 1000; /* Output and return */ ok("libvirtd: v.%lu.%lu.%lu Hypervisor: %s (v.%lu.%lu.%lu)", libMajor, libMinor, libRelease, hvType, hvMajor, hvMinor, hvRelease); }
int main(int argc, char ** argv) { int err; if (!process_arguments(argc, argv)) goto could_not_process_arguments; err = pe_as_lit_kw_map_rd_open(&keywords, keywords_file); if (err) goto could_not_open_keywords; err = pe_lexer_open(&lexer, input_file_name, output_prefix, &keywords.map); if (err) goto could_not_open_lexer; if (!lex(&lexer)) goto could_not_lex; err = pe_lexer_close(&lexer); if (err) goto could_not_close_lexer; pe_as_lit_kw_map_rd_close(&keywords); return EXIT_SUCCESS; could_not_lex: (void)pe_lexer_close(&lexer); could_not_close_lexer: could_not_open_lexer: (void)pe_as_lit_kw_map_rd_close(&keywords); could_not_open_keywords: could_not_process_arguments: return EXIT_FAILURE; }
static void process_options(int argc, char **argv) { if (tpd == 1) fprintf(stderr,"sman:process_options entered\n"); set_up_defaults(); process_arguments(argc, argv); if (tpd == 1) fprintf(stderr,"sman:process_options exit\n"); }
int main(int argc, char *argv[]) { int result, offset_result; double offset=0; char *result_line, *perfdata_line; setlocale (LC_ALL, ""); bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); result = offset_result = STATE_OK; /* Parse extra opts if any */ argv=np_extra_opts (&argc, argv, progname); if (process_arguments (argc, argv) == ERROR) usage4 (_("Could not parse arguments")); set_thresholds(&offset_thresholds, owarn, ocrit); /* initialize alarm signal handling */ signal (SIGALRM, socket_timeout_alarm_handler); /* set socket timeout */ alarm (socket_timeout); offset = offset_request(server_address, &offset_result); if (offset_result == STATE_UNKNOWN) { result = (quiet == 1 ? STATE_UNKNOWN : STATE_CRITICAL); } else { result = get_status(fabs(offset), offset_thresholds); } switch (result) { case STATE_CRITICAL : xasprintf(&result_line, _("NTP CRITICAL:")); break; case STATE_WARNING : xasprintf(&result_line, _("NTP WARNING:")); break; case STATE_OK : xasprintf(&result_line, _("NTP OK:")); break; default : xasprintf(&result_line, _("NTP UNKNOWN:")); break; } if(offset_result == STATE_UNKNOWN) { xasprintf(&result_line, "%s %s", result_line, _("Offset unknown")); xasprintf(&perfdata_line, ""); } else { xasprintf(&result_line, "%s %s %.10g secs", result_line, _("Offset"), offset); xasprintf(&perfdata_line, "%s", perfd_offset(offset)); } printf("%s|%s\n", result_line, perfdata_line); if(server_address!=NULL) free(server_address); return result; }
int main (int argc, char **argv) { // base values int status, intvalue; int upminutes, uphours, updays; double value, uptime; char* perf; char* output_message; /* Parse extra opts if any */ argv = np_extra_opts (&argc, argv, progname); if (process_arguments (argc, argv) == ERROR) usage4 (_("Could not parse arguments")); value = getuptime(); if (verbose >= 3) { printf("Uptime in seconds returned from timespec struct: %f\n", value); } intvalue = (int)value; updays = intvalue / 86400; uphours = (intvalue % 86400) / 3600; upminutes = ((intvalue % 86400) % 3600) / 60; if (!strncmp(timeunit, "minutes", strlen("minutes"))) { uptime = intvalue / 60; } else if (!strncmp(timeunit, "hours", strlen("hours"))) { uptime = intvalue / 3600; } else if (!strncmp(timeunit, "days", strlen("days"))) { uptime = intvalue / 86400; } else { uptime = intvalue; } xasprintf(&output_message,_("%u day(s) %u hour(s) %u minute(s)"), updays, uphours, upminutes); xasprintf(&perf,_("%s"), fperfdata("uptime", uptime, "", my_thresholds->warning?TRUE:FALSE, my_thresholds->warning?my_thresholds->warning->end:0, my_thresholds->critical?TRUE:FALSE, my_thresholds->critical?my_thresholds->critical->end:0, FALSE, 0, FALSE, 0) ); status = get_status(uptime, my_thresholds); if (status == STATE_OK) { printf("Uptime %s: %s | %s\n", _("OK"), output_message, perf); } else if (status == STATE_WARNING) { printf("Uptime %s: %s | %s\n", _("WARNING"), output_message, perf); } else if (status == STATE_CRITICAL) { printf("Uptime %s: %s | %s\n", _("CRITICAL"), output_message, perf); } return status; } // end main
int main (int argc, char **argv) { int elapsed_time; int status = STATE_UNKNOWN; /* begin, by setting the parameters for a backend connection if the * parameters are null, then the system will try to use reasonable * defaults by looking up environment variables or, failing that, * using hardwired constants */ pgoptions = NULL; /* special options to start up the backend server */ pgtty = NULL; /* debugging tty for the backend server */ setlocale (LC_ALL, ""); bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); if (process_arguments (argc, argv) == ERROR) usage4 (_("Could not parse arguments")); /* Set signal handling and alarm */ if (signal (SIGALRM, timeout_alarm_handler) == SIG_ERR) { usage4 (_("Cannot catch SIGALRM")); } alarm (timeout_interval); /* make a connection to the database */ time (&start_time); conn = PQsetdbLogin (pghost, pgport, pgoptions, pgtty, dbName, pguser, pgpasswd); time (&end_time); elapsed_time = (int) (end_time - start_time); /* check to see that the backend connection was successfully made */ if (PQstatus (conn) == CONNECTION_BAD) { printf (_("CRITICAL - no connection to '%s' (%s).\n"), dbName, PQerrorMessage (conn)); PQfinish (conn); return STATE_CRITICAL; } else if (elapsed_time > tcrit) { status = STATE_CRITICAL; } else if (elapsed_time > twarn) { status = STATE_WARNING; } else { status = STATE_OK; } PQfinish (conn); printf (_(" %s - database %s (%d sec.)|%s\n"), state_text(status), dbName, elapsed_time, fperfdata("time", elapsed_time, "s", (int)twarn, twarn, (int)tcrit, tcrit, TRUE, 0, FALSE,0)); return status; }
// Entry point int main(int argc, char **argv) { GTH_api api; int data_socket = -1; int result; int monitoring = 0; int verbose = 0; Channel_t channels[MAX_MTP2_CHANNELS]; int i; int n_channels = 0; int n_sus_per_file = 0; int duration_per_file = 0; int stop_after_interval = 0; int output_filename_format = 0; int drop_fisus = 0; int esnf = 0; int listen_port = 0; int listen_socket = -1; enum PCap_format format = PCAP_NG; char *hostname; char *base_filename; // Check a couple of assumptions about type size. assert(sizeof(u32) == 4); assert(sizeof(u16) == 2); win32_specific_startup(); process_arguments(argv, argc, &monitoring, &verbose, &n_sus_per_file, &duration_per_file, &stop_after_interval, &output_filename_format, &drop_fisus, &esnf, &hostname, channels, &n_channels, &base_filename, &format); result = gth_connect(&api, hostname, verbose); if (result != 0) { die("Unable to connect to the GTH. Giving up."); } read_hw_description(&api, hostname); enable_l1(&api, channels, n_channels, monitoring); listen_socket = gth_make_listen_socket(&listen_port); for (i = 0; i < n_channels; i++){ monitor_mtp2(&api, channels + i, i, drop_fisus, esnf, listen_port, listen_socket); if (i == 0) { data_socket = gth_wait_for_accept(listen_socket); } } fprintf(stderr, "capturing packets, press ^C to abort\n"); convert_to_pcap(&api, data_socket, base_filename, n_sus_per_file, duration_per_file, stop_after_interval, output_filename_format, channels, n_channels, format); return 0; // not reached }
int main (int argc, char **argv) { /* Local Vars */ MYSQL *conn; MYSQL_RES *result; MYSQL_ROW row; int ret; int i; const char *server_version; struct timeval start_time; double time_delta; /* Set signal handling and alarm */ if (signal(SIGALRM, timeout_alarm_handler) == SIG_ERR) critical("Setup SIGALRM trap failed!"); /* Process check arguments */ if (process_arguments(argc, argv) != OK) unknown("Parsing arguments failed!"); /* Start plugin timeout */ alarm(mp_timeout); gettimeofday(&start_time, NULL); /* Connectiong to mysqld */ conn = mp_mysql_init(); /* Get server version */ server_version = mysql_get_server_info(conn); /* Get status info */ if (mp_showperfdata) { ret = mysql_query(conn, "SHOW /*!50002 GLOBAL */ STATUS;"); if (ret != 0) critical("Query 'SHOW GLOBAL STATUS' failed: %s", mysql_error(conn)); result = mysql_store_result(conn); while ((row = mysql_fetch_row(result))) { for (i=0; i < variables; i++) { if (strcmp(variable[i], row[0]) == 0) { mp_perfdata_int(row[0], strtol(row[1], NULL, 10), unit[i], NULL); } } } mysql_free_result(result); } mp_mysql_deinit(conn); time_delta = mp_time_delta(start_time); mp_perfdata_float("time", (float)time_delta, "s", NULL); ok("MySQL v%s", server_version); critical("You should never reach this point."); }
int Organize::main(int argc, char* argv[]){ int ret_val; //int for determining exit number if(retval = process_arguments(argc,argv)) return retval; //loop body return 0; }
int premake_execute(lua_State* L, int argc, const char** argv) { /* Parse the command line arguments */ int z = process_arguments(L, argc, argv); /* Run the built-in Premake scripts */ if (z == OKAY) z = load_builtin_scripts(L); return z; }
int main(int argc, char *argv[]) { /* allocates the space for the "final" result code that is going to be returned as part of the normal command execution, a positive or negative values should idicate an error, a zero value indicates that a normal execution has just finished */ ERROR_CODE return_value; /* allocates space for the name of the program (process) to be executed */ char *program_name; /* allocates the map that will contain the various processed arguments, indexed by name */ struct hash_map_t *arguments; /* prints a debug message */ V_DEBUG_F("Receiving %d argument(s)\n", argc); /* in case the number of arguments is less than one (exception case) returns in error */ if(argc < 1) { cleanup(NULL); RAISE_ERROR_S(1); } /* retrieves the first argument value as the name of the process (program) to be executed */ program_name = argv[0]; /* processes the various arguments into a map and then executes the corresponding (initial) actions */ process_arguments(argc, argv, &arguments); return_value = execute_arguments(program_name, arguments); /* cleans the current process information so that no remaining structure or resource is left in an invalid or erroneous state */ cleanup(arguments); /* deletes the processed arguments and then cleans up the pool based memory allocation system releasing all of its memory before the exit (no leaks) */ delete_arguments(arguments); cleanup_palloc(); /* prints a debug message about the ending of the sytem for the execution of the service and then returns the normal return code (success status) to the caller process */ V_DEBUG_F( "Finishing process [%ld pending]\n", (long int) ALLOCATIONS ); RAISE_AGAIN(return_value); }
int main(int argc, char **argv) { GError *error = NULL; int retval = EXIT_SUCCESS; EVP_PKEY *pubkey; if (!process_arguments(&argc, &argv, &error)) { retval = handle_error(error); g_clear_error(&error); } else if ((pubkey = read_public_key(option_key_file, &error)) == NULL) { retval = handle_error(error); g_clear_error(&error); } else { FILE *infile = fopen(option_data_file, "rb"); if (infile == NULL) { fprintf(stderr, "%s: %s\n", option_data_file, strerror(errno)); retval = EXIT_IO_ERROR; } else { uint8_t hash[SHA256_DIGEST_LENGTH]; uint8_t signature[SIGNATURE_SIZE]; if (fread(signature, 1, sizeof(signature), infile) != sizeof(signature)) { if (ferror(infile)) { fprintf( stderr, "%s: %s\n", option_data_file, strerror(errno)); retval = EXIT_IO_ERROR; } else { fprintf(stderr, "%s: File too short for signature\n", option_data_file); retval = EXIT_FORMAT_ERROR; } } else if (!hash_stream(infile, hash, &error) || !verify_signature(hash, signature, pubkey, &error)) { retval = handle_error(error); g_clear_error(&error); } else if (option_out_file && !write_out_file(infile, option_out_file, &error)) { retval = handle_error(error); g_clear_error(&error); } fclose(infile); } EVP_PKEY_free(pubkey); } return retval; }
int main (int argc, char **argv) { int users = -1; int result = STATE_UNKNOWN; char *perf; struct utmpx *putmpx; setlocale (LC_ALL, ""); bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); perf = strdup (""); /* Parse extra opts if any */ argv = np_extra_opts (&argc, argv, progname); if (process_arguments (argc, argv) == ERROR) usage4 (_("Could not parse arguments")); users = 0; /* get currently logged users from utmpx */ setutxent (); while ((putmpx = getutxent ()) != NULL) if (putmpx->ut_type == USER_PROCESS) users++; endutxent (); /* check the user count against warning and critical thresholds */ if (users > cusers) result = STATE_CRITICAL; else if (users > wusers) result = STATE_WARNING; else if (users >= 0) result = STATE_OK; if (result == STATE_UNKNOWN) printf ("%s\n", _("Unable to read output")); else { asprintf (&perf, "%s", perfdata ("users", users, "", TRUE, wusers, TRUE, cusers, TRUE, 0, FALSE, 0)); printf (_("USERS %s - %d users currently logged in |%s\n"), state_text (result), users, perf); } return result; }
int main(int argc, char *argv[]) { // CygWin sometimes dumps core when an exception is thrown, rather than // reporting it, so we do it ourselves: try { process_arguments(argc, argv); } catch (std::exception &exc) { std::cerr << "Exception: " << exc.what() << std::endl; } }
int main(int argc, char **argv){ int dhcp_socket; int result = STATE_UNKNOWN; setlocale (LC_ALL, ""); bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); /* Parse extra opts if any */ argv=np_extra_opts(&argc, argv, progname); if(process_arguments(argc,argv)!=OK){ usage4 (_("Could not parse arguments")); } /* this plugin almost certainly needs root permissions. */ np_warn_if_not_root(); /* create socket for DHCP communications */ dhcp_socket=create_dhcp_socket(); /* get hardware address of client machine */ if(user_specified_mac!=NULL) memcpy(client_hardware_address,user_specified_mac,6); else get_hardware_address(dhcp_socket,network_interface_name); if(unicast) /* get IP address of client machine */ get_ip_address(dhcp_socket,network_interface_name); /* send DHCPDISCOVER packet */ send_dhcp_discover(dhcp_socket); /* wait for a DHCPOFFER packet */ get_dhcp_offer(dhcp_socket); /* close socket we created */ close_dhcp_socket(dhcp_socket); /* determine state/plugin output to return */ result=get_results(); /* free allocated memory */ free_dhcp_offer_list(); free_requested_server_list(); return result; }
int main(int argc, char *argv[]) { QApplication app(argc, argv); tool_data_t *tool = process_arguments(argc, argv); QString tool_name = ""; QStringList tool_args; if (tool != NULL) { tool_name = tool->name; tool_args = tool->arguments; delete tool; } drgui_main_window_t main_win(tool_name, tool_args); main_win.show(); return app.exec(); }
int main(int argc, char *argv[]) { int last_arg; ztxt *ztxtdb; int x; /* Default options for a new DB */ options.list_bmrks = 0; options.adjust_type = 0; options.line_length = 0; options.title_set = 0; options.output_filename = NULL; options.anno_filename = NULL; options.bmrk_filename = NULL; options.regex_filename = NULL; options.deconstruct = 0; /* Create a new zTXT database */ ztxtdb = ztxt_init(); errorif(ztxtdb == NULL); /* Processing... */ last_arg = process_arguments(ztxtdb, argc, argv); if (last_arg >= argc) { fprintf(stderr, "no input\n"); exit(1); } /* Do something */ if (!options.deconstruct) x = create_ztxt(ztxtdb, argv[last_arg]); else x = deconstruct_ztxt(ztxtdb, argv[last_arg]); /* Free memory */ ztxt_free(ztxtdb); if (!x) return 1; return 0; }
int main (int argc, char **argv) { /* Local Vars */ FILE *fp; mp_subprocess_t *subp = NULL; char *missing = NULL; char *foreign = NULL; rhcs_clustat *clustat; rhcs_clustat_group **groups; rhcs_clustat_node **nodes; rhcs_conf *conf; rhcs_conf_fodom_node **fodomnode; rhcs_conf_service **service; uid_t uid = 0; // Perfdata int services_total = 0; int services_local = 0; int services_stopped = 0; int services_failed = 0; int services_started = 0; int nodes_total = 0; int nodes_online = 0; /* Set signal handling and alarm */ if (signal(SIGALRM, timeout_alarm_handler) == SIG_ERR) critical("Setup SIGALRM trap failed!"); /* Process check arguments */ if (process_arguments(argc, argv) != OK) unknown("Parsing arguments failed!"); /* Start plugin timeout */ alarm(mp_timeout); // Need to be root if (nonroot == 0) mp_noneroot_die(); alarm(mp_timeout); // Parse clustat if (nonroot == 0) { uid = getuid(); if (setuid(0) != 0) unknown("setuid failed"); subp = mp_subprocess((char *[]) {"/usr/sbin/clustat","-x", NULL});
int wmain(int argc, WCHAR *argv[]) { int status_code = 0; if (!process_arguments(argc, argv)) { HeapFree(GetProcessHeap(), 0, task_list); return 1; } if (force_termination) status_code = terminate_processes(); else status_code = send_close_messages(); HeapFree(GetProcessHeap(), 0, task_list); return status_code; }
int main(int argc, char* argv[]) { try { return process_arguments(argc, argv); } catch (const std::exception& xcpt) { std::cerr << "Exception caught: " << xcpt.what() << std::endl; return -1; } catch (...) { std::cerr << "Unknown exception caught." << std::endl; return -2; } return -3; }
int premake_execute(lua_State* L, int argc, const char** argv) { int z; /* push the absolute path to the Premake executable */ lua_pushcfunction(L, path_getabsolute); premake_locate(L, argv[0]); lua_call(L, 1, 1); lua_setglobal(L, "_PREMAKE_COMMAND"); /* Parse the command line arguments */ z = process_arguments(L, argc, argv); /* Run the built-in Premake scripts */ if (z == OKAY) z = load_builtin_scripts(L); return z; }
int main(int argc, char **argv) { struct pe_as_rd as; if (argv[0] != (char *)0) { program_name = argv[0]; } else { program_name= "pep"; } process_arguments(argc, argv); if (!pe_as_rd_open(&as, language, input_file_name)) return EXIT_FAILURE; if (!dump(&as)) return EXIT_FAILURE; if (!pe_as_rd_close(&as)) return EXIT_FAILURE; return EXIT_SUCCESS; }
int main (int argc, char* const *argv) { char filepath[MAXPATHLEN]; filepath[0] = '\0'; process_arguments(argc, argv, filepath); // Perform typical OpenCL setup in order to obtain a context and command // queue. init_opencl(); // Check if the current architecture is compatible with the specified test options if (device_type == CL_DEVICE_TYPE_CPU) { #if __LP64__ if (is32bit) fprintf(stderr, "Warning: user specified the 'cpu32' option on the 64bit architecture.\n"); #else if (!is32bit) fprintf(stderr, "Warning: user specified the 'cpu64' option on the 32bit architecture.\n"); #endif } else if (device_type == CL_DEVICE_TYPE_GPU) { cl_int err; cl_uint address_bits = 0; err = clGetDeviceInfo(device, CL_DEVICE_ADDRESS_BITS, sizeof(address_bits), &address_bits, NULL); if (!is32bit && (address_bits == 32)) fprintf(stderr, "Warning: user specified the 'gpu64' option on the 32bit architecture.\n"); else if (is32bit && (address_bits == 64)) fprintf(stderr, "Warning: user specified the 'gpu32' option on the 64bit architecture.\n"); } // Obtain a CL program and kernel from our pre-compiled bitcode file and // test it by running the kernel on some test data. create_program_from_bitcode(filepath); // Close everything down. shutdown_opencl(); return 0; }