minor tweaks

This commit is contained in:
Kelvin Sherlock 2018-05-10 17:25:43 -04:00
parent 77be11f696
commit 517dfd3ad6
2 changed files with 16 additions and 8 deletions

View File

@ -90,7 +90,7 @@ forkpty2(int *amaster, char *name, struct sgttyb *sg, struct winsize *winp) {
#pragma databank 1
static void sigchild(int sig, int x) {
PostEvent(0x8000,0);
PostEvent(app4Mask,0);
}
#pragma databank 0
@ -108,20 +108,27 @@ int main(int argc, char **argv) {
}
for(;;) {
static char buffer[1024];
int fio = 0;
ioctl(fd, FIONREAD, &fio);
if (fio > 256) fio = 256;
if (fio > sizeof(buffer)) fio = sizeof(buffer);
if (fio > 0) {
fio = read(fd, buffer, fio);
if (fio > 0) vt100_process(buffer, fio);
}
GetNextEvent(...);
GetNextEvent(everyEvent, &event);
if (event.what == keyDownEvt) {
if (fio <= 0) {
}
if (event.what == app4Mask) {
/* child signal received! */
union wait wt;
ok = waitpid(pid, &wt, WNOHANG);
if (ok <= 0)
if (ok <= 0) continue;
display_str("\r\nChild exited.\r\n");
break;
}
asm { cop 0x7f }
}

View File

@ -183,6 +183,7 @@ int main(int argc, char **argv) {
Handle shdHandle = NULL;
Word err;
int ok;
unsigned i;
iLoaded = iStarted = iConnected = false;
@ -196,7 +197,7 @@ int main(int argc, char **argv) {
// todo:keypad flag of some sort?
for (i = 1; i < argv; ++i) {
for (i = 1; i < argc; ++i) {
char *cp = argv[i];
if (cp[0] != '-') break;
if (strcmp(cp, "--vt52") == 0) {
@ -330,7 +331,7 @@ int main(int argc, char **argv) {
vt100_process(buffer, buffer_size);
}
GetNextEvent(keyDownMask | autoKeyMask, &event);
GetNextEvent(everyEvent, &event);
if (event.what == keyDownEvt) {
unsigned char key = event.message;
@ -394,7 +395,7 @@ _exit:
// flush q
while (GetNextEvent(keyDownMask | autoKeyMask, &event)) ;
FlushEvents(everyEvent, 0);
display_cstr("\n\rPress any key to exit.\n\r");
while (!GetNextEvent(keyDownMask | autoKeyMask, &event)) ;