OSDN Git Service

2244517609842baf8351fee0649803b806701824
[ffftp/ffftp.git] / remote.c
1 /*=============================================================================\r
2 *\r
3 *                                                       \83\8a\83\82\81[\83g\91¤\82Ì\83t\83@\83C\83\8b\91\80\8dì\r
4 *\r
5 ===============================================================================\r
6 / Copyright (C) 1997-2007 Sota. All rights reserved.\r
7 /\r
8 / Redistribution and use in source and binary forms, with or without \r
9 / modification, are permitted provided that the following conditions \r
10 / are met:\r
11 /\r
12 /  1. Redistributions of source code must retain the above copyright \r
13 /     notice, this list of conditions and the following disclaimer.\r
14 /  2. Redistributions in binary form must reproduce the above copyright \r
15 /     notice, this list of conditions and the following disclaimer in the \r
16 /     documentation and/or other materials provided with the distribution.\r
17 /\r
18 / THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR \r
19 / IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES \r
20 / OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \r
21 / IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, \r
22 / INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, \r
23 / BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF \r
24 / USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON \r
25 / ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT \r
26 / (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF \r
27 / THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
28 /============================================================================*/\r
29 \r
30 /* \82±\82Ì\83\\81[\83X\82Í\88ê\95\94\81AWS_FTP Version 93.12.05 \82Ì\83\\81[\83X\82ð\8eQ\8dl\82É\82µ\82Ü\82µ\82½\81B */\r
31 \r
32 #define STRICT\r
33 #include <stdio.h>\r
34 #include <stdlib.h>\r
35 #include <stdarg.h>\r
36 #include <string.h>\r
37 #include <mbstring.h>\r
38 #include <time.h>\r
39 #include <winsock.h>\r
40 #include <windowsx.h>\r
41 #include <commctrl.h>\r
42 \r
43 #include "common.h"\r
44 #include "resource.h"\r
45 \r
46 #define PWD_XPWD                0\r
47 #define PWD_PWD                 1\r
48 \r
49 /*===== \83v\83\8d\83g\83^\83C\83v =====*/\r
50 \r
51 static int DoPWD(char *Buf);\r
52 static int ReadOneLine(SOCKET cSkt, char *Buf, int Max, int *CancelCheckWork);\r
53 static int DoDirList(HWND hWnd, SOCKET cSkt, char *AddOpt, char *Path, int Num, int *CancelCheckWork);\r
54 static void ChangeSepaLocal2Remote(char *Fname);\r
55 static void ChangeSepaRemote2Local(char *Fname);\r
56 \r
57 /*===== \8aO\95\94\8eQ\8fÆ =====*/\r
58 \r
59 extern TRANSPACKET MainTransPkt;\r
60 \r
61 /* \90Ý\92è\92l */\r
62 extern int TimeOut;\r
63 extern int SendQuit;\r
64 \r
65 /*===== \83\8d\81[\83J\83\8b\82È\83\8f\81[\83N =====*/\r
66 \r
67 static int PwdCommandType;\r
68 \r
69 static int CheckCancelFlg = NO;\r
70 \r
71 \r
72 \r
73 /*----- \83\8a\83\82\81[\83g\91¤\82Ì\83J\83\8c\83\93\83g\83f\83B\83\8c\83N\83g\83\8a\95Ï\8dX ----------------------------------\r
74 *\r
75 *       Parameter\r
76 *               char *Path : \83p\83X\96¼\r
77 *               int Disp : \83f\83B\83\8c\83N\83g\83\8a\83\8a\83X\83g\82É\83p\83X\96¼\82ð\95\\8e¦\82·\82é\82©\82Ç\82¤\82©(YES/NO)\r
78 *               int ForceGet : \8e¸\94s\82µ\82Ä\82à\83J\83\8c\83\93\83g\83f\83B\83\8c\83N\83g\83\8a\82ð\8eæ\93¾\82·\82é\r
79 *               int ErrorBell : \83G\83\89\81[\8e\96\82Ì\89¹\82ð\96Â\82ç\82·\82©\82Ç\82¤\82©(YES/NO)\r
80 *\r
81 *       Return Value\r
82 *               int \89\9e\93\9a\83R\81[\83h\82Ì\82P\8c\85\96Ú\r
83 *----------------------------------------------------------------------------*/\r
84 \r
85 int DoCWD(char *Path, int Disp, int ForceGet, int ErrorBell)\r
86 {\r
87         int Sts;\r
88         char Buf[FMAX_PATH+1];\r
89 \r
90         Sts = FTP_COMPLETE * 100;\r
91 \r
92         if(strcmp(Path, "..") == 0)\r
93                 Sts = CommandProcCmd(NULL, "CDUP");\r
94         else if(strcmp(Path, "") != 0)\r
95         {\r
96                 if((AskHostType() != HTYPE_VMS) || (strchr(Path, '[') != NULL))\r
97                         Sts = CommandProcCmd(NULL, "CWD %s", Path);\r
98                 else\r
99                         Sts = CommandProcCmd(NULL, "CWD [.%s]", Path);  /* VMS\97p */\r
100         }\r
101 \r
102         if((Sts/100 >= FTP_CONTINUE) && (ErrorBell == YES))\r
103                 SoundPlay(SND_ERROR);\r
104 \r
105         if((Sts/100 == FTP_COMPLETE) ||\r
106            (ForceGet == YES))\r
107         {\r
108                 if(Disp == YES)\r
109                 {\r
110                         if(DoPWD(Buf) != FTP_COMPLETE)\r
111                         {\r
112                                 /*===== PWD\82ª\8eg\82¦\82È\82©\82Á\82½\8fê\8d\87 =====*/\r
113 \r
114                                 if(*Path == '/')\r
115                                         strcpy(Buf, Path);\r
116                                 else\r
117                                 {\r
118                                         AskRemoteCurDir(Buf, FMAX_PATH);\r
119                                         if(strlen(Buf) == 0)\r
120                                                 strcpy(Buf, "/");\r
121 \r
122                                         while(*Path != NUL)\r
123                                         {\r
124                                                 if(strcmp(Path, ".") == 0)\r
125                                                         Path++;\r
126                                                 else if(strncmp(Path, "./", 2) == 0)\r
127                                                         Path += 2;\r
128                                                 else if(strcmp(Path, "..") == 0)\r
129                                                 {\r
130                                                         GetUpperDir(Buf);\r
131                                                         Path += 2;\r
132                                                 }\r
133                                                 else if(strncmp(Path, "../", 2) == 0)\r
134                                                 {\r
135                                                         GetUpperDir(Buf);\r
136                                                         Path += 3;\r
137                                                 }\r
138                                                 else\r
139                                                 {\r
140                                                         SetSlashTail(Buf);\r
141                                                         strcat(Buf, Path);\r
142                                                         break;\r
143                                                 }\r
144                                         }\r
145                                 }\r
146                         }\r
147                         SetRemoteDirHist(Buf);\r
148                 }\r
149         }\r
150         return(Sts/100);\r
151 }\r
152 \r
153 \r
154 \r
155 \r
156 /*----- \83\8a\83\82\81[\83g\91¤\82Ì\83J\83\8c\83\93\83g\83f\83B\83\8c\83N\83g\83\8a\95Ï\8dX\81i\82»\82Ì\82Q\81j-------------------------\r
157 *\r
158 *       Parameter\r
159 *               char *Path : \83p\83X\96¼\r
160 *               char *Cur : \83J\83\8c\83\93\83g\83f\83B\83\8c\83N\83g\83\8a\r
161 *\r
162 *       Return Value\r
163 *               int \89\9e\93\9a\83R\81[\83h\82Ì\82P\8c\85\96Ú\r
164 *\r
165 *       Note\r
166 *               \83p\83X\96¼\82Í "xxx/yyy/zzz" \82Ì\8c`\8e®\r
167 *               \83f\83B\83\8c\83N\83g\83\8a\95Ï\8dX\82ª\8e¸\94s\82µ\82½\82ç\81A\83J\83\8c\83\93\83g\83f\83B\83\8c\83N\83g\83\8a\82É\96ß\82µ\82Ä\82¨\82­\r
168 *----------------------------------------------------------------------------*/\r
169 \r
170 int DoCWDStepByStep(char *Path, char *Cur)\r
171 {\r
172         int Sts;\r
173         char *Set;\r
174         char *Set2;\r
175         char Tmp[FMAX_PATH+2];\r
176 \r
177         Sts = FTP_COMPLETE;\r
178 \r
179         memset(Tmp, NUL, FMAX_PATH+2);\r
180         strcpy(Tmp, Path);\r
181         Set = Tmp;\r
182         while(*Set != NUL)\r
183         {\r
184                 if((Set2 = strchr(Set, '/')) != NULL)\r
185                         *Set2 = NUL;\r
186                 if((Sts = DoCWD(Set, NO, NO, NO)) != FTP_COMPLETE)\r
187                         break;\r
188                 if(Set2 == NULL)\r
189                         break;\r
190                 Set = Set2 + 1;\r
191         }\r
192 \r
193         if(Sts != FTP_COMPLETE)\r
194                 DoCWD(Cur, NO, NO, NO);\r
195 \r
196         return(Sts);\r
197 }\r
198 \r
199 \r
200 /*----- \83\8a\83\82\81[\83g\91¤\82Ì\83J\83\8c\83\93\83g\83f\83B\83\8c\83N\83g\83\8a\8eæ\93¾ ----------------------------------\r
201 *\r
202 *       Parameter\r
203 *               char *Buf : \83p\83X\96¼\82ð\95Ô\82·\83o\83b\83t\83@\r
204 *\r
205 *       Return Value\r
206 *               int \89\9e\93\9a\83R\81[\83h\82Ì\82P\8c\85\96Ú\r
207 *----------------------------------------------------------------------------*/\r
208 \r
209 static int DoPWD(char *Buf)\r
210 {\r
211         char *Pos;\r
212         char Tmp[1024];\r
213         int Sts;\r
214 \r
215         if(PwdCommandType == PWD_XPWD)\r
216         {\r
217                 Sts = CommandProcCmd(Tmp, "XPWD");\r
218                 if(Sts/100 != FTP_COMPLETE)\r
219                         PwdCommandType = PWD_PWD;\r
220         }\r
221         if(PwdCommandType == PWD_PWD)\r
222                 Sts = CommandProcCmd(Tmp, "PWD");\r
223 \r
224         if(Sts/100 == FTP_COMPLETE)\r
225         {\r
226                 if((Pos = strchr(Tmp, '"')) != NULL)\r
227                 {\r
228                         memmove(Tmp, Pos+1, strlen(Pos+1)+1);\r
229                         if((Pos = strchr(Tmp, '"')) != NULL)\r
230                                 *Pos = NUL;\r
231                 }\r
232                 else\r
233                         memmove(Tmp, Tmp+4, strlen(Tmp+4)+1);\r
234 \r
235                 if(strlen(Tmp) < FMAX_PATH)\r
236                 {\r
237                         strcpy(Buf, Tmp);\r
238                         ReplaceAll(Buf, '\\', '/');\r
239                         ChangeSepaRemote2Local(Buf);\r
240                         ChangeFnameRemote2Local(Buf, FMAX_PATH);\r
241                 }\r
242                 else\r
243                         Sts = FTP_ERROR*100;\r
244         }\r
245         return(Sts/100);\r
246 }\r
247 \r
248 \r
249 /*----- PWD\83R\83}\83\93\83h\82Ì\83^\83C\83v\82ð\8f\89\8aú\89»\82·\82é ---------------------------------------\r
250 *\r
251 *       Parameter\r
252 *               \82È\82µ\r
253 *\r
254 *       Return Value\r
255 *               \82È\82µ\r
256 *----------------------------------------------------------------------------*/\r
257 \r
258 void InitPWDcommand()\r
259 {\r
260         PwdCommandType = PWD_XPWD;\r
261 }\r
262 \r
263 \r
264 /*----- \83\8a\83\82\81[\83g\91¤\82Ì\83f\83B\83\8c\83N\83g\83\8a\8dì\90¬ ----------------------------------------\r
265 *\r
266 *       Parameter\r
267 *               char *Path : \83p\83X\96¼\r
268 *\r
269 *       Return Value\r
270 *               int \89\9e\93\9a\83R\81[\83h\82Ì\82P\8c\85\96Ú\r
271 *----------------------------------------------------------------------------*/\r
272 \r
273 int DoMKD(char *Path)\r
274 {\r
275         int Sts;\r
276 \r
277         Sts = CommandProcCmd(NULL, "MKD %s", Path);\r
278 \r
279         if(Sts/100 >= FTP_CONTINUE)\r
280                 SoundPlay(SND_ERROR);\r
281 \r
282         return(Sts/100);\r
283 }\r
284 \r
285 \r
286 /*----- \83\8a\83\82\81[\83g\91¤\82Ì\83f\83B\83\8c\83N\83g\83\8a\8dí\8f\9c ------------------------------------------\r
287 *\r
288 *       Parameter\r
289 *               char *Path : \83p\83X\96¼\r
290 *\r
291 *       Return Value\r
292 *               int \89\9e\93\9a\83R\81[\83h\82Ì\82P\8c\85\96Ú\r
293 *----------------------------------------------------------------------------*/\r
294 \r
295 int DoRMD(char *Path)\r
296 {\r
297         int Sts;\r
298 \r
299         Sts = CommandProcCmd(NULL, "RMD %s", Path);\r
300 \r
301         if(Sts/100 >= FTP_CONTINUE)\r
302                 SoundPlay(SND_ERROR);\r
303 \r
304         return(Sts/100);\r
305 }\r
306 \r
307 \r
308 /*----- \83\8a\83\82\81[\83g\91¤\82Ì\83t\83@\83C\83\8b\8dí\8f\9c ----------------------------------------------\r
309 *\r
310 *       Parameter\r
311 *               char *Path : \83p\83X\96¼\r
312 *\r
313 *       Return Value\r
314 *               int \89\9e\93\9a\83R\81[\83h\82Ì\82P\8c\85\96Ú\r
315 *----------------------------------------------------------------------------*/\r
316 \r
317 int DoDELE(char *Path)\r
318 {\r
319         int Sts;\r
320 \r
321         Sts = CommandProcCmd(NULL, "DELE %s", Path);\r
322 \r
323         if(Sts/100 >= FTP_CONTINUE)\r
324                 SoundPlay(SND_ERROR);\r
325 \r
326         return(Sts/100);\r
327 }\r
328 \r
329 \r
330 /*----- \83\8a\83\82\81[\83g\91¤\82Ì\83t\83@\83C\83\8b\96¼\95Ï\8dX --------------------------------------------\r
331 *\r
332 *       Parameter\r
333 *               char *Src : \8c³\83t\83@\83C\83\8b\96¼\r
334 *               char *Dst : \95Ï\8dX\8cã\82Ì\83t\83@\83C\83\8b\96¼\r
335 *\r
336 *       Return Value\r
337 *               int \89\9e\93\9a\83R\81[\83h\82Ì\82P\8c\85\96Ú\r
338 *----------------------------------------------------------------------------*/\r
339 \r
340 int DoRENAME(char *Src, char *Dst)\r
341 {\r
342         int Sts;\r
343 \r
344         Sts = CommandProcCmd(NULL, "RNFR %s", Src);\r
345         if(Sts == 350)\r
346                 Sts = command(AskCmdCtrlSkt(), NULL, &CheckCancelFlg, "RNTO %s", Dst);\r
347 \r
348         if(Sts/100 >= FTP_CONTINUE)\r
349                 SoundPlay(SND_ERROR);\r
350 \r
351         return(Sts/100);\r
352 }\r
353 \r
354 \r
355 /*----- \83\8a\83\82\81[\83g\91¤\82Ì\83t\83@\83C\83\8b\82Ì\91®\90«\95Ï\8dX ----------------------------------------\r
356 *\r
357 *       Parameter\r
358 *               char *Path : \83p\83X\96¼\r
359 *               char *Mode : \83\82\81[\83h\95\8e\9a\97ñ\r
360 *\r
361 *       Return Value\r
362 *               int \89\9e\93\9a\83R\81[\83h\82Ì\82P\8c\85\96Ú\r
363 *----------------------------------------------------------------------------*/\r
364 \r
365 int DoCHMOD(char *Path, char *Mode)\r
366 {\r
367         int Sts;\r
368 \r
369         Sts = CommandProcCmd(NULL, "%s %s %s", AskHostChmodCmd(), Mode, Path);\r
370 \r
371         if(Sts/100 >= FTP_CONTINUE)\r
372                 SoundPlay(SND_ERROR);\r
373 \r
374         return(Sts/100);\r
375 }\r
376 \r
377 \r
378 /*----- \83\8a\83\82\81[\83g\91¤\82Ì\83t\83@\83C\83\8b\82Ì\83T\83C\83Y\82ð\8eæ\93¾\81i\93]\91\97\83\\83P\83b\83g\8eg\97p\81j-----------------\r
379 *\r
380 *       Parameter\r
381 *               char *Path : \83p\83X\96¼\r
382 *               LONGLONG *Size : \83t\83@\83C\83\8b\82Ì\83T\83C\83Y\82ð\95Ô\82·\83\8f\81[\83N\r
383 *\r
384 *       Return Value\r
385 *               int \89\9e\93\9a\83R\81[\83h\82Ì\82P\8c\85\96Ú\r
386 *\r
387 *       Note\r
388 *               \81\9a\81\9a\93]\91\97\83\\83P\83b\83g\82ð\8eg\97p\82·\82é\81\9a\81\9a\r
389 *               \83T\83C\83Y\82ª\91I\82ç\82ê\82È\82¢\8e\9e\82Í Size = -1 \82ð\95Ô\82·\r
390 *----------------------------------------------------------------------------*/\r
391 \r
392 int DoSIZE(char *Path, LONGLONG *Size)\r
393 {\r
394         int Sts;\r
395         char Tmp[1024];\r
396 \r
397         Sts = CommandProcTrn(Tmp, "SIZE %s", Path);\r
398 \r
399         *Size = -1;\r
400         if((Sts/100 == FTP_COMPLETE) && (strlen(Tmp) > 4) && IsDigit(Tmp[4]))\r
401                 *Size = _atoi64(&Tmp[4]);\r
402 \r
403         return(Sts/100);\r
404 }\r
405 \r
406 \r
407 /*----- \83\8a\83\82\81[\83g\91¤\82Ì\83t\83@\83C\83\8b\82Ì\93ú\95t\82ð\8eæ\93¾\81i\93]\91\97\83\\83P\83b\83g\8eg\97p\81j-------------------\r
408 *\r
409 *       Parameter\r
410 *               char *Path : \83p\83X\96¼\r
411 *               FILETIME *Time : \93ú\95t\82ð\95Ô\82·\83\8f\81[\83N\r
412 *\r
413 *       Return Value\r
414 *               int \89\9e\93\9a\83R\81[\83h\82Ì\82P\8c\85\96Ú\r
415 *\r
416 *       Note\r
417 *               \81\9a\81\9a\93]\91\97\83\\83P\83b\83g\82ð\8eg\97p\82·\82é\81\9a\81\9a\r
418 *               \93ú\95t\82ª\91I\82ç\82ê\82È\82¢\8e\9e\82Í Time = 0 \82ð\95Ô\82·\r
419 *----------------------------------------------------------------------------*/\r
420 \r
421 int DoMDTM(char *Path, FILETIME *Time)\r
422 {\r
423         int Sts;\r
424         char Tmp[1024];\r
425         SYSTEMTIME sTime;\r
426 \r
427     Time->dwLowDateTime = 0;\r
428     Time->dwHighDateTime = 0;\r
429 \r
430         Sts = CommandProcTrn(Tmp, "MDTM %s", Path);\r
431         if(Sts/100 == FTP_COMPLETE)\r
432         {\r
433                 sTime.wMilliseconds = 0;\r
434                 if(sscanf(Tmp+4, "%04d%02d%02d%02d%02d%02d",\r
435                         &sTime.wYear, &sTime.wMonth, &sTime.wDay,\r
436                         &sTime.wHour, &sTime.wMinute, &sTime.wSecond) == 6)\r
437                 {\r
438                         SystemTimeToFileTime(&sTime, Time);\r
439                         SpecificLocalFileTime2FileTime(Time, AskHostTimeZone());\r
440 \r
441                 }\r
442         }\r
443         return(Sts/100);\r
444 }\r
445 \r
446 \r
447 /*----- \83\8a\83\82\81[\83g\91¤\82Ì\83R\83}\83\93\83h\82ð\8eÀ\8ds --------------------------------------------\r
448 *\r
449 *       Parameter\r
450 *               char *CmdStr : \83R\83}\83\93\83h\95\8e\9a\97ñ\r
451 *\r
452 *       Return Value\r
453 *               int \89\9e\93\9a\83R\81[\83h\82Ì\82P\8c\85\96Ú\r
454 *----------------------------------------------------------------------------*/\r
455 \r
456 int DoQUOTE(char *CmdStr)\r
457 {\r
458         int Sts;\r
459 \r
460         Sts = CommandProcCmd(NULL, "%s", CmdStr);\r
461 \r
462         if(Sts/100 >= FTP_CONTINUE)\r
463                 SoundPlay(SND_ERROR);\r
464 \r
465         return(Sts/100);\r
466 }\r
467 \r
468 \r
469 /*----- \83\\83P\83b\83g\82ð\95Â\82\82é ------------------------------------------------------\r
470 *\r
471 *       Parameter\r
472 *               \82È\82µ\r
473 *\r
474 *       Return Value\r
475 *               SOCKET \95Â\82\82½\8cã\82Ì\83\\83P\83b\83g\r
476 *----------------------------------------------------------------------------*/\r
477 \r
478 SOCKET DoClose(SOCKET Sock)\r
479 {\r
480         if(Sock != INVALID_SOCKET)\r
481         {\r
482 //              if(WSAIsBlocking())\r
483 //              {\r
484 //                      DoPrintf("Skt=%u : Cancelled blocking call", Sock);\r
485 //                      WSACancelBlockingCall();\r
486 //              }\r
487                 do_closesocket(Sock);\r
488                 DoPrintf("Skt=%u : Socket closed.", Sock);\r
489                 Sock = INVALID_SOCKET;\r
490         }\r
491         if(Sock != INVALID_SOCKET)\r
492                 DoPrintf("Skt=%u : Failed to close socket.", Sock);\r
493 \r
494         return(Sock);\r
495 }\r
496 \r
497 \r
498 /*----- \83z\83X\83g\82©\82ç\83\8d\83O\83A\83E\83g\82·\82é ----------------------------------------------\r
499 *\r
500 *       Parameter\r
501 *               kSOCKET ctrl_skt : \83\\83P\83b\83g\r
502 *\r
503 *       Return Value\r
504 *               int \89\9e\93\9a\83R\81[\83h\82Ì\82P\8c\85\96Ú\r
505 *----------------------------------------------------------------------------*/\r
506 \r
507 int DoQUIT(SOCKET ctrl_skt)\r
508 {\r
509         int Ret;\r
510 \r
511         Ret = FTP_COMPLETE;\r
512         if(SendQuit == YES)\r
513                 Ret = command(ctrl_skt, NULL, &CheckCancelFlg, "QUIT") / 100;\r
514 \r
515         return(Ret);\r
516 }\r
517 \r
518 \r
519 /*----- \83\8a\83\82\81[\83g\91¤\82Ì\83f\83B\83\8c\83N\83g\83\8a\83\8a\83X\83g\82ð\8eæ\93¾\81i\83R\83}\83\93\83h\83R\83\93\83g\83\8d\81[\83\8b\83\\83P\83b\83g\82ð\8eg\97p)\r
520 *\r
521 *       Parameter\r
522 *               char *AddOpt : \92Ç\89Á\82Ì\83I\83v\83V\83\87\83\93\r
523 *               char *Path : \83p\83X\96¼\r
524 *               int Num : \83t\83@\83C\83\8b\96¼\94Ô\8d\86\r
525 *\r
526 *       Return Value\r
527 *               int \89\9e\93\9a\83R\81[\83h\82Ì\82P\8c\85\96Ú\r
528 *----------------------------------------------------------------------------*/\r
529 \r
530 int DoDirListCmdSkt(char *AddOpt, char *Path, int Num, int *CancelCheckWork)\r
531 {\r
532         int Sts;\r
533 \r
534         if(AskTransferNow() == YES)\r
535                 SktShareProh();\r
536 \r
537 //      if((Sts = DoDirList(NULL, AskCmdCtrlSkt(), AddOpt, Path, Num)) == 429)\r
538 //      {\r
539 //              ReConnectCmdSkt();\r
540                 Sts = DoDirList(NULL, AskCmdCtrlSkt(), AddOpt, Path, Num, CancelCheckWork);\r
541 \r
542                 if(Sts/100 >= FTP_CONTINUE)\r
543                         SoundPlay(SND_ERROR);\r
544 //      }\r
545         return(Sts/100);\r
546 }\r
547 \r
548 \r
549 /*----- \83\8a\83\82\81[\83g\91¤\82Ì\83f\83B\83\8c\83N\83g\83\8a\83\8a\83X\83g\82ð\8eæ\93¾ ----------------------------------\r
550 *\r
551 *       Parameter\r
552 *               HWND hWnd : \93]\91\97\92\86\83_\83C\83A\83\8d\83O\82Ì\83E\83C\83\93\83h\83E\83n\83\93\83h\83\8b\r
553 *               SOCKET cSkt : \83R\83\93\83g\83\8d\81[\83\8b\83\\83P\83b\83g\r
554 *               char *AddOpt : \92Ç\89Á\82Ì\83I\83v\83V\83\87\83\93\r
555 *               char *Path : \83p\83X\96¼ (""=\83J\83\8c\83\93\83g\83f\83B\83\8c\83N\83g\83\8a)\r
556 *               int Num : \83t\83@\83C\83\8b\96¼\94Ô\8d\86\r
557 *\r
558 *       Return Value\r
559 *               int \89\9e\93\9a\83R\81[\83h\r
560 *----------------------------------------------------------------------------*/\r
561 \r
562 static int DoDirList(HWND hWnd, SOCKET cSkt, char *AddOpt, char *Path, int Num, int *CancelCheckWork)\r
563 {\r
564         char Tmp[FMAX_PATH];\r
565         int Sts;\r
566 \r
567 //#pragma aaa\r
568 //DoPrintf("===== DoDirList %d = %s", Num, Path);\r
569 \r
570         MakeCacheFileName(Num, Tmp);\r
571 //      MainTransPkt.ctrl_skt = cSkt;\r
572 \r
573         if(AskListCmdMode() == NO)\r
574         {\r
575                 strcpy(MainTransPkt.Cmd, "NLST");\r
576                 if(strlen(AskHostLsName()) > 0)\r
577                 {\r
578                         strcat(MainTransPkt.Cmd, " ");\r
579                         if((AskHostType() == HTYPE_ACOS) || (AskHostType() == HTYPE_ACOS_4))\r
580                                 strcat(MainTransPkt.Cmd, "'");\r
581                         strcat(MainTransPkt.Cmd, AskHostLsName());\r
582                         if((AskHostType() == HTYPE_ACOS) || (AskHostType() == HTYPE_ACOS_4))\r
583                                 strcat(MainTransPkt.Cmd, "'");\r
584                 }\r
585                 if(strlen(AddOpt) > 0)\r
586                         strcat(MainTransPkt.Cmd, AddOpt);\r
587         }\r
588         else\r
589         {\r
590                 strcpy(MainTransPkt.Cmd, "LIST");\r
591                 if(strlen(AddOpt) > 0)\r
592                 {\r
593                         strcat(MainTransPkt.Cmd, " -");\r
594                         strcat(MainTransPkt.Cmd, AddOpt);\r
595                 }\r
596         }\r
597 \r
598         if(strlen(Path) > 0)\r
599                 strcat(MainTransPkt.Cmd, " ");\r
600 \r
601         strcpy(MainTransPkt.RemoteFile, Path);\r
602         strcpy(MainTransPkt.LocalFile, Tmp);\r
603         MainTransPkt.Type = TYPE_A;\r
604         MainTransPkt.Size = -1;\r
605         /* \83t\83@\83C\83\8b\83\8a\83X\83g\82Ì\92\86\82Ì\8a¿\8e\9a\82Ì\83t\83@\83C\83\8b\96¼\82Í\81A\95Ê\93r */\r
606         /* ChangeFnameRemote2Local \82Å\95Ï\8a·\82·\82é                   */\r
607         MainTransPkt.KanjiCode = KANJI_NOCNV;\r
608         MainTransPkt.KanaCnv = YES;\r
609         MainTransPkt.Mode = EXIST_OVW;\r
610         MainTransPkt.ExistSize = 0;\r
611         MainTransPkt.hWndTrans = hWnd;\r
612         MainTransPkt.Next = NULL;\r
613 \r
614         Sts = DoDownLoad(cSkt, &MainTransPkt, YES, CancelCheckWork);\r
615 \r
616 //#pragma aaa\r
617 //DoPrintf("===== DoDirList Done.");\r
618 \r
619         return(Sts);\r
620 }\r
621 \r
622 \r
623 /*----- \83\8a\83\82\81[\83g\91¤\82Ö\83R\83}\83\93\83h\82ð\91\97\82è\83\8a\83v\83\89\83C\82ð\91Ò\82Â\81i\83R\83}\83\93\83h\83\\83P\83b\83g\81j-----------\r
624 *\r
625 *       Parameter\r
626 *               char *Reply : \83\8a\83v\83\89\83C\82Ì\83R\83s\81[\90æ (NULL=\83R\83s\81[\82µ\82È\82¢)\r
627 *               char *fmt : \83t\83H\81[\83}\83b\83g\95\8e\9a\97ñ\r
628 *               ... : \83p\83\89\83\81\81[\83^\r
629 *\r
630 *       Return Value\r
631 *               int \89\9e\93\9a\83R\81[\83h\r
632 *\r
633 *       Note\r
634 *               \83R\83}\83\93\83h\83R\83\93\83g\83\8d\81[\83\8b\83\\83P\83b\83g\82ð\8eg\82¤\r
635 *----------------------------------------------------------------------------*/\r
636 \r
637 int CommandProcCmd(char *Reply, char *fmt, ...)\r
638 {\r
639         va_list Args;\r
640         char Cmd[1024];\r
641         int Sts;\r
642 \r
643         va_start(Args, fmt);\r
644         wvsprintf(Cmd, fmt, Args);\r
645         va_end(Args);\r
646 \r
647         if(AskTransferNow() == YES)\r
648                 SktShareProh();\r
649 \r
650 //#pragma aaa\r
651 //DoPrintf("**CommandProcCmd : %s", Cmd);\r
652 \r
653 //      if((Sts = command(AskCmdCtrlSkt(), Reply, "%s", Cmd)) == 429)\r
654 //      {\r
655 //              if(ReConnectCmdSkt() == SUCCESS)\r
656 //              {\r
657                         Sts = command(AskCmdCtrlSkt(), Reply, &CheckCancelFlg, "%s", Cmd);\r
658 //              }\r
659 //      }\r
660         return(Sts);\r
661 }\r
662 \r
663 \r
664 /*----- \83\8a\83\82\81[\83g\91¤\82Ö\83R\83}\83\93\83h\82ð\91\97\82è\83\8a\83v\83\89\83C\82ð\91Ò\82Â\81i\93]\91\97\83\\83P\83b\83g\81j---------------\r
665 *\r
666 *       Parameter\r
667 *               char *Reply : \83\8a\83v\83\89\83C\82Ì\83R\83s\81[\90æ (NULL=\83R\83s\81[\82µ\82È\82¢)\r
668 *               char *fmt : \83t\83H\81[\83}\83b\83g\95\8e\9a\97ñ\r
669 *               ... : \83p\83\89\83\81\81[\83^\r
670 *\r
671 *       Return Value\r
672 *               int \89\9e\93\9a\83R\81[\83h\r
673 *\r
674 *       Note\r
675 *               \93]\91\97\83R\83\93\83g\83\8d\81[\83\8b\83\\83P\83b\83g\82ð\8eg\82¤\r
676 *----------------------------------------------------------------------------*/\r
677 \r
678 int CommandProcTrn(char *Reply, char *fmt, ...)\r
679 {\r
680         va_list Args;\r
681         char Cmd[1024];\r
682         int Sts;\r
683 \r
684         va_start(Args, fmt);\r
685         wvsprintf(Cmd, fmt, Args);\r
686         va_end(Args);\r
687 \r
688 //#pragma aaa\r
689 //DoPrintf("**CommandProcTrn : %s", Cmd);\r
690 \r
691 //      if((Sts = command(AskTrnCtrlSkt(), Reply, "%s", Cmd)) == 429)\r
692 //      {\r
693 //              if(ReConnectTrnSkt() == SUCCESS)\r
694                         Sts = command(AskTrnCtrlSkt(), Reply, &CheckCancelFlg, "%s", Cmd);\r
695 //      }\r
696         return(Sts);\r
697 }\r
698 \r
699 \r
700 /*----- \83R\83}\83\93\83h\82ð\91\97\82è\83\8a\83v\83\89\83C\82ð\91Ò\82 ------------------------------------------\r
701 *\r
702 *       Parameter\r
703 *               SOCKET cSkt : \83R\83\93\83g\83\8d\81[\83\8b\83\\83P\83b\83g\r
704 *               char *Reply : \83\8a\83v\83\89\83C\82Ì\83R\83s\81[\90æ (NULL=\83R\83s\81[\82µ\82È\82¢)\r
705 *               char *fmt : \83t\83H\81[\83}\83b\83g\95\8e\9a\97ñ\r
706 *               ... : \83p\83\89\83\81\81[\83^\r
707 *\r
708 *       Return Value\r
709 *               int \89\9e\93\9a\83R\81[\83h\r
710 *\r
711 *       Note\r
712 *               \83z\83X\83g\82Ì\83t\83@\83C\83\8b\96¼\82Ì\8a¿\8e\9a\83R\81[\83h\82É\89\9e\82\82Ä\81A\82±\82±\82Å\8a¿\8e\9a\83R\81[\83h\82Ì\95Ï\8a·\82ð\8ds\82È\82¤\r
713 *----------------------------------------------------------------------------*/\r
714 \r
715 //#pragma aaa\r
716 //static int cntcnt = 0;\r
717 \r
718 int command(SOCKET cSkt, char *Reply, int *CancelCheckWork, char *fmt, ...)\r
719 {\r
720         va_list Args;\r
721         char Cmd[FMAX_PATH*2];\r
722         int Sts;\r
723         char TmpBuf[ONELINE_BUF_SIZE];\r
724 \r
725         if(cSkt != INVALID_SOCKET)\r
726         {\r
727                 va_start(Args, fmt);\r
728                 wvsprintf(Cmd, fmt, Args);\r
729                 va_end(Args);\r
730 \r
731                 if(strncmp(Cmd, "PASS ", 5) == 0)\r
732                         SetTaskMsg(">PASS [xxxxxx]");\r
733                 else if((strncmp(Cmd, "USER ", 5) == 0) ||\r
734                                 (strncmp(Cmd, "OPEN ", 5) == 0))\r
735                 {\r
736                         SetTaskMsg(">%s", Cmd);\r
737                 }\r
738                 else\r
739                 {\r
740                         ChangeSepaLocal2Remote(Cmd);\r
741                         SetTaskMsg(">%s", Cmd);\r
742                         ChangeFnameLocal2Remote(Cmd, FMAX_PATH*2);\r
743                 }\r
744 \r
745 //              DoPrintf("SEND : %s", Cmd);\r
746                 strcat(Cmd, "\x0D\x0A");\r
747 \r
748                 if(Reply != NULL)\r
749                         strcpy(Reply, "");\r
750 \r
751                 Sts = 429;\r
752                 if(SendData(cSkt, Cmd, strlen(Cmd), 0, CancelCheckWork) == SUCCESS)\r
753                 {\r
754                         Sts = ReadReplyMessage(cSkt, Reply, 1024, CancelCheckWork, TmpBuf);\r
755                 }\r
756 \r
757 //#pragma aaa\r
758 //if(Reply != NULL)\r
759 //      DoPrintf("%x : %x : %s : %s", cSkt, &TmpBuf, Cmd, Reply);\r
760 //else\r
761 //      DoPrintf("%x : %x : %s : NULL", cSkt, &TmpBuf, Cmd);\r
762 \r
763 //              DoPrintf("command() RET=%d", Sts);\r
764         }\r
765         else\r
766                 Sts = 429;\r
767 \r
768         return(Sts);\r
769 }\r
770 \r
771 \r
772 /*----- \83f\81[\83^\82ð\91\97\82é ----------------------------------------------------------\r
773 *\r
774 *       Parameter\r
775 *               SOCKET Skt : \83\\83P\83b\83g\r
776 *               char *Data : \83f\81[\83^\r
777 *               int Size : \91\97\82é\83f\81[\83^\82Ì\83T\83C\83Y\r
778 *               int Mode : \83R\81[\83\8b\83\82\81[\83h\r
779 *\r
780 *       Return Value\r
781 *               int \83X\83e\81[\83^\83X\r
782 *                       SUCCESS/FAIL\r
783 *----------------------------------------------------------------------------*/\r
784 \r
785 int SendData(SOCKET Skt, char *Data, int Size, int Mode, int *CancelCheckWork)\r
786 {\r
787         int Sts;\r
788         int Tmp;\r
789 //      fd_set SendFds;\r
790 //      struct timeval Tout;\r
791 //      struct timeval *ToutPtr;\r
792         int TimeOutErr;\r
793 \r
794         Sts = FAIL;\r
795         if(Skt != INVALID_SOCKET)\r
796         {\r
797                 Sts = SUCCESS;\r
798                 while(Size > 0)\r
799                 {\r
800 //                      FD_ZERO(&SendFds);\r
801 //                      FD_SET(Skt, &SendFds);\r
802 //                      ToutPtr = NULL;\r
803 //                      if(TimeOut != 0)\r
804 //                      {\r
805 //                              Tout.tv_sec = TimeOut;\r
806 //                              Tout.tv_usec = 0;\r
807 //                              ToutPtr = &Tout;\r
808 //                      }\r
809 //                      Tmp = select(0, NULL, &SendFds, NULL, ToutPtr);\r
810 //                      if(Tmp == SOCKET_ERROR)\r
811 //                      {\r
812 //                              Sts = FAIL;\r
813 //                              ReportWSError("select", WSAGetLastError());\r
814 //                              break;\r
815 //                      }\r
816 //                      else if(Tmp == 0)\r
817 //                      {\r
818 //                              Sts = FAIL;\r
819 //                              SetTaskMsg(MSGJPN241);\r
820 //                              break;\r
821 //                      }\r
822 \r
823                         Tmp = do_send(Skt, Data, Size, Mode, &TimeOutErr, CancelCheckWork);\r
824                         if(TimeOutErr == YES)\r
825                         {\r
826                                 Sts = FAIL;\r
827                                 SetTaskMsg(MSGJPN241);\r
828                                 break;\r
829                         }\r
830                         else if(Tmp == SOCKET_ERROR)\r
831                         {\r
832                                 Sts = FAIL;\r
833                                 ReportWSError("send", WSAGetLastError());\r
834                                 break;\r
835                         }\r
836 \r
837                         Size -= Tmp;\r
838                         Data += Tmp;\r
839                 }\r
840         }\r
841         return(Sts);\r
842 }\r
843 \r
844 \r
845 /*----- \89\9e\93\9a\83\81\83b\83Z\81[\83W\82ð\8eó\82¯\8eæ\82é ----------------------------------------------\r
846 *\r
847 *       Parameter\r
848 *               SOCKET cSkt : \83R\83\93\83g\83\8d\81[\83\8b\83\\83P\83b\83g\r
849 *               char *Buf : \83\81\83b\83Z\81[\83W\82ð\8eó\82¯\8eæ\82é\83o\83b\83t\83@ (NULL=\83R\83s\81[\82µ\82È\82¢)\r
850 *               int Max : \83o\83b\83t\83@\82Ì\83T\83C\83Y\r
851 *               int *CancelCheckWork :\r
852 *               char *Tmp : \83e\83\93\83|\83\89\83\8a\83\8f\81[\83N\r
853 *\r
854 *       Return Value\r
855 *               int \89\9e\93\9a\83R\81[\83h\r
856 *----------------------------------------------------------------------------*/\r
857 \r
858 int ReadReplyMessage(SOCKET cSkt, char *Buf, int Max, int *CancelCheckWork, char *Tmp)\r
859 {\r
860         int iRetCode;\r
861         int iContinue;\r
862         int FirstCode;\r
863         int Lines;\r
864         int i;\r
865 \r
866         if(Buf != NULL)\r
867                 memset(Buf, NUL, Max);\r
868         Max--;\r
869 \r
870         FirstCode = 0;\r
871         if(cSkt != INVALID_SOCKET)\r
872         {\r
873                 Lines = 0;\r
874                 do\r
875                 {\r
876                         iContinue = NO;\r
877                         iRetCode = ReadOneLine(cSkt, Tmp, ONELINE_BUF_SIZE, CancelCheckWork);\r
878 \r
879                         SetTaskMsg("%s", Tmp);\r
880 \r
881                         if(Buf != NULL)\r
882                         {\r
883                                 // \82Q\8ds\96Ú\88È\8d~\82Ì\89\9e\93\9a\83R\81[\83h\82Í\8fÁ\82·\r
884                                 if(Lines > 0)\r
885                                 {\r
886                                         for(i = 0; ; i++)\r
887                                         {\r
888                                                 if(IsDigit(Tmp[i]) == 0)\r
889                                                         break;\r
890                                                 Tmp[i] = ' ';\r
891                                         }\r
892                                 }\r
893                                 strncat(Buf, Tmp, Max);\r
894                                 Max = max1(0, Max-strlen(Tmp));\r
895 \r
896 //                              strncpy(Buf, Tmp, Max);\r
897                         }\r
898 \r
899                         if((iRetCode != 421) && (iRetCode != 429))\r
900                         {\r
901                                 if((FirstCode == 0) &&\r
902                                    (iRetCode >= 100) && (iRetCode <= 599))\r
903                                 {\r
904                                         FirstCode = iRetCode;\r
905                                 }\r
906 \r
907                                 if((iRetCode < 100) || (iRetCode > 599) ||\r
908                                    (*(Tmp + 3) == '-') ||\r
909                                    ((FirstCode > 0) && (iRetCode != FirstCode)))\r
910                                 {\r
911                                         iContinue = YES;\r
912                                 }\r
913                         }\r
914                         else\r
915                                 FirstCode = iRetCode;\r
916 \r
917                         Lines++;\r
918                 }\r
919                 while(iContinue == YES);\r
920         }\r
921         return(FirstCode);\r
922 }\r
923 \r
924 \r
925 /*----- \82P\8ds\95ª\82Ì\83f\81[\83^\82ð\8eó\82¯\8eæ\82é ----------------------------------------------\r
926 *\r
927 *       Parameter\r
928 *               SOCKET cSkt : \83R\83\93\83g\83\8d\81[\83\8b\83\\83P\83b\83g\r
929 *               char *Buf : \83\81\83b\83Z\81[\83W\82ð\8eó\82¯\8eæ\82é\83o\83b\83t\83@\r
930 *               int Max : \83o\83b\83t\83@\82Ì\83T\83C\83Y\r
931 *               int *CancelCheckWork : \r
932 *\r
933 *       Return Value\r
934 *               int \89\9e\93\9a\83R\81[\83h\r
935 *----------------------------------------------------------------------------*/\r
936 \r
937 static int ReadOneLine(SOCKET cSkt, char *Buf, int Max, int *CancelCheckWork)\r
938 {\r
939         char *Pos;\r
940         int SizeOnce;\r
941         int CopySize;\r
942         int ResCode;\r
943         int i;\r
944 //      fd_set ReadFds;\r
945 //      struct timeval Tout;\r
946 //      struct timeval *ToutPtr;\r
947         char Tmp[1024];\r
948         int TimeOutErr;\r
949 \r
950         ResCode = 0;\r
951         if(cSkt != INVALID_SOCKET)\r
952         {\r
953                 memset(Buf, NUL, Max);\r
954                 Max--;                                  /* \96\96\94ö\82ÌNULL\82Ì\82Ô\82ñ */\r
955                 Pos = Buf;\r
956 \r
957                 for(;;)\r
958                 {\r
959 //                      FD_ZERO(&ReadFds);\r
960 //                      FD_SET(cSkt, &ReadFds);\r
961 //                      ToutPtr = NULL;\r
962 //                      if(TimeOut != 0)\r
963 //                      {\r
964 //                              Tout.tv_sec = TimeOut;\r
965 //                              Tout.tv_usec = 0;\r
966 //                              ToutPtr = &Tout;\r
967 //                      }\r
968 //                      i = select(0, &ReadFds, NULL, NULL, ToutPtr);\r
969 //                      if(i == SOCKET_ERROR)\r
970 //                      {\r
971 //                              ReportWSError("select", WSAGetLastError());\r
972 //                              SizeOnce = -1;\r
973 //                              break;\r
974 //                      }\r
975 //                      else if(i == 0)\r
976 //                      {\r
977 //                              SetTaskMsg(MSGJPN242);\r
978 //                              SizeOnce = -2;\r
979 //                              break;\r
980 //                      }\r
981 \r
982                         /* LF\82Ü\82Å\82ð\8eó\90M\82·\82é\82½\82ß\82É\81A\8dÅ\8f\89\82ÍPEEK\82Å\8eó\90M */\r
983                         if((SizeOnce = do_recv(cSkt, (LPSTR)Tmp, 1024, MSG_PEEK, &TimeOutErr, CancelCheckWork)) <= 0)\r
984                         {\r
985                                 if(TimeOutErr == YES)\r
986                                 {\r
987                                         SetTaskMsg(MSGJPN242);\r
988                                         SizeOnce = -2;\r
989                                 }\r
990                                 else if(SizeOnce == SOCKET_ERROR)\r
991                                 {\r
992                                         SizeOnce = -1;\r
993                                 }\r
994                                 break;\r
995                         }\r
996 \r
997                         /* LF\82ð\92T\82µ\82Ä\81A\82 \82Á\82½\82ç\82»\82±\82Ü\82Å\82Ì\92·\82³\82ð\83Z\83b\83g */\r
998                         for(i = 0; i < SizeOnce ; i++)\r
999                         {\r
1000                                 if(*(Tmp + i) == NUL || *(Tmp + i) == 0x0A)\r
1001                                 {\r
1002                                         SizeOnce = i + 1;\r
1003                                         break;\r
1004                                 }\r
1005                         }\r
1006 \r
1007                         /* \96{\8eó\90M */\r
1008                         if((SizeOnce = do_recv(cSkt, Tmp, SizeOnce, 0, &TimeOutErr, CancelCheckWork)) <= 0)\r
1009                                 break;\r
1010 \r
1011                         CopySize = min1(Max, SizeOnce);\r
1012                         memcpy(Pos, Tmp, CopySize);\r
1013                         Pos += CopySize;\r
1014                         Max -= CopySize;\r
1015 \r
1016                         /* \83f\81[\83^\82ªLF\82Å\8fI\82í\82Á\82Ä\82¢\82½\82ç\82P\8ds\8fI\82í\82è */\r
1017                         if(*(Tmp + SizeOnce - 1) == 0x0A)\r
1018                                 break;\r
1019                 }\r
1020                 *Pos = NUL;\r
1021 \r
1022                 if(SizeOnce <= 0)\r
1023                 {\r
1024                         ResCode = 429;\r
1025                         memset(Buf, 0, Max);\r
1026 \r
1027                         if((SizeOnce == -2) || (AskTransferNow() == YES))\r
1028                         // \93]\91\97\92\86\82É\91S\82Ä\92\86\8e~\82ð\8ds\82¤\82Æ\95s\90³\82È\83f\81[\83^\82ª\93¾\82ç\82ê\82é\8fê\8d\87\82Ì\83o\83O\8fC\90³\r
1029                         // \83G\83\89\81[\82Ì\8eí\97Þ\82É\82æ\82Á\82Ä\82Í\96³\8cÀ\83\8b\81[\83v\82Æ\83X\83^\83b\83N\83I\81[\83o\81[\83t\83\8d\81[\82Ì\89Â\94\\90«\82 \82è\r
1030 //                              DisconnectSet();\r
1031                         {\r
1032                                 if(SizeOnce == -1)\r
1033                                         ReConnectCmdSkt();\r
1034                                 else\r
1035                                         DisconnectSet();\r
1036                         }\r
1037                 }\r
1038                 else\r
1039                 {\r
1040                         if(IsDigit(*Buf) && IsDigit(*(Buf+1)) && IsDigit(*(Buf+2)))\r
1041                         {\r
1042                                 memset(Tmp, NUL, 4);\r
1043                                 strncpy(Tmp, Buf, 3);\r
1044                                 ResCode = atoi(Tmp);\r
1045                         }\r
1046 \r
1047                         /* \96\96\94ö\82Ì CR,LF,\83X\83y\81[\83X\82ð\8eæ\82è\8f\9c\82­ */\r
1048                         while((i=strlen(Buf))>2 &&\r
1049                                   (Buf[i-1]==0x0a || Buf[i-1]==0x0d || Buf[i-1]==' '))\r
1050                                 Buf[i-1]=0;\r
1051                 }\r
1052         }\r
1053         return(ResCode);\r
1054 }\r
1055 \r
1056 \r
1057 /*----- \8cÅ\92è\92·\83f\81[\83^\82ð\8eó\82¯\8eæ\82é ------------------------------------------------\r
1058 *\r
1059 *       Parameter\r
1060 *               SOCKET cSkt : \83R\83\93\83g\83\8d\81[\83\8b\83\\83P\83b\83g\r
1061 *               char *Buf : \83\81\83b\83Z\81[\83W\82ð\8eó\82¯\8eæ\82é\83o\83b\83t\83@\r
1062 *               int Size : \83o\83C\83g\90\94\r
1063 *               int *CancelCheckWork : \r
1064 *\r
1065 *       Return Value\r
1066 *               int \83X\83e\81[\83^\83X\r
1067 *                       SUCCESS/FAIL\r
1068 *----------------------------------------------------------------------------*/\r
1069 \r
1070 int ReadNchar(SOCKET cSkt, char *Buf, int Size, int *CancelCheckWork)\r
1071 {\r
1072 //      struct timeval Tout;\r
1073 //      struct timeval *ToutPtr;\r
1074 //      fd_set ReadFds;\r
1075 //      int i;\r
1076         int SizeOnce;\r
1077         int Sts;\r
1078         int TimeOutErr;\r
1079 \r
1080         Sts = FAIL;\r
1081         if(cSkt != INVALID_SOCKET)\r
1082         {\r
1083                 Sts = SUCCESS;\r
1084                 while(Size > 0)\r
1085                 {\r
1086 //                      FD_ZERO(&ReadFds);\r
1087 //                      FD_SET(cSkt, &ReadFds);\r
1088 //                      ToutPtr = NULL;\r
1089 //                      if(TimeOut != 0)\r
1090 //                      {\r
1091 //                              Tout.tv_sec = TimeOut;\r
1092 //                              Tout.tv_usec = 0;\r
1093 //                              ToutPtr = &Tout;\r
1094 //                      }\r
1095 //                      i = select(0, &ReadFds, NULL, NULL, ToutPtr);\r
1096 //                      if(i == SOCKET_ERROR)\r
1097 //                      {\r
1098 //                              ReportWSError("select", WSAGetLastError());\r
1099 //                              Sts = FAIL;\r
1100 //                              break;\r
1101 //                      }\r
1102 //                      else if(i == 0)\r
1103 //                      {\r
1104 //                              SetTaskMsg(MSGJPN243);\r
1105 //                              Sts = FAIL;\r
1106 //                              break;\r
1107 //                      }\r
1108 \r
1109                         if((SizeOnce = do_recv(cSkt, Buf, Size, 0, &TimeOutErr, CancelCheckWork)) <= 0)\r
1110                         {\r
1111                                 if(TimeOutErr == YES)\r
1112                                         SetTaskMsg(MSGJPN243);\r
1113                                 Sts = FAIL;\r
1114                                 break;\r
1115                         }\r
1116 \r
1117                         Buf += SizeOnce;\r
1118                         Size -= SizeOnce;\r
1119                 }\r
1120         }\r
1121 \r
1122         if(Sts == FAIL)\r
1123                 SetTaskMsg(MSGJPN244);\r
1124 \r
1125         return(Sts);\r
1126 }\r
1127 \r
1128 \r
1129 /*----- \83G\83\89\81[\95\8e\9a\97ñ\82ð\8eæ\93¾ ----------------------------------------------------\r
1130 *\r
1131 *       Parameter\r
1132 *               UINT Error : \83G\83\89\81[\94Ô\8d\86\r
1133 *\r
1134 *       Return Value\r
1135 *               char *\83G\83\89\81[\95\8e\9a\97ñ\r
1136 *----------------------------------------------------------------------------*/\r
1137 \r
1138 char *ReturnWSError(UINT Error)\r
1139 {\r
1140         static char Msg[128];\r
1141         char *Str;\r
1142 \r
1143         switch(Error)\r
1144         {\r
1145                 case WSAVERNOTSUPPORTED:\r
1146                         Str = "version of WinSock not supported";\r
1147                         break;\r
1148 \r
1149                 case WSASYSNOTREADY:\r
1150                         Str = "WinSock not present or not responding";\r
1151                         break;\r
1152 \r
1153                 case WSAEINVAL:\r
1154                         Str = "app version not supported by DLL";\r
1155                         break;\r
1156 \r
1157                 case WSAHOST_NOT_FOUND:\r
1158                         Str = "Authoritive: Host not found";\r
1159                         break;\r
1160 \r
1161                 case WSATRY_AGAIN:\r
1162                         Str = "Non-authoritive: host not found or server failure";\r
1163                         break;\r
1164 \r
1165                 case WSANO_RECOVERY:\r
1166                         Str = "Non-recoverable: refused or not implemented";\r
1167                         break;\r
1168 \r
1169                 case WSANO_DATA:\r
1170                         Str = "Valid name, no data record for type";\r
1171                         break;\r
1172 \r
1173 #if 0\r
1174                 case WSANO_ADDRESS:\r
1175                         Str = "Valid name, no MX record";\r
1176                         break;\r
1177 #endif\r
1178 \r
1179                 case WSANOTINITIALISED:\r
1180                         Str = "WSA Startup not initialized";\r
1181                         break;\r
1182 \r
1183                 case WSAENETDOWN:\r
1184                         Str = "Network subsystem failed";\r
1185                         break;\r
1186 \r
1187                 case WSAEINPROGRESS:\r
1188                         Str = "Blocking operation in progress";\r
1189                         break;\r
1190 \r
1191                 case WSAEINTR:\r
1192                         Str = "Blocking call cancelled";\r
1193                         break;\r
1194 \r
1195                 case WSAEAFNOSUPPORT:\r
1196                         Str = "address family not supported";\r
1197                         break;\r
1198 \r
1199                 case WSAEMFILE:\r
1200                         Str = "no file descriptors available";\r
1201                         break;\r
1202 \r
1203                 case WSAENOBUFS:\r
1204                         Str = "no buffer space available";\r
1205                         break;\r
1206 \r
1207                 case WSAEPROTONOSUPPORT:\r
1208                         Str = "specified protocol not supported";\r
1209                         break;\r
1210 \r
1211                 case WSAEPROTOTYPE:\r
1212                         Str = "protocol wrong type for this socket";\r
1213                         break;\r
1214 \r
1215                 case WSAESOCKTNOSUPPORT:\r
1216                         Str = "socket type not supported for address family";\r
1217                         break;\r
1218 \r
1219                 case WSAENOTSOCK:\r
1220                         Str = "descriptor is not a socket";\r
1221                         break;\r
1222 \r
1223                 case WSAEWOULDBLOCK:\r
1224                         Str = "socket marked as non-blocking and SO_LINGER set not 0";\r
1225                         break;\r
1226 \r
1227                 case WSAEADDRINUSE:\r
1228                         Str = "address already in use";\r
1229                         break;\r
1230 \r
1231                 case WSAECONNABORTED:\r
1232                         Str = "connection aborted";\r
1233                         break;\r
1234 \r
1235                 case WSAECONNRESET:\r
1236                         Str = "connection reset";\r
1237                         break;\r
1238 \r
1239                 case WSAENOTCONN:\r
1240                         Str = "not connected";\r
1241                         break;\r
1242 \r
1243                 case WSAETIMEDOUT:\r
1244                         Str = "connection timed out";\r
1245                         break;\r
1246 \r
1247                 case WSAECONNREFUSED:\r
1248                         Str = "connection refused";\r
1249                         break;\r
1250 \r
1251                 case WSAEHOSTDOWN:\r
1252                         Str = "host down";\r
1253                         break;\r
1254 \r
1255                 case WSAEHOSTUNREACH:\r
1256                         Str = "host unreachable";\r
1257                         break;\r
1258 \r
1259                 case WSAEADDRNOTAVAIL:\r
1260                         Str = "address not available";\r
1261                         break;\r
1262 \r
1263                 default:\r
1264                         sprintf(Msg, "error %u", Error);\r
1265                         return(Msg);\r
1266         }\r
1267         return(Str);\r
1268 }\r
1269 \r
1270 \r
1271 /*----- \83f\83o\83b\83O\83R\83\93\83\\81[\83\8b\82É\83G\83\89\81[\82ð\95\\8e¦ --------------------------------------\r
1272 *\r
1273 *       Parameter\r
1274 *               char *Msg : \83G\83\89\81[\82Ì\91O\82É\95\\8e¦\82·\82é\83\81\83b\83Z\81[\83W\r
1275 *               UINT Error : \83G\83\89\81[\94Ô\8d\86\r
1276 *\r
1277 *       Return Value\r
1278 *               \82È\82µ\r
1279 *----------------------------------------------------------------------------*/\r
1280 \r
1281 void ReportWSError(char *Msg, UINT Error)\r
1282 {\r
1283         if(Msg != NULL)\r
1284                 DoPrintf("[[%s : %s]]", Msg, ReturnWSError(Error));\r
1285         else\r
1286                 DoPrintf("[[%s]]", ReturnWSError(Error));\r
1287 }\r
1288 \r
1289 \r
1290 /*----- \83t\83@\83C\83\8b\96¼\82ð\83\8d\81[\83J\83\8b\91¤\82Å\88µ\82¦\82é\82æ\82¤\82É\95Ï\8a·\82·\82é --------------------------\r
1291 *\r
1292 *       Parameter\r
1293 *               char *Fname : \83t\83@\83C\83\8b\96¼\r
1294 *               int Max : \8dÅ\91å\92·\r
1295 *\r
1296 *       Return Value\r
1297 *               int \83X\83e\81[\83^\83X\r
1298 *                       SUCCESS/FAIL\r
1299 *----------------------------------------------------------------------------*/\r
1300 \r
1301 int ChangeFnameRemote2Local(char *Fname, int Max)\r
1302 {\r
1303         int Sts;\r
1304         char *Buf;\r
1305         char *Pos;\r
1306         CODECONVINFO cInfo;\r
1307 \r
1308         Sts = FAIL;\r
1309         if((Buf = malloc(Max)) != NULL)\r
1310         {\r
1311                 InitCodeConvInfo(&cInfo);\r
1312                 cInfo.KanaCnv = NO;                     //AskHostNameKana();\r
1313                 cInfo.Str = Fname;\r
1314                 cInfo.StrLen = strlen(Fname);\r
1315                 cInfo.Buf = Buf;\r
1316                 cInfo.BufSize = Max - 1;\r
1317 \r
1318                 // \82±\82±\82Å\91S\82ÄUTF-8\82Ö\95Ï\8a·\82·\82é\r
1319                 // TODO: SJIS\88È\8aO\82à\92¼\90ÚUTF-8\82Ö\95Ï\8a·\r
1320                 switch(AskHostNameKanji())\r
1321                 {\r
1322                         case KANJI_SJIS :\r
1323                                 ConvSJIStoUTF8N(&cInfo);\r
1324                                 *(Buf + cInfo.OutLen) = NUL;\r
1325                                 strcpy(Fname, Buf);\r
1326                                 Pos = strchr(Fname, NUL);\r
1327                                 FlushRestData(&cInfo);\r
1328                                 *(Buf + cInfo.OutLen) = NUL;\r
1329                                 strcpy(Pos, Buf);\r
1330                                 break;\r
1331 \r
1332                         case KANJI_JIS :\r
1333                                 ConvJIStoSJIS(&cInfo);\r
1334                                 *(Buf + cInfo.OutLen) = NUL;\r
1335                                 strcpy(Fname, Buf);\r
1336                                 Pos = strchr(Fname, NUL);\r
1337                                 FlushRestData(&cInfo);\r
1338                                 *(Buf + cInfo.OutLen) = NUL;\r
1339                                 strcpy(Pos, Buf);\r
1340                                 // TODO\r
1341                                 InitCodeConvInfo(&cInfo);\r
1342                                 cInfo.KanaCnv = NO;\r
1343                                 cInfo.Str = Pos;\r
1344                                 cInfo.StrLen = strlen(Pos);\r
1345                                 cInfo.Buf = Buf;\r
1346                                 cInfo.BufSize = Max - 1;\r
1347                                 ConvSJIStoUTF8N(&cInfo);\r
1348                                 *(Buf + cInfo.OutLen) = NUL;\r
1349                                 strcpy(Fname, Buf);\r
1350                                 Pos = strchr(Fname, NUL);\r
1351                                 FlushRestData(&cInfo);\r
1352                                 *(Buf + cInfo.OutLen) = NUL;\r
1353                                 strcpy(Pos, Buf);\r
1354                                 break;\r
1355 \r
1356                         case KANJI_EUC :\r
1357                                 ConvEUCtoSJIS(&cInfo);\r
1358                                 *(Buf + cInfo.OutLen) = NUL;\r
1359                                 strcpy(Fname, Buf);\r
1360                                 Pos = strchr(Fname, NUL);\r
1361                                 FlushRestData(&cInfo);\r
1362                                 *(Buf + cInfo.OutLen) = NUL;\r
1363                                 strcpy(Pos, Buf);\r
1364                                 // TODO\r
1365                                 InitCodeConvInfo(&cInfo);\r
1366                                 cInfo.KanaCnv = NO;\r
1367                                 cInfo.Str = Pos;\r
1368                                 cInfo.StrLen = strlen(Pos);\r
1369                                 cInfo.Buf = Buf;\r
1370                                 cInfo.BufSize = Max - 1;\r
1371                                 ConvSJIStoUTF8N(&cInfo);\r
1372                                 *(Buf + cInfo.OutLen) = NUL;\r
1373                                 strcpy(Fname, Buf);\r
1374                                 Pos = strchr(Fname, NUL);\r
1375                                 FlushRestData(&cInfo);\r
1376                                 *(Buf + cInfo.OutLen) = NUL;\r
1377                                 strcpy(Pos, Buf);\r
1378                                 break;\r
1379 \r
1380                         case KANJI_SMB_HEX :\r
1381                         case KANJI_SMB_CAP :\r
1382                                 ConvSMBtoSJIS(&cInfo);\r
1383                                 *(Buf + cInfo.OutLen) = NUL;\r
1384                                 strcpy(Fname, Buf);\r
1385                                 Pos = strchr(Fname, NUL);\r
1386                                 FlushRestData(&cInfo);\r
1387                                 *(Buf + cInfo.OutLen) = NUL;\r
1388                                 strcpy(Pos, Buf);\r
1389                                 // TODO\r
1390                                 InitCodeConvInfo(&cInfo);\r
1391                                 cInfo.KanaCnv = NO;\r
1392                                 cInfo.Str = Pos;\r
1393                                 cInfo.StrLen = strlen(Pos);\r
1394                                 cInfo.Buf = Buf;\r
1395                                 cInfo.BufSize = Max - 1;\r
1396                                 ConvSJIStoUTF8N(&cInfo);\r
1397                                 *(Buf + cInfo.OutLen) = NUL;\r
1398                                 strcpy(Fname, Buf);\r
1399                                 Pos = strchr(Fname, NUL);\r
1400                                 FlushRestData(&cInfo);\r
1401                                 *(Buf + cInfo.OutLen) = NUL;\r
1402                                 strcpy(Pos, Buf);\r
1403                                 break;\r
1404 \r
1405 //                      case KANJI_UTF8N :\r
1406 //                              ConvUTF8NtoSJIS(&cInfo);\r
1407 //                              *(Buf + cInfo.OutLen) = NUL;\r
1408 //                              strcpy(Fname, Buf);\r
1409 //                              Pos = strchr(Fname, NUL);\r
1410 //                              FlushRestData(&cInfo);\r
1411 //                              *(Buf + cInfo.OutLen) = NUL;\r
1412 //                              strcpy(Pos, Buf);\r
1413 //                              break;\r
1414                 }\r
1415                 free(Buf);\r
1416                 Sts = SUCCESS;\r
1417         }\r
1418         return(Sts);\r
1419 }\r
1420 \r
1421 \r
1422 /*----- \83t\83@\83C\83\8b\96¼\82ð\83\8a\83\82\81[\83g\91¤\82Å\88µ\82¦\82é\82æ\82¤\82É\95Ï\8a·\82·\82é --------------------------\r
1423 *\r
1424 *       Parameter\r
1425 *               char *Fname : \83t\83@\83C\83\8b\96¼\r
1426 *               int Max : \8dÅ\91å\92·\r
1427 *\r
1428 *       Return Value\r
1429 *               int \83X\83e\81[\83^\83X\r
1430 *                       SUCCESS/FAIL\r
1431 *----------------------------------------------------------------------------*/\r
1432 \r
1433 int ChangeFnameLocal2Remote(char *Fname, int Max)\r
1434 {\r
1435         int Sts;\r
1436         char *Buf;\r
1437         char *Pos;\r
1438         CODECONVINFO cInfo;\r
1439 \r
1440         Sts = FAIL;\r
1441         if((Buf = malloc(Max)) != NULL)\r
1442         {\r
1443                 InitCodeConvInfo(&cInfo);\r
1444                 cInfo.KanaCnv = AskHostNameKana();\r
1445                 cInfo.Str = Fname;\r
1446                 cInfo.StrLen = strlen(Fname);\r
1447                 cInfo.Buf = Buf;\r
1448                 cInfo.BufSize = Max - 1;\r
1449 \r
1450                 // \82±\82±\82Å\91S\82ÄUTF-8\82©\82ç\95Ï\8a·\82·\82é\r
1451                 // TODO: SJIS\88È\8aO\82à\92¼\90ÚUTF-8\82©\82ç\95Ï\8a·\r
1452                 switch(AskHostNameKanji())\r
1453                 {\r
1454                         case KANJI_SJIS :\r
1455                                 ConvUTF8NtoSJIS(&cInfo);\r
1456                                 *(Buf + cInfo.OutLen) = NUL;\r
1457                                 strcpy(Fname, Buf);\r
1458                                 Pos = strchr(Fname, NUL);\r
1459                                 FlushRestData(&cInfo);\r
1460                                 *(Buf + cInfo.OutLen) = NUL;\r
1461                                 strcpy(Pos, Buf);\r
1462                                 break;\r
1463 \r
1464                         case KANJI_JIS :\r
1465                                 ConvUTF8NtoSJIS(&cInfo);\r
1466                                 *(Buf + cInfo.OutLen) = NUL;\r
1467                                 strcpy(Fname, Buf);\r
1468                                 Pos = strchr(Fname, NUL);\r
1469                                 FlushRestData(&cInfo);\r
1470                                 *(Buf + cInfo.OutLen) = NUL;\r
1471                                 strcpy(Pos, Buf);\r
1472                                 // TODO\r
1473                                 InitCodeConvInfo(&cInfo);\r
1474                                 cInfo.KanaCnv = NO;\r
1475                                 cInfo.Str = Pos;\r
1476                                 cInfo.StrLen = strlen(Pos);\r
1477                                 cInfo.Buf = Buf;\r
1478                                 cInfo.BufSize = Max - 1;\r
1479                                 ConvSJIStoJIS(&cInfo);\r
1480                                 *(Buf + cInfo.OutLen) = NUL;\r
1481                                 strcpy(Fname, Buf);\r
1482                                 Pos = strchr(Fname, NUL);\r
1483                                 FlushRestData(&cInfo);\r
1484                                 *(Buf + cInfo.OutLen) = NUL;\r
1485                                 strcpy(Pos, Buf);\r
1486                                 break;\r
1487 \r
1488                         case KANJI_EUC :\r
1489                                 ConvUTF8NtoSJIS(&cInfo);\r
1490                                 *(Buf + cInfo.OutLen) = NUL;\r
1491                                 strcpy(Fname, Buf);\r
1492                                 Pos = strchr(Fname, NUL);\r
1493                                 FlushRestData(&cInfo);\r
1494                                 *(Buf + cInfo.OutLen) = NUL;\r
1495                                 strcpy(Pos, Buf);\r
1496                                 // TODO\r
1497                                 InitCodeConvInfo(&cInfo);\r
1498                                 cInfo.KanaCnv = NO;\r
1499                                 cInfo.Str = Pos;\r
1500                                 cInfo.StrLen = strlen(Pos);\r
1501                                 cInfo.Buf = Buf;\r
1502                                 cInfo.BufSize = Max - 1;\r
1503                                 ConvSJIStoEUC(&cInfo);\r
1504                                 *(Buf + cInfo.OutLen) = NUL;\r
1505                                 strcpy(Fname, Buf);\r
1506                                 Pos = strchr(Fname, NUL);\r
1507                                 FlushRestData(&cInfo);\r
1508                                 *(Buf + cInfo.OutLen) = NUL;\r
1509                                 strcpy(Pos, Buf);\r
1510                                 break;\r
1511 \r
1512                         case KANJI_SMB_HEX :\r
1513                                 ConvUTF8NtoSJIS(&cInfo);\r
1514                                 *(Buf + cInfo.OutLen) = NUL;\r
1515                                 strcpy(Fname, Buf);\r
1516                                 Pos = strchr(Fname, NUL);\r
1517                                 FlushRestData(&cInfo);\r
1518                                 *(Buf + cInfo.OutLen) = NUL;\r
1519                                 strcpy(Pos, Buf);\r
1520                                 // TODO\r
1521                                 InitCodeConvInfo(&cInfo);\r
1522                                 cInfo.KanaCnv = NO;\r
1523                                 cInfo.Str = Pos;\r
1524                                 cInfo.StrLen = strlen(Pos);\r
1525                                 cInfo.Buf = Buf;\r
1526                                 cInfo.BufSize = Max - 1;\r
1527                                 ConvSJIStoSMB_HEX(&cInfo);\r
1528                                 *(Buf + cInfo.OutLen) = NUL;\r
1529                                 strcpy(Fname, Buf);\r
1530                                 Pos = strchr(Fname, NUL);\r
1531                                 FlushRestData(&cInfo);\r
1532                                 *(Buf + cInfo.OutLen) = NUL;\r
1533                                 strcpy(Pos, Buf);\r
1534                                 break;\r
1535 \r
1536                         case KANJI_SMB_CAP :\r
1537                                 ConvUTF8NtoSJIS(&cInfo);\r
1538                                 *(Buf + cInfo.OutLen) = NUL;\r
1539                                 strcpy(Fname, Buf);\r
1540                                 Pos = strchr(Fname, NUL);\r
1541                                 FlushRestData(&cInfo);\r
1542                                 *(Buf + cInfo.OutLen) = NUL;\r
1543                                 strcpy(Pos, Buf);\r
1544                                 // TODO\r
1545                                 InitCodeConvInfo(&cInfo);\r
1546                                 cInfo.KanaCnv = NO;\r
1547                                 cInfo.Str = Pos;\r
1548                                 cInfo.StrLen = strlen(Pos);\r
1549                                 cInfo.Buf = Buf;\r
1550                                 cInfo.BufSize = Max - 1;\r
1551                                 ConvSJIStoSMB_CAP(&cInfo);\r
1552                                 *(Buf + cInfo.OutLen) = NUL;\r
1553                                 strcpy(Fname, Buf);\r
1554                                 Pos = strchr(Fname, NUL);\r
1555                                 FlushRestData(&cInfo);\r
1556                                 *(Buf + cInfo.OutLen) = NUL;\r
1557                                 strcpy(Pos, Buf);\r
1558                                 break;\r
1559 \r
1560 //                      case KANJI_UTF8N :\r
1561 //                              ConvSJIStoUTF8N(&cInfo);\r
1562 //                              *(Buf + cInfo.OutLen) = NUL;\r
1563 //                              strcpy(Fname, Buf);\r
1564 //                              Pos = strchr(Fname, NUL);\r
1565 //                              FlushRestData(&cInfo);\r
1566 //                              *(Buf + cInfo.OutLen) = NUL;\r
1567 //                              strcpy(Pos, Buf);\r
1568 //                              break;\r
1569                 }\r
1570                 free(Buf);\r
1571                 Sts = SUCCESS;\r
1572         }\r
1573         return(Sts);\r
1574 }\r
1575 \r
1576 \r
1577 /*----- \83p\83X\82Ì\8bæ\90Ø\82è\95\8e\9a\82ð\83z\83X\83g\82É\8d\87\82í\82¹\82Ä\95Ï\8dX\82·\82é ----------------------------\r
1578 *\r
1579 *       Parameter\r
1580 *               char *Fname : \83t\83@\83C\83\8b\96¼\r
1581 *\r
1582 *       Return Value\r
1583 *               \82È\82µ\r
1584 *----------------------------------------------------------------------------*/\r
1585 static void ChangeSepaLocal2Remote(char *Fname)\r
1586 {\r
1587         if(AskHostType() == HTYPE_STRATUS)\r
1588         {\r
1589                 ReplaceAll(Fname, '/', '>');\r
1590         }\r
1591         return;\r
1592 }\r
1593 \r
1594 \r
1595 /*----- \83p\83X\82Ì\8bæ\90Ø\82è\95\8e\9a\82ð\83\8d\81[\83J\83\8b\82É\8d\87\82í\82¹\82Ä\95Ï\8dX\82·\82é --------------------------\r
1596 *\r
1597 *       Parameter\r
1598 *               char *Fname : \83t\83@\83C\83\8b\96¼\r
1599 *\r
1600 *       Return Value\r
1601 *               \82È\82µ\r
1602 *----------------------------------------------------------------------------*/\r
1603 static void ChangeSepaRemote2Local(char *Fname)\r
1604 {\r
1605         if(AskHostType() == HTYPE_STRATUS)\r
1606         {\r
1607                 ReplaceAll(Fname, '>', '/');\r
1608         }\r
1609         return;\r
1610 }\r
1611 \r
1612 \r
1613 \r
1614 \r
1615 \r
1616 \r
1617 \r