5 |
void filename(char name1[], char name2[], char cln1[], char path [], int route, char ini_file[]) |
void filename(char name1[], char name2[], char cln1[], char path [], int route, char ini_file[]) |
6 |
// name1, name2, cln1 - output parameters |
// name1, name2, cln1 - output parameters |
7 |
{ |
{ |
8 |
char fno[80], temp[80], route_path[90], name_route[4]; |
char fno[80], route_path[90], name_route[4]; |
9 |
char command[180]; /*DOS command*/ |
char command[180]; /*DOS command*/ |
10 |
FILE *ffiot; |
FILE *ffiot; |
11 |
|
|
13 |
name_route[1]=ini_file[6]; |
name_route[1]=ini_file[6]; |
14 |
name_route[2]=ini_file[7]; |
name_route[2]=ini_file[7]; |
15 |
name_route[3]='\0'; |
name_route[3]='\0'; |
|
|
|
|
strcpy(temp,path); |
|
|
strcat(temp,"tmp.dat"); |
|
16 |
|
|
17 |
ffiot=fopen(temp, "w+"); |
sprintf(command,"%03i_",route); |
18 |
fprintf(ffiot,"%03i_",route); |
sscanf(command,"%s",fno); |
|
fseek(ffiot,0,0); |
|
|
fgets(fno,10,ffiot); |
|
|
fclose(ffiot); |
|
|
remove(temp); |
|
19 |
|
|
20 |
strncat(strcpy(route_path,path),fno,3); |
strncat(strcpy(route_path,path),fno,3); |
21 |
if (LINUX_flag==1) strcat(route_path,"/tmp.dat"); |
strcat(route_path,"/tmp.dat"); |
|
if (LINUX_flag!=1) strcat(route_path,"\\tmp.dat"); |
|
22 |
|
|
23 |
if ((ffiot=fopen(route_path,"w+"))==0) |
if ((ffiot=fopen(route_path,"w+"))==0) |
24 |
/*************Create directory mmm*************************/ |
/*************Create directory mmm*************************/ |
25 |
{ |
{ |
26 |
if (LINUX_flag==1) strncat(strcat(strcat(strcat(strcpy(command,"mkdir "),path),name_route),"_"),fno,3); |
strncat(strcat(strcat(strcat(strcpy(command,"mkdir "),path),name_route),"_"),fno,3); |
|
if (LINUX_flag!=1) strncat(strcat(strcpy(command,"md "),path),fno,3); |
|
27 |
system(command); |
system(command); |
28 |
/**********************************************************/ |
/**********************************************************/ |
29 |
|
|
30 |
/*************Create directory Cln1************************/ |
/*************Create directory Cln1************************/ |
31 |
if (LINUX_flag==1) strcat(command,"/Cln1"); |
strcat(command,"/Cln1"); |
|
if (LINUX_flag!=1) strcat(command,"\\Cln1"); |
|
32 |
system(command); |
system(command); |
33 |
/**********************************************************/ |
/**********************************************************/ |
34 |
} |
} |
35 |
if (LINUX_flag==1) strcat(strncat(strcat(strcat(strcpy(name1,path),name_route),"_"),fno,3),"/Cln1/"); |
strcat(strncat(strcat(strcat(strcpy(name1,path),name_route),"_"),fno,3),"/Cln1/"); |
36 |
if (LINUX_flag!=1) strcat(strncat(strcpy(name1,path),fno,3),"\\Cln1\\"); |
strcat(strcat(strcat(strcat(strcat(strncat(name1,ini_file,5),"_"),name_route),"_"),fno),"cln1Er.log"); |
37 |
strcat(strncat(strcat(strcat(strcat(name1,name_route),"_"),fno),ini_file,5),"_cln1Er.log"); |
|
38 |
|
strcat(strncat(strcat(strcat(strcpy(name2,path),name_route),"_"),fno,3),"/Cln1/"); |
39 |
if (LINUX_flag==1) strcat(strncat(strcat(strcat(strcpy(name2,path),name_route),"_"),fno,3),"/Cln1/"); |
strcat(strcat(strcat(strcat(strcat(strncat(name2,ini_file,5),"_"),name_route),"_"),fno),"mis_cln1.dat"); |
40 |
if (LINUX_flag!=1) strcat(strncat(strcpy(name2,path),fno,3),"\\Cln1\\"); |
|
41 |
strcat(strncat(strcat(strcat(strcat(name2,name_route),"_"),fno),ini_file,5),"_mis_cln1.dat"); |
strcat(strncat(strcat(strcat(strcpy(cln1,path),name_route),"_"),fno,3),"/Cln1/"); |
42 |
|
strcat(strcat(strcat(strcat(strcat(strncat(cln1,ini_file,5),"_"),name_route),"_"),fno),"cln1.pam"); |
|
if (LINUX_flag==1) strcat(strncat(strcat(strcat(strcpy(cln1,path),name_route),"_"),fno,3),"/Cln1/"); |
|
|
if (LINUX_flag!=1) strcat(strncat(strcpy(cln1,path),fno,3),"\\Cln1\\"); |
|
|
strcat(strncat(strcat(strcat(strcat(cln1,name_route),"_"),fno),ini_file,5),"_cln1.pam"); |
|
43 |
if (ffiot!=0) {fclose(ffiot); remove(route_path);} |
if (ffiot!=0) {fclose(ffiot); remove(route_path);} |
44 |
} |
} |