[Ttssh2-commit] [6961] インデント変更

scmno****@osdn***** scmno****@osdn*****
2017年 10月 27日 (金) 18:40:47 JST


Revision: 6961
          http://sourceforge.jp/projects/ttssh2/scm/svn/commits/6961
Author:   doda
Date:     2017-10-27 18:40:46 +0900 (Fri, 27 Oct 2017)
Log Message:
-----------
インデント変更

Modified Paths:
--------------
    trunk/teraterm/teraterm/telnet.c

-------------- next part --------------
Modified: trunk/teraterm/teraterm/telnet.c
===================================================================
--- trunk/teraterm/teraterm/telnet.c	2017-10-24 17:53:34 UTC (rev 6960)
+++ trunk/teraterm/teraterm/telnet.c	2017-10-27 09:40:46 UTC (rev 6961)
@@ -48,21 +48,21 @@
 enum OptQue {Empty, Opposite};
 
 typedef struct {
-  BOOL Accept;
-  enum OptStatus Status;
-  enum OptQue Que;
+	BOOL Accept;
+	enum OptStatus Status;
+	enum OptQue Que;
 } TelOpt;
 typedef TelOpt *PTelOpt;
 
 typedef struct {
-  TelOpt MyOpt[MaxTelOpt+1];
-  TelOpt HisOpt[MaxTelOpt+1];
-  BYTE SubOptBuff[51];
-  int SubOptCount;
-  BOOL SubOptIAC;
-  BOOL ChangeWinSize;
-  POINT WinSize;
-  int LogFile;
+	TelOpt MyOpt[MaxTelOpt+1];
+	TelOpt HisOpt[MaxTelOpt+1];
+	BYTE SubOptBuff[51];
+	int SubOptCount;
+	BOOL SubOptIAC;
+	BOOL ChangeWinSize;
+	POINT WinSize;
+	int LogFile;
 } TelRec;
 typedef TelRec *PTelRec;
 
