#include <cstdio>
#include <cstring>
#include <string>
-#include <list>
#include <sstream>
#include "stg/common.h"
-#include "stg/netunit.h"
#include "request.h"
#include "common_sg.h"
#include "sg_error_codes.h"
time_t stgTime;
-int ParseReplyGet(void * data, list<string> * ans);
-//int ParseReplySet(void * data, list<string> * ans);
-
struct option long_options_get[] = {
{"server", 1, 0, 's'}, //Server
{"port", 1, 0, 'p'}, //Port
return CheckParameters(req);
}
//-----------------------------------------------------------------------------
-int mainGet(int argc, char **argv)
+bool mainGet(int argc, char **argv)
{
int c;
REQUEST req;
return ProcessGetUser(req.server, req.port, req.admLogin, req.admPasswd, req.login, req);
}
//-----------------------------------------------------------------------------
-int mainSet(int argc, char **argv)
+bool mainSet(int argc, char **argv)
{
string str;
memset(rstr, 0, rLen);
CreateRequestSet(&req, rstr);
-return ProcessSetUser(req.server, req.port, req.admLogin, req.admPasswd, rstr, isMessage);
+if (isMessage)
+ return ProcessSendMessage(req.server, req.port, req.admLogin, req.admPasswd, rstr);
+
+return ProcessSetUser(req.server, req.port, req.admLogin, req.admPasswd, rstr);
}
//-----------------------------------------------------------------------------
int main(int argc, char **argv)
else if (strcmp(argv[1], "set") == 0)
{
//printf("set\n");
- return mainSet(argc - 1, argv + 1);
+ if (mainSet(argc - 1, argv + 1) )
+ return 0;
+ return -1;
}
else
{