summaryrefslogtreecommitdiff
path: root/test/manual-paths.c
diff options
context:
space:
mode:
authorSimon McVittie <smcv@debian.org>2015-02-19 13:35:29 +0000
committerSimon McVittie <smcv@debian.org>2015-02-19 13:35:29 +0000
commit5a676818770d64c5508f5cf28e22228f68b325aa (patch)
treeacfbf8e52304dce6a8450ad3c390cdf874a6fd3e /test/manual-paths.c
parent8fd2c8098849695fce037fa3731a916ac5354e91 (diff)
parent87fe648a5c883d1f790a5d40abfd4a68aff0784c (diff)
downloaddbus-5a676818770d64c5508f5cf28e22228f68b325aa.tar.gz
Imported Upstream version 1.9.12upstream/1.9.12
Diffstat (limited to 'test/manual-paths.c')
-rw-r--r--test/manual-paths.c73
1 files changed, 73 insertions, 0 deletions
diff --git a/test/manual-paths.c b/test/manual-paths.c
new file mode 100644
index 00000000..4ce3ffc7
--- /dev/null
+++ b/test/manual-paths.c
@@ -0,0 +1,73 @@
+/*
+ * Simple manual paths check
+ *
+ * syntax: manual-paths
+ *
+*/
+
+#include "config.h"
+#include "dbus/dbus-list.h"
+#include "dbus/dbus-internals.h"
+#include "dbus/dbus-sysdeps.h"
+
+#include <stdio.h>
+
+dbus_bool_t print_install_root()
+{
+ char runtime_prefix[1000];
+
+ if (!_dbus_get_install_root(runtime_prefix, sizeof(runtime_prefix)))
+ {
+ fprintf(stderr, "dbus_get_install_root() failed\n");
+ return FALSE;
+ }
+ fprintf(stdout, "dbus_get_install_root() returned '%s'\n", runtime_prefix);
+ return TRUE;
+}
+
+dbus_bool_t print_service_dirs()
+{
+ DBusList *dirs;
+ DBusList *link;
+ dirs = NULL;
+
+ if (!_dbus_get_standard_session_servicedirs (&dirs))
+ _dbus_assert_not_reached ("couldn't get standard dirs");
+
+ while ((link = _dbus_list_pop_first_link (&dirs)))
+ {
+ printf ("default service dir: %s\n", (char *)link->data);
+ dbus_free (link->data);
+ _dbus_list_free_link (link);
+ }
+ dbus_free (dirs);
+ return TRUE;
+}
+
+dbus_bool_t print_replace_install_prefix(const char *s)
+{
+ const char *s2 = _dbus_replace_install_prefix(s);
+ if (!s2)
+ return FALSE;
+
+ fprintf(stdout, "replaced '%s' by '%s'\n", s, s2);
+ return TRUE;
+}
+
+int
+main (int argc, char **argv)
+{
+ if (!print_install_root())
+ return -1;
+
+ if (!print_service_dirs())
+ return -2;
+
+ if (!print_replace_install_prefix(DBUS_BINDIR "/dbus-daemon"))
+ return -3;
+
+ if (!print_replace_install_prefix("c:\\Windows\\System32\\testfile"))
+ return -4;
+
+ return 0;
+}