summaryrefslogtreecommitdiff
path: root/base/inifile.cc
diff options
context:
space:
mode:
authorNathan Binkert <binkertn@umich.edu>2004-06-30 14:53:26 -0400
committerNathan Binkert <binkertn@umich.edu>2004-06-30 14:53:26 -0400
commit16f53a7899c4ab6fe84271dee63768654ea0d1aa (patch)
tree1d4c528657282d1a752c9a877babbb9dfbee43be /base/inifile.cc
parentee765958b4bddbffd74a2c345da347ba71ec8d30 (diff)
downloadgem5-16f53a7899c4ab6fe84271dee63768654ea0d1aa.tar.xz
fix the -I flag stuff for CPP so it actually works right.
What was I smoking? --HG-- extra : convert_revision : 24488707a35febe006ec50a1fa7c9fad4842eadc
Diffstat (limited to 'base/inifile.cc')
-rw-r--r--base/inifile.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/base/inifile.cc b/base/inifile.cc
index 7f6a42dd6..10836baea 100644
--- a/base/inifile.cc
+++ b/base/inifile.cc
@@ -35,9 +35,7 @@
#include <sys/types.h>
#include <sys/wait.h>
-#if defined(__OpenBSD__) || defined(__APPLE__)
#include <libgen.h>
-#endif
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@@ -88,10 +86,10 @@ IniFile::loadCPP(const string &file, vector<char *> &cppArgs)
tmpf.close();
- const char *cfile = file.c_str();
- char *dir = basename(cfile);
+ char *cfile = strcpy(new char[file.size() + 1], file.c_str());
+ char *dir = dirname(cfile);
char *dir_arg = NULL;
- if (*dir != '.' && dir != cfile) {
+ if (*dir != '.') {
string arg = "-I";
arg += dir;
@@ -99,6 +97,8 @@ IniFile::loadCPP(const string &file, vector<char *> &cppArgs)
strcpy(dir_arg, arg.c_str());
}
+ delete [] cfile;
+
#ifdef CPP_PIPE
if (pipe(fd) == -1)
return false;