Latest patch from asa
This commit is contained in:
@@ -221,16 +221,8 @@ void MakePathname(char* pathname, const char* path, const char* name) {
|
||||
strbtrim(tmppath);
|
||||
strchg(tmppath, GOLD_WRONG_SLASH_CHR, GOLD_SLASH_CHR);
|
||||
strchg(tmpname, GOLD_WRONG_SLASH_CHR, GOLD_SLASH_CHR);
|
||||
if(strpbrk(tmpname, GOLD_SLASH_STR)){
|
||||
#if defined(__UNIX__)
|
||||
if(tmpname[0] == '~' && tmpname[1] == GOLD_SLASH_CHR){
|
||||
struct passwd* pw = getpwuid(getuid());
|
||||
strxmerge(pathname, sizeof(Path), pw->pw_dir, tmpname+1, NULL);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
strcpy(pathname, tmpname);
|
||||
}
|
||||
if(strpbrk(tmpname, GOLD_SLASH_STR))
|
||||
strschg_environ(strxcpy(pathname, tmpname, sizeof(Path)));
|
||||
else {
|
||||
strcpy(newpath, tmppath);
|
||||
if(*newpath)
|
||||
@@ -308,15 +300,8 @@ void TouchFile(const char* filename) {
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
char* PathCopy(char* __dst, const char* __src) {
|
||||
#if defined(__UNIX__)
|
||||
if(__src[0] == '~' && __src[1] == GOLD_SLASH_CHR){
|
||||
struct passwd* pw = getpwuid(getuid());
|
||||
strxmerge(__dst, sizeof(Path), pw->pw_dir, __src+1, NULL);
|
||||
return AddBackslash(__dst);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
return AddBackslash(strxcpy(__dst, __src, sizeof(Path)));
|
||||
strschg_environ(strxcpy(__dst, __src, sizeof(Path)));
|
||||
return AddBackslash(__dst);
|
||||
}
|
||||
|
||||
|
||||
@@ -472,3 +457,4 @@ void extractdirname(char *dir, const char *path) {
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
|
||||
|
@@ -39,7 +39,7 @@
|
||||
string& AddBackslash(string& p) {
|
||||
|
||||
for(size_t posn = 0; (posn=p.find(GOLD_WRONG_SLASH_CHR, posn)) != p.npos; posn++)
|
||||
p[posn] = GOLD_SLASH_CHR;
|
||||
p[posn] = GOLD_SLASH_CHR;
|
||||
if(p[p.length()-1] != GOLD_SLASH_CHR)
|
||||
p += GOLD_SLASH_STR;
|
||||
|
||||
@@ -64,6 +64,7 @@ void MakePathname(string& pathname, const string& path, const string& name) {
|
||||
void PathCopy(string& dst, const char* src) {
|
||||
|
||||
dst = src;
|
||||
strschg_environ(dst);
|
||||
AddBackslash(dst);
|
||||
}
|
||||
|
||||
@@ -229,7 +230,7 @@ bool maketruepath(string &dirname) {
|
||||
if(access(dirname.c_str(), R_OK)) {
|
||||
dirname = cwd;
|
||||
ok = false;
|
||||
}
|
||||
}
|
||||
for(posn = 0; (posn=dirname.find('\\', posn)) != dirname.npos; posn++)
|
||||
dirname[posn] = '/';
|
||||
while((skipto=dirname.find("/../")) != dirname.npos) {
|
||||
@@ -240,7 +241,7 @@ bool maketruepath(string &dirname) {
|
||||
while((skipfrom=dirname.find("/./")) != dirname.npos)
|
||||
dirname.erase(skipfrom, 2);
|
||||
len = dirname.length();
|
||||
if(len > 2 && !strcmp(&(dirname[len-2]), "/."))
|
||||
if(len > 2 && !strcmp(&(dirname.c_str()[len-2]), "/."))
|
||||
dirname.erase(len-2, 2);
|
||||
len = dirname.length();
|
||||
#ifdef __HAVE_DRIVES__
|
||||
|
@@ -98,7 +98,7 @@ void GKbd::Init() {
|
||||
#if defined(__USE_NCURSES__)
|
||||
|
||||
// Both screen and keyboard must be initialized at once
|
||||
if(1 == (curses_initialized++)) {
|
||||
if(0 == (curses_initialized++)) {
|
||||
initscr();
|
||||
raw();
|
||||
noecho();
|
||||
@@ -295,7 +295,7 @@ GKbd::~GKbd() {
|
||||
|
||||
#if defined(__USE_NCURSES__)
|
||||
|
||||
if(1 == (--curses_initialized))
|
||||
if(0 == (--curses_initialized))
|
||||
endwin();
|
||||
|
||||
#elif defined(__WIN32__)
|
||||
|
@@ -134,7 +134,7 @@ GVid::~GVid() {
|
||||
#if defined(__USE_NCURSES__)
|
||||
|
||||
attrset(A_NORMAL);
|
||||
if(1 == (--curses_initialized))
|
||||
if(0 == (--curses_initialized))
|
||||
endwin();
|
||||
|
||||
#elif defined(__UNIX__)
|
||||
@@ -160,7 +160,7 @@ void GVid::init() {
|
||||
|
||||
#if defined(__USE_NCURSES__)
|
||||
// Both display and keyboard will be initialized at once
|
||||
if(1 == (curses_initialized++)) {
|
||||
if(0 == (curses_initialized++)) {
|
||||
initscr();
|
||||
raw();
|
||||
noecho();
|
||||
|
Reference in New Issue
Block a user