mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-02-14 16:57:12 +01:00
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.
63 lines
965 B
C++
63 lines
965 B
C++
//
|
|
// TestApp.cpp
|
|
//
|
|
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
|
|
// and Contributors.
|
|
//
|
|
// SPDX-License-Identifier: BSL-1.0
|
|
//
|
|
|
|
|
|
#if defined(_WIN32)
|
|
#define _CRT_SECURE_NO_DEPRECATE
|
|
#endif
|
|
|
|
|
|
#include <string>
|
|
#include <iostream>
|
|
#include <cstdlib>
|
|
#include <signal.h>
|
|
|
|
|
|
int main(int argc, char** argv)
|
|
{
|
|
if (argc > 1)
|
|
{
|
|
std::string arg(argv[1]);
|
|
if (arg == "-hello")
|
|
{
|
|
std::cout << "Hello, world!";
|
|
}
|
|
else if (arg == "-count")
|
|
{
|
|
int n = 0;
|
|
int c = std::cin.get();
|
|
while (c != -1) { ++n; c = std::cin.get(); }
|
|
return n;
|
|
}
|
|
else if (arg == "-env")
|
|
{
|
|
const char* s = std::getenv("TESTENV");
|
|
if (s)
|
|
{
|
|
std::cout << s;
|
|
return 0;
|
|
}
|
|
else return 1;
|
|
}
|
|
else if (arg == "-raise-int")
|
|
{
|
|
signal(SIGINT, SIG_DFL);
|
|
raise(SIGINT);
|
|
}
|
|
else if (arg == "-echo-args")
|
|
{
|
|
for (int i = 2; i < argc; ++i)
|
|
{
|
|
std::cout << argv[i] << std::endl;
|
|
}
|
|
}
|
|
}
|
|
return argc - 1;
|
|
}
|