work for the MacCvs integration

This commit is contained in:
aubonbeurre 2001-03-24 01:04:54 +00:00
parent 4a4a22a165
commit ff9290494f
5 changed files with 81 additions and 11 deletions

View File

@ -2,7 +2,11 @@ lsh_new
lsh_delete
lsh_yield
lsh_read
lsh_canread
lsh_write
lsh_canwrite
lsh_getprefsd
lsh_current
lsh_running
lsh_init
lsh_terminate

View File

@ -97,6 +97,11 @@ extern "C" void GUSIwithTTYSockets()
GUSIDeviceRegistry::Instance()->AddDevice(GUSITTYDevice::Instance());
}
extern "C" void GUSIwithoutTTYSockets()
{
GUSIDeviceRegistry::Instance()->RemoveDevice(GUSITTYDevice::Instance());
}
/*

View File

@ -61,6 +61,7 @@ extern char *applname;
extern char *defargstr;
extern void ssh2_init();
extern void ssh2_terminate();
extern void ssh2_sched();
extern void close_all_files();
@ -555,7 +556,7 @@ int InstallTTY(int id, void *ctx)
*/
void RemoveTTY(int fd, void *ctx)
{
#pragma unused (id, ctx)
#pragma unused (fd, ctx)
}
/*
@ -1236,6 +1237,19 @@ int lsh_read(lshctx *ctx, void *buffer, long inbytes)
}
int lsh_canread(lshctx *ctx)
{
lshcontext *context = (lshcontext *)ctx->context;
long outbytes = 0;
if ( context && context->_gConsoleOutBufLen )
{
outbytes = context->_gConsoleOutBufLen;
}
return outbytes;
}
/*
* lsh_write
*/
@ -1266,6 +1280,19 @@ long lsh_write(lshctx *ctx, const void *buffer, long inbytes)
return outbytes;
}
int lsh_canwrite(lshctx *ctx)
{
lshcontext *context = (lshcontext *)ctx->context;
long outbytes = 0;
if ( context && context->_gConsoleInBufLen )
{
outbytes = context->_gConsoleInBufLen;
}
return outbytes;
}
/*
* lsh_getprefsd
*/
@ -1305,6 +1332,16 @@ Boolean lsh_running(lshctx *ctx)
return ctx->pthread != NULL;
}
void lsh_init(void)
{
ssh2_init();
}
void lsh_terminate(void)
{
ssh2_terminate();
}
/*
* __lsh_initialize
*/

View File

@ -144,12 +144,20 @@ int lsh_read(lshctx *ctx, void *buffer, long inbytes);
long lsh_write(lshctx *ctx, const void *buffer, long inbytes);
int lsh_canread(lshctx *ctx);
int lsh_canwrite(lshctx *ctx);
char *lsh_getprefsd();
lshctx *lsh_current();
Boolean lsh_running(lshctx *ctx);
void lsh_init(void);
void lsh_terminate(void);
#ifdef __cplusplus
}
#endif

View File

@ -16,8 +16,10 @@ extern "C" {
#endif
void GUSIwithTTYSockets();
void GUSIwithoutTTYSockets();
void ssh2_init();
void ssh2_terminate();
void add_one_file(struct lshcontext *context, int fd);
void remove_one_file(struct lshcontext *context, int fd);
@ -27,8 +29,12 @@ void remove_one_file(struct lshcontext *context, int fd);
#endif
/*
GusiMSLWriteConsole sWriteConsole = 0L;
GusiMSLWriteConsole sInConsole = 0L;
* - This project is intended to work with MacCvs (http://www.cvsgui.org)
* - It exports the lsh program as a shared library, thanks to Jean-Pierre.
* - The lsh API is hooked up to the cvs shared library of cvs and provide
* the SSH2 authentication.
*
* Questions : alexandre parenteau (aubonbeurre@hotmail.com)
*/
static void myGusiMSLAddFile(int fd)
@ -51,9 +57,10 @@ static void myGusiMSLRemoveFile(int fd)
* ssh2_init
*/
static Boolean sGUSISetup = false;
void ssh2_init()
{
static Boolean sGUSISetup = false;
if ( !sGUSISetup ) {
@ -61,13 +68,22 @@ void ssh2_init()
GusiMSLSetAddFile(myGusiMSLAddFile);
GusiMSLSetRemoveFile(myGusiMSLRemoveFile);
/*
sWriteConsole = GusiMSLGetWriteConsole();
sInConsole = GusiMSLGetInConsole();
GusiMSLSetWriteConsole(WriteCharsToConsole);
GusiMSLSetInConsole(ReadCharsFromConsole);
*/
sGUSISetup = true;
}
}
void ssh2_terminate()
{
static Boolean sGUSISetup = false;
if ( sGUSISetup ) {
GUSIwithoutTTYSockets();
GusiMSLSetAddFile(0L);
GusiMSLSetRemoveFile(0L);
sGUSISetup = false;
}
}