summaryrefslogtreecommitdiffstats
path: root/options.c
diff options
context:
space:
mode:
authorBert <ber.t@gmx.com>2011-01-30 22:00:58 +0100
committerBert <ber.t@gmx.com>2011-01-30 22:00:58 +0100
commit229830ad188fc520da56bfa8a3b8e0da3744c799 (patch)
tree172092091b6486bb592a2034724c4f7d5cf85d6c /options.c
parentc937570bbe61985f632db2b9285232453a8b8ee5 (diff)
downloadnsxiv-229830ad188fc520da56bfa8a3b8e0da3744c799.tar.zst
Replace -w with well-known geometry option
Diffstat (limited to 'options.c')
-rw-r--r--options.c28
1 files changed, 6 insertions, 22 deletions
diff --git a/options.c b/options.c
index 1bcfbe1..3a76120 100644
--- a/options.c
+++ b/options.c
@@ -29,7 +29,7 @@ options_t _options;
const options_t *options = (const options_t*) &_options;
void print_usage() {
- printf("usage: sxiv [-dfhpsvWZ] [-w WIDTH[xHEIGHT]] [-z ZOOM] FILES...\n");
+ printf("usage: sxiv [-dfhpsvWZ] [-g GEOMETRY] [-z ZOOM] FILES...\n");
}
void print_version() {
@@ -38,7 +38,6 @@ void print_version() {
}
void parse_options(int argc, char **argv) {
- unsigned short w, h;
float z;
int opt;
@@ -46,13 +45,12 @@ void parse_options(int argc, char **argv) {
_options.zoom = 1.0;
_options.aa = 1;
- _options.winw = w = 0;
- _options.winh = h = 0;
_options.fullscreen = 0;
+ _options.geometry = NULL;
_options.warn = 0;
- while ((opt = getopt(argc, argv, "dfhpsvWw:Zz:")) != -1) {
+ while ((opt = getopt(argc, argv, "dfg:hpsvWZz:")) != -1) {
switch (opt) {
case '?':
print_usage();
@@ -63,6 +61,9 @@ void parse_options(int argc, char **argv) {
case 'f':
_options.fullscreen = 1;
break;
+ case 'g':
+ _options.geometry = optarg;
+ break;
case 'h':
print_usage();
exit(0);
@@ -78,16 +79,6 @@ void parse_options(int argc, char **argv) {
case 'W':
_options.warn = 1;
break;
- case 'w':
- if (!sscanf(optarg, "%hux%hu", &w, &h)) {
- fprintf(stderr, "sxiv: invalid argument for option -w: %s\n",
- optarg);
- exit(1);
- } else {
- _options.winw = (int) w;
- _options.winh = (int) h;
- }
- break;
case 'Z':
_options.scalemode = SCALE_ZOOM;
_options.zoom = 1.0;
@@ -105,13 +96,6 @@ void parse_options(int argc, char **argv) {
}
}
- if (!_options.winw) {
- _options.winw = WIN_WIDTH;
- _options.winh = WIN_HEIGHT;
- } else if (!_options.winh) {
- _options.winh = _options.winw;
- }
-
_options.filenames = (const char**) argv + optind;
_options.filecnt = argc - optind;
}