aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--commands.c2
-rw-r--r--main.c2
-rw-r--r--nsxiv.14
-rw-r--r--nsxiv.h2
-rw-r--r--options.c5
5 files changed, 7 insertions, 8 deletions
diff --git a/commands.c b/commands.c
index 3bfb28f..cab44ee 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%c", files[i].name, options->stdout_separator);
+ printf("%s%c", files[i].name, options->using_null ? '\0' : '\n');
}
}
exit(EXIT_SUCCESS);
diff --git a/main.c b/main.c
index e16f5ac..4cd9a33 100644
--- a/main.c
+++ b/main.c
@@ -547,7 +547,7 @@ void run_key_handler(const char *key, unsigned int mask)
for (f = i = 0; f < fcnt; i++) {
if ((marked && (files[i].flags & FF_MARK)) || (!marked && i == fileidx)) {
stat(files[i].path, &oldst[f]);
- fprintf(pfs, "%s\n", files[i].name);
+ fprintf(pfs, "%s%c", files[i].name, options->using_null ? '\0' : '\n');
f++;
}
}
diff --git a/nsxiv.1 b/nsxiv.1
index 04228a9..fd84bc0 100644
--- a/nsxiv.1
+++ b/nsxiv.1
@@ -127,8 +127,8 @@ The same as `\-z 100'.
Set zoom level to ZOOM percent.
.TP
.B \-0
-Same as \-o, however the marked files are NULL separated. This option implies
-\-o.
+Use NULL-separator. With this option output of \-o and file-list sent to the
+key-handler will be seperated by a NULL character.
.SH KEYBOARD COMMANDS
.SS General
The following keyboard commands are available in both image and thumbnail mode:
diff --git a/nsxiv.h b/nsxiv.h
index 06f5300..e38460a 100644
--- a/nsxiv.h
+++ b/nsxiv.h
@@ -256,7 +256,7 @@ struct opt {
char **filenames;
bool from_stdin;
bool to_stdout;
- char stdout_separator;
+ bool using_null;
bool recursive;
int filecnt;
int startnum;
diff --git a/options.c b/options.c
index d9eb59d..2d313de 100644
--- a/options.c
+++ b/options.c
@@ -52,7 +52,7 @@ void parse_options(int argc, char **argv)
_options.from_stdin = false;
_options.to_stdout = false;
- _options.stdout_separator = '\n';
+ _options.using_null = false;
_options.recursive = false;
_options.startnum = 0;
@@ -181,8 +181,7 @@ void parse_options(int argc, char **argv)
_options.zoom = (float) n / 100.0;
break;
case '0':
- _options.stdout_separator = '\0';
- _options.to_stdout = true; /* -0 implies -o */
+ _options.using_null = true;
break;
}
}