int main(int argc, char **argv) { /* test that NULL means don't set a default, but "0" sets to zero */ debug = -99; nokbd = -1; fixedBR = -1.0; cleSetDefaults(clargs); if (debug != -99) { fprintf(stderr, "debug defaulted to %d\n", debug); exit(-1); } if (nokbd != 0) { /* implicit defaults for bools? */ fprintf(stderr, "nokbd defaulted to %d\n", nokbd); exit(-1); } if (fixedBR != DFLT_FXBR) { fprintf(stderr, "fixBR defaulted to %f\n", fixedBR); exit(-1); } if(cleHandleArgs(clargs, argc, argv)) { cleUsage(clargs, argv[0]); exit(-1); } printf("algoType=%d fixedBR=%.1f nokbd=%d debug=%d\n", algoType, fixedBR, nokbd, debug); printf("inpath=%s\n", inpath?inpath:"(NULL)"); printf("outpath=%s\n", outpath?outpath:"(NULL)"); exit(0); }
main(int argc, char **argv) { char *programName; int err = 0; programName = argv[0]; cleSetDefaults(clargs); err = cleExtractArgs(clargs, &argc, argv, 0); if (argc > 1) {spec = argv[1];} if(err || spec == NULL) { cleUsage(clargs, programName); exit(-1); } Range r(spec, min_val, max_val+1); if (debug) { r.PrintRanges(spec,stdout); // Is it full? fprintf(stdout, "first=%d last=%d full=%d contains(0)=%d\n", r.first(), r.last(), r.full(), r.contains(0)); } if (indx != RNG_VAL_BAD) { int sby=5; fprintf(stderr, "list[%d] = %d\n", indx, r.index(indx)); Range::iterator it = r.begin(); int i; for (i = 0; i < indx; ++i) { ++it; } int v1 = *it; it.step_by(sby); fprintf(stderr, "list[%d+%d] = %d..%d\n", indx, sby, v1, *it); } if (!quiet) { int first = 1; for (Range::iterator it = r.begin(); !it.at_end(); it++) { // Handle any inter-term separator if (first) {first=0;} else { if (commas) { fprintf(stdout, ","); } else if (horizontal) { fprintf(stdout, " "); } if (!horizontal) { fprintf(stdout, "\n"); } } // Print the actual term fprintf(stdout, "%d", *it); } // Always a final return fprintf(stdout, "\n"); } }