From 1989c02b763a04d0f941114056f11bb96bdb2550 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Wed, 5 May 2021 01:50:12 -0400 Subject: Finally fix damaged ship gfx --- gzip2deflate.c | 78 ---------------------------------------------------------- 1 file changed, 78 deletions(-) delete mode 100644 gzip2deflate.c (limited to 'gzip2deflate.c') diff --git a/gzip2deflate.c b/gzip2deflate.c deleted file mode 100644 index 7edf6ac..0000000 --- a/gzip2deflate.c +++ /dev/null @@ -1,78 +0,0 @@ -// gzip2deflate by Piotr Fusik -// http://xasm.atari.org - -#include -#include -#include -#ifdef __WIN32 -#include -#endif - -static int get_byte(void) -{ - int b = getchar(); - if (b == EOF) { - fputs("gzip2deflate: unexpected end of stream\n", stderr); - exit(1); - } - return b; -} - -static void skip_bytes(int n) -{ - while (--n >= 0) - get_byte(); -} - -static void skip_string(void) -{ - while (get_byte() != 0); -} - -int main (int argc, char *argv[]) -{ - int flg; - char buf[8 + 4096]; - size_t len; -#ifdef __WIN32 - _setmode(_fileno(stdin), _O_BINARY); - _setmode(_fileno(stdout), _O_BINARY); -#endif - if (get_byte() != 0x1f || get_byte() != 0x8b || get_byte() != 8) { - fputs("gzip2deflate: not a gzip file on stdin\n", stderr); - return 1; - } - flg = get_byte(); - skip_bytes(6); - if ((flg & 4) != 0) { - int xlen = get_byte(); - xlen += get_byte() << 8; - skip_bytes(xlen); - } - if ((flg & 8) != 0) - skip_string(); - if ((flg & 16) != 0) - skip_string(); - if ((flg & 2) != 0) - skip_bytes(2); - /* copy everything except the last 8 bytes */ - len = 0; - for (;;) { - len += fread(buf + len, 1, sizeof(buf) - len, stdin); - if (len != sizeof(buf)) - break; - fwrite(buf, 1, sizeof(buf) - 8, stdout); - memcpy(buf, buf + sizeof(buf) - 8, 8); - len = 8; - } - if (ferror(stdin)) { - fputs("gzip2deflate: read error\n", stderr); - return 1; - } - if (len < 8) { - fputs("gzip2deflate: unexpected end of stream\n", stderr); - return 1; - } - fwrite(buf, 1, len - 8, stdout); - return 0; -} -- cgit v1.2.3