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