]> git.lyx.org Git - features.git/commitdiff
Rearrange and rename the environment variable setter/getter functions.
authorAngus Leeming <leeming@lyx.org>
Tue, 15 Feb 2005 13:45:41 +0000 (13:45 +0000)
committerAngus Leeming <leeming@lyx.org>
Tue, 15 Feb 2005 13:45:41 +0000 (13:45 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9634 a592a061-630c-0410-9148-cb99ea01b6c8

16 files changed:
src/ChangeLog
src/lyx_main.C
src/lyxfunc.C
src/lyxrc.C
src/lyxsocket.C
src/support/ChangeLog
src/support/Makefile.am
src/support/environment.C [new file with mode: 0644]
src/support/environment.h [new file with mode: 0644]
src/support/filetools.C
src/support/filetools.h
src/support/lyxlib.h
src/support/os_os2.C
src/support/package.C.in
src/support/putenv.C [deleted file]
src/support/userinfo.C

index b26aa048f0ed70e797ad6ea895e5151ac646889a..f5d4251677dcaeb7593c8d238eef4a3b1e09a95e 100644 (file)
@@ -1,3 +1,13 @@
+2005-02-15  Angus Leeming  <leeming@lyx.org>
+
+       * lyx_main.C (error_handler):
+       * lyxfunc.C:
+       * lyxrc.C (setDefaults):
+       s/GetEnv/getEnv/.
+       #include "environment.h".
+
+       * lyxsocket.C (LyXServerSocket): s/putenv/setEnv/.
+
 2005-02-15  Angus Leeming  <leeming@lyx.org>
 
        * lyxserver.C (startPipe): squash MSVC warning "local variable
index d5074964f93fbe9bf1443ee71314a381e6e9d2fd..67deea775e10d1ff6946f65143dc2c989caf3a75 100644 (file)
@@ -45,6 +45,7 @@
 #include "frontends/lyx_gui.h"
 #include "frontends/LyXView.h"
 
+#include "support/environment.h"
 #include "support/filetools.h"
 #include "support/lyxlib.h"
 #include "support/os.h"
@@ -63,7 +64,7 @@ using lyx::support::bformat;
 using lyx::support::createDirectory;
 using lyx::support::createLyXTmpDir;
 using lyx::support::FileSearch;
-using lyx::support::GetEnv;
+using lyx::support::getEnv;
 using lyx::support::i18nLibFileSearch;
 using lyx::support::LibFileSearch;
 using lyx::support::package;
@@ -369,9 +370,9 @@ static void error_handler(int err_sig)
 
 #ifdef SIGHUP
        if (err_sig == SIGSEGV ||
-           (err_sig != SIGHUP && !GetEnv("LYXDEBUG").empty()))
+           (err_sig != SIGHUP && !getEnv("LYXDEBUG").empty()))
 #else
-       if (err_sig == SIGSEGV || !GetEnv("LYXDEBUG").empty())
+       if (err_sig == SIGSEGV || !getEnv("LYXDEBUG").empty())
 #endif
                lyx::support::abort();
        exit(0);
index 6085a5bbe6174a52fb6a07b216f589d4d3305b7f..ef7ccd59c7d45a6b6e94e0428d73a66062066df5 100644 (file)
@@ -78,6 +78,7 @@
 #include "frontends/Menubar.h"
 #include "frontends/Toolbars.h"
 
+#include "support/environment.h"
 #include "support/filefilterlist.h"
 #include "support/filetools.h"
 #include "support/forkedcontr.h"
index 96350ce76088888b54b4dc1a2ee445ef013a5e69..13497997c439ecbbdbdcc0736503b54dff1faaf4 100644 (file)
@@ -34,6 +34,7 @@
 #include "graphics/GraphicsTypes.h"
 
 #include "support/convert.h"
+#include "support/environment.h"
 #include "support/filetools.h"
 #include "support/lstrings.h"
 #include "support/userinfo.h"
@@ -41,7 +42,7 @@
 using lyx::support::ascii_lowercase;
 using lyx::support::bformat;
 using lyx::support::ExpandPath;
-using lyx::support::GetEnv;
+using lyx::support::getEnv;
 using lyx::support::LibFileSearch;
 using lyx::support::token;
 
