Skip to content

Commit

Permalink
Merge branch '#159'
Browse files Browse the repository at this point in the history
  • Loading branch information
zmatsuo committed Mar 23, 2024
2 parents c23ca86 + 4bfe3b7 commit 9635fcd
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 36 deletions.
7 changes: 4 additions & 3 deletions doc/en/html/about/history.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ <h3 id="teraterm_5.3">YYYY.MM.DD (Ver 5.3 not released yet)</h3>
<li>Misc
<ul>
<li>Added Tamil.lng language file.</li>
<li>Upgraded TTSSH to <a href="#ttssh_3.3">3.3</a>.</li>
</ul>
</li>
</ul>
Expand Down Expand Up @@ -3481,11 +3482,11 @@ <h3 id="ttssh_3.3">YYYY.MM.DD (Ver 3.3 not released yet)</h3>
</ul>
</li-->

<!--li>Misc
<li>Misc
<ul>
<li></li>
<li>If option(<a href="../commandline/ttssh.html#f">/f</a>, <a href="../commandline/ttssh.html#ssh-f">/ssh-f</a>, <a href="../commandline/ttssh.html#ssh-consume">/ssh-consume</a>, <a href="../commandline/ttssh.html#keyfile">/keyfile</a>) argument file name is not absolute path, modify it to be treated as a relative path from %APPDATA%\teraterm5\.</li>
</ul>
</li-->
</li>
</ul>

<h3 id="ttssh_3.2">2024.2.29 (Ver 3.2)</h3>
Expand Down
8 changes: 4 additions & 4 deletions doc/en/html/commandline/ttssh.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,19 @@ <h2>Options</h2>
<dt id="f">/f=&lt;file&gt;</dt>
<dd>
read teraterm.ini(file)<br>
If this value is not a full path, it is understood as a relative path from ttxssh.dll.
If this value is not a full path, it is understood as a relative path from <a href="../setup/folder.html">configuration file folder</a>.
</dd>

<dt id="ssh-f">/ssh-f=&lt;file&gt;</dt>
<dd>
read teraterm.ini(file)<br>
If this value is not a full path, it is understood as a relative path from ttxssh.dll.
If this value is not a full path, it is understood as a relative path from <a href="../setup/folder.html">configuration file folder</a>.
</dd>

<dt id="ssh-consume">/ssh-consume=&lt;file&gt;</dt>
<dd>
After teraterm.ini file is read, it is erased.<br>
If this value is not a full path, it is understood as a relative path from ttxssh.dll.
If this value is not a full path, it is understood as a relative path from <a href="../setup/folder.html">configuration file folder</a>.
</dd>

<dt id="t">/t=&lt;value&gt;</dt>
Expand Down Expand Up @@ -96,7 +96,7 @@ <h2>Options</h2>
<dt id="keyfile">/keyfile=&lt;file&gt;</dt>
<dd>
your private key file is specified<br>
When the file name is not the absolute path, the file is identified as the relative path.
If this value is not a full path, it is understood as a relative path from <a href="../setup/folder.html">configuration file folder</a>.
</dd>

<dt id="ask4passwd">/ask4passwd</dt>
Expand Down
7 changes: 4 additions & 3 deletions doc/ja/html/about/history.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ <h3 id="teraterm_5.3">YYYY.MM.DD (Ver 5.3 not released yet)</h3>
<li>その他
<ul>
<li>言語ファイルにタミル語(Tamil.lng)を追加した。</li>
<li><a href="#ttssh_3.3">TTSSH(3.3)</a>へ差し替えた。</li>
</ul>
</li>
</ul>
Expand Down Expand Up @@ -3477,11 +3478,11 @@ <h2 id="ttssh">TTSSH</h2>

<h3 id="ttssh_3.3">YYYY.MM.DD (Ver 3.3 not released yet)</h3>
<ul class="history">
<!--li>変更
<li>変更
<ul>
<li></li>
<li>オプション(<a href="../commandline/ttssh.html#f">/f</a>, <a href="../commandline/ttssh.html#ssh-f">/ssh-f</a>, <a href="../commandline/ttssh.html#ssh-consume">/ssh-consume</a>, <a href="../commandline/ttssh.html#keyfile">/keyfile</a>)のファイル名が絶対パスでないときは、%APPDATA%\teraterm5\ からの相対パスとして扱うように変更した。</li>
</ul>
</li-->
</li>

<!--li>バグ修正
<ul>
Expand Down
8 changes: 4 additions & 4 deletions doc/ja/html/commandline/ttssh.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,19 @@ <h1>TTSSH command line</h1>
<dt id="f">/f=&lt;file&gt;</dt>
<dd>
teraterm.iniファイル(file)を読み込む<br>
ファイル名が絶対パスでないときは、ttxssh.dll からの相対パスと見なされます。
ファイル名が絶対パスでないときは、<a href="../setup/folder.html">設定ファイルフォルダ</a>からの相対パスと見なされます。
</dd>

<dt id="ssh-f">/ssh-f=&lt;file&gt;</dt>
<dd>
teraterm.iniファイル(file)を読み込む<br>
ファイル名が絶対パスでないときは、ttxssh.dll からの相対パスと見なされます。
ファイル名が絶対パスでないときは、<a href="../setup/folder.html">設定ファイルフォルダ</a>からの相対パスと見なされます。
</dd>

<dt id="ssh-consume">/ssh-consume=&lt;file&gt;</dt>
<dd>
teraterm.iniファイル(file)の読み込み後、当該ファイルを削除する。<br>
ファイル名が絶対パスでないときは、ttxssh.dll からの相対パスと見なされます。
ファイル名が絶対パスでないときは、<a href="../setup/folder.html">設定ファイルフォルダ</a>からの相対パスと見なされます。
</dd>

