diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2020-08-25 20:04:42 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2020-08-25 20:04:42 +0000 |
commit | c43a9ae78220daadd71e00fc0596ceb839621e28 (patch) | |
tree | f263485ed0a09b31afe38be42e151cf9fc1dad9c /src/getfsent.c | |
download | libfstab-c43a9ae78220daadd71e00fc0596ceb839621e28.tar.gz libfstab-c43a9ae78220daadd71e00fc0596ceb839621e28.tar.xz libfstab-c43a9ae78220daadd71e00fc0596ceb839621e28.zip |
Diffstat (limited to 'src/getfsent.c')
-rw-r--r-- | src/getfsent.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/getfsent.c b/src/getfsent.c new file mode 100644 index 0000000..ccfc0d3 --- /dev/null +++ b/src/getfsent.c @@ -0,0 +1,35 @@ +#include "fsent.h" + +static FILE *f; +static char *line; +static struct fstab fstab; +static size_t size; + +void endfsent() +{ + if (f) __fclose_keep_errno(f); + f = 0; +} + +int setfsent() +{ + endfsent(); + return 1; +} + +struct fstab *getfsent() +{ + if (!f) f = fopen(_PATH_FSTAB, "rbe"); + if (!f) return 0; + return __getfsent_a(f, &fstab, &line, &size) ? &fstab : 0; +} + +struct fstab *getfsspec(char const *spec) +{ + return __getfs_a(spec, 0, &fstab, &line, &size) ? &fstab : 0; +} + +struct fstab *getfsfile(char const *file) +{ + return __getfs_a(0, file, &fstab, &line, &size) ? &fstab : 0; +} |