OpenCores
URL https://opencores.org/ocsvn/open8_urisc/open8_urisc/trunk

Subversion Repositories open8_urisc

[/] [open8_urisc/] [trunk/] [gnu/] [binutils/] [gold/] [dirsearch.cc] - Diff between revs 159 and 166

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 159 Rev 166
Line 23... Line 23...
#include "gold.h"
#include "gold.h"
 
 
#include <cerrno>
#include <cerrno>
#include <cstring>
#include <cstring>
#include <sys/types.h>
#include <sys/types.h>
 
#include <sys/stat.h>
#include <dirent.h>
#include <dirent.h>
 
 
#include "debug.h"
#include "debug.h"
#include "gold-threads.h"
#include "gold-threads.h"
#include "options.h"
#include "options.h"
Line 275... Line 276...
 
 
  *pindex = -2;
  *pindex = -2;
  return std::string();
  return std::string();
}
}
 
 
 
// Search for a file in a directory list.  This is a low-level function and
 
// therefore can be used before options and parameters are set.
 
 
 
std::string
 
Dirsearch::find_file_in_dir_list(const std::string& name,
 
                                 const General_options::Dir_list& directories,
 
                                 const std::string& extra_search_dir)
 
{
 
  struct stat buf;
 
  std::string extra_name = extra_search_dir + '/' + name;
 
 
 
  if (stat(extra_name.c_str(), &buf) == 0)
 
    return extra_name;
 
  for (General_options::Dir_list::const_iterator dir = directories.begin();
 
       dir != directories.end();
 
       ++dir)
 
    {
 
      std::string full_name = dir->name() + '/' + name;
 
      if (stat(full_name.c_str(), &buf) == 0)
 
        return full_name;
 
    }
 
  return name;
 
}
 
 
} // End namespace gold.
} // End namespace gold.
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.