Develop and Download Open Source Software

Browse Subversion Repository

Contents of /old/batch.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 17 - (show annotations) (download)
Wed Jan 2 22:39:42 2008 UTC (16 years, 4 months ago) by tabasa
File MIME type: text/plain
File size: 2264 byte(s)


1 #include "defextern.h"
2
3
4 #ifndef STRICT
5 #define STRICT
6 #endif
7 #include <stdio.h>
8 #include <fstream.h>
9 #include <windows.h>
10 #include <wininet.h>
11 #include <windowsx.h>
12 #include <commctrl.h>
13 #include "resource.h"
14 #include "myfilemv.h"
15 #include "initial.h"
16 #include "file.h"
17 #include "batch.h"
18 #include "main.h"
19 #include "status.h"
20
21 char batchExt[]= "tfa";
22
23
24 struct status
25 {
26 BOOL connect;//インターネットに接続しているかどうか
27 char host[1];
28 void init() {connect=FALSE;strcpy(host,""); };
29 void sethost(char *h) {strcpy(host,h);};
30 BOOL checkhost(char *h) {return (strcmp(h,host)==0); };
31 } ;
32
33 status sta;
34
35 void editbatch(char *file)
36 {
37 ShellExecute(NULL, "open",editor ,file, NULL, SW_SHOW);
38 }
39
40
41 void setautoendcomment(char *file, char *buff,int success,int fail,int fnum,int allnum)
42 {
43 wsprintf(buff,"自動:終了 [%s] 接続結果 ○:%d ×:%d (%d/%d)",file,success,fail,fnum,allnum);
44 setstatus(buff);
45 }
46
47
48 // 自動アップロードファイルかどうか、拡張子チェック
49
50 BOOL checkbatch(char *file)
51 {
52 return checkExt(file,batchExt);
53 }
54
55 // 自動アップロードファイル、トランスモード変更かどうか
56 // ascii, binary
57
58 BOOL checktransmode(char *buf)
59 {
60 BOOL ans=FALSE;
61 return ans;
62 }
63
64
65 void batch(char *file)
66 {
67 int upnum=0;
68 int allnum=0;
69 if( checkbatch(file)==FALSE )
70 {
71 setstatusonly("拡張子がtfaではありません");
72 return;
73 }
74 AddAutofile(file);
75 char buf[MAX_PATH*4];
76 char filefrom[MAX_PATH];
77 char fileto[MAX_PATH];
78 char* to;
79 ifstream in(file, ios::nocreate);
80 if(!in) return;
81 setstatusonly("開始");
82 int success=0;
83 int fail=0;
84 while(!in.eof())
85 {
86 in.getline(buf,MAX_PATH*4);
87 if(strncmp(buf,"quit",4)==0) break; // quit で終了
88 if(checktransmode(buf)) continue;
89 if( !ishost(buf)) continue;
90 //myftpaddress.setname(buf);
91 // 接続できたら+1
92 if(sta.connect==FALSE)
93 {
94 fail++;
95 continue;
96 }
97 else success++;
98 setstatusonly(buf);
99 resettitle();
100 while(!in.eof())
101 {
102 in.getline(buf,MAX_PATH*4);
103 if(checktransmode(buf)) continue;
104 if(strcmp(buf,"end")==0) break;
105 strcpy(filefrom,buf);
106 in.getline(fileto,MAX_PATH);
107 if(strcmp(fileto,"end")==0) break;
108 SetCurrentDirectory(filefrom);
109 to=strrchr(filefrom,'\\');
110 if(to==NULL) to=strrchr(filefrom,'/');
111 if(to==NULL) to=filefrom;
112 else to++;
113 allnum++;
114 }
115 }
116 resettitle();
117 }

Properties

Name Value
svn:eol-style native
svn:keywords Id Revision
svn:mime-type text/plain

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26