-time_t stgTime;
-
-struct option long_options_get[] = {
-{"server", 1, 0, 's'}, //Server
-{"port", 1, 0, 'p'}, //Port
-{"admin", 1, 0, 'a'}, //Admin
-{"admin_pass", 1, 0, 'w'}, //passWord
-{"user", 1, 0, 'u'}, //User
-{"addcash", 0, 0, 'c'}, //Add Cash
-//{"setcash", 0, 0, 'v'}, //Set Cash
-{"credit", 0, 0, 'r'}, //cRedit
-{"tariff", 0, 0, 't'}, //Tariff
-{"message", 0, 0, 'm'}, //message
-{"password", 0, 0, 'o'}, //password
-{"down", 0, 0, 'd'}, //down
-{"passive", 0, 0, 'i'}, //passive
-{"disable-stat",0, 0, 'S'}, //disable detail stat
-{"always-online",0, 0, 'O'}, //always online
-{"session-upload", 1, 0, 500}, //SU0
-{"session-download", 1, 0, 501}, //SD0
-{"month-upload", 1, 0, 502}, //MU0
-{"month-download", 1, 0, 503}, //MD0
-
-{"user-data", 1, 0, 700}, //UserData0
-
-{"prepaid", 0, 0, 'e'}, //prepaid traff
-{"create", 0, 0, 'n'}, //create
-{"delete", 0, 0, 'l'}, //delete
-
-{"note", 0, 0, 'N'}, //Note
-{"name", 0, 0, 'A'}, //nAme
-{"address", 0, 0, 'D'}, //aDdress
-{"email", 0, 0, 'L'}, //emaiL
-{"phone", 0, 0, 'P'}, //phone
-{"group", 0, 0, 'G'}, //Group
-{"ip", 0, 0, 'I'}, //IP-address of user
-{"authorized-by",0, 0, 800}, //always online
-
-{0, 0, 0, 0}};
-
-struct option long_options_set[] = {
-{"server", 1, 0, 's'}, //Server
-{"port", 1, 0, 'p'}, //Port
-{"admin", 1, 0, 'a'}, //Admin
-{"admin_pass", 1, 0, 'w'}, //passWord
-{"user", 1, 0, 'u'}, //User
-{"addcash", 1, 0, 'c'}, //Add Cash
-{"setcash", 1, 0, 'v'}, //Set Cash
-{"credit", 1, 0, 'r'}, //cRedit
-{"tariff", 1, 0, 't'}, //Tariff
-{"message", 1, 0, 'm'}, //message
-{"password", 1, 0, 'o'}, //password
-{"down", 1, 0, 'd'}, //down
-{"passive", 1, 0, 'i'}, //passive
-{"disable-stat",1, 0, 'S'}, //disable detail stat
-{"always-online",1, 0, 'O'}, //always online
-{"session-upload", 1, 0, 500}, //U0
-{"session-download", 1, 0, 501}, //U1
-{"month-upload", 1, 0, 502}, //U2
-{"month-download", 1, 0, 503}, //U3
-
-{"user-data", 1, 0, 700}, //UserData
-
-{"prepaid", 1, 0, 'e'}, //prepaid traff
-{"create", 1, 0, 'n'}, //create
-{"delete", 1, 0, 'l'}, //delete
-
-{"note", 1, 0, 'N'}, //Note
-{"name", 1, 0, 'A'}, //nAme
-{"address", 1, 0, 'D'}, //aDdress
-{"email", 1, 0, 'L'}, //emaiL
-{"phone", 1, 0, 'P'}, //phone
-{"group", 1, 0, 'G'}, //Group
-{"ip", 0, 0, 'I'}, //IP-address of user
-
-{0, 0, 0, 0}};
-
-//-----------------------------------------------------------------------------
-CASH_INFO ParseCash(const char * str)
-{
-//-c 123.45:log message
-std::string cashString;
-std::string message;
-const char * pos = strchr(str, ':');
-if (pos != NULL)
- {
- cashString.append(str, pos);
- message.append(pos + 1);
- }
-else
- cashString = str;
-
-double cash = 0;
-if (strtodouble2(cashString, cash) != 0)
- {
- printf("Incorrect cash value %s\n", str);
- exit(PARAMETER_PARSING_ERR_CODE);
- }
-
-return CASH_INFO(cash, message);
-}
-//-----------------------------------------------------------------------------
-double ParseCredit(const char * c)
-{
-double credit;
-if (strtodouble2(c, credit) != 0)
- {
- printf("Incorrect credit value %s\n", c);
- exit(PARAMETER_PARSING_ERR_CODE);
- }
-
-return credit;
-}
-//-----------------------------------------------------------------------------
-double ParsePrepaidTraffic(const char * c)
-{
-double credit;
-if (strtodouble2(c, credit) != 0)
- {
- printf("Incorrect prepaid traffic value %s\n", c);
- exit(PARAMETER_PARSING_ERR_CODE);
- }
-
-return credit;
-}
-//-----------------------------------------------------------------------------
-int64_t ParseTraff(const char * c)
-{
-int64_t traff;
-if (str2x(c, traff) != 0)
- {
- printf("Incorrect credit value %s\n", c);
- exit(PARAMETER_PARSING_ERR_CODE);
- }
-
-return traff;
-}
-//-----------------------------------------------------------------------------
-bool ParseDownPassive(const char * dp)
-{
-if (!(dp[1] == 0 && (dp[0] == '1' || dp[0] == '0')))
- {
- printf("Incorrect value %s\n", dp);
- exit(PARAMETER_PARSING_ERR_CODE);
- }
-
-return dp[0] - '0';
-}
-//-----------------------------------------------------------------------------
-void ParseTariff(const char * str, RESETABLE<std::string> & tariffName, RESETABLE<std::string> & nextTariff)
-{
-const char * pos = strchr(str, ':');
-if (pos != NULL)
- {
- std::string tariff(str, pos);
- if (strcmp(pos + 1, "now") == 0)
- tariffName = tariff;
- else if (strcmp(pos + 1, "delayed") == 0)
- nextTariff = tariff;
- else
- {
- printf("Incorrect tariff value '%s'. Should be '<tariff>', '<tariff>:now' or '<tariff>:delayed'.\n", str);
- exit(PARAMETER_PARSING_ERR_CODE);
- }
- }
-else
- tariffName = str;
-}
-//-----------------------------------------------------------------------------
-time_t ParseCreditExpire(const char * str)
-{
-struct tm brokenTime;
-
-brokenTime.tm_wday = 0;
-brokenTime.tm_yday = 0;
-brokenTime.tm_isdst = 0;
-brokenTime.tm_hour = 0;
-brokenTime.tm_min = 0;
-brokenTime.tm_sec = 0;
-
-stg_strptime(str, "%Y-%m-%d", &brokenTime);
-
-return stg_timegm(&brokenTime);
-}