X-Git-Url: http://git.plutz.net/?p=serve0;a=blobdiff_plain;f=list.sh;h=b941aa7f246d32a3a9e5ff09c0ee509e9ebd2b30;hp=ccb91393dec2821f375cf797f485b86a772dafa0;hb=HEAD;hpb=47009795c4998f1571a6f97de463d43f73defdc4 diff --git a/list.sh b/list.sh index ccb9139..94a9264 100755 --- a/list.sh +++ b/list.sh @@ -6,7 +6,6 @@ list_item() { local meta file link name - eval "$LOCAL_META" if [ "${META_NAME%/}" != "${META_NAME}" ]; then printf '[a .list .dir href="%s?%s" . %s]' \ @@ -56,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}/}" @@ -157,16 +156,20 @@ list_paginate() { local page i c n end qry page="$(GET p |grep -axE '[0-9]+' || printf 1)"; c=1 end=$((page + LISTSIZE)) + eval "$LOCAL_META" # localize vars from db_meta 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 ']'