From: Nathan Binkert Date: Wed, 30 Jun 2004 18:53:26 +0000 (-0400) Subject: fix the -I flag stuff for CPP so it actually works right. X-Git-Tag: m5_1.0_tutorial~279 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=16f53a7899c4ab6fe84271dee63768654ea0d1aa;p=gem5.git fix the -I flag stuff for CPP so it actually works right. What was I smoking? --HG-- extra : convert_revision : 24488707a35febe006ec50a1fa7c9fad4842eadc --- 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 #include -#if defined(__OpenBSD__) || defined(__APPLE__) #include -#endif #include #include #include @@ -88,10 +86,10 @@ IniFile::loadCPP(const string &file, vector &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 &cppArgs) strcpy(dir_arg, arg.c_str()); } + delete [] cfile; + #ifdef CPP_PIPE if (pipe(fd) == -1) return false;