@@ -188,7 +189,7 @@ void LyXRC::setDefaults() {
        ui_file = "default";
        // Get printer from the environment. If fail, use default "",
        // assuming that everything is set up correctly.
-       printer = GetEnv("PRINTER");
+       printer = getEnv("PRINTER");
        print_adapt_output = false;
        print_command = "dvips";
        print_evenpage_flag = "-B";
index 17c33165244964c46d53125c97468475ce69a6e2..29a2480aa04438ae2d7ebe6c1453c4d50dcb47d1 100644 (file)
@@ -21,6 +21,7 @@
 
 #include "frontends/lyx_gui.h"
 
+#include "support/environment.h"
 #include "support/lyxlib.h"
 #include "support/socktools.h"
 
@@ -50,9 +51,9 @@ LyXServerSocket::LyXServerSocket(LyXFunc * f, string const & addr)
 
        // These env vars are used by DVI inverse search
        // Needed by xdvi
-       lyx::support::putenv("XEDITOR", "lyxclient -g %f %l");
+       lyx::support::setEnv("XEDITOR", "lyxclient -g %f %l");
        // Needed by lyxclient
-       lyx::support::putenv("LYXSOCKET", address_);
+       lyx::support::setEnv("LYXSOCKET", address_);
 
        lyx_gui::register_socket_callback(
                fd_,
index ff0ae18346fe3c0788d7a56e96ca3f8d380abe9a..f451fee9f70db74b5e69c2f5091266dc0c951245 100644 (file)
@@ -1,3 +1,26 @@
+2005-02-15  Angus Leeming  <leeming@lyx.org>
+
+       * environment.[Ch]: new files. Move the environment setter/getter
+       functions here from filetools.[Ch]. In the process:
+       rename GetEnv as getEnv.
+       rename putEnv as setEnv. Change the signature of the function
+       to take a pair of arguments (a name and a value) rather than the
+       existing coded "name=value" single argument. Merge the putenv.C
+       code into setEnv.
+
+       * lyxlib.h (putenv): remove declaration.
+       * putenv.C: removed.
+
+       * Makefile.am: add environment.[Ch]. Remove putenv.C.
+
+       * filetools.[Ch]: remove environment setter/getter functions.
+
+       * os_os2.C (init): s/GetEnvPath/getEnvPath/. Left over from an
+       earlier change.
+
+       * package.C.in (get_home_dir, extract_env_var_dir):
+       * userinfo.C (user_email): s/GetEnv/getEnv/.
+
 2005-02-03  Angus Leeming  <leeming@lyx.org>
 
        * forkedcall.C (running): call the lyx::kill wrapper function
@@ -21,7 +44,7 @@
 
 2005-01-31  Lars Gullik Bjonnes  <larsbj@gullik.net>
 
-       * fs_extras.C: add changes from Asgers Win32 patch.
+       * fs_extras.C: add changes from Asger's Win32 patch.
 
 2005-01-31  Asger Ottar Alstrup  <aalstrup@laerdal.dk>
 
index a039c82768cd531f8582c243e91c684d557aeb31..e066fe3b8d504ec9642c382bd73ea91f064bff65 100644 (file)
@@ -27,6 +27,8 @@ libsupport_la_SOURCES = \
        copied_ptr.h \
        cow_ptr.h \
        debugstream.h \
+       environment.h \
+       environment.C \
        filefilterlist.C \
        filefilterlist.h \
        filename.C \
@@ -63,7 +65,6 @@ libsupport_la_SOURCES = \
        path.h \
        package.C \
        package.h \
-       putenv.C \
        rename.C \
        socktools.C \
        socktools.h \
diff --git a/src/support/environment.C b/src/support/environment.C
new file mode 100644 (file)
index 0000000..d068582
--- /dev/null
@@ -0,0 +1,130 @@
+/**
+ * \file environment.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Angus Leeming
+ * \author João Luis M. Assirati
+ * \author Lars Gullik Bjønnes
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#include <config.h>
+
+#include "support/environment.h"
+#include "support/os.h"
+
+#include <boost/tokenizer.hpp>
+
+#include <cstdlib>
+#include <map>
+
+
+using std::string;
+using std::vector;
+
+namespace lyx {
+namespace support {
+
+string const getEnv(string const & envname)
+{
+       // f.ex. what about error checking?
+       char const * const ch = getenv(envname.c_str());
+       string const envstr = !ch ? "" : ch;
+       return envstr;
+}
+
+
+vector<string> const getEnvPath(string const & name)
+{
+       typedef boost::char_separator<char> Separator;
+       typedef boost::tokenizer<Separator> Tokenizer;
+
+       string const env_var = getEnv(name);
+       Separator const separator(string(1, os::path_separator()).c_str());
+       Tokenizer const tokens(env_var, separator);
+       Tokenizer::const_iterator it = tokens.begin();
+       Tokenizer::const_iterator const end = tokens.end();
+
+       std::vector<string> vars;
+       for (; it != end; ++it)
+               vars.push_back(os::internal_path(*it));
+
+       return vars;
+}
+
+
+bool setEnv(string const & name, string const & value)
+{
+       // CHECK Look at and fix this.
+       // f.ex. what about error checking?
+
+#if defined (HAVE_SETENV)
+       int const retval = ::setenv(name.c_str(), value.c_str(), true);
+
+#elif defined (HAVE_PUTENV)
+       static std::map<string, char *> varmap;
+
+       string envstr = name + '=' + value;
+       char * newptr = new char[envstr.size() + 1];
+       envstr.copy(newptr, envstr.length());
+       newptr[envstr.length()] = '\0';
+       int const retval = ::putenv(newptr);
+
+       char * oldptr = varmap[name];
+       if (oldptr)
+               delete oldptr;
+       varmap[name] = newptr;
+
+#else
+#error No environment-setting function has been defined.
+#endif
+       return retval == 0;
+}
+
+
+void setEnvPath(string const & name, vector<string> const & env)
+{
+       char const separator(os::path_separator());
+       std::ostringstream ss;
+       vector<string>::const_iterator it = env.begin();
+       vector<string>::const_iterator const end = env.end();
+       for (; it != end; ++it) {
+               if (ss.tellp() > 0)
+                       ss << separator;
+               ss << os::external_path(*it);
+       }
+       setEnv(name, ss.str());
+}
+
+
+void prependEnvPath(string const & name, string const & prefix)
+{
+       vector<string> env_var = getEnvPath(name);
+
+       typedef boost::char_separator<char> Separator;
+       typedef boost::tokenizer<Separator> Tokenizer;
+
+       Separator const separator(string(1, os::path_separator()).c_str());
+
+       // Prepend each new element to the list, removing identical elements
+       // that occur later in the list.
+       Tokenizer const tokens(prefix, separator);
+       vector<string> reversed_tokens(tokens.begin(), tokens.end());
+
+       typedef vector<string>::const_reverse_iterator token_iterator;
+       token_iterator it = reversed_tokens.rbegin();
+       token_iterator const end = reversed_tokens.rend();
+       for (; it != end; ++it) {
+               vector<string>::iterator remove_it =
+                       std::remove(env_var.begin(), env_var.end(), *it);
+               env_var.erase(remove_it, env_var.end());
+               env_var.insert(env_var.begin(), *it);
+       }
+
+       setEnvPath(name, env_var);
+}
+
+} // namespace support
+} // namespace lyx
diff --git a/src/support/environment.h b/src/support/environment.h
new file mode 100644 (file)
index 0000000..6893762
--- /dev/null
@@ -0,0 +1,58 @@
+// -*- C++ -*-
+/**
+ * \file environment.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Angus Leeming
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#ifndef LYX_ENVIRONMENT_H
+#define LYX_ENVIRONMENT_H
+
+#include <string>
+#include <vector>
+
+namespace lyx {
+namespace support {
+
+/// @returns the contents of the environment variable @c name.
+std::string const getEnv(std::string const & envname);
+
+/** @returns the contents of the environment variable @c name,
+ *  split into path elements using the OS-dependent separator token.
+ *  Each element is then passed through os::internal_path() to
+ *  guarantee that it is in the form of a unix-style path.
+ *  If the environment variable is not set, then the function returns
+ *  an empty vector.
+ */
+std::vector<std::string> const getEnvPath(std::string const & name);
+
+/** Set the contents of the environment variable @c name to @c value.
+ *  @returns true if the variable was set successfully.
+ */
+bool setEnv(std::string const & name, std::string const & value);
+
+/** Set the contents of the environment variable @c name
+ *  using the paths stored in the @c env vector.
+ *  Each element is passed through os::external_path().
+ *  Multiple elements are concatenated into a single string using
+ *  os::path_separator().
+ */
+void setEnvPath(std::string const & name, std::vector<std::string> const & env);
+
+/** Prepend a list of paths to that returned by the environment variable.
+ *  Identical paths occurring later in the list are removed.
+ *  @param name the name of the environment variable.
+ *  @prefix the list of paths in OS-native syntax.
+ *  Eg "/foo/bar:/usr/bin:/usr/local/bin" on *nix,
+ *     "C:\foo\bar;C:\windows" on Windows.
+ */
+void prependEnvPath(std::string const & name, std::string const & prefix);
+
+} // namespace support
+} // namespace lyx
+
+#endif // LYX_ENVIRONMENT_H
index 45cce5bb3ac8ac692aa61f54e9c62cff4834705c..4671f2896097acd415b1450184b60fc06ce92238 100644 (file)
 #include <config.h>
 
 #include "support/convert.h"
