working on a new tool

This commit is contained in:
phyto
2019-07-16 00:19:59 +02:00
parent ecf952d881
commit bcf57f8764
4 changed files with 82 additions and 9 deletions

View File

@@ -4,22 +4,38 @@
#include "../floatimg.h"
/* --------------------------------------------------------------------- */
int verbosity;
/* --------------------------------------------------------------------- */
void help(int lj)
{
fimg_print_version(1);
exit(0);
}
/* --------------------------------------------------------------------- */
int main(int argc, char *argv[])
{
int foo;
int foo, opt;
int width, height;
char *fname;
FloatImg fimg;
while ((opt = getopt(argc, argv, "ho:v")) != -1) {
switch(opt) {
case 'h': help(0); break;
case 'v': verbosity++; break;
}
}
if (4 != argc) {
fimg_print_version(1);
fprintf(stderr, "Usage:\n\t%s quux.fimg width height\n", argv[0]);
exit(1);
}
fname = argv[1];
width = atoi(argv[2]); height = atoi(argv[3]);
fname = argv[optind];
width = atoi(argv[optind+1]); height = atoi(argv[optind+2]);
fprintf(stderr, "making '%s' %d x %d\n", fname, width, height);
foo = fimg_create(&fimg, width, height, 3);
@@ -31,7 +47,7 @@ fimg_clear(&fimg);
foo = fimg_dump_to_file(&fimg, fname, 0);
if (foo) {
fprintf(stderr, "dump floatimg -> %d\n", foo);
fprintf(stderr, "dump fimg -> %d\n", foo);
exit(1);
}