X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=sample%2Fadd.c;fp=sample%2Fadd.c;h=cadbc3a70f13d209f8bafa844ebe255cf0f9a1f0;hb=c7e61475680fa226bd9b8bdd469cd66914e630f5;hp=0058d9e39c40edaa35b0be40cec2db878d5f9f7e;hpb=800deb09b422a73c1212233a93839a223ff59678;p=debian%2Fgzip diff --git a/sample/add.c b/sample/add.c index 0058d9e..cadbc3a 100644 --- a/sample/add.c +++ b/sample/add.c @@ -6,7 +6,9 @@ in the stream. See sub.c for what the filtering is and what it's good for. */ +#include #include +#include #define MAGIC1 'S' /* sub data */ #define MAGIC2 26 /* ^Z */ @@ -24,18 +26,18 @@ int main() if (getchar() != MAGIC1 || getchar() != MAGIC2) { fputs("add: input stream not made by sub\n", stderr); - exit(1); + exit(EXIT_FAILURE); } /* get number of differences from data */ if ((n = getchar()) == EOF || (i = getchar()) == EOF) { fputs("add: unexpected end of file\n", stderr); - exit(1); + exit(EXIT_FAILURE); } n += (i<<8); if (n <= 0 || n > MAX_DIST) { fprintf(stderr, "add: incorrect distance %d\n", n); - exit(1); + exit(EXIT_FAILURE); } /* initialize last byte */ @@ -52,6 +54,6 @@ int main() if (i == n) /* cycle on n differences */ i = 0; } - exit(0); + exit(EXIT_SUCCESS); return 0; /* avoid warning */ }