2020-01-18 09:38:21 +01:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
|
|
|
*
|
2021-04-22 01:24:48 -07:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-01-18 09:38:21 +01:00
|
|
|
*/
|
|
|
|
|
2020-07-29 04:13:43 +04:30
|
|
|
#include <LibCore/ArgsParser.h>
|
2019-04-25 04:42:09 +02:00
|
|
|
#include <stdio.h>
|
2020-02-18 10:47:23 +01:00
|
|
|
#include <unistd.h>
|
2019-04-25 04:42:09 +02:00
|
|
|
|
|
|
|
int main(int argc, char** argv)
|
|
|
|
{
|
2020-02-18 10:47:23 +01:00
|
|
|
if (pledge("stdio", nullptr) < 0) {
|
|
|
|
perror("pledge");
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2020-07-29 04:13:43 +04:30
|
|
|
Vector<const char*> values;
|
|
|
|
bool no_trailing_newline = false;
|
|
|
|
|
|
|
|
Core::ArgsParser args_parser;
|
|
|
|
args_parser.add_option(no_trailing_newline, "Do not output a trailing newline", nullptr, 'n');
|
|
|
|
args_parser.add_positional_argument(values, "Values to print out", "string", Core::ArgsParser::Required::No);
|
|
|
|
args_parser.parse(argc, argv);
|
|
|
|
|
|
|
|
for (size_t i = 0; i < values.size(); ++i) {
|
|
|
|
fputs(values[i], stdout);
|
|
|
|
if (i != values.size() - 1)
|
2019-04-25 04:42:09 +02:00
|
|
|
fputc(' ', stdout);
|
|
|
|
}
|
2020-07-29 04:13:43 +04:30
|
|
|
if (!no_trailing_newline)
|
|
|
|
printf("\n");
|
2019-04-25 04:42:09 +02:00
|
|
|
return 0;
|
|
|
|
}
|