~exec64/imv

8935fafb409bd58b1f6bfe21a5868b91d699b746 — n3f4s 1 year, 26 days ago 72bda97
Add limit for looking through STDIN
1 files changed, 5 insertions(+), 0 deletions(-)

M src/imv.c
M src/imv.c => src/imv.c +5 -0
@@ 940,6 940,7 @@ int imv_run(struct imv *imv)

  if (imv->starting_path) {
    if (imv->paths_from_stdin) {
      int max_tries = 1000;
      bool is_number = true;
      for(int i=0; i<strlen(imv->starting_path); ++i) {
        if (!isdigit(imv->starting_path[i])) {


@@ 953,6 954,9 @@ int imv_run(struct imv *imv)
      }
      bool cont = true;
      while (cont) {
        if (max_tries <= 0) {
          cont = false;
        }
        imv_window_pump_events(imv->window, event_handler, imv);
        if (index == -1) {
          ssize_t img_index = imv_navigator_find_path(imv->navigator, imv->starting_path);


@@ 966,6 970,7 @@ int imv_run(struct imv *imv)
            cont = false;
          }
        }
        max_tries -= 1;
      }
    } else {
      ssize_t index = imv_navigator_find_path(imv->navigator, imv->starting_path);