| 28 |  | int  nrows = 0;                 /* number of rows for output */ | 
| 29 |  | int  ncols = 0;                 /* number of columns for output */ | 
| 30 |  |  | 
| 31 | + | double  x_c = 1.0;              /* ratio of output x size to input */ | 
| 32 | + | double  y_r = 1.0;              /* ratio of output y size to input */ | 
| 33 | + |  | 
| 34 |  | int  singlepass = 0;            /* true means skip first pass */ | 
| 35 |  |  | 
| 36 |  | int  avghot = 0;                /* true means average in bright spots */ | 
| 47 |  |  | 
| 48 |  | int  xres, yres;                /* resolution of input */ | 
| 49 |  |  | 
| 47 | – | double  x_c, y_r;               /* conversion factors */ | 
| 48 | – |  | 
| 50 |  | int  xrad;                      /* x window size */ | 
| 51 |  | int  yrad;                      /* y window size */ | 
| 52 |  |  | 
| 87 |  | if (argv[i][0] == '-') | 
| 88 |  | switch (argv[i][1]) { | 
| 89 |  | case 'x': | 
| 90 | < | ncols = atoi(argv[++i]); | 
| 90 | > | i++; | 
| 91 | > | if (argv[i][0] == '/') { | 
| 92 | > | x_c = 1.0/atof(argv[i]+1); | 
| 93 | > | ncols = 0; | 
| 94 | > | } else | 
| 95 | > | ncols = atoi(argv[i]); | 
| 96 |  | break; | 
| 97 |  | case 'y': | 
| 98 | < | nrows = atoi(argv[++i]); | 
| 98 | > | i++; | 
| 99 | > | if (argv[i][0] == '/') { | 
| 100 | > | y_r = 1.0/atof(argv[i]+1); | 
| 101 | > | nrows = 0; | 
| 102 | > | } else | 
| 103 | > | nrows = atoi(argv[i]); | 
| 104 |  | break; | 
| 105 |  | case 'e': | 
| 106 |  | if (argv[i+1][0] == '+' || argv[i+1][0] == '-') | 
| 128 |  | case '1': | 
| 129 |  | singlepass = 1; | 
| 130 |  | break; | 
| 131 | + | case '2': | 
| 132 | + | singlepass = 0; | 
| 133 | + | break; | 
| 134 |  | case 'p': | 
| 135 |  | npts = atoi(argv[++i]) / 2; | 
| 136 |  | break; | 
| 190 |  | /* add new header info. */ | 
| 191 |  | printargs(i, argv, stdout); | 
| 192 |  | /* get picture size */ | 
| 193 | < | if (fscanf(fin, "-Y %d +X %d\n", &yres, &xres) != 2) { | 
| 193 | > | if (fgetresolu(&xres, &yres, fin) != (YMAJOR|YDECR)) { | 
| 194 |  | fprintf(stderr, "%s: bad picture size\n", progname); | 
| 195 |  | quit(1); | 
| 196 |  | } | 
| 197 | < | if (ncols <= 0) | 
| 198 | < | ncols = xres; | 
| 199 | < | if (nrows <= 0) | 
| 200 | < | nrows = yres; | 
| 197 | > | if (ncols > 0) | 
| 198 | > | x_c = (double)ncols/xres; | 
| 199 | > | else | 
| 200 | > | ncols = x_c*xres + .5; | 
| 201 | > | if (nrows > 0) | 
| 202 | > | y_r = (double)nrows/yres; | 
| 203 | > | else | 
| 204 | > | nrows = y_r*yres + .5; | 
| 205 |  |  | 
| 206 |  | if (singlepass) { | 
| 207 |  | /* skip exposure, etc. */ | 
| 315 |  | double  e; | 
| 316 |  | register int  i; | 
| 317 |  |  | 
| 300 | – | x_c = (double)ncols/xres; | 
| 301 | – | y_r = (double)nrows/yres; | 
| 302 | – |  | 
| 318 |  | if (rad <= 0.0) { | 
| 319 |  | xrad = xres/ncols/2 + 1; | 
| 320 |  | yrad = yres/nrows/2 + 1; | 
| 343 |  | } | 
| 344 |  | e = bright(exposure); | 
| 345 |  | if (e < 1-1e-7 || e > 1+1e-7)           /* record exposure */ | 
| 346 | < | printf("EXPOSURE=%e\n", e); | 
| 346 | > | fputexpos(e, stdout); | 
| 347 |  | printf("\n"); | 
| 348 | < | printf("-Y %d +X %d\n", nrows, ncols);  /* write picture size */ | 
| 348 | > | fputresolu(YMAJOR|YDECR, ncols, nrows, stdout); /* resolution */ | 
| 349 |  | } | 
| 350 |  |  | 
| 351 |  |  |