From 6ba9f3e756b896c13cb11e72124a3586f927f39a Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Sun, 07 May 2023 05:06:24 -0400 Subject: Revert "gzip: Test code" This reverts commit 075f39b18619274bd5ae78a516a93df268b9ef7e. --- (limited to 'src/gzip.c') diff --git a/src/gzip.c b/src/gzip.c index cd56d3a..531294b 100644 --- a/src/gzip.c +++ b/src/gzip.c @@ -171,14 +171,6 @@ _opkg_opk_gzip_write(struct opkg_opk_gzip *gzip, void *record, size_t size, { size_t len; -// memcpy(gzip->buffer, record, size); -// gzip->write_func(gzip->user_data, size); -// if (last == 0) { -// return OPKG_OPK_OK; -// } else { -// return OPKG_OPK_END; -// } - /* Sanity check */ if (gzip->dir != _OPKG_OPK_GZIP_DIR_WRITE) { return OPKG_OPK_ERROR; @@ -248,77 +240,3 @@ opkg_opk_gzip_free(struct opkg_opk_gzip *gzip) free(gzip); return ret; } - -#if 1 /* Test code */ - -/* - * echo 2.0 >debian-binary - * tar -cf test.tar debian-binary # if using GNU tar... - * truncate -s 2048 test.tar # ...remove extra trailer records - * busybox tar -cf test.tar debian-binary # or just use BB tar - * flags=$(pkg-config --cflags --libs zlib) - * gcc -Wall -Wextra -pedantic -g -O0 -o gzip src/gzip.c ${flags} - * ./gzip test.tar test.tar.gz - * gunzip -c test.tar.gz 1>test.tar.ungz - * ls -l test.tar* # test.tar and test.tar.ungz should be 2048 bytes - * # test.tar.gz should be 108 bytes or so - * cmp test.tar test.tar.ungz # should be quiet - * bvi test.tar.gz # compare to RFC 1952 - * gzip -9cn test.tar 1>test.tar.gzip - * ls -l test.tar.gz* # both should be 108 bytes or so - * cmp test.tar.gz* # should be quiet - */ - -#include - -int -main(int argc __attribute__((__unused__)), char *argv[]) -{ - int ret; - FILE *in_fp; - FILE *out_fp; - struct opkg_opk_gzip *gzip; - char in_buffer[512]; - size_t in_size; - - ret = EXIT_SUCCESS; - in_fp = fopen(argv[1], "rb"); - if (in_fp == NULL) { - fputs("Error opening input", stderr); - ret = EXIT_FAILURE; - goto out0; - } - out_fp = fopen(argv[2], "wb"); - if (out_fp == NULL) { - fputs("Error opening output", stderr); - ret = EXIT_FAILURE; - goto out1; - } - gzip = opkg_opk_gzip_init_write(out_fp); - if (gzip == NULL) { - fputs("Error initializing compressor", stderr); - ret = EXIT_FAILURE; - goto out2; - } - while ((in_size = fread(in_buffer, 1, sizeof(in_buffer), in_fp)) > 0) { - if (opkg_opk_gzip_write(gzip, in_buffer, in_size) != - OPKG_OPK_OK) { - fputs("Error compressing", stderr); - ret = EXIT_FAILURE; - goto out3; - } - } - out3: - if (opkg_opk_gzip_free(gzip) != OPKG_OPK_OK) { - fputs("Error freeing compressor", stderr); - ret = EXIT_FAILURE; - } - out2: - fclose(out_fp); - out1: - fclose(in_fp); - out0: - return ret; -} - -#endif -- cgit v0.9.1