|
|
@ -2,10 +2,17 @@ |
|
|
|
|
|
|
|
|
|
|
|
myname="$0" |
|
|
|
myname="$0" |
|
|
|
fetchcmd=curl |
|
|
|
fetchcmd=curl |
|
|
|
filter=cat |
|
|
|
|
|
|
|
hostarg="" |
|
|
|
hostarg="" |
|
|
|
eval cast=\${$#} |
|
|
|
eval cast=\${$#} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if tail -r /dev/null > /dev/null 2>&1; then |
|
|
|
|
|
|
|
filter="tail -r" |
|
|
|
|
|
|
|
elif tac /dev/null > /dev/null 2>&1; then |
|
|
|
|
|
|
|
filter=tac |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
echo "Don't know how to reverse feed! Defaulting to feed order" |
|
|
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
args=$(getopt fih $*) |
|
|
|
args=$(getopt fih $*) |
|
|
|
if [ $? -ne 0 ]; then |
|
|
|
if [ $? -ne 0 ]; then |
|
|
@ -18,14 +25,7 @@ while [ "$1" != -- ]; do |
|
|
|
case "$1" in |
|
|
|
case "$1" in |
|
|
|
-f) fetchcmd=cat ;; |
|
|
|
-f) fetchcmd=cat ;; |
|
|
|
-i) |
|
|
|
-i) |
|
|
|
if tail -r /dev/null > /dev/null 2>&1; then |
|
|
|
filter=cat |
|
|
|
filter="tail -r" |
|
|
|
|
|
|
|
elif tac /dev/null > /dev/null 2>&1; then |
|
|
|
|
|
|
|
filter=tac |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
echo "Don't know how to reverse order!" |
|
|
|
|
|
|
|
exit 1 |
|
|
|
|
|
|
|
fi |
|
|
|
|
|
|
|
;; |
|
|
|
;; |
|
|
|
-h) |
|
|
|
-h) |
|
|
|
hostarg="--host=$3" |
|
|
|
hostarg="--host=$3" |
|
|
@ -36,7 +36,7 @@ done |
|
|
|
shift |
|
|
|
shift |
|
|
|
|
|
|
|
|
|
|
|
if [ $# -lt 3 ]; then |
|
|
|
if [ $# -lt 3 ]; then |
|
|
|
$fetchcmd $cast|grep "<enclosure url"|sed "s/^.*url=//"|cut -d'"' -f2|$filter|mpc $hostarg add |
|
|
|
$fetchcmd $cast|grep "<enclosure.*url"|sed "s/^.*url=//"|cut -d'"' -f2|$filter|mpc $hostarg add |
|
|
|
else |
|
|
|
else |
|
|
|
echo $0 $1 $2 $3 $4 $5 |
|
|
|
echo $0 $1 $2 $3 $4 $5 |
|
|
|
echo "Usage: $myname [-fih] linktorss" >&2 |
|
|
|
echo "Usage: $myname [-fih] linktorss" >&2 |
|
|
|