Added new functions.
authorfredrik <fredrik@959494ce-11ee-0310-bf91-de5d638817bd>
Sun, 25 Dec 2005 18:00:03 +0000 (18:00 +0000)
committerfredrik <fredrik@959494ce-11ee-0310-bf91-de5d638817bd>
Sun, 25 Dec 2005 18:00:03 +0000 (18:00 +0000)
git-svn-id: svn+ssh://svn.dolda2000.com/srv/svn/repos/src/doldaconnect@538 959494ce-11ee-0310-bf91-de5d638817bd

config/dc-filtercmd

index 96444eb..b452e7d 100755 (executable)
@@ -40,3 +40,76 @@ if [ "$cmd" = rmtag ]; then
        fi
     done
 fi
+
+if [ "$cmd" = remain ]; then
+    for f in "$HOME"/dc/resume/*.info; do
+       if [ ! -r "$f" ]; then
+           continue
+       fi
+       unset "${!dcarg_@}"
+       . "$f"
+       resfile="${f%.info}"
+       for id in "$@"; do
+           idt="${id%%:*}"
+           idd="${id#*:}"
+           match=n
+           if [ "$idt" = size ]; then
+               if [ "$idd" -eq "$filesize" ]; then
+                   match=y
+               fi
+           elif [ "$idt" = hash ]; then
+               if [ "$idd" = "$dcarg_hash" ]; then
+                   match=y
+               fi
+           elif [ "$idt" = all ]; then
+               match=y
+           fi
+           if [ "$match" = y ]; then
+               rfrem="$(wc -c <"$resfile" | sed 's/ //g')"
+               echo "size:$filesize"
+               echo "prog:$rfrem"
+               echo "name:$origname"
+               if [ -n "$dcarg_hash" ]; then
+                   echo "hash:$dcarg_hash"
+               fi
+           fi
+       done
+    done
+fi
+
+if [ "$cmd" = lsres ]; then
+    for f in "$HOME"/dc/resume/*.info; do
+       if [ ! -r "$f" ]; then
+           continue
+       fi
+       . "$f"
+       resfile="${f%.info}"
+       rfrem="$(wc -c <"$resfile" | sed 's/ //g')"
+       echo "id:${resfile##*/}"
+       echo "size:$filesize"
+       echo "prog:$rfrem"
+       echo "name:$origname"
+       if [ -e "${resfile}.lock" ]; then
+           echo "lock:yes"
+       else
+           echo "lock:no"
+       fi
+       if [ -n "$dcarg_hash" ]; then
+           echo "hash:$dcarg_hash"
+       fi
+    done
+fi
+
+if [ "$cmd" = rmres ]; then
+    resfile="$HOME/dc/resume/$1"
+    if [ ! -r "${resfile}.info" ]; then
+       echo "err:notfound"
+       exit
+    fi
+    if [ -e "${resfile}.lock" ]; then
+       echo "err:locked"
+       exit
+    fi
+    rm -f "$resfile" "${resfile}.info"
+    echo "ok"
+fi