Replaced option -W with -q, seems more natural

This commit is contained in:
Bert 2011-01-30 22:23:36 +01:00
parent 3d8efb21d5
commit f0e9ec733a
5 changed files with 15 additions and 16 deletions

View file

@ -35,9 +35,9 @@ sxiv supports the following command-line options:
-g GEOMETRY set window position and size -g GEOMETRY set window position and size
(see section GEOMETRY SPECIFICATIONS of X(7)) (see section GEOMETRY SPECIFICATIONS of X(7))
-p pixelize, i.e. turn off image anti-aliasing -p pixelize, i.e. turn off image anti-aliasing
-q be quiet, disable warnings
-s scale all images to fit into window -s scale all images to fit into window
-v print version information and exit -v print version information and exit
-W enable printing of warnings
-Z same as `-z 100' -Z same as `-z 100'
-z ZOOM scale all images to current zoom level, use ZOOM at startup -z ZOOM scale all images to current zoom level, use ZOOM at startup

View file

@ -29,7 +29,7 @@ options_t _options;
const options_t *options = (const options_t*) &_options; const options_t *options = (const options_t*) &_options;
void print_usage() { void print_usage() {
printf("usage: sxiv [-dfhpsvWZ] [-g GEOMETRY] [-z ZOOM] FILES...\n"); printf("usage: sxiv [-dfhpqsvZ] [-g GEOMETRY] [-z ZOOM] FILES...\n");
} }
void print_version() { void print_version() {
@ -48,9 +48,9 @@ void parse_options(int argc, char **argv) {
_options.fullscreen = 0; _options.fullscreen = 0;
_options.geometry = NULL; _options.geometry = NULL;
_options.warn = 0; _options.quiet = 0;
while ((opt = getopt(argc, argv, "dfg:hpsvWZz:")) != -1) { while ((opt = getopt(argc, argv, "dfg:hpqsvZz:")) != -1) {
switch (opt) { switch (opt) {
case '?': case '?':
print_usage(); print_usage();
@ -70,15 +70,15 @@ void parse_options(int argc, char **argv) {
case 'p': case 'p':
_options.aa = 0; _options.aa = 0;
break; break;
case 'q':
_options.quiet = 1;
break;
case 's': case 's':
_options.scalemode = SCALE_FIT; _options.scalemode = SCALE_FIT;
break; break;
case 'v': case 'v':
print_version(); print_version();
exit(0); exit(0);
case 'W':
_options.warn = 1;
break;
case 'Z': case 'Z':
_options.scalemode = SCALE_ZOOM; _options.scalemode = SCALE_ZOOM;
_options.zoom = 1.0; _options.zoom = 1.0;

View file

@ -32,7 +32,7 @@ typedef struct options_s {
unsigned char fullscreen; unsigned char fullscreen;
char *geometry; char *geometry;
unsigned char warn; unsigned char quiet;
} options_t; } options_t;
extern const options_t *options; extern const options_t *options;

13
sxiv.1
View file

@ -3,10 +3,9 @@
sxiv \- Simple (or small or suckless) X Image Viewer sxiv \- Simple (or small or suckless) X Image Viewer
.SH SYNOPSIS .SH SYNOPSIS
.B sxiv .B sxiv
.RB [ \-dfhpsvWZ ] .RB [ \-dfhpqsvZ ]
.RB [ \-w .RB [ \-g
.IB WIDTH x HEIGHT .IR GEOMETRY ]
]
.RB [ \-z .RB [ \-z
.IR ZOOM ] .IR ZOOM ]
.IR FILE ... .IR FILE ...
@ -35,15 +34,15 @@ Print brief usage information to standard output and exit.
.B \-p .B \-p
Pixelize images, i.e. turn off anti-aliasing. Pixelize images, i.e. turn off anti-aliasing.
.TP .TP
.B \-q
Be quiet, disable warnings to standard error stream.
.TP
.B \-s .B \-s
Scale all images to fit into window. Scale all images to fit into window.
.TP .TP
.B \-v .B \-v
Print version information to standard output and exit. Print version information to standard output and exit.
.TP .TP
.B \-W
Enable printing of warnings to standard error stream.
.TP
.B \-Z .B \-Z
The same as `-z 100'. The same as `-z 100'.
.TP .TP

2
sxiv.h
View file

@ -28,7 +28,7 @@
#define WARN(...) \ #define WARN(...) \
do { \ do { \
if (options->warn) { \ if (!options->quiet) { \
fprintf(stderr, "sxiv: %s:%d: warning: ", __FILE__, __LINE__); \ fprintf(stderr, "sxiv: %s:%d: warning: ", __FILE__, __LINE__); \
fprintf(stderr, __VA_ARGS__); \ fprintf(stderr, __VA_ARGS__); \
fprintf(stderr, "\n"); \ fprintf(stderr, "\n"); \