[PATCH 03/30] Moved environment.c to linux/environment.c


Michael Schonberg <mschonberg@...>
 

The funcitons for manipulating environement variables are os-specific. We
may want to add a generic directory for a default implemenation.

This is in preparation for the windows port.

Signed-off-by: Mike Schonberg <mschonberg@nyx.com>
---
common/c_cpp/configure.ac | 3 +-
common/c_cpp/src/c/environment.c | 59 --------------------------------
common/c_cpp/src/c/linux/environment.c | 59 ++++++++++++++++++++++++++++++++
3 files changed, 61 insertions(+), 60 deletions(-)
delete mode 100644 common/c_cpp/src/c/environment.c
create mode 100644 common/c_cpp/src/c/linux/environment.c

diff --git a/common/c_cpp/configure.ac b/common/c_cpp/configure.ac
index 9b08055..b6f537a 100755
--- a/common/c_cpp/configure.ac
+++ b/common/c_cpp/configure.ac
@@ -46,7 +46,8 @@ AC_CANONICAL_BUILD()
# Set up symbolic links for os-specific files
AC_MSG_NOTICE([Configuring symbolic links for $build_os in $srcdir])
case $build_os in
- linux*-*) AC_CONFIG_LINKS([src/c/port.h:src/c/linux/port.h]) ;;
+ linux*-*) AC_CONFIG_LINKS([src/c/port.h:src/c/linux/port.h
+ src/c/environment.c:src/c/linux/environment.c]) ;;
esac

# Checks for programs.
diff --git a/common/c_cpp/src/c/environment.c b/common/c_cpp/src/c/environment.c
deleted file mode 100644
index 34affc0..0000000
--- a/common/c_cpp/src/c/environment.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/* $Id: environment.c,v 1.2.2.3.12.2 2011/08/10 14:53:23 nicholasmarriott Exp $
- *
- * OpenMAMA: The open middleware agnostic messaging API
- * Copyright (C) 2011 NYSE Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA
- */
-
-/* ********************************************************** */
-/* Includes. */
-/* ********************************************************** */
-#include "stdlib.h"
-#include "wombat/environment.h"
-
-int environment_deleteVariable(const char *name)
-{
- return unsetenv(name);
-}
-
-const char *environment_getVariable(const char *name)
-{
- /* Returns. */
- const char *ret = NULL;
-
- /* Check the argument. */
- if(name != NULL)
- {
- ret = getenv(name);
- }
-
- return ret;
-}
-
-int environment_setVariable(const char *name, const char *value)
-{
- /* Returns. */
- int ret = -1;
-
- /* Check the arguments. */
- if((name != NULL) && (value != NULL))
- {
- ret = setenv(name, value, 1);
- }
-
- return ret;
-}
diff --git a/common/c_cpp/src/c/linux/environment.c b/common/c_cpp/src/c/linux/environment.c
new file mode 100644
index 0000000..34affc0
--- /dev/null
+++ b/common/c_cpp/src/c/linux/environment.c
@@ -0,0 +1,59 @@
+/* $Id: environment.c,v 1.2.2.3.12.2 2011/08/10 14:53:23 nicholasmarriott Exp $
+ *
+ * OpenMAMA: The open middleware agnostic messaging API
+ * Copyright (C) 2011 NYSE Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+/* ********************************************************** */
+/* Includes. */
+/* ********************************************************** */
+#include "stdlib.h"
+#include "wombat/environment.h"
+
+int environment_deleteVariable(const char *name)
+{
+ return unsetenv(name);
+}
+
+const char *environment_getVariable(const char *name)
+{
+ /* Returns. */
+ const char *ret = NULL;
+
+ /* Check the argument. */
+ if(name != NULL)
+ {
+ ret = getenv(name);
+ }
+
+ return ret;
+}
+
+int environment_setVariable(const char *name, const char *value)
+{
+ /* Returns. */
+ int ret = -1;
+
+ /* Check the arguments. */
+ if((name != NULL) && (value != NULL))
+ {
+ ret = setenv(name, value, 1);
+ }
+
+ return ret;
+}
--
1.7.7.6