summary refs log tree commit diff
path: root/pkgs/tools/system/dell-command-configure/wrapper-lib.c
blob: f93bcd58ab75173b40a658de0c28255c356f63b8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <stdio.h>
#include <string.h>

static const char from[] =  "/usr/lib/ext/dell/omreg.cfg";
static const char to[] = "@to@";

int access_wrapper(const char *fn, int mode)
{
	if (!strcmp(fn, from)) {
		printf("access_wrapper.c: Replacing path '%s' with '%s'\n", from, to);
		fn = to;
	}
	return access(fn, mode);
}

FILE* fopen_wrapper(const char* fn, const char* mode)
{
	if (!strcmp(fn, from)) {
		printf("fopen_wrapper.c: Replacing path '%s' with '%s'\n", from, to);
		fn = to;
	}
	return fopen(fn, mode);
}