From fb6e4bdd980f72082a264894c12ed7e0650a5bf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bert=20M=C3=BCnnich?= Date: Thu, 22 Aug 2013 09:44:14 +0200 Subject: [PATCH] Only print marked files when -o is given Fallback to print all files, if no images are marked, was kind of irritating. --- Makefile | 2 +- README.md | 2 +- commands.c | 4 ++-- sxiv.1 | 8 ++++---- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 03edc66..f45b2d4 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -VERSION = git-20130810 +VERSION = git-20130822 PREFIX = /usr/local MANPREFIX = $(PREFIX)/share/man diff --git a/README.md b/README.md index 918e6a5..fe0711d 100644 --- a/README.md +++ b/README.md @@ -79,7 +79,7 @@ of small previews is displayed, making it easy to choose an image to open. -i Read file list from stdin -n NUM Start at picture NUM -N NAME Set X window resource name to NAME - -o Write list of marked/all files to stdout when quitting + -o Write list of marked files to stdout when quitting -p Pixelize, i.e. turn off image anti-aliasing -q Be quiet, disable warnings -r Search given directories recursively for images diff --git a/commands.c b/commands.c index c1792a5..501a938 100644 --- a/commands.c +++ b/commands.c @@ -61,9 +61,9 @@ bool it_quit(arg_t a) { unsigned int i; - if (options->to_stdout) { + if (options->to_stdout && markcnt > 0) { for (i = 0; i < filecnt; i++) { - if (!markcnt || files[i].marked) + if (files[i].marked) printf("%s\n", files[i].name); } } diff --git a/sxiv.1 b/sxiv.1 index 02593b1..8a03404 100644 --- a/sxiv.1 +++ b/sxiv.1 @@ -62,10 +62,10 @@ Print brief usage information to standard output and exit. Read names of files to open from standard input. .TP .B \-o -Write list of all marked files, or all opened files if no files are marked, to -standard output when quitting. If combined with -.IR \-i , -then sxiv acts as a visual filter/pipe. +Write list of all marked files to standard output when quitting. In combination +with +.I \-i +sxiv can be used as a visual filter/pipe. .TP .B \-p Pixelize images, i.e. turn off anti-aliasing.