summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPatrick McDermott <patrick.mcdermott@libiquity.com>2023-05-02 19:57:35 (EDT)
committer Patrick McDermott <patrick.mcdermott@libiquity.com>2023-05-02 19:57:35 (EDT)
commitf15f087cb77d44d8594836b353e5a77b1faeba28 (patch)
tree7cf14aa64703caf9b9e671ebba1a18555438086c /src
parent12277cad55c6d3910dbc24ab32baf405f8970d64 (diff)
Revert "gzip: Test code"
This reverts commit 12277cad55c6d3910dbc24ab32baf405f8970d64.
Diffstat (limited to 'src')
-rw-r--r--src/gzip.c103
1 files changed, 0 insertions, 103 deletions
diff --git a/src/gzip.c b/src/gzip.c
index 5798bd6..736cbd7 100644
--- a/src/gzip.c
+++ b/src/gzip.c
@@ -178,14 +178,6 @@ int
opkg_opk_gzip_write(struct opkg_opk_gzip *gzip, void *record, size_t size,
int last)
{
-// 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,98 +240,3 @@ opkg_opk_gzip_free(struct opkg_opk_gzip *gzip)
free(gzip);
return ret;
}
-
-#if 0 /* 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 <stdio.h>
-
-FILE *_out_fp;
-char _out_buffer[8192];
-
-static int
-_write(void *user_data __attribute__((__unused__)), size_t size)
-{
- if (fwrite(_out_buffer, 1, size, _out_fp) == size) {
- return OPKG_OPK_OK;
- } else {
- return OPKG_OPK_ERROR;
- }
-}
-
-int
-main(int argc __attribute__((__unused__)), char *argv[])
-{
- int ret;
- FILE *in_fp;
- char in_buffer[512];
- struct opkg_opk_gzip *gzip;
- 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(_write, NULL);
- if (gzip == NULL) {
- fputs("Error initializing compressor", stderr);
- ret = EXIT_FAILURE;
- goto out2;
- }
- opkg_opk_gzip_set_write_buffer(gzip, _out_buffer, sizeof(_out_buffer));
- while ((in_size = fread(in_buffer, 1, sizeof(in_buffer), in_fp)) > 0) {
- if (opkg_opk_gzip_write(gzip, in_buffer, in_size, 0) !=
- OPKG_OPK_OK) {
- fputs("Error compressing", stderr);
- ret = EXIT_FAILURE;
- goto out3;
- }
- }
- if (feof(in_fp)) {
- if (opkg_opk_gzip_write(gzip, in_buffer, in_size, 1) !=
- OPKG_OPK_END) {
- fputs("Error finishing compression", 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