Trying new setup with screen restore

This commit is contained in:
Michael Krayer 2025-04-08 16:40:19 +02:00
parent c57ce145ea
commit 397bf67942
1 changed files with 10 additions and 10 deletions

View File

@ -40,7 +40,8 @@ restore_term(void)
tcsetattr(0, TCSADRAIN, &orig_term);
/* Make cursor visible. Assumes VT100. */
printf("\033[?25h\033[?1049l");
printf("\033[?1049l");
printf("\033[0 q");
fflush(stdout);
}
@ -88,9 +89,9 @@ die(int sig)
{
/* Print a nice pretty message for some things. */
if (sig == SIGHUP || sig == SIGINT)
printf(EOS "\r\n[detached]\r\n");
printf("[detached]\r\n");
else
printf(EOS "\r\n[got signal %d - dying]\r\n", sig);
printf("[got signal %d - dying]\r\n", sig);
exit(1);
}
@ -115,7 +116,6 @@ process_kbd(int s, struct packet *pkt)
/* And suspend... */
tcsetattr(0, TCSADRAIN, &orig_term);
printf(EOS "\r\n");
kill(getpid(), SIGTSTP);
tcsetattr(0, TCSADRAIN, &cur_term);
@ -133,7 +133,7 @@ process_kbd(int s, struct packet *pkt)
/* Detach char? */
else if (pkt->u.buf[0] == detach_char)
{
printf(EOS "\r\n[detached]\r\n");
printf("[detached]\r\n");
exit(0);
}
/* Just in case something pukes out. */
@ -214,9 +214,9 @@ attach_main(int noerror)
tcsetattr(0, TCSADRAIN, &cur_term);
/* Clear the screen. This assumes VT100. */
printf("\033[?1049h\033[H");
printf("\033[?1049h");
fflush(stdout);
/* write(1, "\33[H\33[J", 6); */
write(1, "\33[H\33[J", 6);
/* Tell the master that we want to attach. */
memset(&pkt, 0, sizeof(struct packet));
@ -240,7 +240,7 @@ attach_main(int noerror)
n = select(s + 1, &readfds, NULL, NULL, NULL);
if (n < 0 && errno != EINTR && errno != EAGAIN)
{
printf(EOS "[select failed]\r\n");
printf("[select failed]\r\n");
exit(1);
}
@ -251,12 +251,12 @@ attach_main(int noerror)
if (len == 0)
{
printf(EOS "[EOF - dtach terminating]\r\n");
printf("[EOF - dtach terminating]\r\n");
exit(0);
}
else if (len < 0)
{
printf(EOS "[read returned an error]\r\n");
printf("[read returned an error]\r\n");
exit(1);
}
/* Send the data to the terminal. */