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 Notes for GoldED+ 1.1.4.5, June 18 2000

View File

@ -43,6 +43,10 @@
#include <dos.h> #include <dos.h>
#endif #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); strbtrim(tmppath);
strchg(tmppath, GOLD_WRONG_SLASH_CHR, GOLD_SLASH_CHR); strchg(tmppath, GOLD_WRONG_SLASH_CHR, GOLD_SLASH_CHR);
strchg(tmpname, GOLD_WRONG_SLASH_CHR, GOLD_SLASH_CHR); strchg(tmpname, GOLD_WRONG_SLASH_CHR, GOLD_SLASH_CHR);
if(strpbrk(tmpname, GOLD_SLASH_STR)) 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); strcpy(pathname, tmpname);
}
else { else {
strcpy(newpath, tmppath); strcpy(newpath, tmppath);
if(*newpath) if(*newpath)
@ -296,7 +308,14 @@ void TouchFile(const char* filename) {
// ------------------------------------------------------------------ // ------------------------------------------------------------------
char* PathCopy(char* __dst, const char* __src) { 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))); return AddBackslash(strxcpy(__dst, __src, sizeof(Path)));
} }

View File

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