diff options
-rwxr-xr-x | examples/find-lowres | 17 | ||||
-rw-r--r-- | src/feh.h | 2 | ||||
-rw-r--r-- | src/slideshow.c | 4 |
3 files changed, 13 insertions, 10 deletions
diff --git a/examples/find-lowres b/examples/find-lowres index 4a7d9a9..ac77e7b 100755 --- a/examples/find-lowres +++ b/examples/find-lowres @@ -1,4 +1,4 @@ -#!/usr/bin/env zsh +#!/bin/sh # Recursively find images below a certain resolution # # Usage: find-lowres [-r] [directory [dimension]] @@ -10,20 +10,23 @@ remove=0 -while [[ $1 == -* ]]; do +while true +do case $1 in -r) remove=1 ;; + -*) echo "option \"$1\" ignored" ;; -|--) shift; break ;; + *) break ;; esac shift done -base=${1-.} -dimension=${2-1000x800} +dir=${1:-.} +dimension=${2:-1000x800} -if (( remove )) +if [ "$remove" = "1" ] then - feh --action 'rm %F' -rlV --max-dim ${dimension} ${base} + feh --action 'rm %F' -rlV --max-dim "${dimension}" "${dir}" else - feh -rlV --max-dim ${dimension} ${base} + feh -rlV --max-dim "${dimension}" "${dir}" fi @@ -152,7 +152,7 @@ void feh_event_handle_stdin(); void feh_event_handle_generic(winwidget winwid, unsigned int state, KeySym keysym, unsigned int button); fehkey *feh_str_to_kb(char * action); void feh_action_run(feh_file * file, char *action, winwidget winwid); -char *format_size(int size); +char *format_size(double size); char *feh_printf(char *str, feh_file * file, winwidget winwid); void im_weprintf(winwidget w, char *fmt, ...); void feh_draw_zoom(winwidget w); diff --git a/src/slideshow.c b/src/slideshow.c index 145ced1..ac8c545 100644 --- a/src/slideshow.c +++ b/src/slideshow.c @@ -445,7 +445,7 @@ void feh_action_run(feh_file * file, char *action, winwidget winwid) return; } -char *format_size(int size) +char *format_size(double size) { static char ret[5]; char units[] = {' ', 'k', 'M', 'G', 'T'}; @@ -454,7 +454,7 @@ char *format_size(int size) size /= 1000; postfix++; } - snprintf(ret, 5, "%3d%c", size, units[postfix]); + snprintf(ret, 5, "%3.0f%c", size, units[postfix]); return ret; } |