在欢迎界面导航栏中点击设备设置->设备添加,则打开dev_add.cgi程序,
一、该进程首先通过进程间通信函数向主控进程发送查询消息,主控进程将主数据结构内存中的数据加载至共享内存,cgi进程然后将共享内存的数据显示到html中。
二、在html中点击表单的submit键时,cgi程序将表单中的数据提取出,修改共享内存数据,然后向主控进程发送更新消息,主控进程则将共享内存中的数据更新至主数据结构内存。
dev_add.c如下:
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "html.h"
#include "config.h"
#include "ipc.h"
void table_tr(char * name,char type,int checked)
{
char type_id[2]="0";
type_id[0]=type+'0';
printf("<tbody>");
printf("<tr><td><input type=\"text\" name=\"name_%s\" value=\"%s\"></td>",type_id,name);
printf("<td><input type=\"text\" name=\