aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2025-08-29 08:28:32 +0100
committerAryadev Chavali <aryadev@aryadevchavali.com>2025-08-29 08:28:32 +0100
commit29d245328823b303047e45e11f82fb1513b5638d (patch)
tree8b9cf5548a00988ab5e6351e5ba619100ca42efc /main.c
parentcc56a2ee2b5703f9ea5ac63a86870af188845c30 (diff)
downloadalisp-29d245328823b303047e45e11f82fb1513b5638d.tar.gz
alisp-29d245328823b303047e45e11f82fb1513b5638d.tar.bz2
alisp-29d245328823b303047e45e11f82fb1513b5638d.zip
Cleaned up bugs with stream implementation
Principle was that we may have read all the content from the underlying pipe (s.t. it set the EoF flag) but we haven't actually iterated the content.
Diffstat (limited to 'main.c')
-rw-r--r--main.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/main.c b/main.c
index 98f2878..4f69209 100644
--- a/main.c
+++ b/main.c
@@ -20,14 +20,18 @@
int main(void)
{
- stream_t stream = {0};
- // const char data[] = "Hello, world!";
- // const sv_t sv = SV(data, ARRSIZE(data) - 1);
+ stream_t stream = {0};
+ const char data[] = "Hello, world!";
+ const sv_t sv = SV(data, ARRSIZE(data) - 1);
+ char filename[] = "test.txt";
+
// stream_init_string(&stream, NULL, sv);
- // stream_init_file(&stream, "test.txt");
+ // FILE *fp = fopen(filename, "rb");
+ // stream_init_file(&stream, filename, fp);
stream_init_file(&stream, "stdin", stdin);
+
printf("[debug]: setup stream pipe\n");
do
{
@@ -36,5 +40,6 @@ int main(void)
} while (!stream_eoc(&stream));
printf("%lu/%lu\n", stream.position, stream_size(&stream));
stream_stop(&stream);
+ // fclose(fp);
return 0;
}