Mercurial > hg > wm
comparison Meerwald/gen_kund3_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 | 2b350281f8b0 |
| children | ad1d224896c5 |
comparison
equal
deleted
inserted
replaced
| 7:2b350281f8b0 | 8:f83ef905a63d |
|---|---|
| 120 if (argc > 1) { | 120 if (argc > 1) { |
| 121 usage(); | 121 usage(); |
| 122 exit(1); | 122 exit(1); |
| 123 } | 123 } |
| 124 | 124 |
| 125 if (argc == 1 && *argv[0] != '-') | 125 if (argc == 1 && *argv[0] != '-') { |
| 126 if ((in = fopen(argv[0], "rb")) == NULL) { | 126 if ((in = fopen(argv[0], "rb")) == NULL) { |
| 127 fprintf(stderr, "%s: unable to open input file %s\n", progname, argv[0]); | 127 fprintf(stderr, "%s: unable to open input file %s\n", progname, argv[0]); |
| 128 exit(1); | 128 exit(1); |
| 129 } | 129 } |
| 130 else | 130 else |
| 131 strcpy(input_name, argv[0]); | 131 strcpy(input_name, argv[0]); |
| 132 } | |
| 132 | 133 |
| 133 if (sig) { | 134 if (sig) { |
| 134 char line[32]; | 135 char line[32]; |
| 135 fgets(line, sizeof(line), sig); | 136 fgets(line, sizeof(line), sig); |
| 136 if (strspn(line, "KD3SG") >= 5) { | 137 if (strspn(line, "KD3SG") >= 5) { |
| 161 } | 162 } |
| 162 else { | 163 else { |
| 163 fprintf(stderr, "%s: invalid signature file %s\n", progname, signature_name); | 164 fprintf(stderr, "%s: invalid signature file %s\n", progname, signature_name); |
| 164 exit(1); | 165 exit(1); |
| 165 } | 166 } |
| 166 close(sig); | 167 fclose(sig); |
| 167 } | 168 } |
| 168 | 169 |
| 169 if (s) | 170 if (s) |
| 170 srandom(s); | 171 srandom(s); |
| 171 else | 172 else |
| 193 fprintf(out, "%d\n", q); | 194 fprintf(out, "%d\n", q); |
| 194 fprintf(out, "%d\n", e); | 195 fprintf(out, "%d\n", e); |
| 195 fprintf(out, "%d\n", f); | 196 fprintf(out, "%d\n", f); |
| 196 fprintf(out, "%s\n", F); | 197 fprintf(out, "%s\n", F); |
| 197 fprintf(out, "%d\n", l); | 198 fprintf(out, "%d\n", l); |
| 198 fprintf(out, "%d\n", random()); | 199 fprintf(out, "%ld\n", random()); |
| 199 nbit_signature = NBYTESTOBITS(n_signature); | 200 nbit_signature = NBYTESTOBITS(n_signature); |
| 200 binstr = malloc((nbit_signature + 1) * sizeof(char)); | 201 binstr = malloc((nbit_signature + 1) * sizeof(char)); |
| 201 sig_to_binstr(binstr); | 202 sig_to_binstr(binstr); |
| 202 fprintf(out, "%s\n", binstr); | 203 fprintf(out, "%s\n", binstr); |
| 203 free(binstr); | 204 free(binstr); |