@@ -74,178 +74,163 @@
 
 void DefaultTelRec()
 {
-  int i;
+	int i;
 
-  for (i=0 ; i <= MaxTelOpt ; i++)
-  {
-    tr.MyOpt[i].Accept = FALSE;
-    tr.MyOpt[i].Status = No;
-    tr.MyOpt[i].Que = Empty;
-    tr.HisOpt[i].Accept = FALSE;
-    tr.HisOpt[i].Status = No;
-    tr.HisOpt[i].Que = Empty;
-  }
+	for (i=0 ; i <= MaxTelOpt ; i++) {
+		tr.MyOpt[i].Accept = FALSE;
+		tr.MyOpt[i].Status = No;
+		tr.MyOpt[i].Que = Empty;
+		tr.HisOpt[i].Accept = FALSE;
+		tr.HisOpt[i].Status = No;
+		tr.HisOpt[i].Que = Empty;
+	}
 
-  tr.SubOptCount = 0;
-  tr.SubOptIAC = FALSE;
-  tr.ChangeWinSize = FALSE;
+	tr.SubOptCount = 0;
+	tr.SubOptIAC = FALSE;
+	tr.ChangeWinSize = FALSE;
 }
 
 void InitTelnet()
 {
-  TelStatus = TelIdle;
+	TelStatus = TelIdle;
 
-  DefaultTelRec();
-  tr.MyOpt[BINARY].Accept = TRUE;
-  tr.HisOpt[BINARY].Accept = TRUE;
-  tr.MyOpt[SGA].Accept = TRUE;
-  tr.HisOpt[SGA].Accept = TRUE;
-  tr.HisOpt[ECHO].Accept = TRUE;
-  tr.MyOpt[TERMTYPE].Accept = TRUE;
-  tr.MyOpt[TERMSPEED].Accept = TRUE;
-  tr.MyOpt[NAWS].Accept = TRUE;
-  tr.HisOpt[NAWS].Accept = TRUE;
-  tr.WinSize.x = ts.TerminalWidth;
-  tr.WinSize.y = ts.TerminalHeight;
+	DefaultTelRec();
+	tr.MyOpt[BINARY].Accept = TRUE;
+	tr.HisOpt[BINARY].Accept = TRUE;
+	tr.MyOpt[SGA].Accept = TRUE;
+	tr.HisOpt[SGA].Accept = TRUE;
+	tr.HisOpt[ECHO].Accept = TRUE;
+	tr.MyOpt[TERMTYPE].Accept = TRUE;
+	tr.MyOpt[TERMSPEED].Accept = TRUE;
+	tr.MyOpt[NAWS].Accept = TRUE;
+	tr.HisOpt[NAWS].Accept = TRUE;
+	tr.WinSize.x = ts.TerminalWidth;
+	tr.WinSize.y = ts.TerminalHeight;
 
-  if ((ts.LogFlag & LOG_TEL) != 0)
-    tr.LogFile = _lcreat("TELNET.LOG",0);
-  else
-    tr.LogFile = 0;
+	if ((ts.LogFlag & LOG_TEL) != 0)
+		tr.LogFile = _lcreat("TELNET.LOG", 0);
+	else
+		tr.LogFile = 0;
 }
 
 void EndTelnet()
 {
-  if (tr.LogFile != 0)
-  {
-    tr.LogFile = 0;
-    _lclose(tr.LogFile);
-  }
+	if (tr.LogFile) {
+		tr.LogFile = 0;
+		_lclose(tr.LogFile);
+	}
 
-  TelStopKeepAliveThread();
+	TelStopKeepAliveThread();
 }
 
 void TelWriteLog1(BYTE b)
 {
-  BYTE Temp[3];
-  BYTE Ch;
+	BYTE Temp[3];
+	BYTE Ch;
 
-  Temp[0] = 0x20;
-  Ch = b / 16;
-  if (Ch <= 9)
-    Ch = Ch + 0x30;
-  else
-    Ch = Ch + 0x37;
-  Temp[1] = Ch;
+	Temp[0] = 0x20;
+	Ch = b / 16;
+	if (Ch <= 9)
+		Ch = Ch + 0x30;
+	else
+		Ch = Ch + 0x37;
+	Temp[1] = Ch;
 
-  Ch = b & 15;
-  if (Ch <= 9)
-    Ch = Ch + 0x30;
-  else
-    Ch = Ch + 0x37;
-  Temp[2] = Ch;
-  _lwrite(tr.LogFile,Temp,3);
+	Ch = b & 15;
+	if (Ch <= 9)
+		Ch = Ch + 0x30;
+	else
+		Ch = Ch + 0x37;
+	Temp[2] = Ch;
+	_lwrite(tr.LogFile, Temp, 3);
 }
 
 void TelWriteLog(PCHAR Buf, int C)
 {
-  int i;
+	int i;
 
-  _lwrite(tr.LogFile,"\015\012>",3);
-  for (i = 0 ; i<= C-1 ; i++)
-    TelWriteLog1(Buf[i]);
+	_lwrite(tr.LogFile, "\015\012>", 3);
+	for (i = 0 ; i<= C-1 ; i++)
+		TelWriteLog1(Buf[i]);
 }
 
 void SendBack(BYTE a, BYTE b)
 {
-  BYTE Str3[3];
+	BYTE Str3[3];
 
-  Str3[0] = IAC;
-  Str3[1] = a;
-  Str3[2] = b;
-  CommRawOut(&cv,Str3,3);
-  if (tr.LogFile!=0)
-    TelWriteLog(Str3,3);
+	Str3[0] = IAC;
+	Str3[1] = a;
+	Str3[2] = b;
+	CommRawOut(&cv, Str3, 3);
+	if (tr.LogFile)
+		TelWriteLog(Str3, 3);
 }
 
 void SendWinSize()
 {
-  int i;
-  BYTE TmpBuff[21];
+	int i;
+	BYTE TmpBuff[21];
 
-  i = 0;
+	i = 0;
 
-  TmpBuff[i] = IAC;
-  i++;
-  TmpBuff[i] = SB;
-  i++;
-  TmpBuff[i] = NAWS;
-  i++;
-  TmpBuff[i] = HIBYTE(tr.WinSize.x);
-  i++;
- /* if (LOBYTE(tr.WinSize.x) == IAC)
-  {
-    tr.SendBackBuff[i] = IAC;
-    i++;
-  } */
-  TmpBuff[i] = LOBYTE(tr.WinSize.x);
-  i++;
-  TmpBuff[i] = HIBYTE(tr.WinSize.y);
-  i++;
- /* if (LOBYTE(tr.WinSize.y) == IAC)
-  {
-    tr.SendBackBuff[i] = IAC;
-    i++;
-  } */
-  TmpBuff[i] = LOBYTE(tr.WinSize.y);
-  i++;
-  TmpBuff[i] = IAC;
-  i++;
-  TmpBuff[i]= SE;
-  i++;
+	TmpBuff[i++] = IAC;
+	TmpBuff[i++] = SB;
+	TmpBuff[i++] = NAWS;
+	TmpBuff[i++] = HIBYTE(tr.WinSize.x);
+//	if (LOBYTE(tr.WinSize.x) == IAC) {
+//		tr.SendBackBuff[i++] = IAC;
+//	}
+	TmpBuff[i++] = LOBYTE(tr.WinSize.x);
+	TmpBuff[i++] = HIBYTE(tr.WinSize.y);
+//	if (LOBYTE(tr.WinSize.y) == IAC) {
+//		tr.SendBackBuff[i++] = IAC;
+//	}
+	TmpBuff[i++] = LOBYTE(tr.WinSize.y);
+	TmpBuff[i++] = IAC;
+	TmpBuff[i++] = SE;
 
-  CommRawOut(&cv,TmpBuff,i);
-  if (tr.LogFile!=0)
-    TelWriteLog(TmpBuff,i);
+	CommRawOut(&cv, TmpBuff, i);
+	if (tr.LogFile)
+		TelWriteLog(TmpBuff, i);
 }
 
 void ParseTelIAC(BYTE b)
 {
-  switch (b) {
-    case SE: break;
-    case NOP:
-    case DM:
-    case BREAK:
-    case IP:
-    case AO:
-    case AYT:
-    case EC:
-    case EL:
-    case GOAHEAD:
-      TelStatus = TelIdle;
-      break;
-    case SB:
-      TelStatus = TelSB;
-      tr.SubOptCount = 0;
-      break;
-    case WILLTEL:
-      TelStatus = TelWill;
-      break;
-    case WONTTEL:
-      TelStatus = TelWont;
-      break;
-    case DOTEL:
-      TelStatus = TelDo;
-      break;
-    case DONTTEL:
-      TelStatus = TelDont;
-      break;
-    case IAC:
-      TelStatus = TelIdle;
-      break;
-    default:
-      TelStatus = TelIdle;
-  }
+	switch (b) {
+	case SE: break;
+	case NOP:
+	case DM:
+	case BREAK:
+	case IP:
+	case AO:
+	case AYT:
+	case EC:
+	case EL:
+	case GOAHEAD:
+		TelStatus = TelIdle;
+		break;
+	case SB:
+		TelStatus = TelSB;
+		tr.SubOptCount = 0;
+		break;
+	case WILLTEL:
+		TelStatus = TelWill;
+		break;
+	case WONTTEL:
+		TelStatus = TelWont;
+		break;
+	case DOTEL:
+		TelStatus = TelDo;
+		break;
+	case DONTTEL:
+		TelStatus = TelDont;
+		break;
+	case IAC:
+		TelStatus = TelIdle;
+		break;
+	default:
+		TelStatus = TelIdle;
+	}
 }
 
 void ParseTelSB(BYTE b)
