/* Telnet options */
char termtype[32];
char termspeed[32];
- char environ[1024]; /* VAR\tvalue\0VAR\tvalue\0\0 */
+ char environmt[1024]; /* VAR\tvalue\0VAR\tvalue\0\0 */
char username[32];
int rfc_environ;
/* Keyboard options */
data++, datalen--;
}
+#ifdef FWHACK
+ if (len == 0x52656d6f) { /* "Remo"te server has closed ... */
+ len = 0x300; /* big enough to carry to end */
+ }
+#endif
+
pad = 8 - (len%8);
biglen = len + pad;
+#include <string.h>
+
struct RSAKey {
int bits;
int bytes;
*/
/*
- * $Id: sshdes.c,v 1.1 1999/01/08 13:02:12 simon Exp $
+ * $Id: sshdes.c,v 1.2 1999/01/08 13:10:15 simon Exp $
* $Log: sshdes.c,v $
- * Revision 1.1 1999/01/08 13:02:12 simon
- * Initial checkin: beta 0.43
+ * Revision 1.2 1999/01/08 13:10:15 simon
+ * John Sullivan's patches plus more fixes:
+ * - Stop using the identifier `environ' as some platforms make it a macro
+ * - Fix silly error box at end of connection in FWHACK mode
+ * - Fix GPF on maximise-then-restore
+ * - Use SetCapture to allow drag-selecting outside the window
+ * - Correctly update window title when iconic and in win_name_always mode
*
* Revision 1.1.1.1 1996/02/18 21:38:11 ylo
* Imported ssh-1.2.13.
*/
/*
- * $Id: sshdes.c,v 1.1 1999/01/08 13:02:12 simon Exp $
+ * $Id: sshdes.c,v 1.2 1999/01/08 13:10:15 simon Exp $
* $Log: sshdes.c,v $
- * Revision 1.1 1999/01/08 13:02:12 simon
- * Initial checkin: beta 0.43
+ * Revision 1.2 1999/01/08 13:10:15 simon
+ * John Sullivan's patches plus more fixes:
+ * - Stop using the identifier `environ' as some platforms make it a macro
+ * - Fix silly error box at end of connection in FWHACK mode
+ * - Fix GPF on maximise-then-restore
+ * - Use SetCapture to allow drag-selecting outside the window
+ * - Correctly update window title when iconic and in win_name_always mode
*
* Revision 1.1.1.1 1996/02/18 21:38:11 ylo
* Imported ssh-1.2.13.
b[0] = IAC; b[1] = SB; b[2] = sb_opt;
b[3] = TELQUAL_IS;
n = 4;
- e = cfg.environ;
+ e = cfg.environmt;
while (*e) {
b[n++] = var;
while (*e && *e != '\t') b[n++] = *e++;
right = (r - 1) / font_width;
top = t / font_height;
bottom = (b - 1) / font_height;
- for (i = top; i <= bottom; i++)
- for (j = left; j <= right; j++)
+ for (i = top; i <= bottom && j<rows ; i++)
+ for (j = left; j <= right && j<cols ; j++)
disptext[i*(cols+1)+j] = ATTR_INVALID;
do_paint (ctx, FALSE);
}
void term_mouse (Mouse_Button b, Mouse_Action a, int x, int y) {
- unsigned long *selpoint = disptop + y * (cols+1) + x;
+ unsigned long *selpoint;
+
+ if (y<0) y = 0;
+ if (y>=rows) y = rows-1;
+ if (x<0) x = 0;
+ if (x>=cols) x = cols-1;
+
+ selpoint = disptop + y * (cols+1) + x;
if (b == MB_SELECT && a == MA_CLICK) {
deselect();
wpps (sesskey, "TerminalType", cfg.termtype);
wpps (sesskey, "TerminalSpeed", cfg.termspeed);
{
- char buf[2*sizeof(cfg.environ)], *p, *q;
+ char buf[2*sizeof(cfg.environmt)], *p, *q;
p = buf;
- q = cfg.environ;
+ q = cfg.environmt;
while (*q) {
while (*q) {
int c = *q++;
gpps (sesskey, "TerminalSpeed", "38400,38400", cfg.termspeed,
sizeof(cfg.termspeed));
{
- char buf[2*sizeof(cfg.environ)], *p, *q;
+ char buf[2*sizeof(cfg.environmt)], *p, *q;
gpps (sesskey, "Environment", "", buf, sizeof(buf));
p = buf;
- q = cfg.environ;
+ q = cfg.environmt;
while (*p) {
while (*p && *p != ',') {
int c = *p++;
SetDlgItemText (hwnd, IDC3_TSEDIT, cfg.termspeed);
SetDlgItemText (hwnd, IDC3_LOGEDIT, cfg.username);
{
- char *p = cfg.environ;
+ char *p = cfg.environmt;
while (*p) {
SendDlgItemMessage (hwnd, IDC3_ENVLIST, LB_ADDSTRING, 0,
(LPARAM) p);
case IDC3_ENVADD:
if (HIWORD(wParam) == BN_CLICKED ||
HIWORD(wParam) == BN_DOUBLECLICKED) {
- char str[sizeof(cfg.environ)];
+ char str[sizeof(cfg.environmt)];
char *p;
GetDlgItemText (hwnd, IDC3_VAREDIT, str, sizeof(str)-1);
if (!*str) {
MessageBeep(0);
break;
}
- p = cfg.environ;
+ p = cfg.environmt;
while (*p) {
while (*p) p++;
p++;
}
- if ((p-cfg.environ) + strlen(str) + 2 < sizeof(cfg.environ)) {
+ if ((p-cfg.environmt) + strlen(str) + 2 < sizeof(cfg.environmt)) {
strcpy (p, str);
p[strlen(str)+1] = '\0';
SendDlgItemMessage (hwnd, IDC3_ENVLIST, LB_ADDSTRING,
SendDlgItemMessage (hwnd, IDC3_ENVLIST, LB_DELETESTRING,
i, 0);
- p = cfg.environ;
+ p = cfg.environmt;
while (i > 0) {
if (!*p)
goto disaster;
break;
}
break;
+
+#define X_POS(l) ((int)(short)LOWORD(l))
+#define Y_POS(l) ((int)(short)HIWORD(l))
+
case WM_LBUTTONDOWN:
- click (MB_SELECT, LOWORD(lParam) / font_width,
- HIWORD(lParam) / font_height);
+ SetCapture(hwnd);
+ click (MB_SELECT, X_POS(lParam) / font_width,
+ Y_POS(lParam) / font_height);
return 0;
case WM_LBUTTONUP:
- term_mouse (MB_SELECT, MA_RELEASE, LOWORD(lParam) / font_width,
- HIWORD(lParam) / font_height);
+ term_mouse (MB_SELECT, MA_RELEASE, X_POS(lParam) / font_width,
+ Y_POS(lParam) / font_height);
+ ReleaseCapture();
return 0;
case WM_MBUTTONDOWN:
+ SetCapture(hwnd);
click (cfg.mouse_is_xterm ? MB_PASTE : MB_EXTEND,
- LOWORD(lParam) / font_width,
- HIWORD(lParam) / font_height);
+ X_POS(lParam) / font_width,
+ Y_POS(lParam) / font_height);
return 0;
case WM_MBUTTONUP:
term_mouse (cfg.mouse_is_xterm ? MB_PASTE : MB_EXTEND,
- MA_RELEASE, LOWORD(lParam) / font_width,
- HIWORD(lParam) / font_height);
+ MA_RELEASE, X_POS(lParam) / font_width,
+ Y_POS(lParam) / font_height);
return 0;
+ ReleaseCapture();
case WM_RBUTTONDOWN:
+ SetCapture(hwnd);
click (cfg.mouse_is_xterm ? MB_EXTEND : MB_PASTE,
- LOWORD(lParam) / font_width,
- HIWORD(lParam) / font_height);
+ X_POS(lParam) / font_width,
+ Y_POS(lParam) / font_height);
return 0;
case WM_RBUTTONUP:
term_mouse (cfg.mouse_is_xterm ? MB_EXTEND : MB_PASTE,
- MA_RELEASE, LOWORD(lParam) / font_width,
- HIWORD(lParam) / font_height);
+ MA_RELEASE, X_POS(lParam) / font_width,
+ Y_POS(lParam) / font_height);
+ ReleaseCapture();
return 0;
case WM_MOUSEMOVE:
/*
b = cfg.mouse_is_xterm ? MB_PASTE : MB_EXTEND;
else
b = cfg.mouse_is_xterm ? MB_EXTEND : MB_PASTE;
- term_mouse (b, MA_DRAG, LOWORD(lParam) / font_width,
- HIWORD(lParam) / font_height);
+ term_mouse (b, MA_DRAG, X_POS(lParam) / font_width,
+ Y_POS(lParam) / font_height);
}
lastbtn = MB_NOTHING;
lastact = MA_NOTHING;
sfree (window_name);
window_name = smalloc(1+strlen(title));
strcpy (window_name, title);
- if (!IsIconic(hwnd))
+ if (cfg.win_name_always || !IsIconic(hwnd))
SetWindowText (hwnd, title);
}
sfree (icon_name);
icon_name = smalloc(1+strlen(title));
strcpy (icon_name, title);
- if (IsIconic(hwnd))
+ if (!cfg.win_name_always && IsIconic(hwnd))
SetWindowText (hwnd, title);
}