summaryrefslogtreecommitdiffstats
path: root/src/getfsent.c
blob: ccfc0d3f3775eb889fc22524eebc0ca881c10860 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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;
}