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