summary refs log tree commit diff
path: root/pkgs/tools/system/dell-command-configure/wrapper-lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/tools/system/dell-command-configure/wrapper-lib.c')
-rwxr-xr-xpkgs/tools/system/dell-command-configure/wrapper-lib.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/pkgs/tools/system/dell-command-configure/wrapper-lib.c b/pkgs/tools/system/dell-command-configure/wrapper-lib.c
new file mode 100755
index 00000000000..f93bcd58ab7
--- /dev/null
+++ b/pkgs/tools/system/dell-command-configure/wrapper-lib.c
@@ -0,0 +1,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);
+}