FFFTPのソースコードです。
Revisão | 588770f0bf195f785550d1066c747839530d2d24 (tree) |
---|---|
Hora | 2012-01-26 12:37:07 |
Autor | Yuji Tanaka <chibi_honu@user...> |
Commiter | Yuji Tanaka |
Fix bugs of InitCmd and simultaneous connection.
@@ -1599,7 +1599,9 @@ int DoSIZE(SOCKET cSkt, char *Path, LONGLONG *Size, int *CancelCheckWork); | ||
1599 | 1599 | // 同時接続対応 |
1600 | 1600 | //int DoMDTM(char *Path, FILETIME *Time); |
1601 | 1601 | int DoMDTM(SOCKET cSkt, char *Path, FILETIME *Time, int *CancelCheckWork); |
1602 | -int DoQUOTE(char *CmdStr); | |
1602 | +// 同時接続対応 | |
1603 | +//int DoQUOTE(char *CmdStr); | |
1604 | +int DoQUOTE(SOCKET cSkt, char *CmdStr); | |
1603 | 1605 | SOCKET DoClose(SOCKET Sock); |
1604 | 1606 | int DoQUIT(SOCKET ctrl_skt); |
1605 | 1607 | int DoDirListCmdSkt(char *AddOpt, char *Path, int Num, int *CancelCheckWork); |
@@ -57,7 +57,9 @@ | ||
57 | 57 | // 64ビット対応 |
58 | 58 | //static BOOL CALLBACK QuickConDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam); |
59 | 59 | static INT_PTR CALLBACK QuickConDialogCallBack(HWND hDlg, UINT iMessage, WPARAM wParam, LPARAM lParam); |
60 | -static int SendInitCommand(char *Cmd); | |
60 | +// 同時接続対応 | |
61 | +//static int SendInitCommand(char *Cmd); | |
62 | +static int SendInitCommand(SOCKET Socket, char *Cmd); | |
61 | 63 | static void AskUseFireWall(char *Host, int *Fire, int *Pasv, int *List); |
62 | 64 | static void SaveCurrentSetToHistory(void); |
63 | 65 | static int ReConnectSkt(SOCKET *Skt); |
@@ -238,7 +240,7 @@ void ConnectProc(int Type, int Num) | ||
238 | 240 | DispWindowTitle(); |
239 | 241 | SoundPlay(SND_CONNECT); |
240 | 242 | |
241 | - SendInitCommand(CurHost.InitCmd); | |
243 | + SendInitCommand(CmdCtrlSocket, CurHost.InitCmd); | |
242 | 244 | |
243 | 245 | if(strlen(CurHost.LocalInitDir) > 0) |
244 | 246 | { |
@@ -609,7 +611,7 @@ void HistoryConnectProc(int MenuCmd) | ||
609 | 611 | DispWindowTitle(); |
610 | 612 | SoundPlay(SND_CONNECT); |
611 | 613 | |
612 | - SendInitCommand(CurHost.InitCmd); | |
614 | + SendInitCommand(CmdCtrlSocket, CurHost.InitCmd); | |
613 | 615 | |
614 | 616 | DoLocalCWD(CurHost.LocalInitDir); |
615 | 617 | GetLocalDirForWnd(); |
@@ -648,7 +650,7 @@ void HistoryConnectProc(int MenuCmd) | ||
648 | 650 | * cmd1\r\ncmd2\r\n\0 |
649 | 651 | *----------------------------------------------------------------------------*/ |
650 | 652 | |
651 | -static int SendInitCommand(char *Cmd) | |
653 | +static int SendInitCommand(SOCKET Socket, char *Cmd) | |
652 | 654 | { |
653 | 655 | char Tmp[INITCMD_LEN+1]; |
654 | 656 | char *Pos; |
@@ -659,7 +661,7 @@ static int SendInitCommand(char *Cmd) | ||
659 | 661 | if((Pos = strchr(Tmp, '\r')) != NULL) |
660 | 662 | *Pos = NUL; |
661 | 663 | if(strlen(Tmp) > 0) |
662 | - DoQUOTE(Tmp); | |
664 | + DoQUOTE(Socket, Tmp); | |
663 | 665 | |
664 | 666 | if((Cmd = strchr(Cmd, '\n')) != NULL) |
665 | 667 | Cmd++; |
@@ -1106,7 +1108,7 @@ int ReConnectTrnSkt(SOCKET *Skt, int *CancelCheckWork) | ||
1106 | 1108 | // if((*Skt = DoConnect(CurHost.HostAdrs, CurHost.UserName, CurHost.PassWord, CurHost.Account, CurHost.Port, CurHost.FireWall, NO, CurHost.Security)) != INVALID_SOCKET) |
1107 | 1109 | if((*Skt = DoConnect(&HostData, CurHost.HostAdrs, CurHost.UserName, CurHost.PassWord, CurHost.Account, CurHost.Port, CurHost.FireWall, NO, CurHost.Security, CancelCheckWork)) != INVALID_SOCKET) |
1108 | 1110 | { |
1109 | - SendInitCommand(CurHost.InitCmd); | |
1111 | + SendInitCommand(*Skt, CurHost.InitCmd); | |
1110 | 1112 | // AskRemoteCurDir(Path, FMAX_PATH); |
1111 | 1113 | // DoCWD(Path, YES, YES, YES); |
1112 | 1114 | Sts = FFFTP_SUCCESS; |
@@ -1148,7 +1150,7 @@ static int ReConnectSkt(SOCKET *Skt) | ||
1148 | 1150 | // if((*Skt = DoConnect(CurHost.HostAdrs, CurHost.UserName, CurHost.PassWord, CurHost.Account, CurHost.Port, CurHost.FireWall, NO, CurHost.Security)) != INVALID_SOCKET) |
1149 | 1151 | if((*Skt = DoConnect(&CurHost, CurHost.HostAdrs, CurHost.UserName, CurHost.PassWord, CurHost.Account, CurHost.Port, CurHost.FireWall, NO, CurHost.Security, &CancelFlg)) != INVALID_SOCKET) |
1150 | 1152 | { |
1151 | - SendInitCommand(CurHost.InitCmd); | |
1153 | + SendInitCommand(*Skt, CurHost.InitCmd); | |
1152 | 1154 | AskRemoteCurDir(Path, FMAX_PATH); |
1153 | 1155 | DoCWD(Path, YES, YES, YES); |
1154 | 1156 | Sts = FFFTP_SUCCESS; |
@@ -1358,6 +1360,13 @@ int AskRealHostType(void) | ||
1358 | 1360 | |
1359 | 1361 | int SetOSS(int wkOss) |
1360 | 1362 | { |
1363 | + if(Oss != wkOss) { | |
1364 | + if (wkOss == YES) { | |
1365 | + strcpy(CurHost.InitCmd, "OSS"); | |
1366 | + } else { | |
1367 | + strcpy(CurHost.InitCmd, "GUARDIAN"); | |
1368 | + } | |
1369 | + } | |
1361 | 1370 | Oss = wkOss; |
1362 | 1371 | return(Oss); |
1363 | 1372 | } |
@@ -3073,7 +3073,9 @@ void SomeCmdProc(void) | ||
3073 | 3073 | |
3074 | 3074 | if(InputDialogBox(somecmd_dlg, GetMainHwnd(), NULL, Cmd, 81, &Tmp, IDH_HELP_TOPIC_0000023) == YES) |
3075 | 3075 | { |
3076 | - DoQUOTE(Cmd); | |
3076 | + // 同時接続対応 | |
3077 | + //DoQUOTE(Cmd); | |
3078 | + DoQUOTE(AskCmdCtrlSkt(), Cmd); | |
3077 | 3079 | } |
3078 | 3080 | EnableUserOpe(); |
3079 | 3081 | } |
@@ -468,11 +468,14 @@ int DoMDTM(SOCKET cSkt, char *Path, FILETIME *Time, int *CancelCheckWork) | ||
468 | 468 | * int 応答コードの1桁目 |
469 | 469 | *----------------------------------------------------------------------------*/ |
470 | 470 | |
471 | -int DoQUOTE(char *CmdStr) | |
471 | +// 同時接続対応 | |
472 | +//int DoQUOTE(char *CmdStr) | |
473 | +int DoQUOTE(SOCKET cSkt, char *CmdStr) | |
472 | 474 | { |
473 | - int Sts; | |
475 | + int Sts, CancelCheckWork; | |
474 | 476 | |
475 | - Sts = CommandProcCmd(NULL, "%s", CmdStr); | |
477 | + CancelCheckWork = NO; | |
478 | + Sts = CommandProcTrn(cSkt, NULL, &CancelCheckWork, "%s", CmdStr); | |
476 | 479 | |
477 | 480 | if(Sts/100 >= FTP_CONTINUE) |
478 | 481 | SoundPlay(SND_ERROR); |
@@ -701,10 +704,10 @@ void SwitchOSSProc(void) | ||
701 | 704 | |
702 | 705 | /* DoPWD でノード名の \ を保存するために OSSフラグも変更する */ |
703 | 706 | if(AskOSS() == YES) { |
704 | - DoQUOTE("GUARDIAN"); | |
707 | + DoQUOTE(AskCmdCtrlSkt(), "GUARDIAN"); | |
705 | 708 | SetOSS(NO); |
706 | 709 | } else { |
707 | - DoQUOTE("OSS"); | |
710 | + DoQUOTE(AskCmdCtrlSkt(), "OSS"); | |
708 | 711 | SetOSS(YES); |
709 | 712 | } |
710 | 713 | /* Current Dir 再取得 */ |
@@ -721,7 +724,9 @@ void SwitchOSSProc(void) | ||
721 | 724 | /*----- リモート側へコマンドを送りリプライを待つ(転送ソケット)--------------- |
722 | 725 | * |
723 | 726 | * Parameter |
727 | +* SOCKET cSkt : ソケット | |
724 | 728 | * char *Reply : リプライのコピー先 (NULL=コピーしない) |
729 | +* int *CancelCheckWork : | |
725 | 730 | * char *fmt : フォーマット文字列 |
726 | 731 | * ... : パラメータ |
727 | 732 | * |