moving things around...

This commit is contained in:
2019-08-28 21:08:59 +02:00
parent 1c47b50954
commit 0e279275df
5 changed files with 65 additions and 26 deletions

View File

@@ -2,7 +2,7 @@
COPT = -Wall -fpic -g -no-pie -pg -DDEBUG_LEVEL=0
DEPS = ../floatimg.h Makefile
OBJS = fimg-png.o fimg-tiff.o misc-plots.o filtrage.o
OBJS = fimg-png.o fimg-tiff.o misc-plots.o filtrage.o utils.o
#---------------------------------------------------------------
@@ -20,3 +20,6 @@ misc-plots.o: misc-plots.c $(DEPS)
filtrage.o: filtrage.c $(DEPS)
gcc $(COPT) -c $<
utils.o: utils.c $(DEPS)
gcc $(COPT) -c $<

31
funcs/utils.c Normal file
View File

@@ -0,0 +1,31 @@
#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;
}
/* --------------------------------------------------------------------- */