mirror of https://github.com/macssh/macssh.git
cleanup
This commit is contained in:
parent
a099985d66
commit
4d0d1cf896
|
@ -32,8 +32,8 @@ typedef struct MemPool {
|
|||
long f_PoolSize;
|
||||
Handle f_HandleRec;
|
||||
Handle f_HandleMem;
|
||||
char *next;
|
||||
char *prev;
|
||||
struct MemPool *next;
|
||||
struct MemPool *prev;
|
||||
#if GETSTATS
|
||||
long f_CurrSize;
|
||||
long f_PeakSize;
|
||||
|
|
|
@ -329,16 +329,28 @@ char * strsignal(int signo)
|
|||
return 0L;
|
||||
}
|
||||
|
||||
/*
|
||||
* get_context_listener
|
||||
*/
|
||||
|
||||
int get_context_listener()
|
||||
{
|
||||
lshcontext *context = (lshcontext *)pthread_getspecific(ssh2threadkey);
|
||||
if ( context ) {
|
||||
return context->_listener;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* setexitbuf
|
||||
* getexitbuf
|
||||
*/
|
||||
|
||||
void setexitbuf(jmp_buf *exitbuf)
|
||||
{
|
||||
lshcontext *context = (lshcontext *)pthread_getspecific(ssh2threadkey);
|
||||
|
||||
if ( context ) {
|
||||
if ( context && context->_self == context ) {
|
||||
context->_pexitbuf = exitbuf;
|
||||
}
|
||||
}
|
||||
|
@ -351,7 +363,7 @@ jmp_buf *getexitbuf()
|
|||
{
|
||||
lshcontext *context = (lshcontext *)pthread_getspecific(ssh2threadkey);
|
||||
|
||||
if ( context ) {
|
||||
if ( context && context->_self == context ) {
|
||||
return context->_pexitbuf;
|
||||
}
|
||||
return NULL;
|
||||
|
@ -372,7 +384,6 @@ void exit(int result UNUSED)
|
|||
Debugger();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* abort
|
||||
*/
|
||||
|
@ -430,7 +441,13 @@ void *lshcalloc(unsigned long items, unsigned long size)
|
|||
{
|
||||
lshcontext *context = pthread_getspecific(ssh2threadkey);
|
||||
if ( context && context->_gMemPool ) {
|
||||
return MPmalloc(context->_gMemPool, items * size);
|
||||
size_t tsize;
|
||||
void *p;
|
||||
tsize = items * size;
|
||||
p = MPmalloc( context->_gMemPool, tsize );
|
||||
if ( p ) {
|
||||
memset(p, '\0', tsize);
|
||||
}
|
||||
} else {
|
||||
return calloc(items, size);
|
||||
}
|
||||
|
@ -838,19 +855,6 @@ void ssh2_doevent(long sleepTime)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* get_context_listener
|
||||
*/
|
||||
|
||||
int get_context_listener()
|
||||
{
|
||||
lshcontext *context = (lshcontext *)pthread_getspecific(ssh2threadkey);
|
||||
if ( context ) {
|
||||
return context->_listener;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
|
||||
|
@ -968,6 +972,7 @@ void lsh_sighandler(int sig)
|
|||
void *lsh_thread(lshctx *ctx)
|
||||
{
|
||||
lshcontext *context;
|
||||
jmp_buf exitbuf;
|
||||
OSErr err;
|
||||
char *tabargv[64];
|
||||
int argc;
|
||||
|
@ -1027,6 +1032,7 @@ void *lsh_thread(lshctx *ctx)
|
|||
context->_window_changed = 0;
|
||||
context->_kpassword[0] = 0;
|
||||
context->_kindex = 0;
|
||||
context->_self = context;
|
||||
|
||||
ctx->context = context;
|
||||
|
||||
|
@ -1034,8 +1040,8 @@ void *lsh_thread(lshctx *ctx)
|
|||
|
||||
make_env( context );
|
||||
|
||||
context->_pexitbuf = &context->_exitbuf;
|
||||
if ( !setjmp(context->_exitbuf) ) {
|
||||
context->_pexitbuf = &exitbuf;
|
||||
if ( !setjmp(exitbuf) ) {
|
||||
/* we need to intercept SIGINT to fake 'exit' */
|
||||
struct sigaction interrupt;
|
||||
memset(&interrupt, 0, sizeof(interrupt));
|
||||
|
|
|
@ -273,21 +273,63 @@ char * strsignal(int signo)
|
|||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* get_context_listener
|
||||
*/
|
||||
|
||||
int get_context_listener()
|
||||
{
|
||||
lshcontext *context = (lshcontext *)pthread_getspecific(ssh2threadkey);
|
||||
if ( context ) {
|
||||
return context->_listener;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* getexitbuf
|
||||
*/
|
||||
|
||||
void setexitbuf(jmp_buf *exitbuf)
|
||||
{
|
||||
lshcontext *context = (lshcontext *)pthread_getspecific(ssh2threadkey);
|
||||
|
||||
if ( context && context->_self == context ) {
|
||||
context->_pexitbuf = exitbuf;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* getexitbuf
|
||||
*/
|
||||
|
||||
jmp_buf *getexitbuf()
|
||||
{
|
||||
lshcontext *context = (lshcontext *)pthread_getspecific(ssh2threadkey);
|
||||
|
||||
if ( context && context->_self == context ) {
|
||||
return context->_pexitbuf;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* exit
|
||||
*/
|
||||
|
||||
void exit(int result UNUSED)
|
||||
{
|
||||
lshcontext *context = pthread_getspecific(ssh2threadkey);
|
||||
extern Boolean SIOUXQuitting;
|
||||
jmp_buf *exitbuf;
|
||||
|
||||
fflush(stdout);
|
||||
trace("*** exit ***\n");
|
||||
fflush(stdout);
|
||||
|
||||
if ( !SIOUXQuitting && context )
|
||||
longjmp( context->_exitbuf, 0 );
|
||||
if ( !SIOUXQuitting && (exitbuf = getexitbuf()) != NULL ) {
|
||||
longjmp( *exitbuf, 1 );
|
||||
}
|
||||
ExitToShell();
|
||||
}
|
||||
|
||||
|
@ -356,7 +398,14 @@ void *lshcalloc(unsigned long items, unsigned long size)
|
|||
{
|
||||
lshcontext *context = pthread_getspecific(ssh2threadkey);
|
||||
if ( context && context->_gMemPool ) {
|
||||
return MPmalloc(context->_gMemPool, items * size);
|
||||
size_t tsize;
|
||||
void *p;
|
||||
assert(context->_self == context);
|
||||
tsize = items * size;
|
||||
p = MPmalloc( context->_gMemPool, tsize );
|
||||
if ( p ) {
|
||||
memset(p, '\0', tsize);
|
||||
}
|
||||
} else {
|
||||
return calloc(items, size);
|
||||
}
|
||||
|
@ -706,13 +755,14 @@ void make_args( char *argstr, int *argc, char ***argv )
|
|||
|
||||
static void run_app()
|
||||
{
|
||||
lshcontext *context;
|
||||
lshcontext *context;
|
||||
jmp_buf exitbuf;
|
||||
extern Boolean SIOUXQuitting;
|
||||
char moreargs[1024];
|
||||
char *pmoreargs;
|
||||
int argc;
|
||||
char **argv;
|
||||
OSErr err;
|
||||
char moreargs[1024];
|
||||
char *pmoreargs;
|
||||
int argc;
|
||||
char **argv;
|
||||
OSErr err;
|
||||
|
||||
context = (lshcontext *)NewPtr(sizeof(lshcontext));
|
||||
if (context == NULL) {
|
||||
|
@ -734,9 +784,12 @@ static void run_app()
|
|||
}
|
||||
|
||||
context->_port = -1;
|
||||
context->_userdata = NULL;
|
||||
context->_thread = pthread_self();
|
||||
context->_forward = 0;
|
||||
context->_localport = 0;
|
||||
context->_listener = -1;
|
||||
context->_socket = -1;
|
||||
//context->_exitbuf = 0;
|
||||
//context->_gMemPool = NULL;
|
||||
memset(context->_filesTable, 0xff, sizeof(context->_filesTable));
|
||||
|
@ -744,6 +797,7 @@ static void run_app()
|
|||
context->_gConsoleInEOF = 0;
|
||||
context->_convertLFs = 1;
|
||||
context->_lastCR = 0;
|
||||
context->_insock = NULL;
|
||||
context->_gConsoleInBufLen = 0;
|
||||
context->_gConsoleInBufMax = CONSOLEBUFSIZE;
|
||||
context->_gConsoleOutBufLen = 0;
|
||||
|
@ -762,8 +816,12 @@ static void run_app()
|
|||
context->_verbosing = 0;
|
||||
context->_debugging = 0;
|
||||
context->_window_changed = 0;
|
||||
context->_kpassword[0] = 0;
|
||||
context->_kindex = 0;
|
||||
context->_self = context;
|
||||
|
||||
if (!setjmp(context->_exitbuf)) {
|
||||
context->_pexitbuf = &exitbuf;
|
||||
if (!setjmp(&exitbuf)) {
|
||||
|
||||
printf("\n\nlsh shell application\nargs (--help for info): ");
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ struct RSdata {
|
|||
bfsiz, // RAB BetterTelnet 1.0fc9 - bold font size
|
||||
bfstyle, // RAB BetterTelnet 1.0fc9 - bold font style
|
||||
realbold, // RAB BetterTelnet 1.2 - use bold font for bold
|
||||
boldislarger;// to use real bold
|
||||
boldislarger; // to use real bold
|
||||
Boolean
|
||||
skip; /* TRUE if we are skipping the output */
|
||||
Boolean
|
||||
|
|
|
@ -271,7 +271,7 @@ void VSIclrbuf
|
|||
{
|
||||
register short j, i;
|
||||
register char *tx;
|
||||
register unsigned short *ta;
|
||||
register VSAttrib *ta;
|
||||
for (i = 0; i <= VSIw->lines; i++)
|
||||
{
|
||||
if (VSIw->oldScrollback)
|
||||
|
@ -411,7 +411,7 @@ short VSnewscreen
|
|||
return(-2);
|
||||
}
|
||||
VSIw->linest[0] = VSIw->buftop;
|
||||
VSIw->attrst[0] = (VSattrlinePtr)VSOnewlines(VSIw->lines + 1,2); /* new space for attributes (these are never scrolled back) */
|
||||
VSIw->attrst[0] = (VSattrlinePtr)VSOnewlines(VSIw->lines + 1,sizeof(VSAttrib)); /* new space for attributes (these are never scrolled back) */
|
||||
if (VSIw->attrst[0] == NULL)
|
||||
{
|
||||
VSIfreelinelist(VSIw->buftop);
|
||||
|
@ -529,9 +529,9 @@ void VSrealloc(short w)
|
|||
savedTextPtr = savedTextBlock;
|
||||
for (i = 0; i <= VSIw->lines; i++) {
|
||||
if (VSIw->oldScrollback)
|
||||
BlockMoveData(VSIw->attrst[i]->text, savedTextPtr->attr, (VSIw->allwidth + 1) * 2);
|
||||
BlockMoveData(VSIw->attrst[i]->text, savedTextPtr->attr, (VSIw->allwidth + 1) * sizeof(VSAttrib));
|
||||
else
|
||||
BlockMoveData(VSIw->linest[i]->attr, savedTextPtr->attr, (VSIw->allwidth + 1) * 2);
|
||||
BlockMoveData(VSIw->linest[i]->attr, savedTextPtr->attr, (VSIw->allwidth + 1) * sizeof(VSAttrib));
|
||||
if (savedTextPtr->next) savedTextPtr = savedTextPtr->next;
|
||||
}
|
||||
|
||||
|
@ -646,8 +646,8 @@ short VSredraw
|
|||
|
||||
for (y=ty1; y<=ty2; y++) {
|
||||
char *pt;
|
||||
unsigned short *pa;
|
||||
unsigned short lasta;
|
||||
VSAttrib *pa;
|
||||
VSAttrib lasta;
|
||||
short x, lastx;
|
||||
|
||||
pt = ypt->text + VSIw->Rleft;
|
||||
|
@ -686,8 +686,8 @@ short VSredraw
|
|||
|
||||
for (y=ty1; y<=ty2; y++) {
|
||||
char *pt;
|
||||
unsigned short *pa;
|
||||
unsigned short lasta;
|
||||
VSAttrib *pa;
|
||||
VSAttrib lasta;
|
||||
short x, lastx;
|
||||
|
||||
pt = ypt->text + VSIw->Rleft;
|
||||
|
@ -795,8 +795,8 @@ short VSOredraw
|
|||
|
||||
for (y=ty1; y<=ty2; y++) {
|
||||
char *pt;
|
||||
unsigned short *pa;
|
||||
unsigned short lasta;
|
||||
VSAttrib *pa;
|
||||
VSAttrib lasta;
|
||||
short x, lastx;
|
||||
|
||||
pt = ypt->text + VSIw->Rleft;
|
||||
|
@ -1707,7 +1707,7 @@ short VSsetlines
|
|||
VSlinePtr line; /* pointer to a line */
|
||||
short i, j, oldlines;
|
||||
char *temp;
|
||||
unsigned short *tempa;
|
||||
VSAttrib *tempa;
|
||||
|
||||
if (VSvalids(w) != 0)
|
||||
return(-3000);
|
||||
|
@ -1845,7 +1845,7 @@ short VSOsetlines
|
|||
VSlinePtr line; /* pointer to a line */
|
||||
short i, j, oldlines;
|
||||
char *temp;
|
||||
unsigned short *tempa;
|
||||
VSAttrib *tempa;
|
||||
|
||||
if (VSvalids(w) != 0)
|
||||
return(-3000);
|
||||
|
@ -1884,7 +1884,7 @@ short VSOsetlines
|
|||
|
||||
|
||||
VSIw->linest[0] = VSOnewlines(lines + 1,1); /* allocate new text and attribute lines */
|
||||
VSIw->attrst[0] = (VSattrlinePtr)VSOnewlines(lines + 1,2);
|
||||
VSIw->attrst[0] = (VSattrlinePtr)VSOnewlines(lines + 1,sizeof(VSAttrib));
|
||||
if (VSIw->linest[0] && VSIw->attrst[0])
|
||||
{ /* mem is there */
|
||||
|
||||
|
@ -1922,7 +1922,7 @@ short VSOsetlines
|
|||
VSIfreelinelist((VSlinePtr)attrst[0]); /* release current visible attrib */
|
||||
DisposePtr((Ptr) attrst);
|
||||
VSIw->linest[0] = VSOnewlines(lines + 1,1); /* allocate new screen arrays */
|
||||
VSIw->attrst[0] = (VSattrlinePtr)VSOnewlines(lines + 1,2);
|
||||
VSIw->attrst[0] = (VSattrlinePtr)VSOnewlines(lines + 1,sizeof(VSAttrib));
|
||||
if (!VSIw->linest[0] || !VSIw->attrst[0])
|
||||
{ /* still not enough memory; Try to allocate just enough to go back to original size */
|
||||
|
||||
|
@ -1932,7 +1932,7 @@ short VSOsetlines
|
|||
VSIfreelinelist((VSlinePtr)VSIw->attrst[0]);
|
||||
|
||||
VSIw->linest[0] = VSOnewlines(oldlines + 1,1); /* try original size */
|
||||
VSIw->attrst[0] = (VSattrlinePtr)VSOnewlines(oldlines + 1,2);
|
||||
VSIw->attrst[0] = (VSattrlinePtr)VSOnewlines(oldlines + 1,sizeof(VSAttrib));
|
||||
|
||||
if (!VSIw->linest[0] || !VSIw->attrst[0])
|
||||
/* damage control: */
|
||||
|
@ -2099,8 +2099,8 @@ short VSPulseOne
|
|||
|
||||
for (y=ty1; y<=ty2; y++) {
|
||||
char *pt;
|
||||
unsigned short *pa;
|
||||
unsigned short lasta;
|
||||
VSAttrib *pa;
|
||||
VSAttrib lasta;
|
||||
short x, lastx;
|
||||
|
||||
pt = ypt->text + VSIw->Rleft;
|
||||
|
@ -2109,7 +2109,7 @@ short VSPulseOne
|
|||
lastx = tx1;
|
||||
lasta = pa[tx1];
|
||||
for(x=tx1+1; x<=tx2; x++) {
|
||||
if (pa[x]!=lasta && VSisblnk(lasta)) { // Ahah! [DJ]
|
||||
if (pa[x]!=lasta && (VSisblnk(lasta) || VSisfastblnk(lasta))) { // Ahah! [DJ]
|
||||
if (!cursOff) {
|
||||
// temporarily hide cursor
|
||||
cursOff = 1;
|
||||
|
@ -2121,7 +2121,7 @@ short VSPulseOne
|
|||
lasta = pa[x];
|
||||
}
|
||||
}
|
||||
if (lastx<=tx2 && VSisblnk(lasta)) { // Ditto [DJ]
|
||||
if (lastx<=tx2 && (VSisblnk(lasta) || VSisfastblnk(lasta))) { // Ditto [DJ]
|
||||
if (!cursOff) {
|
||||
// temporarily hide cursor
|
||||
cursOff = 1;
|
||||
|
@ -2228,8 +2228,8 @@ short VSOPulseOne
|
|||
|
||||
for (y=ty1; y<=ty2; y++) {
|
||||
char *pt;
|
||||
unsigned short *pa;
|
||||
unsigned short lasta;
|
||||
VSAttrib *pa;
|
||||
VSAttrib lasta;
|
||||
short x, lastx;
|
||||
|
||||
pt = ypt->text + VSIw->Rleft;
|
||||
|
@ -2238,7 +2238,7 @@ short VSOPulseOne
|
|||
lastx = tx1;
|
||||
lasta = pa[tx1];
|
||||
for(x=tx1+1; x<=tx2; x++) {
|
||||
if (pa[x]!=lasta && VSisblnk(lasta)) { // Ahah! [DJ]
|
||||
if (pa[x]!=lasta && (VSisblnk(lasta) || VSisfastblnk(lasta))) { // Ahah! [DJ]
|
||||
if (!cursOff) {
|
||||
// temporarily hide cursor
|
||||
cursOff = 1;
|
||||
|
@ -2250,7 +2250,7 @@ short VSOPulseOne
|
|||
lasta = pa[x];
|
||||
}
|
||||
}
|
||||
if (lastx<=tx2 && VSisblnk(lasta)) { // Ditto [DJ]
|
||||
if (lastx<=tx2 && (VSisblnk(lasta) || VSisfastblnk(lasta))) { // Ditto [DJ]
|
||||
if (!cursOff) {
|
||||
// temporarily hide cursor
|
||||
cursOff = 1;
|
||||
|
|
|
@ -271,7 +271,7 @@ VSlinePtr VSInewlines
|
|||
void* memoryPtr;
|
||||
VSlinePtr linePtr;
|
||||
char* textPtr;
|
||||
unsigned short* attrPtr;
|
||||
VSAttrib* attrPtr;
|
||||
long width;
|
||||
long i;
|
||||
|
||||
|
@ -284,14 +284,14 @@ VSlinePtr VSInewlines
|
|||
BCS 970726
|
||||
*/
|
||||
width = VSIw->allwidth + 1;
|
||||
memoryPtr = myNewPtrCritical(nlines * (sizeof(VSline) + (width * 3)));
|
||||
memoryPtr = myNewPtrCritical(nlines * (sizeof(VSline) + (width * (1 + sizeof(VSAttrib)))));
|
||||
if(memoryPtr == NULL)
|
||||
return (VSlinePtr)NULL;
|
||||
|
||||
// Chop the memory up into its 3 chunks.
|
||||
linePtr = (VSlinePtr)memoryPtr;
|
||||
textPtr = (char*)(linePtr + nlines);
|
||||
attrPtr = (unsigned short*)(textPtr + (nlines * width));
|
||||
attrPtr = (VSAttrib*)(textPtr + (nlines * width));
|
||||
|
||||
// Loop through the elements, initializing each one.
|
||||
for(i = 0; i < nlines; i++) {
|
||||
|
@ -606,7 +606,7 @@ void VSIelo
|
|||
Doesn't do anything to the display. */
|
||||
{
|
||||
char *tt;
|
||||
unsigned short *ta;
|
||||
VSAttrib *ta;
|
||||
short i;
|
||||
|
||||
if (s < 0)
|
||||
|
@ -710,7 +710,7 @@ void VSIreset
|
|||
VSIw->DECPAM = 0;
|
||||
VSIw->DECORG = 0; /* NCSA: SB -- is this needed? */
|
||||
VSIw->DECCM = 1; // Bri 970610
|
||||
VSIw->Pattrib = -1; /* NCSA: SB -- is this needed? */
|
||||
VSIw->Pattrib = 0xffff; /* NCSA: SB -- is this needed? */
|
||||
VSIw->IRM = 0;
|
||||
VSIw->attrib = 0;
|
||||
VSIw->x = 0;
|
||||
|
@ -756,7 +756,7 @@ void VSIdellines
|
|||
{
|
||||
short i, j;
|
||||
char *tt;
|
||||
unsigned short *ta;
|
||||
VSAttrib *ta;
|
||||
VSlinePtr ts, TD, BD, TI, BI, itt;
|
||||
|
||||
if (VSIw->oldScrollback) {
|
||||
|
@ -829,7 +829,7 @@ void VSOdellines
|
|||
{
|
||||
short i, j;
|
||||
char *tt;
|
||||
unsigned short *ta;
|
||||
VSAttrib *ta;
|
||||
VSlinePtr as, ts, TD, BD, TI, BI, itt, ita;
|
||||
if (s < 0)
|
||||
s = VSIw->y;
|
||||
|
@ -912,7 +912,7 @@ void VSIinslines
|
|||
{
|
||||
short i, j;
|
||||
char *tt;
|
||||
unsigned short *ta;
|
||||
VSAttrib *ta;
|
||||
VSlinePtr ts, TD, BD, TI, BI, itt;
|
||||
|
||||
VSIflush(); // RAB BetterTelnet 2.0b3
|
||||
|
@ -986,7 +986,7 @@ void VSOinslines
|
|||
{
|
||||
short i, j;
|
||||
char *tt;
|
||||
unsigned short *ta;
|
||||
VSAttrib *ta;
|
||||
VSlinePtr ts, TD, BD, TI, BI, itt;
|
||||
VSattrlinePtr as, aTD, aBD, aTI, aBI, ita;
|
||||
|
||||
|
@ -1064,7 +1064,7 @@ void VSIscroll
|
|||
/* scrolls scrolling region up one line. */
|
||||
{
|
||||
register char *temp;
|
||||
register unsigned short *tempa;
|
||||
register VSAttrib *tempa;
|
||||
static VSlinePtr tmp, tmp2, tmp3, tmp4;
|
||||
register short i;
|
||||
short theBottom; /* NCSA 2.5: the correct screen bottom */
|
||||
|
@ -1195,7 +1195,7 @@ void VSOscroll
|
|||
/* scrolls scrolling region up one line. */
|
||||
{
|
||||
register char *temp;
|
||||
register unsigned short *tempa;
|
||||
register VSAttrib *tempa;
|
||||
register short i;
|
||||
short theBottom; /* NCSA 2.5: the correct screen bottom */
|
||||
static VSlinePtr tmp, tmp2, tmp3, tmp4;
|
||||
|
@ -1384,7 +1384,7 @@ void VSIeeol
|
|||
{
|
||||
char
|
||||
*tt;
|
||||
unsigned short
|
||||
VSAttrib
|
||||
*ta;
|
||||
short
|
||||
x1 = VSIw->x,
|
||||
|
@ -1412,9 +1412,9 @@ void VSIeeol
|
|||
savedTextPtr = savedTextBlock;
|
||||
for (i = 0; i <= VSIw->lines; i++) {
|
||||
if (VSIw->oldScrollback)
|
||||
BlockMoveData(VSIw->attrst[i]->text, savedTextPtr->attr, (VSIw->allwidth + 1) * 2);
|
||||
BlockMoveData(VSIw->attrst[i]->text, savedTextPtr->attr, (VSIw->allwidth + 1) * sizeof(VSAttrib));
|
||||
else
|
||||
BlockMoveData(VSIw->linest[i]->attr, savedTextPtr->attr, (VSIw->allwidth + 1) * 2);
|
||||
BlockMoveData(VSIw->linest[i]->attr, savedTextPtr->attr, (VSIw->allwidth + 1) * sizeof(VSAttrib));
|
||||
if (savedTextPtr->next) savedTextPtr = savedTextPtr->next;
|
||||
}
|
||||
|
||||
|
@ -1428,9 +1428,9 @@ void VSIeeol
|
|||
savedTextPtr = savedTextBlock;
|
||||
for (i = 0; i <= VSIw->lines; i++) {
|
||||
if (VSIw->oldScrollback)
|
||||
BlockMoveData(savedTextPtr->attr, VSIw->attrst[i]->text, (VSIw->allwidth + 1) * 2);
|
||||
BlockMoveData(savedTextPtr->attr, VSIw->attrst[i]->text, (VSIw->allwidth + 1) * sizeof(VSAttrib));
|
||||
else
|
||||
BlockMoveData(savedTextPtr->attr, VSIw->linest[i]->attr, (VSIw->allwidth + 1) * 2);
|
||||
BlockMoveData(savedTextPtr->attr, VSIw->linest[i]->attr, (VSIw->allwidth + 1) * sizeof(VSAttrib));
|
||||
if (savedTextPtr->next) savedTextPtr = savedTextPtr->next;
|
||||
}
|
||||
DisposePtr((Ptr) savedTextBlock); // VSIfreelinelist adds un-needed overhead here
|
||||
|
@ -1471,7 +1471,7 @@ void VSIdelchars
|
|||
offset;
|
||||
char
|
||||
*temp;
|
||||
unsigned short
|
||||
VSAttrib
|
||||
*tempa;
|
||||
|
||||
VSIwrapnow(&x1, &y1);
|
||||
|
@ -1567,7 +1567,7 @@ void VSIebol
|
|||
{
|
||||
char
|
||||
*tt;
|
||||
unsigned short
|
||||
VSAttrib
|
||||
*ta;
|
||||
short
|
||||
x1 = 0,
|
||||
|
@ -1604,7 +1604,7 @@ void VSIel
|
|||
/* erases the specified line. */
|
||||
{
|
||||
char *tt;
|
||||
unsigned short *ta;
|
||||
VSAttrib *ta;
|
||||
short x1 = 0, y1 = s, x2 = VSIw->maxwidth, y2 = s, n = -1, offset;
|
||||
short i;
|
||||
|
||||
|
@ -1897,7 +1897,7 @@ void VSIinschar
|
|||
{
|
||||
short i, j;
|
||||
char *temp;
|
||||
unsigned short *tempa;
|
||||
VSAttrib *tempa;
|
||||
VSIwrapnow(&i, &j);
|
||||
|
||||
if (VSIw->oldScrollback)
|
||||
|
@ -1951,7 +1951,7 @@ void VSIrestore
|
|||
)
|
||||
/* restores the last-saved cursor position and attribute settings. */
|
||||
{
|
||||
if (VSIw->Pattrib < 0)
|
||||
if (VSIw->Pattrib == 0xffff)
|
||||
/* no previous save */
|
||||
return;
|
||||
|
||||
|
@ -1968,7 +1968,7 @@ void VSIdraw
|
|||
short VSIwn, /* window number */
|
||||
short x, /* starting column */
|
||||
short y, /* line on which to draw */
|
||||
short a, /* text attributes */
|
||||
VSAttrib a, /* text attributes */
|
||||
short len, /* length of text to draw */
|
||||
char *c /* pointer to text */
|
||||
)
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#ifndef __VSDATA__
|
||||
#include "vsdata.h"
|
||||
#endif
|
||||
|
||||
/* vsintern.c */
|
||||
short VSIclip(short *x1, short *y1, short *x2, short *y2, short *n, short *offset);
|
||||
short VSIcdellines(short w, short top, short bottom, short n, short scrolled);
|
||||
short VSIcinslines(short w, short top, short bottom, short n, short scrolled);
|
||||
|
@ -48,7 +50,7 @@ void VSIinschar(short x);
|
|||
void VSIinsstring(short len, char *start);
|
||||
void VSIsave(void);
|
||||
void VSIrestore(void);
|
||||
void VSIdraw(short VSIwn, short x, short y, short a, short len, char *c);
|
||||
void VSIdraw(short VSIwn, short x, short y, VSAttrib a, short len, char *c);
|
||||
void VSIflush(void);
|
||||
void VSIcursdisable();
|
||||
void VSIcursenable();
|
||||
|
|
|
@ -94,11 +94,11 @@ extern unsigned char *VSIkplen; /* BYU 2.4.12 */
|
|||
* Definition of attribute bits in the Virtual Screen
|
||||
*
|
||||
* 0 - Bold
|
||||
* 1 -
|
||||
* 2 -
|
||||
* 1 - faint
|
||||
* 2 - italic
|
||||
* 3 - Underline
|
||||
* 4 - Blink
|
||||
* 5 -
|
||||
* 4 - slowly Blinking
|
||||
* 5 - rapidly Blinking
|
||||
* 6 - Reverse
|
||||
* 7 - Graphics character set
|
||||
* 8 - bit 0 of ansi foreground color index
|
||||
|
@ -113,8 +113,11 @@ extern unsigned char *VSIkplen; /* BYU 2.4.12 */
|
|||
*/
|
||||
#define VSa(x) ( 1 << ((x)-1) )
|
||||
#define VSisbold(x) ((x) & 0x01)
|
||||
#define VSisfaint(x) ((x) & 0x02)
|
||||
#define VSisitalic(x) ((x) & 0x04)
|
||||
#define VSisundl(x) ((x) & 0x08)
|
||||
#define VSisblnk(x) ((x) & 0x10)
|
||||
#define VSisfastblnk(x) ((x) & 0x20)
|
||||
#define VSisrev(x) ((x) & 0x40)
|
||||
#define VSisgrph(x) ((x) & 0x80)
|
||||
#define VSinattr(x) ((x) & 0xff)
|
||||
|
|
|
@ -54,11 +54,11 @@ void InitDebug(void)
|
|||
(TERMINALPREFS_RESTYPE, "\p<Default>", sizeof(TerminalPrefs));
|
||||
DetachResource((Handle) termHdl);
|
||||
HLock((Handle)termHdl);
|
||||
|
||||
scratchBoolean = RSsetcolor( console->vs, 0, (*termHdl)->nfcolor);
|
||||
scratchBoolean = RSsetcolor( console->vs, 1, (*termHdl)->nbcolor);
|
||||
scratchBoolean = RSsetcolor( console->vs, 2, (*termHdl)->bfcolor);
|
||||
scratchBoolean = RSsetcolor( console->vs, 3, (*termHdl)->bbcolor);
|
||||
|
||||
RSsetcolor( console->vs, 0, &(*termHdl)->nfcolor);
|
||||
RSsetcolor( console->vs, 1, &(*termHdl)->nbcolor);
|
||||
RSsetcolor( console->vs, 2, &(*termHdl)->bfcolor);
|
||||
RSsetcolor( console->vs, 3, &(*termHdl)->bbcolor);
|
||||
|
||||
DisposeHandle((Handle)termHdl);
|
||||
#else
|
||||
|
|
|
@ -129,10 +129,10 @@ void initftplog( void)
|
|||
DetachResource((Handle) termHdl);
|
||||
HLock((Handle)termHdl);
|
||||
|
||||
scratchBoolean = RSsetcolor( ftplog->vs, 0, (*termHdl)->nfcolor);
|
||||
scratchBoolean = RSsetcolor( ftplog->vs, 1, (*termHdl)->nbcolor);
|
||||
scratchBoolean = RSsetcolor( ftplog->vs, 2, (*termHdl)->bfcolor);
|
||||
scratchBoolean = RSsetcolor( ftplog->vs, 3, (*termHdl)->bbcolor);
|
||||
scratchBoolean = RSsetcolor( ftplog->vs, 0, &(*termHdl)->nfcolor);
|
||||
scratchBoolean = RSsetcolor( ftplog->vs, 1, &(*termHdl)->nbcolor);
|
||||
scratchBoolean = RSsetcolor( ftplog->vs, 2, &(*termHdl)->bfcolor);
|
||||
scratchBoolean = RSsetcolor( ftplog->vs, 3, &(*termHdl)->bbcolor);
|
||||
|
||||
DisposeHandle((Handle)termHdl);
|
||||
VSwrite(ftplog->vs,"\033[24;0H",7); /* Move to bottom of screen */
|
||||
|
@ -300,7 +300,6 @@ void initmac( void)
|
|||
screens[i].active = CNXN_NOTINUSE;
|
||||
|
||||
topLeftCorners = (short **) myNewHandle(MaxSess*sizeof(short));
|
||||
|
||||
|
||||
InquireEnvironment();
|
||||
|
||||
|
@ -424,6 +423,12 @@ void init (void)
|
|||
Size junk;
|
||||
long junk2;
|
||||
FlushEvents(everyEvent,0);
|
||||
|
||||
/* NONO */
|
||||
/*initMemoryBuffer(5*1024,30*1024);*/ //this gives use a grow zone for emergency situations
|
||||
initMemoryBuffer(5*1024,128*1024); //this gives use a grow zone for emergency situations
|
||||
/* NONO */
|
||||
|
||||
initmac(); /* initialize Macintosh stuff */
|
||||
|
||||
DoTheGlobalInits();
|
||||
|
@ -514,8 +519,4 @@ void init (void)
|
|||
}
|
||||
loadWDEF(); //this just loads the WDEF code in so that it doesnt fragment the heap later
|
||||
loadErrors(); //ditto for the error code
|
||||
/* NONO */
|
||||
/*initMemoryBuffer(5*1024,30*1024);*/ //this gives use a grow zone for emergency situations
|
||||
initMemoryBuffer(5*1024,128*1024); //this gives use a grow zone for emergency situations
|
||||
/* NONO */
|
||||
}
|
||||
|
|
|
@ -179,18 +179,22 @@ void trInit (MenuHandle whichMenu)
|
|||
Str255 menuItemName;
|
||||
GetMenuItemText(whichMenu, i,menuItemName);
|
||||
h = GetNamedResource(USER_TRSL,menuItemName);
|
||||
if (ResError() == noErr && (GetHandleSize(h) == 512)) {
|
||||
nNational++;
|
||||
|
||||
// Append the table's data to the master array of table data
|
||||
HUnlock(transTablesHdl);
|
||||
mySetHandleSize(transTablesHdl, (nNational * 512));//we're at init time; we have the mem
|
||||
HLockHi(transTablesHdl);
|
||||
HLock(h);
|
||||
BlockMoveData(*h, (*transTablesHdl) + ((nNational - 1) * 512), 512);
|
||||
if (h != NULL && ResError() == noErr) {
|
||||
if ( GetHandleSize(h) == 512) {
|
||||
nNational++;
|
||||
// Append the table's data to the master array of table data
|
||||
HUnlock(transTablesHdl);
|
||||
if (mySetHandleSize(transTablesHdl, (nNational * 512))) {
|
||||
ReleaseResource(h);
|
||||
break;
|
||||
}
|
||||
HLockHi(transTablesHdl);
|
||||
HLock(h);
|
||||
BlockMoveData(*h, (*transTablesHdl) + ((nNational - 1) * 512), 512);
|
||||
}
|
||||
// Release the resource
|
||||
ReleaseResource(h);
|
||||
}
|
||||
// Release the resource
|
||||
ReleaseResource(h);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -314,12 +314,16 @@ int WriteCharsToTTY(int id, void *ctx, char *buffer, int n)
|
|||
char *buf = buffer;
|
||||
char c;
|
||||
|
||||
if ( id == 2 ) {
|
||||
// log stderr to console
|
||||
putlln( buffer, n );
|
||||
return n;
|
||||
if ( !context ) {
|
||||
context = (lshcontext *)pthread_getspecific(ssh2threadkey);
|
||||
}
|
||||
if ( id == 2 ) {
|
||||
if ( !context || context->_port != -1 ) {
|
||||
// log stderr to console
|
||||
putlln( buffer, n );
|
||||
return n;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !context ) {
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -390,7 +390,7 @@ void setexitbuf(jmp_buf *exitbuf)
|
|||
{
|
||||
lshcontext *context = (lshcontext *)pthread_getspecific(ssh2threadkey);
|
||||
|
||||
if ( context ) {
|
||||
if ( context && context->_self == context ) {
|
||||
context->_pexitbuf = exitbuf;
|
||||
}
|
||||
}
|
||||
|
@ -403,7 +403,7 @@ jmp_buf *getexitbuf()
|
|||
{
|
||||
lshcontext *context = (lshcontext *)pthread_getspecific(ssh2threadkey);
|
||||
|
||||
if ( context ) {
|
||||
if ( context && context->_self == context ) {
|
||||
return context->_pexitbuf;
|
||||
}
|
||||
return NULL;
|
||||
|
@ -438,7 +438,10 @@ void abort(void)
|
|||
*/
|
||||
void __assertion_failed(char const *condition, char const *filename, int lineno)
|
||||
{
|
||||
Debugger();
|
||||
|
||||
fprintf( stderr, "Assertion (%s) failed in \"%s\" on line %d\n", condition, filename, lineno );
|
||||
|
||||
if ( pthread_getspecific( ssh2threadkey ) ) {
|
||||
macosabort();
|
||||
} else {
|
||||
|
@ -457,6 +460,7 @@ void *lshmalloc( unsigned long size )
|
|||
lshcontext *context = (lshcontext *)pthread_getspecific(ssh2threadkey);
|
||||
|
||||
if ( context ) {
|
||||
assert(context->_self == context);
|
||||
return MPmalloc( context->_gMemPool, size );
|
||||
}
|
||||
return NULL;
|
||||
|
@ -471,7 +475,15 @@ void *lshcalloc( unsigned long items, unsigned long size )
|
|||
lshcontext *context = (lshcontext *)pthread_getspecific(ssh2threadkey);
|
||||
|
||||
if ( context ) {
|
||||
return MPmalloc( context->_gMemPool, items * size );
|
||||
size_t tsize;
|
||||
void *p;
|
||||
|
||||
assert(context->_self == context);
|
||||
tsize = items * size;
|
||||
p = MPmalloc( context->_gMemPool, tsize );
|
||||
if ( p ) {
|
||||
memset(p, '\0', tsize);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
@ -488,6 +500,7 @@ void *lshrealloc( void *addr, unsigned long size )
|
|||
size_t orig_size;
|
||||
void *p;
|
||||
|
||||
assert(context->_self == context);
|
||||
if ( addr == 0 )
|
||||
return MPmalloc( context->_gMemPool, size );
|
||||
orig_size = MPsize( context->_gMemPool, addr );
|
||||
|
@ -787,7 +800,7 @@ Boolean gThreadModal = false;
|
|||
|
||||
void LockDialog()
|
||||
{
|
||||
while (gSetUpMovableModal)
|
||||
while (gMovableModal /*gSetUpMovableModal*/)
|
||||
ssh2_sched();
|
||||
pthread_mutex_lock( &dialock );
|
||||
gThreadModal = true;
|
||||
|
@ -817,6 +830,7 @@ char *getpass( const char *prompt )
|
|||
char *password;
|
||||
Boolean valid;
|
||||
|
||||
LockDialog();
|
||||
if ( wind && strstr(prompt, "assword for") ) {
|
||||
/* password authentication */
|
||||
password = wind->sshdata.currentpass;
|
||||
|
@ -824,8 +838,10 @@ char *getpass( const char *prompt )
|
|||
/* add host name to avoid sending password to another host... */
|
||||
strcpy(cprompt, prompt);
|
||||
strncat(cprompt, (char *)wind->sshdata.host + 1, wind->sshdata.host[0]);
|
||||
|
||||
if ( gApplicationPrefs->cachePassphrase
|
||||
&& getnextcachedpassphrase(cprompt, password, &context->_pindex) ) {
|
||||
UnlockDialog();
|
||||
return password;
|
||||
}
|
||||
if ( wind->sshdata.password[0] ) {
|
||||
|
@ -835,9 +851,7 @@ char *getpass( const char *prompt )
|
|||
valid = 1;
|
||||
} else {
|
||||
ppassword[0] = 0;
|
||||
LockDialog();
|
||||
valid = SSH2PasswordDialog(prompt, ppassword);
|
||||
UnlockDialog();
|
||||
if (valid) {
|
||||
memcpy(password, ppassword + 1, ppassword[0]);
|
||||
password[ppassword[0]] = '\0';
|
||||
|
@ -848,18 +862,18 @@ char *getpass( const char *prompt )
|
|||
addcachedpassphrase(context, cprompt, password);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
/* encrypted private key */
|
||||
int plen;
|
||||
assert(context != NULL);
|
||||
if ( gApplicationPrefs->cachePassphrase
|
||||
&& getnextcachedpassphrase(prompt, context->_kpassword, &context->_kindex) ) {
|
||||
UnlockDialog();
|
||||
return context->_kpassword;
|
||||
}
|
||||
context->_kpassword[0] = 0;
|
||||
LockDialog();
|
||||
valid = SSH2PasswordDialog(prompt, (StringPtr)context->_kpassword);
|
||||
UnlockDialog();
|
||||
if (valid) {
|
||||
plen = context->_kpassword[0];
|
||||
password = (wind != NULL) ? wind->sshdata.currentpass : context->_kpassword;
|
||||
|
@ -870,6 +884,7 @@ char *getpass( const char *prompt )
|
|||
}
|
||||
}
|
||||
}
|
||||
UnlockDialog();
|
||||
return (valid) ? password : NULL;
|
||||
}
|
||||
|
||||
|
@ -1012,7 +1027,7 @@ void ssh2_doevent(long sleepTime)
|
|||
extern Boolean haveNotifiedLowMemory;
|
||||
|
||||
if ( key_gen == 0 ) {
|
||||
if (!gThreadModal && !gSetUpMovableModal) {
|
||||
if (!gThreadModal && !/*gSetUpMovableModal*/gMovableModal) {
|
||||
DoEvents(NULL);
|
||||
}
|
||||
if (!TelInfo->done) {
|
||||
|
@ -1026,7 +1041,7 @@ void ssh2_doevent(long sleepTime)
|
|||
haveNotifiedLowMemory = true;
|
||||
}
|
||||
} else {
|
||||
if (!gThreadModal && !gSetUpMovableModal) {
|
||||
if (!gThreadModal && !/*gSetUpMovableModal*/gMovableModal) {
|
||||
static unsigned long lastTicks = 0L;
|
||||
if ( (LMGetTicks() - lastTicks) >= 10 ) {
|
||||
EventRecord myEvent;
|
||||
|
@ -1154,6 +1169,7 @@ int get_context_listener()
|
|||
|
||||
void init_context(lshcontext *context, short port)
|
||||
{
|
||||
context->_self = context;
|
||||
context->_port = port;
|
||||
context->_thread = pthread_self();
|
||||
context->_forward = 0;
|
||||
|
@ -1168,6 +1184,7 @@ void init_context(lshcontext *context, short port)
|
|||
/*context->_convertLFs = 0;*/
|
||||
context->_convertLFs = 1;
|
||||
context->_lastCR = 0;
|
||||
context->_insock = NULL;
|
||||
context->_gConsoleInBufLen = 0;
|
||||
context->_gConsoleInBufMax = CONSOLEBUFSIZE;
|
||||
context->_gConsoleOutBufLen = 0;
|
||||
|
@ -1179,10 +1196,8 @@ void init_context(lshcontext *context, short port)
|
|||
context->_verbose_flag = 0;
|
||||
context->_trace_flag = 0;
|
||||
context->_debug_flag = 0;
|
||||
|
||||
/*context->_error_fd = STDERR_FILENO;*/
|
||||
context->_error_fd = g_error_fd;
|
||||
|
||||
context->_error_pos = 0;
|
||||
context->_error_write = write_raw;
|
||||
context->_tracing = 0;
|
||||
|
@ -1430,7 +1445,7 @@ void *ssh2_thread(WindRec*w)
|
|||
{
|
||||
OSErr err;
|
||||
lshcontext *context;
|
||||
extern char *applname;
|
||||
jmp_buf exitbuf;
|
||||
int argc;
|
||||
char **argv;
|
||||
struct sigaction interrupt;
|
||||
|
@ -1441,6 +1456,7 @@ void *ssh2_thread(WindRec*w)
|
|||
int result;
|
||||
unsigned long finalTicks;
|
||||
int listener;
|
||||
char *mempool;
|
||||
|
||||
port = w->port;
|
||||
|
||||
|
@ -1458,11 +1474,10 @@ void *ssh2_thread(WindRec*w)
|
|||
|
||||
listener = -1;
|
||||
|
||||
context->_pexitbuf = &context->_exitbuf;
|
||||
if (!setjmp(context->_exitbuf)) {
|
||||
context->_pexitbuf = &exitbuf;
|
||||
if (!setjmp(exitbuf)) {
|
||||
|
||||
do {
|
||||
|
||||
init_context(context, port);
|
||||
|
||||
if ( listener != -1 ) {
|
||||
|
@ -1504,8 +1519,9 @@ void *ssh2_thread(WindRec*w)
|
|||
close_all_files(context);
|
||||
|
||||
if ( context->_gMemPool ) {
|
||||
MPDispose(context->_gMemPool);
|
||||
mempool = context->_gMemPool;
|
||||
context->_gMemPool = NULL;
|
||||
MPDispose(mempool);
|
||||
}
|
||||
|
||||
/* window's ptr might have changed... better reload it */
|
||||
|
@ -1533,12 +1549,17 @@ done:
|
|||
|
||||
if ( context ) {
|
||||
if ( context->_listener != -1 ) {
|
||||
close( context->_listener );
|
||||
listener = context->_listener;
|
||||
context->_listener = -1;
|
||||
close( listener );
|
||||
}
|
||||
close_all_files(context);
|
||||
if ( context->_gMemPool ) {
|
||||
MPDispose(context->_gMemPool);
|
||||
mempool = context->_gMemPool;
|
||||
context->_gMemPool = NULL;
|
||||
MPDispose(mempool);
|
||||
}
|
||||
context->_self = NULL;
|
||||
DisposePtr((Ptr)context);
|
||||
}
|
||||
|
||||
|
@ -1714,17 +1735,17 @@ struct AnimationCursRec {
|
|||
|
||||
void *ssh2_randomize_thread(struct RandStruct *rnd)
|
||||
{
|
||||
OSErr err;
|
||||
lshcontext *context;
|
||||
extern char *applname;
|
||||
int argc;
|
||||
char **argv;
|
||||
char levelstr[32];
|
||||
long len;
|
||||
char argstr[1024];
|
||||
char *tabargv[64];
|
||||
char *buf;
|
||||
int i, j;
|
||||
OSErr err;
|
||||
lshcontext *context;
|
||||
jmp_buf exitbuf;
|
||||
int argc;
|
||||
char **argv;
|
||||
char levelstr[32];
|
||||
long len;
|
||||
char argstr[1024];
|
||||
char *tabargv[64];
|
||||
char *buf;
|
||||
int i, j;
|
||||
|
||||
context = (lshcontext *)NewPtr(sizeof(lshcontext));
|
||||
if (context == NULL) {
|
||||
|
@ -1761,8 +1782,8 @@ void *ssh2_randomize_thread(struct RandStruct *rnd)
|
|||
|
||||
key_gen = 1;
|
||||
|
||||
context->_pexitbuf = &context->_exitbuf;
|
||||
if (!setjmp(context->_exitbuf)) {
|
||||
context->_pexitbuf = &exitbuf;
|
||||
if (!setjmp(exitbuf)) {
|
||||
/* we need to intercept SIGINT to fake 'exit' */
|
||||
struct sigaction interrupt;
|
||||
memset(&interrupt, 0, sizeof(interrupt));
|
||||
|
@ -1822,8 +1843,8 @@ void *ssh2_randomize_thread(struct RandStruct *rnd)
|
|||
|
||||
make_args( argstr, tabargv, &argc, &argv );
|
||||
|
||||
context->_pexitbuf = &context->_exitbuf;
|
||||
if (!setjmp(context->_exitbuf)) {
|
||||
context->_pexitbuf = &exitbuf;
|
||||
if (!setjmp(exitbuf)) {
|
||||
/* we need to intercept SIGINT to fake 'exit' */
|
||||
struct sigaction interrupt;
|
||||
memset(&interrupt, 0, sizeof(interrupt));
|
||||
|
@ -1863,6 +1884,7 @@ done:
|
|||
if ( context->_gMemPool ) {
|
||||
MPDispose(context->_gMemPool);
|
||||
}
|
||||
context->_self = NULL;
|
||||
DisposePtr((Ptr)context);
|
||||
}
|
||||
|
||||
|
@ -1964,26 +1986,29 @@ void ssh_randomize(void)
|
|||
HNoPurge((Handle)cursorHandle);
|
||||
}
|
||||
}
|
||||
|
||||
lastTicks = LMGetTicks() - 10;
|
||||
while ( randomize_thread != NULL ) {
|
||||
while ( key_gen != 0 ) {
|
||||
if ( cursorList && (LMGetTicks() - lastTicks) >= 10 ) {
|
||||
lastTicks = LMGetTicks();
|
||||
count = (**cursorList).information.count;
|
||||
frameNum = (**cursorList).frame % count;
|
||||
cursorHandle = (**cursorList).nCursors[frameNum];
|
||||
if ( cursorHandle != NULL ) {
|
||||
HLock((Handle)cursorHandle);
|
||||
SetCursor(*cursorHandle);
|
||||
HUnlock((Handle)cursorHandle);
|
||||
if ( key_gen != 0 ) {
|
||||
while ( key_gen != 0 ) {
|
||||
if ( cursorList && (LMGetTicks() - lastTicks) >= 10 ) {
|
||||
lastTicks = LMGetTicks();
|
||||
count = (**cursorList).information.count;
|
||||
frameNum = (**cursorList).frame % count;
|
||||
cursorHandle = (**cursorList).nCursors[frameNum];
|
||||
if ( cursorHandle != NULL ) {
|
||||
HLock((Handle)cursorHandle);
|
||||
SetCursor(*cursorHandle);
|
||||
HUnlock((Handle)cursorHandle);
|
||||
}
|
||||
(**cursorList).frame = (frameNum + 1) % count;
|
||||
}
|
||||
(**cursorList).frame = (frameNum + 1) % count;
|
||||
if ( key_abt ) {
|
||||
key_abt = 0;
|
||||
pthread_kill( randomize_thread, SIGINT );
|
||||
}
|
||||
sched_yield();
|
||||
}
|
||||
if ( key_abt ) {
|
||||
key_abt = 0;
|
||||
pthread_kill( randomize_thread, SIGINT );
|
||||
}
|
||||
sched_yield();
|
||||
}
|
||||
sched_yield();
|
||||
}
|
||||
|
@ -2021,7 +2046,7 @@ void *ssh_exportkey_thread(void *)
|
|||
{
|
||||
OSErr err;
|
||||
lshcontext *context;
|
||||
extern char *applname;
|
||||
jmp_buf exitbuf;
|
||||
int argc;
|
||||
char **argv;
|
||||
char argstr[1024];
|
||||
|
@ -2060,8 +2085,8 @@ void *ssh_exportkey_thread(void *)
|
|||
|
||||
make_args( argstr, tabargv, &argc, &argv );
|
||||
|
||||
context->_pexitbuf = &context->_exitbuf;
|
||||
if (!setjmp(context->_exitbuf)) {
|
||||
context->_pexitbuf = &exitbuf;
|
||||
if (!setjmp(exitbuf)) {
|
||||
/* we need to intercept SIGINT to fake 'exit' */
|
||||
struct sigaction interrupt;
|
||||
memset(&interrupt, 0, sizeof(interrupt));
|
||||
|
@ -2113,6 +2138,7 @@ done:
|
|||
if ( context->_gMemPool ) {
|
||||
MPDispose(context->_gMemPool);
|
||||
}
|
||||
context->_self = NULL;
|
||||
DisposePtr((Ptr)context);
|
||||
}
|
||||
|
||||
|
|
|
@ -141,7 +141,8 @@ pascal long MyWDEFPatch (short varCode, WindowPtr window, short message, long pa
|
|||
* keep developers writing workarounds and keep their minds afresh.
|
||||
* What else can we say ? Thanks !!!!! (Roberto Avanzi june 19, 1992)
|
||||
*/
|
||||
if ( (message == wDraw) ? (((short)param) != kOurHit ) : true ) {
|
||||
|
||||
if ( message != wDraw || (short)param != kOurHit ) {
|
||||
#ifdef __powerpc__
|
||||
result = CallUniversalProc((UniversalProcPtr)wdefProc, uppMyWDEFPatch, varCode, window, message, param);
|
||||
#else
|
||||
|
@ -159,15 +160,8 @@ pascal long MyWDEFPatch (short varCode, WindowPtr window, short message, long pa
|
|||
SetPort(aPort);
|
||||
aRgn = NewRgn();
|
||||
GetClip(aRgn);
|
||||
|
||||
SetRect(&aRect,-32000,-32000,32000,32000);
|
||||
ClipRect(&aRect);
|
||||
/* should check if title bar is visible...
|
||||
visRgn = NewRgn();
|
||||
SectRgn(visRgn, xxxxxxxx, visRgn);
|
||||
SetClip(visRgn);
|
||||
DisposeRgn(visRgn);
|
||||
*/
|
||||
switch ( (short) param ) { // Roberto Avanzi 18-06-1992: support for
|
||||
// tracking of the new part
|
||||
case 0:
|
||||
|
@ -266,7 +260,7 @@ void PatchWindowWDEF (WindowPtr window, struct WindRec *tw)
|
|||
wdefPatch = *wdefHndl;
|
||||
wdefPatch->oldAddr = oldAddr;
|
||||
#ifdef __powerpc__
|
||||
BlockMove(&MyWDEFPatchUniversal, &wdefPatch->rd, sizeof(wdefPatch->rd));
|
||||
BlockMoveData(&MyWDEFPatchUniversal, &wdefPatch->rd, sizeof(wdefPatch->rd));
|
||||
#else
|
||||
wdefPatch->jmpInst = 0x4ef9; /*JMP*/
|
||||
wdefPatch->patchAddr = (ProcPtr)MyWDEFPatch;
|
||||
|
|
Loading…
Reference in New Issue