From c9803e4ca6534ffb9ff9f5c892e3e9705b327245 Mon Sep 17 00:00:00 2001 From: Maxim Mamontov Date: Thu, 7 Apr 2011 17:30:47 +0300 Subject: [PATCH 1/1] Unused modules removed from srvconf lib --- stglibs/srvconf.lib/test.cpp | 171 ----------------------------------- stglibs/srvconf.lib/test.sh | 1 - 2 files changed, 172 deletions(-) delete mode 100644 stglibs/srvconf.lib/test.cpp delete mode 100755 stglibs/srvconf.lib/test.sh diff --git a/stglibs/srvconf.lib/test.cpp b/stglibs/srvconf.lib/test.cpp deleted file mode 100644 index 092ffce6..00000000 --- a/stglibs/srvconf.lib/test.cpp +++ /dev/null @@ -1,171 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * Author : Boris Mikhailenko - */ - - /* - $Revision: 1.6 $ - $Date: 2008/02/09 16:22:18 $ - $Author: nobunaga $ - */ - -#include -#include -#include "servconf.h" - -//----------------------------------------------------------------------------- -void RecvUserData(USERDATA * ud, void * d) -{ -// ôÕÔ ×Ù×ÏÄÉÔÓÑ ÞÁÓÔØ ÉÎÆÙ Ï ÐÏÌØÚÏ×ÁÔÅÌÅ, ÎÏ × ud ÐÅÒÅÄÁÅÔÓÑ ×ÓÑ ÉÎÆÁ -printf("login: %s password :%s cash:%8.2f ip:%16s\n", ud->login, ud->password, ud->cash, ud->ips); -} -//----------------------------------------------------------------------------- -void RecvServerInfoData(SERVERINFO * si, void * d) -{ -// ôÕÔ ÔÏÖÅ ÔÏÌØËÏ ÞÁÓÔØ ÉÎÆÙ ×Ù×ÏÄÉÔÓÑ ÎÁ ÜËÒÁÎ -printf("uname: %20s\n", si->uname); -printf("version: %20s\n", si->version); -printf("users: %20d\n", si->usersNum); -for (int i = 0; i < DIR_NUM; i++) - { - printf("dir name 1: >%16s<\n", si->dirName[i]); - } -} -//----------------------------------------------------------------------------- -int RecvSetUserAnswer(const char * ans, void * d) -{ -printf("ans=%s\n", ans); -if (strcasecmp("Ok", ans) == 0) - *((bool*)d) = true; -else - *((bool*)d) = false; - -return 0; -} -//----------------------------------------------------------------------------- -int RecvCheckUserAnswer(const char * ans, void * d) -{ -if (strcmp("Ok", ans) == 0) - *((bool*)d) = true; -else - *((bool*)d) = false; -return 0; -} -//----------------------------------------------------------------------------- -int RecvSendMessageAnswer(const char * ans, void * d) -{ -if (strcasecmp("Ok", ans) == 0) - *((bool*)d) = true; -else - *((bool*)d) = false; -return 0; -} -//----------------------------------------------------------------------------- -int main() -{ -SERVCONF sc; -int ret; -bool userExist = false; -bool result = false; - -sc.SetServer("127.0.0.1"); // õÓÔÁÎÁ×ÌÉ×ÁÅÍ ÉÍÑ ÓÅÒ×ÅÒÁ Ó ËÏÔÏÒÇÏ ÚÁÂÉÒÁÔØ ÉÎÆÕ -sc.SetPort(5555); // ÁÄÍÉÎÓËÉÊ ÐÏÒÔ ÓÅÒ×ÅÒÁÐÏÒÔ -sc.SetAdmLogin("admin"); // ÷ÙÓÔÁ×ÌÑÅÍ ÌÏÇÉÎ É ÐÁÒÏÌØ ÁÄÍÉÎÁ -sc.SetAdmPassword("123456"); - -sc.SetUserDataRecvCb(RecvUserData, NULL); // óÔÁ×ÉÍ ËÏÌÂÜË-ÆÕÎËÃÉÉ, ËÏÔÏÒÙÅ -sc.SetGetUserDataRecvCb(RecvUserData, NULL); // GET USER -sc.SetServerInfoRecvCb(RecvServerInfoData, NULL); // ÂÕÄÕÔ ×ÙÚ×ÁÎÙ ÐÒÉ ÐÏÌÕÞÅÎÉÉ ÉÎÆÏÒÍÁÃÉÉ Ó ÓÅÒ×ÅÒÁ -sc.SetChgUserCb(RecvSetUserAnswer, &userExist); -sc.SetCheckUserCb(RecvCheckUserAnswer, &userExist); -sc.SetSendMessageCb(RecvSendMessageAnswer, &result); -printf("--------------- GetServerInfo ---------------\n"); -ret = sc.GetServerInfo(); // úÁÐÒÁÛÉ×ÁÅÍ ÉÎÆÕ Ï ÓÅÒ×ÅÒÅ. üÔÏ ÍÏÖÎÏ ÉÓÐÏÌØÚÏ×ÁÔØ -if (ret != st_ok) // ÄÌÑ ÐÒÏ×ÅÒËÉ ÌÏÇÉÎÁ É ÐÁÒÏÌÑ ÁÄÍÉÎÁ - { - printf("error %d %s\n", ret, sc.GetStrError()); - return 0; - } - -/*printf("--------------- GetUsers ---------------\n"); -ret = sc.GetUsers(); // úÁÐÒÁÛÉ×ÁÅÍ ÉÎÆÕ Ï ÐÏÌØÚÏ×ÁÔÅÌÅ -if (ret != st_ok) - { - printf("error %d %s\n", ret, sc.GetStrError()); - return 0; - }*/ - -printf("--------------- SendMessage ---------------\n"); -ret = sc.SendMessage("zubr11", "test", 0); // -if (ret != st_ok) - { - printf("error %d %s\n", ret, sc.GetStrError()); - return 0; - } -if (result) - printf("SendMessage ok\n"); -else - printf("SendMessage failed\n"); - -return 0; - -printf("--------------- GetUser ---------------\n"); -ret = sc.GetUser("test"); // úÁÐÒÁÛÉ×ÁÅÍ ÉÎÆÕ Ï ÐÏÌØÚÏ×ÁÔÅÌÅ -if (ret != st_ok) - { - printf("error %d %s\n", ret, sc.GetStrError()); - return 0; - } - -return 0; - -printf("--------------- CheckUser ---------------\n"); -sc.CheckUser("test", "123456"); -if (userExist) - printf("login - ok\n"); -else - printf("login failed\n"); - -printf("--------------- ChgUser ON ---------------\n"); -char req[1024]; -sprintf(req, " " - " " - " " - " " - ""); -sc.ChgUser(req); -if (userExist) - printf("chg user ok\n"); -else - printf("chg user error\n"); - -printf("--------------- ChgUser OFF ---------------\n"); -sprintf(req, " " - " " - " "); - -sc.ChgUser(req); -if (userExist) - printf("chg user ok\n"); -else - printf("chg user error\n"); - -return 0; -} -//----------------------------------------------------------------------------- - diff --git a/stglibs/srvconf.lib/test.sh b/stglibs/srvconf.lib/test.sh deleted file mode 100755 index 95b99137..00000000 --- a/stglibs/srvconf.lib/test.sh +++ /dev/null @@ -1 +0,0 @@ -gcc -g3 test.cpp -L../../lib ./libsrvconf.a -lexpat ../../lib/libstg_common.so ../../lib/libstg_crypto.so -I../../include -- 2.44.2