aboutsummaryrefslogtreecommitdiffstats
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
parentb404312686874e539b617d1f27ccbaa5a82936af (diff)
downloadserd-6ffe331cfc8af0735b263ab7af6f84b1b4418102.tar.gz
serd-6ffe331cfc8af0735b263ab7af6f84b1b4418102.tar.bz2
serd-6ffe331cfc8af0735b263ab7af6f84b1b4418102.zip
Make tools read stdin by default
-rw-r--r--doc/serd-filter.12
-rw-r--r--doc/serd-sort.14
-rw-r--r--test/meson.build22
-rw-r--r--tools/serd-filter.c7
-rw-r--r--tools/serd-pipe.c5
-rw-r--r--tools/serd-sort.c7
6 files changed, 15 insertions, 32 deletions
diff --git a/doc/serd-filter.1 b/doc/serd-filter.1
index 44b3f861..983c1969 100644
--- a/doc/serd-filter.1
+++ b/doc/serd-filter.1
@@ -15,7 +15,7 @@
.Op Fl k Ar bytes
.Op Fl o Ar filename
.Ar pattern
-.Ar input ...
+.Op Ar input ...
.Sh DESCRIPTION
.Nm
scans for statements in RDF data.
diff --git a/doc/serd-sort.1 b/doc/serd-sort.1
index 2d019ae3..350d70cd 100644
--- a/doc/serd-sort.1
+++ b/doc/serd-sort.1
@@ -12,11 +12,9 @@
.Op Fl O Ar syntax
.Op Fl b Ar bytes
.Op Fl c Ar collation
-.Op Fl f Ar pattern_file
.Op Fl k Ar bytes
.Op Fl o Ar filename
-.Ar pattern
-.Ar input ...
+.Op Ar input ...
.Sh DESCRIPTION
.Nm
reorders statements in RDF data by loading everything into memory then rewriting it.
diff --git a/test/meson.build b/test/meson.build
index 9830a1dd..c0ed56e4 100644
--- a/test/meson.build
+++ b/test/meson.build
@@ -81,9 +81,7 @@ if is_variable('serd_pipe')
# Basic invalid arguments
bad_args = [
- ['-B', 'nonuriorpath'],
['-B'],
- ['-I', 'turtle'],
['-I', 'unknown'],
['-I'],
['-O', 'unknown'],
@@ -112,12 +110,6 @@ if is_variable('serd_pipe')
suite: ['tools', 'pipe', 'options'])
endforeach
- test('none',
- tool,
- env: test_env,
- should_fail: true,
- suite: ['tools', 'pipe', 'options'])
-
test('remote',
tool,
args: ['ftp://unsupported.org'],
@@ -287,12 +279,6 @@ if is_variable('serd_sort')
suite: ['tools', 'sort', 'options'])
endforeach
- test('none',
- tool,
- env: test_env,
- should_fail: true,
- suite: ['tools', 'sort', 'options'])
-
# IO errors
test('read_dir',
@@ -343,7 +329,6 @@ if is_variable('serd_filter')
bad_args = [
['-f', '/no/such/file.nt', '-'],
['-z'],
- ['?s ?p ?o .'],
]
foreach args : bad_args
@@ -381,13 +366,6 @@ if is_variable('serd_filter')
# Different input sources
- test('missing_input',
- tool,
- args: ['?s ?p ?o .', '/does/not/exist.ttl'],
- env: test_env,
- should_fail: true,
- suite: ['tools', 'filter', 'input'])
-
test('filter_dir',
tool,
args: ['?s ?p ?o .', meson.source_root()],
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