From 397bf67942f31da8c940224bcab19917f9158b3c Mon Sep 17 00:00:00 2001 From: Michael Krayer Date: Tue, 8 Apr 2025 16:40:19 +0200 Subject: [PATCH] Trying new setup with screen restore --- attach.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/attach.c b/attach.c index afa1640..5662b5d 100644 --- a/attach.c +++ b/attach.c @@ -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. */