-#include "support/systemcall.h"
+#include "support/environment.h"
 #include "support/filetools.h"
-#include "support/lstrings.h"
 #include "support/forkedcontr.h"
 #include "support/fs_extras.h"
-#include "support/package.h"
-#include "support/path.h"
+#include "support/lstrings.h"
 #include "support/lyxlib.h"
 #include "support/os.h"
+#include "support/package.h"
+#include "support/path.h"
+#include "support/systemcall.h"
 
 // FIXME Interface violation
 #include "gettext.h"
@@ -39,7 +40,6 @@
 #include <boost/assert.hpp>
 #include <boost/filesystem/operations.hpp>
 #include <boost/regex.hpp>
-#include <boost/tokenizer.hpp>
 
 #include <fcntl.h>
 
@@ -268,17 +268,17 @@ i18nLibFileSearch(string const & dir, string const & name,
        /* [Otherwise] We have to proceed with the POSIX methods of
           looking to `LC_ALL', `LC_xxx', and `LANG'. */
 
-       string lang = GetEnv("LC_ALL");
+       string lang = getEnv("LC_ALL");
        if (lang.empty()) {
-               lang = GetEnv("LC_MESSAGES");
+               lang = getEnv("LC_MESSAGES");
                if (lang.empty()) {
-                       lang = GetEnv("LANG");
+                       lang = getEnv("LANG");
                        if (lang.empty())
                                lang = "C";
                }
        }
 
-       string const language = GetEnv("LANGUAGE");
+       string const language = getEnv("LANGUAGE");
        if (lang != "C" && lang != "POSIX" && !language.empty())
                lang = language;
 
@@ -330,116 +330,6 @@ string const LibScriptSearch(string const & command_in)
 }
 
 
