diff options
Diffstat (limited to 'options.c')
-rw-r--r-- | options.c | 19 |
1 files changed, 16 insertions, 3 deletions
@@ -18,6 +18,7 @@ #include "sxiv.h" #define _IMAGE_CONFIG +#define _TITLE_CONFIG #include "config.h" #include "version.h" @@ -31,8 +32,8 @@ const opt_t *options = (const opt_t*) &_options; void print_usage(void) { printf("usage: sxiv [-abcfhiopqrtvZ] [-A FRAMERATE] [-e WID] [-G GAMMA] " - "[-g GEOMETRY] [-N NAME] [-n NUM] [-S DELAY] [-s MODE] [-z ZOOM] " - "FILES...\n"); + "[-g GEOMETRY] [-N NAME] [-T TITLE] [-n NUM] [-S DELAY] [-s MODE] " + "[-z ZOOM] FILES...\n"); } void print_version(void) @@ -66,13 +67,15 @@ void parse_options(int argc, char **argv) _options.hide_bar = false; _options.geometry = NULL; _options.res_name = NULL; + _options.title_prefix = TITLE_PREFIX; + _options.title_suffixmode = TITLE_SUFFIXMODE; _options.quiet = false; _options.thumb_mode = false; _options.clean_cache = false; _options.private_mode = false; - while ((opt = getopt(argc, argv, "A:abce:fG:g:hin:N:opqrS:s:tvZz:")) != -1) { + while ((opt = getopt(argc, argv, "A:abce:fG:g:hin:N:opqrS:s:T:tvZz:")) != -1) { switch (opt) { case '?': print_usage(); @@ -149,6 +152,16 @@ void parse_options(int argc, char **argv) error(EXIT_FAILURE, 0, "Invalid argument for option -s: %s", optarg); _options.scalemode = s - scalemodes; break; + case 'T': + if ((s = strrchr(optarg, ':')) != NULL) { + *s = '\0'; + n = strtol(++s, &end, 0); + if (*end != '\0' || n < SUFFIX_EMPTY || n > SUFFIX_FULLPATH) + error(EXIT_FAILURE, 0, "Invalid argument for option -T suffixmode: %s", s); + _options.title_suffixmode = n; + } + _options.title_prefix = optarg; + break; case 't': _options.thumb_mode = true; break; |