FloatImg/funcs/utils.c
2019-08-28 21:08:59 +02:00

32 lines
601 B
C

#include <stdio.h>
#include "../floatimg.h"
extern int verbosity; /* must be declared around main() */
/* --------------------------------------------------------------------- */
int parse_WxH(char *str, int *pw, int *ph)
{
// char *ptr;
int foo, w, h;
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( '%s' %p %p )\n", __func__,
str, pw, ph);
#endif
foo = sscanf(str, "%dx%d", &w, &h);
if (2 != foo) {
fprintf(stderr, "%s : arg '%s' is invalid\n", __func__, str);
return foo;
}
*pw = w; *ph = h;
return 2;
}
/* --------------------------------------------------------------------- */