2021-12-09 15:06:45 +01:00
// 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.
2018-07-09 04:34:08 +02:00
# include <iostream>
2018-08-08 03:04:32 +02:00
# include <cstdlib>
2018-07-09 04:34:08 +02:00
2021-12-09 15:06:45 +01:00
int main ( int argc , char * argv [ ] )
{
if ( argc < 2 )
{
2018-07-09 04:34:08 +02:00
std : : cerr < < " Wrong number of arguments " < < std : : endl ;
2018-08-08 03:04:32 +02:00
std : : abort ( ) ;
2018-07-09 04:34:08 +02:00
}
2021-12-09 15:06:45 +01:00
for ( int i = 2 ; i < argc ; + + i )
{
std : : cout < < argv [ i ] < < " \n " ;
}
2018-07-09 04:34:08 +02:00
2023-07-08 23:48:59 +02:00
const int exit_status = static_cast < int > ( std : : strtol ( argv [ 1 ] , nullptr , 10 ) ) ;
2018-07-09 04:34:08 +02:00
return exit_status ;
}