summaryrefslogtreecommitdiff
path: root/src/stdio/ftell.c
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2024-02-02 13:56:33 -0500
committerJakob Kaivo <jkk@ung.org>2024-02-02 13:56:33 -0500
commit8b3f2fa09e9241e20926c8171753a271c21ec93d (patch)
treea8bdff34505bfcf999467053dbfbf276bf7233f1 /src/stdio/ftell.c
parent3a9026cf8557c8efec34e652b6bf37ce49f12f86 (diff)
first cut of tracking previous return values with ftell()/fseek() as POC
Diffstat (limited to 'src/stdio/ftell.c')
-rw-r--r--src/stdio/ftell.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/stdio/ftell.c b/src/stdio/ftell.c
index f68c18b2..ad23bf31 100644
--- a/src/stdio/ftell.c
+++ b/src/stdio/ftell.c
@@ -5,15 +5,21 @@
long int ftell(FILE *stream)
{
+ long int ret = -1L;
+
SIGNAL_SAFE(0);
+ ASSERT_STREAM(stream, 0, 0);
- (void)stream;
- /* TODO */
/*
RETURN_SUCCESS(the current file position);
RETURN_FAILURE(LITERAL(-1L));
*/
- return -1L;
+
+ if (stream->text) {
+ ADD_PREV(ret, stream->valid_ftell, stream->nvalid_ftell);
+ }
+
+ return ret;
}
/***