From 42ae813b3ec2d6faf123083e4a74172347632c8f Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Mon, 18 Apr 2022 20:10:23 -0400 Subject: add path to struct more_file --- io.c | 2 ++ more.h | 1 + 2 files changed, 3 insertions(+) diff --git a/io.c b/io.c index 2de9a7d..c57e6ee 100644 --- a/io.c +++ b/io.c @@ -62,6 +62,7 @@ struct more_file more_open(const char *path) fstat(fileno(mf.f), &st); mf.nbytes = st.st_size; } + mf.path = strdup(path); return mf; } @@ -78,4 +79,5 @@ void more_close(struct more_file *mf) free(mf->tlines); free(mf->buf); + free(mf->path); } diff --git a/more.h b/more.h index 4af1645..5fcd9a2 100644 --- a/more.h +++ b/more.h @@ -12,6 +12,7 @@ struct more_file { size_t *bytepos; char *buf; size_t nbuf; + char *path; }; struct more_file more_open(const char *path); -- cgit v1.2.1