};
//-----------------------------------------------------------------------------
SETTINGS::SETTINGS()
+ : port(0),
+ localPort(0),
+ listenWebIP(0),
+ refreshPeriod(0),
+ daemon(false),
+ noWeb(false),
+ reconnect(false),
+ showPid(false)
{
confFile = "/etc/sgauth.conf";
}
printf("sgauth <server> <port> <login> <password>\n"); //TODO change to correct
}
//-----------------------------------------------------------------------------
-void EventsFn(int)
-{
-LOADSTAT ls;
-clnp->GetStat(&ls);
-}
-//-----------------------------------------------------------------------------
void SetDirName(const vector<string> & dn, void *)
{
for (int j = 0; j < DIR_NUM; j++)
{
cout << "Connect" << endl;
clnp->Connect();
- }
+ }
}
//-----------------------------------------------------------------------------
void CatchUSR2(int)
//-----------------------------------------------------------------------------
int main(int argc, char *argv[])
{
-//int port;
-//char *endptr;
-
SETTINGS settings;
#ifndef WIN32
#endif
{
settings.SetConfFile(argv[1]);
- if (settings.ReadSettings())
- {
- printf("ReadSettingsError\n");
- printf("%s\n", settings.GetStrError().c_str());
- exit(-1);
- }
- settings.Print();
}
else
{
}*/
}
-//settings.Print();
+if (settings.ReadSettings())
+ {
+ printf("ReadSettingsError\n");
+ printf("%s\n", settings.GetStrError().c_str());
+ exit(-1);
+ }
+settings.Print();
#ifndef WIN32
if (settings.GetDaemon())
switch (fork())
{
- case -1: // ìÁÖÁ
+ case -1:
exit(1);
break;
- case 0: // ðÏÔÏÍÏË
+ case 0:
setsid();
break;
- default: // ïÓÎÏ×ÎÏÊ ÐÒÏÃÅÓÓ
+ default:
exit(0);
break;
}
}
-
-
-
#endif
clnp = new IA_CLIENT_PROT(settings.GetServerName(), settings.GetServerPort(), settings.GetLocalPort());
clnp->SetStatChangedCb(StatUpdate, NULL);
clnp->SetReconnect(settings.GetReconnect());
-
clnp->Start();
SetSignalHandlers();
return 0;
}
//-----------------------------------------------------------------------------
-
-