resize-gd

changeset 15:c50716420346 0.2

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 9674ada28cfe
files resize-gd.1 resize-gd.c
diffstat 2 files changed, 12 insertions(+), 1 deletions(-) [+]
line diff
     1.1 --- a/resize-gd.1	Sun Jun 15 15:50:59 2008 +0200
     1.2 +++ b/resize-gd.1	Mon Jun 23 21:03:05 2008 +0200
     1.3 @@ -56,6 +56,9 @@
     1.4  .TP
     1.5  .B 3
     1.6  Not enough memory available to resize the image.
     1.7 +.TP
     1.8 +.B 4
     1.9 +None of the given files was resized successful (or was already small enough).
    1.10  
    1.11  .SH BUGS
    1.12  Please report any bug you find to the author.
     2.1 --- a/resize-gd.c	Sun Jun 15 15:50:59 2008 +0200
     2.2 +++ b/resize-gd.c	Mon Jun 23 21:03:05 2008 +0200
     2.3 @@ -89,6 +89,7 @@
     2.4  main(int argc, char* argv[]) {
     2.5  	int i;
     2.6  	int type;
     2.7 +	int success = 0;
     2.8  	gdImagePtr im_in;
     2.9  	gdImagePtr im_out;
    2.10  	FILE* in;
    2.11 @@ -164,6 +165,7 @@
    2.12  
    2.13  		/* skip images that dont need to be resized */
    2.14  		if (sizedest.w == sizeimg.w && sizedest.h == sizeimg.h) {
    2.15 +			success++;
    2.16  			gdImageDestroy(im_in);
    2.17  			continue;
    2.18  		}
    2.19 @@ -189,9 +191,15 @@
    2.20  		}
    2.21  		fclose(out);
    2.22  
    2.23 +		success++;
    2.24 +
    2.25  		gdImageDestroy(im_in);
    2.26  		gdImageDestroy(im_out);
    2.27  	}
    2.28  
    2.29 -	return 0;
    2.30 +	if (success == 0) {
    2.31 +		return 4;  /* no resizing was successful */
    2.32 +	} else {
    2.33 +		return 0;
    2.34 +	}
    2.35  }