summaryrefslogtreecommitdiffstats
path: root/src/windows/wintel
diff options
context:
space:
mode:
authorKeith Vetter <keithv@fusion.com>1995-06-02 18:55:30 +0000
committerKeith Vetter <keithv@fusion.com>1995-06-02 18:55:30 +0000
commit7050cd49620aa8882a481dba8870ea9e37011ba9 (patch)
tree8198656377d4fd0f14cb524ab1cdb37f0beeb394 /src/windows/wintel
parentc752d322e26e5479b70e281abe0c3e2aa3cc7788 (diff)
downloadkrb5-7050cd49620aa8882a481dba8870ea9e37011ba9.tar.gz
krb5-7050cd49620aa8882a481dba8870ea9e37011ba9.tar.xz
krb5-7050cd49620aa8882a481dba8870ea9e37011ba9.zip
Windows telnet changes to enable the cursor keys
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@5934 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/windows/wintel')
-rw-r--r--src/windows/wintel/changelo12
-rw-r--r--src/windows/wintel/emul.c4
-rw-r--r--src/windows/wintel/intern.c92
-rw-r--r--src/windows/wintel/makefile46
-rw-r--r--src/windows/wintel/screen.c59
-rw-r--r--src/windows/wintel/screen.h7
-rw-r--r--src/windows/wintel/telnet.c10
-rw-r--r--src/windows/wintel/telnet.rc2
8 files changed, 140 insertions, 92 deletions
diff --git a/src/windows/wintel/changelo b/src/windows/wintel/changelo
index 1a9aa7ad18..48bbc6b0f7 100644
--- a/src/windows/wintel/changelo
+++ b/src/windows/wintel/changelo
@@ -1,3 +1,15 @@
+Fri Jun 2 10:51:31 1995 Keith Vetter (keithv@fusion.com)
+
+ Added cursor keys (in two modes) and ctrl-space:
+ * emul.c: enabled calls to ScreenSetOption to change keyboard modes.
+ * intern.c: enabled ScreenSetOption but in a limited fashion.
+ * screen.c: cursor keys now get sent to the host machine.
+ * screen.h: Added prototype for ScreenSetOption and a new message
+ type WM_MYCURSORKEY for handling the cursor keys.
+ * telnet.c: handles WM_MYCURSORKEY and ctrl-space, plus a bug
+ fix on cancelling from the menu on the opening dialog.
+ * makefile: cleaned up and made consistent with the cns makefile.
+
Thu May 25 12:52:50 1995 Keith Vetter (keithv@fusion.com)
* auth.c, intern.c, negotiat.c, screen.c, screen.h, telnet.c,
diff --git a/src/windows/wintel/emul.c b/src/windows/wintel/emul.c
index e3f995cb5c..a80d37a423 100644
--- a/src/windows/wintel/emul.c
+++ b/src/windows/wintel/emul.c
@@ -505,7 +505,7 @@ void ScreenEm(
break;
case 'h': /* set mode (SM) */
-// ScreenSetOption(pScr,1);
+ ScreenSetOption(pScr,1);
escflg = 0;
break;
@@ -520,7 +520,7 @@ void ScreenEm(
break;
case 'l': /* reset mode (RM) */
-// ScreenSetOption(pScr,0);
+ ScreenSetOption(pScr,0);
escflg = 0;
break;
diff --git a/src/windows/wintel/intern.c b/src/windows/wintel/intern.c
index 703ee0254a..426de2f829 100644
--- a/src/windows/wintel/intern.c
+++ b/src/windows/wintel/intern.c
@@ -628,65 +628,69 @@ void ScreenSetOption(
SCREEN *pScr,
int toggle)
{
+ if (pScr->parms[0] == -2 && pScr->parms[1] == 1)
+ pScr->DECCKM = toggle;
- switch(pScr->parms[0]) {
+ #if 0
+ switch(pScr->parms[0]) {
- case -2:
- switch(pScr->parms[1]) {
+ case -2: // Set on the '?' char
+ switch(pScr->parms[1]) {
- case 1: /* set/reset cursor key mode */
- pScr->DECCKM = toggle;
- break;
-
- #ifdef NOT_SUPPORTED
- case 2: /* set/reset ANSI/vt52 mode */
+ case 1: /* set/reset cursor key mode */
+ pScr->DECCKM = toggle;
break;
- #endif
-
- case 3: /* set/reset column mode */
- pScr->x = pScr->y = 0; /* Clear the screen, mama! */
- ScreenEraseScreen(pScr);
- #if 0 /* removed for variable screen size */
- if (toggle) /* 132 column mode */
- pScr->width = pScr->allwidth;
- else
- pScr->width = 79;
+
+ #ifdef NOT_SUPPORTED
+ case 2: /* set/reset ANSI/vt52 mode */
+ break;
#endif
- break;
- #ifdef NOT_SUPPORTED
- case 4: /* set/reset scrolling mode */
- case 5: /* set/reset screen mode */
- case 6: /* set/rest origin mode */
- pScr->DECORG = toggle;
+ case 3: /* set/reset column mode */
+ pScr->x = pScr->y = 0; /* Clear the screen, mama! */
+ ScreenEraseScreen(pScr);
+ #if 0 /* removed for variable screen size */
+ if (toggle) /* 132 column mode */
+ pScr->width = pScr->allwidth;
+ else
+ pScr->width = 79;
+ #endif
break;
- #endif
- case 7: /* set/reset wrap mode */
- pScr->DECAWM = toggle;
-// set_vtwrap(pScrn, fpScr->DECAWM); /* QAK - 7/27/90: added because resetting the virtual screen's wrapping flag doesn't reset telnet window's wrapping */
- break;
+ #ifdef NOT_SUPPORTED
+ case 4: /* set/reset scrolling mode */
+ case 5: /* set/reset screen mode */
+ case 6: /* set/rest origin mode */
+ pScr->DECORG = toggle;
+ break;
+ #endif
- #ifdef NOT_SUPPORTED
- case 8: /* set/reset autorepeat mode */
- case 9: /* set/reset interlace mode */
+ case 7: /* set/reset wrap mode */
+ pScr->DECAWM = toggle;
+// set_vtwrap(pScrn, fpScr->DECAWM); /* QAK - 7/27/90: added because resetting the virtual screen's wrapping flag doesn't reset telnet window's wrapping */
break;
- #endif
- default:
+ #ifdef NOT_SUPPORTED
+ case 8: /* set/reset autorepeat mode */
+ case 9: /* set/reset interlace mode */
+ break;
+ #endif
+
+ default:
+ break;
+ } /* end switch */
break;
- } /* end switch */
- break;
- case 4:
- pScr->IRM=toggle;
- break;
+ case 4:
+ pScr->IRM=toggle;
+ break;
- default:
- break;
+ default:
+ break;
- } /* end switch */
+ } /* end switch */
+ #endif
} /* ScreenSetOption */
@@ -782,7 +786,7 @@ void ScreenDraw(
} /* ScreenDraw */
-#ifdef _DEBUG
+#if ! defined(NDEBUG)
BOOL CheckScreen(
SCREEN *pScr)
diff --git a/src/windows/wintel/makefile b/src/windows/wintel/makefile
index 71aa82447b..d01a01dd1f 100644
--- a/src/windows/wintel/makefile
+++ b/src/windows/wintel/makefile
@@ -1,12 +1,12 @@
# makefile: Constructs the kerborized telnet client
# Works for both k4 and k5 releases.
#
-NAME = telnet
-OBJS = telnet.obj negotiat.obj auth.obj edit.obj emul.obj \
- font.obj intern.obj screen.obj
+NAME = telnet
+OBJS = $(NAME).obj negotiat.obj auth.obj edit.obj emul.obj \
+ font.obj intern.obj screen.obj
##### Options
-DEBUG = 1
+DEBUG = 1
!IF ! defined(KVERSION)
KVERSION = 5
!endif
@@ -32,36 +32,36 @@ XOBJS = k5stream.obj
!endif
##### C Compiler
-CC = cl
-CFLAGS_RELEASE = /nologo /W3 /AL /GAs /Gx /O1 /DNDEBUG
-CFLAGS_DEBUG = /nologo /W3 /AL /GAs /Gx /G2 /Zi /Od /D_DEBUG /Fd"TELNET.PDB"
+CC = cl
+CFLAGS_RELEASE = /nologo /W3 /AL /GAs /G2 /Zp /O2 /DNDEBUG=1
+CFLAGS_DEBUG = /nologo /W3 /AL /GAs /G2 /Zp /O2 /Od /Zi
!if $(DEBUG)
-CFLAGS = $(CFLAGS_DEBUG) $(INCLUDES) /D$(KRB)=1
+CFLAGS = $(CFLAGS_DEBUG) $(INCLUDES) /D$(KRB)=1
!else
-CFLAGS = $(CFLAGS_RELEASE) $(INCLUDES) /D$(KRB)=1
+CFLAGS = $(CFLAGS_RELEASE) $(INCLUDES) /D$(KRB)=1
!endif
##### RC Compiler
-RC = rc
-RFLAGS_RELEASE = /nologo
-RFLAGS_DEBUG = /nologo /D_DEBUG
+RC = rc
+RFLAGS_RELEASE = /nologo /DNDEBUG
+RFLAGS_DEBUG = /nologo
!if $(DEBUG)
-RFLAGS = $(RFLAGS_DEBUG) $(INCLUDES)
+RFLAGS = $(RFLAGS_DEBUG) $(INCLUDES)
!else
-RFLAGS = $(RFLAGS_RELEASE) $(INCLUDES)
+RFLAGS = $(RFLAGS_RELEASE) $(INCLUDES)
!endif
##### Linker
-LINK = link
-LIBS = $(KLIB) $(WLIB)
-SYSLIBS = libw llibcew commdlg
+LINK = link
+LIBS = $(KLIB) $(WLIB)
+SYSLIBS = libw llibcew commdlg
!if $(DEBUG)
-LFLAGS = /co /nol /nod /packc:61440 /stack:32768 /align:16 /onerror:noexe
+LFLAGS = /co /nologo /nod /packc:61440 /stack:32768 /align:16 /onerror:noexe
!else
-LFLAGS = /nol /nod /packc:61440 /stack:32768 /align:16 /onerror:noexe
+LFLAGS = /nologo /nod /packc:61440 /stack:32768 /align:16 /onerror:noexe
!endif
-all: makefile $(NAME).exe
+all:: makefile $(NAME).exe
$(NAME).exe: $*.def $*.res $(OBJS) $(XOBJS) $(LIBS)
$(LINK) $(LFLAGS) $(OBJS) $(XOBJS), $@, $*.map, \
@@ -69,16 +69,16 @@ $(NAME).exe: $*.def $*.res $(OBJS) $(XOBJS) $(LIBS)
$(RC) $(RFLAGS) /k $*.res $@
install:
- copy telnet.exe ..\floppy
+ copy $(NAME).exe ..\floppy
-clean:
+clean::
if exist *.obj del *.obj
if exist *.exe del *.exe
if exist *.res del *.res
if exist *.map del *.map
if exist *.pdb del *.pdb
if exist *.err del *.err
- if exist ..\floppy\telnet.exe del ..\floppy\telnet.exe
+ if exist ..\floppy\$(NAME).exe del ..\floppy\$(NAME).exe
telnet.obj: telnet.h dialog.h screen.h struct.h wt-proto.h ini.h
diff --git a/src/windows/wintel/screen.c b/src/windows/wintel/screen.c
index da1fc1b23b..4945013de1 100644
--- a/src/windows/wintel/screen.c
+++ b/src/windows/wintel/screen.c
@@ -16,6 +16,10 @@ static SCREEN *ScreenList;
static HINSTANCE hInst;
static char szScreenClass[] = "ScreenWClass";
static char szScreenMenu[] = "ScreenMenu";
+static char cursor_key[8][4] = { // Send for cursor keys
+ "\x1B[D", "\x1B[A", "\x1B[C", "\x1B[B", // Normal mode
+ "\x1BOD", "\x1BOA", "\x1BOC", "\x1BOB", // Numpad on mode
+};
void ScreenInit(
HINSTANCE hInstance)
@@ -703,7 +707,7 @@ long FAR PASCAL ScreenWndProc(
MessageBox(NULL, strTmp, "Kerberos", MB_OK);
break;
- #ifdef _DEBUG
+ #if ! defined(NDEBUG)
case IDM_DEBUG:
CheckScreen(pScr);
break;
@@ -843,29 +847,42 @@ long FAR PASCAL ScreenWndProc(
else if (GetKeyState(VK_CONTROL) < 0)
PostMessage(hWnd, WM_COMMAND, IDM_COPY, NULL);
break;
- }
- if (wParam < VK_PRIOR || wParam > VK_DOWN)
- break;
-
- switch (wParam) {
-
- case VK_PRIOR: /* Page up */
- SendMessage(hWnd, WM_VSCROLL, SB_PAGEUP, NULL);
- break;
-
- case VK_NEXT: /* Page down */
- SendMessage(hWnd, WM_VSCROLL, SB_PAGEDOWN, NULL);
- break;
-
- case VK_UP: /* Line up */
- SendMessage(hWnd, WM_VSCROLL, SB_LINEUP, NULL);
+ }
+ /*
+ ** Check for cursor keys. With control pressed, we treat as
+ ** keyboard equivalents to scrolling. Otherwise, we send
+ ** a WM_MYCURSORKEY message with the appropriate string
+ ** to be sent. Sending the actual string allows the upper
+ ** level to be ignorant of keyboard modes, etc.
+ */
+ if (wParam < VK_PRIOR || wParam > VK_DOWN) // Is it a cursor key?
break;
- case VK_DOWN: /* Line down */
- SendMessage(hWnd, WM_VSCROLL, SB_LINEDOWN, NULL);
- break;
+ if (GetKeyState (VK_CONTROL) >= 0) { // No control key
+ if (wParam >= VK_LEFT && wParam <= VK_DOWN) {
+ pScr = (SCREEN *) GetWindowLong(hWnd, SCREEN_HANDLE);
+ assert (pScr != NULL);
+ wParam = wParam - VK_LEFT + (pScr->DECCKM ? 4 : 0);
+ SendMessage (pScr->hwndTel, WM_MYCURSORKEY,
+ strlen(cursor_key[wParam]),
+ (LPARAM) (char FAR *) cursor_key[wParam]);
+ }
+ } else { // Control is down
+ switch (wParam) {
+ case VK_PRIOR: /* Page up */
+ SendMessage(hWnd, WM_VSCROLL, SB_PAGEUP, NULL);
+ break;
+ case VK_NEXT: /* Page down */
+ SendMessage(hWnd, WM_VSCROLL, SB_PAGEDOWN, NULL);
+ break;
+ case VK_UP: /* Line up */
+ SendMessage(hWnd, WM_VSCROLL, SB_LINEUP, NULL);
+ break;
+ case VK_DOWN: /* Line down */
+ SendMessage(hWnd, WM_VSCROLL, SB_LINEDOWN, NULL);
+ break;
+ }
}
-
UpdateWindow(hWnd);
break;
diff --git a/src/windows/wintel/screen.h b/src/windows/wintel/screen.h
index 0864e03663..60618f7b6f 100644
--- a/src/windows/wintel/screen.h
+++ b/src/windows/wintel/screen.h
@@ -33,6 +33,7 @@ extern long FAR PASCAL ScreenWndProc(HWND,UINT,WPARAM,LPARAM);
#define WM_MYSCREENSIZE (WM_USER+6)
#define WM_NETWORKEVENT (WM_USER+7)
#define WM_HOSTNAMEFOUND (WM_USER+8)
+#define WM_MYCURSORKEY (WM_USER+9)
#define FRAME_HEIGHT ((2* GetSystemMetrics(SM_CYFRAME))+GetSystemMetrics(SM_CYCAPTION)+GetSystemMetrics(SM_CYMENU)+3)
#define FRAME_WIDTH (2*GetSystemMetrics(SM_CXFRAME)+GetSystemMetrics(SM_CXVSCROLL))
@@ -234,6 +235,10 @@ intern.c
void ScreenApClear(
SCREEN *pScr);
+ void ScreenSetOption(
+ SCREEN *pScr,
+ int toggle);
+
int ScreenInsChar(
SCREEN *pScr,
int x);
@@ -275,7 +280,7 @@ intern.c
int n,
int s);
- #ifdef _DEBUG
+ #if ! defined(NDEBUG)
BOOL CheckScreen(
SCREEN *pScr);
#endif
diff --git a/src/windows/wintel/telnet.c b/src/windows/wintel/telnet.c
index 7bcd3d2dad..1b9ef1098c 100644
--- a/src/windows/wintel/telnet.c
+++ b/src/windows/wintel/telnet.c
@@ -295,9 +295,18 @@ long FAR PASCAL MainWndProc(
wParam = con->backspace;
else if (wParam == 0x7f)
wParam = con->ctrl_backspace;
+ else if (wParam == VK_SPACE && GetKeyState(VK_CONTROL) < 0)
+ wParam = 0;
TelnetSend(con->ks, (char *) &wParam, 1, NULL);
break;
+ case WM_MYCURSORKEY:
+ /* Acts as a send through: buffer is lParam and length in wParam */
+ if (!con)
+ break;
+ TelnetSend (con->ks, (char *) lParam, wParam, NULL);
+ break;
+
case WM_MYSYSCHAR:
if (!con)
break;
@@ -732,6 +741,7 @@ BOOL FAR PASCAL OpenTelnetDlg(
case WM_COMMAND:
switch (wParam) {
case TEL_CANCEL:
+ case IDCANCEL: // From the menu
EndDialog(hDlg, FALSE);
break;
diff --git a/src/windows/wintel/telnet.rc b/src/windows/wintel/telnet.rc
index cbe082578b..ba00382286 100644
--- a/src/windows/wintel/telnet.rc
+++ b/src/windows/wintel/telnet.rc
@@ -20,7 +20,7 @@ BEGIN
BEGIN
MENUITEM "&Copy Cltr+Ins",IDM_COPY
MENUITEM "&Paste Shift+Ins", IDM_PASTE
- #ifdef _DEBUG
+ #if ! defined(NDEBUG)
MENUITEM "&Debug", IDM_DEBUG
#endif
END