diff options
author | Tom Yu <tlyu@mit.edu> | 2009-10-31 00:48:38 +0000 |
---|---|---|
committer | Tom Yu <tlyu@mit.edu> | 2009-10-31 00:48:38 +0000 |
commit | 02d6bcbc98a214e7aeaaa9f45f0db8784a7b743b (patch) | |
tree | 61b9147863cd8be3eff63903dc36cae168254bd5 /src/windows/wintel/emul.c | |
parent | 162ab371748cba0cc6f172419bd6e71fa04bb878 (diff) | |
download | krb5-02d6bcbc98a214e7aeaaa9f45f0db8784a7b743b.tar.gz krb5-02d6bcbc98a214e7aeaaa9f45f0db8784a7b743b.tar.xz krb5-02d6bcbc98a214e7aeaaa9f45f0db8784a7b743b.zip |
make mark-cstyle
make reindent
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@23100 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/windows/wintel/emul.c')
-rw-r--r-- | src/windows/wintel/emul.c | 230 |
1 files changed, 115 insertions, 115 deletions
diff --git a/src/windows/wintel/emul.c b/src/windows/wintel/emul.c index 18547ab807..2a7ef4cd05 100644 --- a/src/windows/wintel/emul.c +++ b/src/windows/wintel/emul.c @@ -13,12 +13,12 @@ ScreenEmChars(SCREEN *pScr, char *c, int len) * control chracters or cause wrapping to another line. When a control * character is encountered or wrapping occurs, display stops and a * count of the number of characters is returned. - * + * * Parameters: * pScr - the screen to place the characters on. * c - the string of characters to place on the screen. * len - the number of characters contained in the string - * + * * Returns: The number of characters actually placed on the screen. */ @@ -31,10 +31,10 @@ ScreenEmChars(SCREEN *pScr, char *c, int len) char *current; /* place to put characters */ char *start; SCREENLINE *pScrLine; - + if (len <= 0) return(0); - + if (pScr->x != pScr->width - 1) pScr->bWrapPending = FALSE; else { @@ -44,24 +44,24 @@ ScreenEmChars(SCREEN *pScr, char *c, int len) ScreenIndex(pScr); } } - + pScrLine = GetScreenLineFromY(pScr, pScr->y); if (pScrLine == NULL) return(0); - + current = &pScrLine->text[pScr->x]; acurrent = &pScrLine->attrib[pScr->x]; start = current; ocount = pScr->x; extra = 0; - + attrib = pScr->attrib; insert = pScr->IRM; - + for (nchars = 0; nchars < len && *c >= 32; nchars++) { if (insert) ScreenInsChar(pScr, 1); - + *current = *c; *acurrent = (char) attrib; c++; @@ -79,10 +79,10 @@ ScreenEmChars(SCREEN *pScr, char *c, int len) } } } - + ScreenDraw(pScr, ocount, pScr->y, pScr->attrib, pScr->x - ocount + extra, start); - + return(nchars); } @@ -96,16 +96,16 @@ ScreenEm(LPSTR c, int len, SCREEN *pScr) char stat[20]; int i; int nchars; - + if (pScr->screen_bottom != pScr->buffer_bottom) { ScreenUnscroll(pScr); InvalidateRect(pScr->hWnd, NULL, TRUE); SetScrollPos(pScr->hWnd, SB_VERT, pScr->numlines, TRUE); } - + ScreenCursorOff(pScr); escflg = pScr->escflg; - + #ifdef UM if (pScr->localprint && len > 0) { /* see if printer needs anything */ pcount = send_localprint(c, len); @@ -113,7 +113,7 @@ ScreenEm(LPSTR c, int len, SCREEN *pScr) c += pcount; } #endif - + while (len > 0) { /* * look at first character in the vt100 string, if it is a @@ -121,43 +121,43 @@ ScreenEm(LPSTR c, int len, SCREEN *pScr) */ while((*c < 32) && (escflg == 0) && (len > 0)) { switch(*c) { - + case 0x1b: /* ESC found (begin vt100 control sequence) */ escflg++; break; - + case -1: /* IAC from telnet session */ escflg = 6; break; - + #ifdef CISB case 0x05: /* CTRL-E found (answerback) */ bp_ENQ(); break; #endif - + case 0x07: /* CTRL-G found (bell) */ ScreenBell(pScr); break; - + case 0x08: /* CTRL-H found (backspace) */ ScreenBackspace(pScr); break; - + case 0x09: /* CTRL-I found (tab) */ ScreenTab(pScr); /* Later change for versatile tabbing */ break; - + case 0x0a: /* CTRL-J found (line feed) */ case 0x0b: /* CTRL-K found (treat as line feed) */ case 0x0c: /* CTRL-L found (treat as line feed) */ ScreenIndex(pScr); break; - + case 0x0d: /* CTRL-M found (carriage feed) */ ScreenCarriageFeed(pScr); break; - + #if 0 case 0x0e: /* CTRL-N found (invoke Graphics (G1) character set) */ if (pScr->G1) @@ -166,7 +166,7 @@ ScreenEm(LPSTR c, int len, SCREEN *pScr) pScr->attrib = VSnotgraph(pScr->attrib); pScr->charset = 1; break; - + case 0x0f: /* CTRL-O found (invoke 'normal' (G0) character set) */ if(pScr->G0) pScr->attrib = VSgraph(pScr->attrib); @@ -175,14 +175,14 @@ ScreenEm(LPSTR c, int len, SCREEN *pScr) pScr->charset = 0; break; #endif - + #ifdef CISB case 0x10: /* CTRL-P found (undocumented in vt100) */ bp_DLE(c, len); len = 0; break; #endif - + #if 0 case 0x11: /* CTRL-Q found (XON) (unused presently) */ case 0x13: /* CTRL-S found (XOFF) (unused presently) */ @@ -191,24 +191,24 @@ ScreenEm(LPSTR c, int len, SCREEN *pScr) break; #endif } - + c++; /* advance to the next character in the string */ len--; /* decrement the counter */ } - + if (escflg == 0) { /* check for normal character to print */ nchars = ScreenEmChars(pScr, c, len); c += nchars; len -= nchars; } - + while ((len > 0) && (escflg == 1)) { /* ESC character was found */ switch(*c) { - + case 0x08: /* CTRL-H found (backspace) */ ScreenBackspace(pScr); break; - + /* * mostly cursor movement options, and DEC private stuff following */ @@ -216,77 +216,77 @@ ScreenEm(LPSTR c, int len, SCREEN *pScr) ScreenApClear(pScr); escflg = 2; break; - + case '#': /* various screen adjustments */ escflg = 3; break; - + case '(': /* G0 character set options */ escflg = 4; break; - + case ')': /* G1 character set options */ escflg = 5; break; - + case '>': /* keypad numeric mode (DECKPAM) */ pScr->DECPAM = 0; escflg = 0; break; - + case '=': /* keypad application mode (DECKPAM) */ pScr->DECPAM = 1; escflg = 0; break; - + case '7': /* save cursor (DECSC) */ ScreenSaveCursor(pScr); escflg = 0; break; - + case '8': /* restore cursor (DECRC) */ ScreenRestoreCursor(pScr); escflg = 0; break; - + #if 0 case 'c': /* reset to initial state (RIS) */ ScreenReset(pScr); escflg = 0; break; #endif - + case 'D': /* index (move down one line) (IND) */ ScreenIndex(pScr); escflg = 0; break; - + case 'E': /* next line (move down one line and to first column) (NEL) */ pScr->x = 0; ScreenIndex(pScr); escflg = 0; break; - + case 'H': /* horizontal tab set (HTS) */ pScr->tabs[pScr->x] = 'x'; escflg = 0; break; - + #ifdef CISB case 'I': /* undoumented in vt100 */ bp_ESC_I(); break; #endif - + case 'M': /* reverse index (move up one line) (RI) */ ScreenRevIndex(pScr); escflg = 0; break; - + case 'Z': /* identify terminal (DECID) */ escflg = 0; break; - + default: /* put the ESC character into the Screen */ ScreenEmChars(pScr, "\033", 1); @@ -294,20 +294,20 @@ ScreenEm(LPSTR c, int len, SCREEN *pScr) ScreenEmChars(pScr, c, 1); escflg = 0; break; - + } /* end switch */ - + c++; len--; } - - while((escflg == 2) && (len > 0)) { /* '[' handling */ + + while((escflg == 2) && (len > 0)) { /* '[' handling */ switch(*c) { - + case 0x08: /* backspace */ ScreenBackspace(pScr); break; - + case '0': case '1': case '2': @@ -323,15 +323,15 @@ ScreenEm(LPSTR c, int len, SCREEN *pScr) pScr->parms[pScr->parmptr] *= 10; pScr->parms[pScr->parmptr] += *c - '0'; break; - + case '?': /* vt100 mode change */ pScr->parms[pScr->parmptr++] = -2; break; - + case ';': /* parameter divider */ pScr->parmptr++; break; - + case 'A': /* cursor up (CUU) */ pScr->bWrapPending = FALSE; rc.left = pScr->x * pScr->cxChar; @@ -349,7 +349,7 @@ ScreenEm(LPSTR c, int len, SCREEN *pScr) escflg = 0; SendMessage(pScr->hWnd, WM_PAINT, 0, 0); break; - + case 'B': /* cursor down (CUD) */ pScr->bWrapPending = FALSE; rc.left = pScr->x * pScr->cxChar; @@ -367,7 +367,7 @@ ScreenEm(LPSTR c, int len, SCREEN *pScr) escflg = 0; SendMessage(pScr->hWnd, WM_PAINT, 0, 0); break; - + case 'C': /* cursor forward (right) (CUF) */ pScr->bWrapPending = FALSE; rc.left = pScr->x * pScr->cxChar; @@ -385,7 +385,7 @@ ScreenEm(LPSTR c, int len, SCREEN *pScr) escflg = 0; SendMessage(pScr->hWnd, WM_PAINT, 0, 0); break; - + case 'D': /* cursor backward (left) (CUB) */ pScr->bWrapPending = FALSE; rc.left = pScr->x * pScr->cxChar; @@ -401,7 +401,7 @@ ScreenEm(LPSTR c, int len, SCREEN *pScr) escflg = 0; SendMessage(pScr->hWnd, WM_PAINT, 0, 0); break; - + case 'f': /* horizontal & vertical position (HVP) */ case 'H': /* cursor position (CUP) */ pScr->bWrapPending = FALSE; @@ -416,10 +416,10 @@ ScreenEm(LPSTR c, int len, SCREEN *pScr) escflg = 0; SendMessage(pScr->hWnd, WM_PAINT, 0, 0); break; - + case 'J': /* erase in display (ED) */ switch(pScr->parms[0]) { - + case -1: case 0: /* erase from active position to end of screen */ ScreenEraseToEndOfScreen(pScr); @@ -429,73 +429,73 @@ ScreenEm(LPSTR c, int len, SCREEN *pScr) ScreenEraseToPosition(pScr); #endif break; - + case 2: /* erase whole screen */ ScreenEraseScreen(pScr); break; - + default: break; } - + escflg = 0; break; - + case 'K': /* erase in line (EL) */ switch(pScr->parms[0]) { case -1: case 0: /* erase to end of line */ ScreenEraseToEOL(pScr); break; - + case 1: /* erase to beginning of line */ ScreenEraseToBOL(pScr); break; - + case 2: /* erase whole line */ ScreenEraseLine(pScr, -1); break; - + default: break; } - + escflg = 0; break; - + case 'L': /* insert n lines preceding current line (IL) */ if (pScr->parms[0] < 1) pScr->parms[0] = 1; ScreenInsLines(pScr, pScr->parms[0], -1); escflg = 0; break; - + case 'M': /* delete n lines from current position downward (DL) */ if (pScr->parms[0] < 1) pScr->parms[0] = 1; ScreenDelLines(pScr, pScr->parms[0], -1); escflg = 0; break; - + case 'P': /* delete n chars from cursor to the left (DCH) */ if (pScr->parms[0] < 1) pScr->parms[0] = 1; ScreenDelChars(pScr, pScr->parms[0]); escflg = 0; break; - + #if 0 case 'R': /* receive cursor position status from host */ break; #endif - + #if 0 case 'c': /* device attributes (DA) */ ScreenSendIdent(); escflg = 0; break; #endif - + case 'g': /* tabulation clear (TBC) */ if (pScr->parms[0] == 3)/* clear all tabs */ ScreenTabClear(pScr); @@ -504,12 +504,12 @@ ScreenEm(LPSTR c, int len, SCREEN *pScr) pScr->tabs[pScr->x] = ' '; escflg = 0; break; - + case 'h': /* set mode (SM) */ ScreenSetOption(pScr,1); escflg = 0; break; - + case 'i': /* toggle printer */ #if 0 if(pScr->parms[pScr->parmptr] == 5) @@ -519,16 +519,16 @@ ScreenEm(LPSTR c, int len, SCREEN *pScr) #endif escflg = 0; break; - + case 'l': /* reset mode (RM) */ ScreenSetOption(pScr,0); escflg = 0; break; - + case 'm': /* select graphics rendition (SGR) */ { int temp = 0; - + while (temp <= pScr->parmptr) { if (pScr->parms[temp] < 1) pScr->attrib &= 128; @@ -539,7 +539,7 @@ ScreenEm(LPSTR c, int len, SCREEN *pScr) } escflg = 0; break; - + case 'n': /* device status report (DSR) */ switch (pScr->parms[0]) { #if 0 @@ -556,11 +556,11 @@ ScreenEm(LPSTR c, int len, SCREEN *pScr) } /* end switch */ escflg = 0; break; - + case 'q': /* load LEDs (unsupported) (DECLL) */ escflg = 0; break; - + case 'r': /* set top & bottom margins (DECSTBM) */ if (pScr->parms[0] < 0) pScr->top = 0; @@ -596,23 +596,23 @@ ScreenEm(LPSTR c, int len, SCREEN *pScr) #endif escflg = 0; break; - -#if 0 + +#if 0 case 'x': /* request/report terminal parameters (DECREQTPARM/DECREPTPARM) */ case 'y': /* invoke confidence test (DECTST) */ break; #endif - + default: escflg = 0; break; - + } - + c++; len--; - + #if 0 if (pScr->localprint && (len > 0)) { /* see if printer needs anything */ pcount = send_localprint(c, len); @@ -621,13 +621,13 @@ ScreenEm(LPSTR c, int len, SCREEN *pScr) } #endif } - + while ((escflg == 3) && (len > 0)) { /* # Handling */ switch (*c) { case 0x08: /* backspace */ ScreenBackspace(pScr); break; - + #if 0 case '3': /* top half of double line (DECDHL) */ case '4': /* bottom half of double line (DECDHL) */ @@ -635,29 +635,29 @@ ScreenEm(LPSTR c, int len, SCREEN *pScr) case '6': /* double width line (DECDWL) */ break; #endif - + case '8': /* screen alignment display (DECALN) */ ScreenAlign(pScr); escflg = 0; break; - + default: escflg = 0; break; - + } - + c++; len--; } - + while ((escflg == 4) && (len > 0)) { /* ( Handling (GO character set) */ switch (*c) { - + case 0x08: /* backspace */ ScreenBackspace(pScr); break; - + #if 0 case 'A': /* united kingdom character set (unsupported) */ case 'B': /* ASCII character set */ @@ -667,7 +667,7 @@ ScreenEm(LPSTR c, int len, SCREEN *pScr) pScr->attrib = ScreenNotGraph(pScr->attrib); escflg = 0; break; - + case '0': /* choose special graphics set */ case '2': /* alternate character set (special graphics) */ pScr->G0 = 1; @@ -676,24 +676,24 @@ ScreenEm(LPSTR c, int len, SCREEN *pScr) escflg = 0; break; #endif - + default: escflg = 0; break; } - + c++; len--; - + } /* end while */ - + while((escflg == 5) && (len > 0)) { /* ) Handling (G1 handling) */ switch (*c) { - + case 0x08: /* backspace */ ScreenBackspace(pScr); break; - + #if 0 case 'A': /* united kingdom character set (unsupported) */ case 'B': /* ASCII character set */ @@ -703,7 +703,7 @@ ScreenEm(LPSTR c, int len, SCREEN *pScr) pScr->attrib = ScreenNotGraph(pScr->attrib); escflg = 0; break; - + case '0': /* choose special graphics set */ case '2': /* alternate character set (special graphics) */ pScr->G1 = 1; @@ -712,20 +712,20 @@ ScreenEm(LPSTR c, int len, SCREEN *pScr) escflg = 0; break; #endif - + default: escflg = 0; break; } /* end switch */ - + c++; len--; } /* end while */ - + while ((escflg >= 6) && (escflg <= 10) && (len > 0)) { /* Handling IAC */ ic = (unsigned char) *c; switch (escflg) { - + case 6: /* Handling IAC xx */ if (ic == 255) /* if IAC */ escflg = 0; @@ -734,19 +734,19 @@ ScreenEm(LPSTR c, int len, SCREEN *pScr) else escflg = 9; break; - + case 7: /* Handling IAC SB xx */ if (ic == 255) /* if IAC */ escflg = 8; break; - + case 8: /* Handling IAC SB IAC xx */ if (ic == 255) /* if IAC IAC */ escflg = 7; else if (ic == 240) /* if IAC SE */ escflg = 0; break; - + case 9: /* IAC xx xx */ escflg = 0; break; @@ -754,7 +754,7 @@ ScreenEm(LPSTR c, int len, SCREEN *pScr) c++; /* advance to the next character in the string */ len--; /* decrement the counter */ } - + if (escflg > 2 && escflg < 6 && len > 0) { escflg = 0; c++; |