X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/90e389f6ec12e60a62c362296ffcf314feb5b03d..c0e423f3a00da01cdcc994e973d0f04c7c956bae:/projects/sgauth/main.cpp?ds=sidebyside diff --git a/projects/sgauth/main.cpp b/projects/sgauth/main.cpp index 96c58203..3256ae52 100644 --- a/projects/sgauth/main.cpp +++ b/projects/sgauth/main.cpp @@ -49,8 +49,6 @@ const int winKOI = 0; IA_CLIENT_PROT * clnp; WEB * web = NULL; -using namespace std; - time_t stgTime; //----------------------------------------------------------------------------- @@ -61,13 +59,13 @@ void Usage() printf("sgauth \n"); } //----------------------------------------------------------------------------- -void SetDirName(const vector & dn, void *) +void SetDirName(const std::vector & dn, void *) { for (int j = 0; j < DIR_NUM; j++) { if (winKOI) { - string dir; + std::string dir; KOIToWin(dn[j], &dir); if (web) web->SetDirName(dir, j); @@ -90,13 +88,13 @@ void StatusChanged(int, void *) { } //----------------------------------------------------------------------------- -void ShowMessage(const string & message, int i, int, int, void *) +void ShowMessage(const std::string & message, int i, int, int, void *) { if (web) web->AddMessage(message, i); } //----------------------------------------------------------------------------- -void ShowError(const string & message, int, void *) +void ShowError(const std::string & message, int, void *) { if (web) web->AddMessage(message, 0); @@ -106,20 +104,20 @@ void CatchUSR1(int) { if (clnp->GetAuthorized()) { - cout << "Connect" << endl; + std::cout << "Connect" << std::endl; clnp->Connect(); } } //----------------------------------------------------------------------------- void CatchUSR2(int) { -cout << "Disconnect" << endl; +std::cout << "Disconnect" << std::endl; clnp->Disconnect(); } //----------------------------------------------------------------------------- void CatchTERM(int) { -cout << "Terminated" << endl; +std::cout << "Terminated" << std::endl; clnp->Disconnect(); sleep(2); exit(0); @@ -200,7 +198,7 @@ if (settings.GetDaemon()) } } -clnp = new IA_CLIENT_PROT(settings.GetServerName(), settings.GetServerPort(), settings.GetLocalPort()); +clnp = new IA_CLIENT_PROT(settings.GetServerName(), settings.GetServerPort(), settings.GetLocalName(), settings.GetLocalPort()); if (!settings.GetNoWeb()) { @@ -239,7 +237,8 @@ clnp->Connect(); while (1) { - usleep(200000); + struct timespec ts = {0, 200000000}; + nanosleep(&ts, NULL); char state[20];