This repository has been archived by the owner on Jan 16, 2023. It is now read-only.
[feature request] Load all images in the same folder #179
Comments
causes-
changed the title
[feature request] Load all images in same folder
[feature request] Load all images in the same folder
Oct 12, 2014
sxiv is designed for command line users. Please use a wrapper script for that. Google
|
It would be good if diff --git a/options.c b/options.c
index de02407..b9ca468 100644
--- a/options.c
+++ b/options.c
@@ -45,6 +45,7 @@ void parse_options(int argc, char **argv)
int n, opt;
char *end, *s;
const char *scalemodes = "dfwh";
+ char *opt_n = NULL; /* -n (starting picture number) can be index or filename */
progname = strrchr(argv[0], '/');
progname = progname ? progname + 1 : argv[0];
@@ -117,10 +118,7 @@ void parse_options(int argc, char **argv)
_options.from_stdin = true;
break;
case 'n':
- n = strtol(optarg, &end, 0);
- if (*end != '\0' || n <= 0)
- error(EXIT_FAILURE, 0, "Invalid argument for option -n: %s", optarg);
- _options.startnum = n - 1;
+ opt_n = optarg;
break;
case 'N':
_options.res_name = optarg;
@@ -172,6 +170,21 @@ void parse_options(int argc, char **argv)
_options.filenames = argv + optind;
_options.filecnt = argc - optind;
+ if (opt_n != NULL) {
+ for (n = 0; n < _options.filecnt; n++) {
+ if (strcmp(_options.filenames[n], opt_n) == 0)
+ break;
+ }
+ if (n < _options.filecnt) {
+ _options.startnum = n;
+ } else {
+ n = strtol(opt_n, &end, 0);
+ if (*end != '\0' || n <= 0)
+ error(EXIT_FAILURE, 0, "Invalid argument for option -n: %s", optarg);
+ _options.startnum = n - 1;
+ }
+ }
+
if (_options.filecnt == 1 && STREQ(_options.filenames[0], "-")) {
_options.filenames++;
_options.filecnt--; EDIT: Just noticed that there is already a pull request (#371). |
My workaround for this: |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
If i click a picture in filemanager it opens only the clicked picture. I would really like to see feature to load all pictures in the same folder so i could browse through the pictures.
The text was updated successfully, but these errors were encountered: