aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2022-01-14 01:43:37 -0500
committerDavid Robillard <d@drobilla.net>2022-01-28 21:57:07 -0500
commit6ffe331cfc8af0735b263ab7af6f84b1b4418102 (patch)
tree42dd2f5b2f04798421f9c489cf65a72b7564b87b /tools
parentb404312686874e539b617d1f27ccbaa5a82936af (diff)
downloadserd-6ffe331cfc8af0735b263ab7af6f84b1b4418102.tar.gz
serd-6ffe331cfc8af0735b263ab7af6f84b1b4418102.tar.bz2
serd-6ffe331cfc8af0735b263ab7af6f84b1b4418102.zip
Make tools read stdin by default
Diffstat (limited to 'tools')
-rw-r--r--tools/serd-filter.c7
-rw-r--r--tools/serd-pipe.c5
-rw-r--r--tools/serd-sort.c7
3 files changed, 13 insertions, 6 deletions
diff --git a/tools/serd-filter.c b/tools/serd-filter.c
index 789d3149..6cf8e0e7 100644
--- a/tools/serd-filter.c
+++ b/tools/serd-filter.c
@@ -244,6 +244,9 @@ parse_option(OptionIter* const iter, Options* const opts)
int
main(int argc, char** argv)
{
+ char default_input[] = "-";
+ char* default_inputs[] = {default_input};
+
Options opts = {{"",
NULL,
4096u,
@@ -274,8 +277,8 @@ main(int argc, char** argv)
opts.inputs = argv + iter.a;
opts.n_inputs = argc - iter.a;
if (opts.n_inputs == 0) {
- fprintf(stderr, "%s: missing input\n", argv[0]);
- return print_usage(argv[0], true);
+ opts.n_inputs = 1;
+ opts.inputs = default_inputs;
}
// Don't add prefixes to blank node labels if there is only one input
diff --git a/tools/serd-pipe.c b/tools/serd-pipe.c
index 75b3e0d4..25efb54f 100644
--- a/tools/serd-pipe.c
+++ b/tools/serd-pipe.c
@@ -168,7 +168,8 @@ parse_option(OptionIter* const iter, Options* const opts)
int
main(const int argc, char* const* const argv)
{
- char* const default_input[] = {"-"};
+ char default_input[] = "-";
+ char* default_inputs[] = {default_input};
Options opts = {{"",
NULL,
@@ -197,7 +198,7 @@ main(const int argc, char* const* const argv)
opts.n_inputs = argc - iter.a;
if (opts.n_inputs + (bool)opts.input_string == 0) {
opts.n_inputs = 1;
- opts.inputs = default_input;
+ opts.inputs = default_inputs;
}
// Don't add prefixes to blank node labels if there is only one input
diff --git a/tools/serd-sort.c b/tools/serd-sort.c
index deb79cb5..8ba99445 100644
--- a/tools/serd-sort.c
+++ b/tools/serd-sort.c
@@ -234,6 +234,9 @@ parse_option(OptionIter* const iter, Options* const opts)
int
main(const int argc, char* const* const argv)
{
+ char default_input[] = "-";
+ char* default_inputs[] = {default_input};
+
Options opts = {{"",
NULL,
4096u,
@@ -261,8 +264,8 @@ main(const int argc, char* const* const argv)
opts.inputs = argv + iter.a;
opts.n_inputs = argc - iter.a;
if (opts.n_inputs + (bool)opts.input_string == 0) {
- fprintf(stderr, "%s: missing input\n", argv[0]);
- return print_usage(argv[0], true);
+ opts.n_inputs = 1;
+ opts.inputs = default_inputs;
}
// Don't add prefixes to blank node labels if there is only one input