Compare commits

..

No commits in common. "c3bc39750d229be061411dca5a9ae621f7f4f03e" and "afac6aeff1a0d87e39af2d4cf1cc0c37d9a12776" have entirely different histories.

5 changed files with 8 additions and 67 deletions

View File

@ -88,8 +88,5 @@ int fimg_save_as_png(FloatImg *src, char *outname, int flags);
int fimg_draw_something(FloatImg *fimg); int fimg_draw_something(FloatImg *fimg);
int parse_WxH(char *str, int *pw, int *ph); int parse_WxH(char *str, int *pw, int *ph);
int parse_double(char *str, double *dptr);

View File

@ -8,28 +8,20 @@
#include "../floatimg.h" #include "../floatimg.h"
int fimg_pnm_infos(char *);
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
int foo; int foo;
double dval; char *infile = "foo.pnm";
char *str;
str = "12.34"; dval = 0.0; pnm_init(&argc, argv);
foo = parse_double(str, &dval);
printf("%-10s -> %3d %g\n", str, foo, dval);
str = "12e4"; dval = 0.0; if (2 == argc) infile = argv[1];
foo = parse_double(str, &dval);
printf("%-10s -> %3d %g\n", str, foo, dval);
str = "5s"; dval = 0.0; foo = fimg_pnm_infos(infile);
foo = parse_double(str, &dval); fprintf(stderr, "got %d\n", foo);
printf("%-10s -> %3d %g\n", str, foo, dval);
str = "PORN"; dval = 0.0;
foo = parse_double(str, &dval);
printf("%-10s -> %3d %g\n", str, foo, dval);
return 0; return 0;
} }

View File

@ -1,28 +0,0 @@
/*
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pam.h>
#include "../floatimg.h"
int fimg_pnm_infos(char *);
/* --------------------------------------------------------------------- */
int main(int argc, char *argv[])
{
int foo;
char *infile = "foo.pnm";
pnm_init(&argc, argv);
if (2 == argc) infile = argv[1];
foo = fimg_pnm_infos(infile);
fprintf(stderr, "got %d\n", foo);
return 0;
}
/* --------------------------------------------------------------------- */

View File

@ -29,16 +29,3 @@ if (2 != foo) {
return 2; return 2;
} }
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
int parse_double(char *str, double *dptr)
{
double value;
int foo;
foo = sscanf(str, "%lf", &value);
if (1 == foo) {
*dptr = value;
return 1;
}
return -1;
}
/* --------------------------------------------------------------------- */

View File

@ -122,14 +122,7 @@ while ((opt = getopt(argc, argv, "d:ghn:o:O:p:s:uv")) != -1) {
case 'n': nbre_capt = atoi(optarg); break; case 'n': nbre_capt = atoi(optarg); break;
case 'O': dest_dir = optarg; break; case 'O': dest_dir = optarg; break;
case 'o': outfile = optarg; break; case 'o': outfile = optarg; break;
case 'p': foo = parse_double(optarg, &period); case 'p': period = 1e6*atof(optarg); break;
if (foo<0) {
fprintf(stderr,
"error parsing -p arg '%s'\n",
optarg);
exit(1);
}
break;
case 's': parse_WxH(optarg, &width, &height); case 's': parse_WxH(optarg, &width, &height);
break; break;
case 'u': upscaling = 1; break; case 'u': upscaling = 1; break;