mirror of https://github.com/martanne/abduco
Added silent reconnect feature
This commit is contained in:
parent
8c32909a15
commit
135583c073
3
abduco.1
3
abduco.1
|
|
@ -115,6 +115,9 @@ options.
|
|||
Be quiet, do not print informative messages.
|
||||
.It Fl r
|
||||
Read-only session, user input is ignored.
|
||||
.IT F1 s
|
||||
Silently Attach/Detach without switching to/from alternate buffer. Useful for automatically reconnecting
|
||||
persistent SSH connections that don't want to alter terminal state when reconnecting.
|
||||
.It Fl v
|
||||
Print version information and exit.
|
||||
.El
|
||||
|
|
|
|||
6
abduco.c
6
abduco.c
|
|
@ -98,6 +98,7 @@ struct Client {
|
|||
enum {
|
||||
CLIENT_READONLY = 1 << 0,
|
||||
CLIENT_LOWPRIORITY = 1 << 1,
|
||||
CLIENT_NOALTBUF = 1 << 1,
|
||||
} flags;
|
||||
Client *next;
|
||||
};
|
||||
|
|
@ -223,7 +224,7 @@ static void die(const char *s) {
|
|||
}
|
||||
|
||||
static void usage(void) {
|
||||
fprintf(stderr, "usage: abduco [-a|-A|-c|-n] [-p] [-r] [-q] [-l] [-f] [-e detachkey] name command\n");
|
||||
fprintf(stderr, "usage: abduco [-a|-A|-c|-n] [-p] [-r] [-q] [-l] [-f] [-s] [-e detachkey] name command\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
|
@ -633,6 +634,9 @@ int main(int argc, char *argv[]) {
|
|||
case 'r':
|
||||
client.flags |= CLIENT_READONLY;
|
||||
break;
|
||||
case 's':
|
||||
client.flags |= CLIENT_NOALTBUF;
|
||||
break;
|
||||
case 'l':
|
||||
client.flags |= CLIENT_LOWPRIORITY;
|
||||
break;
|
||||
|
|
|
|||
4
client.c
4
client.c
|
|
@ -25,7 +25,7 @@ static void client_restore_terminal(void) {
|
|||
if (!has_term)
|
||||
return;
|
||||
tcsetattr(STDIN_FILENO, TCSAFLUSH, &orig_term);
|
||||
if (alternate_buffer) {
|
||||
if (!(client.flags & CLIENT_NOALTBUF) && alternate_buffer) {
|
||||
printf("\033[?25h\033[?1049l");
|
||||
fflush(stdout);
|
||||
alternate_buffer = false;
|
||||
|
|
@ -48,7 +48,7 @@ static void client_setup_terminal(void) {
|
|||
cur_term.c_cc[VTIME] = 0;
|
||||
tcsetattr(STDIN_FILENO, TCSANOW, &cur_term);
|
||||
|
||||
if (!alternate_buffer) {
|
||||
if (!(client.flags & CLIENT_NOALTBUF) && !alternate_buffer) {
|
||||
printf("\033[?1049h\033[H");
|
||||
fflush(stdout);
|
||||
alternate_buffer = true;
|
||||
|
|
|
|||
Loading…
Reference in New Issue