X-Git-Url: http://git.plutz.net/?p=serve0;a=blobdiff_plain;f=list.sh;h=b941aa7f246d32a3a9e5ff09c0ee509e9ebd2b30;hp=b57e4e45369aad090375bfa7b423453efc2d853b;hb=HEAD;hpb=d530d1d96264df5d7684eac1be32c41beec48311 diff --git a/list.sh b/list.sh index b57e4e4..94a9264 100755 --- a/list.sh +++ b/list.sh @@ -55,7 +55,7 @@ list_item() { )" list_fullname(){ - local short="$(UNSTRING "${1%${CR}}")" file + local short="$1" file file="$(printf %s\\n "$_DATA/$ITEM/$short".*)" file="${file%%${BR}*}" [ -e "$file" ] && printf %s\\n "${file#${_DATA}/${ITEM}/}" @@ -160,13 +160,16 @@ list_paginate() { printf '[div .itemlist ' while :; do - c=$((c + 1)) - if [ $c -gt $page -a $c -le $end ]; then + if [ $c -lt $page ]; then + read -r discard || break + elif [ $c -ge $end ]; then + c=$((c + $(wc -l) )) + break + else read_meta || break list_item - else - read -r discard || break fi + c=$((c + 1)) done printf ']'