int main(int argc, char *argv[]) { const char *zipfile; int nopts; if (isatty(STDOUT_FILENO)) tty = 1; if (getenv("UNZIP_DEBUG") != NULL) unzip_debug = 1; for (int i = 0; i < argc; ++i) debug("%s%c", argv[i], (i < argc - 1) ? ' ' : '\n'); /* * Info-ZIP's unzip(1) expects certain options to come before the * zipfile name, and others to come after - though it does not * enforce this. For simplicity, we accept *all* options both * before and after the zipfile name. */ nopts = getopts(argc, argv); /* * When more of the zipinfo mode options are implemented, this * will need to change. */ if (zipinfo_mode && !Z1_opt) { printf("Zipinfo mode needs additional options\n"); exit(1); } if (argc <= nopts) usage(); zipfile = argv[nopts++]; if (strcmp(zipfile, "-") == 0) zipfile = NULL; /* STDIN */ while (nopts < argc && *argv[nopts] != '-') add_pattern(&include, argv[nopts++]); nopts--; /* fake argv[0] */ nopts += getopts(argc - nopts, argv + nopts); if (n_opt + o_opt + u_opt > 1) errorx("-n, -o and -u are contradictory"); time(&now); unzip(zipfile); exit(0); }
main(int argc, char *argv[]) { newSng_n = mktemp("sngXXXXXX"); newSym_n = mktemp("symXXXXXX"); signal(SIGINT, (SIG_TYP)cleanup); getopts(argc, argv); symb = new char[bufsize]; newSymb = new char[bufsize]; newSngb = new char[bufsize]; if (optind == argc) tryToDemangleAout("a.out"); else { for (; optind < argc; optind++) tryToDemangleAout(argv[optind]); } delete symb; delete newSymb; delete newSngb; return 0; }
int getoptscmd(int argc, char **argv) { char **optbase = NULL, **ap; int i; if (argc < 3) error("usage: getopts optstring var [arg]"); if (shellparam.reset == 1) { INTOFF; if (shellparam.optp) { for (ap = shellparam.optp ; *ap ; ap++) ckfree(*ap); ckfree(shellparam.optp); shellparam.optp = NULL; } if (argc > 3) { shellparam.optp = ckmalloc((argc - 2) * sizeof *ap); memset(shellparam.optp, '\0', (argc - 2) * sizeof *ap); for (i = 0; i < argc - 3; i++) shellparam.optp[i] = savestr(argv[i + 3]); } INTON; optbase = argc == 3 ? shellparam.p : shellparam.optp; shellparam.optnext = optbase; shellparam.optptr = NULL; shellparam.reset = 0; } else optbase = shellparam.optp ? shellparam.optp : shellparam.p; return getopts(argv[1], argv[2], optbase, &shellparam.optnext, &shellparam.optptr); }
int main(int argc, char** argv) { int* numtests = &tests; int rc = 0; int (*tests[])() = {NULL, test1, test2a_s, test2a_m, test2b, test2c, test3a_s, test3a_m, test3b, test4_s, test4_m, /*test5a, test5b,test5c */}; //MQTTClient_nameValue* info; xml = fopen("TEST-test3.xml", "w"); fprintf(xml, "<testsuite name=\"test3\" tests=\"%d\">\n", (int)(ARRAY_SIZE(tests) - 1)); setenv("MQTT_C_CLIENT_TRACE", "ON", 1); setenv("MQTT_C_CLIENT_TRACE_LEVEL", "ERROR", 1); getopts(argc, argv); if (options.test_no == 0) { /* run all the tests */ for (options.test_no = 1; options.test_no < ARRAY_SIZE(tests); ++options.test_no) rc += tests[options.test_no](options); /* return number of failures. 0 = test succeeded */ } else rc = tests[options.test_no](options); /* run just the selected test */ MyLog(LOGA_INFO, "Total tests run: %d", *numtests); if (rc == 0) MyLog(LOGA_INFO, "verdict pass"); else MyLog(LOGA_INFO, "verdict fail"); fprintf(xml, "</testsuite>\n"); fclose(xml); return rc; }
int main(int argc, char** argv) { int rc = 0; int (*tests[])() = {NULL, test1, test2}; int i; xml = fopen("TEST-MQTT4sync.xml", "w"); fprintf(xml, "<testsuite name=\"test-mqtt4sync\" tests=\"%d\">\n", (int)(ARRAY_SIZE(tests) - 1)); setenv("MQTT_C_CLIENT_TRACE", "ON", 1); setenv("MQTT_C_CLIENT_TRACE_LEVEL", "ERROR", 1); getopts(argc, argv); for (i = 0; i < options.iterations; ++i) { if (options.test_no == 0) { /* run all the tests */ for (options.test_no = 1; options.test_no < ARRAY_SIZE(tests); ++options.test_no) rc += tests[options.test_no](options); /* return number of failures. 0 = test succeeded */ } else rc = tests[options.test_no](options); /* run just the selected test */ } if (rc == 0) MyLog(LOGA_INFO, "verdict pass"); else MyLog(LOGA_INFO, "verdict fail"); fprintf(xml, "</testsuite>\n"); fclose(xml); return rc; }
int main( int argc, char **argv ) { int i = 1, j = 0, sch = 0; while ( i < argc ) { if ( (argv[i][0] == '-') && isin(argv[i][1],"en-") && getopts(argv[i]+1) ) i++; if ( stopargs ) break; } char skip = 0; while ( i < argc ) { if ( !(opt&O_ESC) ) { fputs(argv[i],stdout); putchar(((i+1)==argc)?((opt&O_NONL)?'\0':'\n'):' '); i++; continue; } j = skip = 0; while ( !skip ) { sch = descape(argv[i]+j); j += sch; if ( sch == -1 ) return 0; if ( !sch ) skip = 1; } putchar((i<(argc-1))?' ':'\n'); i++; } return 0; }
/* start of program execution */ int main(int argc, char* argv[]){ int rank; #ifdef DO_MPI MPI_Init(&argc,&argv); MPI_Comm_rank(MPI_COMM_WORLD,&rank); #else rank = 0; #endif /* parse command-line options */ getopts(argc, argv); /* if verbose mode, print out program information as a header */ if(rank == 0 && !opt.silent){ printf("------------------------------------\n"); show_version(); printf("------------------------------------\n"); } int retval = run(rank); #ifdef DO_MPI MPI_Finalize(); #endif /* run the simulation until end of program*/ return retval; }
int main(int argc, char *argv[]) { int rc; getopts(argc, argv); if(getlognumber()) { fprintf(stderr, "Cannot determine actual log number\n"); exit(4); } if(run_as_daemon) { if((rc = daemonize(outputfile)) != 0) { fprintf(stderr, "Error starting daemon process : %s\n", strerror(rc)); exit(5); } } else { if(redirect(outputfile)) { exit(6); } } if(workdir) { if(chdir(workdir)) { perror("Error changing directory: "); exit(7); } } if(verbose) { print_config(); } if(cmd != NULL) { sighandling(); if(start_cmd() != 0) exit(9); } return process(); }
static int main(string arg) { object ply, island; string file, *map; if (!objectp(ply = this_player())) { return 0; } if (!stringp(arg) || !strlen(arg = getopts("ac", arg))) { if (!stringp(file = environment(ply)->query_island())) { return notify_fail("Usage: " + query_verb() + " <island>"); } sscanf(file, EMP_DIR_ISLANDS + "%s/island", arg); } else { file = EMP_DIR_ISLANDS + arg + "/island"; } if (file_size(file + ".c") < 0 || !objectp(island = file->__bootstrap()) || !arrayp(map = island->create_island_view())) { return notify_fail("Island '" + file + "' not found."); } if (opts['a']) { map = island->format_view(map, 1); } else if (opts['c']) { map = island->format_view(map, store_fp("do_unload"), arg); } else { map = island->format_view(map, store_fp("is_loaded"), arg); } tell_ansi(ply, "\n" + implode(map, "\n")); return 1; }
int main(int argc, char** argv) { int rc = 0; int (*tests[])() = {NULL, test1, test2, test3, test4, test5, test6, test7, test8, test9, test10, test11, test12, test13}; xml = fopen("TEST-test1.xml", "w"); fprintf(xml, "<testsuite name=\"test1\" tests=\"%d\">\n", (int)(ARRAY_SIZE(tests) - 1)); getopts(argc, argv); if (options.test_no == 0) { /* run all the tests */ for (options.test_no = 1; options.test_no < ARRAY_SIZE(tests); ++options.test_no) rc += tests[options.test_no](options); /* return number of failures. 0 = test succeeded */ } else rc = tests[options.test_no](options); /* run just the selected test */ if (rc == 0) MyLog(LOGA_INFO, "verdict pass"); else MyLog(LOGA_INFO, "verdict fail"); fprintf(xml, "</testsuite>\n"); fclose(xml); return rc; }
int main( int argc, char **argv ) { int i=0; while ( (++i<argc) && (*argv[i] == '-') ) if ( getopts(argv[i]+1) ) return 1; if ( !opt ) opt |= O_KERN; return printuname(); }
int main(int argc, char *argv[]) { bzero(&g_conf, sizeof(g_conf)); getopts(argc, argv); signal(SIGPIPE,SIG_IGN); return bs_main(); }
int main (int argc, char **argv) { int retval = 0; int flag = 2; setlocale(LC_ALL, ""); bindtextdomain(GETTEXT_PACKAGE, LIBSMBIOS_LOCALEDIR); textdomain(GETTEXT_PACKAGE); int c; char *args = 0; while ( (c=getopts(argc, argv, opts, &args)) != 0 ) { switch(c) { case 1: memory_obj_factory(MEMORY_UNIT_TEST_MODE | MEMORY_GET_SINGLETON, args); break; case 2: cmos_obj_factory(CMOS_UNIT_TEST_MODE | CMOS_GET_SINGLETON, args); break; case 3: flag = 1; // fall through case 4: if( sysinfo_has_up_boot_flag() ) sysinfo_set_up_boot_flag( flag ); break; case 255: printf( _("Libsmbios version: %s\n"), smbios_get_library_version_string()); exit(0); break; default: break; } free(args); } // default if no other params specified if( sysinfo_has_up_boot_flag() ) { if(sysinfo_get_up_boot_flag()) { retval = 0; printf(_("UP Boot Flag SET\n")); } else { retval = 1; printf(_("UP Boot Flag NOT SET\n")); } } exit(retval); }
int main(int argc, char *argv[]) { if (getopts(argc, argv) == 1) return 1; if (luna_service_initialize("com.apptuckerbox.service")) luna_service_start(); return 0; }
int main(int argc, char** argv) { int rc = 0; if (argc < 2) usage(); char* topic = argv[1]; if (strchr(topic, '#') || strchr(topic, '+')) opts.showtopics = 1; if (opts.showtopics) printf("topic is %s\n", topic); getopts(argc, argv); IPStack ipstack = IPStack(); MQTT::Client<IPStack, Countdown, 1000> client = MQTT::Client<IPStack, Countdown, 1000>(ipstack); signal(SIGINT, cfinish); signal(SIGTERM, cfinish); MQTTPacket_connectData data = MQTTPacket_connectData_initializer; data.willFlag = 0; data.MQTTVersion = 3; data.clientID.cstring = opts.clientid; data.username.cstring = opts.username; data.password.cstring = opts.password; data.keepAliveInterval = 10; data.cleansession = 1; printf("will flag %d\n", data.willFlag); myconnect(ipstack, client, data); rc = client.subscribe(topic, opts.qos, messageArrived); printf("Subscribed %d\n", rc); while (!toStop) { client.yield(1000); //if (!client.isconnected) // myconnect(ipstack, client, data); } printf("Stopping\n"); rc = client.disconnect(); ipstack.disconnect(); return 0; }
int main(int argc, char *argv[]) { const char *zipfile; int nopts; if (isatty(STDOUT_FILENO)) tty = 1; if (getenv("UNZIP_DEBUG") != NULL) unzip_debug = 1; for (int i = 0; i < argc; ++i) debug("%s%c", argv[i], (i < argc - 1) ? ' ' : '\n'); /* * Info-ZIP's unzip(1) expects certain options to come before the * zipfile name, and others to come after - though it does not * enforce this. For simplicity, we accept *all* options both * before and after the zipfile name. */ nopts = getopts(argc, argv); if (argc <= nopts) usage(); zipfile = argv[nopts++]; while (nopts < argc && *argv[nopts] != '-') add_pattern(&include, argv[nopts++]); nopts--; /* fake argv[0] */ nopts += getopts(argc - nopts, argv + nopts); if (n_opt + o_opt + u_opt > 1) errorx("-n, -o and -u are contradictory"); time(&now); unzip(zipfile); exit(0); }
int main(int argc, char *argv[]) { debug = DEFAULT_DEBUG_LEVEL; if (getopts(argc, argv) == 1) return 1; if (luna_service_initialize("org.webosinternals.xecutah")) luna_service_start(); return 0; }
int main(int argc, char *argv[]) { debug = DEFAULT_DEBUG_LEVEL; if (getopts(argc, argv) == 1) return 1; if (luna_service_initialize("uk.co.nicbedford.adhoc")) luna_service_start(); return 0; }
int main(int argc, char** argv) { int rc = 0; int (*tests[])() = {NULL, test1, test2, test3, test4, test5, test6}; /* indexed starting from 1 */ MQTTAsync_nameValue* info; int i; xml = fopen("TEST-test4.xml", "w"); fprintf(xml, "<testsuite name=\"test4\" tests=\"%d\">\n", (int)(ARRAY_SIZE(tests)) - 1); getopts(argc, argv); MQTTAsync_setTraceCallback(trace_callback); info = MQTTAsync_getVersionInfo(); while (info->name) { MyLog(LOGA_INFO, "%s: %s", info->name, info->value); info++; } for (i = 0; i < options.iterations; ++i) { if (options.test_no == -1) { /* run all the tests */ for (options.test_no = 1; options.test_no < ARRAY_SIZE(tests); ++options.test_no) { failures = 0; MQTTAsync_setTraceLevel(MQTTASYNC_TRACE_ERROR); rc += tests[options.test_no](options); /* return number of failures. 0 = test succeeded */ } } else { MQTTAsync_setTraceLevel(MQTTASYNC_TRACE_ERROR); rc = tests[options.test_no](options); /* run just the selected test */ } } if (rc == 0) MyLog(LOGA_INFO, "verdict pass"); else MyLog(LOGA_INFO, "verdict fail"); fprintf(xml, "</testsuite>\n"); fclose(xml); return rc; }
int main(int argc, char **argv) { struct tap tapin, tapout; FILE *infile; long pulse; getopts(argc, argv); if (optind == argc) { infile = stdin; } else if (optind == argc - 1) { if (!strcmp(argv[optind], "-")) { infile = stdin; } else { infile = fopen(argv[optind], "rb"); if (!infile) { perror(argv[optind]); return 1; } } } else { fprintf(stderr, "%s: too many arguments\n", argv0); usage(); return 1; } if (tap_read_header(&tapin, infile)) { fprintf(stderr, "%s: error reading TAP file\n", argv0); return 1; } if (outversion < 0) tapout.version = tapin.version; else tapout.version = outversion; if (tap_write_header(&tapout, stdout)) { fprintf(stderr, "%s: error writing TAP file\n", argv0); return 1; } while ((pulse = get_pulse(&tapin)) >= 0) { if (tapin.version == 0 && pulse == V0_LONG_PULSE) { pulse = LONG_PULSE; } pulse /= speed; put_pulse(pulse, &tapout); } tap_close(&tapout); return 0; }
/* start of program execution */ int main(int argc, char* argv[]){ /* parse command-line options */ getopts(argc, argv); /* if verbose mode, print out program information as a header */ if(!opt.silent){ printf("------------------------------------\n"); show_version(); printf("------------------------------------\n"); } int retval = run(); /* run the simulation until end of program*/ return retval; }
int main(int argc, char** argv) { int* numtests = &tests; int rc = 0; int (*tests[])() = { NULL, test1, test2, test3, test4, test5}; sprintf(unique, "%u", rand()); MyLog(LOGA_INFO, "Random prefix/suffix is %s", unique); xml = fopen("TEST-test9.xml", "w"); fprintf(xml, "<testsuite name=\"test9\" tests=\"%lu\">\n", ARRAY_SIZE(tests) - 1); MQTTAsync_setTraceCallback(handleTrace); getopts(argc, argv); if (options.test_no == 0) { /* run all the tests */ for (options.test_no = 1; options.test_no < ARRAY_SIZE(tests); ++options.test_no) { failures = 0; MQTTAsync_setTraceLevel(MQTTASYNC_TRACE_ERROR); rc += tests[options.test_no](options); /* return number of failures. 0 = test succeeded */ } } else { MQTTAsync_setTraceLevel(MQTTASYNC_TRACE_ERROR); rc = tests[options.test_no](options); /* run just the selected test */ } MyLog(LOGA_INFO, "Total tests run: %d", *numtests); if (rc == 0) MyLog(LOGA_INFO, "verdict pass"); else MyLog(LOGA_INFO, "verdict fail"); fprintf(xml, "</testsuite>\n"); fclose(xml); return rc; }
int getoptscmd(int argc, char **argv) { char **optbase; if (argc < 3) error("usage: getopts optstring var [arg]"); else if (argc == 3) optbase = shellparam.p; else optbase = &argv[3]; if (shellparam.reset == 1) { shellparam.optnext = optbase; shellparam.optptr = NULL; shellparam.reset = 0; } return getopts(argv[1], argv[2], optbase, &shellparam.optnext, &shellparam.optptr); }
int main(int argc, char *argv[]) { int c; int aflag = 0; int bflag = 0; int numoption = 0; char txtoption[200] = "default"; opterr = 0; while ( (c = getopts(argc, argv, "abn:t:")) != EOF) { switch (c) { case 'a' : aflag = 1; break; case 'b' : bflag = 1; break; case 'n' : numoption = atoi(optarg); break; case 't' : strcpy(txtoption, optarg); break; case '?' : printf(stderr, "wrong option: -%c\n", optopt); } } if (aflag) printf("Parametr a is set\n"); if (bflag) printf("Parametr b is set\n"); printf("Num value of option %d\n", numoption); printf("Text value of option %s\n", txtoption); argv +=optind; argc -= optind; while(argc--) { printf("arg: %s\n", *argv++); } return 0; }
main(int argc, char *argv[]) { FILE *infile = stdin, *outfile = stdout; char line[2][256]; /* Nice & roomy */ if (Error_ == getopts(argc, argv)) usage(-1); if (help) usage(0); if (1 < xargc) infile = cant(xargv[1], "r"); if (2 < xargc) outfile = cant(xargv[2], "w"); while (NULL != fgets(line[0], 255, infile)) { char *p1, *p2; int OK; strcpy(line[1], line[0]); if ('\n' == LAST_CHAR(line[1])) LAST_CHAR(line[1]) = NUL; if (fold) strupr(line[1]); if (punc) rmpunc(line[1]); for (p1 = line[1], p2 = &LAST_CHAR(line[1]), OK = 1; p2 > p1; ++p1, --p2) { if (*p1 != *p2) { OK = 0; break; } } if (OK) fputs(line[0], outfile); } return 0; }
int main(int argc, char **argv){ int i = 0; unsigned long long start, end, delta; pthread_t tid[MAX_NUM_THREADS]; bench_log("Welcome to %s:\n\n", argv[0]); getopts(argc, argv); bench_init(1 /* start */); g_msgbuf = make_msgbuf(g_msgsize); if ( g_msgsize < 5 ) { bench_log(" Ridiculously short message %ld--exiting\n", g_msgsize); exit(1); } bench_log(" Starting %d thread(s)\n", g_numthreads); start = gettimestamp_milis(); for ( i = 0; i < g_numthreads; i++) pthread_create(&tid[i], NULL, thread_work, (void *)&i); for ( i = 0; i < g_numthreads; i++) pthread_join(tid[i], NULL); end = gettimestamp_milis(); delta = (end - start); #ifdef _WIN32 bench_log( "\n Time = %I64d milisec\n", delta); #else bench_log( "\n Time = %lld milisec\n", delta); #endif bench_init(0); return(0); }
int main(int argc, char **argv) { primsigs = primitives(); Parser ps; Lexer lexer; FILE *ic, *oc; int err = 0; getopts(argc, argv); ic = fopen(input, "r"); if(ic == NULL){ printf("Can not open the file.\n"); return 1; } parser_init(&ps); lexer_init(&lexer); lexer_setin(&lexer, ic); err |= yyparse(&ps, &lexer, "input"); fclose(ic); if(proc_compile && err == 0){ oc = fopen(compiled_file, "w"); err |= compile(oc, &ps.prog); fclose(oc); } if(proc_assemble && err == 0){ char cmd[100]; sprintf(cmd, "gcc -o %s %s -L%s %s", output, compiled_file, libdir, LIBS); system(cmd); } return 0; }
int main( int argc, char** argv ) { if ( argc < 3 ) { std::cout << "Usage: " << argv[0] << " [volumetric mesh file] [output obj file] [-t]" << std::endl; std::cout << "Generates the surface mesh of the given volumetric mesh." << std::endl; std::cout << "-t: (this option only applies with cubic meshes) Triangulates each quad face. Default: faces are left as quads." << std::endl; return 1; } char * meshFile = argv[1]; char * outputFile = argv[2]; bool outputTriangleMesh = false; opt_t opttable[] = { { (char*)"t", OPTBOOL, &outputTriangleMesh }, { NULL, 0, NULL } }; argv += 1; argc -= 1; getopts(argc,argv,opttable); if (outputTriangleMesh) printf("Triangle mesh will be triangulated (if needed).\n"); VolumetricMesh * mesh = VolumetricMeshLoader::load(meshFile); GenerateSurfaceMesh generateSurfaceMesh; ObjMesh * objMesh = generateSurfaceMesh.ComputeMesh(mesh, outputTriangleMesh); objMesh->save(outputFile); return 0; }
int main(int argc, char** argv) { int* numtests = &tests; int rc = 0; int (*tests[])() = {NULL, test1, test2a_s, test2a_m, test2b, test2c, test3a_s, test3a_m, test3b, test4_s, test4_m, test5a, test5b, test5c}; getopts(argc, argv); if (options.test_no == 0) { /* run all the tests */ for (options.test_no = 1; options.test_no < ARRAY_SIZE(tests); ++options.test_no) rc += tests[options.test_no](options); /* return number of failures. 0 = test succeeded */ } else rc = tests[options.test_no](options); /* run just the selected test */ MyLog(LOGA_INFO, "Total tests run: %d", *numtests); if (rc == 0) MyLog(LOGA_INFO, "verdict pass"); else MyLog(LOGA_INFO, "verdict fail"); return rc; }
int main(int argc, char** argv) /*****************************************************************************/ { struct options opts[] = { { 1, "rank", "rank of processor (0) ", "r", 1 }, { 2, "num_procs", "number of processors (1)", "n", 1 }, { 3, "all", "generate all meshes for number of processors (false)", "a", 0 }, { 4, "dimension", "dimension (3D)", "d", 1 }, { 5, "file", "mesh description file (no default)", "f", 1 }, { 0, NULL, NULL, NULL, 0 } }; char *args; int c; int all = FALSE; int rank = 0; int issz; int num_procs = 1; int start_rank = 0; int end_rank = 0; int dimension = 3; char * file_name = NULL; char * out_file_name = NULL; FILE * infile = NULL; long size; char *file_char_array = NULL; if(argc == 1){ getopts_usage(argv[0],opts); return 1; } while ((c = getopts(argc, argv, opts, &args)) != 0) { switch(c) { /* Special Case: Recognize options that we didn't set above. */ case -2: printf("Unknown Option: \n");/* << args << std::endl;*/ getopts_usage(argv[0],opts); return 1; break; /* Special Case: getopts() can't allocate memory. Should probably exit() here */ case -1: printf("Unabled to allocate memory from getopts().\n"); break; case 1: rank = atoi(args); break; case 2: num_procs = atoi(args); break; case 3: all = TRUE; break; case 4: dimension = atoi(args); break; case 5: { int sl = strlen(args); file_name = (char *)malloc(sl+1); file_name[sl] = '\0'; strcpy(file_name,args); } break; default: break; } /* This free() is required since getopts() automagically allocates space */ /* for "args" everytime it's called. */ free(args); } if(rank < 0 || rank >= num_procs){ getopts_usage(argv[0],opts); printf("rank must be positive and between 0 and the number of processors %i\n",rank); } if(num_procs < 0){ getopts_usage(argv[0],opts); printf("number of processors must be positive %i\n", num_procs); } /*deal with all switch*/ end_rank = num_procs; if(!all){ start_rank = rank; end_rank = start_rank+1; } infile = fopen(file_name,"r"); if(!infile){ printf("unable to open input file "); return 1; } fseek(infile, 0, SEEK_END); size = ftell(infile); fseek(infile, 0, SEEK_SET); file_char_array = (char *)malloc(size + 1); file_char_array[size] = '\0'; fread(file_char_array, sizeof(char), size, infile); fclose(infile); /*create the out_file_name*/ out_file_name = (char*)malloc(MAX_STR_LENGTH+1); for( rank = start_rank; rank != end_rank; rank ++){ int cr_result; sprintf(out_file_name,"%s.exo.%i.%i",file_name,num_procs,rank); cr_result = Create_Pamgen_Mesh(file_char_array, dimension, rank, num_procs, INT_MAX); if (cr_result == ERROR_PARSING_DEFINITION){ int essz = getPamgenEchoStreamSize(); char * echo_char_array = (char *)malloc(essz+1); printf("PARSE ERROR\n"); echo_char_array[essz] = '\0'; echo_char_array = getPamgenEchoStream(echo_char_array); if(echo_char_array)printf("%s",echo_char_array); if(cr_result == ERROR_CREATING_IMD)printf("ERROR Failure to create Inline_Mesh_Desc creation\n"); if(echo_char_array)free(echo_char_array); return 1; } if(cr_result == ERROR_CREATING_MS){ int essz = getPamgenErrorStreamSize(); char * error_char_array = (char *)malloc(essz+1); error_char_array[essz] = '\0'; error_char_array = getPamgenErrorStream(error_char_array); if(error_char_array)printf("%s",error_char_array); printf("\nERROR Failure to create Mesh_Specification\n"); if(error_char_array)free(error_char_array); return 1; } { int wssz = getPamgenWarningStreamSize(); if(wssz){ char * warning_char_array = (char *)malloc(wssz+1); warning_char_array[wssz] = '\0'; warning_char_array = getPamgenWarningStream(warning_char_array); printf("WARNING Records\n"); printf("%s",warning_char_array); free(warning_char_array); } } { issz = getPamgenInfoStreamSize(); if(issz){ char * info_char_array = (char *)malloc(issz+1); info_char_array[issz] = '\0'; info_char_array = getPamgenInfoStream(info_char_array); printf("INFO Records\n"); printf("%s",info_char_array); free(info_char_array); } } read_mesh_to_memory(); write_mesh_to_stdout(); #ifdef HAVE_PAMGEN_NEMESIS write_to_exodus(rank,num_procs,out_file_name); #endif/* HAVE_PAMGEN_NEMESIS*/ Delete_Pamgen_Mesh(); free_memory(); }/* end loop over all output ranks*/ if(file_char_array)free(file_char_array); if(out_file_name)free(out_file_name); if(file_name)free(file_name); return 0; }