# HG changeset patch # User meillo@marmaro.de # Date 1214247785 -7200 # Node ID c50716420346842144f5ed97dd3a18d8178eba89 # Parent 6f5c3a02e4d5dc4a029c2a7f387be891abd0baba new exit code (4) if all files failed in resizing diff -r 6f5c3a02e4d5 -r c50716420346 resize-gd.1 --- 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. diff -r 6f5c3a02e4d5 -r c50716420346 resize-gd.c --- 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; + } }