libcryfs/test/cpp-utils/process/exit_status.cpp
Sebastian Messmer 9ccb006f61 - Switch some CI jobs to clang 15
- Fix clang-tidy warnings from Clang 15
2023-07-08 14:48:59 -07:00

22 lines
499 B
C++

// This is a small executable that exits with the exit status in its first argument and before exiting prints all other arguments, each on a separate line.
#include <iostream>
#include <cstdlib>
int main(int argc, char *argv[])
{
if (argc < 2)
{
std::cerr << "Wrong number of arguments" << std::endl;
std::abort();
}
for (int i = 2; i < argc; ++i)
{
std::cout << argv[i] << "\n";
}
const int exit_status = static_cast<int>(std::strtol(argv[1], nullptr, 10));
return exit_status;
}