Changeset 743


Ignore:
Timestamp:
Dec 20, 2008, 12:04:54 AM (12 years ago)
Author:
Peter Johansson
Message:

removed usage of envar HOME in Gnuplot.cc

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/configure.ac

    r742 r743  
    8282AC_PATH_PROG([HELP2MAN], [help2man], [no])
    8383AM_CONDITIONAL([HAVE_HELP2MAN], [test x$HELP2MAN != xno])
    84 AC_CHECK_PROG([GNUPLOT],[gnuplot],[ok])
     84AC_PATH_PROG([GNUPLOT],[gnuplot],[no])
     85AC_DEFINE_UNQUOTED([GNUPLOT_PATH], ["$GNUPLOT"],
     86                   [defined to gnuplot path (or no if gnuplot was not found)])
    8587
    8688# Save FLAGS
     
    273275
    274276# Failure to locate gnuplot is not considered fatal
    275 if (test "$GNUPLOT" != "ok") ; then
     277if (test "x$GNUPLOT" = "xno") ; then
    276278  AC_MSG_WARN([Gnuplot was not found. svndigest will compile
    277279  without gnuplot but will throw an exception at run-time. Please
  • trunk/lib/Gnuplot.cc

    r727 r743  
    44  Copyright (C) 2006 Jari Häkkinen, Peter Johansson
    55  Copyright (C) 2007 Peter Johansson
    6   Copyright (C) 2008 Jari Häkkinen
     6  Copyright (C) 2008 Jari Häkkinen, Peter Johansson
    77
    88  This file is part of svndigest, http://dev.thep.lu.se/svndigest
     
    2121  along with svndigest. If not, see <http://www.gnu.org/licenses/>.
    2222*/
     23
     24#include <config.h>
    2325
    2426#include "Gnuplot.h"
     
    5860  void Gnuplot::acquire_program_path(const std::string& progname)
    5961  {
    60     char* env_path=getenv("PATH");
    61     if (!env_path)
    62       throw GnuplotException("Environment variable PATH is not set");
    63 
    64     std::list<std::string> paths;
    65     tokenizer(env_path,paths);
    66     for (std::list<std::string>::const_iterator i=paths.begin();
    67          i!=paths.end(); ++i) {
    68       std::string tmp((*i) + '/' + progname);
    69       if (!access(tmp.c_str(),X_OK)) {
    70         gnuplot_binary_=tmp;
    71         break;
    72       }
     62    std::string tmp = GNUPLOT_PATH;
     63    if (tmp=="no")
     64      throw GnuplotException("no gnuplot binary available");
     65    if (!access(tmp.c_str(),X_OK)) {
     66      gnuplot_binary_=tmp;
    7367    }
    7468
    7569    if (gnuplot_binary_.empty())
    76       throw GnuplotException("Cannot find '" + progname + "' in PATH");
     70      throw GnuplotException("Cannot find '" + tmp);
    7771  }
    7872
Note: See TracChangeset for help on using the changeset viewer.