From ad6987e1b102611528ee139cd4b07b2f06866e06 Mon Sep 17 00:00:00 2001 From: Lars Brinkhoff Date: Tue, 18 Feb 2020 15:16:26 +0100 Subject: [PATCH] New backend flag for needing a terminal. --- putty.h | 1 + unix/uxplink.c | 6 ++++++ windows/winplink.c | 6 ++++++ 3 files changed, 13 insertions(+) diff --git a/putty.h b/putty.h index abfb060f..298ad775 100644 --- a/putty.h +++ b/putty.h @@ -482,6 +482,7 @@ enum { /* Backend flags */ #define BACKEND_RESIZE_FORBIDDEN 0x01 /* Backend does not allow resizing terminal */ +#define BACKEND_NEEDS_TERMINAL 0x02 /* Backend must have terminal */ struct Backend { const BackendVtable *vt; diff --git a/unix/uxplink.c b/unix/uxplink.c index 473a0c4b..57b84af8 100644 --- a/unix/uxplink.c +++ b/unix/uxplink.c @@ -820,6 +820,12 @@ int main(int argc, char **argv) return 1; } + if (backvt->flags & BACKEND_NEEDS_TERMINAL) { + fprintf(stderr, + "Plink must have a terminal to run.\n"); + return 1; + } + /* * Block SIGPIPE, so that we'll get EPIPE individually on * particular network connections that go wrong. diff --git a/windows/winplink.c b/windows/winplink.c index 304e4873..45a34688 100644 --- a/windows/winplink.c +++ b/windows/winplink.c @@ -393,6 +393,12 @@ int main(int argc, char **argv) return 1; } + if (vt->flags & BACKEND_NEEDS_TERMINAL) { + fprintf(stderr, + "Plink must have a terminal to run.\n"); + return 1; + } + sk_init(); if (p_WSAEventSelect == NULL) { fprintf(stderr, "Plink requires WinSock 2\n");