Windows telnet changes to enable the cursor keys
authorKeith Vetter <keithv@fusion.com>
Fri, 2 Jun 1995 18:55:30 +0000 (18:55 +0000)
committerKeith Vetter <keithv@fusion.com>
Fri, 2 Jun 1995 18:55:30 +0000 (18:55 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@5934 dc483132-0cff-0310-8789-dd5450dbe970

src/windows/cns/changelo
src/windows/cns/makefile
src/windows/wintel/changelo
src/windows/wintel/emul.c
src/windows/wintel/intern.c
src/windows/wintel/makefile
src/windows/wintel/screen.c
src/windows/wintel/screen.h
src/windows/wintel/telnet.c
src/windows/wintel/telnet.rc

index 4dee962fdb6b2906dd4383370680fda4a1cd954d..721abbdba189157cd1f871d30f5d6e9af72c0139 100644 (file)
@@ -1,3 +1,7 @@
+Fri Jun 2 11:45:23 1995 Keith Vetter (keithv@fusion.com)
+
+       * makefile: cleaned up and made consistent with telnet's makefile.
+
 Tue May 30 17:28:04 1995 Keith Vetter (keithv@fusion.com)
 
        * kpasswd.c: new file for k5 password changing.
index 0f3fff350cd0f711b954ff69dcf2561f05374f00..0163c874f5e96b64f59d98ce704e0d7fb2d86dae 100644 (file)
@@ -2,7 +2,7 @@
 # Works for both k4 and k5 releases.
 #
 NAME    = cns
-OBJS    = cns.obj tktlist.obj kpasswd.obj
+OBJS    = $(NAME).obj tktlist.obj
 
 ##### Options
 DEBUG   = 1
@@ -17,6 +17,7 @@ LIBDIR         = $(BUILDTOP)\lib\krb
 KLIB    = $(LIBDIR)\kerberos.lib 
 WLIB    = $(LIBDIR)\winsock.lib
 INCLUDES = /I$(BUILDTOP)\include
+XOBJS    = 
 !endif
 
 !if $(KVERSION) == 5
@@ -25,12 +26,13 @@ LIBDIR       = $(BUILDTOP)\lib
 KLIB    = $(LIBDIR)\libkrb5.lib
 WLIB    = $(LIBDIR)\winsock.lib
 INCLUDES = /I$(BUILDTOP)\include /I$(BUILDTOP)\include\krb5
+XOBJS    = kpasswd.obj
 !endif
 
 ##### C Compiler
 CC      = cl
-CFLAGS_RELEASE = /f- /nologo /W3 /AL /GAs /G2 /Zp /O2 /DNDEBUG=1
-CFLAGS_DEBUG   = /f  /nologo /W3 /AL /GAs /G2 /Zp /O2 /Od /Zi
+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
 !else
@@ -53,21 +55,26 @@ LFLAGS       = /nologo /nod /nopackcode
 
 all:: makefile $(NAME).exe
 
-$(NAME).exe: $*.def $*.res $(OBJS) $(LIBS)
-       $(LINK) $(LFLAGS) $(OBJS), $@, $*.map, $(LIBS) $(SYSLIBS), $*.def
+$(NAME).exe: $*.def $*.res $(OBJS) $(XOBJS) $(LIBS)
+       $(LINK) $(LFLAGS) $(OBJS) $(XOBJS), $@, $*.map, \
+         $(LIBS) $(SYSLIBS), $*.def
        $(RC) $(RFLAGS) /k $*.res $@
 
-$(OBJS) cns.res: cns.h tktlist.h
-
 install:
-       copy cns.exe ..\floppy
+       copy $(NAME).exe ..\floppy
 
 clean:: 
-       if exist *.exe del *.exe
-       if exist ..\floppy\cns.exe del ..\floppy\cns.exe
        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\$(NAME).exe del ..\floppy\$(NAME).exe
+
+$(OBJS) $(NAME).res: $(NAME).h tktlist.h
 
+$(NAME).res: clock00.ico clock05.ico clock10.ico clock15.ico clock20.ico \
+            clock25.ico clock30.ico clock35.ico clock40.ico clock45.ico \
+            clock50.ico clock55.ico clock60.ico clockexp.ico clocktkt.ico \
+            cns.ico
index 1a9aa7ad184d3c206ced518bf3e6dcc25f79de05..48bbc6b0f7419ddc9a6deaa3a9fb8f5e048202ea 100644 (file)
@@ -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,
index e3f995cb5c0579a79ce621ece63306e2fc4d23d2..a80d37a4234c301c222fffb1a69c94cc186f4b6b 100644 (file)
@@ -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;
 
index 703ee0254a15d16ce928ca34c3a751c856c7cffd..426de2f8291128b12616b99ed31b75425cc3f950 100644 (file)
@@ -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)
index 71aa82447b4392e9c1adc2513a64c75830dc6d7b..d01a01dd1f0c362bc06682fb81be083d976a9348 100644 (file)
@@ -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
 
index da1fc1b23b678538522c6345ec0e9a9a401805cc..4945013de147c7d4bac9d4ad7367d18a4d70e1f7 100644 (file)
@@ -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;
                
index 0864e036630770fe104253a8fe7ad6be148f3378..60618f7b6fb10f110794e1e08b9076f47d138a9c 100644 (file)
@@ -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
index 7bcd3d2dad92fb07327f88baaccd686f7f50fb7e..1b9ef1098ce1d79e93c5f39a34db064ddd8ec50b 100644 (file)
@@ -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;
                                
index cbe082578ba1d14be3cd099de85f0a7d3a6d9ce6..ba00382286cd98ac62a9ba5c329f97ffcc2ee8c2 100644 (file)
@@ -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