file processing function --- verbosely */
| 199 | |
| 200 | /* file processing function --- verbosely */ |
| 201 | static void vprocess(FILE *fid) { |
| 202 | char line[MAX_LINE + 3], *s, pline[40]; |
| 203 | PJ_LP dat_ll; |
| 204 | PJ_XY dat_xy; |
| 205 | int linvers; |
| 206 | PJ_COORD coord; |
| 207 | |
| 208 | if (!oform) |
| 209 | oform = "%.3f"; |
| 210 | |
| 211 | if (bin_in || bin_out) |
| 212 | emess(1, "binary I/O not available in -V option"); |
| 213 | |
| 214 | for (;;) { |
| 215 | proj_errno_reset(Proj); |
| 216 | ++emess_dat.File_line; |
| 217 | |
| 218 | if (!(s = fgets(line, MAX_LINE, fid))) |
| 219 | break; |
| 220 | |
| 221 | if (!strchr(s, '\n')) { /* overlong line */ |
| 222 | int c; |
| 223 | (void)strcat(s, "\n"); |
| 224 | /* gobble up to newline */ |
| 225 | while ((c = fgetc(fid)) != EOF && c != '\n') |
| 226 | ; |
| 227 | } |
| 228 | |
| 229 | if (*s == tag) { /* pass on data */ |
| 230 | (void)fputs(s, stdout); |
| 231 | continue; |
| 232 | } |
| 233 | |
| 234 | /* check to override default input mode */ |
| 235 | if (*s == 'I' || *s == 'i') { |
| 236 | linvers = 1; |
| 237 | ++s; |
| 238 | } else |
| 239 | linvers = inverse; |
| 240 | |
| 241 | if (linvers) { |
| 242 | if (!PJ_INVERSE(Proj)) { |
| 243 | emess(-1, "inverse for this projection not avail.\n"); |
| 244 | continue; |
| 245 | } |
| 246 | dat_xy.x = strtod(s, &s); |
| 247 | dat_xy.y = strtod(s, &s); |
| 248 | if (dat_xy.x == HUGE_VAL || dat_xy.y == HUGE_VAL) { |
| 249 | emess(-1, "lon-lat input conversion failure\n"); |
| 250 | continue; |
| 251 | } |
| 252 | if (prescale) { |
| 253 | dat_xy.x *= fscale; |
| 254 | dat_xy.y *= fscale; |
| 255 | } |
| 256 | if (reversein) { |
| 257 | PJ_XY temp = dat_xy; |
| 258 | dat_xy.x = temp.y; |
no test coverage detected