resize-gd

diff resize-gd.c @ 15:c50716420346

new exit code (4) if all files failed in resizing
author meillo@marmaro.de
date Mon, 23 Jun 2008 21:03:05 +0200
parents 6f5c3a02e4d5
children 159402d54c29
line diff
     1.1 --- a/resize-gd.c	Sun Jun 15 15:50:59 2008 +0200
     1.2 +++ b/resize-gd.c	Mon Jun 23 21:03:05 2008 +0200
     1.3 @@ -89,6 +89,7 @@
     1.4  main(int argc, char* argv[]) {
     1.5  	int i;
     1.6  	int type;
     1.7 +	int success = 0;
     1.8  	gdImagePtr im_in;
     1.9  	gdImagePtr im_out;
    1.10  	FILE* in;
    1.11 @@ -164,6 +165,7 @@
    1.12  
    1.13  		/* skip images that dont need to be resized */
    1.14  		if (sizedest.w == sizeimg.w && sizedest.h == sizeimg.h) {
    1.15 +			success++;
    1.16  			gdImageDestroy(im_in);
    1.17  			continue;
    1.18  		}
    1.19 @@ -189,9 +191,15 @@
    1.20  		}
    1.21  		fclose(out);
    1.22  
    1.23 +		success++;
    1.24 +
    1.25  		gdImageDestroy(im_in);
    1.26  		gdImageDestroy(im_out);
    1.27  	}
    1.28  
    1.29 -	return 0;
    1.30 +	if (success == 0) {
    1.31 +		return 4;  /* no resizing was successful */
    1.32 +	} else {
    1.33 +		return 0;
    1.34 +	}
    1.35  }