-string const GetEnv(string const & envname)
-{
-       // f.ex. what about error checking?
-       char const * const ch = getenv(envname.c_str());
-       string const envstr = !ch ? "" : ch;
-       return envstr;
-}
-
-
-vector<string> const getEnvPath(string const & name)
-{
-       typedef boost::char_separator<char> Separator;
-       typedef boost::tokenizer<Separator> Tokenizer;
-
-       string const env_var = GetEnv(name);
-       Separator const separator(string(1, os::path_separator()).c_str());
-       Tokenizer const tokens(env_var, separator);
-       Tokenizer::const_iterator it = tokens.begin();
-       Tokenizer::const_iterator const end = tokens.end();
-
-       std::vector<string> vars;
-       for (; it != end; ++it)
-               vars.push_back(os::internal_path(*it));
-
-       return vars;
-}
-
-
-void setEnvPath(string const & name, vector<string> const & env)
-{
-       char const separator(os::path_separator());
-       std::ostringstream ss;
-       vector<string>::const_iterator it = env.begin();
-       vector<string>::const_iterator const end = env.end();
-       for (; it != end; ++it) {
-               if (ss.tellp() > 0)
-                       ss << separator;
-               ss << os::external_path(*it);
-       }
-       putEnv(name + "=" + ss.str());
-}
-
-
-void prependEnvPath(string const & name, string const & prefix)
-{
-       vector<string> env_var = getEnvPath(name);
-
-       typedef boost::char_separator<char> Separator;
-       typedef boost::tokenizer<Separator> Tokenizer;
-
-       Separator const separator(string(1, os::path_separator()).c_str());
-
-       // Prepend each new element to the list, removing identical elements
-       // that occur later in the list.
-       Tokenizer const tokens(prefix, separator);
-       vector<string> reversed_tokens(tokens.begin(), tokens.end());
-
-       typedef vector<string>::const_reverse_iterator token_iterator;
-       token_iterator it = reversed_tokens.rbegin();
-       token_iterator const end = reversed_tokens.rend();
-       for (; it != end; ++it) {
-               vector<string>::iterator remove_it =
-                       std::remove(env_var.begin(), env_var.end(), *it);
-               env_var.erase(remove_it, env_var.end());
-               env_var.insert(env_var.begin(), *it);
-       }
-
-       setEnvPath(name, env_var);
-}
-
-
-bool putEnv(string const & envstr)
-{
-       // CHECK Look at and fix this.
-       // f.ex. what about error checking?
-
-#if defined (HAVE_SETENV)
-       string name;
-       string const value = split(envstr, name, '=');
-       int const retval = ::setenv(name.c_str(), value.c_str(), true);
-#elif defined (HAVE_PUTENV)
-       // this leaks, but what can we do about it?
-       //   Is doing a getenv() and a free() of the older value
-       //   a good idea? (JMarc)
-       // Actually we don't have to leak...calling putenv like this
-       // should be enough: ... and this is obviously not enough if putenv
-       // does not make a copy of the string. It is also not very wise to
-       // put a string on the free store. If we have to leak we should do it
-       // like this:
-       char * leaker = new char[envstr.length() + 1];
-       envstr.copy(leaker, envstr.length());
-       leaker[envstr.length()] = '\0';
-       int const retval = ::putenv(leaker);
-
-       // If putenv does not make a copy of the char const * this
-       // is very dangerous. OTOH if it does take a copy this is the
-       // best solution.
-       // The  only implementation of putenv that I have seen does not
-       // allocate memory. _And_ after testing the putenv in glibc it
-       // seems that we need to make a copy of the string contents.
-       // I will enable the above.
-       //int retval = lyx::putenv(envstr.c_str());
-#else
-       // No environment setting function. Can this happen?
-       int const retval = 1; //return an error condition.
-#endif
-       return retval == 0;
-}
-
-
 namespace {
 
 string const createTmpDir(string const & tempdir, string const & mask)
@@ -771,7 +661,7 @@ string const ReplaceEnvironmentPath(string const & path)
                        if (!what[0].matched)
                                break;
                }
