Package:pngtools
Version:0.4-1
Hello,
pnginfo returns random numbers as return code. No chance to
tell wether it failed or succeeded. Only a few lines need to
be changed.
Markus
diff -Nbur pngtools-0.4.orig/debian/changelog pngtools-0.4/debian/changelog
--- pngtools-0.4.orig/debian/changelog 2014-04-01 11:44:19.000000000 +0200
+++ pngtools-0.4/debian/changelog 2014-04-01 11:29:10.928408006 +0200
@@ -1,3 +1,10 @@
+pngtools (0.4-1.1) UNRELEASED; urgency=low
+
+ * Non-maintainer upload.
+ * Make pnginfo return a code for error or success.
+
+ -- Markus <markus@deb-71-build-64> Tue, 01 Apr 2014 11:27:46 +0200
+
pngtools (0.4-1) unstable; urgency=low
* New upstream release;
diff -Nbur pngtools-0.4.orig/debian/pnginfo.1 pngtools-0.4/debian/pnginfo.1
--- pngtools-0.4.orig/debian/pnginfo.1 2014-04-01 11:44:19.000000000 +0200
+++ pngtools-0.4/debian/pnginfo.1 2014-04-01 11:36:53.416408061 +0200
@@ -11,7 +11,8 @@
.PP
The format for the output bitmaps is hexadecimal, with each pixel presented as a triple \-\- for instance [red green blue]. This means that paletted images et cetera will have their bitmaps expanded before display.
.SH RETURNS
-Nothing.
+ 0 success
+ 1 error
.SH EXAMPLE
pnginfo \-t toucan.png basn3p02.png basn6a16.png
toucan.png...
diff -Nbur pngtools-0.4.orig/pnginfo.c pngtools-0.4/pnginfo.c
--- pngtools-0.4.orig/pnginfo.c 2008-11-27 00:14:17.000000000 +0100
+++ pngtools-0.4/pnginfo.c 2014-04-01 11:29:45.808407925 +0200
@@ -18,7 +18,9 @@
The format for the output bitmaps is hexadecimal, with each pixel presented as a triple -- for instance [red green blue]. This means that paletted images et cetera will have their bitmaps expanded before display.
DESCRIPTION END
-RETURNS Nothing
+RETURNS
+ 0 success
+ 1 error
EXAMPLE START
%bash: pnginfo -t toucan.png basn3p02.png basn6a16.png
@@ -127,6 +129,8 @@
// For each filename that we have:
for (; i < argc; i++)
pnginfo_displayfile (argv[i], extractBitmap, displayBitmap, tiffnames);
+
+ return 0;
}
void
@@ -153,11 +157,7 @@
// Check that it really is a PNG file
fread (sig, 1, 8, image);
if (!png_check_sig (sig, 8))
- {
- printf (" This file is not a valid PNG file\n");
- fclose (image);
- return;
- }
+ pnginfo_error ("This file is not a valid PNG file.");
// Start decompressing
if ((png = png_create_read_struct (PNG_LIBPNG_VER_STRING, NULL,
@@ -451,7 +451,7 @@
pnginfo_error (char *message)
{
fprintf (stderr, "%s\n", message);
- exit (42);
+ exit (1);
}
// Allocate some memory