1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-09-15 00:37:19 +02:00

Major plugin refactor and cleanup.

Switched to POCO library for unified platform/library interface.
Deprecated the external module API. It was creating more problems than solving.
Removed most built-in libraries in favor of system libraries for easier maintenance.
Cleaned and secured code with help from static analyzers.
This commit is contained in:
Sandu Liviu Catalin
2021-01-30 08:51:39 +02:00
parent e0e34b4030
commit 4a6bfc086c
6219 changed files with 1209835 additions and 454916 deletions

View File

@@ -0,0 +1,63 @@
//
// dict.cpp
//
// This sample demonstrates the StreamSocket and SocketStream classes.
//
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#include "Poco/Net/StreamSocket.h"
#include "Poco/Net/SocketStream.h"
#include "Poco/Net/SocketAddress.h"
#include "Poco/StreamCopier.h"
#include "Poco/Path.h"
#include "Poco/Exception.h"
#include <iostream>
using Poco::Net::StreamSocket;
using Poco::Net::SocketStream;
using Poco::Net::SocketAddress;
using Poco::StreamCopier;
using Poco::Path;
using Poco::Exception;
int main(int argc, char** argv)
{
const std::string HOST("dict.org");
const unsigned short PORT = 2628;
if (argc != 2)
{
Path p(argv[0]);
std::cout << "usage: " << p.getBaseName() << " <term>" << std::endl;
std::cout << " looks up <term> in dict.org and prints the results" << std::endl;
return 1;
}
std::string term(argv[1]);
try
{
SocketAddress sa(HOST, PORT);
StreamSocket sock(sa);
SocketStream str(sock);
str << "DEFINE ! " << term << "\r\n" << std::flush;
str << "QUIT\r\n" << std::flush;
sock.shutdownSend();
StreamCopier::copyStream(str, std::cout);
}
catch (Exception& exc)
{
std::cerr << exc.displayText() << std::endl;
return 1;
}
return 0;
}