]> git.stg.codes - stg.git/blobdiff - projects/sgconf_xml/main.cpp
stg-2.409 pre-merge.
[stg.git] / projects / sgconf_xml / main.cpp
index 751a7537bbe32a022923af8be4ac9e025ea84804..2d8975733e02e14076ba382d1406881ec76af658 100644 (file)
@@ -33,9 +33,9 @@ $Date: 2008/01/05 12:11:34 $
 #include <arpa/inet.h>
 #include <string.h>
 
+#include "stg/common.h"
+#include "stg/netunit.h"
 #include "request.h"
-#include "common.h"
-#include "netunit.h"
 
 #define FN_LEN          (512)
 #define REQ_STR_LEN     (300)
@@ -108,7 +108,7 @@ void CreateRequest(REQUEST * req, char * r)
 char str[10024];
 r[0] = 0;
 
-if (!req->strReq.res_empty())
+if (!req->strReq.empty())
     {
     sprintf(str, "%s", req->strReq.const_data().c_str());
     strcat(r, str);
@@ -135,13 +135,12 @@ if (!req->strReq.res_empty())
 //-----------------------------------------------------------------------------
 int Process(REQUEST * r)
 {
-char errorMsg[MAX_ERR_STR_LEN];
 int ret;
 char str[2048];
 
 NETTRANSACT nt;
 nt.SetServer(r->server.const_data().c_str());
-nt.SetServerPort(r->port);
+nt.SetServerPort(r->port.const_data());
 nt.SetLogin(r->admLogin.const_data().c_str());
 nt.SetPassword(r->admPasswd.const_data().c_str());
 nt.SetRxCallback(NULL, ParseReply);
@@ -150,20 +149,17 @@ CreateRequest(r, str);
 
 if ((ret = nt.Connect()) != st_ok)
     {
-    strncpy(errorMsg, nt.GetError(), MAX_ERR_STR_LEN);
-    printf("%s", errorMsg);
+    printf("%s\n", nt.GetError().c_str());
     return ret;
     }
 if ((ret = nt.Transact(str)) != st_ok)
     {
-    strncpy(errorMsg, nt.GetError(), MAX_ERR_STR_LEN);
-    printf("%s", errorMsg);
+    printf("%s\n", nt.GetError().c_str());
     return ret;
     }
 if ((ret = nt.Disconnect()) != st_ok)
     {
-    strncpy(errorMsg, nt.GetError(), MAX_ERR_STR_LEN);
-    printf("%s", errorMsg);
+    printf("%s\n", nt.GetError().c_str());
     return ret;
     }
 
@@ -173,13 +169,13 @@ return 0;
 //-----------------------------------------------------------------------------
 int CheckParameters(REQUEST * req)
 {
-int a = !req->admLogin.res_empty()
-        && !req->admPasswd.res_empty()
-        && !req->server.res_empty()
-        && !req->port.res_empty();
+int a = !req->admLogin.empty()
+        && !req->admPasswd.empty()
+        && !req->server.empty()
+        && !req->port.empty();
 
-int b = !req->fileReq.res_empty()
-        || !req->strReq.res_empty();
+int b = !req->fileReq.empty()
+        || !req->strReq.empty();
 
 return a && b;
 }