svnno****@sourc*****
svnno****@sourc*****
2011年 7月 31日 (日) 15:10:17 JST
Revision: 4555 http://sourceforge.jp/projects/ttssh2/svn/view?view=rev&revision=4555 Author: maya Date: 2011-07-31 15:10:17 +0900 (Sun, 31 Jul 2011) Log Message: ----------- ãã¼ã¸ã§ã³ãå¤æ´ããã¦ããªãå ´åã«ã¯puttyversion.hãæ´æ°ããªãããã«ãã Modified Paths: -------------- trunk/ttssh2/puttyrev/puttyrev.cpp -------------- next part -------------- Modified: trunk/ttssh2/puttyrev/puttyrev.cpp =================================================================== --- trunk/ttssh2/puttyrev/puttyrev.cpp 2011-07-31 03:56:12 UTC (rev 4554) +++ trunk/ttssh2/puttyrev/puttyrev.cpp 2011-07-31 06:10:17 UTC (rev 4555) @@ -28,6 +28,7 @@ int i; CString filename, buf, cs; char revision[64] = {0}; + char header_line[64], *p; // PuTTYÌo[Wðæ¾·éB filename = path; @@ -54,11 +55,35 @@ close: csf.Close(); -write: - // o[Wðwb_É«ÞB filename = path; filename += "\\ttssh2\\ttxssh\\puttyversion.h"; + // o[Wð`FbNµAÏXªÈ¯êβ¯é + ret = csf.Open(filename, CFile::modeRead); + if (ret == FALSE) { + goto write; + } + + if (csf.ReadString(header_line, sizeof(header_line)) == NULL) { + csf.Close(); + goto write; + } + + if ( (p = strchr(header_line, '"')) == NULL ) { + csf.Close(); + goto write; + } + + p++; + if (strncmp(p, revision, strlen(p)-2) == 0) { + csf.Close(); + goto end; + } + + csf.Close(); + +write: + // o[Wðwb_É«ÞB ret = csf.Open(filename, CFile::modeWrite | CFile::modeCreate); if (ret == FALSE) { goto end;