#line 2 "@srcdir@/lib/dirs.c.in"
/*
- * Copyright (c) 2008, 2009, 2010 Nicira Networks.
+ * Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <config.h>
#include "dirs.h"
#include <stdlib.h>
+#include "util.h"
struct directory {
const char *value; /* Actual value; NULL if not yet determined. */
return d->value;
}
+const char *
+ovs_sysconfdir(void)
+{
+ static struct directory d = { NULL, @sysconfdir@, "OVS_SYSCONFDIR" };
+ return get_dir(&d);
+}
+
const char *
ovs_pkgdatadir(void)
{
return get_dir(&d);
}
+const char *
+ovs_dbdir(void)
+{
+ static const char *dbdir;
+ if (!dbdir) {
+ dbdir = getenv("OVS_DBDIR");
+ if (!dbdir || !dbdir[0]) {
+ char *sysconfdir = getenv("OVS_SYSCONFDIR");
+
+ dbdir = (sysconfdir
+ ? xasprintf("%s/openvswitch", sysconfdir)
+ : @DBDIR@);
+ }
+ }
+ return dbdir;
+}
+
const char *
ovs_bindir(void)
{