From eb6806dd642fcf58d1ff11c78e5cc4884bdcd283 Mon Sep 17 00:00:00 2001 From: Thomas Bernard Date: Sat, 7 Mar 2020 15:52:38 +0100 Subject: [PATCH] tiffdump: use EXIT_FAILURE / EXIT_SUCCESS see #17 --- tools/tiffdump.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/tools/tiffdump.c b/tools/tiffdump.c index 8d9b6a73..00be9dd4 100644 --- a/tools/tiffdump.c +++ b/tools/tiffdump.c @@ -56,6 +56,13 @@ extern int getopt(int argc, char * const argv[], const char *optstring); #include "tiffio.h" +#ifndef EXIT_SUCCESS +#define EXIT_SUCCESS 0 +#endif +#ifndef EXIT_FAILURE +#define EXIT_FAILURE 1 +#endif + #ifndef O_BINARY # define O_BINARY 0 #endif @@ -105,7 +112,7 @@ void usage() { fprintf(stderr, "usage: %s [-h] [-o offset] [-m maxitems] file.tif ...\n", appname); - exit(-1); + exit(EXIT_FAILURE); } int @@ -142,7 +149,7 @@ main(int argc, char* argv[]) fd = open(argv[optind], O_RDONLY|O_BINARY, 0); if (fd < 0) { perror(argv[0]); - return (-1); + return (EXIT_FAILURE); } if (multiplefiles) printf("%s:\n", argv[optind]); @@ -152,7 +159,7 @@ main(int argc, char* argv[]) dump(fd, diroff); close(fd); } - return (0); + return (EXIT_SUCCESS); } #define ord(e) ((int)e) @@ -874,7 +881,7 @@ Fatal(const char* fmt, ...) va_start(ap, fmt); vError(stderr, fmt, ap); va_end(ap); - exit(-1); + exit(EXIT_FAILURE); } /* vim: set ts=8 sts=8 sw=8 noet: */