summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--commands.c2
-rw-r--r--nsxiv.h1
-rw-r--r--options.c7
3 files changed, 8 insertions, 2 deletions
diff --git a/commands.c b/commands.c
index aad2c3c..15859fa 100644
--- a/commands.c
+++ b/commands.c
@@ -59,7 +59,7 @@ bool cg_quit(arg_t _)
if (options->to_stdout && markcnt > 0) {
for (i = 0; i < filecnt; i++) {
if (files[i].flags & FF_MARK)
- printf("%s\n", files[i].name);
+ printf("%s%c", files[i].name, options->stdout_separator);
}
}
exit(EXIT_SUCCESS);
diff --git a/nsxiv.h b/nsxiv.h
index 0a3bff1..be7ffe6 100644
--- a/nsxiv.h
+++ b/nsxiv.h
@@ -268,6 +268,7 @@ struct opt {
char **filenames;
bool from_stdin;
bool to_stdout;
+ char stdout_separator;
bool recursive;
int filecnt;
int startnum;
diff --git a/options.c b/options.c
index 31cfa39..d46bac8 100644
--- a/options.c
+++ b/options.c
@@ -52,6 +52,7 @@ void parse_options(int argc, char **argv)
_options.from_stdin = false;
_options.to_stdout = false;
+ _options.stdout_separator = '\n';
_options.recursive = false;
_options.startnum = 0;
@@ -75,7 +76,7 @@ void parse_options(int argc, char **argv)
_options.clean_cache = false;
_options.private_mode = false;
- while ((opt = getopt(argc, argv, "A:abce:fG:g:hin:N:opqrS:s:T:tvZz:")) != -1) {
+ while ((opt = getopt(argc, argv, "A:abce:fG:g:hin:N:0opqrS:s:T:tvZz:")) != -1) {
switch (opt) {
case '?':
print_usage();
@@ -128,6 +129,10 @@ void parse_options(int argc, char **argv)
case 'N':
_options.res_name = optarg;
break;
+ case '0':
+ _options.stdout_separator = '\0';
+ /* -0 implies -o */
+ /* fall through */
case 'o':
_options.to_stdout = true;
break;