From Sir Raorn: ~ dir expansion and fix in keyboard code for linux

This commit is contained in:
Jacobo Tarrío 2000-08-07 19:49:56 +00:00
parent 9a2386a823
commit 009d791042
3 changed files with 35 additions and 5 deletions

View File

@ -7,6 +7,16 @@ ______________________________________________________________________
--- === *** === ---
______________________________________________________________________
Notes for GoldED+ 1.1.4.6, August 7 2000
______________________________________________________________________
+ GoldEd+ now recognizes the asciitilde (~) alias for the home
directory, in Linux.
- Fixed small bug in console shiftstate code under Linux.
______________________________________________________________________
Notes for GoldED+ 1.1.4.5, June 18 2000

View File

@ -43,6 +43,10 @@
#include <dos.h>
#endif
#if defined(__UNIX__)
#include <pwd.h>
#include <sys/types.h>
#endif
// ------------------------------------------------------------------
@ -217,8 +221,16 @@ 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))
strcpy(pathname, tmpname);
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);
}
else {
strcpy(newpath, tmppath);
if(*newpath)
@ -296,8 +308,15 @@ void TouchFile(const char* filename) {
// ------------------------------------------------------------------
char* PathCopy(char* __dst, const char* __src) {
return AddBackslash(strxcpy(__dst, __src, sizeof(Path)));
#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)));
}

View File

@ -57,6 +57,7 @@
#if defined(__linux__)
#include <sys/ioctl.h>
#include <stdio.h>
#endif
@ -1303,7 +1304,7 @@ gkey kbxget_raw(int mode) {
if(ioctl(fileno(stdin), TIOCLINUX, &shifts) == -1)
shifts = 0;
if(shifts & ALT)
key = Key_A_BS;
k = Key_A_BS;
}
#endif