📄 installd.c
字号:
else sscanf(pii,"%d",&max_sockets);
find_def_a("P_ECHOPORT",pib);
sscanf(pib,"%d",&echo_port);
printf("? The port NO. of communication(D: %d)[I] ",echo_port);
gets(pii);
if(strlen(pii)==0)sscanf(pib,"%d",&echo_port);
else sscanf(pii,"%d",&echo_port);
find_def_a("P_INTETIME",pib);
sscanf(pib,"%d",&interval_time);
printf("? The time of sending pause(D: %d mins)[I] ",interval_time);
gets(pii);
if(strlen(pii)==0)sscanf(pib,"%d",&interval_time);
else sscanf(pii,"%d",&interval_time);
find_def_a("P_LASTTIME",pib);
sscanf(pib,"%d",&lastno_time);
printf("? The time of sending last(D: %d mins)[I] ",lastno_time);
gets(pii);
if(strlen(pii)==0)sscanf(pib,"%d",&lastno_time);
else sscanf(pii,"%d",&lastno_time);
find_def_a("P_SEMSKEY",pib);
while(sems_key==0)
{ sscanf(pib,"%d",&sems_key);
printf("? The sem set key(must be >0)(D: %d)[I] ",sems_key);
gets(pii);
if(strlen(pii)==0)sscanf(pib,"%d",&sems_key);
else sscanf(pii,"%d",&sems_key); }
sem_number=7;
/* sem usage map(0-5) .
* 0 ... pr_sort0.tmp ; 1 ... np_sort0.tmp ;
* 2 ... ma_sort0.tmp ; 3 ... sr_tran0.tmp ;
* 4 ... s*0.tmp ; 5 ... r*0.dat ;
* 6 ... Sending the telegram .
*/
find_def_a("P_SLEEPTIME",pib);
while(sleeping_time==0)
{ sscanf(pib,"%d",&sleeping_time);
printf("? The time of process sleeping(D: %d mins)[I] ",sleeping_time);
gets(pii);
if(strlen(pii)==0)sscanf(pib,"%d",&sleeping_time);
else sscanf(pii,"%d",&sleeping_time); }
printf("\n\n\nTelegram: %s %s %s %s %s %s %s\n",post_office,
tel_address,new_prefix0,man_prefix0,
tel_prefix0,tel_prefix1,tel_prefix2);
if(rec_mode==1 || rec_mode==0)
{ printf("Device : %s %d,%d,%d,%s\n",device_name,port_baud,
port_databit,port_stopbit,verify_mode); }
printf("Station : Sended objects %d sended stations %d\n",
send_object,stat_number);
printf("Sockets : max_sockets %d port NO. %d\n",
max_sockets,echo_port);
printf("Buffer : I/O buffer size %d packet size %d\n",
buffer_size,packet_size);
printf("Run plan: semskey %d time(Type) %d(st) %d(sl) %d(ps)\n\n",
sems_key,interval_time,lastno_time,sleeping_time);
if(rec_mode==-1 || rec_mode==-2){
printf("Server name: %s\n",server_name);
printf("User name: %s\n",user_name);
printf("User password: %s\n",user_pass);
printf("Volume name: %s\n",volume_name);
printf("Directory: %s\n",user_directory);
printf("Mount_point: %s\n\n\n",mount_point);
}
c_key[0]=0;
while(strlen(c_key)==0 ||
c_key[0]!='Y' &&
c_key[0]!='y' &&
c_key[0]!='N' &&
c_key[0]!='n')
{ printf("Are you sure ?(Y/N)[s] ");
gets(c_key); }
if(c_key[0]=='Y' || c_key[0]=='y')break;
}
return;
}
void mk_nfcnet_h(void)
{
FILE *hp;
if((hp=fopen("nfcnet.h","w+"))==NULL)
{ printf("Create file, nfcnet.h error !\n");
exit(0);}
strtoup(p0);
fprintf(hp,"#define P_POSTOFFICE %c%s%c\n",P_QUOTA,p0,P_QUOTA);
strtoup(p1);
fprintf(hp,"#define P_TELEADDR %c%s%c\n",P_QUOTA,p1,P_QUOTA);
strtoup(p2);
fprintf(hp,"#define P_TELFIX1 %c%s%c\n",P_QUOTA,p2,P_QUOTA);
strtoup(p3);
fprintf(hp,"#define P_TELFIX2 %c%s%c\n",P_QUOTA,p3,P_QUOTA);
strtoup(p4);
fprintf(hp,"#define P_TELFIX3 %c%s%c\n",P_QUOTA,p4,P_QUOTA);
strtoup(p5);
fprintf(hp,"#define P_MANFIX1 %c%s%c\n",P_QUOTA,p5,P_QUOTA);
strtoup(p6);
fprintf(hp,"#define P_NEWFIX1 %c%s%c\n",P_QUOTA,p6,P_QUOTA);
strtolo(p7);
fprintf(hp,"#define P_DEVNAME %c%s%c\n",P_QUOTA,p7,P_QUOTA);
strtoup(p8);
fprintf(hp,"#define P_VERMODE %c%s%c\n",P_QUOTA,p8,P_QUOTA);
if(rec_mode==-1 || rec_mode==-2){
strtolo(p9);
fprintf(hp,"#define P_SERVER %c%s%c\n",P_QUOTA,p9,P_QUOTA);
strtolo(p10);
fprintf(hp,"#define P_USERNAME %c%s%c\n",P_QUOTA,p10,P_QUOTA);
strtolo(p11);
fprintf(hp,"#define P_PASSWORD %c%s%c\n",P_QUOTA,p11,P_QUOTA);
strtolo(p12);
fprintf(hp,"#define P_VOLUME %c%s%c\n",P_QUOTA,p12,P_QUOTA);
strtolo(p13);
fprintf(hp,"#define P_DIRECTORY %c%s%c\n",P_QUOTA,p13,P_QUOTA);
strtolo(p14);
fprintf(hp,"#define P_MOUNTPT %c%s%c\n",P_QUOTA,p14,P_QUOTA); }
fprintf(hp,"#define P_PORTBAUD B%d\n",port_baud);
fprintf(hp,"#define P_DATABIT CS%d\n",port_databit);
fprintf(hp,"#define P_STOPBIT %d\n",port_stopbit);
fprintf(hp,"#define P_SENDOBJ %d\n",send_object);
fprintf(hp,"#define P_STTOBJM %d\n",stat_objmap);
fprintf(hp,"#define P_STTNUMB %d\n",stat_number);
fprintf(hp,"#define P_SIZEBUF %d\n",buffer_size);
fprintf(hp,"#define P_SIZEPACK %d\n",packet_size);
fprintf(hp,"#define P_MAXSOCKET %d\n",max_sockets);
fprintf(hp,"#define P_ECHOPORT %d\n",echo_port);
fprintf(hp,"#define P_INTETIME %d\n",interval_time);
fprintf(hp,"#define P_LASTTIME %d\n",lastno_time);
fprintf(hp,"#define P_SLEEPTIME %d\n",sleeping_time);
fprintf(hp,"#define P_SEMSKEY %d\n",sems_key);
fprintf(hp,"#define P_SEMNUMB %d\n",sem_number);
fprintf(hp,"#define P_SEMACCESS 0660\n");
fprintf(hp,"#define P_PR_SORT 0\n");
fprintf(hp,"#define P_NP_SORT 1\n");
fprintf(hp,"#define P_MA_SORT 2\n");
fprintf(hp,"#define P_SR_TRAN 3\n");
fprintf(hp,"#define P_S0 4\n");
fprintf(hp,"#define P_R0 5\n");
fprintf(hp,"#define P_SENDTEL 6\n");
fclose(hp);
return;
}
void mk_nfcnet_dir(void)
{ int statusx;
statusx=mkdir("/nfcnet",S_IRWXO|S_IRWXG|S_IRWXU);
if(statusx == -1)printf("The /nfcnet is exist !\n");
statusx=mkdir("/nfcnet/inst",S_IRWXO|S_IRWXG|S_IRWXU);
if(statusx == -1)printf("The /nfcnet/inst is exist !\n");
statusx=mkdir("/nfcnet/exec",S_IRWXO|S_IRWXG|S_IRWXU);
if(statusx == -1)printf("The /nfcnet/exec is exist !\n");
statusx=mkdir("/nfcnet/sysd",S_IRWXO|S_IRWXG|S_IRWXU);
if(statusx == -1)printf("The /nfcnet/sysd is exist !\n");
statusx=mkdir("/nfcnet/tele",S_IRWXO|S_IRWXG|S_IRWXU);
if(statusx == -1)printf("The /nfcnet/tele is exist !\n");
statusx=mkdir("/nfcnet/temp",S_IRWXO|S_IRWXG|S_IRWXU);
if(statusx == -1)printf("The /nfcnet/temp is exist !\n");
statusx=mkdir("/nfcnet/nets",S_IRWXO|S_IRWXG|S_IRWXU);
if(statusx == -1)printf("The /nfcnet/nets is exist !\n");
statusx=mkdir("/nfcnet/netr",S_IRWXO|S_IRWXG|S_IRWXU);
if(statusx == -1)printf("The /nfcnet/netr is exist !\n");
statusx=mkdir("/nfcnet/ddbf",S_IRWXO|S_IRWXG|S_IRWXU);
if(statusx == -1)printf("The /nfcnet/ddbf is exist !\n");
if(rec_mode==-2)
{ statusx=mkdir(p14,S_IRWXO|S_IRWXG|S_IRWXU);
if(statusx == -1)printf("The mount point is exist !\n"); }
return;
}
void mk_exec(void)
{ int statusx;
printf("Compiling & link addr_tab .\n");
statusx=system("cc -o addr_tab.exe addr_tab.c");
printf("Compiling & link crtstatm .\n");
statusx=system("cc -o crtstatm.exe crtstatm.c");
printf("Compiling & link crt_stam .\n");
statusx=system("cc -o crt_stam.exe crt_stam.c");
printf("Compiling & link manual .\n");
statusx=system("cc -o manual.exe manual.c");
printf("Compiling & link man_rmt .\n");
statusx=system("cc -o man_rmt.exe man_rmt.c");
printf("Compiling & link man_wx .\n");
statusx=system("cc -o man_wx.exe man_wx.c");
printf("Compiling & link monitor .\n");
statusx=system("cc -o monitor.exe monitor.c");
printf("Compiling & link mon_auto .\n");
statusx=system("cc -o mon_auto.exe mon_auto.c");
printf("Compiling & link nfc_semc .\n");
statusx=system("cc -o nfc_semc.exe nfc_semc.c");
printf("Compiling & link npre_pro .\n");
statusx=system("cc -o npre_pro.exe npre_pro.c");
if(rec_mode==1)
{ printf("Compiling & link rec_tele .\n");
statusx=system("cc -o rec_tele.exe rec_tele.c");
printf("Compiling & link pre_proc .\n");
statusx=system("cc -o pre_proc.exe pre_proc.c");
}
if(rec_mode==0)
{ printf("Compiling & link rec_dirc .\n");
statusx=system("cc -o rec_dirc.exe rec_dirc.c");
printf("Compiling & link pre_proc .\n");
statusx=system("cc -o pre_proc.exe pre_proc.c");
}
if((rec_mode==1)||(rec_mode==0))
{ printf("Compiling & link dialog .\n");
statusx=system("cc -o dialog.exe dialog.c");
}
if(rec_mode==-1)
{ printf("Compiling & link pre_netw .\n");
statusx=system("cc -o pre_netw.exe pre_netw.c");
}
if(rec_mode==-2)
{ printf("Compiling & link pre_nfss .\n");
statusx=system("cc -o pre_nfss.exe pre_nfss.c");
}
printf("Compiling & link semcheck .\n");
statusx=system("cc -o semcheck.exe semcheck.c");
printf("Compiling & link snd_auto .\n");
statusx=system("cc -o snd_auto.exe snd_auto.c");
printf("Compiling & link snd_tele .\n");
statusx=system("cc -o snd_tele.exe snd_tele.c");
printf("Compiling & link srt_tele .\n");
statusx=system("cc -o srt_tele.exe srt_tele.c");
printf("Compiling & link ns_input .\n");
statusx=system("cc -o ns_input.exe ns_input.c");
printf("Compiling & link srt_tran .\n");
statusx=system("cc -o srt_tran.exe srt_tran.c");
printf("Compiling & link telesum .\n");
statusx=system("cc -o telesum.exe telesum.c");
printf("Compiling & link packx .\n");
statusx=system("cc -o packx.exe packx.c");
printf("Compiling & link nfcprocs .\n");
statusx=system("cc -o nfcprocs.exe nfcprocs.c");
printf("Compiling & link tcpclnt .\n");
statusx=system("cc -o tcpclnt.exe tcpclnt.c -lsocket -lnsl");
printf("Compiling & link tcpserv .\n");
statusx=system("cc -o tcpserv.exe tcpserv.c -lsocket -lnsl");
printf("Compiling & link tcpclntx .\n");
statusx=system("cc -o tcpclntx.exe tcpclntx.c -lsocket -lnsl");
printf("Compiling & link tcpservx .\n");
statusx=system("cc -o tcpservx.exe tcpservx.c -lsocket -lnsl");
printf("Compiling & link end !\n");
return;
}
void mk_runprog(void)
{ FILE *fp;
fp=fopen("S30nfcnet","w+");
fprintf(fp,"/nfcnet/exec/nfc_semc.exe >/dev/null &\n");
if(rec_mode==1)
{ fprintf(fp,"/nfcnet/exec/rec_tele.exe >/dev/null &\n");
fprintf(fp,"/nfcnet/exec/pre_proc.exe >/dev/null &\n"); }
if(rec_mode==0)
{ fprintf(fp,"/nfcnet/exec/rec_dirc.exe >/dev/null &\n");
fprintf(fp,"/nfcnet/exec/pre_proc.exe >/dev/null &\n"); }
if(rec_mode==-1)
{ fprintf(fp,"/nfcnet/exec/pre_netw.exe >/dev/null &\n"); }
if(rec_mode==-2)
{ fprintf(fp,"/nfcnet/exec/pre_nfss.exe >/dev/null &\n"); }
fprintf(fp,"/nfcnet/exec/npre_pro.exe >/dev/null &\n");
fprintf(fp,"/nfcnet/exec/ns_input.exe >/dev/null &\n");
fprintf(fp,"/nfcnet/exec/tcpservx.exe >/dev/null &\n");
fprintf(fp,"/nfcnet/exec/tcpclntx.exe %d %d >/dev/null &\n",1,send_object);
fprintf(fp,"/nfcnet/exec/srt_tele.exe >/dev/null &\n");
fprintf(fp,"/nfcnet/exec/srt_tran.exe >/dev/null &\n");
fprintf(fp,"/nfcnet/exec/mon_auto.exe >/dev/null &\n");
fprintf(fp,"/nfcnet/exec/nfcprocs.exe >/dev/null &\n");
fclose(fp);
if(rec_mode==-1)
{ fp=fopen("serverpass","w+");
fprintf(fp,"%s\n",user_pass);
fclose(fp); }
}
void mk_copy(void)
{ int statusx;
if(copy_to_targ[0]=='Y')
{ printf("copy * to /nfcnet/inst .\n");
statusx=system("cp * /nfcnet/inst");
if(statusx!=0)
{ printf("The error is found in copy command(0) .\n");
printf("Check the working directory, please !\n");}
printf("copy *.exe to /nfcnet/exec .\n");
statusx=system("cp lwpnfsd /nfcnet/exec");
statusx=system("cp *.exe /nfcnet/exec");
if(statusx!=0)
{ printf("The error is found in copy command(1) .\n");
printf("Check the working directory, please !\n");
exit(1); }
printf("copy S30nfcnet to /etc/rc3.d .\n");
statusx=system("cp S30nfcnet /etc/rc3.d/S30nfcnet");
if(statusx!=0)
{ printf("The error is found in copy command(2) .\n");
printf("Check the working directory, please !\n");
exit(1); }
if(rec_mode==-1){
printf("copy serverpass to /etc/rc3.d .\n");
statusx=system("cp serverpass /etc/rc3.d/serverpass");
if(statusx!=0)
{ printf("The error is found in copy command(3) .\n");
printf("Check the working directory, please !\n");
exit(1); } }
}
else
{ printf("\nIf any thing is good :\n");
printf("PLS copy lwpfnsd to /nfcnet/exec\n");
printf("PLS copy *.exe to /nfcnet/exec\n");
printf(" copy S30nfcnet to /etc/rc3.d\n");
if(rec_mode==-1)
printf(" copy serverpass to /etc/rc3.d .\n");
printf("\n");
}
return;
}
void chg_mode(void)
{ int statusx;
printf("Now begin to change access mode of dirctory and file !\n");
printf("PLS ignor the WARNING from chmod command !\n");
statusx=system("chmod 777 /nfcnet");
statusx=system("chmod 777 /nfcnet/*");
statusx=system("chmod a+w /nfcnet/ddbf/*");
statusx=system("chmod a+w /nfcnet/exec/*");
statusx=system("chmod a+w /nfcnet/inst/*");
statusx=system("chmod a+w /nfcnet/netr/*");
statusx=system("chmod a+w /nfcnet/nets/*");
statusx=system("chmod a+w /nfcnet/sysd/*");
statusx=system("chmod a+w /nfcnet/tele/*");
statusx=system("chmod a+w /nfcnet/temp/*");
printf("Change access mode complate !\n");
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -