Mercurial > hg > wm
comparison Meerwald/gen_koch_sig.c @ 8:f83ef905a63d
fixing many warnings
increase capacity for coordinates in bruyn
fix some uninit. variables
| author | Peter Meerwald <pmeerw@cosy.sbg.ac.at> |
|---|---|
| date | Tue, 22 Apr 2008 13:36:05 +0200 |
| parents | be303a3f5ea8 |
| children | 4987db85cfae |
comparison
equal
deleted
inserted
replaced
| 7:2b350281f8b0 | 8:f83ef905a63d |
|---|---|
| 62 strcpy(output_name, optarg); | 62 strcpy(output_name, optarg); |
| 63 break; | 63 break; |
| 64 case 'q': | 64 case 'q': |
| 65 q = atoi(optarg); | 65 q = atoi(optarg); |
| 66 if (q <= 0 || q > 100) { | 66 if (q <= 0 || q > 100) { |
| 67 fprintf(stderr, "%s: quantization factor %f out of range\n", progname, q); | 67 fprintf(stderr, "%s: quantization factor %d out of range\n", progname, q); |
| 68 exit(1); | 68 exit(1); |
| 69 } | 69 } |
| 70 break; | 70 break; |
| 71 case 's': | 71 case 's': |
| 72 if ((sig = fopen(optarg, "r")) == NULL) { | 72 if ((sig = fopen(optarg, "r")) == NULL) { |
| 87 if (argc > 1) { | 87 if (argc > 1) { |
| 88 usage(); | 88 usage(); |
| 89 exit(1); | 89 exit(1); |
| 90 } | 90 } |
| 91 | 91 |
| 92 if (argc == 1 && *argv[0] != '-') | 92 if (argc == 1 && *argv[0] != '-') { |
| 93 if ((in = fopen(argv[0], "rb")) == NULL) { | 93 if ((in = fopen(argv[0], "rb")) == NULL) { |
| 94 fprintf(stderr, "%s: unable to open input file %s\n", progname, argv[0]); | 94 fprintf(stderr, "%s: unable to open input file %s\n", progname, argv[0]); |
| 95 exit(1); | 95 exit(1); |
| 96 } | 96 } |
| 97 else | 97 else |
| 98 strcpy(input_name, argv[0]); | 98 strcpy(input_name, argv[0]); |
| 99 | 99 } |
| 100 | |
| 100 if (s) | 101 if (s) |
| 101 srandom(s); | 102 srandom(s); |
| 102 else | 103 else |
| 103 srandom(time(NULL) * getpid()); | 104 srandom(time(NULL) * getpid()); |
| 104 | 105 |
| 145 | 146 |
| 146 fprintf(out, "KCSG\n"); | 147 fprintf(out, "KCSG\n"); |
| 147 fprintf(out, "%d\n", n); | 148 fprintf(out, "%d\n", n); |
| 148 fprintf(out, "%f\n", l); | 149 fprintf(out, "%f\n", l); |
| 149 fprintf(out, "%d\n", q); | 150 fprintf(out, "%d\n", q); |
| 150 fprintf(out, "%d\n", random()); | 151 fprintf(out, "%ld\n", random()); |
| 151 fwrite(signature, sizeof(char), nb, out); | 152 fwrite(signature, sizeof(char), nb, out); |
| 152 fprintf(out, "\n"); | 153 fprintf(out, "\n"); |
| 153 | 154 |
| 154 fclose(out); | 155 fclose(out); |
| 155 | 156 |
