/* WARNING: This file was generated by dkct. Changes you make here will be lost if dkct is run again! You should modify the original source and run dkct on it. Original source: test-dk4strmco.ctr */ /** @file test-dk4strmco.c The test-dk4strmco module. */ #line 1 "test-dk4strmco.ctr" #include "dk4conf.h" #include #include "dk4strmf.h" #include "dk4strmco.h" #line 12 "test-dk4strmco.ctr" int main(void) { char buf[4096]; dk4_stream_t *fstrm = NULL; dk4_stream_t *cstrm = NULL; size_t szbuf = sizeof(buf); size_t br; int res; #line 24 "test-dk4strmco.ctr" #line 25 "test-dk4strmco.ctr" fstrm = dk4stream_open_for_file( stdout, DK4_STREAM_WRITE, 0, 4096, NULL ); if (NULL == fstrm) { fputs("ERROR: Failed to open stream for stdout!\n", stderr); fflush(stderr); goto finished; } cstrm = dk4strmco_open( fstrm, DK4_STRMCO_PP_NONE, DK4_STRMCO_CO_FLATE, DK4_STRMCO_OE_ASCII85, (DK4_STRMCO_FL_EOD_OE | DK4_STRMCO_FL_NL_OE), NULL ); if (NULL == cstrm) { fputs("ERROR: Failed to open compressing stream!\n", stderr); fflush(stderr); goto finished; } do { br = fread(buf, 1, szbuf, stdin); if (0 < br) { res = dk4stream_write(cstrm, buf, br, NULL); if (0 == res) { fputs("ERROR: Write operation failed!\n", stderr); fflush(stderr); } } } while ((!feof(stdin)) && (0 < br)); finished: if (NULL != cstrm) { res = dk4stream_close(cstrm, NULL); if (0 == res) { fputs("ERROR: Failed to close compressed stream!\n", stderr); fflush(stderr); } } if (NULL != fstrm) { res = dk4stream_close(fstrm, NULL); if (0 == res) { fputs("ERROR: Failed to close file stream!\n", stderr); fflush(stderr); } } #line 73 "test-dk4strmco.ctr" #line 74 "test-dk4strmco.ctr" return 0; } /* vim: set ai sw=4 ts=4 : */