@@ -266,10 +251,10 @@
 				            IAC, SB, TERMTYPE, 0, ts.TermType, IAC, SE);
 				// 4 \x83o\x83C\x83g\x96ڂ\xC9 0 \x82\xAA\x93\xFC\x82\xE9\x82̂ŁA\x82\xB8\x82炵\x82Ē\xB7\x82\xB3\x82\xF0\x82Ƃ\xE9
 				i = strlen(TmpStr + 4) + 4;
-				CommRawOut(&cv,TmpStr,i);
+				CommRawOut(&cv, TmpStr, i);
 
-				if (tr.LogFile!=0)
-					TelWriteLog(TmpStr,i);
+				if (tr.LogFile)
+					TelWriteLog(TmpStr, i);
 			}
 			else if ( /* (tr.HisOpt[NAWS].Status == Yes) && */
 			        (tr.SubOptCount >= 5) &&
@@ -285,11 +270,11 @@
 			         (tr.SubOptBuff[1] == 1))
 			{
 				_snprintf_s(TmpStr, sizeof(TmpStr),
-					_TRUNCATE,"%c%c%c%c%d,%d%c%c",
+					_TRUNCATE, "%c%c%c%c%d,%d%c%c",
 					IAC, SB, TERMSPEED, 0,
 					ts.TerminalInputSpeed,
 					ts.TerminalOutputSpeed,
-					IAC,SE);
+					IAC, SE);
 				// 4 \x83o\x83C\x83g\x96ڂ\xC9 0 \x82\xAA\x93\xFC\x82\xE9\x82̂ŁA\x82\xB8\x82炵\x82Ē\xB7\x82\xB3\x82\xF0\x82Ƃ\xE9
 				i = strlen(TmpStr + 4) + 4;
 				CommRawOut(&cv, TmpStr, i);
