]> git.plutz.net Git - serve0/blobdiff - list.sh
Merge commit 'b931bbd0c30907b9cc956d3707b26b449bf41f76'
[serve0] / list.sh
diff --git a/list.sh b/list.sh
index b57e4e45369aad090375bfa7b423453efc2d853b..94a926465f40f161474b4ef364ab7f1744065c3e 100755 (executable)
--- 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 ']'