Mercurial > 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 wrap: on
line diff
--- a/resize-gd.1 Sun Jun 15 15:50:59 2008 +0200 +++ b/resize-gd.1 Mon Jun 23 21:03:05 2008 +0200 @@ -56,6 +56,9 @@ .TP .B 3 Not enough memory available to resize the image. +.TP +.B 4 +None of the given files was resized successful (or was already small enough). .SH BUGS Please report any bug you find to the author.
--- a/resize-gd.c Sun Jun 15 15:50:59 2008 +0200 +++ b/resize-gd.c Mon Jun 23 21:03:05 2008 +0200 @@ -89,6 +89,7 @@ main(int argc, char* argv[]) { int i; int type; + int success = 0; gdImagePtr im_in; gdImagePtr im_out; FILE* in; @@ -164,6 +165,7 @@ /* skip images that dont need to be resized */ if (sizedest.w == sizeimg.w && sizedest.h == sizeimg.h) { + success++; gdImageDestroy(im_in); continue; } @@ -189,9 +191,15 @@ } fclose(out); + success++; + gdImageDestroy(im_in); gdImageDestroy(im_out); } - return 0; + if (success == 0) { + return 4; /* no resizing was successful */ + } else { + return 0; + } }