puttyrev を削除
- putty のバージョンをヘッダに書き出すツール
- 使用しなくなった
@@ -7,13 +7,8 @@ | ||
7 | 7 | add_subdirectory(matcher) |
8 | 8 | set_target_properties(matcher PROPERTIES FOLDER ttssh2) |
9 | 9 | |
10 | -# config時に cmake で puttyversion.h を生成するようにした | |
11 | -#add_subdirectory(puttyrev) | |
12 | -#set_target_properties(puttyrev PROPERTIES FOLDER ttssh2) | |
13 | - | |
14 | 10 | add_subdirectory(putty) |
15 | 11 | set_target_properties(libputty PROPERTIES FOLDER ttssh2) |
16 | 12 | |
17 | 13 | add_subdirectory(argon2) |
18 | 14 | set_target_properties(argon2 PROPERTIES FOLDER ttssh2) |
19 | - |
@@ -1,13 +0,0 @@ | ||
1 | -project(puttyrev) | |
2 | - | |
3 | -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/") | |
4 | - | |
5 | -set(SRC | |
6 | - puttyrev.h | |
7 | - puttyrev.cpp | |
8 | - ) | |
9 | - | |
10 | -add_executable( | |
11 | - puttyrev | |
12 | - ${SRC} | |
13 | - ) |
@@ -1 +0,0 @@ | ||
1 | -#pragma once |
@@ -1,141 +0,0 @@ | ||
1 | -/* | |
2 | - * (C) 2004- TeraTerm Project | |
3 | - * All rights reserved. | |
4 | - * | |
5 | - * Redistribution and use in source and binary forms, with or without | |
6 | - * modification, are permitted provided that the following conditions | |
7 | - * are met: | |
8 | - * | |
9 | - * 1. Redistributions of source code must retain the above copyright | |
10 | - * notice, this list of conditions and the following disclaimer. | |
11 | - * 2. Redistributions in binary form must reproduce the above copyright | |
12 | - * notice, this list of conditions and the following disclaimer in the | |
13 | - * documentation and/or other materials provided with the distribution. | |
14 | - * 3. The name of the author may not be used to endorse or promote products | |
15 | - * derived from this software without specific prior written permission. | |
16 | - * | |
17 | - * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR | |
18 | - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
19 | - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
20 | - * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, | |
21 | - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
22 | - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
23 | - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
24 | - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
25 | - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
26 | - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
27 | - */ | |
28 | -#include <windows.h> | |
29 | -#include <stdio.h> | |
30 | -#include "puttyrev.h" | |
31 | - | |
32 | -void write_putty_version(char *path) | |
33 | -{ | |
34 | - BOOL ret; | |
35 | - FILE *fp; | |
36 | - char *keywords[] = { | |
37 | - //"AppVerName", | |
38 | - "AppVersion", | |
39 | - "VersionInfoTextVersion", | |
40 | - NULL, | |
41 | - }; | |
42 | - int i; | |
43 | - char filename[MAX_PATH * 2], buf[64]; | |
44 | - char revision[64] = {0}; | |
45 | - char header_line[64]= {0}, *p; | |
46 | - | |
47 | - // PuTTYのバージョンを取得する。 | |
48 | - _snprintf_s(filename, sizeof(filename), _TRUNCATE, | |
49 | - "%s%s", path, "\\libs\\putty\\windows\\putty.iss"); | |
50 | - | |
51 | - if (fopen_s(&fp, filename, "r") != 0) { | |
52 | - goto write; | |
53 | - } | |
54 | - | |
55 | - while(!feof(fp)){ | |
56 | - char tmp[64]; | |
57 | - fgets(buf, sizeof(buf), fp); | |
58 | - for (i = 0 ; keywords[i] ; i++) { | |
59 | - _snprintf_s(tmp, sizeof(tmp), _TRUNCATE, | |
60 | - "%s%s", keywords[i], "=%[^\n]s"); | |
61 | - ret = sscanf_s(buf, tmp, revision, sizeof(revision)); | |
62 | - if (ret != 1) | |
63 | - continue; | |
64 | - printf("%s\n", revision); | |
65 | - goto close; | |
66 | - } | |
67 | - } | |
68 | - | |
69 | -close: | |
70 | - fclose(fp); | |
71 | - | |
72 | - _snprintf_s(filename, sizeof(filename), _TRUNCATE, | |
73 | - "%s%s", path, "\\ttssh2\\ttxssh\\puttyversion.h"); | |
74 | - | |
75 | - // バージョンをチェックし、変更がなければ抜ける | |
76 | - if (fopen_s(&fp, filename, "r") != 0) { | |
77 | - goto write; | |
78 | - } | |
79 | - | |
80 | - memset(header_line, 0, sizeof(header_line)); | |
81 | - if (fread(header_line, sizeof(char), sizeof(header_line)-1, fp) == 0) { | |
82 | - fclose(fp); | |
83 | - goto write; | |
84 | - } | |
85 | - | |
86 | - if ( (p = strchr(header_line, '"')) == NULL ) { | |
87 | - fclose(fp); | |
88 | - goto write; | |
89 | - } | |
90 | - | |
91 | - p++; | |
92 | - if (strncmp(p, revision, strlen(p)-2) == 0) { | |
93 | - fclose(fp); | |
94 | - goto end; | |
95 | - } | |
96 | - | |
97 | - fclose(fp); | |
98 | - | |
99 | -write: | |
100 | - _snprintf_s(filename, sizeof(filename), _TRUNCATE, | |
101 | - "%s%s", path, "\\ttssh2\\ttxssh\\puttyversion.h"); | |
102 | - | |
103 | - // バージョンをヘッダに書き込む。 | |
104 | - if (fopen_s(&fp, filename, "w+") != 0) { | |
105 | - goto end; | |
106 | - } | |
107 | - | |
108 | - if (revision[0] != '\0') { | |
109 | - fprintf(fp, "#define PUTTYVERSION \"%s\"\n", revision); | |
110 | - } | |
111 | - else { | |
112 | - fprintf(fp, "#undef PUTTYVERSION\n"); | |
113 | - } | |
114 | - | |
115 | - fclose(fp); | |
116 | - | |
117 | -end:; | |
118 | -} | |
119 | - | |
120 | -int main(int argc, char* argv[]) | |
121 | -{ | |
122 | - int nRetCode = 0; | |
123 | - char path[MAX_PATH * 2]; | |
124 | - int i, len; | |
125 | - | |
126 | - GetModuleFileName(::GetModuleHandle(NULL), path, sizeof(path)); | |
127 | - len = (int)strlen(path); | |
128 | - for (i=len; i>=0; i--) { | |
129 | - if (path[i] == '\\') { | |
130 | - break; | |
131 | - } | |
132 | - path[i] = '\0'; | |
133 | - } | |
134 | - SetCurrentDirectory(path); // teraterm\debug or teraterm\release | |
135 | - SetCurrentDirectory("..\\..\\..\\"); // top of source tree | |
136 | - GetCurrentDirectory(sizeof(path), path); | |
137 | - | |
138 | - write_putty_version(path); | |
139 | - | |
140 | - return nRetCode; | |
141 | -} |