tiffsplit: use EXIT_SUCCESS / EXIT_FAILURE

This commit is contained in:
Thomas Bernard 2020-03-07 16:31:23 +01:00
parent 2fa1ce2f55
commit aea167005f
No known key found for this signature in database
GPG Key ID: 0FF11B67A5C0863C

View File

@ -30,6 +30,13 @@
#include "tiffio.h"
#ifndef EXIT_SUCCESS
#define EXIT_SUCCESS 0
#endif
#ifndef EXIT_FAILURE
#define EXIT_FAILURE 1
#endif
#ifndef HAVE_GETOPT
extern int getopt(int argc, char * const argv[], const char *optstring);
#endif
@ -60,7 +67,7 @@ main(int argc, char* argv[])
if (argc < 2) {
fprintf(stderr, "%s\n\n", TIFFGetVersion());
fprintf(stderr, "usage: tiffsplit input.tif [prefix]\n");
return (-3);
return (EXIT_FAILURE);
}
if (argc > 2) {
strncpy(fname, argv[2], sizeof(fname));
@ -83,14 +90,14 @@ main(int argc, char* argv[])
_TIFFfree(path);
if (out == NULL)
return (-2);
return (EXIT_FAILURE);
if (!tiffcp(in, out))
return (-1);
return (EXIT_FAILURE);
TIFFClose(out);
} while (TIFFReadDirectory(in));
(void) TIFFClose(in);
}
return (0);
return (EXIT_SUCCESS);
}
static void
@ -117,7 +124,7 @@ newfilename(void)
if (fnum == MAXFILES) {
if (!defname || fname[0] == 'z') {
fprintf(stderr, "tiffsplit: too many files.\n");
exit(1);
exit(EXIT_FAILURE);
}
fname[0]++;
fnum = 0;