From 419e5e2230850f1555d44e62417e8f606cb68e6e Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Thu, 22 Apr 2021 18:17:35 +0100 Subject: [PATCH] Move other backends into a subdirectory. This is the last of the subdirectory creations I had planned. This one is almost too footling to bother with (it hardly declutters the top level very much). One useful side effect is that I've included testback.c (containing the null and loopback backends) in the otherbackends library, which means it will now actually be _compiled_ even when nothing's using it, and we'll spot bit-rot promptly when internal APIs change. (And, to prove the point, I've immediately had to fix some bit-rot.) --- CMakeLists.txt | 2 +- otherbackends/CMakeLists.txt | 6 ++++++ raw.c => otherbackends/raw.c | 0 rlogin.c => otherbackends/rlogin.c | 0 supdup.c => otherbackends/supdup.c | 0 telnet.c => otherbackends/telnet.c | 0 testback.c => otherbackends/testback.c | 18 +++++++++--------- 7 files changed, 16 insertions(+), 10 deletions(-) create mode 100644 otherbackends/CMakeLists.txt rename raw.c => otherbackends/raw.c (100%) rename rlogin.c => otherbackends/rlogin.c (100%) rename supdup.c => otherbackends/supdup.c (100%) rename telnet.c => otherbackends/telnet.c (100%) rename testback.c => otherbackends/testback.c (94%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2a944fc7..4bf6eacd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,9 +51,9 @@ add_library(sftpclient STATIC add_subdirectory(ssh) add_library(otherbackends STATIC - telnet.c rlogin.c raw.c supdup.c $ $) +add_subdirectory(otherbackends) add_executable(testcrypt testcrypt.c sshpubk.c ssh/crc-attack-detector.c) diff --git a/otherbackends/CMakeLists.txt b/otherbackends/CMakeLists.txt new file mode 100644 index 00000000..099d1253 --- /dev/null +++ b/otherbackends/CMakeLists.txt @@ -0,0 +1,6 @@ +add_sources_from_current_dir(otherbackends + raw.c + rlogin.c + supdup.c + telnet.c + testback.c) diff --git a/raw.c b/otherbackends/raw.c similarity index 100% rename from raw.c rename to otherbackends/raw.c diff --git a/rlogin.c b/otherbackends/rlogin.c similarity index 100% rename from rlogin.c rename to otherbackends/rlogin.c diff --git a/supdup.c b/otherbackends/supdup.c similarity index 100% rename from supdup.c rename to otherbackends/supdup.c diff --git a/telnet.c b/otherbackends/telnet.c similarity index 100% rename from telnet.c rename to otherbackends/telnet.c diff --git a/testback.c b/otherbackends/testback.c similarity index 94% rename from testback.c rename to otherbackends/testback.c index 173786ed..8a158439 100644 --- a/testback.c +++ b/otherbackends/testback.c @@ -45,10 +45,10 @@ static size_t null_sendbuffer(Backend *); static void null_size(Backend *, int, int); static void null_special(Backend *, SessionSpecialCode, int); static const SessionSpecial *null_get_specials(Backend *); -static int null_connected(Backend *); +static bool null_connected(Backend *); static int null_exitcode(Backend *); -static int null_sendok(Backend *); -static int null_ldisc(Backend *, int); +static bool null_sendok(Backend *); +static bool null_ldisc(Backend *, int); static void null_provide_ldisc(Backend *, Ldisc *); static void null_unthrottle(Backend *, size_t); static int null_cfg_info(Backend *); @@ -172,9 +172,9 @@ static const SessionSpecial *null_get_specials (Backend *be) { return NULL; } -static int null_connected(Backend *be) { +static bool null_connected(Backend *be) { - return 0; + return false; } static int null_exitcode(Backend *be) { @@ -182,18 +182,18 @@ static int null_exitcode(Backend *be) { return 0; } -static int null_sendok(Backend *be) { +static bool null_sendok(Backend *be) { - return 1; + return true; } static void null_unthrottle(Backend *be, size_t backlog) { } -static int null_ldisc(Backend *be, int option) { +static bool null_ldisc(Backend *be, int option) { - return 0; + return false; } static void null_provide_ldisc (Backend *be, Ldisc *ldisc) {