2019-09-13 04:48:12 +11:00
|
|
|
/*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <pam.h>
|
|
|
|
|
|
|
|
#include "../floatimg.h"
|
|
|
|
|
|
|
|
/* --------------------------------------------------------------------- */
|
2019-10-31 01:49:53 +11:00
|
|
|
int essai_parse_double(void)
|
2019-09-13 04:48:12 +11:00
|
|
|
{
|
|
|
|
int foo;
|
2019-09-16 21:28:47 +11:00
|
|
|
double dval;
|
|
|
|
char *str;
|
|
|
|
|
|
|
|
str = "12.34"; dval = 0.0;
|
|
|
|
foo = parse_double(str, &dval);
|
|
|
|
printf("%-10s -> %3d %g\n", str, foo, dval);
|
2019-09-13 04:48:12 +11:00
|
|
|
|
2019-09-16 21:28:47 +11:00
|
|
|
str = "12e4"; dval = 0.0;
|
|
|
|
foo = parse_double(str, &dval);
|
|
|
|
printf("%-10s -> %3d %g\n", str, foo, dval);
|
2019-09-13 04:48:12 +11:00
|
|
|
|
2019-09-16 21:28:47 +11:00
|
|
|
str = "5s"; dval = 0.0;
|
|
|
|
foo = parse_double(str, &dval);
|
|
|
|
printf("%-10s -> %3d %g\n", str, foo, dval);
|
2019-09-13 23:34:56 +11:00
|
|
|
|
2019-09-16 21:28:47 +11:00
|
|
|
str = "PORN"; dval = 0.0;
|
|
|
|
foo = parse_double(str, &dval);
|
|
|
|
printf("%-10s -> %3d %g\n", str, foo, dval);
|
2019-09-13 04:48:12 +11:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
/* --------------------------------------------------------------------- */
|
2019-10-31 01:49:53 +11:00
|
|
|
int essai_detect_type(void)
|
|
|
|
{
|
|
|
|
int foo;
|
|
|
|
char *fname;
|
|
|
|
|
|
|
|
foo = format_from_extension(fname="foo.fimg");
|
|
|
|
printf("%-10s %d\n\n", fname, foo);
|
|
|
|
|
|
|
|
foo = format_from_extension(fname="foo.pNm");
|
|
|
|
printf("%-10s %d\n\n", fname, foo);
|
|
|
|
|
|
|
|
foo = format_from_extension(fname="foo.xyzzy");
|
|
|
|
printf("%-10s %d\n\n", fname, foo);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
/* --------------------------------------------------------------------- */
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
int foo;
|
|
|
|
|
|
|
|
foo = essai_detect_type();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
/* --------------------------------------------------------------------- */
|