Port Scanner
Lightweight TCP port scanner for Linux
Loading...
Searching...
No Matches
printer.cpp
#include <iostream>
#include "printer.hpp"
int main() {
std::cout << Printer::isTerminal() << '\n';
try {
std::vector<std::pair<port_t, bool>> ports{{80, true}, {443, false}};
} catch (std::bad_alloc &e) {
std::cerr << "Memory allocation failed: " << e.what() << '\n';
return 1;
} catch (std::system_error &e) {
std::cerr << "System error: " << e.what() << '\n';
return 2;
} catch (...) {
std::cerr << "Unexpected error occurred.\n";
return -1;
}
}
static void print(std::vector< std::pair< port_t, bool > > const &ports)
Prints to stdout the formated information about the ports accessibility.
Definition printer.cpp:11
static bool isTerminal() noexcept
Checks if stdout is connected to a terminal.
Definition printer.cpp:7
int main(int argc, char *argv[])
Definition main.cpp:6