Fixed keyboard read on all bigendian machines
This commit is contained in:
parent
b1edb832c5
commit
d7d0e94918
@ -18,9 +18,11 @@ v0.71.1 28-Nov-2004
|
|||||||
During hangup we set sighup to ignore.
|
During hangup we set sighup to ignore.
|
||||||
Made zmodem-8k downloads work again.
|
Made zmodem-8k downloads work again.
|
||||||
Some small buffer protections added in addfile.
|
Some small buffer protections added in addfile.
|
||||||
|
Fixed keyboad input for all bigendian machines.
|
||||||
|
|
||||||
mbnewuser:
|
mbnewuser:
|
||||||
During hangup we set sighup to ignore.
|
During hangup we set sighup to ignore.
|
||||||
|
Fixed keyboad input for all bigendian machines.
|
||||||
|
|
||||||
mbfile:
|
mbfile:
|
||||||
The adopt command now first checks if the filename is 8.3 or a
|
The adopt command now first checks if the filename is 8.3 or a
|
||||||
|
@ -50,23 +50,16 @@ int Waitchar(unsigned char *ch, int wtime)
|
|||||||
|
|
||||||
for (i = 0; i < wtime; i++) {
|
for (i = 0; i < wtime; i++) {
|
||||||
rc = GETCHAR(0);
|
rc = GETCHAR(0);
|
||||||
// Syslog('t', "Waitchar(): after GETCHAR() tty_status = %d, rc = %d", tty_status, rc);
|
|
||||||
if (tty_status == STAT_SUCCESS) {
|
if (tty_status == STAT_SUCCESS) {
|
||||||
// Syslog('t', "Waitchar(): return %d", rc);
|
|
||||||
// #ifdef __NetBSD__
|
|
||||||
*ch = (unsigned char)rc;
|
*ch = (unsigned char)rc;
|
||||||
// #else
|
// memcpy(ch, &rc, sizeof(unsigned char)); /* doesn't work on bigendian machines */
|
||||||
// memcpy(ch, &rc, sizeof(unsigned char));
|
|
||||||
// #endif
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (tty_status != STAT_TIMEOUT) {
|
if (tty_status != STAT_TIMEOUT) {
|
||||||
// Syslog('t', "Waitchar(): error rc=%d", rc);
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
msleep(10);
|
msleep(10);
|
||||||
}
|
}
|
||||||
// Syslog('t', "Waitchar() timeout returns %d", rc);
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,7 +75,6 @@ int Escapechar(unsigned char *ch)
|
|||||||
* 50 mSec, the user really pressed <esc>.
|
* 50 mSec, the user really pressed <esc>.
|
||||||
*/
|
*/
|
||||||
if ((rc = Waitchar(ch, 5)) == TIMEOUT) {
|
if ((rc = Waitchar(ch, 5)) == TIMEOUT) {
|
||||||
// Syslog('t', "Escapechar() real escape");
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,9 +83,7 @@ int Escapechar(unsigned char *ch)
|
|||||||
* Start of CSI sequence. If nothing follows,
|
* Start of CSI sequence. If nothing follows,
|
||||||
* return immediatly.
|
* return immediatly.
|
||||||
*/
|
*/
|
||||||
// Syslog('t', "Escapechar() CSI intro");
|
|
||||||
if ((rc = Waitchar(ch, 5)) == TIMEOUT) {
|
if ((rc = Waitchar(ch, 5)) == TIMEOUT) {
|
||||||
// Syslog('t', "Escapechar() nothing follows");
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,7 +93,6 @@ int Escapechar(unsigned char *ch)
|
|||||||
* guaranteed to work with PC-clients.
|
* guaranteed to work with PC-clients.
|
||||||
*/
|
*/
|
||||||
c = *ch;
|
c = *ch;
|
||||||
// Syslog('t', "Escapechar() CSI input %d", c);
|
|
||||||
if (c == 'A')
|
if (c == 'A')
|
||||||
c = KEY_UP;
|
c = KEY_UP;
|
||||||
else if (c == 'B')
|
else if (c == 'B')
|
||||||
@ -129,12 +118,10 @@ int Escapechar(unsigned char *ch)
|
|||||||
Waitchar(ch, 5); /* Eat following ~ char */
|
Waitchar(ch, 5); /* Eat following ~ char */
|
||||||
c = KEY_PGDN;
|
c = KEY_PGDN;
|
||||||
} else if (c == '1') {
|
} else if (c == '1') {
|
||||||
// Syslog('t', "Possible function key");
|
|
||||||
if ((rc = Waitchar(ch, 5)) == TIMEOUT) {
|
if ((rc = Waitchar(ch, 5)) == TIMEOUT) {
|
||||||
c = KEY_HOME;
|
c = KEY_HOME;
|
||||||
} else {
|
} else {
|
||||||
c = *ch;
|
c = *ch;
|
||||||
// Syslog('t', "next %d %c", c, c);
|
|
||||||
Waitchar(ch, 5); /* Eat following ~ char */
|
Waitchar(ch, 5); /* Eat following ~ char */
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case '1' : c = KEY_F1; break;
|
case '1' : c = KEY_F1; break;
|
||||||
@ -148,11 +135,9 @@ int Escapechar(unsigned char *ch)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Syslog('t', "Escapechar() will return %d", c);
|
|
||||||
memcpy(ch, &c, sizeof(unsigned char));
|
memcpy(ch, &c, sizeof(unsigned char));
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
// Syslog('t', "Escapechar() not a CSI sequence");
|
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -171,32 +156,26 @@ unsigned char Readkey(void)
|
|||||||
unsigned char ch = 0;
|
unsigned char ch = 0;
|
||||||
int rc = TIMEOUT;
|
int rc = TIMEOUT;
|
||||||
|
|
||||||
// Syslog('t', "Readkey()");
|
|
||||||
while (rc == TIMEOUT) {
|
while (rc == TIMEOUT) {
|
||||||
rc = Waitchar(&ch, 5);
|
rc = Waitchar(&ch, 5);
|
||||||
// Syslog('t', "rc = %d, ch = %d", rc, ch);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If the character is not an Escape character,
|
* If the character is not an Escape character,
|
||||||
* then this function is finished.
|
* then this function is finished.
|
||||||
*/
|
*/
|
||||||
if ((rc == 1) && (ch != KEY_ESCAPE)) {
|
if ((rc == 1) && (ch != KEY_ESCAPE)) {
|
||||||
// Syslog('t', "Readkey() returns %d", ch);
|
|
||||||
return ch;
|
return ch;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((rc == 1) && (ch == KEY_ESCAPE)) {
|
if ((rc == 1) && (ch == KEY_ESCAPE)) {
|
||||||
rc = Escapechar(&ch);
|
rc = Escapechar(&ch);
|
||||||
if (rc == 1) {
|
if (rc == 1) {
|
||||||
// Syslog('t', "Readkey() escaped returns %d", ch);
|
|
||||||
return ch;
|
return ch;
|
||||||
} else {
|
} else {
|
||||||
// Syslog('t', "Readkey() escaped returns %d (real escape)", KEY_ESCAPE);
|
|
||||||
return KEY_ESCAPE;
|
return KEY_ESCAPE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Syslog('t', "Readkey() returns %d", rc);
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user