Example #1
0
int group_writeToFile(const sGroup *g,const char *path) {
	int res;
	FILE *f = fopen(path,"w");
	if(!f)
		return errno;
	res = group_write(g,f);
	fclose(f);
	return res;
}
Example #2
0
int TcWebApiAdv_vlan_group_execute(int id)
{
		int i;
		if(id==GB_C_VLAN_GROUPSETTING)
		{fprintf(stderr,"-----save\n");
			group_del();
			group_add();
		}



		if(id==GB_C_VLAN_GROUPDELETE)
		{
			strncpy(bu_active,web_api->adv_vlan_group[vlan_index-1]->active,8);
			strncpy(web_api->adv_vlan_group[vlan_index-1]->active,val_def->vlan_group_active_no,8);	
			
			strncpy(bu_vlan_id,web_api->adv_vlan_group[vlan_index-1]->vlan_id,8);
			memset(web_api->adv_vlan_group[vlan_index-1]->vlan_id,0,sizeof(web_api->adv_vlan_group[vlan_index-1]->vlan_id));
			
			for(i=0;i<8;i++)
			{
				bu_atmt[i]=web_api->adv_vlan_group[vlan_index-1]->atmt[i];
				web_api->adv_vlan_group[vlan_index-1]->atmt[i]=0;
				
				bu_atmp[i]=web_api->adv_vlan_group[vlan_index-1]->atmp[i];
				web_api->adv_vlan_group[vlan_index-1]->atmp[i]=0;
			}
			for(i=0;i<4;i++)
			{
				bu_ethernett[i]=web_api->adv_vlan_group[vlan_index-1]->ethernett[i];
				web_api->adv_vlan_group[vlan_index-1]->ethernett[i]=0;
				
				bu_ethernetp[i]=web_api->adv_vlan_group[vlan_index-1]->ethernetp[i];
				web_api->adv_vlan_group[vlan_index-1]->ethernetp[i]=0;
			}
			bu_usbt=web_api->adv_vlan_group[vlan_index-1]->usbt;
			web_api->adv_vlan_group[vlan_index-1]->usbt=0;
			
			bu_usbp=web_api->adv_vlan_group[vlan_index-1]->usbp;
			web_api->adv_vlan_group[vlan_index-1]->usbp=0;	
	
			group_del();
		}

	group_write();
	return 0;
}