<dt id="t">/t=&lt;value&gt;</dt>
Expand Down Expand Up @@ -96,7 +96,7 @@ <h1>TTSSH command line</h1>
<dt id="keyfile">/keyfile=&lt;file&gt;</dt>
<dd>
秘密鍵を指定する<br>
ファイル名が絶対パスでないときは、ttxssh.dll からの相対パスと見なされます。
ファイル名が絶対パスでないときは、<a href="../setup/folder.html">設定ファイルフォルダ</a>からの相対パスと見なされます。
</dd>

<dt id="ask4passwd">/ask4passwd</dt>
Expand Down
34 changes: 14 additions & 20 deletions ttssh2/ttxssh/ttxssh.c
Original file line number Diff line number Diff line change
Expand Up @@ -1362,15 +1362,11 @@ static void PASCAL TTXWriteINIFile(const wchar_t *fileName, PTTSet ts)
static void read_ssh_options_from_user_file(PTInstVar pvar,
const wchar_t *user_file_name)
{
if (user_file_name[0] == '.') {
read_ssh_options(pvar, user_file_name);
} else {
wchar_t *fname;
wchar_t *fname;

fname = get_teraterm_dir_relative_nameW(user_file_name);
read_ssh_options(pvar, fname);
free(fname);
}
fname = get_home_dir_relative_nameW(user_file_name);
read_ssh_options(pvar, fname);
free(fname);

pvar->settings = *pvar->ts_SSH;
FWDUI_load_settings(pvar);
Expand Down Expand Up @@ -1664,7 +1660,10 @@ static void PASCAL TTXParseParam(wchar_t *param, PTTSet ts, PCHAR DDETopic)
WideCharToACP_t(option + 8, pvar->ssh2_password, sizeof(pvar->ssh2_password));

} else if (wcsncmp(option + 1, L"keyfile=", 8) == 0) {
WideCharToACP_t(option + 9, pvar->ssh2_keyfile, sizeof(pvar->ssh2_keyfile));
wchar_t *keyfileW = option + 9;
keyfileW = get_home_dir_relative_nameW(keyfileW);
WideCharToACP_t(keyfileW, pvar->ssh2_keyfile, sizeof(pvar->ssh2_keyfile));
free(keyfileW);

} else if (wcscmp(option + 1, L"ask4passwd") == 0) {
// パスワードを聞く (2006.9.18 maya)
Expand Down Expand Up @@ -2068,7 +2067,7 @@ static void about_dlg_set_abouttext(PTInstVar pvar, HWND dlg, digest_algorithm d

static void init_about_dlg(PTInstVar pvar, HWND dlg)
{
char buf[1024], tmpbuf[128];
char buf[1024];
static const DlgTextInfo text_info[] = {
{ 0, "DLG_ABOUT_TITLE" },
{ IDC_FP_HASH_ALG, "DLG_ABOUT_FP_HASH_ALGORITHM" },
Expand Down Expand Up @@ -2475,8 +2474,7 @@ wchar_t *get_teraterm_dir_relative_nameW(const wchar_t *basename)
wchar_t *path;
wchar_t *ret;

if (basename[0] == '\\' || basename[0] == '/'
|| (basename[0] != 0 && basename[1] == ':')) {
if (!IsRelativePathW(basename)) {
return _wcsdup(basename);
}

Expand All @@ -2487,15 +2485,13 @@ wchar_t *get_teraterm_dir_relative_nameW(const wchar_t *basename)
return ret;
}

void get_teraterm_dir_relative_name(char *buf, int bufsize,
char *basename)
void get_teraterm_dir_relative_name(char *buf, int bufsize, const char *basename)
{
int filename_start = 0;
int i;
int ch;

if (basename[0] == '\\' || basename[0] == '/'
|| (basename[0] != 0 && basename[1] == ':')) {
if (!IsRelativePathA(basename)) {
strncpy_s(buf, bufsize, basename, _TRUNCATE);
return;
}
Expand All @@ -2512,16 +2508,14 @@ void get_teraterm_dir_relative_name(char *buf, int bufsize,
}
}

int copy_teraterm_dir_relative_path(char *dest, int destsize,
char *basename)
int copy_teraterm_dir_relative_path(char *dest, int destsize, const char *basename)
{
char buf[1024];
int filename_start = 0;
int i;
int ch, ch2;

if (basename[0] != '\\' && basename[0] != '/'
&& (basename[0] == 0 || basename[1] != ':')) {
if (!IsRelativePathA(basename)) {
strncpy_s(dest, destsize, basename, _TRUNCATE);
return strlen(dest);
}
Expand Down
4 changes: 2 additions & 2 deletions ttssh2/ttxssh/ttxssh.h
Original file line number Diff line number Diff line change
Expand Up @@ -400,9 +400,9 @@ void logprintf(int level, const char *fmt, ...);
void logprintf_hexdump(int level, const char *data, int len, const char *fmt, ...);
#endif

void get_teraterm_dir_relative_name(char *buf, int bufsize, char *basename);
void get_teraterm_dir_relative_name(char *buf, int bufsize, const char *basename);
wchar_t *get_teraterm_dir_relative_nameW(const wchar_t *basename);
int copy_teraterm_dir_relative_path(char *dest, int destsize, char *basename);
int copy_teraterm_dir_relative_path(char *dest, int destsize, const char *basename);
wchar_t *get_home_dir_relative_nameW(const wchar_t *basename);
wchar_t *get_log_dir_relative_nameW(const wchar_t *basename);
int uuencode(unsigned char *src, int srclen, unsigned char *target, int targsize);
Expand Down

0 comments on commit 9635fcd

Please sign in to comment.