#include <WScom.h>
#include <WSCfunctionList.h>
#include <WSCbase.h>
//----------------------------------------------------------
//Function for the event procedure
//----------------------------------------------------------
#include <newwin000.h>

extern WSCstring ipaddr;
extern WSCstring broadcast_ipaddr;
extern void initop(WSCbase*);

void saveinfo(){
    ipaddr = newvifi_011->getProperty(WSNlabelString);
    broadcast_ipaddr = newvifi_012->getProperty(WSNlabelString);
    ipaddr.delHeadSpace();
    ipaddr.delTailSpace();
    ipaddr.delLineFeed();
    broadcast_ipaddr.delHeadSpace();
    broadcast_ipaddr.delTailSpace();
    broadcast_ipaddr.delLineFeed();
    WSCstring output;
    output << ipaddr << "\n";
    output << broadcast_ipaddr << "\n";
    WSGFreplaceTextFile("$(HOME)/.wsagentrc",output.getString(),False);
}
void setop(WSCbase* object){
  //do something...
  long ret = newdial_002->popup();
  if (ret == WS_DIALOG_OK){
    saveinfo();
    initop(object);
  }

}
static WSCfunctionRegister  op("setop",(void*)setop);
