From 54e7f590e3004d522742758c9187d35dd3fae722 Mon Sep 17 00:00:00 2001 From: chombier <> Date: Thu, 22 Mar 2001 10:23:07 +0000 Subject: [PATCH] fixed broken keygen --- macssh/source/ssh/GUSIPatch1.cp | 39 +++++++++++++++++++++++++++++++ macssh/source/ssh/console.stubs.c | 10 ++++---- 2 files changed, 45 insertions(+), 4 deletions(-) diff --git a/macssh/source/ssh/GUSIPatch1.cp b/macssh/source/ssh/GUSIPatch1.cp index 479afde..cd1390a 100755 --- a/macssh/source/ssh/GUSIPatch1.cp +++ b/macssh/source/ssh/GUSIPatch1.cp @@ -25,6 +25,8 @@ #include "netevent.proto.h" #include "network.proto.h" +#include "GUSITTY.h" + #include #include #include @@ -171,6 +173,43 @@ GUSISIOUXSocket::GUSISIOUXSocket() } */ +/* + * default GUSISIOUXSocket::select checks for keyDown or + * autoKey events from MacOS's EventQueue. + * we use an internal buffer. + */ + +class GUSISIOUXSocket : public GUSISocket { +public: + ~GUSISIOUXSocket(); + + ssize_t read(const GUSIScatterer & buffer); + ssize_t write(const GUSIGatherer & buffer); + virtual int ioctl(unsigned int request, va_list arg); + virtual int fstat(struct stat * buf); + virtual int isatty(); + bool select(bool * canRead, bool * canWrite, bool *); + + static GUSISIOUXSocket * Instance(); +private: + static GUSISIOUXSocket * sInstance; + + GUSISIOUXSocket(); +}; + +bool GUSISIOUXSocket::select(bool * canRead, bool * canWrite, bool *) +{ + bool cond = false; + + if (canRead) { + if (*canRead = (AvailableFromTTY(0, (lshcontext *)pthread_getspecific(ssh2threadkey)))) + cond = true; + } + if (canWrite) + cond = *canWrite = true; + return cond; +} + /* * default GUSIProcess::Yield has 20 ticks to remain in same state * we use 0. diff --git a/macssh/source/ssh/console.stubs.c b/macssh/source/ssh/console.stubs.c index b17e6cc..ef47b5f 100755 --- a/macssh/source/ssh/console.stubs.c +++ b/macssh/source/ssh/console.stubs.c @@ -94,8 +94,9 @@ long WriteCharsToConsole(char *buffer, long n) /* since we redirect stdin/out/err to our 'sockets' * this shouldn't occur ! (or lsh calls printf ? (; ) */ - DebugStr("\pWriteCharsToConsole"); - return n; +// DebugStr("\pWriteCharsToConsole"); +// return n; + return WriteCharsToTTY(1, pthread_getspecific(ssh2threadkey), buffer, n); } /* @@ -116,8 +117,9 @@ long ReadCharsFromConsole(char *buffer, long n) /* since we redirect stdin/out/err to our 'sockets' * this shouldn't occur ! (or lsh calls printf ? (; ) */ - DebugStr("\pReadCharsFromConsole"); - return 0; +// DebugStr("\pReadCharsFromConsole"); +// return 0; + return ReadCharsFromTTY(0, pthread_getspecific(ssh2threadkey), buffer, n); } /*