//config: help
//config: A text-mode VNC like program for Linux virtual terminals.
//config: example: conspy NUM shared access to console num
//config: help
//config: A text-mode VNC like program for Linux virtual terminals.
//config: example: conspy NUM shared access to console num
//usage:#define conspy_full_usage "\n\n"
//usage: "A text-mode VNC like program for Linux virtual consoles."
//usage: "\nTo exit, quickly press ESC 3 times."
//usage: "\n"
//usage:#define conspy_full_usage "\n\n"
//usage: "A text-mode VNC like program for Linux virtual consoles."
//usage: "\nTo exit, quickly press ESC 3 times."
//usage: "\n"
//usage: "\n -s Open a SHELL session"
//usage: "\n -n Black & white"
//usage: "\n -d Dump console to stdout"
//usage: "\n -f Follow cursor"
//usage: "\n -s Open a SHELL session"
//usage: "\n -n Black & white"
//usage: "\n -d Dump console to stdout"
//usage: "\n -f Follow cursor"
struct screen_info {
unsigned char lines, cols, cursor_x, cursor_y;
};
struct screen_info {
unsigned char lines, cols, cursor_x, cursor_y;
};
// remote console
struct screen_info remote;
// saved local tty terminfo
struct termios term_orig;
// remote console
struct screen_info remote;
// saved local tty terminfo
struct termios term_orig;
tcsetattr(G.kbd_fd, TCSANOW, &G.term_orig);
if (ENABLE_FEATURE_CLEAN_UP) {
close(G.kbd_fd);
}
// Reset attributes
if (!BW)
tcsetattr(G.kbd_fd, TCSANOW, &G.term_orig);
if (ENABLE_FEATURE_CLEAN_UP) {
close(G.kbd_fd);
}
// Reset attributes
if (!BW)
}
data = G.data + G.current;
xread(vcsa_fd, data, G.size);
}
data = G.data + G.current;
xread(vcsa_fd, data, G.size);
unsigned x = j - G.x; // if will catch j < G.x too
unsigned y = i - G.y; // if will catch i < G.y too
unsigned x = j - G.x; // if will catch j < G.x too
unsigned y = i - G.y; // if will catch i < G.y too
int conspy_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int conspy_main(int argc UNUSED_PARAM, char **argv)
{
int conspy_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int conspy_main(int argc UNUSED_PARAM, char **argv)
{
static const char getopt_longopts[] ALIGN1 =
"viewonly\0" No_argument "v"
"createdevice\0" No_argument "c"
static const char getopt_longopts[] ALIGN1 =
"viewonly\0" No_argument "v"
"createdevice\0" No_argument "c"
"session\0" No_argument "s"
"nocolors\0" No_argument "n"
"dump\0" No_argument "d"
"follow\0" No_argument "f"
"session\0" No_argument "s"
"nocolors\0" No_argument "n"
"dump\0" No_argument "d"
"follow\0" No_argument "f"
- opts = getopt32(argv, "vcsndfx:y:", &G.x, &G.y);
+ opts = getopt32(argv, "vcQsndfFx:y:", &G.x, &G.y);
- sprintf(tty_name, "%s%u", "/dev/tty", ttynum);
+ sprintf(tty_name, "%s%u", DEV_TTY, ttynum);
if (opts & FLAG(c)) {
if ((opts & (FLAG(s)|FLAG(v))) != FLAG(v))
create_cdev_if_doesnt_exist(tty_name, makedev(4, ttynum));
if (opts & FLAG(c)) {
if ((opts & (FLAG(s)|FLAG(v))) != FLAG(v))
create_cdev_if_doesnt_exist(tty_name, makedev(4, ttynum));
k = keybuf + G.key_count;
bytes_read = read(G.kbd_fd, k, sizeof(keybuf) - G.key_count);
if (bytes_read < 0)
k = keybuf + G.key_count;
bytes_read = read(G.kbd_fd, k, sizeof(keybuf) - G.key_count);
if (bytes_read < 0)
- for (i = 0; i < bytes_read; i++) {
- if (k[i] != '\033')
- G.escape_count = 0;
- else if (++G.escape_count >= 3)
- cleanup(0);
+ if (!(option_mask32 & FLAG(Q))) {
+ for (i = 0; i < bytes_read; i++) {
+ if (k[i] != '\033')
+ G.escape_count = -1;
+ if (++G.escape_count >= 3)
+ cleanup(EXIT_SUCCESS);
+ }
// Insert all keys pressed into the virtual console's input
// buffer. Don't do this if the virtual console is in scan
// code mode - giving ASCII characters to a program expecting
// scan codes will confuse it.
// Insert all keys pressed into the virtual console's input
// buffer. Don't do this if the virtual console is in scan
// code mode - giving ASCII characters to a program expecting
// scan codes will confuse it.
handle = xopen(tty_name, O_WRONLY);
result = ioctl(handle, KDGKBMODE, &kbd_mode);
if (result >= 0) {
char *p = keybuf;
handle = xopen(tty_name, O_WRONLY);
result = ioctl(handle, KDGKBMODE, &kbd_mode);
if (result >= 0) {
char *p = keybuf;