@@ -335,455 +320,454 @@
 
 void ParseTelWill(BYTE b)
 {
-  if (b <= MaxTelOpt)
-  {
-    switch (tr.HisOpt[b].Status) {
-      case No:
-	if (tr.HisOpt[b].Accept)
-	{
-	  SendBack(DOTEL,b);
-	  tr.HisOpt[b].Status = Yes;
-	}
-	else
-	  SendBack(DONTTEL,b);
-	break;
+	if (b <= MaxTelOpt) {
+		switch (tr.HisOpt[b].Status) {
+		case No:
+			if (tr.HisOpt[b].Accept) {
+				SendBack(DOTEL, b);
+				tr.HisOpt[b].Status = Yes;
+			}
+			else {
+				SendBack(DONTTEL, b);
+			}
+			break;
 
-      case WantNo:
-	switch (tr.HisOpt[b].Que) {
-	  case Empty:
-	    tr.HisOpt[b].Status = No;
-	    break;
-	  case Opposite:
-	    tr.HisOpt[b].Status = Yes;
-	    break;
-	}
-	break;
+		case WantNo:
+			switch (tr.HisOpt[b].Que) {
+			case Empty:
+				tr.HisOpt[b].Status = No;
+				break;
+			case Opposite:
+				tr.HisOpt[b].Status = Yes;
+				break;
+			}
+			break;
 
-      case WantYes:
-	switch (tr.HisOpt[b].Que) {
-	  case Empty:
-	    tr.HisOpt[b].Status = Yes;
-	    break;
-	  case Opposite:
-	    tr.HisOpt[b].Status = WantNo;
-	    tr.HisOpt[b].Que = Empty;
-	    SendBack(DONTTEL,b);
-	    break;
+		case WantYes:
+			switch (tr.HisOpt[b].Que) {
+			case Empty:
+				tr.HisOpt[b].Status = Yes;
+				break;
+			case Opposite:
+				tr.HisOpt[b].Status = WantNo;
+				tr.HisOpt[b].Que = Empty;
+				SendBack(DONTTEL, b);
+				break;
+			}
+			break;
+		}
 	}
-	break;
-    }
-  }
-  else
-    SendBack(DONTTEL,b);
+	else {
+		SendBack(DONTTEL, b);
+	}
 
-  switch (b) {
-    case ECHO:
-      if (ts.TelEcho>0)
-	switch (tr.HisOpt[ECHO].Status) {
-	  case Yes:
-	    ts.LocalEcho = 0;
-	    break;
-	  case No:
-	    ts.LocalEcho = 1;
-	    break;
+	switch (b) {
+	case ECHO:
+		if (ts.TelEcho) {
+			switch (tr.HisOpt[ECHO].Status) {
+			case Yes:
+				ts.LocalEcho = 0;
+				break;
+			case No:
+				ts.LocalEcho = 1;
+				break;
+			}
+		}
+		if (tr.HisOpt[ECHO].Status == Yes) {
+			cv.TelLineMode = FALSE;
+		}
+		break;
+
+	case SGA:
+		if (tr.HisOpt[SGA].Status == Yes) {
+			cv.TelLineMode = FALSE;
+		}
+		break;
+
+	case BINARY:
+		switch (tr.HisOpt[BINARY].Status) {
+		case Yes:
+			cv.TelBinRecv = TRUE;
+			break;
+		case No:
+			cv.TelBinRecv = FALSE;
+			break;
+		}
+		break;
 	}
-      if (tr.HisOpt[ECHO].Status == Yes) {
-        cv.TelLineMode = FALSE;
-      }
-      break;
-    case SGA:
-      if (tr.HisOpt[SGA].Status == Yes) {
-	cv.TelLineMode = FALSE;
-      }
-      break;
-    case BINARY:
-      switch (tr.HisOpt[BINARY].Status) {
-	case Yes:
-	  cv.TelBinRecv = TRUE;
-	  break;
-	case No:
-	  cv.TelBinRecv = FALSE;
-	  break;
-      }
-      break;
-  }
-  TelStatus = TelIdle;
+	TelStatus = TelIdle;
 }
 
 void ParseTelWont(BYTE b)
 {
-  if (b <= MaxTelOpt)
-  {
-    switch (tr.HisOpt[b].Status) {
-      case Yes:
-	tr.HisOpt[b].Status = No;
-	SendBack(DONTTEL,b);
-	break;
+	if (b <= MaxTelOpt) {
+		switch (tr.HisOpt[b].Status) {
+		case Yes:
+			tr.HisOpt[b].Status = No;
+			SendBack(DONTTEL, b);
+			break;
 
-      case WantNo:
-	switch (tr.HisOpt[b].Que) {
-	  case Empty:
-	    tr.HisOpt[b].Status = No;
-	    break;
-	  case Opposite:
-	    tr.HisOpt[b].Status = WantYes;
-	    tr.HisOpt[b].Que = Empty;
-	    SendBack(DOTEL,b);
-	    break;
-	}
-	break;
+		case WantNo:
+			switch (tr.HisOpt[b].Que) {
+			case Empty:
+				tr.HisOpt[b].Status = No;
+				break;
+			case Opposite:
+				tr.HisOpt[b].Status = WantYes;
+				tr.HisOpt[b].Que = Empty;
+				SendBack(DOTEL, b);
+				break;
+			}
+			break;
 
-      case WantYes:
-	switch (tr.HisOpt[b].Que) {
-	  case Empty:
-	    tr.HisOpt[b].Status = No;
-	    break;
-	  case Opposite:
-	    tr.HisOpt[b].Status = No;
-	    tr.HisOpt[b].Que = Empty;
-	    break;
+		case WantYes:
+			switch (tr.HisOpt[b].Que) {
+			case Empty:
+				tr.HisOpt[b].Status = No;
+				break;
+			case Opposite:
+				tr.HisOpt[b].Status = No;
+				tr.HisOpt[b].Que = Empty;
+				break;
+			}
+			break;
+		}
 	}
-	break;
-    }
-  }
-  else
-    SendBack(DONTTEL,b);
+	else {
+		SendBack(DONTTEL, b);
+	}
 
-  switch (b) {
-    case ECHO:
-      if (ts.TelEcho>0)
-	switch (tr.HisOpt[ECHO].Status) {
-	  case Yes:
-	    ts.LocalEcho = 0;
-	    break;
-	  case No:
-	    ts.LocalEcho = 1;
-	    break;
+	switch (b) {
+	case ECHO:
+		if (ts.TelEcho) {
+			switch (tr.HisOpt[ECHO].Status) {
+			case Yes:
+				ts.LocalEcho = 0;
+				break;
+			case No:
+				ts.LocalEcho = 1;
+				break;
+			}
+		}
+		if (tr.HisOpt[ECHO].Status == Yes) {
+			cv.TelLineMode = FALSE;
+		}
+		break;
+
+	case BINARY:
+		switch (tr.HisOpt[BINARY].Status) {
+		case Yes:
+			cv.TelBinRecv = TRUE;
+			break;
+		case No:
+			cv.TelBinRecv = FALSE;
+			break;
+		}
+		break;
 	}
-	break;
-      if (tr.HisOpt[ECHO].Status == Yes) {
-        cv.TelLineMode = FALSE;
-      }
-    case BINARY:
-      switch (tr.HisOpt[BINARY].Status) {
-	case Yes:
-	  cv.TelBinRecv = TRUE;
-	  break;
-	case No:
-	  cv.TelBinRecv = FALSE;
-	  break;
-      }
-      break;
-  }
-  TelStatus = TelIdle;
+	TelStatus = TelIdle;
 }
 
 void ParseTelDo(BYTE b)
 {
-  if (b <= MaxTelOpt)
-  {
-    switch (tr.MyOpt[b].Status) {
-      case No:
-	if (tr.MyOpt[b].Accept)
-	{
-	  tr.MyOpt[b].Status = Yes;
-	  SendBack(WILLTEL,b);
-	}
-	else
-	  SendBack(WONTTEL,b);
-	break;
+	if (b <= MaxTelOpt) {
+		switch (tr.MyOpt[b].Status) {
+		case No:
+			if (tr.MyOpt[b].Accept) {
+				tr.MyOpt[b].Status = Yes;
+				SendBack(WILLTEL, b);
+			}
+			else {
+				SendBack(WONTTEL, b);
+			}
+			break;
 
-      case WantNo:
-	switch (tr.MyOpt[b].Que) {
-	  case Empty:
-	    tr.MyOpt[b].Status = No;
-	    break;
-	  case Opposite:
-	    tr.MyOpt[b].Status = Yes;
-	    break;
+		case WantNo:
+			switch (tr.MyOpt[b].Que) {
+			case Empty:
+				tr.MyOpt[b].Status = No;
+				break;
+			case Opposite:
+				tr.MyOpt[b].Status = Yes;
+				break;
+			}
+			break;
+
+		case WantYes:
+			switch (tr.MyOpt[b].Que) {
+			case Empty:
+				tr.MyOpt[b].Status = Yes;
+				break;
+			case Opposite:
+				tr.MyOpt[b].Status = WantNo;
+				tr.MyOpt[b].Que = Empty;
+				SendBack(WONTTEL, b);
+				break;
+			}
+			break;
+		}
 	}
-	break;
+	else {
+		SendBack(WONTTEL, b);
+	}
 
-      case WantYes:
-	switch (tr.MyOpt[b].Que) {
-	  case Empty:
-	    tr.MyOpt[b].Status = Yes;
-	    break;
-	  case Opposite:
-	    tr.MyOpt[b].Status = WantNo;
-	    tr.MyOpt[b].Que = Empty;
-	    SendBack(WONTTEL,b);
-	    break;
+	switch (b) {
+	case BINARY:
+		switch (tr.MyOpt[BINARY].Status) {
+		case Yes:
+			cv.TelBinSend = TRUE;
+			break;
+		case No:
+			cv.TelBinSend = FALSE;
+			break;
+		}
+		break;
+
+	case NAWS:
+		if (tr.MyOpt[NAWS].Status==Yes)
+			SendWinSize();
+		break;
+
+	case SGA:
+		if (tr.MyOpt[SGA].Status==Yes)
+			cv.TelLineMode = FALSE;
+		break;
 	}
-	break;
-    }
-  }
-  else
-    SendBack(WONTTEL,b);
-
-  switch (b) {
-    case BINARY:
-      switch (tr.MyOpt[BINARY].Status) {
-	case Yes:
-	  cv.TelBinSend = TRUE;
-	  break;
-	case No:
-	  cv.TelBinSend = FALSE;
-	  break;
-      }
-      break;
-    case NAWS:
-      if (tr.MyOpt[NAWS].Status==Yes)
-	SendWinSize();
-      break;
-    case SGA:
-      if (tr.MyOpt[SGA].Status==Yes)
-        cv.TelLineMode = FALSE;
-      break;
-  }
-  TelStatus = TelIdle;
+	TelStatus = TelIdle;
 }
 
 void ParseTelDont(BYTE b)
 {
-  if (b <= MaxTelOpt)
-  {
-    switch (tr.MyOpt[b].Status) {
-      case Yes:
-	tr.MyOpt[b].Status = No;
-	SendBack(WONTTEL,b);
-	break;
+	if (b <= MaxTelOpt) {
+		switch (tr.MyOpt[b].Status) {
+		case Yes:
+			tr.MyOpt[b].Status = No;
+			SendBack(WONTTEL, b);
+			break;
 
-      case WantNo:
-	switch (tr.MyOpt[b].Que) {
-	  case Empty:
-	    tr.MyOpt[b].Status = No;
-	    break;
-	  case Opposite:
-	    tr.MyOpt[b].Status = WantYes;
-	    tr.MyOpt[b].Que = Empty;
-	    SendBack(WILLTEL,b);
-	    break;
+		case WantNo:
+			switch (tr.MyOpt[b].Que) {
+			case Empty:
+				tr.MyOpt[b].Status = No;
+				break;
+			case Opposite:
+				tr.MyOpt[b].Status = WantYes;
+				tr.MyOpt[b].Que = Empty;
+				SendBack(WILLTEL, b);
+				break;
+			}
+			break;
+
+		case WantYes:
+			switch (tr.MyOpt[b].Que) {
+			case Empty:
+				tr.MyOpt[b].Status = No;
+				break;
+			case Opposite:
+				tr.MyOpt[b].Status = No;
+				tr.MyOpt[b].Que = Empty;
+				break;
+			}
+			break;
+		}
 	}
-	break;
+	else {
+		SendBack(WONTTEL, b);
+	}
 
-      case WantYes:
-	switch (tr.MyOpt[b].Que) {
-	  case Empty:
-	    tr.MyOpt[b].Status = No;
-	    break;
-	  case Opposite:
-	    tr.MyOpt[b].Status = No;
-	    tr.MyOpt[b].Que = Empty;
-	    break;
+	switch (b) {
+	case BINARY:
+		switch (tr.MyOpt[BINARY].Status) {
+		case Yes:
+			cv.TelBinSend = TRUE;
+			break;
+		case No:
+			cv.TelBinSend = FALSE;
+			break;
+		}
+		break;
 	}
-	break;
-    }
-  }
-  else
-    SendBack(WONTTEL,b);
-
-  switch (b) {
-    case BINARY:
-      switch (tr.MyOpt[BINARY].Status) {
-	case Yes:
-	  cv.TelBinSend = TRUE;
-	  break;
-	case No:
-	  cv.TelBinSend = FALSE;
-	  break;
-      }
-      break;
-  }
-  TelStatus = TelIdle;
+	TelStatus = TelIdle;
 }
 
 void ParseTel(BOOL *Size, int *nx, int *ny)
 {
-  BYTE b;
-  int c;
+	BYTE b;
+	int c;
 
-  c = CommReadRawByte(&cv,&b);
+	c = CommReadRawByte(&cv, &b);
 
-  while ((c>0) && (cv.TelMode))
-  {
-    if (tr.LogFile!=0)
-    {
-      if (TelStatus==TelIAC)
-      {
-	_lwrite(tr.LogFile,"\015\012<",3);
-	TelWriteLog1(0xff);
-      }
-      TelWriteLog1(b);
-    }
+	while ((c>0) && (cv.TelMode)) {
+		if (tr.LogFile) {
+			if (TelStatus==TelIAC) {
+				_lwrite(tr.LogFile, "\015\012<", 3);
+				TelWriteLog1(0xff);
+			}
+			TelWriteLog1(b);
+		}
 
-    tr.ChangeWinSize = FALSE;
+		tr.ChangeWinSize = FALSE;
 
-    switch (TelStatus) {
-      case TelIAC: ParseTelIAC(b); break;
-      case TelSB: ParseTelSB(b); break;
-      case TelWill: ParseTelWill(b); break;
-      case TelWont: ParseTelWont(b); break;
-      case TelDo: ParseTelDo(b); break;
-      case TelDont: ParseTelDont(b); break;
-      case TelNop: TelStatus = TelIdle; break;
-    }
-    if (TelStatus == TelIdle) cv.TelMode = FALSE;
+		switch (TelStatus) {
+			case TelIAC: ParseTelIAC(b); break;
+			case TelSB: ParseTelSB(b); break;
+			case TelWill: ParseTelWill(b); break;
+			case TelWont: ParseTelWont(b); break;
+			case TelDo: ParseTelDo(b); break;
+			case TelDont: ParseTelDont(b); break;
+			case TelNop: TelStatus = TelIdle; break;
+		}
+		if (TelStatus == TelIdle) cv.TelMode = FALSE;
 
-    if (cv.TelMode) c = CommReadRawByte(&cv,&b);
-  }
+		if (cv.TelMode) c = CommReadRawByte(&cv, &b);
+	}
 
-  *Size = tr.ChangeWinSize;
-  *nx = tr.WinSize.x;
-  *ny = tr.WinSize.x;
+	*Size = tr.ChangeWinSize;
+	*nx = tr.WinSize.x;
+	*ny = tr.WinSize.x;
 }
 
 void TelEnableHisOpt(BYTE b)
 {
-  if (b <= MaxTelOpt)
-  {
-    switch (tr.HisOpt[b].Status) {
-      case No:
-	tr.HisOpt[b].Status = WantYes;
-	SendBack(DOTEL,b);
-	break;
+	if (b <= MaxTelOpt) {
+		switch (tr.HisOpt[b].Status) {
+		case No:
+			tr.HisOpt[b].Status = WantYes;
+			SendBack(DOTEL, b);
+			break;
 
-      case WantNo:
-	if (tr.HisOpt[b].Que==Empty)
-	  tr.HisOpt[b].Que = Opposite;
-	break;
+		case WantNo:
+			if (tr.HisOpt[b].Que==Empty)
+				tr.HisOpt[b].Que = Opposite;
+			break;
 
-      case WantYes:
-	if (tr.HisOpt[b].Que==Opposite)
-	  tr.HisOpt[b].Que = Empty;
-	break;
-    }
-  }
+		case WantYes:
+			if (tr.HisOpt[b].Que==Opposite)
+				tr.HisOpt[b].Que = Empty;
+			break;
+		}
+	}
 }
 
 void TelDisableHisOpt(BYTE b)
 {
-  if (b <= MaxTelOpt)
-  {
-    switch (tr.HisOpt[b].Status) {
-      case Yes:
-	tr.HisOpt[b].Status = WantNo;
-	SendBack(DONTTEL,b);
-	break;
+	if (b <= MaxTelOpt) {
+		switch (tr.HisOpt[b].Status) {
+		case Yes:
+			tr.HisOpt[b].Status = WantNo;
+			SendBack(DONTTEL, b);
+			break;
 
-      case WantNo:
-	if (tr.HisOpt[b].Que==Opposite)
-	  tr.HisOpt[b].Que = Empty;
-	break;
+		case WantNo:
+			if (tr.HisOpt[b].Que==Opposite)
+				tr.HisOpt[b].Que = Empty;
+			break;
 
-      case WantYes:
-	if (tr.HisOpt[b].Que==Empty)
-	  tr.HisOpt[b].Que = Opposite;
-	break;
-    }
-  }
+		case WantYes:
+			if (tr.HisOpt[b].Que==Empty)
+				tr.HisOpt[b].Que = Opposite;
+			break;
+		}
+	}
 }
 
 void TelEnableMyOpt(BYTE b)
 {
-  if (b <= MaxTelOpt)
-  {
-    switch (tr.MyOpt[b].Status) {
-      case No:
-	tr.MyOpt[b].Status = WantYes;
-	SendBack(WILLTEL,b);
-	break;
+	if (b <= MaxTelOpt) {
+		switch (tr.MyOpt[b].Status) {
+		case No:
+			tr.MyOpt[b].Status = WantYes;
+			SendBack(WILLTEL, b);
+			break;
 
-      case WantNo:
-	if (tr.MyOpt[b].Que==Empty)
-	  tr.MyOpt[b].Que = Opposite;
-	break;
+		case WantNo:
+			if (tr.MyOpt[b].Que==Empty)
+				tr.MyOpt[b].Que = Opposite;
+			break;
 
-      case WantYes:
-	if (tr.MyOpt[b].Que==Opposite)
-	  tr.MyOpt[b].Que = Empty;
-	break;
-    }
-  }
+		case WantYes:
+			if (tr.MyOpt[b].Que==Opposite)
+				tr.MyOpt[b].Que = Empty;
+			break;
+		}
+	}
 }
 
 void TelDisableMyOpt(BYTE b)
 {
-  if (b <= MaxTelOpt)
-  {
-    switch (tr.MyOpt[b].Status) {
-      case Yes:
-	tr.MyOpt[b].Status = WantNo;
-	SendBack(WONTTEL,b);
-	break;
+	if (b <= MaxTelOpt) {
+		switch (tr.MyOpt[b].Status) {
+		case Yes:
+			tr.MyOpt[b].Status = WantNo;
+			SendBack(WONTTEL, b);
+			break;
 
-      case WantNo:
-	if (tr.MyOpt[b].Que==Opposite)
-	  tr.MyOpt[b].Que = Empty;
-	break;
+		case WantNo:
+			if (tr.MyOpt[b].Que==Opposite)
+				tr.MyOpt[b].Que = Empty;
+			break;
 
-      case WantYes:
-	if (tr.MyOpt[b].Que==Empty)
-	  tr.MyOpt[b].Que = Opposite;
-	break;
-    }
-  }
+		case WantYes:
+			if (tr.MyOpt[b].Que==Empty)
+				tr.MyOpt[b].Que = Opposite;
+			break;
+		}
+	}
 }
 
 void TelInformWinSize(int nx, int ny)
 {
-  if ((tr.MyOpt[NAWS].Status==Yes) &&
-      ((nx!=tr.WinSize.x) ||
-       (ny!=tr.WinSize.y)))
-  {
-    tr.WinSize.x = nx;
-    tr.WinSize.y = ny;
-    SendWinSize();
-  }
+	if ((tr.MyOpt[NAWS].Status==Yes) &&
+	    (nx != tr.WinSize.x || ny != tr.WinSize.y))
+	{
+		tr.WinSize.x = nx;
+		tr.WinSize.y = ny;
+		SendWinSize();
+	}
 }
 
 void TelSendAYT()
 {
-  BYTE Str[2];
+	BYTE Str[2];
 
-  Str[0] = IAC;
-  Str[1] = AYT;
-  CommRawOut(&cv,Str,2);
-  CommSend(&cv);
-  if (tr.LogFile!=0)
-    TelWriteLog(Str,2);
+	Str[0] = IAC;
+	Str[1] = AYT;
+	CommRawOut(&cv, Str, 2);
+	CommSend(&cv);
+	if (tr.LogFile)
+		TelWriteLog(Str, 2);
 }
 
 void TelSendBreak()
 {
-  BYTE Str[2];
+	BYTE Str[2];
 
-  Str[0] = IAC;
-  Str[1] = BREAK;
-  CommRawOut(&cv,Str,2);
-  CommSend(&cv);
-  if (tr.LogFile!=0)
-    TelWriteLog(Str,2);
+	Str[0] = IAC;
+	Str[1] = BREAK;
+	CommRawOut(&cv, Str, 2);
+	CommSend(&cv);
+	if (tr.LogFile)
+		TelWriteLog(Str, 2);
 }
 
 void TelChangeEcho()
 {
-  if (ts.LocalEcho==0)
-    TelEnableHisOpt(ECHO);
-  else
-    TelDisableHisOpt(ECHO);
+	if (ts.LocalEcho==0)
+		TelEnableHisOpt(ECHO);
+	else
+		TelDisableHisOpt(ECHO);
 }
 
 void TelSendNOP()
 {
-  BYTE Str[2];
+	BYTE Str[2];
 
-  Str[0] = IAC;
-  Str[1] = NOP;
-  CommRawOut(&cv,Str,2);
-  CommSend(&cv);
-  if (tr.LogFile!=0)
-    TelWriteLog(Str,2);
+	Str[0] = IAC;
+	Str[1] = NOP;
+	CommRawOut(&cv, Str, 2);
+	CommSend(&cv);
+	if (tr.LogFile)
+		TelWriteLog(Str, 2);
 }
 
 #define WM_SEND_HEARTBEAT (WM_USER + 1)
@@ -790,43 +774,36 @@
 
 static LRESULT CALLBACK telnet_heartbeat_dlg_proc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
 {
-
 	switch (msg) {
-		case WM_INITDIALOG:
-			return FALSE;
+	case WM_INITDIALOG:
+		return FALSE;
 
-		case WM_SEND_HEARTBEAT:
-			TelSendNOP();
-			return TRUE;
-			break;
+	case WM_SEND_HEARTBEAT:
+		TelSendNOP();
+		return TRUE;
+		break;
 
-		case WM_COMMAND:
-			switch (wp) {
-			}
-
-			switch (LOWORD(wp)) {
-				case IDOK:
-					{
-					return TRUE;
-					}
-
-				case IDCANCEL:
-					EndDialog(hWnd, 0);
-					return TRUE;
-				default:
-					return FALSE;
-			}
-			break;
-
-		case WM_CLOSE:
-			// close\x83{\x83^\x83\x93\x82\xAA\x89\x9F\x89\xBA\x82\xB3\x82\xEA\x82Ă\xE0 window \x82\xAA\x95‚\xB6\x82Ȃ\xA2\x82悤\x82ɂ\xB7\x82\xE9\x81B
+	case WM_COMMAND:
+		switch (LOWORD(wp)) {
+		case IDOK:
 			return TRUE;
-
-		case WM_DESTROY:
+		case IDCANCEL:
+			EndDialog(hWnd, 0);
 			return TRUE;
-
 		default:
 			return FALSE;
+		}
+		break;
+
+	case WM_CLOSE:
+		// close\x83{\x83^\x83\x93\x82\xAA\x89\x9F\x89\xBA\x82\xB3\x82\xEA\x82Ă\xE0 window \x82\xAA\x95‚\xB6\x82Ȃ\xA2\x82悤\x82ɂ\xB7\x82\xE9\x81B
+		return TRUE;
+
+	case WM_DESTROY:
+		return TRUE;
+
+	default:
+		return FALSE;
 	}
 	return TRUE;
 }
@@ -833,58 +810,58 @@
 
 
 static unsigned _stdcall TelKeepAliveThread(void *dummy) {
-  static int instance = 0;
+	static int instance = 0;
 
-  if (instance > 0)
-    return 0;
-  instance++;
+	if (instance > 0)
+		return 0;
+	instance++;
 
-  while (cv.Open && nop_interval > 0) {
-    if (time(NULL) >= cv.LastSendTime + nop_interval) {
-		SendMessage(keepalive_dialog, WM_SEND_HEARTBEAT, 0, 0);
-    }
+	while (cv.Open && nop_interval > 0) {
+		if (time(NULL) >= cv.LastSendTime + nop_interval) {
+			SendMessage(keepalive_dialog, WM_SEND_HEARTBEAT, 0, 0);
+		}
 
-    Sleep(100);
-  }
-  instance--;
-  return 0;
+		Sleep(100);
+	}
+	instance--;
+	return 0;
 }
 
 void TelStartKeepAliveThread() {
-  unsigned tid;
+	unsigned tid;
 
-  if (ts.TelKeepAliveInterval > 0) {
-    nop_interval = ts.TelKeepAliveInterval;
+	if (ts.TelKeepAliveInterval > 0) {
+		nop_interval = ts.TelKeepAliveInterval;
 
 	// \x83\x82\x81[\x83h\x83\x8C\x83X\x83_\x83C\x83A\x83\x8D\x83O\x82\xF0\x92lj\xC1 (2007.12.26 yutaka)
 	keepalive_dialog = CreateDialog(hInst, MAKEINTRESOURCE(IDD_BROADCAST_DIALOG),
-               HVTWin, (DLGPROC)telnet_heartbeat_dlg_proc);
+	                                HVTWin, (DLGPROC)telnet_heartbeat_dlg_proc);
 
-    keepalive_thread = (HANDLE)_beginthreadex(NULL, 0, TelKeepAliveThread, NULL, 0, &tid);
-    if (keepalive_thread == (HANDLE)-1) {
-      nop_interval = 0;
-    }
-  }
+		keepalive_thread = (HANDLE)_beginthreadex(NULL, 0, TelKeepAliveThread, NULL, 0, &tid);
+		if (keepalive_thread == (HANDLE)-1) {
+			nop_interval = 0;
+		}
+	}
 }
 
 void TelStopKeepAliveThread() {
-  if (keepalive_thread != (HANDLE)-1L) {
-    nop_interval = 0;
-    WaitForSingleObject(keepalive_thread, INFINITE);
-    CloseHandle(keepalive_thread);
-    keepalive_thread = (HANDLE)-1L;
+	if (keepalive_thread != (HANDLE)-1L) {
+		nop_interval = 0;
+		WaitForSingleObject(keepalive_thread, INFINITE);
+		CloseHandle(keepalive_thread);
+		keepalive_thread = (HANDLE)-1L;
 
-	DestroyWindow(keepalive_dialog);
-  }
+		DestroyWindow(keepalive_dialog);
+	}
 }
 
 void TelUpdateKeepAliveInterval() {
-  if (cv.Open && cv.TelFlag && ts.TCPPort==ts.TelPort) {
-    if (ts.TelKeepAliveInterval > 0 && keepalive_thread == (HANDLE)-1)
-      TelStartKeepAliveThread();
-    else if (ts.TelKeepAliveInterval == 0 && keepalive_thread != (HANDLE)-1)
-      TelStopKeepAliveThread();
-    else
-      nop_interval = ts.TelKeepAliveInterval;
-  }
+	if (cv.Open && cv.TelFlag && ts.TCPPort==ts.TelPort) {
+		if (ts.TelKeepAliveInterval > 0 && keepalive_thread == (HANDLE)-1)
+			TelStartKeepAliveThread();
+		else if (ts.TelKeepAliveInterval == 0 && keepalive_thread != (HANDLE)-1)
+			TelStopKeepAliveThread();
+		else
+			nop_interval = ts.TelKeepAliveInterval;
+	}
 }



Ttssh2-commit メーリングリストの案内