📄 setcommunication.c
字号:
#include "cgilib.h"int main(){ int i; htmlinput_struct htmlinputs[20]; int htmlinputcount; commparam_struct commparam; unsigned long addr; htmlinputcount=get_CGI_request(htmlinputs); if (!htmlinputcount) { html_message("error","set parameters error!"); exit(1); } else { printf("Content-type:text/html\n\n"); printf("<HTML>\n"); printf("<HEAD>\n"); printf("<TITLE>%s</TITLE>\n","message"); printf("</HEAD>\n"); printf("<BODY>\n"); for(i=0;i<htmlinputcount;i++) { if (!strcmp(htmlinputs[i].name,"serverip")) { strcpy(commparam.serverip,htmlinputs[i].value); printf("%s<BR>",commparam.serverip); } if (!strcmp(htmlinputs[i].name,"serverport")) { strcpy(commparam.serverport,htmlinputs[i].value); printf("%s<BR>",commparam.serverport); } if (!strcmp(htmlinputs[i].name,"baudrate")) { strcpy(commparam.baudrate,htmlinputs[i].value); printf("%s<BR>",commparam.baudrate); } if (!strcmp(htmlinputs[i].name,"parity")) { strcpy(commparam.parity,htmlinputs[i].value); printf("%s<BR>",commparam.parity); } if (!strcmp(htmlinputs[i].name,"databits")) { strcpy(commparam.databits,htmlinputs[i].value); printf("%s<BR>",commparam.databits); } if (!strcmp(htmlinputs[i].name,"stopbits")) { strcpy(commparam.stopbits,htmlinputs[i].value); printf("%s<BR>",commparam.stopbits); } if (!strcmp(htmlinputs[i].name,"handshaking")) { strcpy(commparam.handshaking,htmlinputs[i].value); printf("%s<BR>",commparam.handshaking); } } printf("set successfully.<BR>"); } //write the communication data to /etc/config/param.conf write_comm_to_file("/etc/config/param.conf",commparam); //save the ip data file to 0xfff00000 addr = 0xfff00000; erase_sector(addr); sleep(3); write_file_to_flash("/etc/config/param.conf",addr); printf("</BODY>\n"); printf("</HTML>\n"); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -