-0 sends NULL separated file-list to key-handler
with this change `-0` is turned into a more generic switch which can be used to send NULL-separated file-list to the key-handler as well. this also means `-0` no longer implicitly enables `-o` Closes: https://github.com/nsxiv/nsxiv/issues/140
This commit is contained in:
parent
8934744c60
commit
d0b5005a02
|
@ -59,7 +59,7 @@ bool cg_quit(arg_t _)
|
||||||
if (options->to_stdout && markcnt > 0) {
|
if (options->to_stdout && markcnt > 0) {
|
||||||
for (i = 0; i < filecnt; i++) {
|
for (i = 0; i < filecnt; i++) {
|
||||||
if (files[i].flags & FF_MARK)
|
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);
|
exit(EXIT_SUCCESS);
|
||||||
|
|
2
main.c
2
main.c
|
@ -547,7 +547,7 @@ void run_key_handler(const char *key, unsigned int mask)
|
||||||
for (f = i = 0; f < fcnt; i++) {
|
for (f = i = 0; f < fcnt; i++) {
|
||||||
if ((marked && (files[i].flags & FF_MARK)) || (!marked && i == fileidx)) {
|
if ((marked && (files[i].flags & FF_MARK)) || (!marked && i == fileidx)) {
|
||||||
stat(files[i].path, &oldst[f]);
|
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++;
|
f++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
4
nsxiv.1
4
nsxiv.1
|
@ -127,8 +127,8 @@ The same as `\-z 100'.
|
||||||
Set zoom level to ZOOM percent.
|
Set zoom level to ZOOM percent.
|
||||||
.TP
|
.TP
|
||||||
.B \-0
|
.B \-0
|
||||||
Same as \-o, however the marked files are NULL separated. This option implies
|
Use NULL-separator. With this option output of \-o and file-list sent to the
|
||||||
\-o.
|
key-handler will be seperated by a NULL character.
|
||||||
.SH KEYBOARD COMMANDS
|
.SH KEYBOARD COMMANDS
|
||||||
.SS General
|
.SS General
|
||||||
The following keyboard commands are available in both image and thumbnail mode:
|
The following keyboard commands are available in both image and thumbnail mode:
|
||||||
|
|
2
nsxiv.h
2
nsxiv.h
|
@ -256,7 +256,7 @@ struct opt {
|
||||||
char **filenames;
|
char **filenames;
|
||||||
bool from_stdin;
|
bool from_stdin;
|
||||||
bool to_stdout;
|
bool to_stdout;
|
||||||
char stdout_separator;
|
bool using_null;
|
||||||
bool recursive;
|
bool recursive;
|
||||||
int filecnt;
|
int filecnt;
|
||||||
int startnum;
|
int startnum;
|
||||||
|
|
|
@ -52,7 +52,7 @@ void parse_options(int argc, char **argv)
|
||||||
|
|
||||||
_options.from_stdin = false;
|
_options.from_stdin = false;
|
||||||
_options.to_stdout = false;
|
_options.to_stdout = false;
|
||||||
_options.stdout_separator = '\n';
|
_options.using_null = false;
|
||||||
_options.recursive = false;
|
_options.recursive = false;
|
||||||
_options.startnum = 0;
|
_options.startnum = 0;
|
||||||
|
|
||||||
|
@ -181,8 +181,7 @@ void parse_options(int argc, char **argv)
|
||||||
_options.zoom = (float) n / 100.0;
|
_options.zoom = (float) n / 100.0;
|
||||||
break;
|
break;
|
||||||
case '0':
|
case '0':
|
||||||
_options.stdout_separator = '\0';
|
_options.using_null = true;
|
||||||
_options.to_stdout = true; /* -0 implies -o */
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue