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