svnno****@sourc*****
svnno****@sourc*****
2016年 2月 9日 (火) 12:37:31 JST
Revision: 6292 http://sourceforge.jp/projects/ttssh2/scm/svn/commits/6292 Author: doda Date: 2016-02-09 12:37:30 +0900 (Tue, 09 Feb 2016) Log Message: ----------- HOME_CHDIR/-cd より -d でのディレクトリ指定を優先するようにした。 Modified Paths: -------------- trunk/cygterm/cygterm.cc -------------- next part -------------- Modified: trunk/cygterm/cygterm.cc =================================================================== --- trunk/cygterm/cygterm.cc 2016-02-09 02:36:43 UTC (rev 6291) +++ trunk/cygterm/cygterm.cc 2016-02-09 03:37:30 UTC (rev 6292) @@ -987,19 +987,20 @@ for (e = sh_env.next; e != NULL; e = e->next) { putenv(e->env); } - if (home_chdir) { - // chdir to home directory - const char *home_dir = getenv("HOME"); - // ignore chdir(2) system-call error. - chdir(home_dir); - } - else if (change_dir[0] != 0) { + // change directory + if (change_dir[0] != 0) { if (chdir(change_dir) < 0) { char tmp[256]; snprintf(tmp, 256, "Can't chdir to \"%s\".", change_dir); c_error(tmp); } } + else if (home_chdir) { + // chdir to home directory + const char *home_dir = getenv("HOME"); + // ignore chdir(2) system-call error. + chdir(home_dir); + } // execute a shell char *argv[32]; get_argv(argv, 32, cmd_shell); @@ -1313,6 +1314,13 @@ return 0; } + if (change_dir[0] != 0) { + home_chdir = false; + if (enable_loginshell) { + add_env(&sh_envp, "CHERE_INVOKING=y", NULL); + } + } + // terminal side connection if (cl_port > 0) { // connect to the specified TCP port