|
a/src/utils/pathut.cpp |
|
b/src/utils/pathut.cpp |
1 |
#ifndef lint
|
1 |
#ifndef lint
|
2 |
static char rcsid[] = "@(#$Id: pathut.cpp,v 1.14 2006-12-23 13:07:21 dockes Exp $ (C) 2004 J.F.Dockes";
|
2 |
static char rcsid[] = "@(#$Id: pathut.cpp,v 1.15 2007-02-06 14:16:43 dockes Exp $ (C) 2004 J.F.Dockes";
|
3 |
#endif
|
3 |
#endif
|
4 |
/*
|
4 |
/*
|
5 |
* This program is free software; you can redistribute it and/or modify
|
5 |
* This program is free software; you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
6 |
* it under the terms of the GNU General Public License as published by
|
7 |
* the Free Software Foundation; either version 2 of the License, or
|
7 |
* the Free Software Foundation; either version 2 of the License, or
|
|
... |
|
... |
213 |
struct passwd *entry = getpwnam(s.substr(1, l).c_str());
|
213 |
struct passwd *entry = getpwnam(s.substr(1, l).c_str());
|
214 |
if (entry)
|
214 |
if (entry)
|
215 |
o.replace(0, l+1, entry->pw_dir);
|
215 |
o.replace(0, l+1, entry->pw_dir);
|
216 |
}
|
216 |
}
|
217 |
return o;
|
217 |
return o;
|
|
|
218 |
}
|
|
|
219 |
|
|
|
220 |
extern std::string path_absolute(const std::string &is)
|
|
|
221 |
{
|
|
|
222 |
if (is.length() == 0)
|
|
|
223 |
return is;
|
|
|
224 |
string s = is;
|
|
|
225 |
if (s[0] != '/') {
|
|
|
226 |
char buf[MAXPATHLEN];
|
|
|
227 |
if (!getcwd(buf, MAXPATHLEN)) {
|
|
|
228 |
return "";
|
|
|
229 |
}
|
|
|
230 |
s = path_cat(string(buf), s);
|
|
|
231 |
}
|
|
|
232 |
return s;
|
218 |
}
|
233 |
}
|
219 |
|
234 |
|
220 |
#include <smallut.h>
|
235 |
#include <smallut.h>
|
221 |
extern std::string path_canon(const std::string &is)
|
236 |
extern std::string path_canon(const std::string &is)
|
222 |
{
|
237 |
{
|