-               result = what.str(1) + GetEnv(what.str(2)) + what.str(3);
+               result = what.str(1) + getEnv(what.str(2)) + what.str(3);
        }
        return result;
 }
index a34e981ff357ed2824ee759c718d907a2c25dbcb..bdba4bca59af029411e608d6764652f2b6e90088 100644 (file)
@@ -104,35 +104,6 @@ i18nLibFileSearch(std::string const & dir, std::string const & name,
  */
 std::string const LibScriptSearch(std::string const & command);
 
-///
-std::string const GetEnv(std::string const & envname);
-
-/** Return the contents of the environment variable \c name,
- *  split using the OS-dependent token separating elements.
- *  Each element is then passed through os::internal_path to
- *  guarantee that it is in the form of a unix-stype path.
- *  If the environment variable is not set, then returns an empty vector.
- */
-std::vector<std::string> const getEnvPath(std::string const & name);
-
-/** Set the contents of the environment variable \c name
- *  using the paths stored in the \c env vector.
- *  Each element is passed through os::external_path.
- */
-void setEnvPath(std::string const & name, std::vector<std::string> const & env);
-
-/** Prepend a list of paths to that returned by the environment variable.
- *  Identical paths occurring later in the list are removed.
- *  @param name the name of the environment variable.
- *  @prefix the list of paths in OS-native syntax.
- *  Eg "/foo/bar:/usr/bin:/usr/local/bin" on *nix,
- *     "C:\foo\bar;C:\windows" on Windows.
- */
-void prependEnvPath(std::string const & name, std::string const & prefix);
-
-/// Set an environment variable using a string of the form "name=FOO".
-bool putEnv(std::string const & envstr);
-
 /// Substitutes active latex characters with underscores in filename
 std::string const MakeLatexName(std::string const & file);
 
index 235a113744e7b23279fb8892f8d466827a1a34ea..fa06e1de11ba79db384d56bd10f0fec3611f2e09 100644 (file)
@@ -40,8 +40,6 @@ int kill(int pid, int sig);
 void abort();
 /// create the given directory with the given mode
 int mkdir(std::string const & pathname, unsigned long int mode);
-/// put variable=value as a C std::string into the environment
-bool putenv(std::string const & varname, std::string const & value);
 /// unlink the given file
 int unlink(std::string const & file);
 /// (securely) create a temporary file in the given dir with the given prefix
index e49b3317f6d857bad4b6fced2a1df602154d4fa5..86713af6ee655f8efaa022f24653abae0f960c23 100644 (file)
@@ -44,10 +44,10 @@ void init(int argc, char * argv[])
                exit(rc);
 
        // OS/2 cmd.exe has another use for '&'
-       string sh = OnlyFilename(GetEnvPath("EMXSHELL"));
+       string sh = OnlyFilename(getEnvPath("EMXSHELL"));
        if (sh.empty()) {
                // COMSPEC is set, unless user unsets
-               sh = OnlyFilename(GetEnvPath("COMSPEC"));
+               sh = OnlyFilename(getEnvPath("COMSPEC"));
                if (sh.empty())
                        sh = "cmd.exe";
        }
index f7db4a77fa2f8bec776124687e79fcf81deaa55f..9a9a2afc7b6fe0a6468fcab8dd24b6b9aca281cb 100644 (file)
@@ -19,6 +19,7 @@
 #include "debug.h"
 #include "gettext.h"
 
+#include "support/environment.h"
 #include "support/filetools.h"
 #include "support/lstrings.h"
 #include "support/os.h"
@@ -319,9 +320,9 @@ string const get_document_dir(string const & home_dir)
 string const get_home_dir()
 {
 #if defined (USE_WINDOWS_PACKAGING)
-       string const home_dir = GetEnv("USERPROFILE");
+       string const home_dir = getEnv("USERPROFILE");
 #else // Posix-like.
-       string const home_dir = GetEnv("HOME");
+       string const home_dir = getEnv("HOME");
 #endif
 
        return os::internal_path(home_dir);
@@ -650,7 +651,7 @@ bool check_command_line_dir(string const & dir,
 // The environment variable @c env_var expands to a (single) file path.
 string const extract_env_var_dir(string const & env_var)
 {
-       string const dir = os::internal_path(GetEnv(env_var));
+       string const dir = os::internal_path(getEnv(env_var));
        return dir.empty() ? dir : MakeAbsPath(dir);
 }
 
diff --git a/src/support/putenv.C b/src/support/putenv.C
deleted file mode 100644 (file)
index efb26fa..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- * \file putenv.C
- * This file is part of LyX, the document processor.
- * Licence details can be found in the file COPYING.
- *
- * \author Lars Gullik Bjønnes
- * \author João Luis M. Assirati
- *
- * Full author contact details are available in file CREDITS.
- */
-
-#include <config.h>
-
-#include "support/lyxlib.h"
-
-#include <cstdlib>
-#include <string>
-#include <map>
-
-using std::string;
-using std::map;
-
-bool lyx::support::putenv(string const & varname, string const & value)
-{
-       static map<string, char *> varmap;
-
-       string str = varname + '=' + value;
-       char * newptr = new char[str.size() + 1];
-       newptr[str.copy(newptr, string::npos)] = '\0';
-       bool status = (::putenv(newptr) == 0);
-
-       char * oldptr = varmap[varname];
-       if (oldptr)
-               delete oldptr;
-       varmap[varname] = newptr;
-
-       return status;
-}
index e10cd6a17dad744f7b5fe3790d92e2fb1587a428..758ce34572a9e0e8f755ec938a66c5989fc2c01f 100644 (file)
@@ -11,7 +11,7 @@
 #include <config.h>
 
 #include "support/userinfo.h"
-#include "support/filetools.h"
+#include "support/environment.h"
 
 #include <boost/assert.hpp>
 
@@ -40,9 +40,9 @@ string const user_name()
 
 string const user_email()
 {
-       string email = GetEnv("EMAIL_ADDRESS");
+       string email = getEnv("EMAIL_ADDRESS");
        if (email.empty())
-               email = GetEnv("EMAIL");
+               email = getEnv("EMAIL");
        return email;
 }