various fixes

This commit is contained in:
Alexander S. Aganichev
2001-01-27 11:52:13 +00:00
parent f5ebff9c19
commit d288f34470
18 changed files with 135 additions and 87 deletions

View File

@@ -1171,8 +1171,6 @@ gkey kbxget_raw(int mode) {
WORD &VKC = inp.Event.KeyEvent.wVirtualKeyCode;
char &ascii = inp.Event.KeyEvent.uChar.AsciiChar;
// Get next key
inp.Event.KeyEvent.bKeyDown = false;
while(1) {
PeekConsoleInput(gkbd_hin, &inp, 1, &nread);

View File

@@ -87,8 +87,8 @@ char* strnp2c(char* str, int n);
char* strnp2cc(char* dest, const char* str, int n);
char* strp2c(char* str);
const char* strlword(const char* str);
const char* strrword(const char* str);
const char* strlword(const char* str, const char *separator=NULL);
const char* strrword(const char* str, const char *separator=NULL);
char* strrevname(char* reversedname, const char* name);
char* strunrevname(char* unreversedname, const char* name);

View File

@@ -487,7 +487,7 @@ char* strltrim(char* str) {
// ------------------------------------------------------------------
const char* strlword(const char* str) {
const char* strlword(const char* str, const char *separator) {
char buf[256];
static char left[40];
@@ -495,7 +495,7 @@ const char* strlword(const char* str) {
*left = NUL;
if(*str) {
strxcpy(buf, str, sizeof(buf));
if(strtok(buf, " ") != NULL) {
if(strtok(buf, (separator == NULL) ? " \t\n\r" : separator) != NULL) {
strxcpy(left, buf, sizeof(left));
}
}
@@ -505,7 +505,7 @@ const char* strlword(const char* str) {
// ------------------------------------------------------------------
const char* strrword(const char* str) {
const char* strrword(const char* str, const char *separator) {
char* ptr;
char* ptr2;
@@ -515,11 +515,14 @@ const char* strrword(const char* str) {
*right = NUL;
if(*str) {
strxcpy(buf, str, sizeof(buf));
ptr = strtok(buf, " ");
if(separator == NULL) {
separator = " \t\n\r";
}
ptr = strtok(buf, separator);
ptr2 = ptr;
while(ptr != NULL) {
ptr2 = ptr;
ptr = strtok(NULL, " ");
ptr = strtok(NULL, separator);
}
if(ptr2) {
strxcpy(right, ptr2, sizeof(right));